LaTeX Tips and Tricks Collection
This post summarizes some common useful tips in LaTeX editing.
Figures
- Horizontal alignment of subfigures
subfloat
insubfig
% Style: Figure 1(a)
\usepackage[subrefformat=parens,labelformat=parens]{subfig}
\subfloat[]{
\includegraphics[height=\textheight]{example}
\label{fig:example}
}
\subref*{fig:example}
Bibliography
- How do I run bibtex after using the -output-directory flag with pdflatex, when files are included from subdirectories?
- biblatex simple usage
% unsrt, abbrev, last option means use unsrt in \cite[xxx,yyy,ccc]
\usepackage[sorting=none,firstinits=true,sortcites=true]{biblatex}
% add this in preamble
\bibliography{dsa-verification}
% at the end
\printbibliography
Graphics
- Graphics path
\graphicspath{{figs/}}
- Use other file extensions:
\DeclareGraphicsExtensions{.pdf, .jpg, .png}
Table and Tabular
- threeparttable: Use footnote in tabular
% 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
\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
- reduce space between float and text
\setlength{\textfloatsep}{10pt plus 1.0pt minus 2.0pt}
\setlength{\floatsep}{10pt plus 1.0pt minus 2.0pt}
\setlength{\intextsep}{10pt plus 1.0pt minus 2.0pt}
\setlength\bibitemsep{0.5\itemsep}
- geometry: control the margins at top, bottom, left and right
-
enumitem: control the spacing related to
enumerate
anditemize
. - LaTeX Tips n Tricks for Conference Papers
- Latex: Squeezing the Vertical White Space
- Squeezing Space in LaTeX
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
orarray
.
Comments