ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* setuphead broken?
@ 2012-09-13 10:14 John Devereux
  2012-09-13 10:27 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: John Devereux @ 2012-09-13 10:14 UTC (permalink / raw)
  To: ntg-context


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
___________________________________________________________________________________


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

* Re: setuphead broken?
  2012-09-13 10:14 setuphead broken? John Devereux
@ 2012-09-13 10:27 ` Wolfgang Schuster
  2012-09-13 11:49   ` John Devereux
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2012-09-13 10:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 13.09.2012 um 12:14 schrieb John Devereux <john@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
___________________________________________________________________________________


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

* Re: setuphead broken?
  2012-09-13 10:27 ` Wolfgang Schuster
@ 2012-09-13 11:49   ` John Devereux
  0 siblings, 0 replies; 3+ messages in thread
From: John Devereux @ 2012-09-13 11:49 UTC (permalink / raw)
  To: ntg-context

Wolfgang Schuster <wolfgang.schuster@gmail.com> writes:

> Am 13.09.2012 um 12:14 schrieb John Devereux <john@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
___________________________________________________________________________________

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

end of thread, other threads:[~2012-09-13 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-13 10:14 setuphead broken? John Devereux
2012-09-13 10:27 ` Wolfgang Schuster
2012-09-13 11:49   ` John Devereux

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).