Wednesday, February 3, 2010

Some LaTeX tips

- Useful commands
  • \footnote{} for adding footnotes in text (numbered)
  • \titlenote{} for adding footnotes to titles, subtitles etc. (*, dagger etc.)
  • \bibliographystyle{abbrv} to get short author names in the References
  • \bibliography{<.bib file>}
  • \fbox{} for enclosing text within a box 
  • To get a new line/line break after the paragraph title, use \paragraph{}\<space>\\
  • To hyperlink text, use \href{}{link text} (uses thepackage hyperref)
- About \begin{figure}
  • \begin{figure/table}[h] - the [h] will try to force the figure/table to appear at that place in the text
  • \epsfig{file=sth.eps, scale=0.25} - quick way to include .eps image.
  • Ensure that label comes immediately after caption, i.e. stick to the order: \caption{}\label{}\end{figure} when including figure. [Updated]
- Numbering parts of figures
  • Add \usepackage{subfig}
  • Put \subfloat[]{ \label{} \epsfig{}} \subfloat{...} ... within \begin{figure} ... \end{figure}
- About table/tabular
  • Use \begin{center}\begin{tabular}... if u dont need full-fledged table
  • If u have \begin{tabular}{|c|c||c|c|c|}, use \multicolumn{2}{|c||}{text} & \multicolumn{3}{|c|}to merge the first 2 and the next 3 columns.
  • Use longtable instead of tabular to allow the table to be split over two pages.
- For multiple authors, use this -
auth1 \and auth2 \and auth3 \and auth4 \and

\email{\texttt{\{auth1,auth2, auth3, auth4\}}}
-To spell check TeX files, use command ispell <.tex file>.


  1. One more important tip: I encountered a problem with the numbering of figures. The figure numbers were in order of appearance, as usual, but while referring to any figure, the number displayed was '1'. That is, it would say ... as shown in figure 1 ... for any figure I referred to.

    The solution is to have the label written just in front of the caption. For example,


  2. Thanks Govind! I have updated the post.