Gunther Maier
Gunther Maier

Reputation: 23

Quarto-Pandoc: md to latex: How to change .cell and .cell-output formatting?

I'm trying to develop a Quarto extension for an OA journal. In that context, I need to change how Pandoc formats the R code junks and their output. I know about Quarto extensions and partials. I searched for hours but cannot find the solution to my (fairly simple) problem. Please help!

I render a document to PDF and keep the MD-file as well as the TEX-file.

In the MD-file, I have:

::: {.cell}

```{.r .cell-code}
sqrt(2)
```

::: {.cell-output .cell-output-stdout}

```
[1] 1.414214
```

:::
:::

By default, this translates to the following code in the TEX-file:

\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{sqrt}\NormalTok{(}\DecValTok{2}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
[1] 1.414214
\end{verbatim}

For my journal extension, I need to replace the "verbatim" environment by a "Verbatim" environment (capital "V"). Is there a tex-partial or another configuration file that needs to be changed for that? I just cannot find the right place.

I searched through the online documentation and the GitHub repos mentioned there.

Upvotes: 1

Views: 105

Answers (1)

Instead of changing the output of quarto, you could tackle this from the latex side and redefine verbatim to be the same as Verbatim:

---
title: "Proof of Concept"
author: "Your Name"
date: "2024-06-08"
format: pdf
header-includes:
 - \RecustomVerbatimEnvironment{verbatim}{Verbatim}{}
---

::: {.cell}

```{.r .cell-code}
sqrt(2)
```

::: {.cell-output .cell-output-stdout}

```
[1] 1.414214
```

:::
:::

Upvotes: 2

Related Questions