From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/98875 Path: news.gmane.org!.POSTED!not-for-mail From: Rik Kabel Newsgroups: gmane.comp.tex.context Subject: Re: About \setupheadertexts : simplify a code Date: Fri, 18 Aug 2017 18:23:08 -0400 Message-ID: <4e1cd231-003f-9e90-2d6a-fee511086d04@rik.users.panix.com> References: <1503009593.5007.98.camel@gmail.com> <4E4C3ACE-6834-4D63-9AB7-B88568A34CF2@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3014877090766952143==" X-Trace: blaine.gmane.org 1503095029 19917 195.159.176.226 (18 Aug 2017 22:23:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 18 Aug 2017 22:23:49 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sat Aug 19 00:23:44 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 1dipg3-0004eK-FR for gctc-ntg-context-518@m.gmane.org; Sat, 19 Aug 2017 00:23:39 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id F2DC6FC0FCB; Sat, 19 Aug 2017 00:23:26 +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 c1yUyBWcd2G6; Sat, 19 Aug 2017 00:23:26 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 32361FC0FB2; Sat, 19 Aug 2017 00:23:26 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 1C555FC0FB2 for ; Sat, 19 Aug 2017 00:23:25 +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 l3Q0tPOUfDfC for ; Sat, 19 Aug 2017 00:23:24 +0200 (CEST) Original-Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 2EDE8FC0F51 for ; Sat, 19 Aug 2017 00:23:14 +0200 (CEST) Original-Received: from [192.168.201.10] (cpe-24-194-22-135.nycap.res.rr.com [24.194.22.135]) by mailbackend.panix.com (Postfix) with ESMTPSA id B3C1C11EFD for ; Fri, 18 Aug 2017 18:23:12 -0400 (EDT) In-Reply-To: Content-Language: en-US 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:98875 Archived-At: This is a multi-part message in MIME format. --===============3014877090766952143== Content-Type: multipart/alternative; boundary="------------FE5CBB4A01DDA4163EF809AD" Content-Language: en-US This is a multi-part message in MIME format. --------------FE5CBB4A01DDA4163EF809AD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 2017-08-18 18:14, Fabrice Couvreur wrote: > Hi Rik, > Can you clarify by editing my files ? > Fabrice > > 2017-08-18 23:57 GMT+02:00 Rik Kabel >: > > On 2017-08-18 17:34, Fabrice Couvreur wrote: >> Hello, >> It's ok for me if I compile the Aditya file. >> I have another problem with a simple structure. I created the >> file MyLayout.tex containing the macro and I want to call this >> macro in the dm1.tex file, but it does not work. >> Thank you >> Fabrice >> >> ######### >> MyLayout.tex >> ######### >> >> % macros=mkvi >> >> \startenvironment MyLayout >> >> \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 >> >> \stopenvironment >> >> ###### >> dm-1.tex >> ###### >> >> \startcomponent dm-1 >> >>   \environment MyLayout >> >>   \MyHeader{Seconde}{17}{08}{2017}{Devoir surveillé}{1}{1h\,30m} >> >>   \input knuth >> >> \stopcomponent >> >> 2017-08-18 18:44 GMT+02:00 Otared Kavian > >: >> >> Hi Aditya, >> >> Thanks for having sent the example file: indeed with your >> file I can typeset the example and see the expected result. >> I don’t know what happened when I copied and pasted the >> example from the e-mail… >> I think the command >>         % macros = mkvi >> was not set correctly written at the first line, that is I >> had a space before the percent sign « % ». In fact >>         %macros=mkvi >> or >>         %macros = mkvi >> work as well. >> >> By the way, wouldn’t be more user friendly, and more in the >> spirit of ConTeXt, if we had a command saying >>         \enablemode[mkvi] >> in order to tell ConTeXt that we are using %macros = mkvi ? >> >> Best regards: OK >> >> > On 18 Aug 2017, at 17:54, Aditya Mahajan > > wrote: >> > >> > On Fri, 18 Aug 2017, Otared Kavian wrote: >> > >> >> 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. >> > >> > I am attaching the file. It runs fine here with ConTeXt  >> ver: 2017.08.14 23 :57. >> > >> > Aditya >> > > I believe you need to declare the use of MKVI macros as the first > thing in your project file if they will be used by any components. > > -- > Rik > %macros=mkvi \startcomponent dm-1 … -- Rik --------------FE5CBB4A01DDA4163EF809AD Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 2017-08-18 18:14, Fabrice Couvreur wrote:
Hi Rik,
Can you clarify by editing my files ?
Fabrice

2017-08-18 23:57 GMT+02:00 Rik Kabel <context@rik.users.panix.com>:
On 2017-08-18 17:34, Fabrice Couvreur wrote:
Hello,
It's ok for me if I compile the Aditya file.
I have another problem with a simple structure. I created the file MyLayout.tex containing the macro and I want to call this macro in the dm1.tex file, but it does not work.
Thank you
Fabrice

#########
MyLayout.tex
#########

% macros=mkvi

\startenvironment MyLayout

\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
 
\stopenvironment

######
dm-1.tex
######

\startcomponent dm-1

  \environment MyLayout

  \MyHeader{Seconde}{17}{08}{2017}{Devoir surveillé}{1}{1h\,30m}
 
  \input knuth

\stopcomponent

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

Thanks for having sent the example file: indeed with your file I can typeset the example and see the expected result.
I don’t know what happened when I copied and pasted the example from the e-mail…
I think the command
        % macros = mkvi
was not set correctly written at the first line, that is I had a space before the percent sign « % ». In fact
        %macros=mkvi
or
        %macros = mkvi
work as well.

By the way, wouldn’t be more user friendly, and more in the spirit of ConTeXt, if we had a command saying
        \enablemode[mkvi]
in order to tell ConTeXt that we are using %macros = mkvi ?

Best regards: OK

> On 18 Aug 2017, at 17:54, Aditya Mahajan <adityam@umich.edu> wrote:
>
> On Fri, 18 Aug 2017, Otared Kavian wrote:
>
>> 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.
>
> I am attaching the file. It runs fine here with ConTeXt  ver: 2017.08.14 23:57.
>
> Aditya<frame.tex>

I believe you need to declare the use of MKVI macros as the first thing in your project file if they will be used by any components.

--
Rik


%macros=mkvi
\startcomponent dm-1



--
Rik

 
--------------FE5CBB4A01DDA4163EF809AD-- --===============3014877090766952143== 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 --===============3014877090766952143==--