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

Contents Shortcode not working for pdf output (relates to Feature 10552) #10671

Open
natecostello opened this issue Aug 31, 2024 · 3 comments
Open
Assignees
Labels
bug Something isn't working shortcodes issues related to shortcodes
Milestone

Comments

@natecostello
Copy link

natecostello commented Aug 31, 2024

Bug description

This relates to Feature 10552.

When I try and output, to pdf, the minimal example in the documentation. I get this a malformed document and an incorrect output:

quarto preview /workspaces/quarto-playpen-2/.devcontainer/content_test_qmd.qmd --to pdf --no-brow
ser --no-watch-inputs

Output:

Starting python3 kernel...Done

Executing 'content_test_qmd.quarto_ipynb'
  Cell 1/1: 'a-cell'...Done

pandoc 
  to: latex
  output-file: content_test_qmd.tex
  standalone: true
  pdf-engine: xelatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf
  
metadata
  documentclass: scrartcl
  classoption:
    - DIV=11
    - numbers=noendperiod
  papersize: letter
  header-includes:
    - '\KOMAoption{captions}{tableheading}'
  block-headings: true
  
WARNING (/opt/quarto/share/filters/main.lua:15386) [Malformed document] Found `contents` shortcode without a corresponding div with id: a-cell.
This might happen because the shortcode is used in div context, while the id corresponds to a span.
Removing from document.

Rendering PDF
running xelatex - 1
  This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/Debian) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  
running xelatex - 2
  This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/Debian) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  

Output created: content_test_qmd.pdf

Steps to reproduce

## A section

Here we define a plot.

```{python}
#| echo: false
#| label: a-cell
import matplotlib.pyplot as plt
plt.plot([1,2,3])
```

## Another section

Here we use the plot, inside a callout:

::: callout-note

## Note the following plot

{{< contents a-cell >}}

:::

Expected behavior

A pdf that is consistent with the documentation.

Actual behavior

I get the error above, and a document that looks like this:

image

Your environment

  • IDE: VS Code 1.92.2
  • OS: 13.6.7 Ventura

Quarto check output

Quarto 1.6.9
[✓] 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.6.9
      Path: /opt/quarto/bin

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

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

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.1
      Path: /usr/local/bin/python
      Jupyter: 5.7.2
      Kernels: python3

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

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
@natecostello natecostello added the bug Something isn't working label Aug 31, 2024
@natecostello natecostello changed the title Contents Shortcode not working for pdf output (relates to https://github.com/quarto-dev/quarto-cli/issues/10552) Contents Shortcode not working for pdf output relates to [Feature 10552](https://github.com/quarto-dev/quarto-cli/issues/10552) Aug 31, 2024
@natecostello natecostello changed the title Contents Shortcode not working for pdf output relates to [Feature 10552](https://github.com/quarto-dev/quarto-cli/issues/10552) Contents Shortcode not working for pdf output (relates to Feature 10552) Aug 31, 2024
@mcanouil mcanouil added shortcodes issues related to shortcodes triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. labels Sep 1, 2024
@mcanouil
Copy link
Collaborator

mcanouil commented Sep 1, 2024

FYI, the feature seems to be working only for HTML-based formats.
@cscheid Is it a known limitation currently not stated? https://prerelease.quarto.org/docs/authoring/contents.html

@cscheid cscheid removed the triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. label Sep 5, 2024
@cscheid cscheid added this to the v1.6 milestone Sep 5, 2024
@cscheid
Copy link
Collaborator

cscheid commented Sep 5, 2024

This is a consequence of #7062 and related bugs. The problem, specifically, is that the label is being assigned to the image rather than the cell in this case:

## A section

Here we define a plot.

::: {.cell execution_count=1}

::: {.cell-output .cell-output-display}
![](10671_files/figure-pdf/a-cell-output-1.pdf){#a-cell}
:::
:::

@cscheid
Copy link
Collaborator

cscheid commented Sep 5, 2024

In HTML, we produce this:

## A section

Here we define a plot.

::: {#cell-a-cell .cell execution_count=1}

::: {.cell-output .cell-output-display}
![](10671_files/figure-html/a-cell-output-1.png){#a-cell width=579 height=411}
:::
:::

Note that now there's a cell-a-cell id on the resulting div.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working shortcodes issues related to shortcodes
Projects
None yet
Development

No branches or pull requests

3 participants