LaTeX Tips and Tricks Collection

- - posted in LaTeX

This post summarizes some common useful tips in LaTeX editing.

Figures

  • Horizontal alignment of subfigures
  • subfloat in subfig
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    % Style: Figure 1(a)
    \usepackage[subrefformat=parens,labelformat=parens]{subfig}
    
    \subfloat[]{
    \includegraphics[height=\textheight]{example}
    \label{fig:example}
    }
    
    \subref*{fig:example}
    

Bibliography

Graphics

  • Graphics path
    1
    
    \graphicspath
    
  • Use other file extensions:
    1
    
    \DeclareGraphicsExtensions{.pdf, .jpg, .png}
    

Table and Tabular

  • threeparttable: Use footnote in tabular
    1
    2
    3
    4
    5
    6
    7
    
    % inside tabular:
    \tnote{$\dagger$}
    
    % after tabular
    \begin{tablenotes}[para] % do not break line between items
    \item [$\dagger$] A foot note. % this reference to the item
    \end{tablenotes}
    

Theorem, Definition

  • New definition/theorem
    1
    
    \newtheorem{definition}{Definition}
    
  • Useful packages:
    • ntheorem
    • amsthm

Fonts

Packages

  • csvsimple: can automatically read csv and create tabular.
  • algpseudocode: the most updated algorithm / code environment, need to sit inside with algorithm package.
  • biblatex: provides better control for Bibliography.
  • multirow: provides \multirow and \multicolumn.
  • url: provides \url.
  • xspace: prevent a command eating space.
  • flushend: provides \flushend, balance two columns.

Controlling space

Commands and tools:

  • latexmk: automatically compile multiple times to resolve reference.
  • biber: replacement for bibtex for biblatex
  • texdoc: use texdoc <package> to search for a manual.

IEEE

  • proof: use \IEEEproof
  • multiple equations: use \IEEEeqnarray or array.

Uncategorized

Comments