Skip to content

Code cells with #| output: asis ignore #| tbl-cap and #| label:  #3770

@TS-CUBED

Description

@TS-CUBED

Bug description

I try to generate a LaTeX table in Julia using PrettyTables.jl

This creates the LaTeX code for the \begin{tabular} ... \end{tabular} sections.

  1. If I use #| output: true that gets inserted in a verbatim environment, which prints the LaTeX code in the final document, which is not what I want. It does include the table environment and adds a caption and label as expected, though. I can use the @tbl-label method to cross-reference in this case.

  2. If I use #| output: asis the output is inserted as is (as expected). This renders a nice table, however, then I don't get the table environment and no caption and label.

  3. I use 2, and add the \begin{table}, \caption, \label before the block and the \end{table} after. Then I get the correct table, incl. caption, but I cannot use the @tbl-label to crossreference, which is annoying, since I want to use HTML export as well. For LaTeX \ref{tbl-label} works, but then I'd need to add the "Table" in front of that and it would need more trickery to switch to HTML export.

Is there a way to either make (1) not use the verbatim environment, or (2) honour the float options #| label and #| tbl-cap:?

Checklist

  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcrossreftablesIssues with Tables including the gt integration

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions