Hi Otared and Aditya,
I get the same mtx-context | fatal error: return code: 1
The log shows this :
tex error > tex error on line 36 in file /home/adeimantos/TRAVAIL/context/Fichiers-ConTeXt_Doc- Tests/ConTEXt_TEST_Formulaire. tex: ! Illegal parameter number in definition of \MyHeader
----- Mail original -----
De: "Otared Kavian" <otared@gmail.com>
À: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Envoyé: Vendredi 18 Août 2017 11:45:47
Objet: Re: [NTG-context] About \setupheadertexts : simplify a code
Hi Aditya,
I tried to typeset your example, but got an error: whether or not the command
% macros=mkvi
is present on the fist line, then ConTeXt complains saying that
! Illegal parameter number in definition of \MyHeader
and stops typesetting pointing to the command \stoptexdefinition.
What am I missing here?
Thanks for your attention: OK
> On 18 Aug 2017, at 06:25, Aditya Mahajan <adityam@umich.edu> wrote:
>
> On Fri, 18 Aug 2017, Henri wrote:
>
>> On Thu, 2017-08-17 at 15:25 +0200, Fabrice Couvreur wrote:
>>> Hello,
>>> To get the alignment, I had to create three \vbox. Can we simplify this code a bit ?
>>> Thank you
>>> Fabrice
>>
>> Use the optional argument of the new framed you defined.
>
> In addition to that, you can also simplify other things as well. This is how I would have done it:
>
> % macros=mkvi
> \showframe
>
> \setuplayout
> [header=3\lineheight,
> headerdistance=\lineheight]
>
> \setupbackgrounds
> [header]
> [text]
> [
> frame=off,
> bottomframe=on,
> framecolor=darkgray,
> rulethickness=2pt,
> ]
>
> \defineframed[headerframed]
> [
> frame=off, % For visualization set this to on
> height=fit,
> width=fit,
> location=bottom,
> boffset=\lineheight,
> ]
>
> \starttexdefinition MyHeader #where #day #month #year #title #number #time
>
> \setupheadertexts
> [{\headerframed[align=middle, foregroundstyle=bold, foregroundcolor=red]
> {#title n\high{o}\,#number}}]
>
> \setupheadertexts
> [{\headerframed[align=flushleft, foregroundstyle=\ssx]
> {Lycée JANSON DE SAILLY \\ \date[d=#day,m=#month,y=#year]}}]
> [{\headerframed[align=flushright, foregroundstyle=\ssx]
> {#where \\ {#time}}}]
>
> \stoptexdefinition
>
> \MyHeader{Seconde}{17}{08}{2017}{Devoir surveillé}{1}{1h\,30m}
>
> \starttext
> \input knuth
> \stoptext
>
> An added benefit is that you get correct interlinespace for the left and right header.
>
> Aditya______________________________________________________ _____________________________
> 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://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
____________________________________________________________ _______________________