ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] command line arguments
@ 2024-03-19 20:41 Hraban Ramm
  2024-03-19 22:46 ` [NTG-context] " Willi Egger
  2024-03-19 22:53 ` Wolfgang Schuster
  0 siblings, 2 replies; 4+ messages in thread
From: Hraban Ramm @ 2024-03-19 20:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Following up on the other imposition question, I'm trying to make an 
example file that shows an imposition schema according to command line 
arguments.

This way it works for the number of pages, as used in 
\dorecurse{\Pages}{…}, but not for the imposition schema. Typesetting 
\Schema looks right, but \setuparranging doesn’t work. Where's my error?

\def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}

\def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}

\setuparranging[\Schema]

Find the full example attached, I call it like

context --autopdf=auto --arrange impositiontest.tex --schema=TRYPTICHON --numberofpages=32

Hraban

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

[-- Attachment #2: impositiontest.tex --]
[-- Type: text/x-tex, Size: 960 bytes --]

% context --autopdf=auto --arrange --arguments=schema=2\*4,pages=16

\def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}
\def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}

\setuppapersize[A9,landscape][A7,landscape]

\setuparranging[\Schema]

\setupbodyfont[ss,10pt]

\setuplayout[margin=0pt, width=fit, header=2.8ex, footer=2.8ex]
\setupalign[middle,hilo]
\setuppagenumbering [alternative=doublesided,location=footer]
\setupheadertexts[\CONTEXT\ imposition test]

\showframe
\setupbackgrounds [text][text][background=color,backgroundcolor=lightgray]

% Where the block of pages is placed on the sheet
% (relevant if there is space left over.)
\setuplayout [location=middle,marking=on]

\startbuffer[Fakepage]
    \strut
    \blank
    \bold{[\Schema]}
    \vfill
    This is page \recurselevel
    \vfill
\stopbuffer

\starttext
\dorecurse{\Pages}{\getbuffer[Fakepage]\page}
\stoptext

[-- Attachment #3: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [NTG-context] Re: command line arguments
  2024-03-19 20:41 [NTG-context] command line arguments Hraban Ramm
@ 2024-03-19 22:46 ` Willi Egger
  2024-03-19 22:53 ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Willi Egger @ 2024-03-19 22:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

Hello Hraban,

I puzzled a while. To me the —arguments= option does not work. I saw then on the Wiki, that one can also add documentarguments as —schema=2UP —numberofpages=16.

I further changed to \startdocument … \stopdocument.

Please look at the attached file

Willi

[-- Attachment #2: impositiontest-2.tex --]
[-- Type: application/octet-stream, Size: 1249 bytes --]

% context --autopdf=auto --schema=2\*4\*2 --numberofpages=16
 %\def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}
%\def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}

\setuppapersize[A9,landscape][A7,landscape]

\setupbodyfont[ss,10pt]

\setuplayout[margin=0pt, width=fit, header=2.8ex, footer=2.8ex]
\setupalign[middle,hilo]
\setuppagenumbering [alternative=doublesided,location=footer]
\setupheadertexts[\CONTEXT\ imposition test]

\showframe
\setupbackgrounds [text][text][background=color,backgroundcolor=lightgray]

% Where the block of pages is placed on the sheet
% (relevant if there is space left over.)
\setuplayout [location=middle,marking=on]

\startbuffer[Fakepage]
    \strut
    \blank
    \bold{[\documentvariable{Schema}]}
    \vfill
    This is page \recurselevel
    \vfill
\stopbuffer


\startdocument
   [Schema={\getdocumentargument{schema}}, %{1*8},
	  Nofpages=\doifelsedocumentargument%
	   {numberofpages}{\getdocumentargument{numberofpages}}{1}]
	
\setuparranging[\documentvariable{Schema}]	
	
	% Contents of Documentvariable "Schema" = \documentvariable{Schema}
	
  \dorecurse{\documentvariable{Nofpages}}{\getbuffer[Fakepage]\page}
\stopdocument

[-- Attachment #3: Type: text/plain, Size: 1384 bytes --]



> On 19 Mar 2024, at 21:41, Hraban Ramm <texml@fiee.net> wrote:
> 
> Following up on the other imposition question, I'm trying to make an example file that shows an imposition schema according to command line arguments.
> 
> This way it works for the number of pages, as used in \dorecurse{\Pages}{…}, but not for the imposition schema. Typesetting \Schema looks right, but \setuparranging doesn’t work. Where's my error?
> 
> \def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}
> \def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}
> 
> \setuparranging[\Schema]
> 
> 
> Find the full example attached, I call it like
> 
> context --autopdf=auto --arrange impositiontest.tex --schema=TRYPTICHON --numberofpages=32
> 
> Hraban
> 
> <impositiontest.tex>___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
> ___________________________________________________________________________________


[-- Attachment #4: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [NTG-context] Re: command line arguments
  2024-03-19 20:41 [NTG-context] command line arguments Hraban Ramm
  2024-03-19 22:46 ` [NTG-context] " Willi Egger
@ 2024-03-19 22:53 ` Wolfgang Schuster
  2024-03-20  9:10   ` Hraban Ramm
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2024-03-19 22:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Hraban Ramm

Hraban Ramm schrieb am 19.03.2024 um 21:41:
> Following up on the other imposition question, I'm trying to make an 
> example file that shows an imposition schema according to command line 
> arguments.
> 
> This way it works for the number of pages, as used in 
> \dorecurse{\Pages}{…}, but not for the imposition schema. Typesetting 
> \Schema looks right, but \setuparranging doesn’t work. Where's my error?

You forgot about expansion and in your case \doifelsedocumentargument is 
not fully expandable. This doesn't matter for \dorecurse where the 
number parser ignores the flag because \setuparranging does care and 
\Schema fails to expand.

> \def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}}
> 
> \def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}}
> 
> \setuparranging[\Schema]

\doifelsedocumentargument{schema}
   {\setuparranging[\getdocumentargument{schema}]}
   {\setuparranging[1*8]}

It does also help to look at the included extra files (e.g. 
mtx-context-arrange.tex) written by Hans.

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [NTG-context] Re: command line arguments
  2024-03-19 22:53 ` Wolfgang Schuster
@ 2024-03-20  9:10   ` Hraban Ramm
  0 siblings, 0 replies; 4+ messages in thread
From: Hraban Ramm @ 2024-03-20  9:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 19.03.24 um 23:53 schrieb Wolfgang Schuster:
> Hraban Ramm schrieb am 19.03.2024 um 21:41:
>> Following up on the other imposition question, I'm trying to make an 
>> example file that shows an imposition schema according to command 
>> line arguments.
>>
>> This way it works for the number of pages, as used in 
>> \dorecurse{\Pages}{…}, but not for the imposition schema. Typesetting 
>> \Schema looks right, but \setuparranging doesn’t work. Where's my error?
>
> You forgot about expansion and in your case \doifelsedocumentargument 
> is not fully expandable. This doesn't matter for \dorecurse where the 
> number parser ignores the flag because \setuparranging does care and 
> \Schema fails to expand.
Thank you! Well, I tried \expanded in a few places, and that didn’t work.
>
>> \def\Schema{\doifelsedocumentargument{schema}{\getdocumentargument{schema}}{1*8}} 
>>
>>
>> \def\Pages{\doifelsedocumentargument{numberofpages}{\getdocumentargument{numberofpages}}{16}} 
>>
>>
>> \setuparranging[\Schema]
>
> \doifelsedocumentargument{schema}
>   {\setuparranging[\getdocumentargument{schema}]}
>   {\setuparranging[1*8]}

Ok, that works. (Of course, if you say so.)

>
> It does also help to look at the included extra files (e.g. 
> mtx-context-arrange.tex) written by Hans.
>
Well, I don’t know how to use that, it doesn’t compile on its own, any 
hints?

Hraban

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-20  9:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-19 20:41 [NTG-context] command line arguments Hraban Ramm
2024-03-19 22:46 ` [NTG-context] " Willi Egger
2024-03-19 22:53 ` Wolfgang Schuster
2024-03-20  9:10   ` Hraban Ramm

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).