quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.76k stars 306 forks source link

how to tweak quarto render process to be compatible w/ latex glossaries package? #1782

Closed jjallaire closed 1 year ago

jjallaire commented 2 years ago

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/1780

Originally posted by **chrizz89** August 10, 2022 I am considering transitioning from latex to quarto for my current project. One thing I have not been able to get going is **making use of the latex glossaries package in quarto**. It does work as far as commands (which rely on my definitions inside `glossary.tex`) are processed and displayed correctly but **printing my glossary does absolutly not work**. I have tried `keep-tex: true`as well as `latex-clean: false` as my web search suggests it has some thing todo with glossaries requiring multiple latex compilations in order to work, but non if it seemed to work so far. (I tried pdflatex as well as xelatex for rendering) Any suggestions how to tackle this? as small example how I implemented it in my _quarto.yml: ``` format: pdf: documentclass: scrbook include-in-header: - \usepackage[acronym, nonumberlist]{glossaries} - \makeglossaries include-before-body: - \input{glossary.tex} include-after-body: - \printglossary[type=\acronymtype] keep-tex: true latex-clean: false latex-min-runs: 3 ```
jjallaire commented 2 years ago

I don't have experience with the glossaries package so don't have any specific advice. Perhaps someone else here does? We are planning on doing some additional work on references and likely glossaries in v1.2 (including getting them to work w/ HTML) so I'm going to target this issue for that release.

Minh-AnhHuynh commented 1 year ago

Thanks to your post, I understood that glossaries does not currently work well with quarto. I have decided to use the acronym package instead, which works well but doesn't sort the acronyms alphabetically, which have to be done manually, unfortunately.

dragonstyle commented 1 year ago

A separate makeglossaries step is required for that package. You can do the following, however:

test.qmd

---
title: Glossary Test
format:
  pdf:
    documentclass: scrbook
    include-in-header: 
      text: |
        \usepackage[acronym, nonumberlist]{glossaries}
        \input{glossary.tex}
        \makenoidxglossaries
    include-after-body: 
      text: |
        \printnoidxglossaries
---

## Hello

In this phrase, the user-defined term \gls{latex} is inserted.    

glossary.tex

\newglossaryentry{latex}{{name=latex}, description={LaTeX is a document preparation system}}

Will result in a PDF using glossaries.