ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Rik <rik@panix.com>
To: ntg-context@ntg.nl
Subject: Re: About \setupheadertexts : simplify a code
Date: Fri, 18 Aug 2017 19:15:26 -0400	[thread overview]
Message-ID: <34c79241-e64d-0e48-2577-9929707b0d22@panix.com> (raw)
In-Reply-To: <CACyK-eojYN3Qxg3bbKFKDOEE0veqEFFvdRDN1T36cXbZAzB+EQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 5657 bytes --]

On 2017-08-18 19:01, Fabrice Couvreur wrote:
> If I test this file, it does not work
>
> % macros=mkvi
>
> \startcomponent dm-1
>
>   \environment MyLayout
>
>   \MyHeader{Seconde}{17}{08}{2017}{Devoir surveillé}{1}{1h\,30m}
>
>   \dorecurse{20}{\input knuth}
>
>   \math{x^2+4x+5=0}
>
> \stopcomponent
>
> 2017-08-19 0:23 GMT+02:00 Rik Kabel <context@rik.users.panix.com 
> <mailto:context@rik.users.panix.com>>:
>
>     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
>>     <mailto: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
>>>         <mailto: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 <mailto: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 <tel:2017.08.14%2023>: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
>         …
>

I was wrong, and (no surprise) Aditya was correct.

The %macros=mkvi line is not needed in dm1.tex. It should be at the top 
of MyLayout.tex.

You may then reference MyLayout.tex (note the addition of the extension) 
in dm1.tex, or you may rename the file to MyLayout.mkvi, where you can 
reference it as either MyLayout or as MyLayout.mkvi.

Sorry for the noise.

-- 
Rik

[-- Attachment #1.2: Type: text/html, Size: 18776 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  parent reply	other threads:[~2017-08-18 23:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17 13:25 Fabrice Couvreur
2017-08-17 22:39 ` Henri
2017-08-18  4:25   ` Aditya Mahajan
2017-08-18  9:45     ` Otared Kavian
2017-08-18 10:46       ` Fabrice Couvreur
2017-08-18 13:05       ` Jean-Pierre Delange
2017-08-18 13:25         ` Fabrice Couvreur
2017-08-18 15:06         ` Fabrice Couvreur
2017-08-18 15:54       ` Aditya Mahajan
2017-08-18 16:44         ` Otared Kavian
2017-08-18 21:34           ` Fabrice Couvreur
2017-08-18 21:57             ` Rik Kabel
2017-08-18 22:14               ` Fabrice Couvreur
2017-08-18 22:23                 ` Rik Kabel
2017-08-18 23:01                   ` Fabrice Couvreur
2017-08-18 23:06                     ` Fabrice Couvreur
2017-08-18 23:15                     ` Rik [this message]
2017-08-18 23:25                       ` Fabrice Couvreur
2017-08-18 23:00             ` Aditya Mahajan
     [not found] <mailman.1693.1503094464.2080.ntg-context@ntg.nl>
2017-08-18 23:29 ` Jeong Dal
2017-08-19  9:55   ` Fabrice Couvreur
2017-08-19 10:35     ` Aditya Mahajan
2017-08-19 10:51       ` Fabrice Couvreur
2017-08-19 16:38       ` Jean-Pierre Delange
     [not found] <mailman.1.1503136802.15098.ntg-context@ntg.nl>
2017-08-19 11:58 ` Jeong Dal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34c79241-e64d-0e48-2577-9929707b0d22@panix.com \
    --to=rik@panix.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).