texlive[59001] trunk: pdfxup (26apr21)

commits+karl at tug.org commits+karl at tug.org
Tue Apr 27 15:34:28 CEST 2021


Revision: 59001
          http://tug.org/svn/texlive?view=revision&revision=59001
Author:   karl
Date:     2021-04-27 15:34:28 +0200 (Tue, 27 Apr 2021)
Log Message:
-----------
pdfxup (26apr21)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/pdfxup/pdfxup
    trunk/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl
    trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
    trunk/Build/source/texk/texlive/linked_scripts/texlive/updmap.pl
    trunk/Master/texmf-dist/doc/man/man1/pdfxup.1
    trunk/Master/texmf-dist/doc/man/man1/pdfxup.man1.pdf
    trunk/Master/texmf-dist/doc/support/pdfxup/README
    trunk/Master/texmf-dist/doc/support/pdfxup/RELEASES
    trunk/Master/texmf-dist/doc/support/pdfxup/pdfxup.pdf
    trunk/Master/texmf-dist/scripts/pdfxup/pdfxup
    trunk/Master/texmf-dist/tex/latex/pdfxup/pdfxup-template.tex

Modified: trunk/Build/source/texk/texlive/linked_scripts/pdfxup/pdfxup
===================================================================
(Binary files differ)

Modified: trunk/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl	2021-04-27 13:34:03 UTC (rev 59000)
+++ trunk/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl	2021-04-27 13:34:28 UTC (rev 59001)
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
-# $Id: fmtutil.pl 58847 2021-04-12 01:00:22Z preining $
+# $Id: fmtutil.pl 58961 2021-04-22 00:55:07Z preining $
 # fmtutil - utility to maintain format files.
 # (Maintained in TeX Live:Master/texmf-dist/scripts/texlive.)
 # 
@@ -24,11 +24,11 @@
   TeX::Update->import();
 }
 
-my $svnid = '$Id: fmtutil.pl 58847 2021-04-12 01:00:22Z preining $';
-my $lastchdate = '$Date: 2021-04-12 03:00:22 +0200 (Mon, 12 Apr 2021) $';
+my $svnid = '$Id: fmtutil.pl 58961 2021-04-22 00:55:07Z preining $';
+my $lastchdate = '$Date: 2021-04-22 02:55:07 +0200 (Thu, 22 Apr 2021) $';
 $lastchdate =~ s/^\$Date:\s*//;
 $lastchdate =~ s/ \(.*$//;
-my $svnrev = '$Revision: 58847 $';
+my $svnrev = '$Revision: 58961 $';
 $svnrev =~ s/^\$Revision:\s*//;
 $svnrev =~ s/\s*\$$//;
 my $version = "r$svnrev ($lastchdate)";

Modified: trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl	2021-04-27 13:34:03 UTC (rev 59000)
+++ trunk/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl	2021-04-27 13:34:28 UTC (rev 59001)
@@ -1,12 +1,12 @@
 #!/usr/bin/env perl
-# $Id: tlmgr.pl 58862 2021-04-13 01:01:37Z preining $
+# $Id: tlmgr.pl 58961 2021-04-22 00:55:07Z preining $
 #
 # Copyright 2008-2021 Norbert Preining
 # This file is licensed under the GNU General Public License version 2
 # or any later version.
 
-my $svnrev = '$Revision: 58862 $';
-my $datrev = '$Date: 2021-04-13 03:01:37 +0200 (Tue, 13 Apr 2021) $';
+my $svnrev = '$Revision: 58961 $';
+my $datrev = '$Date: 2021-04-22 02:55:07 +0200 (Thu, 22 Apr 2021) $';
 my $tlmgrrevision;
 my $tlmgrversion;
 my $prg;
@@ -873,7 +873,7 @@
   # only existing formats are recreated
   if (!$localtlpdb->option("create_formats")) {
     $invoke_fmtutil .= " --refresh";
-    info("only existing formats will be refreshed per user option (create_formats=0)\n");
+    debug("only existing formats will be refreshed per user option (create_formats=0)\n");
   }
 
   if ($::files_changed) {
@@ -7007,9 +7007,9 @@
   # choose a mirror if we are asked.
   if ($location =~ m/^ctan$/i) {
     $location = give_ctan_mirror();
-  } elsif ($location =~ m,^$TeXLiveServerURL,) {
+  } elsif ($location =~ m,^$TeXLiveServerURLRegexp,) {
     my $mirrorbase = TeXLive::TLUtils::give_ctan_mirror_base();
-    $location =~ s,^$TeXLiveServerURL,$mirrorbase,;
+    $location =~ s,^$TeXLiveServerURLRegexp,$mirrorbase,;
   }
 
   my $errormsg;
@@ -7049,9 +7049,9 @@
   # choose a mirror if we are asked.
   if ($location =~ m/^ctan$/i) {
     $location = give_ctan_mirror();
-  } elsif ($location =~ m,^$TeXLiveServerURL,) {
+  } elsif ($location =~ m,^$TeXLiveServerURLRegexp,) {
     my $mirrorbase = TeXLive::TLUtils::give_ctan_mirror_base();
-    $location =~ s,^$TeXLiveServerURL,$mirrorbase,;
+    $location =~ s,^$TeXLiveServerURLRegexp,$mirrorbase,;
   }
 
   # if we talk about a net location try to download the hash of the tlpdb
@@ -7698,7 +7698,7 @@
 
 =item C<tlmgr option repository ctan>
 
-=item C<tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet>
+=item C<tlmgr option repository https://mirror.ctan.org/systems/texlive/tlnet>
 
 Tell C<tlmgr> to use a nearby CTAN mirror for future updates; useful if
 you installed TeX Live from the DVD image and want to have continuing
@@ -7781,7 +7781,7 @@
 
 =item C<ctan>
 
-=item C<http://mirror.ctan.org/systems/texlive/tlnet>
+=item C<https://mirror.ctan.org/systems/texlive/tlnet>
 
 Pick a CTAN mirror automatically, trying for one that is both nearby and
 up-to-date. The chosen mirror is used for the entire download. The bare
@@ -8557,7 +8557,7 @@
 get further updates from the Internet, after originally installing from
 DVD.  To do this, you can run
 
- tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet
+ tlmgr option repository https://mirror.ctan.org/systems/texlive/tlnet
 
 The C<install-tl> documentation has more information about the possible
 values for C<repository>.  (For backward compatibility, C<location> can
@@ -10116,7 +10116,7 @@
 distribution (L<https://tug.org/texlive>) and both are licensed under the
 GNU General Public License Version 2 or later.
 
-$Id: tlmgr.pl 58862 2021-04-13 01:01:37Z preining $
+$Id: tlmgr.pl 58961 2021-04-22 00:55:07Z preining $
 =cut
 
 # test HTML version: pod2html --cachedir=/tmp tlmgr.pl >/tmp/tlmgr.html

Modified: trunk/Build/source/texk/texlive/linked_scripts/texlive/updmap.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texlive/updmap.pl	2021-04-27 13:34:03 UTC (rev 59000)
+++ trunk/Build/source/texk/texlive/linked_scripts/texlive/updmap.pl	2021-04-27 13:34:28 UTC (rev 59001)
@@ -1,9 +1,9 @@
 #!/usr/bin/env perl
-# $Id: updmap.pl 51338 2019-06-07 16:36:59Z karl $
+# $Id: updmap.pl 58960 2021-04-22 00:52:00Z preining $
 # updmap - maintain map files for outline fonts.
 # (Maintained in TeX Live:Master/texmf-dist/scripts/texlive.)
 # 
-# Copyright 2011-2019 Norbert Preining
+# Copyright 2011-2021 Norbert Preining
 # This file is licensed under the GNU General Public License version 2
 # or any later version.
 #
@@ -14,7 +14,7 @@
 # the original versions were licensed under the following agreement:
 # Anyone may freely use, modify, and/or distribute this file, without
 
-my $svnid = '$Id: updmap.pl 51338 2019-06-07 16:36:59Z karl $';
+my $svnid = '$Id: updmap.pl 58960 2021-04-22 00:52:00Z preining $';
 
 my $TEXMFROOT;
 BEGIN {
@@ -27,10 +27,10 @@
   unshift(@INC, "$TEXMFROOT/tlpkg");
 }
 
-my $lastchdate = '$Date: 2019-06-07 18:36:59 +0200 (Fri, 07 Jun 2019) $';
+my $lastchdate = '$Date: 2021-04-22 02:52:00 +0200 (Thu, 22 Apr 2021) $';
 $lastchdate =~ s/^\$Date:\s*//;
 $lastchdate =~ s/ \(.*$//;
-my $svnrev = '$Revision: 51338 $';
+my $svnrev = '$Revision: 58960 $';
 $svnrev =~ s/^\$Revision:\s*//;
 $svnrev =~ s/\s*\$$//;
 my $version = "r$svnrev ($lastchdate)";
@@ -1373,10 +1373,10 @@
 but will not be found because overriding files exist, listed below.
 ");
     #
-    if ($prg eq "updmap-sys") {
+    if ($opts{'sys'}) {
       print_and_log ("
-Perhaps you have run updmap in the past, but are running updmap-sys
-now.  Once you run updmap the first time, you have to keep using it,
+Perhaps you have run updmap-user in the past, but are running updmap-sys
+now.  Once you run updmap-user the first time, you have to keep using it,
 or else remove the personal configuration files it creates (the ones
 listed below).
 ");

Modified: trunk/Master/texmf-dist/doc/man/man1/pdfxup.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/pdfxup.1	2021-04-27 13:34:03 UTC (rev 59000)
+++ trunk/Master/texmf-dist/doc/man/man1/pdfxup.1	2021-04-27 13:34:28 UTC (rev 59001)
@@ -1,6 +1,6 @@
 .\" Manpage for pdfxup.
 .\" Contact pdfxup at markey.fr to correct errors or typos.
-.TH man 1 "17 december 2020" "2.00" "pdfxup man page"
+.TH man 1 "25 april 2021" "2.10" "pdfxup man page"
 .SH NAME
 pdfxup \- n-up tool with reduced margins
 .SH SYNOPSIS
@@ -123,6 +123,46 @@
 \fB\-d\fR, \fB\-\-debug\fR
 debug mode: keep intermediary files.
 .TP
+\fB\-col\fR, \fB\-\-column-mode\fR, \fB\-\-vertical\fR
+fill in pages top-down first (instead of the default left-to-right mode).
+By default, pages are inserted from left to right, until the line is full;
+with this option, pages are inserted from top to bottom, until the column
+is full. See option \fB\-bal\fR below for examples of both options.
+.TP
+\fB\-row\fR, \fB\-\-row-mode\fR, \fB\-\-horizontal\fR
+fill in pages left to right (which is the default mode).
+.TP
+\fB\-bal\fR, \fB\-\-balance-last\fR
+balance last page: when using column mode, the pages are filled in from
+top to bottom, and the last page is no exception. Still, it may be prefered
+that the columns in the last page remains "balanced", which is what this
+option achieves. Symmetrically, in row mode, this option would balance the
+rows.
+.nf
+                 ---------                        ---------
+row, no-balance | 1  2  3 |  column, no-balance  | 1  4  7 |
+(default mode)  | 4  5  6 |                      | 2  5  8 |
+                | 7  8  9 |                      | 3  6  9 |
+                 ---------                        ---------
+                 ---------                        ---------
+                |10 11 12 |                      |10 13    |
+                |13 14    |                      |11 14    |
+                |         |                      |12       |
+                 ---------                        ---------
+
+                 ---------                        ---------
+   row, balance | 1  2  3 |     column, balance  | 1  4  7 |
+                | 4  5  6 |                      | 2  5  8 |
+                | 7  8  9 |                      | 3  6  9 |
+                 ---------                        ---------
+                 ---------                        ---------
+                |10 11    |                      |10 12 14 |
+                |12 13    |                      |11 13    |
+                |14       |                      |         |
+                 ---------                        ---------
+
+.fi
+.TP
 \fB\-V [0-3]\fR, \fB\-\-verbose\fR [0-3]
 select verbosity (default: 1).
 .TP

Modified: trunk/Master/texmf-dist/doc/man/man1/pdfxup.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/pdfxup/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/pdfxup/README	2021-04-27 13:34:03 UTC (rev 59000)
+++ trunk/Master/texmf-dist/doc/support/pdfxup/README	2021-04-27 13:34:28 UTC (rev 59001)
@@ -1,4 +1,4 @@
-PDFXUP -- v2.00 (2020/12/17)
+PDFXUP -- v2.10 (2021/04/25)
 N. Markey <pdfxup at markey.fr>
 
 
@@ -18,7 +18,7 @@
 
 
 
-%% (c) 2020/12/17 Nicolas Markey <pdfxup at markey dot fr>
+%% (c) 2021/04/25 Nicolas Markey <pdfxup at markey dot fr>
 %%
 %% This work may  be distributed and/or modified under  the conditions of
 %% the LaTeX Project  Public License, either version 1.3  of this license

Modified: trunk/Master/texmf-dist/doc/support/pdfxup/RELEASES
===================================================================
--- trunk/Master/texmf-dist/doc/support/pdfxup/RELEASES	2021-04-27 13:34:03 UTC (rev 59000)
+++ trunk/Master/texmf-dist/doc/support/pdfxup/RELEASES	2021-04-27 13:34:28 UTC (rev 59001)
@@ -4,7 +4,7 @@
 ##
 ##################################################################
 Author: Nicolas Markey 
-Please send your comments to <pdfxup at markey.fr>
+Please send your comments and bug reports to <pdfxup at markey.fr>
 
 v1.00 (2015/08/23)
  - first release
@@ -50,4 +50,15 @@
    extension .xup) can be used to define default values
    for frequent situations.
  - cleaned-up man page, adding some missing options (thanks
-   to Louis Gostiaux for pointing undocumented options)
\ No newline at end of file
+   to Louis Gostiaux for pointing undocumented options)
+
+v2.10 (2021/04/25)
+ - fixed a bug due to ghostscript adding a patch-level number in
+   their version number. This is the bug reported in 
+     https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=976080
+   It was solved with the help of Christian Gnaegi.
+ - fixed 2 bugs in the computations of size of pages
+ - fixed a bug which inhibited short-edge option of booklets
+ - added options --col (to fill in pages vertically first) and --bal
+   (to balance columns (or rows) the last page). This feature was
+   requested by Philipp Killinger.

Modified: trunk/Master/texmf-dist/doc/support/pdfxup/pdfxup.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/scripts/pdfxup/pdfxup
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/latex/pdfxup/pdfxup-template.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/pdfxup/pdfxup-template.tex	2021-04-27 13:34:03 UTC (rev 59000)
+++ trunk/Master/texmf-dist/tex/latex/pdfxup/pdfxup-template.tex	2021-04-27 13:34:28 UTC (rev 59001)
@@ -1,6 +1,25 @@
+%
+% pdfxup template file
+%
+%% (c) 2021/04/25 Nicolas Markey <pdfxup at markey dot fr>
+%%
+%% This work may  be distributed and/or modified under  the conditions of
+%% the LaTeX Project  Public License, either version 1.3  of this license
+%% or (at  your option)  any later version.   The latest version  of this
+%% license is in
+%% 
+%%   http://www.latex-project.org/lppl.txt
+%% 
+%% and version 1.3 or later is part of all distributions of LaTeX version
+%% 2005/12/01 or later.
+%% 
+%% This work has the LPPL maintenance status `maintained'.
+%% The Current Maintainer of this work is Nicolas Markey.
+
+
 \expandafter\ifx\csname pdfxupfile\endcsname\relax
 \PackageError{pdfxup}{This file should not be compiled alone}
-             {File pdfxup-template.pdf is not meant to be compiled alone.
+             {File pdfxup-template.tex is not meant to be compiled alone.
                \MessageBreak
              It should only be used via the 'pdfxup' script.}
 \fi
@@ -20,17 +39,17 @@
   \newcounter{result}%
   \newif\iffound
   \def\@parserange#1-#2-#3\@end#4\@end{%
-    \setcounter{result}{#4}%
-    \ifnum\value{result}=1\relax
+    \c at result=#4\relax%
+    \ifnum\c at result=1\relax
       \foundtrue
-      \setcounter{result}{#1}%
+      \c at result=#1\relax%
     \else
-      \addtocounter{result}{-1}%
+      \advance\c at result by -1\relax%
       \ifx\relax#3\relax%% means that range contains no -
       \else
-        \addtocounter{result}{#1}%
-        \ifnum#2<\value{result}\relax
-          \addtocounter{result}{-#2}%
+        \advance\c at result by #1\relax%
+        \ifnum#2<\c at result\relax
+          \advance\c at result by -#2\relax%
         \else
           \foundtrue
         \fi
@@ -40,48 +59,45 @@
   \def\@parsecsl#1,#2\@end#3\@end{%
     \parserange{#3}{#1}%
     \iffound\else
-    \ifx\relax#2\relax\else\@parsecsl#2\@end\value{result}\@end\fi\fi}
+    \ifx\relax#2\relax\else\@parsecsl#2\@end\c at result\@end\fi\fi}
    %% \nthvalue#1#2 looks for #1-th value in list of intervals #2
   \def\nthvalue#1#2{\foundfalse\expandafter\@parsecsl#2,\@end#1\@end}
-   %%
 
-
   %% perform various computations:
   %% - width and height of image (\hresult and \vresult)
   %% - width and height of frame containing image (\hboxsize and \vboxsize)
   \newcounter{lastpage}
-  \newcounter{outpage}
-  \setcounter{outpage}{\pdfxupnbpages}
-  \addtocounter{outpage}{-1}
+  \newcounter{outpage}%%% nr of pages of output document
+  \c at outpage=\pdfxupnbpages\relax
+  \advance\c at outpage by -1\relax
   \divide\c at outpage by \pdfxupnbhoriz
   \divide\c at outpage by \pdfxupnbvert
   \ifbooklet
-    \divide\c at outpage by 2
+    \divide\c at outpage by 2\relax
   \fi
-  \stepcounter{outpage}
+  \advance\c at outpage by 1\relax
   \ifbooklet
-    \multiply\c at outpage by 2
+    \multiply\c at outpage by 2\relax
   \fi
-  \setcounter{lastpage}{\value{outpage}}
+  \c at lastpage=\c at outpage\relax
   \multiply\c at lastpage by \pdfxupnbhoriz
   \multiply\c at lastpage by \pdfxupnbvert
-  \makeatother
   %
   \newlength\outputvmargin
   \newlength\outputhmargin
-  \setlength\outputvmargin{\pdfxupvmargin}
-  \setlength\outputhmargin{\pdfxuphmargin}
+  \outputvmargin=\pdfxupvmargin\relax
+  \outputhmargin=\pdfxuphmargin\relax
   \newlength\innervmargin
   \newlength\innerhmargin
-  \setlength\innervmargin{\pdfxupinnervmargin}
-  \setlength\innerhmargin{\pdfxupinnerhmargin}
+  \innervmargin=\pdfxupinnervmargin\relax
+  \innerhmargin=\pdfxupinnerhmargin\relax
   \newlength\outputindivvmargin
   \newlength\outputindivhmargin
-  \setlength\outputindivvmargin{\pdfxupintermvspace}
-  \setlength\outputindivhmargin{\pdfxupintermhspace}
+  \outputindivvmargin=\pdfxupintermvspace\relax
+  \outputindivhmargin=\pdfxupintermhspace\relax
   %
-  \fboxsep=0pt%
-  \setlength\fboxrule{\pdfxupframewidth}
+  \fboxrule=\pdfxupframewidth\relax
+  \fboxsep=-\fboxrule
   \newlength\hresult
   \newlength\vresult
   \newlength\vboxsize
@@ -94,8 +110,8 @@
   \vresult=\paperheight 
   \advance\vresult by -\pdfxupnbvert\fboxrule
   \advance\vresult by -\pdfxupnbvert\fboxrule
-  \advance\vresult by -\pdfxupnbvert\innerhmargin
-  \advance\vresult by -\pdfxupnbvert\innerhmargin
+  \advance\vresult by -\pdfxupnbvert\innervmargin
+  \advance\vresult by -\pdfxupnbvert\innervmargin
   %
   \advance\hresult by -2\outputhmargin
   \advance\vresult by -2\outputvmargin
@@ -116,14 +132,26 @@
   \advance\hboxsize by 2\innerhmargin
 
 
-  %% compute actual scale by which PDF is shrunk (or extended)
+  \let\pdfxupnblines\pdfxupnbvert
+  \let\pdfxupnbcols\pdfxupnbhoriz
+  \ifnum\columnmode=0\relax
+  %% "row-mode"
+  \def\horizincr{\pdfxupnbhoriz}
+  \def\vertincr{1}
+  \else
+  %% "column-mode"
+  \def\horizincr{1}
+  \def\vertincr{\pdfxupnbvert}%
+  \fi
+
+%% compute actual scale by which PDF is shrunk (or extended)
   \ifnum\pdfxupemptybb=0\relax
   \newcounter{origx}
-  \setcounter{origx}{\pdfxupw}
-  \addtocounter{origx}{-\pdfxupx}
+  \c at origx=\pdfxupw\relax
+  \advance\c at origx by -\pdfxupx\relax
   \newcounter{origy}
-  \setcounter{origy}{\pdfxuph}
-  \addtocounter{origy}{-\pdfxupy}
+  \c at origy=\pdfxuph\relax
+  \advance\c at origy by -\pdfxupy\relax
   \newlength\finalx
   \newlength\finaly
   \finalx=\hresult
@@ -148,56 +176,94 @@
   %\tracingoutput=1
   %\tracingpages=1
   %\tracingparagraphs=1
-  \makeatletter
-  \newcounter{curroutpage}
-  \setcounter{curroutpage}{1}
-  \addtocounter{curroutpage}{-1}
-  \newcounter{currpage}
-  \newcounter{currcol}
-  \newcounter{currline}
-  \newcounter{realout}
-  \newcounter{wmout}
-  \newcounter{wmoutaux}
-  \@whilenum \value{outpage}>\value{curroutpage} \do%
-    {\stepcounter{curroutpage}%
-    \setcounter{currpage}{\value{curroutpage}}%
-    \advance\c at currpage by -1%
-    \multiply\c at currpage by \pdfxupnbhoriz%
-    \multiply\c at currpage by \pdfxupnbvert%
+  \newcounter{curroutpage}%%%% counts pages nr  of output document
+  \c at curroutpage=0\relax
+  \newcounter{currpage}%%%%%%% page nr of input document
+  \newcounter{linecurrpage}%%% currpage at beginning of line
+  \newcounter{currcol}%
+  \newcounter{currline}%
+  \newcounter{realout}%
+  \newcounter{wmout}%
+  \newcounter{wmoutaux}%
+  \@whilenum \c at outpage>\c at curroutpage \do%
+    {\advance\c at curroutpage by 1\relax%
+    %% check if we are on last page, and if so, possibly balance last page
+    \if0\balancelast\relax\else
+    \c at currpage=\c at curroutpage\relax%
+    \multiply\c at currpage by \pdfxupnbhoriz\relax%
+    \multiply\c at currpage by \pdfxupnbvert\relax%
+    \ifnum\c at currpage>\pdfxupnbpages\relax
+      \c at currpage=-\c at curroutpage\relax%
+      \advance\c at currpage by 1 %
+      \multiply\c at currpage by \pdfxupnbhoriz\relax%
+      \multiply\c at currpage by \pdfxupnbvert\relax%
+      \advance\c at currpage by \pdfxupnbpages\relax
+      \ifnum\columnmode=0\relax
+        \advance\c at currpage by -1\relax
+        \divide\c at currpage by \pdfxupnbvert\relax%
+        \advance\c at currpage by 1\relax
+        \edef\horizincr{\thecurrpage}%
+        \edef\pdfxupnbcols{\thecurrpage}%
+      \else
+        \advance\c at currpage by -1\relax
+        \divide\c at currpage by \pdfxupnbhoriz\relax%
+        \advance\c at currpage by 1\relax
+        %\showthe\value{currpage}
+        \edef\vertincr{\thecurrpage}%
+        \edef\pdfxupnblines{\thecurrpage}%
+        %\show\vertincr
+        %\show\horizincr
+      \fi
+    \fi
+    \fi
+    %% start producing page
+    \c at currpage=\c at curroutpage%
+    \advance\c at currpage by -1\relax%
+    \multiply\c at currpage by \pdfxupnbhoriz\relax%
+    \multiply\c at currpage by \pdfxupnbvert\relax%
+    \c at linecurrpage=\c at currpage%
     \hrule \@height\z@%
-    \setcounter{currline}{0}%
-    \vskip \outputvmargin%
-    \@whilenum\value{currline}<\pdfxupnbvert \do%
-      {\hrule \@height\z@\vskip \outputindivvmargin%
-        \ifnum\value{currline}>0\vskip \outputindivvmargin\fi%
-        \global\stepcounter{currline}%
-        \setcounter{currcol}{0}%
+    \c at currline=0\relax%
+    \vskip\outputvmargin%
+    \@whilenum\c at currline<\pdfxupnblines \do%
+      {\hrule \@height\z@%
+       \ifnum\value{currline}>0\relax%
+          \vskip \outputindivvmargin%
+          \advance\c at linecurrpage by \horizincr\relax%
+        \else%
+          \advance\c at linecurrpage by 1\relax%
+        \fi%
+        \advance\c at currline by 1\relax%
+        \c at currpage=\c at linecurrpage\relax%
+        \c at currcol=0\relax%
         \hskip \outputhmargin%
-        \@whilenum\value{currcol}<\pdfxupnbhoriz \do%
-          {\ifnum\value{currcol}>0\hskip\outputindivhmargin\fi%
-            \global\stepcounter{currcol}%
-            \global\stepcounter{currpage}%
-            \ifnum\value{currpage}>\value{lastpage}\else
+        \@whilenum\c at currcol<\pdfxupnbcols \do%
+          {\ifnum\c at currcol>0\relax%
+             \hskip\outputindivhmargin%
+             \advance\c at currpage by \vertincr\relax%
+            \fi%
+            \advance\c at currcol by 1\relax%
+            \ifnum\c at currpage>\c at lastpage\else
 	      %% computing page number corresponding to \currline and \currcol
-              \setcounter{realout}{\value{currpage}}%
+              \c at realout=\c at currpage%
               \def\ang{0}%
               \ifbooklet
                \iflongedge
                 %% long edge:
                 %% 1->n, 2->1, 3->n-1 (rotated), 4->2(rotated)...
-                \ifodd\value{realout}%           -> 1 or 3
-                  \addtocounter{realout}{-1}%
+                \ifodd\c at realout\relax%           -> 1 or 3
+                  \advance\c at realout by -1\relax%
                   \divide\c at realout by 2\relax
-                  \ifodd\value{realout}%         -> 3
+                  \ifodd\c at realout\relax%         -> 3
                     \def\ang{180}%
                   \else%                         -> 1
                   \fi
-                  \setcounter{realout}{-\value{realout}}%
-                  \addtocounter{realout}{\value{outpage}}%
-                  \addtocounter{realout}{\value{outpage}}%
+                  \c at realout=-\value{realout}\relax%
+                  \advance\c at realout by \c at outpage\relax%
+                  \advance\c at realout by \c at outpage\relax%
                 \else%                           -> 2 or 4
                   \divide\c at realout by 2\relax
-                  \ifodd\value{realout}%         -> 2
+                  \ifodd\c at realout%         -> 2
                   \else%                         -> 4
                     \def\ang{180}%
                   \fi
@@ -205,29 +271,29 @@
                \else 
                 %% short edge:
                 %% 1->n, 2->1, 3->2, 4->n-1, 5->n-2, 6->3, 7->4, 8->n-3
-                \ifodd\value{realout}%           -> 1 or 3
-                  \addtocounter{realout}{-1}%
+                \ifodd\c at realout\relax%           -> 1 or 3
+                  \advance\c at realout by -1\relax%
                   \divide\c at realout by 2\relax
-                  \ifodd\value{realout}%         -> 3
-                    \stepcounter{realout}
+                  \ifodd\c at realout%         -> 3
+                    \advance\c at realout by 1\relax
                   \else%                         -> 1
-                    \setcounter{realout}{-\value{realout}}%
-                    \addtocounter{realout}{\value{outpage}}%
-                    \addtocounter{realout}{\value{outpage}}%
+                    \c at realout=-\c at realout%
+                    \advance\c at realout by \c at outpage\relax%
+                    \advance\c at realout by \c at outpage\relax%
                   \fi
                 \else%                           -> 2 or 4
                   \divide\c at realout by 2\relax
-                  \ifodd\value{realout}%         -> 2
+                  \ifodd\c at realout\relax%         -> 2
                   \else%                         -> 4
-                    \setcounter{realout}{-\value{realout}}%
-                    \stepcounter{realout}
-                    \addtocounter{realout}{\value{outpage}}%
-                    \addtocounter{realout}{\value{outpage}}%
+                    \c at realout=-\c at realout\relax%
+                    \advance\c at realout by 1\relax
+                    \advance\c at realout by \c at outpage\relax%
+                    \advance\c at realout by \c at outpage\relax%
                   \fi
                 \fi
                \fi %% \iflongedge...\else
               \fi %% \ifbooklet
-              \ifnum\value{realout}>\pdfxupnbpages\relax
+              \ifnum\c at realout>\pdfxupnbpages\relax
 	        %% if page above nb of pages, output blank page
                 %\hskip\hresult\hskip2\fboxrule
 		\hskip\hboxsize
@@ -234,22 +300,22 @@
               \else
                 %% otherwise compute corresponding page to display
 	        %% first keep realout for watermarking...
-	        \setcounter{wmoutaux}{\value{realout}}%
-	        \setcounter{wmout}{\value{realout}}%
-                \nthvalue{\value{realout}}{\pdfxuppagelist}%
-                \iffound\setcounter{realout}{\value{result}}%
+	        \c at wmoutaux=\c at realout\relax%
+	        \c at wmout=\c at realout\relax%
+                \nthvalue{\c at realout}{\pdfxuppagelist}%
+                \iffound\c at realout=\c at result\relax%
                 \else %% hmmm... problem
                 \message{I'm messed up counting pages...}%
                 \fi
                 %% compute watermarking page and display
 	        \ifx\pdfxupwatermark\@empty\else
-	  	  \ifnum\pdfxupnbwp<\value{wmoutaux}\relax
-		    \addtocounter{wmoutaux}{-\pdfxupnbwp}%
-		    \addtocounter{wmoutaux}{-1}%
+	  	  \ifnum\pdfxupnbwp<\c at wmoutaux\relax
+		    \advance\c at wmoutaux by -\pdfxupnbwp\relax%
+		    \advance\c at wmoutaux by -1\relax%
 		    \divide\c at wmoutaux by \pdfxupwperiod\relax
-                    \stepcounter{wmoutaux}%
+                    \advance\c at wmoutaux by 1\relax%
 		    \multiply\c at wmoutaux by \pdfxupwperiod\relax
-		    \addtocounter{wmout}{-\value{wmoutaux}}%
+		    \advance\c at wmout by -\c at wmoutaux%
 		  \fi
 		  \vbox to \vboxsize{\vfill
 	          \hbox to \hboxsize{\hfill



More information about the tex-live-commits mailing list.