[NTG-context] setuphead broken?

2012-09-13 Thread John Devereux

Hi,

\setuphead seems to be broken for me in recent context (following
upgrade of a ~year-old system).

Problem happens when use the command= key.

An example from the wiki fails, as does my own code.

mtx-context | ConTeXt Process Management 0.60
mtx-context |
mtx-context | main context file: 
/opt/context/tex/texmf-context/tex/context/base/context.mkiv
mtx-context | current version: 2012.09.10 00:57

==


\setuppapersize[A5]
\setupexternalfigures[location=default] % needed only for the wiki to the find 
the figure

\useexternalfigure[section-1][cow][width=5cm,height=1cm]
\useexternalfigure[section-2][mill.png][width=5cm,height=1cm]

\setuphead
   [section]
   [command=\MySectionCommand]
\setuphead
   [subsection]
   [command=]

\def\MySectionCommand#1#2%
   {\externalfigure[section-\currentheadnumber]}

\starttext

\section{One}
\subsection{First subsection of Section One}
\section{Two}

\stoptext

==




ERROR: Argument of \MySectionCommand has an extra }.

--- TeX said ---

system   tex  error on line 19 in file test2.tex: Argument of  ...

 9[command=\MySectionCommand]
10 \setuphead
11[subsection]
12[command=]
13 
14 \def\MySectionCommand#1#2%
15{\externalfigure[section-\currentheadnumber]}
16 
17 \starttext
18 
19   \section{One}
20 \subsection{First subsection of Section One}
21 \section{Two}
22 
23 \stoptext

inserted text 
\par 
to be read again 
   }
\strc_rendering_inject_number_and_text ...ommand }
  \ifx \p_command \empty \di...
\strc_rendering_place_head_number_and_text ...ext 
  }\fi \strc_rendering_stop_...
\strc_sectioning_handle ...e_head_number_and_text 
  \else \strc_rendering_plac...
l.19 \section{One}
  
--- HELP ---
From the .log file...

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.


==





-- 

John Devereux
___
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] setuphead broken?

2012-09-13 Thread Wolfgang Schuster

Am 13.09.2012 um 12:14 schrieb John Devereux j...@devereux.me.uk:

 
 Hi,
 
 \setuphead seems to be broken for me in recent context (following
 upgrade of a ~year-old system).
 
 Problem happens when use the command= key.
 
 An example from the wiki fails, as does my own code.
 
 mtx-context | ConTeXt Process Management 0.60
 mtx-context |
 mtx-context | main context file: 
 /opt/context/tex/texmf-context/tex/context/base/context.mkiv
 mtx-context | current version: 2012.09.10 00:57
 
 ==
 
 
 \setuppapersize[A5]
 \setupexternalfigures[location=default] % needed only for the wiki to the 
 find the figure
 
 \useexternalfigure[section-1][cow][width=5cm,height=1cm]
 \useexternalfigure[section-2][mill.png][width=5cm,height=1cm]
 
 \setuphead
   [section]
   [command=\MySectionCommand]
 \setuphead
   [subsection]
   [command=]
 
 \def\MySectionCommand#1#2%
   {\externalfigure[section-\currentheadnumber]}

Use \define[2]\MySectionCommand{…} or \unexpanded\def\MySectionCommand#1#2{…}.

To get the section number for the figure you have to replace 
“\currentheadnumber” with “\namedheadnumber{section}”.

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] setuphead broken?

2012-09-13 Thread John Devereux
Wolfgang Schuster wolfgang.schus...@gmail.com writes:

 Am 13.09.2012 um 12:14 schrieb John Devereux j...@devereux.me.uk:

 
 Hi,
 
 \setuphead seems to be broken for me in recent context (following
 upgrade of a ~year-old system).
 
 Problem happens when use the command= key.
 
 An example from the wiki fails, as does my own code.
 
 mtx-context | ConTeXt Process Management 0.60
 mtx-context |
 mtx-context | main context file: 
 /opt/context/tex/texmf-context/tex/context/base/context.mkiv
 mtx-context | current version: 2012.09.10 00:57
 
 ==
 
 
 \setuppapersize[A5]
 \setupexternalfigures[location=default] % needed only for the wiki to the 
 find the figure
 
 \useexternalfigure[section-1][cow][width=5cm,height=1cm]
 \useexternalfigure[section-2][mill.png][width=5cm,height=1cm]
 
 \setuphead
   [section]
   [command=\MySectionCommand]
 \setuphead
   [subsection]
   [command=]
 
 \def\MySectionCommand#1#2%
   {\externalfigure[section-\currentheadnumber]}

 Use \define[2]\MySectionCommand{…} or \unexpanded\def\MySectionCommand#1#2{…}.

 To get the section number for the figure you have to replace 
 “\currentheadnumber” with “\namedheadnumber{section}”.

 Wolfgang

Wow that was fast, thanks Wolfgang.

I started to change the examples in the wiki
http://wiki.contextgarden.net/Titles. But I realised we need to
distinguish MKIV from MKII and I don't really know what I am doing...



-- 

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