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

Beamer TOC misbehaving with lualatex #6226

Closed darthlite closed 1 year ago

darthlite commented 1 year ago

Bug description

Note: I only ran into this on my fourth document using the same _quarto.yml file without any changes (and all with lualatex), so it seems the issue is not consistent, and I'm not sure what triggers it. However, I was able to reproduce the issue on a small MWE so decided to file this bug report.

When rendering my .qmd document to beamer using lualatex as the engine and with toc: true, the TOC slide appears blank. If the engine is changed to xelatex, then it is populated correctly with sections.

P.S. I don't want to change over to xelatex because another issue arises: it messes up my slides. For some reason anything that I wrote on the slides without a bullet point never gets shown if I switch to xelatex. I could not, however, reproduce this issue on a small example so it might have to do with my template. (Any hints about this other issue are welcome, however!).

Steps to reproduce

---
title: "Test"
format:
    beamer:
        pdf-engine: lualatex
        toc: true
        slide-level: 3
---

# Section 1

## A subsection

### A slide

# Section 2

## Another subsection

### Another slide

Expected behavior

TOC slide should look like this (this is generated with xelatex):

Screenshot 2023-07-16 at 4 59 08 PM

Actual behavior

Instead, it looks like this:

Screenshot 2023-07-16 at 4 59 53 PM

Your environment

Quarto check output

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.433
      Path: /Applications/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.10.12 (Conda)
      Path: /opt/homebrew/Caskroom/miniforge/base/bin/python
      Jupyter: 5.3.1
      Kernels: julia-0.4, matlab_kernel, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.3.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
      knitr: 1.43
      rmarkdown: 2.23

[✓] Checking Knitr engine render......OK
cscheid commented 1 year ago

Ok, this is super obnoxious. I don't understand why, but https://tex.stackexchange.com/questions/42007/table-of-contents-does-not-show-in-a-frame had the solution: pdflatex and lualatex require two compilations in the presence of frame environments.

You can verify that the following fixes the problem: add keep-tex: true to your metadata, and then manually run lualatex file.tex twice (even though there's no indication from the output that two compilations are required.)

cscheid commented 1 year ago

@dragonstyle I'm not sure if this is the case for all such situations, but the only difference between the output of the two compilations I can find is the following line:

No file 6226-test.aux.

On the second compilation, this message is missing. I wonder if we should be detecting this line, and reissuing a compilation in that case.

dragonstyle commented 1 year ago

Yes we should! There is an option to manually set minimum number of runs (‘latex-min-runs: 2’) which should allow you to force this until we get that fixed…

I’ll have a look at the fix…