1

I'm writing class documentation with the doc package (well, via ltxdoc documentclass). I have several similar options like font sizes and line spacing, that I want to group together in one macro environment, listing the names in a vertical stack at left, where there is usually just one name.

I'm fine to hardcode the number of names to stack (e.g. 3) and leave unused blank, but the definition should be aligned with the first name.

MWE

\documentclass{article}
\usepackage{doc}
\begin{document}
  \begin{macro}{foo}
    the definition of foo
  \end{macro}
  \begin{macro}{bar}
    the definition of bar
  \end{macro}
  % \begin{macros}{foo}{bar}{}
  %   the definition of foo and bar
  % \end{macros}
\end{document}

Desired output

desired output

1

You just use multiple macro environments:

\documentclass{article}
\usepackage{doc}

\usepackage{lipsum}

\begin{document}

\begin{macro}{foo}
\begin{macro}{bar}
  \lipsum[1][1-4]
\end{macro}
\end{macro}

\begin{macro}{baz}
  the definition of baz
\end{macro}

\end{document}

enter image description here

2
  • Thanks. Is this intended behaviour of the macro environment? I would not have expected this to work. Aug 26 at 16:48
  • @jessexknight Yes, that's the expected behavior.
    – egreg
    Aug 26 at 17:20
1

You could use l3doc instead

\documentclass{l3doc}

\begin{document}
  \begin{macro}{foo}
    the definition of foo
  \end{macro}
  \begin{macro}{bar}
    the definition of bar
  \end{macro}
   \begin{macro}{foo,bar}
     the definition of foo and bar
   \end{macro}
\end{document}   

enter image description here

1
  • Thanks! I look forward to full release of LaTeX3 :) In the mean time, I don't like these "(End definition for ..." and it seems there's no way to disable it, so I prefer egreg's solution for now. Aug 26 at 16:50

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.