GitHub Action to compile LaTeX documents, based on https://github.com/xu-cheng/latex-action/actions. Extend with git-latexdiff and latex statistics.
It is based on a docker image with a full TeXLive environment installed, for more see Dockerfile.
If you want to run arbitrary commands in a TeXLive environment, use texlive-action instead.
If your using compile_diff
you must use a check out at least two commits. Thus, if your using actions/checkout@v2
set fetch-depth
to 2 or more.
For example:
- name: Set up Git repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: tawalaya/latex-diff-action@v1
with:
root_file: |
file1.tex
file2.tex
-
root_file
The 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.
-
working_directory
The working directory for the LaTeX engine.
-
compiler
The LaTeX engine to be invoked. 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 LaTeX engine. By default, it is
-pdf -file-line-error -halt-on-error -interaction=nonstopmode
. This tellslatexmk
to usepdflatex
. Refer tolatexmk
document for more information. -
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. -
pre_compile
Arbitrary bash codes to be executed before compiling LaTeX documents. For example,
pre_compile: "tlmgr update --all"
to update all TeXLive packages. -
post_compile
Arbitrary 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_escape
Instruct
latexmk
to enable--shell-escape
. -
latexmk_use_lualatex
Instruct
latexmk
to use LuaLaTeX. -
latexmk_use_xelatex
Instruct
latexmk
to use XeLaTeX. -
compile_diff
runs
git-latexdiff
against the previous commit usinggit-latexdiff --main $root_file --no-view -o diff.pdf --cleanup all --ignore-makefile HEAD~ --
. Using this together with theworking_directory
might be needed. -
with_stats
uses
latexpand
andtexcount
to give you some latex statisitcs
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.tex
For furhter examples look at the original.
- diff.pdf : contains the
latexdiff
results - stats.txt : contains the
texcount
stats root_file
.pdf : containts the compiled tex file
MIT