[OS X TeX] Colored words

Alain Schremmer Schremmer.Alain at verizon.net
Mon Feb 21 12:17:21 EST 2005


Aaron Jackson wrote:

> OK.  I looked at this again and the following is the best I could 
> do...   Maybe comp.text.tex can give better info.
>
> Aaron
>
> NOTE:  If you replace texcsstyle={\color{blue}} with  
> texcsstyle=*{\color{blue}} the leading \ of each command is also  
> considered part of the command, however this is a buggy feature.
>
> \documentclass[11pt]{article}
> \usepackage[pdftex]{color}
> \usepackage{listings}
> \newcommand{\mysyntaxp}[2]{\textcolor{blue}{\textbackslash#1}\textcolor{ 
> green}{\{}\textsf{#2}\textcolor{green}{\}}}
> \newcommand{\mysyntax}[1]{\textcolor{blue}{\textbackslash#1}}
> %%
> %% For computer code listings
> %%
> \newlength{\xleftmargin}
> \settowidth{\xleftmargin}{\textbf{99999}}% width of 5 digits in the  
> current font.
> \newlength{\numbersep}
> \settowidth{\numbersep}{\textbf{99}}% width of 2 digits in the 
> current  font.
> \usepackage{listings}
> \lstloadlanguages{{[latex]TeX}}
> \lstset{language={[latex]TeX}, keywordstyle=\color{blue},  
> identifierstyle=\textsf, texcsstyle={\color{blue}},  
> commentstyle=\color{red}, showstringspaces=false, showspaces=false,  
> showtabs=false, columns=fullflexible, numbers=left, stepnumber=1,  
> numberstyle=\normalsize, numbersep=\numbersep,  
> xleftmargin=\xleftmargin, tabsize=4,  fontadjust, basewidth=1ex,  
> breaklines, moretexcs={numbersep,xleftmargin,  
> color,textcolor,mysyntaxp,mysyntax,lstset,lstloadlanguages,lstinputlisti 
> ng}}
> \begin{document}
>
> \mysyntaxp{textbf}{test} \\
>
> \mysyntax{itshape} \\
>
> \lstinputlisting{Untitled.tex}
>
> \end{document} 

Sorry to have taken so long. (Had to install a sewer pipe for a friend.)

I copy pastd the above but the console says "Undefined color 'green'."
(Same for the other colors)

I am totally out of my detph here so I must bother you again.
(By the way what is the difference between \usepackage[pdftex]{color} 
and \usepackage{color} which is what I have been using so far?)

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