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 inkscapeexe option in \svgsetup{}.

Hint

  • You might have to add Inkscape 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 UnitSlabPro (for BFH members only) or, if not available, the open fallback font nunito. To change the font of the document globally, use the setmainfont command. However, you should not modify the font of a document because this may break the CD guidelines.

\setmainfont{<FONT>}

Example:

\setmainfont{Latin Modern Roman}

Use the female German form for titlepage terms

The BFH document classes only provide one German/French label for the titlepage roles Author, Advisor, Co-advisor, Expert, Project partner, Supervisor and Co-Supervisor. English does not need this, as it does not distinguish gender for these terms.

To use the female (or any other) form, redefine the relevant babel translation for German/French with the translations package (already loaded by the BFH classes, no extra \usepackage needed) in your document, before \begin{document}:

\redefinetranslation{German}{Advisor}{Dozentin}
\redefinetranslation{German}{advisor}{Dozentin}                   % lowercase form, for consistency
\redefinetranslation{German}{Author}{Autorin}
\redefinetranslation{German}{author}{Autorin}
\redefinetranslation{German}{Co-advisor}{Mitbetreuerin}
\redefinetranslation{German}{co-advisor}{Mitbetreuerin}
\redefinetranslation{German}{Expert}{Expertin}
\redefinetranslation{German}{expert}{Expertin}
\redefinetranslation{German}{Project partner}{Projektpartnerin}
\redefinetranslation{German}{project partner}{Projektpartnerin}
\redefinetranslation{German}{Supervisor}{Betreuerin}
\redefinetranslation{German}{supervisor}{Betreuerin}
\redefinetranslation{German}{Co-Supervisor}{Co-Betreuerin}
\redefinetranslation{German}{co-supervisor}{Co-Betreuerin}

Hint

Only redefine the terms you actually need. This works for any babel language, not just German/French. See the translations package documentation for details.

Note

This changes the label for all people in that role — there’s currently no way to mix male/female forms for the same label when multiple people are listed with \and, and the BFH classes don’t automatically switch to a plural label in that case either.

Structure of a LaTeX document

If you have trouble keeping an overview of your document, we recommend splitting up a large document into separate .tex files and assembling 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 the minipage environment; it can be filled with any LaTeX code.

\begin{figure}[h]
  \begin{minipage}{.45\textwidth}
    \centering
    \includegraphics[width=\textwidth]{picture-one}
    \caption{example 1}
    \label{fig:ex-1}
  \end{minipage}\hfill
  \begin{minipage}{.45\textwidth}
    \centering
    \includegraphics[width=\textwidth]{picture-two}
    \caption{example 2}
    \label{fig:ex-2}
  \end{minipage}
\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[backend=biber]{biblatex}
\addbibresource{project.bib}      % the project.bib file gets loaded

\begin{document}

reference to einstein \cite{einstein}.

\printbibliography
\end{document}

Make your document PDF/A compliant

PDF/A is the ISO standard for long-term archiving of PDF documents. Documents built with the BFH classes (tested with bfhthesis) can be configured to produce PDF/A-3u documents with a few changes.

  1. Switch the color space to RGB. The BFH classes default to CMYK. pdfx (used below) normally expects an RGB profile for PDF/A, and its own docs warn that PDF/A validation of CMYK documents can fail specifically when colored hyperlinks are used, which the BFH classes’ hyperref setup does, so RGB is the safe choice here. Add this before \documentclass[...]{...} (after \PassOptionsToPackage{table}{xcolor} if you have it):

    \PassOptionsToPackage{colormode=RGB}{bfhcolors}
    
  2. Replace the usual hyperref setup with the pdfx package. Don’t set document metadata with \hypersetup here, it will come from the .xmpdata file (see below) instead:

    \usepackage[a-3u]{pdfx}
    \hypersetup{
        hidelinks,
        bookmarksopen=true,
        bookmarksnumbered=true,
        pdfdisplaydoctitle=true,
    }
    
  3. Create a <jobname>.xmpdata file next to your main .tex file (same base name, e.g. thesis.xmpdata for thesis.tex) with the document metadata:

    \Author{Author A\sep Author B}
    \Title{Eine Thesis}
    \Language{de-CH}
    \Keywords{Thesis\sep LaTeX\sep BFH}
    \Publisher{BFH}
    \Subject{thesis}
    

Warning

When using this RGB setup, images should also be RGB (not CMYK), and the fonts used must support PDF/A embedding. Some packages may need extra care to remain PDF/A compliant. Validate the final PDF with a tool such as veraPDF to confirm conformance.

Hint

See the pdfx package documentation for more on the package and the .xmpdata file.

Modern LaTeX also provides PDF-standard support through its PDF management system using \DocumentMetadata{pdfstandard=A-3u,...}. See the pdfmanagement package documentation.

For now, the pdfx approach described above provides a simple and tested solution for the BFH classes.

Add additional LaTeX packages to the VS Code Docker image

See the Docker FAQ.

Avoid unexpected blank pages in two-sided documents

If your document is two-sided (twoside=true, the bfhthesis default) you may notice unexpected blank pages before some chapters. This is because bfhthesis defaults to KOMA-Script’s scrbook class (unless overridden with the class option), which defaults to open=right, meaning every \chapter must start on a right-hand (odd) page, so an empty left page is inserted automatically whenever needed to enforce that. You can change this behaviour by setting one of these options:

Note

You only need one of the following, not both.

  • Make the document single-sided:

    \documentclass[
      twoside=false,   % or: oneside
      ...
    ]{bfhthesis}
    
  • Keep the document two-sided, but allow chapters to start on either page:

    \documentclass[
      open=any,
      ...
    ]{bfhthesis}
    

Note

This is standard KOMA-Script layout behavior, not specific to the BFH classes. See the KOMA-Script documentation for the full set of page-layout options.