# Option to include root macros in latex lstlisings?

**URL:** <https://root-forum.cern.ch/t/option-to-include-root-macros-in-latex-lstlisings/59239>\
**Category:** Newbie\
**Created:** [May 6, 2024, 2:29pm UTC](https://root-forum.cern.ch/t/option-to-include-root-macros-in-latex-lstlisings/59239 "2024-05-06T14:29:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [May 6, 2024, 2:29pm UTC](https://root-forum.cern.ch/t/option-to-include-root-macros-in-latex-lstlisings/59239/1 "2024-05-06T14:29:19Z")

</div>

HI,  
is there any predefined option for ROOT syntax highlighting while including macros in a LaTeX document using `\lstlistings` ?

Thanks a lot

---

<div class="post-metadata">

**Author:** ![vpadulan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vpadulan/32/25315_2.png) [@vpadulan](https://root-forum.cern.ch/u/vpadulan)\
**Post date:** [May 6, 2024, 2:47pm UTC](https://root-forum.cern.ch/t/option-to-include-root-macros-in-latex-lstlisings/59239/2 "2024-05-06T14:47:59Z")

</div>

Dear @utkarsh-2000 ,

I believe there is no such options, maybe @couet knows a bit more about it.

But in any case, wouldn’t it be better to use the syntax highlighting for either C++ or Python code (depending on which language you are using in your ROOT application)?

Cheers,  
Vincenzo

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [May 13, 2024, 1:41pm UTC](https://root-forum.cern.ch/t/option-to-include-root-macros-in-latex-lstlisings/59239/3 "2024-05-13T13:41:03Z")

</div>

> [@utkarsh-2000](#):
>
> is there any predefined option for ROOT syntax highlighting while including macros in a LaTeX document using `\lstlistings` ?

No, there is not, TLatex and TMathext implement a subset of the LaTeX functionalities and only those related to a single line of text. If you want to include a macro in a LaTeX document using `lstlistings` you should do (in your LaTeX) document:

```auto
\begin{lstlisting}
Put your macro code here.
\end{lstlisting}

```
