[OS X TeX] Colored words

Alain Schremmer Schremmer.Alain at verizon.net
Sat Feb 19 18:09:27 EST 2005


Herb Schulz wrote:

>On 2/19/05 11:35 AM, "Alain Schremmer" <Schremmer.Alain at verizon.net> wrote:
>
>  
>
>>Now that my dental problem has been cured, I would like to know how I
>>can emulate TeXshop's source style.
>>Specifically, while, in Companion2ed, I found that fancyvrb allows one
>>to reformat a whole line (page 157), I have not been able to
>>"Helveticize" and color single words within a line of regular LaTeX text.
>>Regards
>>--schremmer
>>
>>    
>>
>
>Howdy,
>
>Documentation for the fancyvrb package is in
>'/usr/local/teTeX/share/texmf.tetex/doc/latex/fancyvrb/'
>Or use the symbolic link
>'/Library/teTeX/share/texmf.tetex/doc/latex/fancyvrb/'
>assuming you've got the documentation loaded. Basically you've got to tell
>the Verbatim environment what to use as a ``command'' character.
>
>What kind of pretty printing are you trying to do? If it's programming
>language printing take a look at the listings package.
>
>Good Luck,
>
>Herb Schulz
>(herbs at wideopenwest.com)
>  
>
I read the documentation which I found indeed better than Companion2ed.

The "pretty printing [I] am trying to do" is reproducing TeXShop's 
source file. (I finally got hooked by my own petard and had to agree to 
write … the intro to LaTeX that I would have liked to have last year.) 
For instance, I would like to be able to write stuff like

Say you want to Boldface the word "text". Select "text", Go Window > 
LaTeX panel > Typeface > Bold. Observe that, in the source, "text" is 
now the argument of \textbf{ }. Typeset.

in which "text" appears in Helvetica rather than between quotes, \textbf 
appears in blue Helvetica and the curly braces in green.

So far, though, I have only been able to get what follows which is still 
far off the mark.

\documentclass[11pt]{book}
\usepackage{fancyvrb}
\usepackage{color}
\begin{document}

\DefineShortVerb{\|}
This text is within DefineShortVerb, \Verb+this text is in verbatim, + 
and this is more text within DefineShortVerb.
\UndefineShortVerb{\|}

\begin{Verbatim}[commandchars=\\\{\}]
This text is within Verbatim, \textcolor{red}{this is Red Text within 
Verbatim,} and this is more text within Verbatim.
\end{Verbatim}


This is body text while
\begin{Verbatim}[fontfamily=helvetica]
this text is in helvetica, the font used in the text file in TeXShop.
\end{Verbatim}
this is more body text.

\end{document}

Best regards
--schremmer

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list