Skip to content

Instantly share code, notes, and snippets.

@qin-yu
Last active April 24, 2020 07:23
Show Gist options
  • Save qin-yu/3c212ade7ad674e283f0640dcdffee31 to your computer and use it in GitHub Desktop.
Save qin-yu/3c212ade7ad674e283f0640dcdffee31 to your computer and use it in GitHub Desktop.
Some Important Configurations in LaTex

Some Important Configurations in LaTex

Qin Yu, Apr 2020

Rules

  1. Label should always be after caption in figures
  2. With the setting of [!htb] you'll get the best results for figure placement
  3. Newline(s) between subfigure environment breaks side-by-side figures apart
  4. # has to be escaped, i.e. use \#, which is especially common in URLs
  5. The PDF bookmarks are a different thing than the table of contents. The bookmarks are not typeset by TeX: they simply are strings of characters, so no math or general formatting instructions are allowed. The easiest method to avoid the warnings is to use \texorpdfstring[*]:
    \subsubsection{Find an optimal \texorpdfstring{$\sigma$}{sigma}?}
    
  6. The standard tools to insert a LaTeX file into another are \input and \include, but these are prone to errors if nested file importing is needed. For this reason the recommended option is the package import. [*]

Notes

To add References section to TOC:

To add a link to the references section in the table of content, use:

\addcontentsline{toc}{section}{References}
\printbibliography  % This alone does not add a link to TOC

To solve more than 26 subfigure index:

\usepackage{alphalph}
\renewcommand\thesubfigure{\alphalph{\value{subfigure}}}

To add bibliography:

Biblatex is an easier and more flexible interface and a better language localization than bibtex and natbib.

\usepackage{biblatex}
\addbibresource{file1.bib}
\addbibresource{file2.bib}

\begin{document}
\printbibliography
\end{document}

To keep figures within its section

After each section:

\FloatBarrier

To get quote environment

\usepackage{csquotes}

\begin{displayquote}
Sé que tengo un ego del tamaño de un planeta pequeño, pero incluso yo a
veces me equivoco
\end{displayquote}

Set space between paragraphs, indentation in first line

\setlength{\parindent}{0em}
\setlength{\parskip}{1em}

. in file names causes error

More than one . before file extension? e.g.

\includegraphics[width=0.75\linewidth]{figures/figure.0.3.eps}

gives error Unknown graphics extension: .0.3.eps.

Solution

\usepackage{graphicx}
\usepackage{grffile}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment