Skip to content

loicreynier/latex-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LaTeX templates

Important The templates are currently a WIP

Templates for LaTeX document builds in Nix environments.

About

These templates provide Nix development environments for the reproducible build of LaTeX documents. Each template lies in its own subdirectory.

Although they are Nix flake templates, they also include Justfile and .latexmkrc configuration files required for document build. Therefore, they can be used as templates by non-Nix users, even though template system (like GitHub's) generally favor a one-template-per-repository approach. In the future, copier integration (or alternative) may be implemented to simplify the use of these templates for non-Nix users.

Supported repository structure

All templates provide a Nix environment for compiling a LaTeX project with the following structure:

  1. Each project can contain multiple documents. Each document is associated with a .tex source file located at the root of the project. All other .tex files (TikZ figures, include targets, etc.) are placed in subdirectories.
  2. Compilation is carried out in the ./build directory; all intermediate files are placed in this directory to maintain cleanliness at the root.
  3. Compilation is performed via latexmk configured by a .latexmkrc file. This configuration files allow compilation to take place in ./build/ and manages all dependencies. Therefore, there is no need to use a Makefile, as all recipes are handled by latexmk. Consequently, a Justfile is used to execute the compilation commands.

Here is an example structure supported by the templates:

project-root/
│
├── document1.tex
├── document1.pdf
├── document2.tex
├── document2.pdf
├── figures/
│   ├── figure1.tex
│   ├── figure2.tex
│   └── ...
│
├── sections/
│   ├── section1.tex
│   ├── section2.tex
│   └── ...
│
├── build/
│   ├── document1.aux
│   ├── document1.log
│   ├── document2.aux
│   ├── document2.log
│   └── ...
│
├── .latexmkrc
├── Justfile
└── ...

Templates

  • full-phiso: LaTeX builds with φso, bib2gls and TikZ externalize support

Usage

  1. Create a Git repository, copy the template and enable environment

    mkdir project && cd project
    git init
    nix flake init --template github:loicreynier/latex-templates#<template>
    direnv allow
    # or alternatively
    # nix develop
  2. Edit and/or add source files

    touch slides.tex
    vi main.tex
    vi slides.tex
  3. Build documents

    just build
    # or alternatively
    # nix build

Credits

These templates are inspired by: