No description
  • TeX 75.6%
  • Perl 20.3%
  • Nix 3.6%
  • Shell 0.5%
Find a file
2026-06-26 06:39:52 -04:00
shared more common macros 2026-06-26 06:39:52 -04:00
templates more common macros 2026-06-26 06:39:52 -04:00
flake.nix more common macros 2026-06-26 06:39:52 -04:00
README.md more common macros 2026-06-26 06:39:52 -04:00
sync.sh more common macros 2026-06-26 06:39:52 -04:00

LaTeX Templates

This repository contains Nix flake templates for LaTeX projects.

Available Templates

  • latex-paper: A standard LaTeX paper template using the KOMA-Script scrartcl class, with custom macro/style configurations (hiromacros.sty, hirostyle.sty, commonmacros.sty).
  • paper-on-the-loop-bath: A LaTeX paper template using the American Physical Society revtex4-2 document class, with specialized style configurations for the loop bath project (conversationalcomments.sty, poormanssubfig.sty).

Initialization

To initialize a new project from a template, run the following command in an empty directory:

nix flake init -t path/to/code/latex_templates#<template-name>

Replace <template-name> with either latex-paper or paper-on-the-loop-bath.

Development and Building

Once initialized, the following workflows are supported in the project directory:

  • Entering the development environment:
    nix develop
    
    Alternatively, if direnv is installed:
    direnv allow
    
  • Formatting LaTeX files:
    tex-fmt index.tex
    
  • Compiling the document continuously with livereload:
    latexmk -pvc index.tex
    
  • Building the PDF in a clean sandbox:
    nix build
    
    The compiled PDF is output to result/index.pdf.

Repository Structure and Synchronization

  • shared/: Contains configuration files shared across all templates (.envrc, .gitignore, flake.nix, latexmkrc, tex-fmt.toml, references.bib).
  • templates/: Contains the specific template directories.
  • sync.sh: Copies files from shared/ to the template directories to ensure consistency.

To update shared configurations across all templates, modify the files in shared/ and execute the synchronization script:

./sync.sh