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?

  • 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

enter image description here

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




%some stuff that does something
%    \begin{macrocode}
%    \end{macrocode}
  • 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
  • ltxdoc` is a very thin wrapper that just loads doc package with article 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.