Re: [NTG-context] About \setupheadertexts : simplify a code

2017-08-19 Thread Jean-Pierre Delange
Hi Aditya, Fabrice and others,

I didn't know that the solution was to compile dm-1.tex with a call to 
MyLayout.mkvi. 
The file compile perfectly with \environment MyLayout command...

JP

- Mail original -
De: "Aditya Mahajan" 
À: "mailing list for ConTeXt users" 
Envoyé: Samedi 19 Août 2017 12:35:24
Objet: Re: [NTG-context] About \setupheadertexts : simplify a code

On Sat, 19 Aug 2017, Fabrice Couvreur wrote:

> Hello,
> I have tried many approaches, but it still does not work. Everything is
> passed to the dm-1.tex file (font, footer) but not the header.


> \startcomponent dm-1
>
>  \component MyLayout
>
>  \MyHeader{Seconde}{17}{08}{2017}{Devoir surveillé}{1}{1h\,30m}
>
>  \input knuth
>
> \stopcomponent

Two things:

1. Use \environment MyLayout instead of \component MyLayout.
2. The environment should be set before \startcomponent.

I am attaching a zip file with working code.

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
___

Re: [NTG-context] About \setupheadertexts : simplify a code

2017-08-19 Thread Jeong Dal
Dear Fabrice,

I tried to compile your example, but not succeed.
I am sorry that I couldn’t tell you what is the problem.

Here is the part of the log file. One thing that I don’t understand is  why it 
reads ##title and ##number, …
Is it normal in log file?

I hope that experts correct your example to work.

Best regards,

Dalyoung

*
tex error   > tex error on line 64 in file mylayout.mkiv: ! Illegal 
parameter number in definition of \MyHeader

 
t
 ..., foregroundstyle=bold,foregroundcolor=red]{##t
  itle n\high {o}\,##number}...
\dostarttexdefinition ...clf_texdefinition_two {#1
  }
l.64 \stoptexdefinition
 

54  [{\headerframed[align=middle, foregroundstyle=bold,
55 foregroundcolor=red]
56{#title n\high{o}\,#number}}]
57 
58\setupheadertexts
59  [{\headerframed[align=flushleft, foregroundstyle=\ssx]
60  {Lycée JANSON DE SAILLY \\ \date[d=#day,m=#month,y=#year]}}]
61  [{\headerframed[align=flushright, foregroundstyle=\ssx]
62  {#where \\ {#time}}}]
63 
64 >>  \stoptexdefinition
65 
66 \stopenvironment
67 
*

A strange thing is that 
> 2017. 8. 19. 오후 7:00, ntg-context-requ...@ntg.nl 작성:
> 
> Re: About \setupheadertexts : simplify a code 

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

Re: [NTG-context] unwanted space after \in

2017-08-19 Thread Alan Bowen
Thanks, Aditya. Using \goto works better.

I have been abusing \reference for some time now, mainly to mark the end of
a file in order to generate page numbers: E.g., \reference[EOF]{} just
before \stoptext or \stopcomponent with \at[EOF]. This has worked for
getting the page range of a chapter or paper. Is there a better way to do
this?

Alan

On Fri, Aug 18, 2017 at 10:26 PM, Aditya Mahajan  wrote:

> On Fri, 18 Aug 2017, Alan Bowen wrote:
>
> Unlike \goto and \at, \in seems to insert an unwanted space before any text
>> that follows.
>>
>> MWE—
>>
>> starttext
>> Text\reference[abc]{}
>>
>> \page
>> Text ,
>>
>> \in{Text}[abc],
>>
>> \at{Text, p.}[abc],
>>
>> \goto{Text}[abc],
>> \stoptext
>>
>
> I am not sure if I consider this a bug. In a typical use case, \reference
> will have a value, e.g., \reference[abc]{whatever}. In that case, if you
> use \in{Text}[abc], there should be a non-breakable space between "Text"
> and "whatever". You appear to be abusing the reference system by giving an
> empty reference.
>
> I think that usin \goto is better in this case rather than adding a check
> to \in for an atypical use case.
>
> 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
___

Re: [NTG-context] About \setupheadertexts : simplify a code

2017-08-19 Thread Fabrice Couvreur
Hi Aditya,
Thank you very much !!
I did not know that it was necessary to use \environment instead of
\component, it is probably in the documentation
Fabrice

2017-08-19 12:35 GMT+02:00 Aditya Mahajan :

> On Sat, 19 Aug 2017, Fabrice Couvreur wrote:
>
> Hello,
>> I have tried many approaches, but it still does not work. Everything is
>> passed to the dm-1.tex file (font, footer) but not the header.
>>
>
>
> \startcomponent dm-1
>>
>>  \component MyLayout
>>
>>  \MyHeader{Seconde}{17}{08}{2017}{Devoir surveillé}{1}{1h\,30m}
>>
>>  \input knuth
>>
>> \stopcomponent
>>
>
> Two things:
>
> 1. Use \environment MyLayout instead of \component MyLayout.
> 2. The environment should be set before \startcomponent.
>
> I am attaching a zip file with working code.
>
> 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
___

Re: [NTG-context] About \setupheadertexts : simplify a code

2017-08-19 Thread Fabrice Couvreur
Hello,
I have tried many approaches, but it still does not work. Everything is
passed to the dm-1.tex file (font, footer) but not the header.
Have you tested the files, does it work for you ?
Sorry to insist, but I really need this way of doingThank you
Fabrice

##
MyLayout.mkvi
##

\startenvironment MyLayout

\setupbodyfont[12pt,pagella]

\definelayout
   [noheader]
   [header=2\lineheight,
headerdistance=\lineheight,
backspace=2cm,
width=middle,
topspace=\dimexpr 2cm-\headerheight-\headerdistance\relax,
footer=\lineheight,
height=middle]

\setuplayout
   [header=\zeropoint,
headerdistance=\lineheight,
backspace=2cm,
width=middle,
topspace=\dimexpr 2cm-\headerheight-\headerdistance\relax,
footer=\lineheight,
height=middle]

\definelayout[1][noheader]

\setuppagenumbering[alternative=doublesided,location=]

\setupfootertexts[\tfxx Page \pagenumber\,/\,\lastpage][]

\definecolor[darkgray]   [s=.25]

\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

  \component MyLayout

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

  \input knuth

\stopcomponent

2017-08-19 1:29 GMT+02:00 Jeong Dal :

> Hi, Otared,
>
> I am also able to typeset Aditya’s example without problem, so example
> file is OK for me.
> There may be something which is not in the file.
> I am using MKIV beta 6. 21 version under OSX.
>
> This is LuaTeX, Version 1.05.0 (TeX Live 2017)
>  system commands enabled.
> open source > level 1, order 1, name '/Users/graph/ConTeXt/tex/
> texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
> system  >
> system  > ConTeXt  ver: 2017.06.21 23:03 MKIV beta  fmt:
> 2017.6.25  int: english/english
>
> Best regards,
>
> Dalyoung
>
>
> 2017. 8. 19. 오전 7:14, ntg-context-requ...@ntg.nl 작성:
>
> About \setupheadertexts : simplify a code
>
>
>
> 
> ___
> 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
___