GithubHelp home page GithubHelp logo

jzarnett / make-latex-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patricklam/make-latex-action

0.0 1.0 0.0 49 KB

:octocat: GitHub Action to compile LaTeX documents

License: MIT License

Shell 47.03% TeX 46.13% Dockerfile 6.85%

make-latex-action's Introduction

make-latex-action

GitHub Action to compile multiple LaTeX documents.

This action runs on docker using a maximal TeXLive environment installed. Instead of the parent latex-action, though, it simply calls make in the specified directory.

Inputs

  • working_directory

    The working directory for the latex compiler to be invoked.

  • compiler

    The LaTeX engine to be used. By default latexmk is used. latexmk 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 default, it is -pdf -latexoption=-file-line-error -latexoption=-interaction=nonstopmode. This tells latexmk to use pdflatex. Refer to latexmk document for more information.

  • extra_system_packages

    The extra packages to be installed by apt-get separated by space.

Examples

Build main.tex using latexmk

Note that by default latexmk is used. latexmk automates the process of generating LaTeX documents by issuing the appropriate sequence of commands to be run.

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: patricklam/make-latex-action@master
        with:
          working_directory: lectures

Build example-class-relations--svg.tex using lualatex

This is required if one does not trust latexmk and wants to build "by hand"

name: Build LaTeX document
on: [push]
jobs:
  build_latex:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Git repository
        uses: actions/checkout@v2
      - name: example-class-relations--svg
        uses: dante-ev/latex-action@master
        with:
          root_file: example-class-relations--svg.tex
          compiler: lualatex
          args: -interaction=nonstopmode -shell-escape

"Real" document

In a "real" document, one would have to encode all steps one after another:

name: Build LaTeX document
on: [push]
jobs:
  build_latex:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Git repository
        uses: actions/checkout@v2
      - name: pdflatex main
        uses: dante-ev/latex-action@master
        with:
          root_file: main.tex
          compiler: pdflatex
          args: -interaction=nonstopmode -shell-escape
      - name: bibtex main
        uses: dante-ev/latex-action@master
        with:
          root_file: main.tex
          compiler: bibtex
          args: 
      - name: pdflatex main
        uses: dante-ev/latex-action@master
        with:
          root_file: main.tex
          compiler: pdflatex
          args: -interaction=nonstopmode -shell-escape

FAQs

How to use XeLaTeX or LuaLaTeX instead of pdfLaTeX?

By default, this action uses pdfLaTeX. If you want to use XeLaTeX or LuaLaTeX, you can set the args to -xelatex -latexoption=-file-line-error -latexoption=-interaction=nonstopmode or -lualatex -latexoption=-file-line-error -latexoption=-interaction=nonstopmode respectively. Alternatively, you could create a .latexmkrc file. Refer to the latexmk document for more information. Please mind that it is not recommend to change the compiler parameter, as the by default used latexmk has the advantage of determinating the (re)compilation steps automatically and executes them.

How to enable --shell-escape?

To enable --shell-escape, you should add it to args. For example, set args to -pdf -latexoption=-file-line-error -latexoption=-interaction=nonstopmode -latexoption=-shell-escape when using pdfLaTeX.

Where does the initial code come from?

The initial code is from xu-cheng/latex-action, updated at dante-ev/latex-action. The idea there is to initially provide all packages instead of using texliveonfly. Using a full installation, this action also offers to use packages such as pax, which require other tooling such as perl. More reasoning is given in ADR-0002.

How can I speedup the build?

You can try to use caching, though be careful as sometimes a LaTeX document needs to be rebuilt completly in order to have a proper result.

Here is an example that rebuilds uses the cache at most once a day. The files to cache are taken from the well-known GitHub .gitignore templates:

      # https://github.com/actions/cache#creating-a-cache-key
      # http://man7.org/linux/man-pages/man1/date.1.html
      - name: Get Date
        id: get-date
        run: |
          echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
        shell: bash

      - name: Cache
        uses: actions/[email protected]
        with:
          # A list of files, directories, and wildcard patterns to cache and restore
          path: |
            *.aux
            *.lof
            *.lot
            *.fls
            *.out
            *.toc
            *.fmt
            *.fot
            *.cb
            *.cb2
            .*.lb
            *.bbl
            *.bcf
            *.blg
            *-blx.aux
            *-blx.bib
            *.run.xml
          key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}

License

MIT

make-latex-action's People

Contributors

jzarnett avatar koppor avatar patricklam avatar rugk avatar splitt3r avatar xu-cheng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.