[OS X TeX] Verbatim mode question...

Ross Moore ross at ics.mq.edu.au
Mon Jun 17 21:49:26 EDT 2002



> Perchance, would anyone happen to know how to format a piece of 
> verbatim text within, say, the \caption{} command in the figure 
> environment?

Ouch; that would be technically a *very* difficult thing to do.

Do you really need verbatim ?
Or is it just the \texttt mono-spaced font style that you need ?

> monospaced/tt font). However, not being a LaTeX programmer, I was 
> unable to glean anything usable.

As a general rule, true verbatim (as with \verb+...+) cannot work
in the argument of a LaTeX command.
This is because \verb needs to change the interpretation of
special characters *before* they are read by TeX.

Once the argument has been read, the interpretation has been frozen,
so to speak, as that normally used in (La)TeX documents.
(e.g. a $ means a math-shift operation, not a dollar-symbol).
It can no longer be changed.

 
> Yes, I know this is a pure LaTeX question, but I am unable to find 
> any sort of answer (I recall that it may be possible, but have search 
> my own notes, the books I own, and a few FAQ documents without any 
> luck).

Most special characters can be obtained by simple macros:
 \$ \@ \_ \% \&   ( \^{} \~{} are not quite right )
 
> I did take a peek at the code in "graphics.sty" ("draft mode" puts 
> filename in place of placed graphics files in the current 

There is some TeX trickery that can be used in some places,
but being within  \caption  adds an extra degree of difficulty,
as it's argument is used in 2 places:

  1. as the caption to a figure, when placed
and
  2. within the List of Figures page.

To make trickery work correctly in both places would be quite hard.


> I did try using boxes and other variants of enclosing the verbatim 
> text (I know that there is an issue with the verb/verbatim 
> environment within other environments). For some reason, I have a 
> feeling that the solution isn't too difficult, or impossible, and 
> that I may have also known how to do this in the past....

It will involve writing macros, and using those within the captions.
\DeclareRobustCommand , or similar ideas, will play some role.

 
> Anyone feeling helpful? I will greatly appreciate any help offered. Thanks.

I'd need to see exactly what you are trying to do, to be able
to work out the best way to handle it.


Hope this helps,

	Ross Moore

> 
> 
> -Dave
> 
> 
> -----------------------------------------------------------------
> Threaded list archives can be found at:
> <http://www.masda.vxu.se/~pku/MacOSX_TeX/>
> -----------------------------------------------------------------
> To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
> "unsubscribe macosx-tex" (no quotes) in the body.
> For additional HELP, send email to <info at email.esm.psu.edu> with
> "help" (no quotes) in the body.
> -----------------------------------------------------------------


-----------------------------------------------------------------
Threaded list archives can be found at:
<http://www.masda.vxu.se/~pku/MacOSX_TeX/>
-----------------------------------------------------------------
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.
-----------------------------------------------------------------




More information about the MacOSX-TeX mailing list