Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap latex commands #14

Open
ratnanil opened this issue Oct 24, 2023 · 0 comments
Open

Wrap latex commands #14

ratnanil opened this issue Oct 24, 2023 · 0 comments

Comments

@ratnanil
Copy link

As stated in #13, I want to use the latex-environment filter to highlight specific parts of my code, using the listings latex package / environment together with colorbox. Per default, all latex code within a listings environment is ignored. However, I can specify an escape character in the package options (see here)

escapechar=⟨character⟩ or escapechar={}
If not empty the given character escapes the user to LATEX: all code between
two such characters is interpreted as LATEX code

So if I set the escapechar = |, everything in between | in my listing environment will be interpreted as latex code. Is there a way to get this input:

:::{.lstlisting}
[one]{.colorbox optons = "gray"}, [two]{.colorbox options = "red"}
:::

to this latex output (note the wrapping |)?:

\begin{lstlisting}
|\colorbox{gray}{one}|, |\colorbox{red}{two}|
\end{lstlisting}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant