2014-02-18

LaTeX Cheat sheet

I am currently writing a long document in LaTeX and here is a small cheat sheet of functions that I use quite often:


To rescale tables/...

\resizebox{width}{height}{object} 
Needs package graphicx


\resizebox{\textwidth}{!}{...}


To create long table that has caption that splits over multiple pages

\begin{longtable}{P{.05\textwidth}P{.18\textwidth}P{.25\textwidth}P{.5\textwidth}}
 %%
   % Kopf erste Seite
        \caption[Short caption]{Looong caption.}\label{tab:mylabel} \\
        \toprule
                Nr. &  Nr2      &Example                 &  Description\\
        \midrule
        \endfirsthead
% Kopf weitere Seiten
        \caption[]{\emph{(Continued)}} \\

         \toprule
               Nr. &  Title      &Example                 &  Description\\
        \midrule
        \endhead

1&2&3&4\\
 
\bottomrule
\end{longtable}               


 

To create table with booktabs

\begin{table}
\caption[]{}    
\begin{center}
 % \resizebox{\textwidth}{!}{
    \begin{tabular}{ll}
    \toprule
      & \\

    \midrule
      & \\
    \bottomrule
    \end{tabular}
%}
 \end{center}
\end{table}