Things to Know

Include svg files and convert them on-the-fly

  • Inkscape must be installed.

  • The path to the Inkscape binary has to be in the System’s PATH variable or be specified with the inksacepeexe option in \svgsetup{}.

Hint

  • You might have to add Inskscape to PATH manually on Windows native installations.

  • Inkscape is already installed and ready to use in the BFH-LaTeX Docker image.

\usepackage{svg} % Include Packages
% use inkscapepath = <GENERATE_FOLDER> e.g _build
\svgsetup{inkscapepath=_build,inkscapeformat=pdf,inkscapelatex=false,inkscapearea=page} 
\svgpath{{svg/}{/usr/local/svg/}} % set source folder 

\includesvg[width=.75\textwidth]{svg-file} % include svg image

Information

The documentation for additional options to the svg package can be found here.

If you don’t want to use Inkscape, you can convert the svg manually to pdf or png with e.g. cairosvg and include the generated file in the LaTeX document.

Change the depth of the table of contents

If you want to change the depth shown in the table of contents, use the setcounter command and the alias name tocdepth

\setcounter{tocdepth}{<NUMBER>}

Change the global document font

If you use the BFH document classes the default font is unitslap (for BFH members only) or if not available the open fallback font nunito. To change the font of the document globally, us the setmainfont command. However, you should not modify the font of a document because this may break with CD guide lines.

\setmainfont{<FONT>}

Example:

\setmainfont{Latin Modern Roman}

Structure of a LaTeX document

If you have trouble to keep the overview over you document, we recommend to split up a large document in separate .tex files and assemble the content in a main file accordingly.

Hint

Have a look into the templates provided by the BFH to get the idea.

Include PDF files in LaTeX

\usepackage{pdfpages}

\includepdf[angle=, pages={}]{pdf-file}

Please see the official documentation for available options to the pdfpages package.

Align pictures side by side

You can use minipage environment, it can be filled with any LaTeX code.

\begin{figure}[h]
  \begin{minipage}{.45\textwidth}
    \centering
    \includegraphics[width=\textwidth]{picture-one}
    \label{fig:ex-1}
    \caption{example 1}
  \end{minipage}\hfill
  \begin{minipage}{.45\textwidth}
  \begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{picture-two}
    \label{fig:ex-2}
    \caption{example 2}
\end{figure}

Use the BFH terminal within BFH beamer

If you have a runaway error using the bfhterminal within the bfhbeamer class, make sure you have passed the proper option [fragile] to the frame environment.

\LoadBFHModule{terminal}

\begin{frame}[fragile]
  \setupLinuxPrompt{student}
  \begin{ubuntu}
    man man
  \end{ubuntu}
\end{frame}

Add a caption to a BFH terminal

The control sequence \captionof can be used to do so:

\LoadBFHModule{terminal}

\setupLinuxPrompt{student}
\begin{ubuntu}
  echo "Hello World" `\StartConsole`
  Hello World
\end{ubuntu}
\captionof{lstlisting}{This is a caption}

Citation

Read the texdoc manual for information about biblatex.

Hint

Our templates provide some good examples to start with.

Simple example

project.bib

@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
        [{On} the electrodynamics of moving bodies]",
    journal =      "Annalen der Physik",
    volume =       "322",
    number =       "10",
    pages =        "891--921",
    year =         "1905",
    DOI =          "http://dx.doi.org/10.1002/andp.19053221004"
}

@book{latexcompanion,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The \LaTeX\ Companion",
    year      = "1993",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts"
}

@misc{knuthwebsite,
    author    = "Donald Knuth",
    title     = "Knuth: Computers and Typesetting",
    url       = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
\documentclass{bfhthesis}
\usepackage{cite}

\begin{document}

reference to einstein \cite{einstein}.

\bibliographystyle{unsrt}
\bibliography{project}      % the project.bib file gets loaded
\end{document}

Add additional LaTeX packages to the VS Code Docker image

Please read here