In PDF output, code listings can float away from their annotations

Open
#10,297 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, markdown
Domain
backend

Research direction

Reproduce the Markdown example in the issue with PDF output and compare the annotation placement against the attached image. Read the referenced commit 5e1027bc58ed83b28e99bd9d1003108a9e8d319d to understand the earlier fix, then verify that code listings remain adjacent to their annotations in the generated PDF.

Written by the indexing model from the issue text.

Description

bug code-annotation crossref latex

Following up on feedback from @giabaio and @nichtich at

  • #5142

Take this example

---
title: Hello World
format: pdf
---

## Hello

{{< lipsum 1-2 >}}

```{#lst-customers .r lst-cap="Customers Query"}


# this is a comment that adds length to the code block
# this is a comment that adds length to the code block
# this is a comment that adds length to the code block

library(tidyverse)

# this is a comment that adds length to the code block
# this is a comment that adds length to the code block
# this is a comment that adds length to the code block

library(palmerpenguins)
penguins |>                                      # <1>
  mutate(                                        # <2>
    bill_ratio = bill_depth_mm / bill_length_mm, # <2>
    bill_area  = bill_depth_mm * bill_length_mm  # <2>
  )                                              # <2>
```
1. Take `penguins`, and then,
2. add new columns for the bill ratio and bill area.

{{< lipsum 3-4 >}}

image

So it seems the issue from 1.3 is happening again. It was initially fixed by https://github.com/quarto-dev/quarto-cli/commit/5e1027bc58ed83b28e99bd9d1003108a9e8d319d but does not seem to apply anymore

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

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.

More from quarto-dev/quarto-cli

All issues in quarto-dev/quarto-cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.