1

I use ltxdoc and want to have a different font for the macro code. Inspired by

Change macrocode environment colour when documenting package with ltxdoc

I tried the suggestion given there

\AtBeginEnvironment{macrocode}{Xx\huge\bfseries Yy}

Now the Yy is in huge/bold, but the rest of the macros is not. Any hint to what I should do?

Jack
  • 1,137
  • your question would (as always) be clearer if you showed as test document, but in principle you just need to define \MacroFont to be whatever font you want, I think. – David Carlisle Jan 25 '18 at 21:35

1 Answers1

3

enter image description here

macrocode uses the hook \MacroFont which you can define to be whatever:

%\iffalse
\documentclass{ltxdoc}
\usepackage{color}
\renewcommand\MacroFont{\Huge\color{blue}\ttfamily}
\begin{document}

\DocInput{\jobname}
\end{document}

%\fi


%some stuff that does something
%    \begin{macrocode}
\zz
\zzzzz
\zzZ
%    \end{macrocode}
David Carlisle
  • 757,742
  • 1
    Thank you David. I did not find something like MacroFont in the ltxdoc documentation, but after searching for it I found it in doc.sty. The doc.sty documentation gives me some further clues – Jack Jan 26 '18 at 11:30
  • 1
    ltxdocis a very thin wrapper that just loadsdocpackage witharticle` class and a few helper commands for documenting the base latex sources, all the real code is in the doc package. – David Carlisle Jan 26 '18 at 12:19
  • Yes, you made me aware of that. Thanks again – Jack Jan 27 '18 at 20:34