quarto-dev / quarto-dev/quarto-cli

listings:true crashes render with LaTeX Error: Environment codelisting undefined

Open
#13,379 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug crossref latex listings
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

Adding listings:true to the yaml header breaks the rendering.

Steps to reproduce

---
title: "A new idea"
format:
  pdf:
    keep-tex: true
    listings: true
---

## Introduction

We present a great idea.

Here's the code to prove it.

```{#lst-thecode lst-cap="Clever code"}
do_this : NOW
do_that : LATER
finish , HAPPY
```

If I run quarto render mwe.qmd without the listings:true line it compiles fine, making a tex file with the verbatim environment wrapped in the codelistings environment.

However, when adding the listings: true, it produces the error shown below.

Actual behavior
Rendering PDF
running lualatex - 1
  This is LuaHBTeX, Version 1.17.0 (TeX Live 2023/Debian) 
   restricted system commands enabled.
  
updating tlmgr

updating existing packages
ERROR: 
compilation failed- error
LaTeX Error: Environment codelisting undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.180 \begin{codelisting}

see mwe.log for more information.
Expected behavior

A listings block with a caption and a label.

Your environment
  • OS: Ubuntu 24.04.3 LTS

Just using a text editor (emacs) and the command line (bash).

Quarto check output

$ quarto check
Quarto 1.8.24
[✓] Checking environment information...
      Quarto cache location: /home/fvuo500/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.3.1: OK
      Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.8.24
      Path: /opt/quarto/bin

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

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

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /usr/bin/google-chrome
      Source: PATH

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

[✓] Checking Python 3 installation....OK
      Version: 3.9.12 (Conda)
      Path: /home/fvuo500/miniconda3/bin/python
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with conda install jupyter

[✓] Checking R installation...........OK
      Version: 4.3.3
      Path: /usr/lib/R
      LibPaths:
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: (None)
      rmarkdown: (None)

      The knitr package is not available in this R installation.
      Install with install.packages("knitr")
      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")

[mwe.log](https://github.com/user-attachments/files/22360540/mwe.log)

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

Use the reported mwe.qmd example as the entry point and run quarto render mwe.qmd with and without listings: true. Compare the generated TeX and mwe.log around the reported line 180 to trace the undefined codelisting environment. Done means the PDF renders with a captioned, labeled listings block.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.