GitHub Action to compile LaTeX documents.
It runs in the docker with a minimal TeXLive environment installed. Further, it uses texliveonfly
to find and install the missing packages.
-
root_file
The root LaTeX file to be compiled. This input is required.
-
working_directory
The working directory for
texliveonfly
to be invoked. -
compiler
The LaTeX engine to used by
texliveonfly
. By default,latexmk
is used, which automates the process of generating LaTeX documents by issuing the appropriate sequence of commands to be run. -
args
The extra arguments to be passed to the compiler by
texliveonfly
. By default, it is-pdf -file-line-error -interaction=nonstopmode
. This tellslatexmk
to usepdflatex
. Refer tolatexmk
document for more information. -
extra_packages
The extra packages to be installed by
tlmgr
separated by space. For example,extra_packages: "cm-super biblatex-ieee"
will install packagescm-super
andbiblatex-ieee
explicitly. -
extra_system_packages
The extra packages to be installed by
apk
separated by space. For example,extra_system_packages: "py-pygments"
will install the packagepy-pygments
to be used by theminted
for code highlights.
name: Build LaTeX document
on: [push]
jobs:
build_latex:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v1
- name: Compile LaTeX document
uses: xu-cheng/latex-action@master
with:
root_file: main.tex
By default, this action uses pdfLaTeX. If you want to use XeLaTeX or LuaLaTeX, you can set the args
to -xelatex -file-line-error -interaction=nonstopmode
or -lualatex --file-line-error --interaction=nonstopmode
respectively. Alternatively, you could create a .latexmkrc
file. Refer to the latexmk
document for more information.
To enable --shell-escape
, you should add it to args
. For example, set args
to -pdf -file-line-error -interaction=nonstopmode -shell-escape
when using pdfLaTeX.
If this Github action fails to build the document, it is likely due to texliveonfly
failing to install the missing packages. In this case, you can pass them explicitly in extra_packages
. Try to find the missing packages or the missing fonts in the build log. Alternatively, you could use the list_tl_pkgs.rb
script to list all the packages used by your LaTeX document. Open an issue if you need help.
The setup script installs TeXLive in small scheme to reduce the size. If you want to change it, you can specify it using extra_packages
. For example, extra_packages: scheme-medium
will install medium scheme, while extra_packages: scheme-full
will install everything.
MIT