Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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}


share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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