Re: [NTG-context] How to increment a counter

2015-02-07 Thread Wolfgang Schuster

 Am 05.02.2015 um 17:19 schrieb Otared Kavian ota...@gmail.com:
 
 Hi all,
 
 I have a counter in an itemize environment which I need to increment by using
   \incrementcounter[NameOfTheCounter]
 
 However this does not work in the following example, maybe due to the use of 
 blocks, or some other reason.
 I define two blocks, one for exercises, one for the solutions.
 Then in each exercise I have a certain number of questions, presented with an 
 itemgroup named Questions.
 Analogously I have an itemgroup named Answers, which appear in the solution 
 to an exercise. Now my problem is that some questions don’t have an answer 
 included (for instance they are too easy…) and I need to increment the 
 counter by saying
   \incrementcounter[Answers]
 
 But this does not work, for an unknown reason. (See below)
 Can anyone give an advice?

This doesn’t work because the name of the counter is “itemgroup:Answers”
and you have to use \incrementcounter[itemgroup:Answers] to increase
the counter for the items.

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
___

Re: [NTG-context] need defaults for \definehighlight

2015-02-07 Thread Hans Hagen

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
___

Re: [NTG-context] need defaults for \definehighlight

2015-02-07 Thread Idris Samawi Hamid ادريس سماوي حامد

Hi Hans,

On Sat, 07 Feb 2015 05:53:08 -0700, Hans Hagen pra...@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]

Re: [NTG-context] need defaults for \definehighlight

2015-02-07 Thread Idris Samawi Hamid ادريس سماوي حامد
On Sat, 07 Feb 2015 12:33:00 -0700, Idris Samawi Hamid ادريس سماوي حامد  
isha...@colostate.edu wrote:


\definehighlight[extraimportant] 
[\c!command=\v!no,\c!style=\v!bolditalic]


\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
--
Idris Samawi Hamid
Professor of Philosophy
Colorado State University
Fort Collins, CO 80523
___
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
___

Re: [NTG-context] How to increment a counter

2015-02-07 Thread Otared Kavian
Hi Wolfgang,

Thanks for your answer which solves the problem I encountered.
However the block mechanism seems to have some limitations regarding how a 
certain block is absent (for instance when the whole solution to a problem is 
absent).

In another thread I’ll be more precise regarding what I think is missing in the 
block mechanism: Hans talked about a « coupling » mechanism in mkiv, but I 
don’t know whether this is already done or not. 
In my opinion, what we need is a coupling mechanism which couples for instance 
each exercise with its hint, and its solution, with a built-in interaction and 
when for instance a hint or a solution is not there, one does not need to 
increment manually a counter.

Best regards: OK

 On 07 Feb 2015, at 12:46, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:
 
 
 Am 05.02.2015 um 17:19 schrieb Otared Kavian ota...@gmail.com:
 
 Hi all,
 
 I have a counter in an itemize environment which I need to increment by using
  \incrementcounter[NameOfTheCounter]
 
 However this does not work in the following example, maybe due to the use of 
 blocks, or some other reason.
 I define two blocks, one for exercises, one for the solutions.
 Then in each exercise I have a certain number of questions, presented with 
 an itemgroup named Questions.
 Analogously I have an itemgroup named Answers, which appear in the solution 
 to an exercise. Now my problem is that some questions don’t have an answer 
 included (for instance they are too easy…) and I need to increment the 
 counter by saying
  \incrementcounter[Answers]
 
 But this does not work, for an unknown reason. (See below)
 Can anyone give an advice?
 
 This doesn’t work because the name of the counter is “itemgroup:Answers”
 and you have to use \incrementcounter[itemgroup:Answers] to increase
 the counter for the items.
 
 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
 ___

___
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
___

[NTG-context] Coupling mechanism: how to use it…

2015-02-07 Thread Otared Kavian
Hi Hans,

After struggling to set up a complex structure with \defineblocks in which I 
wish to have a series of exercises (with a certain number of questions) and 
hints (some questions have no hints, ans some exercises have no hints), and 
finally solutions (again some questions have no answers, and some exercises 
don’t have solutions), I remembered that a few years ago you talked about a 
coupling mechanism in mkiv. As a matter of fact in the file
strc-enu.mkvi
this coupling mechanism is introduced but I didn’t figure out how to adapt it 
to my needs, that is to the situation I just described.

Is there an example which can help understand how to use it?
Is it possible to submit a feature request (for instance automatic interactions 
between each component, say exercise, its hint and its solution), with a 
reasonable amount of effort on your part to have it?

Thanks in advance, and please forgive me if I am pushing too far my request…
Best regards: OK
___
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
___