[OS X TeX] Colored words

Aaron Jackson jackson at msrce.howard.edu
Sun Feb 20 22:29:12 CET 2005


On Feb 20, 2005, at 9:07 AM, Alain Schremmer wrote:

> Aaron Jackson wrote:
>
>> You most likely only need to change the C references to tex, or  
>> something similar, in order to use it as is.  Then just tweek until  
>> you get what you want...
>
> Awsome! Indeed, all I did was to change C to tex and Hello world to  
> file.tex and there it was.
>
> Unfortunately, this does not help me. Here is my situation:
>
> In the process of a step by step instruction, I am refering within my  
> own text to pieces of the TeXShop source code that a person already  
> has. Using the TeXShop look and feel for these pieces of source code  
> would avoid the use of quotes. Here is an example of what I am  
> writing:
>
>            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.
>
> Most of this is in Body Text but I would like "text" to be in  
> Helvetica, "\textbf" to be in blue Helvetica with the curly braces "{  
> }" in green Helvetica, rather than in Body Text between quotes.

OK.  I see what you are trying to do.  As a dirty hack, if you only  
have one or two references to LaTeX code, you can use the following.   
Of course there's probably a better way to do this with listings  
package, I just don't know how...

\documentclass[11pt]{article}
\usepackage[pdftex]{color}
\newcommand{\mysyntaxp}[2]{\textcolor{blue}{\textbackslash#1}\textcolor{ 
green}{\{}\textsf{#2}\textcolor{green}{\}}}
\newcommand{\mysyntax}[1]{\textcolor{blue}{\textbackslash#1}}
\begin{document}

\mysyntaxp{textbf}{test}

\mysyntax{itshape}

  \end{document}

--------------------- 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 macostex-archives mailing list