LateX tips

Posted by MAW on July 10, 2017

Here are a few tips for Latex.

  • Include the following package to obtain \toprule and \midrule commands inside a latex document. booktabs package
\usepackage{booktabs}
  • To adjust the width of table, use adjustbox package which allows to force the table to the specified width
\usepackage{adjustbox}

Example usage :

\begin{table}
	\begin{adjustbox}{max width=\textwidth}
		\begin{tabular}{llrcr}
		\end{tabular}
	\end{adjustbox}
\end{table}
  • Just a reminder, the label in a figure or table applies to the caption so it should be put after the \caption command !
\caption{}
\label{}
  • To avoid an empty page after a \page or \chapter, simply add oneside in the documentclass options like :
\documentclass[oneside]{memoir}
  • To add abbreviations, use nomenclature package and follow the descriptions provide at the following link

  • To strike through (bar) the text, use this :

\usepackage[normalem]{ulem}
%if overlay is needed
\renewcommand<>{\sout}[1]{
\alt#2{\beameroriginal{\sout}{#1}}{#1}
}	
  • To delete headline on top of each frame in beamer, simply add
\setbeamertemplate{headline}{}
  • To add outline at the beginning of each section, just use the following code (tip found on link) :
\setbeamerfont{myTOC}{series=\bfseries,size=\Large}
\AtBeginSection[]{\frame{\frametitle{Outline}%
	   \usebeamerfont{myTOC}\tableofcontents[current]}}
  • To add source code in latex, use the link
  • Convert text with special characters into Latex recognized text, use the link
  • Spell checking .tex files …

aspell --lang=en --mode=tex check file.tex