quarto-dev / quarto-dev/quarto-cli

`lst-cap-location: margin` has bad placement in PDF output

Open
#11,384 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug description

Writing a Tufte style document with margin use. Having a listing for my code segments doesn't properly place the caption text in the margin.


---
format:
    pdf:
      documentclass: scrartcl
      papersize: a4
      geometry:
        #- showframe
        - left=20.0mm
        - textwidth=105.0mm
        - marginparsep=7.7mm
        - marginparwidth=57.3mm
        - top=20mm
        - bottom=20mm
        - footskip=10mm
      
      code-annotations: true
      code-line-numbers: false
      code-block-bg: "#FFFFE8"
      code-block-border-left: "#DDDDC8"

reference-location: margin
citation-location: document
tbl-cap-location: margin
cap-location: margin
lst-cap-location: margin

---

<!-- uses margin, as declared in YAML -->
::: { #lst-adcread-a }

``` {.rs}
fn read_12bit_adc() -> u16 {
    let v: u16 = adc1.read_dr(); // data register
    assert!(v <= 4095);
    return v;
}
```

When reading the the value from the Analog to Digital Converter (ADC)
hardware, the value which is given back cannot be known at compile time.

:::


---


::: { #lst-adcread-b cap-location=bottom}

``` {.rs}
fn read_12bit_adc() -> u16 {
    let v: u16 = adc1.read_dr(); // data register
    assert!(v <= 4095);
    return v;
}
```

When reading the the value from the Analog to Digital Converter (ADC)
hardware, the value which is given back cannot be known at compile time.

:::

---

::: { #lst-adcread-c cap-location=top}

``` {.rs}
fn read_12bit_adc() -> u16 {
    let v: u16 = adc1.read_dr(); // data register
    assert!(v <= 4095);
    return v;
}
```

When reading the the value from the Analog to Digital Converter (ADC)
hardware, the value which is given back cannot be known at compile time.

:::

Image

Quarto check output

Running latest version of quarto-cli from main branch.

sasja@ed800-g2:~/.quarto/quarto-cli$ git show -s --format="%as %H"
2024-11-11 adc7186f0ee20ed125588cd603330beb2e76bc71
sasja@ed800-g2:~/.quarto/quarto-cli$ quarto check
Quarto 99.9.9
[✓] Checking environment information...
      Quarto cache location: /home/sasja/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: adc7186f0ee20ed125588cd603330beb2e76bc71
      Path: /home/sasja/.quarto/quarto-cli/package/dist/bin

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

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/sasja/.TinyTeX/bin/x86_64-linux
      Version: 2024

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.6
      Path: /usr/bin/python3
      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/

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

Start by rendering the supplied Quarto example with the PDF format and inspect the resulting LaTeX/PDF placement of the listing captions. Compare the default lst-cap-location: margin behavior with the explicit bottom and top cases; done means the margin caption is placed in the margin while the explicit locations remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
build-system, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.