From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/98860 Path: news.gmane.org!.POSTED!not-for-mail From: Fabrice Couvreur Newsgroups: gmane.comp.tex.context Subject: Re: About \setupheadertexts : simplify a code Date: Fri, 18 Aug 2017 12:46:29 +0200 Message-ID: References: <1503009593.5007.98.camel@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7217674322054687108==" X-Trace: blaine.gmane.org 1503053229 25955 195.159.176.226 (18 Aug 2017 10:47:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 18 Aug 2017 10:47:09 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Aug 18 12:47:03 2017 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dieno-00068l-G1 for gctc-ntg-context-518@m.gmane.org; Fri, 18 Aug 2017 12:46:56 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 60019105589; Fri, 18 Aug 2017 12:46:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ygRydIXPph4Z; Fri, 18 Aug 2017 12:46:43 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 864671055C7; Fri, 18 Aug 2017 12:46:43 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 17ABC1055C7 for ; Fri, 18 Aug 2017 12:46:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sfZSBBlF8iS8 for ; Fri, 18 Aug 2017 12:46:41 +0200 (CEST) Original-Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 0447E105589 for ; Fri, 18 Aug 2017 12:46:30 +0200 (CEST) Original-Received: by mail-wr0-f170.google.com with SMTP id b65so66734598wrd.0 for ; Fri, 18 Aug 2017 03:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=T0XsF5I4PH8IJWeuflk2P2Pk9Z9gHOtyKJ5R6NThLu4=; b=qaH9NKOMW43EyWydCuKyiIUAS/fXDs9nN81VPPOC18iz0zjiUse8cMa8s3lEybakuo JfqmiwT8DoQ2Y9E3wdS/AR9f39WipV8iukfuGM82Dqz6Y3ub8b9zmMVltSi/JfBbIfzj MPvLqmJ+6skGUSf+PjRzY7cNiXOPvT6EzomJme0XU6O2fi8we66N1X+O1SenapPZpzxh FYOSe9lsmEA60XIZLqukUPRCwjxPci5U73GCEbhcUgGH1tbtbrZQwqSviHRMgOeaYL34 qkdF3wz8gN4oJAS4S615pBzbxHvFidNnZgN0GZR5CxbwR4XcjODTqPaZzKVgSKjtxxWG dwTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=T0XsF5I4PH8IJWeuflk2P2Pk9Z9gHOtyKJ5R6NThLu4=; b=hTNicvXkuw1wMG0U1b55gfj2jIALcIu6or6QVr5UTQLx7VIBwgN+EHTzDboWrcsDl/ vZwCoKSaIoJyUC2BNwLw1Vugujg+Ztt5IArIMKrCRq4XSJT2DvlX42q4xrA9SBx+WNsb nzJXYdkCCk7dtOJpc7ulByPSMfowRC30xzGxPIZ6JkaO8YsIDv/pbKwJfKZSfguvtHd9 8iOo7HNlr0Z6o6xDbH08HobFInHeUEmwLdbq7XmlyDkE9d7NFS9mn5f4Wx/0SlptFxcR BjvrRw9cXtqb4Pwo2+r8YJYYyVluSYaktXJf+4oIz/ZOc/MjC0wkhfHQ0vQuYPMfC+2C vugw== X-Gm-Message-State: AHYfb5jgkKRWd9IkBCMwa58h3ZDopW74aBOHw/YzykHKFnRouBQsMoIQ 63MDgA8/r8WAb5Tp7iA44uoxgpnasHAN X-Received: by 10.80.152.129 with SMTP id j1mr4304427edb.191.1503053190444; Fri, 18 Aug 2017 03:46:30 -0700 (PDT) Original-Received: by 10.80.205.92 with HTTP; Fri, 18 Aug 2017 03:46:29 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:98860 Archived-At: --===============7217674322054687108== Content-Type: multipart/alternative; boundary="94eb2c195afa7eba58055704d734" --94eb2c195afa7eba58055704d734 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, @Aditya and Henri Thank you for your suggestions. @Otared Maybe remove \showframe ? Fabrice 2017-08-18 11:45 GMT+02:00 Otared Kavian : > Hi Aditya, > > I tried to typeset your example, but got an error: whether or not the > command > % macros=3Dmkvi > 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 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 i= s > how I would have done it: > > > > % macros=3Dmkvi > > \showframe > > > > \setuplayout > > [header=3D3\lineheight, > > headerdistance=3D\lineheight] > > > > \setupbackgrounds > > [header] > > [text] > > [ > > frame=3Doff, > > bottomframe=3Don, > > framecolor=3Ddarkgray, > > rulethickness=3D2pt, > > ] > > > > \defineframed[headerframed] > > [ > > frame=3Doff, % For visualization set this to on > > height=3Dfit, > > width=3Dfit, > > location=3Dbottom, > > boffset=3D\lineheight, > > ] > > > > \starttexdefinition MyHeader #where #day #month #year #title #number > #time > > > > \setupheadertexts > > [{\headerframed[align=3Dmiddle, foregroundstyle=3Dbold, > foregroundcolor=3Dred] > > {#title n\high{o}\,#number}}] > > > > \setupheadertexts > > [{\headerframed[align=3Dflushleft, foregroundstyle=3D\ssx] > > {Lyc=C3=A9e JANSON DE SAILLY \\ \date[d=3D#day,m=3D#month,y=3D= #year]}}] > > [{\headerframed[align=3Dflushright, foregroundstyle=3D\ssx] > > {#where \\ {#time}}}] > > > > \stoptexdefinition > > > > \MyHeader{Seconde}{17}{08}{2017}{Devoir surveill=C3=A9}{1}{1h\,30m} > > > > \starttext > > \input knuth > > \stoptext > > > > An added benefit is that you get correct interlinespace for the left an= d > 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 > ____________________________________________________________ > _______________________ > --94eb2c195afa7eba58055704d734 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
@Aditya and= Henri Thank you for your suggestions.
@Otared Maybe remove= \showframe ?
Fabrice

2017-08-18 11:45 GMT+02= :00 Otared Kavian <otared@gmail.com>:
Hi Aditya,

I tried to typeset your example, but got an error: whether or not the comma= nd
=C2=A0 =C2=A0 =C2=A0 =C2=A0 % macros=3Dmkvi
is present on the fist line, then ConTeXt complains saying that
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ! Illegal parameter number in definition of \My= Header
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 simp= lify 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=3Dmkvi
> \showframe
>
> \setuplayout
>=C2=A0 =C2=A0[header=3D3\lineheight,
>=C2=A0 =C2=A0 headerdistance=3D\lineheight]
>
> \setupbackgrounds
>=C2=A0 [header]
>=C2=A0 [text]
>=C2=A0 [
>=C2=A0 =C2=A0 frame=3Doff,
>=C2=A0 =C2=A0 bottomframe=3Don,
>=C2=A0 =C2=A0 framecolor=3Ddarkgray,
>=C2=A0 =C2=A0 rulethickness=3D2pt,
>=C2=A0 ]
>
> \defineframed[headerframed]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0frame=3Doff, % F= or visualization set this to on
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0height=3Dfit, >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0width=3Dfit,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0location=3Dbotto= m,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0boffset=3D\lineh= eight,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0]
>
> \starttexdefinition MyHeader #where #day #month #year #title #number #= time
>
>=C2=A0 =C2=A0 \setupheadertexts
>=C2=A0 =C2=A0 =C2=A0 [{\headerframed[align=3Dmiddle, foregroundstyle=3D= bold, foregroundcolor=3Dred]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {#title n\high{o}\,#number}}]=
>
>=C2=A0 =C2=A0 \setupheadertexts
>=C2=A0 =C2=A0 =C2=A0 [{\headerframed[align=3Dflushleft, foreground= style=3D\ssx]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {Lyc=C3=A9e JANSON DE SAILLY \\ \dat= e[d=3D#day,m=3D#month,y=3D#year]}}]
>=C2=A0 =C2=A0 =C2=A0 [{\headerframed[align=3Dflushright, foregroun= dstyle=3D\ssx]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {#where \\ {#time}}}]
>
> \stoptexdefinition
>
> \MyHeader{Seconde}{17}{08}{2017}{Devoir surveill=C3=A9}{1}{1h\,30= m}
>
> \starttext
> \input knuth
> \stoptext
>
> An added benefit is that you get correct interlinespace for the left a= nd right header.
>
> Aditya_______________________________________________= ____________________________________
> If your question is of interes= t to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-contex= t
> webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.ne= t
> archive=C2=A0 : https://bitbucket.org/phg/context-mirror/commits/
> wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
> ____________________________________________________________= _______________________

_________________________________________________________________= __________________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-context@ntg.nl / <= a href=3D"http://www.ntg.nl/mailman/listinfo/ntg-context" rel=3D"noreferrer= " target=3D"_blank">http://www.ntg.nl/mailman/listinfo/ntg-context=
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/cont= ext-mirror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
_________________________________________________________________= __________________

--94eb2c195afa7eba58055704d734-- --===============7217674322054687108== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============7217674322054687108==--