I have come to realize that the pleasant style (argument in italics, enclosed by angle brackets) of macro descriptions in numerous package documentations is actually produced by a number of special commands, such as \marg and \oarg, provided by the ltxdoc document class.

The following screenshot is taken from documentation of the listings package.

enter image description here

How can I produce the same (or similar) result with normal packages (e.g. listings) in, say, the article document class?


Plundering existing code goes a long way :)

enter image description here


\usepackage[T1]{fontenc} % for typewriter braces 
\usepackage{textcomp}    % for ``text'' angle brackets

% adapted from doc.dtx    
\providecommand\meta[1]{\textlangle{\itshape #1\/}\textrangle}

% directly taken from ltxdoc.dtx

% directly taken from listings.dtx (lstdoc.sty)

% adapted from listings.dtx (lstdoc.sty)

\rcmdname\lstset\marg{key=value list}
\rcmdname\lstinputlisting\oarg{key=value list}\marg{file name}


  • 1
    Thanks, :-) This works just fine. Although I cannot completely understand the code. But I will firstly search for what I do not know by myself. Moreover, I have found an easier solution provided by @LeoLiu (but not on SE site): Use listings package, and set \lstset{basicstyle=\ttfamily,moredelim=[s][\normalfont\itshape]{<}{>}}. – Naitree May 3 '14 at 14:08

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.