edit this page - page history - about editing


Latex is both a great typesetting system which separates presentation from content, and also makes it as difficult as machinely possible to let you properly present your content.

  1. A Crude Latex Diff Script in Linux
  2. Images in Latex
  3. SVG in Latex
  4. Vertical Spacing in Latex Tables
  5. Horizonal Spacing in Latex Tables
  6. A reference of different types of bibliography styles in Latex
  7. Comprehensive Latex Symbol List
  8. My Latex Setup
  9. Changing the Default Font for the Report documentclass in Latex
  10. Removing the Coloured Boxes around Hyperref links in Latex
  11. Eclipse Pygments Style
  12. Labelled Frames in Latex
  13. Changing list indent, spacing, etc, using enumitem
  14. Aligning Images in Tables in Latex
  15. Fancy Quotation Boxes in Latex
  16. Unrecoverable Error in ps2ascii when using Inkscape images
  17. Aligning table cells vertically center in LaTeX
  18. Adding UML Guillemots in Latex and Adding Special Symbols to Minted Environments
  19. Enumerate List Environment Whitespace in Latex
  20. Maximum Width of Table Captions in LaTeX
  21. Capital Letter Headings for Index in LaTeX with makeindex
  22. addcontentsline Doesn't Work in LaTeX
  23. Incompatible List can't be Unboxed in LaTeX
  24. Controlling the Whitespace and Layout of LaTeX Table of Contents
  25. Delicious Icon More Latex bookmarks on delicious
My extensions to Pygments to support code formatting and highlighting for various lanuages in Latex:
  1. Eclipse Pygments Style
  2. Lexers
    1. Drools Pygments Lexer
    2. Crocopat Pygments Lexer
    3. OCL Pygments Lexer
    4. LTL Pygments Lexer
    5. Jess Pygments Lexer
    6. Jena Pygments Lexer
    7. Checks Pygments Style
    8. Xtend Pygments Style
    9. Alloy Pygments Style
    10. IDL Pygments Style
    11. OWL Functional Pygments Style

Here are some tips I've found when using Latex.


Using the natbib package, you can use these commands... see the natbib.sty file for more details:

\renewcommand{\cite}{\citep}    (makes \cite the same as \citep)
\cite{key}            => (Jones et al., 1990)
\citep{key}           => (Jones et al., 1990)
\citet{key}           => Jones et al. (1990)
\citep[pg. 34]{key}   => (Jones et al., 1990, pg. 34)
\citet[ABC:][]{key}   => (ABC: Jones et al., 1990)

Remove Date from Titlepage

When you use \maketitle, it uses the following attributes:

If you want to get rid of the date field, just add

Clickable Wrapped URLs in Bibtex Bibliography

Argh. For every hour you gain from abandoning Microsoft Word, you lose trying to configure Latex to do things that would otherwise be trivial.

If you are using the latex > dvips > ps2pdf compilation route for your documents, you may have problems trying to have URLs in your bibliography that are very long. One option is to manually wrap them yourself (using a space). However, this is better, put at the end of your .tex preamble:

% this package adds clickable links to http addresses and footnotes
% this package makes url's breakable with hyperref (but loses the cyan boxes)

Word Count in Latex

Just use this script somewhere in your compilation process:

ps2ascii file.pdf | wc -w

(source: http://www.wlug.org.nz/LatexWordcount)

Rotating Table Rows

Add this to the prelude:

% provides \rotatebox{}

% provides multirow

And then this to the table (this counts as one row):

\multirow{4}{*}{\rotatebox{90}{hi there}}
	& a \\
  & b \\
  & c \\
  & d \\

Changing the Font Size of a Table

Just add the font size line in the Table:


    .. table content ...

IEEE Formatting: 8.5 x 11-inch Proceedings Manuscripts

For some reason, IEEE does not provide a Latex version of this publication format on its FTP site. However, this Latex file covers most of the basics of the format: http://cisedu.us/storage/old/cts07/doc/latexformat.htm

-dEmbedAllFonts with ps2pdf

I was having difficulty adding this command-line parameter to the ps2pdf script call. It appears that the equals operator '=' is not supported; instead you should use hash '#':

ps2pdf -dEmbedAllFonts#true %1.ps %1.pdf >> create_pdf.log

Embedding all fonts with ps2pdf

I was having issue submitting an IEEE paper as they were saying that my fonts, Times-Roman, Times-Italic etc were not being embedded. The solution is to use the following command line to ps2pdf:

ps2pdf -dEmbedAllFonts#true -dSubsetFonts#true -dPDFSETTINGS#/prepress %1.ps %1.pdf >> create_pdf.log


Overriding and Re-using a Latex Command

If you try to re-use a renewed command like so, Latex will crash with (essentially) an infinite loop:

\renewcommand\foo{something \foo something}

As discussed by this document on extending Latex, you can use the primitive \let to save a "snapshot" of the current command:

\renewcommand\foo{something \oldFoo something}

Making all URLs in Helvetica

If you use the command
after the initial \begin{document}, all URLs in the document (as specified by \url{...}) will be rendered as a sans-serif font (i.e. Helvetica, or equivalent).

Tick and Cross Symbols

Creating output similar to the right, I found the following symbols worked well:


pdflatex vs dvipdfm vs dvips-ps2pdf

  1. pdflatex: I couldn't get it to work with the hyperref package (to make bookmarks in Adobe), and it cannot include EPS images.
  2. dvipdfm: I couldn't get it to work with the hyperref package (to make bookmarks in Adobe), and it threw a lot of warnings.
  3. dvips-ps2pdf: Not possible to create Tagged PDFs (I think), cannot handle JPEG, PNG images (etc) directly

Coloured Table Borders

If you have a normal table, you can make borders coloured by doing the following. It will also work with \hline and \cline:

\arrayrulecolor{green} %always at the beginning of a table row

If you are using \vline, this won't work; you need to wrap the \vline with the colour explicitly:


Cannot use -dPDFSETTINGS in Ghostscript

On Windows, you cannot use the = character in the command line; you need to use #. i.e.:

ps2pdf -dPDFSETTINGS#/prepress %1.ps %1.pdf

Bad Image Compression (JPEG-like) when using ps2pdf

I had a frequently-recurring problem that my generated PDFs were resampling and compressing many of the bitmap images in my PDF into JPEGs.

The solution was to tell Ghostscript to use prepress PDF settings.

@ (at sign) in LaTeX index

I wanted an index entry with an @ sign. After much stress, I found the man page for makeindex, and found one solution:

\index{"@@"@generated tag}

This will create an index entry named "@generated tag". I couldn't work out any way to also apply additional formatting, i.e. none of these worked:

\index{generated tag@$@$\texttt{generated} tag}
\index{"@@"@generated tag@\texttt{"@@"@generated} tag}
\index{"@@"@generated tag@\texttt{@generated} tag}
\index{"@@"@generated tag@"@@"\texttt{@generated} tag}

Perhaps if you read the makeindex documentation you might work it out Wink

Disabling Footnotes

It is fairly simple to remove all footnotes throughout your LaTeX document, just define the following command in the preamble:


Categories: Article | Programming | Latex
edit this page - what links to here? - page history - top
Last edited by jevon jevon 30 months ago