quarto-dev / quarto-cli

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

Add line-break before beamer partials #9892

Closed pagiraud closed 2 months ago

pagiraud commented 3 months ago

Bug description

When I want to add template-partials to my beamer export, it fails: if the title YAML entry doesn’t contain any space, the export ends without error but no title is displayed. If the title contains a space, the export fails with a

ERROR: 
compilation failed- error
LaTeX Error: Missing \begin{document}.

Steps to reproduce

Make a simple qmd document:

---
title: "TRY ME"
author: "My name"
format:
  beamer: 
    template-partials: 
      - before-title.tex
---

Some content.

Expected behavior

The document is generated.

Actual behavior

The document is not.

Your environment

I use RStudio but this is not relevant: I also tried from command line with the same result. But I use Ubuntu 24.04 with the texlive packages from my distribution, not tinytex. Maybe this is important.

Quarto check output

Quarto 1.5.40
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.40
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      Chromium: 869685
      TinyTeX: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/bin
      Version: 2023

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.3
      Path: /usr/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.4.0
      Path: /usr/lib/R
      LibPaths:
        - /home/xxxxxxx/R/x86_64-pc-linux-gnu-library/4.4
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.47
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK
mcanouil commented 3 months ago

Thanks for the report.

Could you share the content of before-title.tex in your example?

pagiraud commented 3 months ago

Yes, of course. Sorry, I forgot that part. Actually, this is quite simple : my before-title.tex only contains comments:

%Some comment

But if I remove or comment:

    template-partials: 
      - before-title.tex

from my .qmd document, the beamer presentation is correctly generated…

EDIT: The error also occurs with other PDF engines, at least pdf-engine: lualatex and pdf-engine: pdflatex.

cderv commented 3 months ago

I tried

---
title: "TRY ME"
author: "My name"
keep-tex: true
format:
  beamer: 
    template-partials: 
      - before-title.tex
---

Some content.

and the partials being

%Some comment

This generate a document, but the title is missing.

I think this is the same things at

The template is missing a newline as expected by Pandoc.

Try this

%Some comment

And can you confirm it works ok ?

Thanks.

pagiraud commented 3 months ago

I do confirm that it works. Thank you so much!

cderv commented 3 months ago

So same reason than #7293 where I explained the change that impacted that.

I wonder if we should keep adding those newlines after each partials we insert.

We don't currently for this one. https://github.com/quarto-dev/quarto-cli/blob/0a548a67cd4a2094c4b5c71b15bb53ee1b18c2cf/src/resources/formats/pdf/pandoc/template.tex#L418-L419

 $before-title.tex()$
+
 $title.tex()$

 \begin{document}