quarto-dev / quarto-dev/quarto-cli

Using unchanged default TeX template or partials changes output

Open
#13,054 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation latex
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

I have:
  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide
Bug description

Using any TeX partial, even when using the exact same file as Quarto uses by default, changes the .tex file from which the PDF is rendered.

Steps to reproduce
  1. Create a new book project

    quarto create project book book-test book-title --no-open
    cd book-test
    

    Edit the _quarto.yml file by adding keep-tex: true

    project:
      type: book
    
    book:
      title: "book-title"
      author: "Norah Jones"
      date: "7/10/2025"
      chapters:
        - index.qmd
        - intro.qmd
        - summary.qmd
        - references.qmd
    
    bibliography: references.bib
    
    format:
      html:
        theme:
          - cosmo
          - brand
      pdf:
        documentclass: scrreprt
        keep-tex: true
    
  2. Render project using quarto render. This will result in book.tex in the home directory. Rename this file, otherwise it will be overwritten by the next rendering: mv book.tex book_default.tex

  3. In the home directory, create an empty file which will act as a TeX template partial. For this example I've chosen the before-title.tex partial, which is empty by default.

    touch before-title.tex
    

    Set the project to use the partial by setting template-partials. The _quarto.yml file now looks like this:

    project:
    type: book
    
    book:
    title: "book-title"
    author: "Norah Jones"
    date: "7/10/2025"
    chapters:
     - index.qmd
     - intro.qmd
     - summary.qmd
     - references.qmd
    
    bibliography: references.bib
    
    format:
    html:
     theme:
       - cosmo
       - brand
    pdf:
     documentclass: scrreprt
     keep-tex: true
     template-partials:
       - before-title.tex
    
Actual behavior

Compare the book_default.tex and book.tex files to reveal three changed lines:

% diff book.tex book_partial.tex

9,10c9
<   DIV=11,
<   numbers=noendperiod]{scrreprt}
---
> ]{scrreprt}
138a138
>  
141,142d140
< 
< \KOMAoption{captions}{tableheading}
  • The DIV=11 and numbers=noendperiod options are gone from the \documentclass[...]{scrreprt} call when using any partial
  • The following line is missing completely when using any partial: \KOMAoption{captions}{tableheading}

I was able to reproduce this behaviour when using the default template file template: template.tex or other partials like template-partial: title.tex.

In particular the DVI=11 option changes the text area of the PDF, which results in noticeably different text width and thus (when enough text is present in the book) document length.

Expected behavior

The two files should be identical when using default partials, particularly when both the default and user-supplied partial files are empty.

Nota bene, this behaviour does not occur when using quarto render --to latex instead of quarto render with the keep-tex: true option.

Your environment

Positron Version: 2025.07.0 build 204
Code - OSS Version: 1.100.3
Commit: 03ae7a5393c776bb24c23d2aa6a6bfbba90cbc5e
Date: 2025-06-30T16:29:03.492Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.5.0

Quarto check output
% quarto check
Quarto 1.7.32
[✓] Checking environment information...
      Quarto cache location: /Users/gleb/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.85.1: OK
      Deno version 1.46.3: OK
      Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.7.32
      Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/gleb/Library/TinyTeX/bin/universal-darwin
      Version: 2025

[✓] Checking Chrome Headless....................OK
      Chrome:  (not detected)

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

[✓] Checking Python 3 installation....OK
      Version: 3.13.2
      Path: /Users/gleb/.pyenv/versions/3.13.2/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.3
      Path: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources
      LibPaths:
        - /Users/gleb/Library/R/arm64/4.4/library
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.48
      rmarkdown: 2.28

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the book project with keep-tex enabled, then compare book_default.tex and the partial-based book.tex. Read the _quarto.yml template-partials configuration and the mentioned before-title.tex, template.tex, and title.tex files. Done means unchanged or empty default partials produce identical generated TeX, including the scrreprt options and KOMAoption line.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.