ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: need defaults for \definehighlight
Date: Sat, 07 Feb 2015 13:53:08 +0100	[thread overview]
Message-ID: <54D60AB4.5020904@wxs.nl> (raw)
In-Reply-To: <op.xtnxd0hrfkrasx@ishamid-pc>

On 2/7/2015 2:07 AM, Idris Samawi Hamid ادريس سماوي حامد wrote:
> Dear gang,
>
> Thinking of present and future documents (maximum flexibility in
> converting from format to format), I'm moving from the standard {\em
> text} to something like \definehighlight[emph][style=italic]. Here's the
> question:
>
> Does ConTeXt contain some default highlights that need not be defined by
> the user? It seems that some of the basic ones should have presets. This
> helps with at least two things:
>
> 1. Document portability (independent of a given style or env file);
> 2. Editor setups.
>
> As an example of the latter: If I select text in Notepad++ I can do
>
> Right-Click -> ConTeXt Typography -> Emphasize
>
> where Emphasize is defined as {\em }
>
> Right now, whenever I release an update to the N++ editor package (now
> years overdue, I know) any user can depend upon this right-click
> feature. But if I define
>
> \definehighlight[emph][style=italic]
>
> and set up the editor to implement it; then there is no guarantee that
> other users will use the same definition.
>
> As issues of conversion from one format to another become ever more
> urgent and common, it makes more sense to use tagged and exportable
> versions of the common typographical functions and to standardize a few.
> So my suggestion is that we develop a set of default or "official"
> highlights for commonly used cases, with a list made available somewhere
> such as the wiki. Perhaps redefine some existing 1-parameter typography
> commands (\emph, \bold, \scap, etc.) as highlights. Some of these should
> be kept short (such as \emph, \bold) given their very frequent use.

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

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.

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

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

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2015-02-07 12:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-07  1:07 Idris Samawi Hamid ادريس سماوي حامد
2015-02-07 12:53 ` Hans Hagen [this message]
2015-02-07 19:33   ` Idris Samawi Hamid ادريس سماوي حامد
2015-02-07 19:34     ` Idris Samawi Hamid ادريس سماوي حامد
2015-02-08 12:56   ` Keith J. Schultz
2015-02-08 14:01     ` Hans Hagen
2015-02-08 14:40       ` Idris Samawi Hamid ادريس سماوي حامد
2015-02-08 17:38         ` Hans Hagen
2015-02-08 19:08           ` Idris Samawi Hamid ادريس سماوي حامد
2015-02-08 21:51             ` Hans Hagen
2015-02-08 22:42               ` Idris Samawi Hamid ادريس سماوي حامد
2015-02-09 13:34               ` Keith Schultz
2015-02-09 13:46                 ` Wolfgang Schuster
2015-02-08 19:17         ` Wolfgang Schuster
2015-02-08 19:28           ` Idris Samawi Hamid ادريس سماوي حامد
2015-02-08 23:42       ` Keith Schultz
2015-02-09  8:03         ` Hans Hagen
2015-02-08 14:24     ` Idris Samawi Hamid ادريس سماوي حامد
2015-02-08 18:51     ` Wolfgang Schuster
2015-02-09  8:46     ` Alan BRASLAU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D60AB4.5020904@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).