texlive[71219] trunk: pdfjam (9may24)

commits+karl at tug.org commits+karl at tug.org
Thu May 9 21:24:35 CEST 2024


Revision: 71219
          https://tug.org/svn/texlive?view=revision&revision=71219
Author:   karl
Date:     2024-05-09 21:24:35 +0200 (Thu, 09 May 2024)
Log Message:
-----------
pdfjam (9may24)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/pdfjam/pdfjam
    trunk/Master/texmf-dist/doc/man/man1/pdfjam.man1.pdf
    trunk/Master/texmf-dist/doc/support/pdfjam/README.md
    trunk/Master/texmf-dist/doc/support/pdfjam/VERSION
    trunk/Master/texmf-dist/doc/support/pdfjam/tests.zip
    trunk/Master/texmf-dist/scripts/pdfjam/pdfjam

Modified: trunk/Build/source/texk/texlive/linked_scripts/pdfjam/pdfjam
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/pdfjam/pdfjam	2024-05-09 19:24:23 UTC (rev 71218)
+++ trunk/Build/source/texk/texlive/linked_scripts/pdfjam/pdfjam	2024-05-09 19:24:35 UTC (rev 71219)
@@ -1,11 +1,11 @@
 #!/bin/sh
-version=3.10
+version=3.11
 #########################################################################
 ##                                                                     ##
 ##  pdfjam: A shell-script interface to the "pdfpages" LaTeX package   ##
 ##  ------                                                             ##
 ##                                                                     ##
-##  Author: David Firth (http://warwick.ac.uk/dfirth)                  ##
+##  Author: David Firth (https://warwick.ac.uk/dfirth)                 ##
 ##                                                                     ##
 ##  Usage: see https://github.com/rrthomas/pdfjam                      ##
 ##         or "pdfjam --help"                                          ##
@@ -27,13 +27,255 @@
 ##                                                                     ##
 #########################################################################
 ##
+##  PRELIMINARIES
+##
+##  First determine:
+##    --- whether verbose commentary should be provided (not if --quiet 
+#         or --configpath was specified); 
+##    --- whether this call to pdfjam is a "batch" call; 
+##    --- whether just the help text is required; 
+##    --- or whether all configuration files should be ignored.
+##
+verbose=true
+for arg
+do
+    case $arg in
+	--quiet | -q | --configpath)
+	    verbose=false ;
+	    ;;
+	--version | -V)
+	    echo "$version"
+	    exit 0 ;
+	    ;;
+	--batch)
+	    batch=true ;
+	    ;;
+	--vanilla)
+	    vanilla=true ;
+	    ;;
+	*)
+	    ;;
+    esac
+done
+##
+##  Check to see whether this is a "secondary" call to pdfjam:
+##
+if test -z "$PDFJAM_CALL_NUMBER"  ## not a secondary call
+then
+    PDFJAM_CALL_NUMBER=0
+fi
+##
+##  Keep a copy of the internal file separator, so we can change it safely
+##
+OIFS="$IFS"
+##
+##  Record the full filename of the current working diractory
+##
+pwd=$(pwd)
+##
+##  Trap interrupts so that they kill everything:
+##
+trap 'IFS=$OIFS; exit 1' 1 2 15
+##
+##  The following will be useful for readability of the script:
+##
+newline='
+'
+##
+##  Define a function to escape tricky characters in file names etc:
+##
+escape_chars () {
+    (printf "%s" "${1}" | sed 's/[^a-zA-Z0-9._/\-]/\\&/g')
+}
+##
+##  Define a function to output verbose comments:
+##
+prattle () { ## second argument here is non-null for continuation lines
+    if test $verbose = true; then
+	prefix1="  pdfjam:" ;
+	prefix2=$(printf "%s" "$prefix1" | sed 's/pdfjam:/       /') ;
+	indent="" ;
+	if test "$PDFJAM_CALL_NUMBER" -gt 0  &&
+	    test "$batch" != true
+	then
+	    indent="    "
+	fi
+	IFS="$newline" ;
+	lineCounter=0 ;
+	for line in ${1}
+	do
+	    lineCounter=$((lineCounter + 1)) ;
+	    if  test $lineCounter -eq 1  &&  test ! -n "${2}" ;
+	    then 
+		if test -w "$PDFJAM_MESSAGES_FILE"
+		then printf "$prefix1$indent %s\n" "$line" >> \
+                       "$PDFJAM_MESSAGES_FILE"
+		else messages="$messages$prefix1$indent $line$newline"  
+                       ## msg file not made yet
+		fi
+	    else 
+		if test -w "$PDFJAM_MESSAGES_FILE"
+		then printf "$prefix2$indent %s\n" "$line" >> \
+                       "$PDFJAM_MESSAGES_FILE"
+		else messages="$messages$prefix2$indent $line$newline"  
+                       ## msg file not made yet
+		fi
+	    fi ;
+	done ;
+	IFS="$OIFS" ;
+    fi ;
+    return ;
+}
+##
+##  And here's the first piece of verbose commentary:
+##
+prattle "----" 1
+prattle "This is pdfjam version ${version}."
+##
+#########################################################################
+##
+##  CONFIGURATION
+##
+##  THESE SETTINGS WILL BE OVERRIDDEN by any found in configuration
+##  files.  By default such files are found at any or all of
+##     /etc/pdfjam.conf
+##     /usr/share/etc/pdfjam.conf
+##     /usr/local/share/pdfjam.conf
+##     /usr/local/etc/pdfjam.conf
+##     $HOME/.pdfjam.conf
+##  (And they are read in that order; if a setting is made more than
+##  once, the last instance prevails.)
+##
+##  An example configuration file can be found at
+##     https://github.com/rrthomas/pdfjam
+##
+##  The path searched for site-wide configuration files can be changed
+##  by editing the variable 'configpath' at the top of this file.
+##
+##
+##  First get the full path (if it exists) to pdflatex:
+##
+latex=$(command -v pdflatex)
+if [ -z "$latex" ] ; then latex="not found" ; fi
+##
+##  Likewise for the pdfinfo and iconv (only needed for `--keepinfo'):
+##
+pdfinfo=$(command -v pdfinfo)
+if [ -z "$pdfinfo" ] ; then pdfinfo="not found"; fi
+iconv=$(command -v iconv)
+if [ -z "$iconv" ] ; then iconv="not found"; fi
+##
+##
+##  Next a permitted location for temporary files on your system:
+##
+tempfileDir=${TMPDIR:-'/tmp'}  ##  /tmp is standard on most unix systems
+##
+##
+##  Default for the output file location:
+##
+outFile="$pwd"           ##  Output to the current working directory
+##
+##
+##  A few more default settings for pdfjam:
+##
+shortedge='true'           ## Default paper is rotated shortedge when doing book
+##
+runs=1                     ## Run latex just once
+##
+tidy='true'                ##  Delete all temporary files at the end
+##
+keepinfo='false'           ##  Don't try to preserve "pdfinfo" data
+##
+checkfiles='false'         ##  Don't use the Unix 'file -Lb' utility to
+##                           identify PDF files from their contents;
+##                           rely on the .pdf or .PDF extension instead.
+##
+suffix='pdfjam'            ##  Default filename suffix to be used when 
+##                           --outfile is either (a) a directory, or (b) 
+##                           not specified in a --batch call.
+##
+preamble=''                ##  Default LaTeX preamble string.
+##
+##  END OF SETTINGS MADE DIRECTLY WITHIN THE SCRIPT
+##
+##  Now read the site's or user's configuration file(s) if such exist,
+##  unless '--vanilla' was specified.
+##
+if test "$vanilla" != true
+then
+    if test "$PDFJAM_CALL_NUMBER" = 0   ## not a secondary call to pdfjam
+    then
+	configFiles=$(printf "%s" "$configpath" | \
+	    sed 's/:/\/pdfjam.conf:/g; s/$/\/pdfjam.conf/')
+	configFiles="${configFiles}:$HOME/.pdfjam.conf"
+	PDFJAM_CONFIG=""
+	prattle "Reading any site-wide or user-specific defaults..."
+	IFS=':'
+	for d in $configFiles
+	do
+	    if test -f "$d"; then
+		change=$(sed '/^ *#.*/d ; s/ *#.*//; s/^ *//' "$d")
+		comment="## ${newline}## From ${d}: ${newline}##"
+		PDFJAM_CONFIG="$PDFJAM_CONFIG$comment$newline$change$newline"
+	    fi
+	done
+	IFS="$OIFS"
+	PDFJAM_CONFIG=$(printf "%s" "$PDFJAM_CONFIG" | sed 's/^/    /')
+	if test "$batch" = true ; then export PDFJAM_CONFIG ; fi
+	if test -z "$PDFJAM_CONFIG"
+	then
+	    prattle "(none found)" 1
+	else
+	    prattle "$PDFJAM_CONFIG" 1
+	fi
+    fi
+    if test -n "$PDFJAM_CONFIG" ; then eval "$PDFJAM_CONFIG" ; fi
+else
+    if test $PDFJAM_CALL_NUMBER -eq 0
+    then
+	prattle "Called with '--vanilla': no user or site configuration"
+	prattle "files will be read." 1
+    fi
+fi
+## For backwards compatibility, check here for a $pdflatex setting in the config file
+if [ -n "${pdflatex:-}" ] ; then latex="$pdflatex" ; fi
+##
+##  If paper size is not set, get default paper size from libpaper >= 2 if
+##  possible, otherwise guess A4.
+##
+paperspec=
+if test -z "$paper"; then
+    if command -v paper >/dev/null ; then
+	paperspec=$(paper)
+	if echo "$paperspec" | grep -q '^.*: '; then
+	    paperdimensions=$(echo "$paperspec" | cut -f 2 -d " ")
+	    paperunit=$(echo "$paperspec" | cut -f 3 -d " ")
+	    if test "$paperunit" = "pt"; then paperunit=bp; fi
+	    paperwidth=$(echo "$paperdimensions" | cut -f 1 -d "x")
+	    paperheight=$(echo "$paperdimensions" | cut -f 2 -d "x")
+	    papersize="papersize={$paperwidth$paperunit,$paperheight$paperunit}"
+	    paper='' ## We might not have a LaTeX-compatible name
+	else
+	    echo "The 'paper' program seems not to be working; not using it"
+	fi
+    fi
+    if test -z "$paperspec"; then
+	paper='a4paper'  ## fallback paper size is ISO A4
+	papersize=''     ## clear papersize
+    fi
+fi
+##
+##  END OF CONFIGURATION BLOCK
+##
+#########################################################################
+##
 ##  HELP TEXT
 ##
 ##  Defines the output of 'pdfjam --help'
 ##
 helptext="
-pdfjam is a shell-script front end to the LaTeX 'pdfpages' package (for
-which, see http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages).
+pdfjam is a shell-script front end to the LaTeX 'pdfpages' package; see
+https://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages
 
 Usage: pdfjam [OPTIONS] [--] [FILE1 [SEL1]] [FILE2 [SEL2]]...
 where
@@ -118,8 +360,8 @@
                   LaTeX packages and/or to set global options.  If '--preamble'
                   is used more than once in the call, the supplied preamble 
                   strings are simply concatenated.  For a note on avoiding
-                  clashes, see the PDFjam-README file (also available at
-                  http://www.pdfjam.net).
+                  clashes, see the README file, also available at
+                  https://github.com/rrthomas/pdfjam
      --keepinfo
      --no-keepinfo
                   Preserve (or not) Title, Author, Subject and Keywords
@@ -155,11 +397,14 @@
                   A wide range of paper sizes is available thanks to the
                   LaTeX 'geometry' package.  For details see documentation
                   for LaTeX and/or the 'geometry' package.
+                  If no default value is set and libpaper is not available,
+                  A4 is used.
                   [Default for you at this site: paper=$paper]
      --papersize '{WIDTH,HEIGHT}'
                   Specify a custom paper size, e.g.,
                       --papersize '{10in,18cm}'
                   (Note the braces, and the comma!)
+                  [Libpaper default: $papersize]
      --pagecolor RGBSPEC
                   Specify a background colour for the output pages.  The 
                   RGBSPEC must be a comma-separated trio of integers
@@ -182,8 +427,7 @@
                   Run latex N times, for each output document made. 
                   [Default for you at this site: runs=$runs]
      --vanilla
-                  Suppress the reading of any site-wide or user-specific
-                  configuration files.
+                  Suppress the reading of any pdfjam configuration files.
      --enc
                   Specify a command-line encoding
                   [Default for you at this site: enc=$enc]
@@ -217,7 +461,7 @@
                                    only the content will be rotated.)
                   etc., etc.  For more information see the manual for
                   the 'pdfpages' package, at
-                  http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages
+                  https://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages
 * '--' can be used to signal that there are no more options to come.
 
 Defaults for the options '--suffix', '--keepinfo', '--paper', '--outfile', 
@@ -238,243 +482,23 @@
 ##  END OF HELP TEXT
 ##
 #########################################################################
-##
-##  PRELIMINARIES
-##
-##  First determine:
-##    --- whether verbose commentary should be provided (not if --quiet 
-#         or --configpath was specified); 
-##    --- whether this call to pdfjam is a "batch" call; 
-##    --- whether just the help text is required; 
-##    --- or whether all configuration files should be ignored.
-##
-verbose=true
+#
+# If --help is given, print help and exit. We do this here so that the
+# configuration files have already been read, and default values can be
+# shown in the help
 for arg
 do
     case $arg in
-	--quiet | -q | --configpath)
-	    verbose=false ;
-	    ;;
-	--version | -V)
-	    echo "$version"
-	    exit 0 ;
-	    ;;
-	--batch)
-	    batch=true ;
-	    ;;
 	--help | -u | -h)
 		printf "%s\n" "$helptext" ;
 		exit 0 ;
 	    ;;
-	--vanilla)
-	    vanilla=true ;
-	    ;;
 	*)
 	    ;;
     esac
 done
-##
-##  Check to see whether this is a "secondary" call to pdfjam:
-##
-if test -z "$PDFJAM_CALL_NUMBER"  ## not a secondary call
-then
-    PDFJAM_CALL_NUMBER=0
-fi
-##
-##  Keep a copy of the internal file separator, so we can change it safely
-##
-OIFS="$IFS"
-##
-##  Record the full filename of the current working diractory
-##
-pwd=$(pwd)
-##
-##  Trap interrupts so that they kill everything:
-##
-trap 'IFS=$OIFS; exit 1' 1 2 15
-##
-##  The following will be useful for readability of the script:
-##
-newline='
-'
-##
-##  Define a function to escape tricky characters in file names etc:
-##
-escape_chars () {
-    (printf "%s" "${1}" | sed 's/[^a-zA-Z0-9._/\-]/\\&/g')
-}
-##
-##  Define a function to output verbose comments:
-##
-prattle () { ## second argument here is non-null for continuation lines
-    if test $verbose = true; then
-	prefix1="  pdfjam:" ;
-	prefix2=$(printf "%s" "$prefix1" | sed 's/pdfjam:/       /') ;
-	indent="" ;
-	if test "$PDFJAM_CALL_NUMBER" -gt 0  &&
-	    test "$batch" != true
-	then
-	    indent="    "
-	fi
-	IFS="$newline" ;
-	lineCounter=0 ;
-	for line in ${1}
-	do
-	    lineCounter=$((lineCounter + 1)) ;
-	    if  test $lineCounter -eq 1  &&  test ! -n "${2}" ;
-	    then 
-		if test -w "$PDFJAM_MESSAGES_FILE"
-		then printf "$prefix1$indent %s\n" "$line" >> \
-                       "$PDFJAM_MESSAGES_FILE"
-		else messages="$messages$prefix1$indent $line$newline"  
-                       ## msg file not made yet
-		fi
-	    else 
-		if test -w "$PDFJAM_MESSAGES_FILE"
-		then printf "$prefix2$indent %s\n" "$line" >> \
-                       "$PDFJAM_MESSAGES_FILE"
-		else messages="$messages$prefix2$indent $line$newline"  
-                       ## msg file not made yet
-		fi
-	    fi ;
-	done ;
-	IFS="$OIFS" ;
-    fi ;
-    return ;
-}
-##
-##  And here's the first piece of verbose commentary:
-##
-prattle "----" 1
-prattle "This is pdfjam version ${version}."
-##
 #########################################################################
 ##
-##  CONFIGURATION
-##
-##  THESE SETTINGS WILL BE OVER-RIDDEN by any found in configuration
-##  files.  By default such files are found at any or all of
-##     /etc/pdfjam.conf
-##     /usr/share/etc/pdfjam.conf
-##     /usr/local/share/pdfjam.conf
-##     /usr/local/etc/pdfjam.conf
-##     $HOME/.pdfjam.conf
-##  (And they are read in that order; if a setting is made more than
-##  once, the last instance prevails.)
-##
-##  An example configuration file can be found at
-##     https://github.com/rrthomas/pdfjam
-##
-##  The path searched for site-wide configuration files can be changed
-##  by editing the variable 'configpath' at the top of this file.
-##
-##
-##  First get the full path (if it exists) to pdflatex:
-##
-latex=$(command -v pdflatex)
-if [ -z "$latex" ] ; then latex="not found" ; fi
-##
-##  Likewise for the pdfinfo and iconv (only needed for `--keepinfo'):
-##
-pdfinfo=$(command -v pdfinfo)
-if [ -z "$pdfinfo" ] ; then pdfinfo="not found"; fi
-iconv=$(command -v iconv)
-if [ -z "$iconv" ] ; then iconv="not found"; fi
-##
-##
-##  Next a permitted location for temporary files on your system:
-##
-tempfileDir=${TMPDIR:-'/tmp'}  ##  /tmp is standard on most unix systems
-##
-##
-##  Default for the output file location:
-##
-outFile="$pwd"           ##  Output to the current working directory
-##
-##
-##  A few more default settings for pdfjam:
-##
-shortedge='true'           ## Default paper is rotated shortedge when doing book
-##
-runs=1                     ## Run latex just once
-##
-tidy='true'                ##  Delete all temporary files at the end
-##
-keepinfo='false'           ##  Don't try to preserve "pdfinfo" data
-##
-checkfiles='false'         ##  Don't use the Unix 'file -Lb' utility to
-##                           identify PDF files from their contents;
-##                           rely on the .pdf or .PDF extension instead.
-##
-suffix='pdfjam'            ##  Default filename suffix to be used when 
-##                           --outfile is either (a) a directory, or (b) 
-##                           not specified in a --batch call.
-##
-preamble=''                ##  Default LaTeX preamble string.
-##
-##  Get default paper size from libpaper >= 2 if possible, otherwise guess A4
-##
-if command -v paper >/dev/null ; then
-    paperspec=$(paper)
-    paperdimensions=$(echo "$paperspec" | cut -f 2 -d " ")
-    paperunit=$(echo "$paperspec" | cut -f 3 -d " ")
-    if test "$paperunit" = "pt"; then paperunit=bp; fi
-    paperwidth=$(echo "$paperdimensions" | cut -f 1 -d "x")
-    paperheight=$(echo "$paperdimensions" | cut -f 2 -d "x")
-    papersize="papersize={$paperwidth$paperunit,$paperheight$paperunit}"
-    paper='' ## We might not have a LaTeX-compatible name
-else
-    paper='a4paper'  ## fallback paper size is ISO A4
-fi
-##
-##  END OF SETTINGS MADE DIRECTLY WITHIN THE SCRIPT
-##
-##  Now read the site's or user's configuration file(s) if such exist,
-##  unless '--vanilla' was specified.
-##
-if test "$vanilla" != true
-then
-    if test "$PDFJAM_CALL_NUMBER" = 0   ## not a secondary call to pdfjam
-    then
-	configFiles=$(printf "%s" "$configpath" | \
-	    sed 's/:/\/pdfjam.conf:/g; s/$/\/pdfjam.conf/')
-	configFiles="${configFiles}:$HOME/.pdfjam.conf"
-	PDFJAM_CONFIG=""
-	prattle "Reading any site-wide or user-specific defaults..."
-	IFS=':'
-	for d in $configFiles
-	do
-	    if test -f "$d"; then
-		change=$(sed '/^ *#.*/d ; s/ *#.*//; s/^ *//' "$d")
-		comment="## ${newline}## From ${d}: ${newline}##"
-		PDFJAM_CONFIG="$PDFJAM_CONFIG$comment$newline$change$newline"
-	    fi
-	done
-	IFS="$OIFS"
-	PDFJAM_CONFIG=$(printf "%s" "$PDFJAM_CONFIG" | sed 's/^/    /')
-	if test "$batch" = true ; then export PDFJAM_CONFIG ; fi
-	if test -z "$PDFJAM_CONFIG"
-	then
-	    prattle "(none found)" 1
-	else
-	    prattle "$PDFJAM_CONFIG" 1
-	fi
-    fi
-    if test -n "$PDFJAM_CONFIG" ; then eval "$PDFJAM_CONFIG" ; fi
-else
-    if test $PDFJAM_CALL_NUMBER -eq 0
-    then
-	prattle "Called with '--vanilla': no user or site configuration"
-	prattle "files will be read." 1
-    fi
-fi
-## For backwards compatibility, check here for a $pdflatex setting in the config file
-if [ -n "${pdflatex:-}" ] ; then latex="$pdflatex" ; fi
-##
-##  END OF CONFIGURATION BLOCK
-##
-#########################################################################
-##
 ##  ERROR CODES
 ##
 E_USAGE=64           #  command line usage error
@@ -660,6 +684,7 @@
 			shift ;;
 		    --paper)
 			paper="${2}"
+			papersize=''    ## clear papersize
 			callOptions="$callOptions ${1} ${2}" ;
 			shift ;;
 		    --pagecolor)
@@ -677,9 +702,11 @@
                         --ansidpaper | --ansiepaper | \
                         --letterpaper | --legalpaper | --executivepaper)
 			paper=$(printf "%s" "${1}" | sed 's/^--//') ;
+			papersize=''    ## clear papersize
 			callOptions="$callOptions ${1}" ;
 			;;
 		    --papersize)
+			paper=''        ## clear paper
 			papersize="papersize=${2}" ;
 			callOptions="$callOptions ${1} '${2}'" ;
 			shift ;;
@@ -832,7 +859,10 @@
 ##
 case $landscape in
     true)
-	orientation=landscape ;;
+	orientation=landscape
+	if test -n "$papersize"; then
+	    papersize="papersize={$paperheight$paperunit,$paperwidth$paperunit}"
+	fi ;;
     *)
 	orientation="" ;;
 esac

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

Modified: trunk/Master/texmf-dist/doc/support/pdfjam/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/pdfjam/README.md	2024-05-09 19:24:23 UTC (rev 71218)
+++ trunk/Master/texmf-dist/doc/support/pdfjam/README.md	2024-05-09 19:24:35 UTC (rev 71219)
@@ -26,7 +26,7 @@
 
 The **pdfjam** package makes available the `pdfjam` shell script that provides a 
 simple interface to much of the functionality of the excellent 
-[pdfpages](http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages) 
+[pdfpages](https://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages) 
 package (by Andreas Matthias) for _LaTeX_. The `pdfjam` script takes one 
 or more PDF files (and/or JPG/PNG graphics files) as input, and produces 
 one or more PDF files as output. It is useful for joining files together, 
@@ -37,7 +37,7 @@
 
 `pdfjam` is designed for Unix-like systems, including Linux and Mac OS X. 
 It seems that it will work also on Windows computers with a suitable 
-installation of [Cygwin](http://www.cygwin.com) (with TeX Live 
+installation of [Cygwin](https://www.cygwin.com) (with TeX Live 
 installed), but this has not been thoroughly tested.
 
 Alternatives to `pdfjam` which are widely packaged in GNU/Linux distributions and other free software collections include:
@@ -116,7 +116,7 @@
 documented there, `pdfjam` provides access to all of the options of the 
 **pdfpages** package: that's a large number of options, and it's a set of options 
 that might change, so users are referred to the current 
-[pdfpages manual (PDF)](http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages/pdfpages.pdf) to see what's available.
+[pdfpages manual (PDF)](https://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages/pdfpages.pdf) to see what's available.
 
 In case you want to look at the `pdfjam --help` text template online, for example
 before you decide whether to install **pdfjam**, the source is available at
@@ -215,7 +215,7 @@
 # <a name="using"></a> Using pdfjam
 
 For a full overview of what `pdfjam` can do, the importance of the 
-[pdfpages manual (PDF)](http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages/pdfpages.pdf) 
+[pdfpages manual (PDF)](https://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages/pdfpages.pdf) 
 cannot be stressed enough! 
 The following examples merely serve as a brief introduction.
 
@@ -315,7 +315,7 @@
 
 To offset the content of double-sided printed pages so that they are 
 suitable for binding with a 
-[Heftstreifen](http://de.wikipedia.org/wiki/Heftstreifen), use 
+[Heftstreifen](https://de.wikipedia.org/wiki/Heftstreifen), use 
 the `--twoside` option:
 
 ```

Modified: trunk/Master/texmf-dist/doc/support/pdfjam/VERSION
===================================================================
--- trunk/Master/texmf-dist/doc/support/pdfjam/VERSION	2024-05-09 19:24:23 UTC (rev 71218)
+++ trunk/Master/texmf-dist/doc/support/pdfjam/VERSION	2024-05-09 19:24:35 UTC (rev 71219)
@@ -1 +1 @@
-This is pdfjam 3.10
+This is pdfjam 3.11

Modified: trunk/Master/texmf-dist/doc/support/pdfjam/tests.zip
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/scripts/pdfjam/pdfjam
===================================================================
--- trunk/Master/texmf-dist/scripts/pdfjam/pdfjam	2024-05-09 19:24:23 UTC (rev 71218)
+++ trunk/Master/texmf-dist/scripts/pdfjam/pdfjam	2024-05-09 19:24:35 UTC (rev 71219)
@@ -1,11 +1,11 @@
 #!/bin/sh
-version=3.10
+version=3.11
 #########################################################################
 ##                                                                     ##
 ##  pdfjam: A shell-script interface to the "pdfpages" LaTeX package   ##
 ##  ------                                                             ##
 ##                                                                     ##
-##  Author: David Firth (http://warwick.ac.uk/dfirth)                  ##
+##  Author: David Firth (https://warwick.ac.uk/dfirth)                 ##
 ##                                                                     ##
 ##  Usage: see https://github.com/rrthomas/pdfjam                      ##
 ##         or "pdfjam --help"                                          ##
@@ -27,13 +27,255 @@
 ##                                                                     ##
 #########################################################################
 ##
+##  PRELIMINARIES
+##
+##  First determine:
+##    --- whether verbose commentary should be provided (not if --quiet 
+#         or --configpath was specified); 
+##    --- whether this call to pdfjam is a "batch" call; 
+##    --- whether just the help text is required; 
+##    --- or whether all configuration files should be ignored.
+##
+verbose=true
+for arg
+do
+    case $arg in
+	--quiet | -q | --configpath)
+	    verbose=false ;
+	    ;;
+	--version | -V)
+	    echo "$version"
+	    exit 0 ;
+	    ;;
+	--batch)
+	    batch=true ;
+	    ;;
+	--vanilla)
+	    vanilla=true ;
+	    ;;
+	*)
+	    ;;
+    esac
+done
+##
+##  Check to see whether this is a "secondary" call to pdfjam:
+##
+if test -z "$PDFJAM_CALL_NUMBER"  ## not a secondary call
+then
+    PDFJAM_CALL_NUMBER=0
+fi
+##
+##  Keep a copy of the internal file separator, so we can change it safely
+##
+OIFS="$IFS"
+##
+##  Record the full filename of the current working diractory
+##
+pwd=$(pwd)
+##
+##  Trap interrupts so that they kill everything:
+##
+trap 'IFS=$OIFS; exit 1' 1 2 15
+##
+##  The following will be useful for readability of the script:
+##
+newline='
+'
+##
+##  Define a function to escape tricky characters in file names etc:
+##
+escape_chars () {
+    (printf "%s" "${1}" | sed 's/[^a-zA-Z0-9._/\-]/\\&/g')
+}
+##
+##  Define a function to output verbose comments:
+##
+prattle () { ## second argument here is non-null for continuation lines
+    if test $verbose = true; then
+	prefix1="  pdfjam:" ;
+	prefix2=$(printf "%s" "$prefix1" | sed 's/pdfjam:/       /') ;
+	indent="" ;
+	if test "$PDFJAM_CALL_NUMBER" -gt 0  &&
+	    test "$batch" != true
+	then
+	    indent="    "
+	fi
+	IFS="$newline" ;
+	lineCounter=0 ;
+	for line in ${1}
+	do
+	    lineCounter=$((lineCounter + 1)) ;
+	    if  test $lineCounter -eq 1  &&  test ! -n "${2}" ;
+	    then 
+		if test -w "$PDFJAM_MESSAGES_FILE"
+		then printf "$prefix1$indent %s\n" "$line" >> \
+                       "$PDFJAM_MESSAGES_FILE"
+		else messages="$messages$prefix1$indent $line$newline"  
+                       ## msg file not made yet
+		fi
+	    else 
+		if test -w "$PDFJAM_MESSAGES_FILE"
+		then printf "$prefix2$indent %s\n" "$line" >> \
+                       "$PDFJAM_MESSAGES_FILE"
+		else messages="$messages$prefix2$indent $line$newline"  
+                       ## msg file not made yet
+		fi
+	    fi ;
+	done ;
+	IFS="$OIFS" ;
+    fi ;
+    return ;
+}
+##
+##  And here's the first piece of verbose commentary:
+##
+prattle "----" 1
+prattle "This is pdfjam version ${version}."
+##
+#########################################################################
+##
+##  CONFIGURATION
+##
+##  THESE SETTINGS WILL BE OVERRIDDEN by any found in configuration
+##  files.  By default such files are found at any or all of
+##     /etc/pdfjam.conf
+##     /usr/share/etc/pdfjam.conf
+##     /usr/local/share/pdfjam.conf
+##     /usr/local/etc/pdfjam.conf
+##     $HOME/.pdfjam.conf
+##  (And they are read in that order; if a setting is made more than
+##  once, the last instance prevails.)
+##
+##  An example configuration file can be found at
+##     https://github.com/rrthomas/pdfjam
+##
+##  The path searched for site-wide configuration files can be changed
+##  by editing the variable 'configpath' at the top of this file.
+##
+##
+##  First get the full path (if it exists) to pdflatex:
+##
+latex=$(command -v pdflatex)
+if [ -z "$latex" ] ; then latex="not found" ; fi
+##
+##  Likewise for the pdfinfo and iconv (only needed for `--keepinfo'):
+##
+pdfinfo=$(command -v pdfinfo)
+if [ -z "$pdfinfo" ] ; then pdfinfo="not found"; fi
+iconv=$(command -v iconv)
+if [ -z "$iconv" ] ; then iconv="not found"; fi
+##
+##
+##  Next a permitted location for temporary files on your system:
+##
+tempfileDir=${TMPDIR:-'/tmp'}  ##  /tmp is standard on most unix systems
+##
+##
+##  Default for the output file location:
+##
+outFile="$pwd"           ##  Output to the current working directory
+##
+##
+##  A few more default settings for pdfjam:
+##
+shortedge='true'           ## Default paper is rotated shortedge when doing book
+##
+runs=1                     ## Run latex just once
+##
+tidy='true'                ##  Delete all temporary files at the end
+##
+keepinfo='false'           ##  Don't try to preserve "pdfinfo" data
+##
+checkfiles='false'         ##  Don't use the Unix 'file -Lb' utility to
+##                           identify PDF files from their contents;
+##                           rely on the .pdf or .PDF extension instead.
+##
+suffix='pdfjam'            ##  Default filename suffix to be used when 
+##                           --outfile is either (a) a directory, or (b) 
+##                           not specified in a --batch call.
+##
+preamble=''                ##  Default LaTeX preamble string.
+##
+##  END OF SETTINGS MADE DIRECTLY WITHIN THE SCRIPT
+##
+##  Now read the site's or user's configuration file(s) if such exist,
+##  unless '--vanilla' was specified.
+##
+if test "$vanilla" != true
+then
+    if test "$PDFJAM_CALL_NUMBER" = 0   ## not a secondary call to pdfjam
+    then
+	configFiles=$(printf "%s" "$configpath" | \
+	    sed 's/:/\/pdfjam.conf:/g; s/$/\/pdfjam.conf/')
+	configFiles="${configFiles}:$HOME/.pdfjam.conf"
+	PDFJAM_CONFIG=""
+	prattle "Reading any site-wide or user-specific defaults..."
+	IFS=':'
+	for d in $configFiles
+	do
+	    if test -f "$d"; then
+		change=$(sed '/^ *#.*/d ; s/ *#.*//; s/^ *//' "$d")
+		comment="## ${newline}## From ${d}: ${newline}##"
+		PDFJAM_CONFIG="$PDFJAM_CONFIG$comment$newline$change$newline"
+	    fi
+	done
+	IFS="$OIFS"
+	PDFJAM_CONFIG=$(printf "%s" "$PDFJAM_CONFIG" | sed 's/^/    /')
+	if test "$batch" = true ; then export PDFJAM_CONFIG ; fi
+	if test -z "$PDFJAM_CONFIG"
+	then
+	    prattle "(none found)" 1
+	else
+	    prattle "$PDFJAM_CONFIG" 1
+	fi
+    fi
+    if test -n "$PDFJAM_CONFIG" ; then eval "$PDFJAM_CONFIG" ; fi
+else
+    if test $PDFJAM_CALL_NUMBER -eq 0
+    then
+	prattle "Called with '--vanilla': no user or site configuration"
+	prattle "files will be read." 1
+    fi
+fi
+## For backwards compatibility, check here for a $pdflatex setting in the config file
+if [ -n "${pdflatex:-}" ] ; then latex="$pdflatex" ; fi
+##
+##  If paper size is not set, get default paper size from libpaper >= 2 if
+##  possible, otherwise guess A4.
+##
+paperspec=
+if test -z "$paper"; then
+    if command -v paper >/dev/null ; then
+	paperspec=$(paper)
+	if echo "$paperspec" | grep -q '^.*: '; then
+	    paperdimensions=$(echo "$paperspec" | cut -f 2 -d " ")
+	    paperunit=$(echo "$paperspec" | cut -f 3 -d " ")
+	    if test "$paperunit" = "pt"; then paperunit=bp; fi
+	    paperwidth=$(echo "$paperdimensions" | cut -f 1 -d "x")
+	    paperheight=$(echo "$paperdimensions" | cut -f 2 -d "x")
+	    papersize="papersize={$paperwidth$paperunit,$paperheight$paperunit}"
+	    paper='' ## We might not have a LaTeX-compatible name
+	else
+	    echo "The 'paper' program seems not to be working; not using it"
+	fi
+    fi
+    if test -z "$paperspec"; then
+	paper='a4paper'  ## fallback paper size is ISO A4
+	papersize=''     ## clear papersize
+    fi
+fi
+##
+##  END OF CONFIGURATION BLOCK
+##
+#########################################################################
+##
 ##  HELP TEXT
 ##
 ##  Defines the output of 'pdfjam --help'
 ##
 helptext="
-pdfjam is a shell-script front end to the LaTeX 'pdfpages' package (for
-which, see http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages).
+pdfjam is a shell-script front end to the LaTeX 'pdfpages' package; see
+https://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages
 
 Usage: pdfjam [OPTIONS] [--] [FILE1 [SEL1]] [FILE2 [SEL2]]...
 where
@@ -118,8 +360,8 @@
                   LaTeX packages and/or to set global options.  If '--preamble'
                   is used more than once in the call, the supplied preamble 
                   strings are simply concatenated.  For a note on avoiding
-                  clashes, see the PDFjam-README file (also available at
-                  http://www.pdfjam.net).
+                  clashes, see the README file, also available at
+                  https://github.com/rrthomas/pdfjam
      --keepinfo
      --no-keepinfo
                   Preserve (or not) Title, Author, Subject and Keywords
@@ -155,11 +397,14 @@
                   A wide range of paper sizes is available thanks to the
                   LaTeX 'geometry' package.  For details see documentation
                   for LaTeX and/or the 'geometry' package.
+                  If no default value is set and libpaper is not available,
+                  A4 is used.
                   [Default for you at this site: paper=$paper]
      --papersize '{WIDTH,HEIGHT}'
                   Specify a custom paper size, e.g.,
                       --papersize '{10in,18cm}'
                   (Note the braces, and the comma!)
+                  [Libpaper default: $papersize]
      --pagecolor RGBSPEC
                   Specify a background colour for the output pages.  The 
                   RGBSPEC must be a comma-separated trio of integers
@@ -182,8 +427,7 @@
                   Run latex N times, for each output document made. 
                   [Default for you at this site: runs=$runs]
      --vanilla
-                  Suppress the reading of any site-wide or user-specific
-                  configuration files.
+                  Suppress the reading of any pdfjam configuration files.
      --enc
                   Specify a command-line encoding
                   [Default for you at this site: enc=$enc]
@@ -217,7 +461,7 @@
                                    only the content will be rotated.)
                   etc., etc.  For more information see the manual for
                   the 'pdfpages' package, at
-                  http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages
+                  https://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages
 * '--' can be used to signal that there are no more options to come.
 
 Defaults for the options '--suffix', '--keepinfo', '--paper', '--outfile', 
@@ -238,243 +482,23 @@
 ##  END OF HELP TEXT
 ##
 #########################################################################
-##
-##  PRELIMINARIES
-##
-##  First determine:
-##    --- whether verbose commentary should be provided (not if --quiet 
-#         or --configpath was specified); 
-##    --- whether this call to pdfjam is a "batch" call; 
-##    --- whether just the help text is required; 
-##    --- or whether all configuration files should be ignored.
-##
-verbose=true
+#
+# If --help is given, print help and exit. We do this here so that the
+# configuration files have already been read, and default values can be
+# shown in the help
 for arg
 do
     case $arg in
-	--quiet | -q | --configpath)
-	    verbose=false ;
-	    ;;
-	--version | -V)
-	    echo "$version"
-	    exit 0 ;
-	    ;;
-	--batch)
-	    batch=true ;
-	    ;;
 	--help | -u | -h)
 		printf "%s\n" "$helptext" ;
 		exit 0 ;
 	    ;;
-	--vanilla)
-	    vanilla=true ;
-	    ;;
 	*)
 	    ;;
     esac
 done
-##
-##  Check to see whether this is a "secondary" call to pdfjam:
-##
-if test -z "$PDFJAM_CALL_NUMBER"  ## not a secondary call
-then
-    PDFJAM_CALL_NUMBER=0
-fi
-##
-##  Keep a copy of the internal file separator, so we can change it safely
-##
-OIFS="$IFS"
-##
-##  Record the full filename of the current working diractory
-##
-pwd=$(pwd)
-##
-##  Trap interrupts so that they kill everything:
-##
-trap 'IFS=$OIFS; exit 1' 1 2 15
-##
-##  The following will be useful for readability of the script:
-##
-newline='
-'
-##
-##  Define a function to escape tricky characters in file names etc:
-##
-escape_chars () {
-    (printf "%s" "${1}" | sed 's/[^a-zA-Z0-9._/\-]/\\&/g')
-}
-##
-##  Define a function to output verbose comments:
-##
-prattle () { ## second argument here is non-null for continuation lines
-    if test $verbose = true; then
-	prefix1="  pdfjam:" ;
-	prefix2=$(printf "%s" "$prefix1" | sed 's/pdfjam:/       /') ;
-	indent="" ;
-	if test "$PDFJAM_CALL_NUMBER" -gt 0  &&
-	    test "$batch" != true
-	then
-	    indent="    "
-	fi
-	IFS="$newline" ;
-	lineCounter=0 ;
-	for line in ${1}
-	do
-	    lineCounter=$((lineCounter + 1)) ;
-	    if  test $lineCounter -eq 1  &&  test ! -n "${2}" ;
-	    then 
-		if test -w "$PDFJAM_MESSAGES_FILE"
-		then printf "$prefix1$indent %s\n" "$line" >> \
-                       "$PDFJAM_MESSAGES_FILE"
-		else messages="$messages$prefix1$indent $line$newline"  
-                       ## msg file not made yet
-		fi
-	    else 
-		if test -w "$PDFJAM_MESSAGES_FILE"
-		then printf "$prefix2$indent %s\n" "$line" >> \
-                       "$PDFJAM_MESSAGES_FILE"
-		else messages="$messages$prefix2$indent $line$newline"  
-                       ## msg file not made yet
-		fi
-	    fi ;
-	done ;
-	IFS="$OIFS" ;
-    fi ;
-    return ;
-}
-##
-##  And here's the first piece of verbose commentary:
-##
-prattle "----" 1
-prattle "This is pdfjam version ${version}."
-##
 #########################################################################
 ##
-##  CONFIGURATION
-##
-##  THESE SETTINGS WILL BE OVER-RIDDEN by any found in configuration
-##  files.  By default such files are found at any or all of
-##     /etc/pdfjam.conf
-##     /usr/share/etc/pdfjam.conf
-##     /usr/local/share/pdfjam.conf
-##     /usr/local/etc/pdfjam.conf
-##     $HOME/.pdfjam.conf
-##  (And they are read in that order; if a setting is made more than
-##  once, the last instance prevails.)
-##
-##  An example configuration file can be found at
-##     https://github.com/rrthomas/pdfjam
-##
-##  The path searched for site-wide configuration files can be changed
-##  by editing the variable 'configpath' at the top of this file.
-##
-##
-##  First get the full path (if it exists) to pdflatex:
-##
-latex=$(command -v pdflatex)
-if [ -z "$latex" ] ; then latex="not found" ; fi
-##
-##  Likewise for the pdfinfo and iconv (only needed for `--keepinfo'):
-##
-pdfinfo=$(command -v pdfinfo)
-if [ -z "$pdfinfo" ] ; then pdfinfo="not found"; fi
-iconv=$(command -v iconv)
-if [ -z "$iconv" ] ; then iconv="not found"; fi
-##
-##
-##  Next a permitted location for temporary files on your system:
-##
-tempfileDir=${TMPDIR:-'/tmp'}  ##  /tmp is standard on most unix systems
-##
-##
-##  Default for the output file location:
-##
-outFile="$pwd"           ##  Output to the current working directory
-##
-##
-##  A few more default settings for pdfjam:
-##
-shortedge='true'           ## Default paper is rotated shortedge when doing book
-##
-runs=1                     ## Run latex just once
-##
-tidy='true'                ##  Delete all temporary files at the end
-##
-keepinfo='false'           ##  Don't try to preserve "pdfinfo" data
-##
-checkfiles='false'         ##  Don't use the Unix 'file -Lb' utility to
-##                           identify PDF files from their contents;
-##                           rely on the .pdf or .PDF extension instead.
-##
-suffix='pdfjam'            ##  Default filename suffix to be used when 
-##                           --outfile is either (a) a directory, or (b) 
-##                           not specified in a --batch call.
-##
-preamble=''                ##  Default LaTeX preamble string.
-##
-##  Get default paper size from libpaper >= 2 if possible, otherwise guess A4
-##
-if command -v paper >/dev/null ; then
-    paperspec=$(paper)
-    paperdimensions=$(echo "$paperspec" | cut -f 2 -d " ")
-    paperunit=$(echo "$paperspec" | cut -f 3 -d " ")
-    if test "$paperunit" = "pt"; then paperunit=bp; fi
-    paperwidth=$(echo "$paperdimensions" | cut -f 1 -d "x")
-    paperheight=$(echo "$paperdimensions" | cut -f 2 -d "x")
-    papersize="papersize={$paperwidth$paperunit,$paperheight$paperunit}"
-    paper='' ## We might not have a LaTeX-compatible name
-else
-    paper='a4paper'  ## fallback paper size is ISO A4
-fi
-##
-##  END OF SETTINGS MADE DIRECTLY WITHIN THE SCRIPT
-##
-##  Now read the site's or user's configuration file(s) if such exist,
-##  unless '--vanilla' was specified.
-##
-if test "$vanilla" != true
-then
-    if test "$PDFJAM_CALL_NUMBER" = 0   ## not a secondary call to pdfjam
-    then
-	configFiles=$(printf "%s" "$configpath" | \
-	    sed 's/:/\/pdfjam.conf:/g; s/$/\/pdfjam.conf/')
-	configFiles="${configFiles}:$HOME/.pdfjam.conf"
-	PDFJAM_CONFIG=""
-	prattle "Reading any site-wide or user-specific defaults..."
-	IFS=':'
-	for d in $configFiles
-	do
-	    if test -f "$d"; then
-		change=$(sed '/^ *#.*/d ; s/ *#.*//; s/^ *//' "$d")
-		comment="## ${newline}## From ${d}: ${newline}##"
-		PDFJAM_CONFIG="$PDFJAM_CONFIG$comment$newline$change$newline"
-	    fi
-	done
-	IFS="$OIFS"
-	PDFJAM_CONFIG=$(printf "%s" "$PDFJAM_CONFIG" | sed 's/^/    /')
-	if test "$batch" = true ; then export PDFJAM_CONFIG ; fi
-	if test -z "$PDFJAM_CONFIG"
-	then
-	    prattle "(none found)" 1
-	else
-	    prattle "$PDFJAM_CONFIG" 1
-	fi
-    fi
-    if test -n "$PDFJAM_CONFIG" ; then eval "$PDFJAM_CONFIG" ; fi
-else
-    if test $PDFJAM_CALL_NUMBER -eq 0
-    then
-	prattle "Called with '--vanilla': no user or site configuration"
-	prattle "files will be read." 1
-    fi
-fi
-## For backwards compatibility, check here for a $pdflatex setting in the config file
-if [ -n "${pdflatex:-}" ] ; then latex="$pdflatex" ; fi
-##
-##  END OF CONFIGURATION BLOCK
-##
-#########################################################################
-##
 ##  ERROR CODES
 ##
 E_USAGE=64           #  command line usage error
@@ -660,6 +684,7 @@
 			shift ;;
 		    --paper)
 			paper="${2}"
+			papersize=''    ## clear papersize
 			callOptions="$callOptions ${1} ${2}" ;
 			shift ;;
 		    --pagecolor)
@@ -677,9 +702,11 @@
                         --ansidpaper | --ansiepaper | \
                         --letterpaper | --legalpaper | --executivepaper)
 			paper=$(printf "%s" "${1}" | sed 's/^--//') ;
+			papersize=''    ## clear papersize
 			callOptions="$callOptions ${1}" ;
 			;;
 		    --papersize)
+			paper=''        ## clear paper
 			papersize="papersize=${2}" ;
 			callOptions="$callOptions ${1} '${2}'" ;
 			shift ;;
@@ -832,7 +859,10 @@
 ##
 case $landscape in
     true)
-	orientation=landscape ;;
+	orientation=landscape
+	if test -n "$papersize"; then
+	    papersize="papersize={$paperheight$paperunit,$paperwidth$paperunit}"
+	fi ;;
     *)
 	orientation="" ;;
 esac



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