[NTG-context] suggestion on [option=TEX]

Wolfgang Schuster schuster.wolfgang at gmail.com
Fri Feb 7 00:36:19 CET 2014


Am 06.02.2014 um 19:29 schrieb Pablo Rodriguez <oinos at gmx.es>:

> On 02/06/2014 12:57 AM, Wolfgang Schuster wrote:
>> Am 05.02.2014 um 19:50 schrieb Pablo Rodriguez <oinos at gmx.es>:
>> 
>>> Hi Hans,
>>> 
>>> I have the following sample:
>>> 
>>> \setuptyping[option=TEX]
>>> \starttext
>>> \starttyping
>>> \input zapf % knuth
>>> \stoptyping
>>> \stoptext
>>> 
>>> The percent character is in bold font and gray color, but the rest of
>>> the commented text isn’t.
>>> [...]
>> 
>> http://pragma-ade.com/general/magazines/mag-1102.pdf
> 
> Many thanks for your reply, Wolfgang.
> 
> After reading the document, I think it could be achieved with:
> 
> \definefontfamily[mainface][mono][DejaVu Sans Mono]
> \setupbodyfont[mainface]
> \defineprocessor[myescape][style=bold,color=gray, left=\%]
> \setuptyping[TEX][escape=myescape->{\%}]
> \starttext
> \startTEX
> This is a c%omment.
> 
> % And this is another one.
> 
> \command
>  [with colored]
>  {brackets}
> \stopTEX
> \stoptext
> 
> But this doesn’t work. I must be missing something obvious.
> 
> What am I doing wrong here?
> 
> Many thanks for your help,


You have to add a comma after \letterpercent. You should also be careful with
the text in the comments because commands are expanded, e.g. take a look
at the \TeX in the comment.

\setupbodyfont[dejavu]

\defineprocessor[myescape][style=\ttbf,color=gray,left={\letterpercent}]

\setuptyping[TEX][escape=myescape->{\letterpercent,}]

\starttext
\startTEX
This is \TeX\ code % and this is a \TeX\ comment.
\stopTEX
\stoptext

Wolfgang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20140207/a686a1f7/attachment-0001.html>


More information about the ntg-context mailing list