How can I use a starred version of a LaTeX environment with

In an R Markdown document with LaTeX output, I can use custom blocks for a LaTeX environment.

:::{.multicols data-latex="{2}"}
Lorem ipsum
:::

The LaTeX output will be:

\begin{multicols}{2}
Lorem ipsum
\end{multicols}

Some LaTeX environments have a version with an asterisk, and I want it to use multicols* instead of multicols. I tried the following:

:::{.multicols* data-latex="{2}"}
Lorem ipsum
:::

But that resulted in this LaTeX output:

:::\{.multicols* data-latex=``\{2\}''\}
Lorem ipsum
:::

The problem is that it is being escaped. I do not want that. I want this:

\begin{multicols*}{2}
Lorem ipsum
\end{multicols*}

I think this is a missing feature from our LaTeX environment support in rmarkdown.

You should open a new feature request in R Markdown.

I don't think Pandoc will support the * in the class name, but we can add an attribute maybe like starred=true or another class .starred so that we know when to add this

:::{.multicols .starred data-latex="{2}"}
Lorem ipsum
:::

For now workaround is to use raw latex

1 Like

I created an issue in the R Markdown repository: [FR] Starred LaTeX environment with custom blocks · Issue #2427 · rstudio/rmarkdown · GitHub

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.