GitHub Action to compile LaTeX documents.
It runs in a docker image with a full TeXLive environment installed.
-
root_fileThe root LaTeX file to be compiled. This input is required. You can also pass multiple files as a multi-line string to compile multiple documents. For example:
- uses: BendikMann/latex-action@v0.0.1 with: root_file: | file1.tex file2.tex
-
working_directoryThe working directory for the LaTeX engine.
-
compilerThe LaTeX engine to be invoked. By default,
latexmkis used, which automates the process of generating LaTeX documents by issuing the appropriate sequence of commands to be run. -
argsThe extra arguments to be passed to the LaTeX engine. By default, it is
-pdf -file-line-error -halt-on-error -interaction=nonstopmode. This tellslatexmkto usepdflatex. Refer tolatexmkdocument for more information. -
extra_system_packagesThe extra packages to be installed by
apkseparated by space. For example,extra_system_packages: "py-pygments"will install the packagepy-pygmentsto be used by themintedfor code highlights.
-
pre_compileArbitrary bash codes to be executed before compiling LaTeX documents. For example,
pre_compile: "tlmgr update --all"to update all TeXLive packages. -
post_compileArbitrary bash codes to be executed after compiling LaTeX documents. For example,
post_compile: "latexmk -c"to clean up temporary files.
The following inputs are only valid if the input compiler is not changed.
-
latexmk_shell_escapeInstruct
latexmkto enable--shell-escape. -
latexmk_use_lualatexInstruct
latexmkto use LuaLaTeX. -
latexmk_use_xelatexInstruct
latexmkto use XeLaTeX.
name: Build LaTeX document
on: [push]
jobs:
build_latex:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v2
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v2
with:
root_file: main.texBy default, this action uses pdfLaTeX. If you want to use XeLaTeX or LuaLaTeX, you can set the latexmk_use_xelatex or latexmk_use_lualatex input respectively. For example:
- uses: BendikMann/latex-action@v0.0.1
with:
root_file: main.tex
latexmk_use_xelatex: true- uses: BendikMann/latex-action@v0.0.1
with:
root_file: main.tex
latexmk_use_lualatex: trueAlternatively, you could create a .latexmkrc file. Refer to the latexmk document for more information.
To enable --shell-escape, set the latexmk_shell_escape input.
- uses: BendikMann/latex-action@v0.0.1
with:
root_file: main.tex
latexmk_shell_escape: trueThe PDF file will be in the same folder as that of the LaTeX source in the CI environment. It is up to you on whether to upload it to some places. Here are some example.
- You can use
@actions/upload-artifactto upload PDF file to the workflow tab. - You can use
@actions/upload-release-assetto upload PDF file to the Github Release. - You can use normal shell tools such as
scp/git/rsyncto upload PDF file anywhere. For example, you can git push to thegh-pagesbranch in your repo, so you can view the document using Github Pages.
- Try to solve the problem by examining the build log.
- Try to build the document locally.
- You can also try to narrow the problem by creating a minimal working example to reproduce the problem.
- Open an issue if you need help. Please include a minimal working example to demonstrate your problem.
MIT