ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \combinepages[]: Change order
@ 2006-10-07 17:01 Tobias Burnus
  2006-10-09  7:39 ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Tobias Burnus @ 2006-10-07 17:01 UTC (permalink / raw)


Hello,

Using \combinepages[some-pdf][nx=3,ny=5], I get:

 1  2  3
 4  5  6
 7  8  9
10 11 12

However, I'd like to get:
 1  5  9
 2  6 10
 3  7 11
 4  8 12

How can one achieve this? (I want to create again a poster out of talk.pdf.)

Tobias

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

* Re: \combinepages[]: Change order
  2006-10-07 17:01 \combinepages[]: Change order Tobias Burnus
@ 2006-10-09  7:39 ` Wolfgang Schuster
  2006-10-10  7:25   ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2006-10-09  7:39 UTC (permalink / raw)



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

2006/10/7, Tobias Burnus <burnus@net-b.de>:
>
> Hello,
>
> Using \combinepages[some-pdf][nx=3,ny=5], I get:
>
> 1  2  3
> 4  5  6
> 7  8  9
> 10 11 12
>
> However, I'd like to get:
> 1  5  9
> 2  6 10
> 3  7 11
> 4  8 12
>
> How can one achieve this? (I want to create again a poster out of talk.pdf
> .)
>
> Tobias


Hi Tobias,

I can provide a first draft of a solution to your problem.

The frame around the combination should you show a small problem with my
correction,
it is up to you change this and maybe to wikify this.


\unprotect

\startvariables            dutch                     english
                           german                    czech
                           italian                   romanian
                           french

               horizontal: horizontal                horizontal
                           horizontal                horizontal
                           horizontal                horizontal
                           horizontal

\stopvariables

\def\docombinepages[#1][#2]% a=perpag b=free
  {\bgroup
   \dontcomplain
   \getfiguredimensions[#1]%
   \getparameters
     [\??ip]
     [\c!alternative=\v!a,
      \c!n=\noffigurepages,\c!nx=2,\c!ny=2,\c!start=1,\c!stop=\!!maxcard,
      \c!distance=\bodyfontsize,
      \c!bottom=\vfill,\c!top=\vss,
      \c!left=\hss,\c!right=\hss,
      \c!before=\page,\c!after=\page,\c!inbetween=\blank,
      \c!frame=,\c!background=,\c!backgroundcolor=,
      \c!direction=\v!horizontal, % added
      #2]%
   \@@ipbefore
  %\doglobal\newcounter\combinedpagescounter
   \globallet\combinedpagescounter\@@ipstart
   \doifelse\@@ipalternative\v!b\!!doneafalse\!!doneatrue
   \if!!donea
    \doifelse\@@ipdirection\v!horizontal % added
     % loop for left to right and top to bottom combination
     {\doloop
       {\vbox to \textheight
           {\hsize\textwidth % ? ?
            \scratchdimen\@@ipdistance
            \!!widtha
\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax

\!!heighta\dimexpr(\vsize-\@@ipny\scratchdimen+\scratchdimen)/\@@ipny\relax
            \dorecurse\@@ipny
              {\hbox to \hsize
                 {\dorecurse\@@ipnx
                    {\vbox to \!!heighta
                       {\hsize\!!widtha
                        \vsize\!!heighta
                        \@@iptop
                        \hbox to \hsize
                          {\@@ipleft
                           \ifnum\combinedpagescounter>\@@ipstop\relax
                             \globallet\@@ipn\!!zerocount
                           \else\ifnum\combinedpagescounter>\@@ipn \else
                             \externalfigure[#1]
                               [\c!object=\v!no,
                                \c!page=\combinedpagescounter,
                                \c!factor=\v!max,
                                \c!background=\@@ipbackground,
                                \c!backgroundcolor=\@@ipbackgroundcolor,
                                \c!frame=\@@ipframe]%
                           \fi\fi
                           \@@ipright}
                        \@@ipbottom}%
                     \doglobal\increment\combinedpagescounter
                     \hfil}%
                  \hfilneg}
               \vfil}%
           \vfilneg}%
           \page
        \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}}
     % loop for top to bottom and left to right combination
     {\doloop
       {\vbox %to \textheight
         {\hsize\textwidth
          \scratchdimen\@@ipdistance
          \!!widtha
\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax

\!!heighta\dimexpr(\vsize-\@@ipny\scratchdimen+\scratchdimen)/\@@ipny\relax
          \hbox to \hsize
           {\dorecurse\@@ipnx
              {\@@ipleft
               \vbox to \textheight
                 {\hsize\!!widtha
                   {\dorecurse\@@ipny
                       {\@@iptop
                        \hbox to \hsize
                          {\vbox to \!!heighta
                            {\hsize\!!widtha
                             \vsize\!!heighta
                             \ifnum\combinedpagescounter>\@@ipstop\relax
                               \globallet\@@ipn\!!zerocount
                             \else\ifnum\combinedpagescounter>\@@ipn \else
                               \externalfigure[#1]
                                 [\c!object=\v!no,
                                  \c!page=\combinedpagescounter,
                                  \c!factor=\v!max,
                                  \c!background=\@@ipbackground,
                                  \c!backgroundcolor=\@@ipbackgroundcolor,
                                  \c!frame=\@@ipframe]%
                             \fi\fi}}
                        \doglobal\increment\combinedpagescounter
                        \@@ipbottom}%
                     %\doglobal\increment\combinedpagescounter
                     \vfil}%
                  \vfilneg}
               \hfil}%
           \hfilneg}}
           \page
        \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}}
   \else
     \doloop
       {\startbaselinecorrection
          \scratchdimen\@@ipdistance

\!!widtha\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax
          \hbox to \hsize
            {\dorecurse\@@ipnx
               {\doglobal\increment\combinedpagescounter
                \ifnum\combinedpagescounter>\@@ipn \else
                   \expanded{\externalfigure[#1]
                     [\c!page=\combinedpagescounter,
                      \c!width=\the\!!widtha,% todo \freezedimenmacro
                      \c!background=\@@ipbackground,
                      \c!backgroundcolor=\@@ipbackgroundcolor,
                      \c!frame=\@@ipframe]}%
                   \hfill
                \fi}\hfillneg}%
        \stopbaselinecorrection
        \ifnum\combinedpagescounter<\@@ipn\relax
          \@@ipinbetween
        \else
          \exitloop
        \fi}
   \fi
   \@@ipafter
   \egroup}

\protect

\starttext

\framed{\combinepages[your-pdf][nx=4,ny=6,direction=vertical]}

\framed{\combinepages[your-pdf][nx=4,ny=6]}

\stoptext

Wolfgang

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

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: \combinepages[]: Change order
  2006-10-09  7:39 ` Wolfgang Schuster
@ 2006-10-10  7:25   ` Wolfgang Schuster
  2006-10-10 10:07     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2006-10-10  7:25 UTC (permalink / raw)



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

2006/10/9, Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
>
>
>
> 2006/10/7, Tobias Burnus <burnus@net-b.de>:
> >
> > Hello,
> >
> > Using \combinepages[some-pdf][nx=3,ny=5], I get:
> >
> > 1  2  3
> > 4  5  6
> > 7  8  9
> > 10 11 12
> >
> > However, I'd like to get:
> > 1  5  9
> > 2  6 10
> > 3  7 11
> > 4  8 12
> >
> > How can one achieve this? (I want to create again a poster out of
> > talk.pdf.)
> >
> > Tobias
>
>
> Hi Tobias,
>
> I can provide a first draft of a solution to your problem.
>
> The frame around the combination should you show a small problem with my
> correction,
> it is up to you change this and maybe to wikify this.
>
>



[old macro deleted]

I changed the macro to a (for mee) more readable form.


\unprotect

% a new variable for horizontal (default) direction

\startvariables            dutch                     english
                           german                    czech
                           italian                   romanian
                           french

               horizontal: horizontal                horizontal
                           horizontal                horizontal
                           horizontal                horizontal
                           horizontal

\stopvariables

% we extract the combine macros from the core

\def\docombinepages[#1][#2]% a=perpag b=free
  {\bgroup
   \dontcomplain
   \getfiguredimensions[#1]%
   \getparameters
     [\??ip]
     [\c!alternative=\v!a,
      \c!n=\noffigurepages,\c!nx=2,\c!ny=2,\c!start=1,\c!stop=\!!maxcard,
      \c!distance=\bodyfontsize,
      \c!bottom=\vfill,\c!top=\vss,
      \c!left=\hss,\c!right=\hss,
      \c!before=\page,\c!after=\page,\c!inbetween=\blank,
      \c!frame=,\c!background=,\c!backgroundcolor=,
      \c!direction=\v!horizontal,
      #2]%
   \@@ipbefore
  %\doglobal\newcounter\combinedpagescounter
   \globallet\combinedpagescounter\@@ipstart
   \doifelse\@@ipalternative\v!b\!!doneafalse\!!doneatrue

\doifelse\@@ipdirection\v!horizontal\docombinepageshorizontal\docombinepagesvertical#1
% watch the #1 ;-)
   \@@ipafter
   \egroup}

% we work from left to right and from top to bottom

\def\docombinepageshorizontal#1
  {\if!!donea
     \doloop
       {\vbox to \textheight
           {\hsize\textwidth % ? ?
            \scratchdimen\@@ipdistance
            \!!widtha
\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax

\!!heighta\dimexpr(\vsize-\@@ipny\scratchdimen+\scratchdimen)/\@@ipny\relax
            \dorecurse\@@ipny
              {\hbox to \hsize
                 {\dorecurse\@@ipnx
                    {\vbox to \!!heighta
                       {\hsize\!!widtha
                        \vsize\!!heighta
                        \@@iptop
                        \hbox to \hsize
                          {\@@ipleft
                           \ifnum\combinedpagescounter>\@@ipstop\relax
                             \globallet\@@ipn\!!zerocount
                           \else\ifnum\combinedpagescounter>\@@ipn \else
                             \externalfigure[#1]
                               [\c!object=\v!no,
                                \c!page=\combinedpagescounter,
                                \c!factor=\v!max,
                                \c!background=\@@ipbackground,
                                \c!backgroundcolor=\@@ipbackgroundcolor,
                                \c!frame=\@@ipframe]%
                           \fi\fi
                           \@@ipright}
                        \@@ipbottom}%
                     \doglobal\increment\combinedpagescounter
                     \hfil}%
                  \hfilneg}
               \vfil}%
           \vfilneg}%
           \page
        \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}
   \else
     \doloop
       {\startbaselinecorrection
          \scratchdimen\@@ipdistance

\!!widtha\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax
          \hbox to \hsize
            {\dorecurse\@@ipnx
               {\doglobal\increment\combinedpagescounter
                \ifnum\combinedpagescounter>\@@ipn \else
                   \expanded{\externalfigure[#1]
                     [\c!page=\combinedpagescounter,
                      \c!width=\the\!!widtha,% todo \freezedimenmacro
                      \c!background=\@@ipbackground,
                      \c!backgroundcolor=\@@ipbackgroundcolor,
                      \c!frame=\@@ipframe]}%
                   \hfill
                \fi}\hfillneg}%
        \stopbaselinecorrection
        \ifnum\combinedpagescounter<\@@ipn\relax
          \@@ipinbetween
        \else
          \exitloop
        \fi}
   \fi}

% we work from top to bottom and from left to right, no alternative=b

\def\docombinepagesvertical#1
  {\doloop
     {\vbox %to \textheight % neccesary?
        {\hsize\textwidth
         \vsize\textheight
         \scratchdimen\@@ipdistance
         \!!widtha
\dimexpr(\hsize-\@@ipnx\scratchdimen+\scratchdimen)/\@@ipnx\relax

\!!heighta\dimexpr(\vsize-\@@ipny\scratchdimen+\scratchdimen)/\@@ipny\relax
         \hbox to \hsize
           {\dorecurse\@@ipnx
              {\vbox to \vsize
                 {\hsize\!!widtha
                  \dorecurse\@@ipny
                    {\@@iptop
                     \hbox to \hsize
                       {\@@ipleft
                        \vbox to \!!heighta
                          {\hsize\!!widtha
                           \vsize\!!heighta
                           \ifnum\combinedpagescounter>\@@ipstop\relax
                             \globallet\@@ipn\!!zerocount
                           \else\ifnum\combinedpagescounter>\@@ipn \else
                             \externalfigure[#1]
                               [\c!object=\v!no,
                                \c!page=\combinedpagescounter,
                                \c!factor=\v!max,
                                \c!background=\@@ipbackground,
                                \c!backgroundcolor=\@@ipbackgroundcolor,
                                \c!frame=\@@ipframe]%
                           \fi\fi}%
                        \@@ipright}
                     \doglobal\increment\combinedpagescounter
                     \@@ipbottom}
                  \vfil}%
               \hfil}
            \hfilneg}
         \vfilneg}
         \page
      \ifnum\combinedpagescounter>\@@ipn \exitloop\fi}}

\protect

>  \starttext
>
> \framed{\combinepages[your-pdf][nx=4,ny=6,direction=vertical]}
>
> \framed{\combinepages[your-pdf][nx=4,ny=6]}
>
> \stoptext
>

Wolfgang

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

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: \combinepages[]: Change order
  2006-10-10  7:25   ` Wolfgang Schuster
@ 2006-10-10 10:07     ` Hans Hagen
  2006-10-10 10:43       ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2006-10-10 10:07 UTC (permalink / raw)


Wolfgang Schuster wrote:
>
> I changed the macro to a (for mee) more readable form.
i changed your first patch to an 'alternative c' option with split up 
macro's directiuon is reserved for directional typesetting
>  
>
>
>    
> \doifelse\@@ipdirection\v!horizontal\docombinepageshorizontal\docombinepagesvertical#1 
> % watch the #1 ;-)
>  
>
see patch i sent you; we can avoid the #1 ; will be in the next beta 

also imagine that #1 is blabla and not a \cs ... in sich cases you really need {#1} 

so: ...[alternative=a|b|c|horizontal|vertical]

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: \combinepages[]: Change order
  2006-10-10 10:07     ` Hans Hagen
@ 2006-10-10 10:43       ` Wolfgang Schuster
  2006-10-10 20:41         ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2006-10-10 10:43 UTC (permalink / raw)



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

2006/10/10, Hans Hagen <pragma@wxs.nl>:
>
> Wolfgang Schuster wrote:
> >
> > I changed the macro to a (for mee) more readable form.
> i changed your first patch to an 'alternative c' option with split up
> macro's directiuon is reserved for directional typesetting
> >
> >
> >
> >
> >
> \doifelse\@@ipdirection\v!horizontal\docombinepageshorizontal\docombinepagesvertical#1
> > % watch the #1 ;-)
> >
> >
> see patch i sent you; we can avoid the #1 ; will be in the next beta
>
> also imagine that #1 is blabla and not a \cs ... in sich cases you really
> need {#1}
>
> so: ...[alternative=a|b|c|horizontal|vertical]
>
> Hans


Hi Hans,

if I look at your it seems to me alternative=horizontal|vertical will be
similiar
to  alternative=b and not horizontal==a and vertical==c as I thought.

You're right about the #1 but this is my method of lerning of TeX. Help
other people
and try to understand how things work.

Wolfgang

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

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: \combinepages[]: Change order
  2006-10-10 10:43       ` Wolfgang Schuster
@ 2006-10-10 20:41         ` Hans Hagen
  2006-10-11 12:30           ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2006-10-10 20:41 UTC (permalink / raw)


Wolfgang Schuster wrote:
>
>
> 2006/10/10, Hans Hagen <pragma@wxs.nl <mailto:pragma@wxs.nl>>:
>
>     Wolfgang Schuster wrote:
>     >
>     > I changed the macro to a (for mee) more readable form.
>     i changed your first patch to an 'alternative c' option with split up
>     macro's directiuon is reserved for directional typesetting
>     >
>     >
>     >
>     >
>     >
>     \doifelse\@@ipdirection\v!horizontal\docombinepageshorizontal\docombinepagesvertical#1
>     > % watch the #1 ;-)
>     >
>     >
>     see patch i sent you; we can avoid the #1 ; will be in the next beta
>
>     also imagine that #1 is blabla and not a \cs ... in sich cases you
>     really need {#1}
>
>     so: ...[alternative=a|b|c|horizontal|vertical]
>
>     Hans
>
>  
> Hi Hans,
>  
> if I look at your it seems to me alternative=horizontal|vertical will 
> be similiar
> to  alternative=b and not horizontal==a and vertical==c as I thought.
can you test the beta? the code is in there now 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: \combinepages[]: Change order
  2006-10-10 20:41         ` Hans Hagen
@ 2006-10-11 12:30           ` Wolfgang Schuster
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2006-10-11 12:30 UTC (permalink / raw)



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

2006/10/10, Hans Hagen <pragma@wxs.nl>:
>
> Wolfgang Schuster wrote:
> >
> >
> > 2006/10/10, Hans Hagen <pragma@wxs.nl <mailto:pragma@wxs.nl>>:
> >
> >     Wolfgang Schuster wrote:
> >     >
> >     > I changed the macro to a (for mee) more readable form.
> >     i changed your first patch to an 'alternative c' option with split
> up
> >     macro's directiuon is reserved for directional typesetting
> >     >
> >     >
> >     >
> >     >
> >     >
> >
> \doifelse\@@ipdirection\v!horizontal\docombinepageshorizontal\docombinepagesvertical#1
> >     > % watch the #1 ;-)
> >     >
> >     >
> >     see patch i sent you; we can avoid the #1 ; will be in the next beta
> >
> >     also imagine that #1 is blabla and not a \cs ... in sich cases you
> >     really need {#1}
> >
> >     so: ...[alternative=a|b|c|horizontal|vertical]
> >
> >     Hans
> >
> >
> > Hi Hans,
> >
> > if I look at your it seems to me alternative=horizontal|vertical will
> > be similiar
> > to  alternative=b and not horizontal==a and vertical==c as I thought.
> can you test the beta? the code is in there now
>
> Hans


Hi Hans,

I looked yesterday only at your E-Mail, after I tried today the new beta
everything works fine and as expected with all alternatives.

Wolfgang

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

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

end of thread, other threads:[~2006-10-11 12:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-07 17:01 \combinepages[]: Change order Tobias Burnus
2006-10-09  7:39 ` Wolfgang Schuster
2006-10-10  7:25   ` Wolfgang Schuster
2006-10-10 10:07     ` Hans Hagen
2006-10-10 10:43       ` Wolfgang Schuster
2006-10-10 20:41         ` Hans Hagen
2006-10-11 12:30           ` Wolfgang Schuster

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