1
---
documentclass: report
classoption: twoside
fontsize: 12pt
output: 
  pdf_document: 
    latex_engine: xelatex
    keep_tex: true
header-includes: |
  \usepackage{geometry}
  \usepackage{tikz}
  \newcommand{\zero}{\centerline{\tikz{\node[circle, fill=gray, minimum size=0.4\linewidth] {};}}}
---
\zero

I am wondering why in the tex file I am not getting

\begin{document}
\zero
\end{document}

instead I get the full code

\begin{document}
\centerline{\tikz{\node[circle, fill=gray, minimum size=0.4\linewidth] {};}}
\end{document}
Mohamed
  • 89
  • 6
  • 1
    Macros with \newcommnad are expanded when exported. Not sure why, because this is exactly what LaTeX will also make, but if this is a problem, note that macros with \def are not expanded. However, you must be aware that careless use of \def could have unexpected consequences. – Fran Dec 21 '20 at 11:35

0 Answers0