[NTG-context] need defaults for \definehighlight

Idris Samawi Hamid ادريس سماوي حامد ishamid at colostate.edu
Sat Feb 7 20:33:00 CET 2015


Hi Hans,

On Sat, 07 Feb 2015 05:53:08 -0700, Hans Hagen <pragma at wxs.nl> wrote:

> Well, if you talk about automatic injection of commands 'short' is  
> irrelevant and also likely to clash.

Ok, fair enough. There is also function auto-completion...

> Anyway, the problem with predefined highlights is that we won't overload  
> existing commands by default, so redefining is not an option in the core.
>
> An option is to provide a set like:
>
> \unprotect
>
> \definehighlight[\v!italic    ][\c!command=\v!no,\c!style=\v!italic]
> \definehighlight[\v!bold      ][\c!command=\v!no,\c!style=\v!bold]
> \definehighlight[\v!bolditalic][\c!command=\v!no,\c!style=\v!bolditalic]
> \definehighlight[\v!mono]      [\c!command=\v!no,\c!style=\v!mono]
> \definehighlight[\v!monobold]  [\c!command=\v!no,\c!style=\v!monobold]
>
> \definehighlight[important]    [\c!command=\v!no,\c!style=\v!bold]
> \definehighlight[unimportant]  [\c!command=\v!no,\c!color=darkgray]
> \definehighlight[warning]  
> [\c!command=\v!no,\c!style=\v!bold,\c!color=darkblue]
> \definehighlight[error]  
> [\c!command=\v!no,\c!style=\v!bold,\c!color=darkred]
>
> \protect
>
> \starttext
>
>      \highlight[italic]     {italic}
>      \highlight[bolditalic] {bolditalic}
>      \highlight[bold]       {bold}
>      \highlight[mono]       {mono}
>      \highlight[monobold]   {monobold}
>      \highlight[important]  {important}
>      \highlight[unimportant]{unimportant}
>      \highlight[warning]    {warning}
>      \highlight[error]      {error}
>
> \stoptext
>
> Keep in mind that coding in terms of 'emph' is rather useless with  
> respect to highlights. Highlights relate to structure (while \it  
> doesn't) so you need tags like 'important' and so.

Yes, but when precisely used emphasis is just as structural as important.  
Put another way, important is a species of the genus emphasis. But instead  
of, say, 'lightemphasis', something like 'emphasis' should not cause  
confusion.

Or we could do 'important' and 'veryimportant'. The defaults could be  
something like

\definehighlight[important]    [\c!command=\v!no,\c!style=\v!italic]
\definehighlight[veryimportant]    [\c!command=\v!no,\c!style=\v!bold]
\definehighlight[extraimportant]     
[\c!command=\v!no,\c!style=\v!bolditalic]

> Also, by defining highlights with the command = no option will provide a  
> bit more protection.

Could you explain? Or give an example?

> But we need to agree on some kind of reasonable set first.

Ok, take a look at this iteration:

===============
\unprotect

\definehighlight[\v!italic    ][\c!command=\v!no,\c!style=\v!italic]
\definehighlight[\v!bold      ][\c!command=\v!no,\c!style=\v!bold]
\definehighlight[\v!bolditalic][\c!command=\v!no,\c!style=\v!bolditalic]
\definehighlight[\v!mono]      [\c!command=\v!no,\c!style=\v!mono]
\definehighlight[\v!monobold]  [\c!command=\v!no,\c!style=\v!monobold]
\definehighlight[\v!smallcaps]  [\c!command=\v!no,\c!style=\v!smallcaps]

\definehighlight[important]    [\c!command=\v!no,\c!style=\v!italic]
\definehighlight[veryimportant]    [\c!command=\v!no,\c!style=\v!bold]
\definehighlight[extraimportant]     
[\c!command=\v!no,\c!style=\v!smallcaps]
% \definehighlight[extraimportant]     
[\c!command=\v!no,\c!style=\v!bolditalic] % smallcaps is a better default  
for extraimportant than bolditalic
\definehighlight[unimportant]  [\c!command=\v!no,\c!color=darkgray]
\definehighlight[warning]  
[\c!command=\v!no,\c!style=\v!bold,\c!color=darkblue]
\definehighlight[error]  
[\c!command=\v!no,\c!style=\v!bold,\c!color=darkred]

\definehighlight[emphasis]    [\c!command=\v!no,\c!style=\v!italic] % Does  
Hans prefer slanted here for default??
\definehighlight[booktitle]    [\c!command=\v!no,\c!style=\v!italic]
\definehighlight[abbreviation]    [\c!command=\v!no,\c!style=\v!smallcaps]
\definehighlight[propername]    [\c!command=\v!no,\c!style=\v!smallcaps]

%% Use-mention distinction
% \definehighlight[concept]    [\c!command=\v!no,\c!command=\v!\quotation]  
% doesn't work!
% \definehighlight[expression]    [\c!command=\v!no,\c!command=\v!\quote]   
% doesn't work!

\definehighlight[typing]    [\c!command=\v!no,\c!style=\v!mono]

\protect

\starttext

     \highlight[italic]     {italic}
     \highlight[bolditalic] {bolditalic}
     \highlight[bold]       {bold}
     \highlight[mono]       {mono}
     \highlight[monobold]   {monobold}
     \highlight[smallcaps]  {smallcaps}

     {\sc smallcaps}       % this works
     \smallcaps{smallcaps} % this command doesn't work!!

     \highlight[important]      {important}
     \highlight[veryimportant]  {very important}
     \highlight[extraimportant] {extra important}
     \highlight[unimportant]    {unimportant}
     \highlight[warning]        {warning}
     \highlight[error]          {error}

     \highlight[emphasis]     {emphasis}
     \highlight[abbreviation] {abbreviation}
     \highlight[booktitle]    {Book Title}
     \highlight[propername]   {Proper Name}

     % \highlight[concept]    {concept}
     % \highlight[expression] {expression}

     \highlight[typing]    {typing}
\stoptext
===============

Note the comments on smallcaps, quotation, quote, concept, and expression.  
These need to be fixed somehow. Thanks and

Best wishes
Idris
-- 
Idris Samawi Hamid
Professor of Philosophy
Colorado State University
Fort Collins, CO 80523


More information about the ntg-context mailing list