Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message in the absence of custom crossref declaration fields #10816

Open
ddlawton opened this issue Sep 14, 2024 · 2 comments
Open
Assignees
Labels
enhancement New feature or request lua Issues related to the lua codebase, filter chain, etc
Milestone

Comments

@ddlawton
Copy link

I encountered an issue when trying to compile a Quarto document into a pdf. The LaTeX compilation fails with the following error:

Error running filter /Applications/quarto/share/filters/main.lua:
/Applications/quarto/share/filters/main.lua:12672: attempt to concatenate a nil value (local 'env_name')
stack traceback:
        /Applications/quarto/share/filters/main.lua:2824: in function 'metaInjectLatex'
        /Applications/quarto/share/filters/main.lua:12644: in function 'initialize_custom_crossref_categories'
        /Applications/quarto/share/filters/main.lua:23444: in field 'Meta'
        /Applications/quarto/share/filters/main.lua:573: in function 'run_emulated_filter'
        /Applications/quarto/share/filters/main.lua:1334: in local 'callback'
        /Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
        /Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>

I have narrowed this env_name problem down to the custom cross-references I have in my yaml head (pasted below). When I remove this section entirely, the pdf will compile. Although given this is a scientific manuscript, I would love to have these custom cross references back!

my yaml header in index.qmd:

---
title: Example manuscript

keywords:
  - key1
  - key2

abstract: |
  this is the abstract

plain-language-summary: |
  this is the plain language summary

key-points: 
  - point1
  - point 2

date: last-modified

crossref:
  custom:
    - kind: float
      key: fig
      reference-prefix: Figure
      space-before-numbering: true
      latex-list-of-description: Figure
    - kind: float
      key: suppfig
      latex-env: suppfig
      reference-prefix: Supplementary Figure 
      space-before-numbering: true
      latex-list-of-description: Supplementary Figure
    - kind: float
      key: tbl
      reference-prefix: Table
      space-before-numbering: true
      latex-list-of-description: Table
    - kind: float
      key: supptbl
      reference-prefix: Supplementary Table
      space-before-numbering: true
      latex-list-of-description: Supplementary Table
      

bibliography: references.bib
csl: citation_style.csl

number-sections: true
---

my _quarto.yml:

project:
  type: manuscript
manuscript:
  article: index.qmd
format:
  html:
    toc: true
    comments:
      hypothesis: true
  docx: default
  jats: default
  pdf:
    documentclass: "article"
    keep-tex: true
notebook-links: global
execute:
  freeze: auto

System details:

  1. quarto version: 1.5.57
  2. OS: MacOS
  3. code editor: vscode
@ddlawton
Copy link
Author

Of course after I post this issue i see the potential error -- I missed the latex_env variable for two of my cross reference types.

@cscheid cscheid reopened this Sep 16, 2024
@cscheid
Copy link
Collaborator

cscheid commented Sep 16, 2024

We should still offer a better error message than this!

@cscheid cscheid transferred this issue from quarto-dev/quarto Sep 16, 2024
@cscheid cscheid added enhancement New feature or request lua Issues related to the lua codebase, filter chain, etc labels Sep 16, 2024
@cscheid cscheid self-assigned this Sep 16, 2024
@cscheid cscheid added this to the v1.6 milestone Sep 16, 2024
@cscheid cscheid changed the title latex-env Issue in Lua Filter Leading to LaTeX Compilation Error Improve error message in the absence of custom crossref declaration fields Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lua Issues related to the lua codebase, filter chain, etc
Projects
None yet
Development

No branches or pull requests

2 participants