🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #2005

Re: Help writing a macro that expands to \verb

#2005
From: William Skyvington
Date: Wed, 02 Sep 1992 16:36
33 lines
2017 bytes
In article <1992Sep1.123134.7107@cs.cornell.edu>, raman@cs.cornell.edu
(T. V. Raman) writes:

|  I would like to have a macro of the following type:
|  \term#1 which expands to \verb|#1| but do not know how to write it.

I've been using the following hack for years now, and I would find it
difficult to live without it when writing software manuals:

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%  Verbatim term
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%%%  Write \|word| to typeset "word" in verbatim \tt font.

\def\|{\begingroup \catcode``=13 \@noligs 
\tt \let\do\@makeother \dospecials 
\obeyspaces \frenchspacing \def\@tempa ##1|{##1\endgroup}\@tempa}

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

My borrowing the "\|" signs to indicate the start of a verbatim term
means that there's some kind of sophisticated mathematical thing (I've
forgotten what it is) that I can no longer do. Naturally, the only sign
that cannot appear in a verbatim term is the vertical bar. But they're
not all that common in programming languages. It goes without saying
that this "\|verbatim|" construct is only used for short in-line terms.

=====================================================================
      William Skyvington    ILOG     2 avenue Gallieni - BP 85
            94253 GENTILLY CEDEX     France                             
          Tel 33 (1) 46 63 66 66     E-mail skyvington@ilog.fr
=====================================================================
Technical Details
Message-ID: <22966@ilog.fr>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!corton!ilog!republique!skyvingt
References: <1992Sep1.123134.7107@cs.cornell.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!corton!ilog!republique!skyvingt
From: skyvington@republique.ilog.fr (William Skyvington)
Newsgroups: comp.text.tex
Subject: Re: Help writing a macro that expands to \verb
Message-ID: <22966@ilog.fr>
Date: 2 Sep 92 16:36:18 GMT
References: <1992Sep1.123134.7107@cs.cornell.edu>
Sender: news@ilog.fr
Reply-To: skyvington@ilog.fr
Organization: ILOG (Software Intelligence), Gentilly, France
Lines: 33