xu-cheng / latex-action

:octocat: GitHub Action to compile LaTeX documents
https://github.com/xu-cheng/latex-action
MIT License
1.11k stars 133 forks source link

Compiling a project with glossaries #152

Closed guger closed 1 month ago

guger commented 1 month ago

I wanted to compile a project that uses the glossaries package. Therefore, I need to call "makeglossaries" before the final build.

Therefore, I need to prebuild the project, call makeglossaries and then do the build.

I tried to setup this action, but it fails with command not found in the precompiling of latexmk --shell-escape -xelatex:

name: Build LaTeX document

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the "main" branch
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: Checkout Repository
        uses: actions/checkout@v4
      - name: Compile LaTeX document
        uses: xu-cheng/latex-action@v2
        with:
          working_directory: Documentation
          root_file: MAIN.tex
          pre_compile: |
            "latexmk --shell-escape -xelatex"
            "makeglossaries"
          latexmk_use_xelatex: true
          latexmk_shell_escape: true
          extra_system_packages: "inkscape"
      - name: Upload Artifact
        uses: actions/upload-artifact@v4.3.4
        with:
          name: MAIN.pdf
          path: Documentation/MAIN.pdf
xu-cheng commented 1 month ago

Likely due to the quote in your pre_compile command, which causes the entire line being interrupted as the command line name.

Moreover, it is recommended to use custom latexmkrc to let latexmk handle glossaries for you instead of using pre_compile. Please refer to google how to achieve this.