On 02/07/2014 12:36 AM, Wolfgang Schuster wrote:
Am 06.02.2014 um 19:29 schrieb Pablo Rodriguez:
[...] After reading the document, I think it could be achieved with: [...] But this doesn’t work. I must be missing something obvious.
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
Sorry for not having replied before and many thanks for your help, Wolfgang. The code works as you told me. I really appreciate your help. I have a further question about the option=TEX to color code. This was my original issue, but I haven’t expressed myself clearly. The question is directed primarily to Hans. With option=TEX, comment seems to be the only element that isn’t colored and formatted as a whole. Other elements are formatted as a whole and the format even extends in multiple lines. My question here isn’t technical (unless the described behavior is a bug). The issue is on visual coherence. At least for newbies, it would be better to differentiate visually between regular text and commented text. Is there any reason not to format whole comments option=TEX? (Sorry, but I don’t understand why this is different.) Many thanks for your help, Pablo -- http://www.ousia.tk