LaTeX on GNU/Linux

Note

Remove all LaTeX packages on you system first, for a clean installation of the latest TexLive installation. For a clean removal of the LaTeX packages please see here for some hints.

As said earlier there are multiple ways of getting a TeX distribution. However, we recommend the usage of TeXLive on GNU/Linux. This guide describes how to install it on your system.

Attention

Do not install TeXLive from your operating system’s package manager. It is possible that it will not install the latest version, which is needed to get the latest BFH LaTeX packages.

Basic Packages

Requirements

# apt install -y unzip wget perl

TexLive Manager

  • Create temporary folder

    $ mkdir /tmp/texlive && cd /tmp/texlive
    
  • Download the TeXLive installer for linux.

    $ wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip
    
  • Unzip install-tl.zip

    $ unzip ./install-tl.zip -d install-tl
    
  • Change to the exctracted directory

    $ cd install-tl/install-tl-$(date +%Y%m%d)
    
  • Start the installation

    # perl ./install-tl
    ======================> TeX Live installation procedure <=====================
    
    ======>   Letters/digits in <angle brackets> indicate   <=======
    ======>   menu items for actions or customizations      <=======
    = help>   https://tug.org/texlive/doc/install-tl.html   <=======
    
     Detected platform: GNU/Linux on x86_64
     
     <B> set binary platforms: 1 out of 16
    
     <S> set installation scheme: scheme-full
    
     <C> set installation collections:
         40 collections out of 41, disk space required: 7231 MB
    
     <D> set directories:
       TEXDIR (the main TeX directory):
         /usr/local/texlive/2021
       TEXMFLOCAL (directory for site-wide local files):
         /usr/local/texlive/texmf-local
       TEXMFSYSVAR (directory for variable and automatically generated data):
         /usr/local/texlive/2021/texmf-var
       TEXMFSYSCONFIG (directory for local config):
         /usr/local/texlive/2021/texmf-config
       TEXMFVAR (personal directory for variable and automatically generated data):
         ~/.texlive2021/texmf-var
       TEXMFCONFIG (personal directory for local config):
         ~/.texlive2021/texmf-config
       TEXMFHOME (directory for user-specific files):
         ~/texmf
    
     <O> options:
       [ ] use letter size instead of A4 by default
       [X] allow execution of restricted list of programs via \write18
       [X] create all format files
       [X] install macro/font doc tree
       [X] install macro/font source tree
       [ ] create symlinks to standard directories
    
     <V> set up for portable installation
    
    Actions:
     <I> start installation to hard disk
     <P> save installation profile to 'texlive.profile' and exit
     <Q> quit
    
    Enter command: 
    
  • Press S to change the scheme

    ===============================================================================
    Select scheme:
    
     a [X] full scheme (everything)
     b [ ] medium scheme (small + more packages and languages)
     c [ ] small scheme (basic + xetex, metapost, a few languages)
     d [ ] basic scheme (plain and latex)
     e [ ] minimal scheme (plain only)
     f [ ] ConTeXt scheme
     g [ ] GUST TeX Live scheme
     h [ ] infrastructure-only scheme (no TeX at all)
     i [ ] teTeX scheme (more than medium, but nowhere near full)
     j [ ] custom selection of collections
    
    Actions: (disk space required: 7231 MB)
     <R> return to main menu
     <Q> quit
    
    Enter letter to select scheme: 
    
  • Select small scheme (c)

  • Return to main menu (R)

  • Install TeXLive (I)

  • After the installation completed, add a symlink to /usr/local/bin

    Note

    Replace the <YEAR> in the path with your target version.

    # /usr/local/texlive/<YEAR>/bin/x86_64-linux/tlmgr path add
    

Required TeX Packages

Important

Always update symlinks for freshly installed LaTeX binaries

# tlmgr path add

Hint

If you prefer a GUI for installing additional packages, use following command to start tlmgr as a GUI.

# tlmgr --gui
  • Download tex-requirements.txt

  • Install the packages listed in tex-requirements.txt

    # tlmgr install `cat tex-requirements.txt`
    
  • Update the symlinks again

    # tlmgr path add
    

Fonts

  • Check if nunito is installed on your system

    nunito is the default font for the BFH CI and thus needed

    # tlmgr list --only-installed --data name | grep nunito
    
  • If the output of the previous command is empty then install nunito manually

    # tlmgr install nunito
    

Additional Tools/Packages

Latexmk

A Perl script to compile LaTeX source file, highly recommended. Read the section about Latexmk for more information about the CLI build tool.

# tlmgr install latexmk 

Inkscape

Inkscape is used either to draw vector graphics and/or to convert SVGs into PDFs on-the-fly. A conversion is needed because LaTeX has no native support for the SVG format.

# apt install -y inkscape libcanberra-gtk-module

Biber

Biber can be used to create bibliographies in LaTeX

# tlmgr install biber

Make

To work with Makefiles

# apt install -y make

Editors

As described earlier, you can literally use any plain text editor which has syntax highlighting for TeX. However, for beginners we recommend installing on of the editors listed below.

LaTeXila

Edit TeX files (GNU/Linux only; Recommended if you use GNOME as desktop environment)

# apt install -y latexila

TexStudio

Edit TeX files (An alternative to LeTeXila; Also available for OS X and Windows)

# apt install -y texstudio

TexWorks

Edit TeX files (An alternative to LeTeXila and TeXStudio; Also available for OS X and Windows)

# apt install -y texworks texworks-scripting-lua texworks-scripting-python

VS Code

General purpose editor, together with the extension LaTeX Workshop

Installation Documentation