ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* suggestion on [option=TEX]
@ 2014-02-05 18:50 Pablo Rodriguez
  2014-02-05 23:57 ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez @ 2014-02-05 18:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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.

My suggestion would be to apply the same color and font of the percent
character to the rest of the comment. So it is easier to see that the
text is a comment. And I think coloring the whole commented text (not
only the percent character) is the normal practice in all text editors
(if comments are colored at all).

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: suggestion on [option=TEX]
  2014-02-05 18:50 suggestion on [option=TEX] Pablo Rodriguez
@ 2014-02-05 23:57 ` Wolfgang Schuster
  2014-02-06 18:29   ` Pablo Rodriguez
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2014-02-05 23:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 05.02.2014 um 19:50 schrieb Pablo Rodriguez <oinos@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.
> 
> My suggestion would be to apply the same color and font of the percent
> character to the rest of the comment. So it is easier to see that the
> text is a comment. And I think coloring the whole commented text (not
> only the percent character) is the normal practice in all text editors
> (if comments are colored at all).


http://pragma-ade.com/general/magazines/mag-1102.pdf

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: suggestion on [option=TEX]
  2014-02-05 23:57 ` Wolfgang Schuster
@ 2014-02-06 18:29   ` Pablo Rodriguez
  2014-02-06 23:36     ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Rodriguez @ 2014-02-06 18:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 02/06/2014 12:57 AM, Wolfgang Schuster wrote:
> Am 05.02.2014 um 19:50 schrieb Pablo Rodriguez <oinos@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,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: suggestion on [option=TEX]
  2014-02-06 18:29   ` Pablo Rodriguez
@ 2014-02-06 23:36     ` Wolfgang Schuster
  2014-02-12 20:10       ` Pablo Rodriguez
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2014-02-06 23:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1613 bytes --]


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

> On 02/06/2014 12:57 AM, Wolfgang Schuster wrote:
>> Am 05.02.2014 um 19:50 schrieb Pablo Rodriguez <oinos@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

[-- Attachment #1.2: Type: text/html, Size: 2611 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: suggestion on [option=TEX]
  2014-02-06 23:36     ` Wolfgang Schuster
@ 2014-02-12 20:10       ` Pablo Rodriguez
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Rodriguez @ 2014-02-12 20:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-12 20:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-05 18:50 suggestion on [option=TEX] Pablo Rodriguez
2014-02-05 23:57 ` Wolfgang Schuster
2014-02-06 18:29   ` Pablo Rodriguez
2014-02-06 23:36     ` Wolfgang Schuster
2014-02-12 20:10       ` Pablo Rodriguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).