Skip to content

thomas-chauvet/latex2pdf-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LateX CV to PDF

latex2pdf-action

GitHub action to convert LaTeX document in PDF file with LuaTeX.

Parameters

  • output_dir: use it to get the PDF file at a specific location at the end of the compilation.
  • main_latex_file: main latex file to convert (ex: main.tex).
  • ctan_packages: Extra package from CTAN to install. List of packages available here. Each package must be separated by a space (ex: "moderncv xargs")."
  • toc: boolean to add ToC or not. Default false. It will compile the document twice to generate the ToC with LuaTeX.

Use it in your pipeline

You can refer to the example attached in this repository.

In the example below we compile the document in PDF and upload as an artefact of the pipeline:

name: LateX to PDF

on:
  push:
    branches: 
      - master
      - develop
    tags:
       - '*'
  pull_request:
    branches: [ master ]

jobs:
  build_latex:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Git repository
        uses: actions/checkout@v2
      - name: latex2pdf
        id: compile-latex-document
        uses: thomas-chauvet/latex2pdf-action@1.0.5
        with:
          output_dir: output
          main_latex_file: test.tex
          ctan_packages: amsmath amsfonts lua-uni-algos
      - name: Upload PDF to the workflow tab
        id: upload-workflow-tab
        uses: actions/upload-artifact@v2
        with:
          name: output
          path: output/test.pdf

You can find a more complete example in my CV repository with everything to release the PDF document.

Development

Test locally

Build docker image:

docker build -t latex2pdf .

Run the example:

docker run \
  -e OUTPUT_DIR="output" \
  -e MAIN_LATEX_FILE="test.tex" \
  -e CTAN_PACKAGES="amssymb latexsym amsmath" \
  -v "${PWD}/resources/test.tex":"/test.tex" \
  -v "${PWD}/output":"/output" \
  latex2pdf

Notes

The Docker images used to compile the document is based on Ubuntu and the excellent work of @Yihui for TinyTeX. It allows the image to stay relatively small and use only what is needed.