Skip to content

Latest commit

 

History

History

LaTeX

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Kickstart - $\LaTeX$

The accompanying scripts in this directory provide two main functionalities:

  1. Automating the creation of $\LaTeX$ new projects from a template that includes configuration files for editors, formatter, typesetting program, and Git tools.
  2. A non-interactive and cross-platform installation of a $\TeX$ distribution along with latexmk and $\TeX$ packages needed for certain CI/CD workflows. Also, depending on the installation path, this can be completed without privileged access.

Use Cases and Motivation

A $\LaTeX$ document often needs to be compiled multiple times to resolve cross-references, bibliographies, and other dependencies. This process can be automated using latexmk. The accompanying scripts started from a need to use latexmk in a minimal CI/CD environment and aim to address the following issues encountered in the process:

  • Availability: Depending on the system, latexmk is not always available through the system's package manager.
  • Bandwidth and disk usage: When available, installing a full mainstream $\TeX$ distribution using the system's package manager seems to function as expected. However, it is too large (>5GB) to be used in a CI/CD workflow. Also, several, often many, $\TeX$ packages are generally bundled in a single system package. Hence, relying only on the system's package manager may lead to excessive disk usage, even to build a simple document like the provided template.
  • Conflicting versions: Mainstream $\TeX$ distributions have their own package managers, e.g. tlmgr for TeX Live and mpm for MiKTeX. So, in theory, one should be able to install a minimal $\TeX$ distribution using the system's package manager and then install the remaining $\TeX$ packages using the $\TeX$ distribution package manager. However, in some cases, the installed version of the $\TeX$ distribution package manager is outdated and fails to function, as is the case for tlmgr on Ubuntu 20.04 - 24.04, where you may greeted with error messages that require some extra steps to be resolved.

Installation

Supported $\TeX$ distributions:

To install a $\TeX$ distribution along with latexmk, you could run the following command using either Bash or PowerShell:

kickstart latex -install

This defaults to the TeX Live distribution. The installer's settings could be specified in the configuration files and overridden using command-line options. For instance, the following command installs a minimal Tex Live distribution (only infrastructure), along with a specified set of $\TeX$ packages, in the user's home directory, and hence without the need for privileged access:

kickstart latex \
    -install \
    -distribution texlive \
    -tl-scheme infraonly \
    -tl-pkgs "amscls,amsfonts,amsmath,etoolbox,hyperref,latex-bin,latexmk" \
    -download-dir "$HOME/Downloads" \
    -tex-dir "$HOME/texlive" \
    -tex-user-dir "$HOME/.texlive"

For available options, run:

kickstart latex -help

Afterwards, additional $\TeX$ packages could also be installed using the $\TeX$ distribution package manager, e.g. tlmgr for TeX Live:

tlmgr install <package1> <package2> ...

New Projects

To initialise a new $\LaTeX$ project from the template, you could run the following command using either Bash or PowerShell:

kickstart latex -new <project_name>

The default configuration could be overridden using command-line options. For example, the following command creates a new $\LaTeX$ project with a different author and email:

kickstart latex -new <project_name> -author <author> -email <email>

For available options, run:

kickstart latex -new <project_name> -help

Building and previewing

  1. To build the $\LaTeX$ document:
latexmk
  1. To build and preview the document:
latexmk -pv
  1. To continuously build and preview the document on save:
latexmk -pvc
  1. To clean all generated files except the DVI, PostScript, and PDF files:
latexmk -c
  1. To clean all generated files:
latexmk -C

See latexmk documentation for more options.