[texhax] 'verbatim' inside 'raisebox'?

Uwe Lueck uwe.lueck at web.de
Thu Jun 11 08:39:46 CEST 2009


It is well known that verbatim environments are difficult ... 

    http://mirror.ctan.org/macros/latex/contrib/fancybox/fancybox.pdf

discusses this on pp. 18ff. and offers some solutions. 

However, for \raisebox with only *short* (part of line) verbatim text the problem may be much easier than with listings that verbatim etc. are made for: 

    \newsavebox{\mybox}
    \begin{lrbox}{\mybox}
    \verb|\stuff|
    \end{lrbox}
    A\raisebox{1ex}{\usebox{\mybox}} B

HTH -- Uwe. 

T Ziomek <ctz001 at email.mot.com> schrieb am 11.06.2009 05:06:30:
> I need to put pre-formatted text (ala HTML <PRE> or <CODE>) within
> a 'raisebox'.  AFAICT the Tex way to do this is via 'verbatim'
> (though I'd welcome alternative suggestions).  But Tex (specific-
> ally, pdfeTeX, Version 3.141592-1.21a-2.2) fails on the 2nd clos-
> ing '}'.
> 
> My simplest test case:
>   \documentclass{article}
>   \begin{document}
>   \raisebox
>      {-1.5 cm}
>      {
>         \begin{verbatim}
>            Some text
>         \end{verbatim}
>      }
>   \end{document}
> 
> Output:
>   % latex t2.tex
>   This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
>   entering extended mode
>   (./t2.tex
>   LaTeX2e <2003/12/01>
>   Babel  and hyphenation patterns for american, french, german,
>   ngerman, b ahasa, basque, bulgarian, catalan, croatian, czech,
>   danish, dutch, esperanto, e stonian, finnish, greek, icelandic,
>   irish, italian, latin, magyar, norsk, polis h, portuges,
>   romanian, russian, serbian, slovak, slovene, spanish, swedish,
>   tur kish, ukrainian, nohyphenation, loaded.
>   (/usr/share/texmf/tex/latex/base/article.cls
>   Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
>   (/usr/share/texmf/tex/latex/base/size10.clo))
>   No file t2.aux.
>   
>   ! LaTeX Error: Something's wrong--perhaps a missing \item.
>   
>   See the LaTeX manual or LaTeX Companion for explanation.
>   Type  H   for immediate help.
>    ...                                              
>                                                     
>   l.9    }
>            
>   ? 
> 
> 
> I see the same issue if I include "\usepackage{verbatim}".
> 
> Any suggestions?  Thanks,
> Tom
> 
> 
> I don't think my larger use case matters, but just in case:  I'm using
> the message sequence chart package from
> <http://www.ctan.org/tex-archive/macros/latex/contrib/msc/>.  Some of
> my MSC message flows require formatted text, and 'raisebox' so the
> message line/arrow doesn't overlap the text, so it's on a '\mess' that
> I'm trying to use 'raisebox' and within that 'verbatim'.
> -- 
>   /"\  ASCII Ribbon Campaign   |
>   \ /                          |   Email to user 'CTZ001'
>    X        Against HTML       |             at 'email.mot.com'
>   / \     in e-mail & news     |



More information about the texhax mailing list