diff options
Diffstat (limited to 'support')
-rw-r--r-- | support/l3sys-query/CHANGELOG.md | 12 | ||||
-rw-r--r-- | support/l3sys-query/README.md | 2 | ||||
-rw-r--r-- | support/l3sys-query/l3sys-query-tool.pdf | bin | 0 -> 374018 bytes | |||
-rw-r--r-- | support/l3sys-query/l3sys-query-tool.tex | 264 | ||||
-rw-r--r-- | support/l3sys-query/l3sys-query.1 | 16 | ||||
-rw-r--r-- | support/l3sys-query/l3sys-query.lua | 4 | ||||
-rw-r--r-- | support/pdfxup/README | 4 | ||||
-rw-r--r-- | support/pdfxup/RELEASES | 5 | ||||
-rw-r--r-- | support/pdfxup/lipics.xup | 2 | ||||
-rw-r--r-- | support/pdfxup/llncs.xup | 2 | ||||
-rwxr-xr-x | support/pdfxup/pdfxup | 27 | ||||
-rw-r--r-- | support/pdfxup/pdfxup-template.tex | 181 | ||||
-rw-r--r-- | support/pdfxup/pdfxup.1 | 38 | ||||
-rw-r--r-- | support/pdfxup/pdfxup.pdf | bin | 90395 -> 90128 bytes |
14 files changed, 424 insertions, 133 deletions
diff --git a/support/l3sys-query/CHANGELOG.md b/support/l3sys-query/CHANGELOG.md index 1ea7406411..b11654d512 100644 --- a/support/l3sys-query/CHANGELOG.md +++ b/support/l3sys-query/CHANGELOG.md @@ -7,9 +7,19 @@ Changelog](https://keepachangelog.com/en/1.0.0/), this project uses date-based ## [Unreleased] +## [2024-03-15] + +### Added +- PDF documentation in distribution +- `man` file in distribution + +### Changed +- Documentation tweaks + ## [2024-03-14] ### Added - New script -[Unreleased]: https://github.com/latex3/l3sys-query/compare/2024-03-14...HEAD +[Unreleased]: https://github.com/latex3/l3sys-query/compare/2024-03-15...HEAD +[2024-03-15]: https://github.com/latex3/l3sys-query/compare/2024-03-14...2024-03-15 diff --git a/support/l3sys-query/README.md b/support/l3sys-query/README.md index 2091f11c8d..1b9998f29e 100644 --- a/support/l3sys-query/README.md +++ b/support/l3sys-query/README.md @@ -1,6 +1,6 @@ # `l3sys-query`: System queries for LaTeX using Lua -Release 2024-03-04 +Release 2024-03-15 ## Overview diff --git a/support/l3sys-query/l3sys-query-tool.pdf b/support/l3sys-query/l3sys-query-tool.pdf Binary files differnew file mode 100644 index 0000000000..78e2666269 --- /dev/null +++ b/support/l3sys-query/l3sys-query-tool.pdf diff --git a/support/l3sys-query/l3sys-query-tool.tex b/support/l3sys-query/l3sys-query-tool.tex new file mode 100644 index 0000000000..d9b99d59c1 --- /dev/null +++ b/support/l3sys-query/l3sys-query-tool.tex @@ -0,0 +1,264 @@ +\iffalse meta-comment + +File l3sys-query-tool.tex Copyright (C) 2024 The LaTeX Project + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +----------------------------------------------------------------------- + +The development version of the bundle can be found at + + https://github.com/latex3/l3sys-query + +for those people who are interested. + +----------------------------------------------------------------------- + +\fi + +\documentclass{l3doc} + +\begin{document} + +\title{The \pkg{l3sys-query} script: System queries for LaTeX using Lua} + +\author{% + The \LaTeX{} Project\thanks{% + Email: \href{mailto:latex-team@latex-project.org} + {latex-team@latex-project.org}% + }% +} + +\date{Release 2024-03-15} + +\maketitle +\tableofcontents + +\begin{documentation} + +\section{Introduction} + +\TeX{} engines provide only very limited access to information about the system +they are used on: using primitives, one can for example get the size of a single +file, but not a list of files in a given location. For most documents, this is +not an issue as they are self-contained. However, for cases where +\enquote{dynamic} construction of parts of a document is needed based on file +lists or other system-dependent data, methods to obtain this from (restricted) +shell escape are desirable. + +Security considerations mean that directly querying the system shell is +problematic for general use. Instead, \emph{restricted} shell escape may be used +to get many details, provided a suitable tool is available to provide the +information in a platform-neutral and security-conscious way. The Java program +\texttt{texosquery}, written by Nicola Talbot, has been available for a number +of years to provide this facility. As well as file system insight, +\texttt{texosquery} also provides for example locale data and other system +information. However, the requirement for Java means that the script is not +automatically usable when a \TeX{} system is installed. + +The \LaTeX{} team have therefore provided a Lua-based script, +\texttt{l3sys-query}, which conforms to the security requirements of \TeX{} Live +using Lua to obtain the system information. This means that it can be used +\enquote{out of the box} across platforms. The facilities provided by +\texttt{l3sys-query} are more limited than \texttt{texosquery}, partly as some +information is available in modern \TeX{} systems using primitives, and partly +as the aim of \texttt{l3sys-query} is to provide information where there are +defined use cases. Requests for additional data interfaces are welcome. + +\section{The command line interface} + +The command line interface to +\begin{center} + \ttfamily + l3sys-query \meta{cmd} [\meta{option(s)}] [\meta{args}] +\end{center} +where \texttt{\meta{cmd}} can be one of the following: +\begin{itemize}[noitemsep]\ttfamily + \item ls + \item ls \meta{args} + \item pwd +\end{itemize} +The \meta{cmd} are described below. The result of the \meta{cmd} will be printed +to the terminal in an interactive run; in normal usage, this will be piped to +the calling \TeX{} process. Results containing path separators \emph{always} +use~|/|, irrespective of the platform in use. + +As well as these targets, the script recognizes the options +\begin{itemize} + \item |--exclude| Specification for directory entries to exclude + \item |--ignore-case| Ignores case when sorting directory listings + \item |--pattern| (|-p|) Treat the \meta{args} as Lua patterns rather + than converting from wildcards + \item |--recursive| (|-r|) Enables recursive searching during directory + listings + \item |--reverse| Causes sorting to go from highest to lowest rather + than lowest to highest + \item |--sort| Sets the method used to sort entries returned by |ls| + \item |--type| Selects the type of entry returned by |ls| +\end{itemize} +The action of these options on the appropriate \meta{cmd(s)} is detailed below. + +\subsection{\texttt{ls [\meta{args}]}} + +Lists the contents of one or more directories, in a manner somewhat reminiscent +of the Unix command |ls| or the Windows command |dir|. The exact nature of the +output will depend on the \meta{args}, if given, along with the prevailing +options. Note that the options names are inspired by ideas from the Unix +commands |ls| and |find| as well as the Windows command |dir|: they therefore do +not map directly to those of any one of the command line tools that they +somewhat mirror. + +When no \meta{args} are given, all entries in the current directory will be +listed, one per line in the output. This will include both files and +subdirectories. Each entry will include a path relative to the current +directory: for files \emph{in} the current directory, this will be |./|. The +order of results will be determined by the underlying operating system process: +unless requested \emph{via} an option, no sorting takes place. + +As standard, the \meta{args} are treated as a file/path name potentially +including |?| and |*| as wildcards, for example |*.png| or |file?.txt|. +\begin{verbatim} + l3sys-query ls '*.png' +\end{verbatim} +Some care is needed in preventing expansion of such wildcards by the shell or +\texttt{texlua} process: these are detailed in Section~\ref{sec:wildcard}. In +this section, |'| is used to indicate a character being used to suppress +expansion: this is for example normal on macOS and Linux. + +Removal of entries from the listing can be achieved using the |--exclude| +option, which should be given with a \meta{xarg}, for example +\begin{verbatim} + l3sys-query ls --exclude '*.bak' 'graphics/*' +\end{verbatim} +Directory entries starting |.| are traditionally hidden on Linux and macOS +systems: these \enquote{dot} entries are excluded from the output of +\texttt{l3sys-query}. The entries |.| and |..| for the current and parent +directory are also excluded from the results returned by \texttt{l3sys-query} as +they can always be assumed. + +For more complex matching, the \meta{args} can be treated as a Lua pattern using +the |--pattern| (|-p|) option; this also applies to the \meta{xarg} argument to +the |--exclude| option. For example, the equivalent to wildcard |*.png| could be +obtained using +\begin{verbatim} + l3sys-query ls --pattern '^.*%.png$' +\end{verbatim} + +The results returned by |ls| can be sorted using the |--sort| option. This can +be set to |none| (use the order from the file system: the default), |name| (sort +by file name) or |date| (sort by date last modified). The sorting order can be +reversed using |--reverse|. Sorting normally takes account of case: this can be +suppressed with the |--ignore-case| option. + +The listing can be filtered based on the type of entry using the |--type| +option. This takes a string argument, one of |d| (directory) or |f| (file). + +As standard, only the path specified as part of the \meta{args} is queried. +However, if the |--recursive| (|-r|) option is set, the query is applied within +all subdirectories. Subdirectories starting with~|.| (macOS and Linux hidden) +are excluded from recursion. + +For security reasons, only paths within the current working directory can be +queried, this for example |graphics/*.png| will list all |png| files in the +|graphics| subdirectory, but |../graphics/*.png| will yield no output. + +\subsection{\texttt{pwd}} + +Returns the absolute path to the current working directory from which +\texttt{l3sys-query} is run. From within a \TeX{} run, this will (usually) be +the directory containing the main file, assuming a command such as +\begin{verbatim} + pdflatex main.tex +\end{verbatim} +The \texttt{pwd} command is unaffected by any options. + +\section{Spaces in arguments} + +Since \texttt{l3sys-query} is intended primarily for use with restricted shell +escape calls from \TeX{} processes, handling of spaces is unusual. It is not +possible to quote spaces in such a call, so for example whilst +\begin{verbatim} + l3sys-query ls "foo *" +\end{verbatim} +does work from the command prompt to find all files with names starting +\verb*|foo |, it would not work \emph{via} restricted shell escape. To +circumvent this, \texttt{l3sys-query} will collect all command line arguments +after any \meta{options}, and combine these as a space-separated \meta{args}, +for example allowing +\begin{verbatim} + l3sys-query ls foo '*' +\end{verbatim} +to achieve the same result as the first example. The result is that the +\meta{args} will only every be interpreted by \texttt{l3sys-query} as a single +argument. It also means that spaces cannot be used at the start or end of the +argument, nor can multiple spaces appear between non-space arguments. + +\section{Wildcard expansion handling\label{sec:wildcard}} + +The handling of wildcards needs some further comment for those using +\texttt{l3sys-query} from the command line: the \pkg{expl3} interface described +in Section~\ref{sec:expl3} handles this aspect automatically for the user. + +On macOS and Linux, the shell normally expands globs, which include the +wildcards |*| and |?|, before passing arguments to the appropriate command. +This can be suppressed by surrounding the argument with |'| characters, hence +the formulation +\begin{verbatim} + l3sys-query ls '*.png' +\end{verbatim} +earlier. + +On Windows, the shell does no expansion, and thus arguments are passed as-is to +the relevant command. As such, |'| has no special meaning here. However, to +allow quoting of wildcards from the shell in a platform-neutral manner, +\texttt{l3sys-query} will strip exactly one set of |'| characters around each +argument before further processing. + +It is not possible to use |"| quotes at all in the argument passed to +\texttt{l3sys-query} from \TeX{}, as the \TeX{} system removes all |"| in +|\input| while handling space quoting. + +Restricted shell escape prevents shell expansion of wildcards entirely. On +non-Windows systems, it does this by ensuring that each argument is |'| quoted +to ensure further expansion. Thus a \TeX{} call such as +\begin{verbatim} + \input|"l3sys-query ls '*.png'" +\end{verbatim} +will work if |--shell-escape| is used as the argument is passed directly to the +shell, but in restricted shell escape will give an error such as: +\begin{verbatim} +! I can't find file `"|l3sys-query ls '*.png'"'. +\end{verbatim} +The \LaTeX{} interfaces described below adust the quoting used depending on the +|shell-escape| status. + +\section{The \LaTeX{} interface\label{sec:expl3}} + +Using \texttt{l3sys-query} is not tied to access \emph{via} \pkg{expl3}, but +this is the preferred approach for the \LaTeX{} Team. Details of how to use +\texttt{l3sys-query} as an \pkg{expl3} programmer will covered in +\texttt{interface3.pdf} once the macro code is finalized. A document level +interface will also be provided via a \pkg{l3sys-query} package which is based +on the \pkg{expl3} interface and will be described here. + +\end{documentation} + +\PrintIndex + +\end{document} diff --git a/support/l3sys-query/l3sys-query.1 b/support/l3sys-query/l3sys-query.1 new file mode 100644 index 0000000000..146d0e4c2c --- /dev/null +++ b/support/l3sys-query/l3sys-query.1 @@ -0,0 +1,16 @@ +.TH L3SYS-QUERY 1 "2024-03-15" "LaTeX" + +.SH NAME +l3sys-query + +.SH SYNOPSIS + Usage l3sys-query <cmd> [<options>] [<args>] + +.SH DESCRIPTION + +The l3sys-query script provides a method for TeX runs to obtain system +information via shell escape to Lua. The facilities are more limited than the +similar Java script texosquery, but since it uses Lua, l3sys-query can be +used 'out of the box' with any install TeX system. The script is written taking +account of TeX Live security requirement; it is therefore suitable for use with +restricted shell escape, the standard setting when installing a TeX system. diff --git a/support/l3sys-query/l3sys-query.lua b/support/l3sys-query/l3sys-query.lua index a435e57aea..03e86296af 100644 --- a/support/l3sys-query/l3sys-query.lua +++ b/support/l3sys-query/l3sys-query.lua @@ -36,7 +36,7 @@ for those people who are interested. -- Details of the script itself, etc. -- local copyright = "Copyright (C) 2024 The LaTeX Project" -local release_date = "2024-03-14" +local release_date = "2024-03-15" local script_desc = "System queries for LaTeX using Lua\n" local script_name = "l3sys-query" @@ -566,4 +566,4 @@ if result then exit(0) else exit(1) -end
\ No newline at end of file +end diff --git a/support/pdfxup/README b/support/pdfxup/README index 05a36f5f4b..335ae71dd8 100644 --- a/support/pdfxup/README +++ b/support/pdfxup/README @@ -1,4 +1,4 @@ -PDFXUP -- v2.10 (2021/04/25) +PDFXUP -- v2.11 (2024/03/15) N. Markey <pdfxup@markey.fr> @@ -18,7 +18,7 @@ graphicx package) in order to produce the new document. -%% (c) 2021/04/25 Nicolas Markey <pdfxup at markey dot fr> +%% (c) 2024/03/15 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 diff --git a/support/pdfxup/RELEASES b/support/pdfxup/RELEASES index a9f1fedc6a..b6272603a3 100644 --- a/support/pdfxup/RELEASES +++ b/support/pdfxup/RELEASES @@ -58,7 +58,10 @@ v2.10 (2021/04/25) 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. + +v2.11 (2024/03/15) + - fixed a bug in testdim, which did not support fractional values + (bug reported by Walt Tuvell) diff --git a/support/pdfxup/lipics.xup b/support/pdfxup/lipics.xup new file mode 100644 index 0000000000..85217027e1 --- /dev/null +++ b/support/pdfxup/lipics.xup @@ -0,0 +1,2 @@ +## force bounding-box to default LIPICS values (with page numbers) +SET_BBOX="75 47 540 755" diff --git a/support/pdfxup/llncs.xup b/support/pdfxup/llncs.xup new file mode 100644 index 0000000000..968b26fa7b --- /dev/null +++ b/support/pdfxup/llncs.xup @@ -0,0 +1,2 @@ +## force bounding-box to default LNCS values (without page numbers) +SET_BBOX="134 126 482 677" diff --git a/support/pdfxup/pdfxup b/support/pdfxup/pdfxup index c53607b82a..d31db88f9e 100755 --- a/support/pdfxup/pdfxup +++ b/support/pdfxup/pdfxup @@ -2,12 +2,12 @@ shopt -s extglob shopt -s lastpipe -VERSION="2.10" -VDATE="2021/04/25" +VERSION="2.11" +VDATE="2024/03/15" ## see release notes at the end of this file. -## (c) 2021/04/25 Nicolas Markey <pdfxup at markey dot fr> +## (c) 2024/03/15 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 @@ -294,12 +294,21 @@ function testdim() { dim=$1; case $dim in - +([0-9])@(pt|in|cm|mm)) + ?(\.)+([0-9])@(pt|in|cm|mm)) ;; - +([0-9])) + +([0-9])\.*([0-9])@(pt|in|cm|mm)) + ;; + ?(\.)+([0-9])) + dim=${dim}pt + ;; + +([0-9])\.*([0-9])) dim=${dim}pt ;; - +([0-9])*) + ?(\.)+([0-9])[!\.0-9]*) + echo " illegal unit of measure in option '$3'; ignoring"; + dim=$2; + ;; + +([0-9])\.*([0-9])[!\.0-9]*) echo " illegal unit of measure in option '$3'; ignoring"; dim=$2; ;; @@ -307,7 +316,7 @@ function testdim() echo " not a valid dimension in option '$3'; ignoring"; dim=$2; ;; - esac + esac } ## sets variable $in to 1 if $1 is in list of ranges $2 @@ -1620,3 +1629,7 @@ v2.10 (2021/04/25) - 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. + +v2.11 (2024/03/15) + - fixed a bug in testdim, which did not support fractional values + (bug reported by Walt Tuvell) diff --git a/support/pdfxup/pdfxup-template.tex b/support/pdfxup/pdfxup-template.tex index 5f7bea843f..d96f5f22f8 100644 --- a/support/pdfxup/pdfxup-template.tex +++ b/support/pdfxup/pdfxup-template.tex @@ -1,25 +1,6 @@ -% -% 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.tex is not meant to be compiled alone. + {File pdfxup-template.pdf is not meant to be compiled alone. \MessageBreak It should only be used via the 'pdfxup' script.} \fi @@ -39,17 +20,17 @@ \newcounter{result}% \newif\iffound \def\@parserange#1-#2-#3\@end#4\@end{% - \c@result=#4\relax% - \ifnum\c@result=1\relax + \setcounter{result}{#4}% + \ifnum\value{result}=1\relax \foundtrue - \c@result=#1\relax% + \setcounter{result}{#1}% \else - \advance\c@result by -1\relax% + \addtocounter{result}{-1}% \ifx\relax#3\relax%% means that range contains no - \else - \advance\c@result by #1\relax% - \ifnum#2<\c@result\relax - \advance\c@result by -#2\relax% + \addtocounter{result}{#1}% + \ifnum#2<\value{result}\relax + \addtocounter{result}{-#2}% \else \foundtrue \fi @@ -59,7 +40,7 @@ \def\@parsecsl#1,#2\@end#3\@end{% \parserange{#3}{#1}% \iffound\else - \ifx\relax#2\relax\else\@parsecsl#2\@end\c@result\@end\fi\fi} + \ifx\relax#2\relax\else\@parsecsl#2\@end\value{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} @@ -68,35 +49,36 @@ %% - width and height of frame containing image (\hboxsize and \vboxsize) \newcounter{lastpage} \newcounter{outpage}%%% nr of pages of output document - \c@outpage=\pdfxupnbpages\relax - \advance\c@outpage by -1\relax + \setcounter{outpage}{\pdfxupnbpages} + \addtocounter{outpage}{-1} \divide\c@outpage by \pdfxupnbhoriz \divide\c@outpage by \pdfxupnbvert \ifbooklet - \divide\c@outpage by 2\relax + \divide\c@outpage by 2 \fi - \advance\c@outpage by 1\relax + \stepcounter{outpage} \ifbooklet - \multiply\c@outpage by 2\relax + \multiply\c@outpage by 2 \fi - \c@lastpage=\c@outpage\relax + \setcounter{lastpage}{\value{outpage}} \multiply\c@lastpage by \pdfxupnbhoriz \multiply\c@lastpage by \pdfxupnbvert + \makeatother % \newlength\outputvmargin \newlength\outputhmargin - \outputvmargin=\pdfxupvmargin\relax - \outputhmargin=\pdfxuphmargin\relax + \setlength\outputvmargin{\pdfxupvmargin} + \setlength\outputhmargin{\pdfxuphmargin} \newlength\innervmargin \newlength\innerhmargin - \innervmargin=\pdfxupinnervmargin\relax - \innerhmargin=\pdfxupinnerhmargin\relax + \setlength\innervmargin{\pdfxupinnervmargin} + \setlength\innerhmargin{\pdfxupinnerhmargin} \newlength\outputindivvmargin \newlength\outputindivhmargin - \outputindivvmargin=\pdfxupintermvspace\relax - \outputindivhmargin=\pdfxupintermhspace\relax + \setlength\outputindivvmargin{\pdfxupintermvspace} + \setlength\outputindivhmargin{\pdfxupintermhspace} % - \fboxrule=\pdfxupframewidth\relax + \setlength\fboxrule{\pdfxupframewidth} \fboxsep=-\fboxrule \newlength\hresult \newlength\vresult @@ -147,11 +129,11 @@ %% compute actual scale by which PDF is shrunk (or extended) \ifnum\pdfxupemptybb=0\relax \newcounter{origx} - \c@origx=\pdfxupw\relax - \advance\c@origx by -\pdfxupx\relax + \setcounter{origx}{\pdfxupw} + \addtocounter{origx}{-\pdfxupx} \newcounter{origy} - \c@origy=\pdfxuph\relax - \advance\c@origy by -\pdfxupy\relax + \setcounter{origy}{\pdfxuph} + \addtocounter{origy}{-\pdfxupy} \newlength\finalx \newlength\finaly \finalx=\hresult @@ -176,8 +158,9 @@ %\tracingoutput=1 %\tracingpages=1 %\tracingparagraphs=1 + \makeatletter \newcounter{curroutpage}%%%% counts pages nr of output document - \c@curroutpage=0\relax + \setcounter{curroutpage}{0}% \newcounter{currpage}%%%%%%% page nr of input document \newcounter{linecurrpage}%%% currpage at beginning of line \newcounter{currcol}% @@ -185,11 +168,11 @@ \newcounter{realout}% \newcounter{wmout}% \newcounter{wmoutaux}% - \@whilenum \c@outpage>\c@curroutpage \do% - {\advance\c@curroutpage by 1\relax% + \@whilenum \value{outpage}>\value{curroutpage} \do% + {\advance\c@curroutpage by 1% %% check if we are on last page, and if so, possibly balance last page \if0\balancelast\relax\else - \c@currpage=\c@curroutpage\relax% + \c@currpage=\c@curroutpage % \multiply\c@currpage by \pdfxupnbhoriz\relax% \multiply\c@currpage by \pdfxupnbvert\relax% \ifnum\c@currpage>\pdfxupnbpages\relax @@ -202,15 +185,15 @@ \advance\c@currpage by -1\relax \divide\c@currpage by \pdfxupnbvert\relax% \advance\c@currpage by 1\relax - \edef\horizincr{\thecurrpage}% - \edef\pdfxupnbcols{\thecurrpage}% + \edef\horizincr{\thecurrpage} + \edef\pdfxupnbcols{\thecurrpage} \else \advance\c@currpage by -1\relax \divide\c@currpage by \pdfxupnbhoriz\relax% \advance\c@currpage by 1\relax %\showthe\value{currpage} - \edef\vertincr{\thecurrpage}% - \edef\pdfxupnblines{\thecurrpage}% + \edef\vertincr{\thecurrpage} + \edef\pdfxupnblines{\thecurrpage} %\show\vertincr %\show\horizincr \fi @@ -218,52 +201,52 @@ \fi %% start producing page \c@currpage=\c@curroutpage% - \advance\c@currpage by -1\relax% - \multiply\c@currpage by \pdfxupnbhoriz\relax% - \multiply\c@currpage by \pdfxupnbvert\relax% + \advance\c@currpage by -1% + \multiply\c@currpage by \pdfxupnbhoriz% + \multiply\c@currpage by \pdfxupnbvert% \c@linecurrpage=\c@currpage% \hrule \@height\z@% - \c@currline=0\relax% + \c@currline=0% \vskip\outputvmargin% - \@whilenum\c@currline<\pdfxupnblines \do% + \@whilenum\value{currline}<\pdfxupnblines \do% {\hrule \@height\z@% - \ifnum\value{currline}>0\relax% + \ifnum\value{currline}>0% \vskip \outputindivvmargin% - \advance\c@linecurrpage by \horizincr\relax% + \advance\c@linecurrpage by \horizincr% \else% - \advance\c@linecurrpage by 1\relax% + \advance\c@linecurrpage by 1% \fi% - \advance\c@currline by 1\relax% - \c@currpage=\c@linecurrpage\relax% - \c@currcol=0\relax% + \stepcounter{currline}% + \c@currpage=\c@linecurrpage% + \c@currcol=0% \hskip \outputhmargin% - \@whilenum\c@currcol<\pdfxupnbcols \do% - {\ifnum\c@currcol>0\relax% + \@whilenum\value{currcol}<\pdfxupnbcols \do% + {\ifnum\value{currcol}>0% \hskip\outputindivhmargin% - \advance\c@currpage by \vertincr\relax% + \advance\c@currpage by \vertincr% \fi% - \advance\c@currcol by 1\relax% - \ifnum\c@currpage>\c@lastpage\else + \stepcounter{currcol}% + \ifnum\value{currpage}>\value{lastpage}\else %% computing page number corresponding to \currline and \currcol - \c@realout=\c@currpage% + \c@realout=\value{currpage}% \def\ang{0}% \ifbooklet \iflongedge %% long edge: %% 1->n, 2->1, 3->n-1 (rotated), 4->2(rotated)... - \ifodd\c@realout\relax% -> 1 or 3 - \advance\c@realout by -1\relax% + \ifodd\value{realout}% -> 1 or 3 + \addtocounter{realout}{-1}% \divide\c@realout by 2\relax - \ifodd\c@realout\relax% -> 3 + \ifodd\value{realout}% -> 3 \def\ang{180}% \else% -> 1 \fi - \c@realout=-\value{realout}\relax% - \advance\c@realout by \c@outpage\relax% - \advance\c@realout by \c@outpage\relax% + \setcounter{realout}{-\value{realout}}% + \addtocounter{realout}{\value{outpage}}% + \addtocounter{realout}{\value{outpage}}% \else% -> 2 or 4 \divide\c@realout by 2\relax - \ifodd\c@realout% -> 2 + \ifodd\value{realout}% -> 2 \else% -> 4 \def\ang{180}% \fi @@ -271,51 +254,51 @@ \else %% short edge: %% 1->n, 2->1, 3->2, 4->n-1, 5->n-2, 6->3, 7->4, 8->n-3 - \ifodd\c@realout\relax% -> 1 or 3 - \advance\c@realout by -1\relax% + \ifodd\value{realout}% -> 1 or 3 + \addtocounter{realout}{-1}% \divide\c@realout by 2\relax - \ifodd\c@realout% -> 3 - \advance\c@realout by 1\relax + \ifodd\value{realout}% -> 3 + \stepcounter{realout} \else% -> 1 - \c@realout=-\c@realout% - \advance\c@realout by \c@outpage\relax% - \advance\c@realout by \c@outpage\relax% + \setcounter{realout}{-\value{realout}}% + \addtocounter{realout}{\value{outpage}}% + \addtocounter{realout}{\value{outpage}}% \fi \else% -> 2 or 4 \divide\c@realout by 2\relax - \ifodd\c@realout\relax% -> 2 + \ifodd\value{realout}% -> 2 \else% -> 4 - \c@realout=-\c@realout\relax% - \advance\c@realout by 1\relax - \advance\c@realout by \c@outpage\relax% - \advance\c@realout by \c@outpage\relax% + \setcounter{realout}{-\value{realout}}% + \stepcounter{realout} + \addtocounter{realout}{\value{outpage}}% + \addtocounter{realout}{\value{outpage}}% \fi \fi \fi %% \iflongedge...\else \fi %% \ifbooklet - \ifnum\c@realout>\pdfxupnbpages\relax + \ifnum\value{realout}>\pdfxupnbpages\relax %% if page above nb of pages, output blank page %\hskip\hresult\hskip2\fboxrule \hskip\hboxsize \else %% otherwise compute corresponding page to display %% first keep realout for watermarking... - \c@wmoutaux=\c@realout\relax% - \c@wmout=\c@realout\relax% - \nthvalue{\c@realout}{\pdfxuppagelist}% - \iffound\c@realout=\c@result\relax% + \setcounter{wmoutaux}{\value{realout}}% + \setcounter{wmout}{\value{realout}}% + \nthvalue{\value{realout}}{\pdfxuppagelist}% + \iffound\setcounter{realout}{\value{result}}% \else %% hmmm... problem \message{I'm messed up counting pages...}% \fi %% compute watermarking page and display \ifx\pdfxupwatermark\@empty\else - \ifnum\pdfxupnbwp<\c@wmoutaux\relax - \advance\c@wmoutaux by -\pdfxupnbwp\relax% - \advance\c@wmoutaux by -1\relax% + \ifnum\pdfxupnbwp<\value{wmoutaux}\relax + \addtocounter{wmoutaux}{-\pdfxupnbwp}% + \addtocounter{wmoutaux}{-1}% \divide\c@wmoutaux by \pdfxupwperiod\relax - \advance\c@wmoutaux by 1\relax% + \stepcounter{wmoutaux}% \multiply\c@wmoutaux by \pdfxupwperiod\relax - \advance\c@wmout by -\c@wmoutaux% + \addtocounter{wmout}{-\value{wmoutaux}}% \fi \vbox to \vboxsize{\vfill \hbox to \hboxsize{\hfill diff --git a/support/pdfxup/pdfxup.1 b/support/pdfxup/pdfxup.1 index 75198b87fc..8ca0c2b394 100644 --- a/support/pdfxup/pdfxup.1 +++ b/support/pdfxup/pdfxup.1 @@ -1,6 +1,6 @@ .\" Manpage for pdfxup. .\" Contact pdfxup@markey.fr to correct errors or typos. -.TH man 1 "25 april 2021" "2.10" "pdfxup man page" +.TH man 1 "24 april 2021" "2.10" "pdfxup man page" .SH NAME pdfxup \- n-up tool with reduced margins .SH SYNOPSIS @@ -125,12 +125,20 @@ 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; +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. +is full. For instance: +.nf + --------- --------- +row-mode | 1 2 3 | column-mode | 1 4 7 | + | 4 5 6 | | 2 5 8 | + | 7 8 9 | | 3 6 9 | + --------- --------- + +.fi .TP \fB\-row\fR, \fB\-\-row-mode\fR, \fB\-\-horizontal\fR -fill in pages left to right (which is the default mode). +fill in pages left to right. .TP \fB\-bal\fR, \fB\-\-balance-last\fR balance last page: when using column mode, the pages are filled in from @@ -140,25 +148,15 @@ 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, no-balance | 1 2 3 | column, no-balance | 1 4 | + | 4 5 | | 2 5 | + | | | 3 | --------- --------- --------- --------- - 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 | | | + row, balance | 1 2 | column, balance | 1 3 5 | + | 3 4 | | 2 4 | + | 5 | | | --------- --------- .fi diff --git a/support/pdfxup/pdfxup.pdf b/support/pdfxup/pdfxup.pdf Binary files differindex d7b289a8a1..2c629a8b2e 100644 --- a/support/pdfxup/pdfxup.pdf +++ b/support/pdfxup/pdfxup.pdf |