My Wiki!

Latex tricks

1. Generate graph from dot with graphviz

  dot -Tps network-ontology.dot -K twopi -Goverlap=scale -Gfontsize=8.0 -o network-ontology.eps
  

-K engines: Use one of: circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi

2. Merge bibtex files

To avoid changing capitalization and also the duplicated entries on the merged file we can use

bibtool --preserve.key.case=on --print.deleted.entries=off -s -d input1.bib input2.bib -o output.bib

3. EDAS gutter

Problem with the figure across 2 columns

\begin{figure*}[th!]
  \centering
  \begin{minipage}[t]{\linewidth}    <----------- Add this
    %\includegraphics[width=0.99\textwidth, height=6cm]{images/multi_domain_arche_overview}
    \includegraphics[width=0.90\textwidth,height=5.9cm]{images/multi_domain_arche_overview}
  \caption{Multi-domain network slicing management architectures: federated (left), brokering (right). The dotted arrows show stakeholder-neutral communication and the solid arrows show operator specific network protocols}
\label{fig:multi_domain_arche}
%\parbox{6.5cm}{\small \hspace{1.5cm} }
\end{minipage}                  <---------- Add this
\end{figure*}

3.1 Equation

LaTeX Tricks

LaTeX Space

Space between Columns: Reduce Column Paddings

  \setlength{\tabcolsep}{-2pt}   % set length to -2pt
  \addtolength{\tabcolsep}{-2pt} % reduce space by -2pt

Space between Rows:

  \def\arraystretch{1.5}

Horizontal Alignmenti (requires package array)

  p{width} % equivalent to \parbox[t]{width}
  m{width} % centered vertically
  b{width} % equivalent to \parbox[b]{width}
  \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
  \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}

Wide Table Option: Shrink Table to Width

  \resizebox{\columnwidth}{!}{ \begin{tabular}{} ...  \end{tabular} }

Math Space

  \arraycolsep=5pt                  % distance between 2 columns 
  \thinmuskip=3mu                   % space between ordinary and operator atoms 
  \medmuskip=4mu plus 2mu minus 4mu % space between ordinary and binary atoms 
  \thickmuskip=5mu plus 5mu         % space between ordinary and relation atoms 

Vertical Space:

  \setlength\jot{-30pt}
  \renewcommand\arraystretch{1}
  \def\>{\mskip\medmuskip}
  \def\;{\mskip\thickmuskip}
  \def\!{\mskip-\thinmuskip

Before/After Math Expressions:

  \abovedisplayskip=12pt plus 3pt minus 9pt 
  \belowdisplayskip=12pt plus 3pt minus 9pt
  \abovedisplayshortskip=0pt plus 3pt 
  \belowdisplayshortskip=7pt plus 3pt minus 4pt

Iteration and Emulation Space

  \def\itemhook{\topsep=1ex \itemsep=0ex}
  \def\enumhook{\topsep=0ex \itemsep=0ex}
  \def\descripthook{\topsep=0ex \itemsep=0ex}

Heading Space

\usepackage[medium,compact]{titlesec}
\titlespacing*{\section}{0pt}{*0.8}{*0.8}
\titlespacing*{\subsection}{0pt}{*0.8}{*0.8}
\titlespacing*{\subsubsection}{0pt}{*0.3}{*0.3}

Caption Space

\abovecaptionskip=3pt % above caption
\belowcaptionskip=3pt % below caption

Vertical Space for Flating

  \textfloatsep=3pt % between top and bottom of float and text
  \intextsep=3pt    % between floats

Modify Enumeration: \renewcommand{\labelenumi}{[\Alph{enumi}]}

Figure

Wrapfigure: Required package: wrapfig

  \begin{wrapfigure}[16]{r}{0.6\textwidth}  % [16] is optional, generally works better
  \vspace{-20pt}
  \includegraphics[width=0.59\textwidth]{Figure}   
  \caption{Figure Caption} \label{Fig:Caption}
  \vspace{-20pt}
  \end{wrapfigure} 

Side-by-side figures

\begin{figure}
\centerinn{figure}
\centering
\begin{minipage}{.5\textwidth}
  \centering
\includegraphics[width=\textwidth]{Figure-1}
  \captionof{figure}{Figure 1 Caption}
  \label{Figure-1-label}
\end{minipage}%
\begin{minipage}{.5\textwidth}
  \centering
\includegraphics[width=\textwidth]{Figure-1}
  \captionof{figure}{Figure 2 Caption}
  \label{Figure-2-label}
\end{minipage}
\end{figure}
Subfig: Required package: subfig
\begin{figure}
\centering
\subfloat[Caption 1\label{fig1}]{
\includegraphics[width=3in]{figure1}
}
\quad
\subfloat[Caption 2\label{fig2}]{
\includegraphics[width=3in]{figure2}
}
\caption{Caption of the entire figure}
\end{figure}

Change Figure Directory: \graphicspath{ {./Figures/} }

Rename Caption: \renewcommand{\figurename}{Fig.}

Include PDF File

Required package: pdfpages

\includepdf[pages={1-},noautoscale]{PDF-page-file}

Over- and underbrackets

\underbrace{…} \underbracket[LineThickness][Height]{…} \overbrace{…} \overbracket[LineThickness][Height]{…}

Font Packages

\usepackage{times}    similar to \usepackage{mathptm}
\usepackage{fourier}
\usepackage{palatino} similar to \usepackage{mathpple}
\usepackage{bookman}  % very wide fonts 
\usepackage{charter}
\usepackage{newcent}

Using algorithmic package

\IF{condition} \STATE  \ELSE \STATE  \ENDIF
\FOR{condition} \STATE  \ENDFOR
\FOR{condition} \TO {condition} \STATE  \ENDFOR
\FORALL{condition} \STATE  \ENDFOR
\WHILE{condition} \STATE  \ENDWHILE
\REPEAT \STATE  \UNTIL {condition}
\LOOP \STATE  \ENDLOOP

Change Floatname: \floatname{algorithm}{Protocol}

Using algorithm in beamer

Problem: The algorithm floating does not work well with beamer.

Solution: \begin{algorithm}[H]…\end{algorithm}

Remove beamer navigation symbols

  \beamertemplatenavigationsymbolsempty

Navigation