texlive[65325] trunk: xput (19dec22)
commits+karl at tug.org
commits+karl at tug.org
Wed Dec 21 21:56:12 CET 2022
Revision: 65325
http://tug.org/svn/texlive?view=revision&revision=65325
Author: karl
Date: 2022-12-21 21:56:12 +0100 (Wed, 21 Dec 2022)
Log Message:
-----------
xput (19dec22)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/Makefile.am
trunk/Build/source/texk/texlive/linked_scripts/Makefile.in
trunk/Build/source/texk/texlive/linked_scripts/scripts.lst
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/libexec/ctan2tds
trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
Added Paths:
-----------
trunk/Build/source/texk/texlive/linked_scripts/xput/
trunk/Build/source/texk/texlive/linked_scripts/xput/xputserver
trunk/Master/bin/aarch64-linux/xputserver
trunk/Master/bin/amd64-freebsd/xputserver
trunk/Master/bin/amd64-netbsd/xputserver
trunk/Master/bin/armhf-linux/xputserver
trunk/Master/bin/i386-cygwin/xputserver
trunk/Master/bin/i386-freebsd/xputserver
trunk/Master/bin/i386-linux/xputserver
trunk/Master/bin/i386-netbsd/xputserver
trunk/Master/bin/i386-solaris/xputserver
trunk/Master/bin/universal-darwin/xputserver
trunk/Master/bin/x86_64-cygwin/xputserver
trunk/Master/bin/x86_64-darwinlegacy/xputserver
trunk/Master/bin/x86_64-linux/xputserver
trunk/Master/bin/x86_64-linuxmusl/xputserver
trunk/Master/bin/x86_64-solaris/xputserver
trunk/Master/texmf-dist/doc/latex/xput/
trunk/Master/texmf-dist/doc/latex/xput/1x1.pdf
trunk/Master/texmf-dist/doc/latex/xput/2x1.pdf
trunk/Master/texmf-dist/doc/latex/xput/3x2.pdf
trunk/Master/texmf-dist/doc/latex/xput/LICENSE.txt
trunk/Master/texmf-dist/doc/latex/xput/README.md
trunk/Master/texmf-dist/doc/latex/xput/example-book.pdf
trunk/Master/texmf-dist/doc/latex/xput/example-book.tex
trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.pdf
trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.tex
trunk/Master/texmf-dist/doc/latex/xput/example-graphic.pdf
trunk/Master/texmf-dist/doc/latex/xput/example-graphic.tex
trunk/Master/texmf-dist/doc/latex/xput/example-grid.pdf
trunk/Master/texmf-dist/doc/latex/xput/example-grid.tex
trunk/Master/texmf-dist/doc/latex/xput/example-template.pdf
trunk/Master/texmf-dist/doc/latex/xput/example-template.tex
trunk/Master/texmf-dist/doc/latex/xput/example-text.pdf
trunk/Master/texmf-dist/doc/latex/xput/example-text.tex
trunk/Master/texmf-dist/doc/latex/xput/koepi.jpg
trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.pdf
trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.tex
trunk/Master/texmf-dist/doc/latex/xput/xputmanual.pdf
trunk/Master/texmf-dist/doc/latex/xput/xputmanual.tex
trunk/Master/texmf-dist/scripts/xput/
trunk/Master/texmf-dist/scripts/xput/xput
trunk/Master/texmf-dist/scripts/xput/xputserver
trunk/Master/texmf-dist/tex/latex/xput/
trunk/Master/texmf-dist/tex/latex/xput/xput.cls
trunk/Master/tlpkg/tlpsrc/xput.tlpsrc
Modified: trunk/Build/source/texk/texlive/linked_scripts/Makefile.am
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/Makefile.am 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Build/source/texk/texlive/linked_scripts/Makefile.am 2022-12-21 20:56:12 UTC (rev 65325)
@@ -98,7 +98,8 @@
texosquery/texosquery-jre8.sh \
tikztosvg/tikztosvg \
typeoutfileinfo/typeoutfileinfo.sh \
- wordcount/wordcount.sh
+ wordcount/wordcount.sh \
+ xput/xputserver
texmf_other_scripts = \
a2ping/a2ping.pl \
Modified: trunk/Build/source/texk/texlive/linked_scripts/Makefile.in
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/Makefile.in 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Build/source/texk/texlive/linked_scripts/Makefile.in 2022-12-21 20:56:12 UTC (rev 65325)
@@ -312,7 +312,8 @@
texosquery/texosquery-jre8.sh \
tikztosvg/tikztosvg \
typeoutfileinfo/typeoutfileinfo.sh \
- wordcount/wordcount.sh
+ wordcount/wordcount.sh \
+ xput/xputserver
texmf_other_scripts = \
a2ping/a2ping.pl \
Modified: trunk/Build/source/texk/texlive/linked_scripts/scripts.lst
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/scripts.lst 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Build/source/texk/texlive/linked_scripts/scripts.lst 2022-12-21 20:56:12 UTC (rev 65325)
@@ -40,6 +40,7 @@
tikztosvg/tikztosvg
typeoutfileinfo/typeoutfileinfo.sh
wordcount/wordcount.sh
+xput/xputserver
a2ping/a2ping.pl
accfonts/mkt1font
accfonts/vpl2ovp
Added: trunk/Build/source/texk/texlive/linked_scripts/xput/xputserver
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/xput/xputserver (rev 0)
+++ trunk/Build/source/texk/texlive/linked_scripts/xput/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,338 @@
+#!/bin/sh
+#
+# Copyright (C) 2022 by Friedemann Bartels
+#
+# This file may be distributed and/or modified under the
+# conditions of the LaTeX Project Public License, either
+# version 1.3c 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.3c or later is part of all distributions of
+# LaTeX version 2008/05/04 or later.
+#
+
+_convert() {
+ turbo=$1
+ filename=$2
+ filenamecache=$3
+ fileextcache=$4
+ originalwidthsp=$5
+ originalheightsp=$6
+ originalcropleftsp=$7
+ originalcroprightsp=$8
+ originalcroptopsp=$9
+ originalcropbottomsp=${10}
+ density=${11}
+ displaywidth=${12}
+ displayheight=${13}
+ resizethreshold=${14}
+ unsharp=${15}
+ quality="${16}"
+
+ mkdir -p cache/"$filenamecache"
+ originalwidth=$( magick identify -ping -format %w "$filename" )
+ originalheight=$( magick identify -ping -format %h "$filename" )
+ width=$(( (10 * originalwidth * (originalwidthsp - originalcropleftsp - originalcroprightsp) / originalwidthsp + 5) / 10 ))
+ height=$(( (10 * originalheight * (originalheightsp - originalcroptopsp - originalcropbottomsp) / originalheightsp + 5) / 10 ))
+ cropleft=$(( (10 * originalwidth * originalcropleftsp / originalwidthsp + 5) / 10 ))
+ croptop=$(( (10 * originalheight * originalcroptopsp / originalheightsp + 5) / 10 ))
+ resizewidth=$(( (10 * displaywidth * 100 * density / 473628672 + 5) / 10 ))
+ if [ $(( resizewidth * resizethreshold / 100 )) -gt $width ]; then
+ resizewidth=$width
+ resizeheight=$height
+ else
+ resizeheight=$(( resizewidth * height / width + 1 ))
+ fi
+
+ x="x"
+ if [ $turbo = 1 ]; then
+ export MAGICK_THREAD_LIMIT=1
+ fi
+ if [ "$quality" != "" ]; then
+ quality="-quality $quality"
+ fi
+ if [ "$unsharp" != "" ]; then
+ unsharp="-unsharp $unsharp"
+ fi
+
+ magick "$filename" -crop $width$x$height+$cropleft+$croptop -resize $resizewidth$x$resizeheight $unsharp $quality "cache/$filenamecache/.g$fileextcache"
+ mv "cache/$filenamecache/.g$fileextcache" "cache/$filenamecache/g$fileextcache"
+}
+
+_startbatchprocess() {
+ success=0
+ for file in cache/*; do
+ if [ -f "$file" ]; then
+ success=1
+ name=$( basename "${file}" )
+ mv "$file" "cache/.$name" 2> /dev/null
+ if [ $? -eq 0 ]; then
+ line=$(head -n 1 "cache/.$name")
+
+ IFS="%"
+ set -- $line
+ IFS=" "
+ _convert 1 "$@"
+
+ rm "cache/.$name"
+ break
+ fi
+ fi
+ done
+
+ if [ $success -eq 1 ]; then
+ _startbatchprocess
+ fi
+}
+
+getwidth() {
+ if command -v magick >/dev/null 2>&1; then
+ filename=$1
+
+ originalwidth=$( magick identify -ping -format %w "$filename" )
+ echo $originalwidth
+ else
+ echo errormagicknotinstalled
+ fi
+}
+
+optimize() {
+ if command -v magick >/dev/null 2>&1; then
+ filenamecache=$2
+ fileextcache=$3
+
+ if [ -f cache/"$filenamecache" ]; then
+ mv cache/"$filenamecache" cache/."$filenamecache" 2> /dev/null
+ if [ $? -eq 0 ]; then
+ line=$(head -n 1 "cache/.$filenamecache")
+
+ IFS="%"
+ set -- $line
+ IFS=" "
+ _convert 1 "$@"
+
+ rm "cache/.$filenamecache"
+ else
+ while [ ! -f cache/"$filenamecache"/g"$fileextcache" ]; do
+ sleep 0.05
+ done
+ fi
+ elif [ -d cache/"$filenamecache" ]; then
+ while [ ! -f cache/"$filenamecache"/g"$fileextcache" ]; do
+ sleep 0.05
+ done
+ else
+ _convert 0 "$@"
+ fi
+
+ echo ok
+ else
+ echo errormagicknotinstalled
+ fi
+}
+
+makeshadow() {
+ if command -v magick >/dev/null 2>&1; then
+ filename=$1
+ stdDeviation=$2
+ opacity=$3
+ fill=$4
+ width=$5
+ height=$6
+ framewidth=$7
+ frameheight=$8
+ frameborder=$9
+ frameradius=${10}
+
+ [ ! -d cache ] && mkdir cache
+ mkdir -p cache/$filename
+ echo "<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+ <svg
+ width='$width'
+ height='$height'
+ version='1.1'
+ xmlns='http://www.w3.org/2000/svg'
+ xmlns:svg='http://www.w3.org/2000/svg'>
+ <defs>
+ <filter
+ style='color-interpolation-filters:sRGB'
+ id='blur'
+ x='-4'
+ y='-4'
+ width='8'
+ height='8'>
+ <feGaussianBlur
+ stdDeviation='$stdDeviation' />
+ </filter>
+ </defs>
+ <rect
+ style='filter:url(#blur);opacity:$opacity;fill:$fill'
+ width='$framewidth'
+ height='$frameheight'
+ x='$frameborder'
+ y='$frameborder'
+ rx='$frameradius'
+ ry='$frameradius' />
+ </svg>
+ " > cache/$filename/s.svg
+ inkscape cache/$filename/s.svg --export-dpi=600 --export-filename cache/$filename/s.pdf
+ rm cache/$filename/s.svg
+
+ echo ok
+ else
+ echo errorinkscapenotinstalled
+ fi
+}
+
+import() {
+ if [ -d import ]; then
+ importdir=import
+ elif [ "$XPUT_IMPORT_DIRECTORY" != "" ]; then
+ if [ -d "$XPUT_IMPORT_DIRECTORY" ]; then
+ importdir="$XPUT_IMPORT_DIRECTORY"
+ else
+ echo $XPUT_IMPORT_DIRECTORY
+ exit
+ fi
+ else
+ echo errornoimportdir
+ exit
+ fi
+
+ defaultdirectory=$( echo $1 | sed -e 's/^{//g' | sed -e 's/}{.*//g' )
+ directorylist=$( echo $1 | sed -e 's/^{//g' | sed -e 's/}$//g' | sed -e 's/}{/$/g' )
+
+ for entry in "$importdir"/*.*
+ do
+ if [ -f "$entry" ]; then
+ name=$( basename "${entry}" )
+ if [ "$directorylist" != "" ]; then
+ echo "$directorylist" | tr '$' '\n' | while read directory; do
+ if [ -f "$directory$name" ]; then
+ mv "$entry" "$directory"
+ fi
+ done
+ fi
+ if [ -f "$entry" ]; then
+ if [ -d "$defaultdirectory" ]; then
+ mv "$entry" "$defaultdirectory"
+ else
+ mv "$entry" .
+ fi
+ fi
+ cachename=$( echo "$name" | sed -e 's/\.[a-zA-Z]*$//g' )
+ rm -rf cache/"$cachename"*
+ fi
+ done
+}
+
+startturbo() {
+ file=$1
+ if [ -f $file.tex ]; then
+ tmpdir=$( mktemp -d 2>/dev/null )/xputturbo$( date "+%Y%m%d%H%M%S" )$RANDOM
+ mkdir $tmpdir
+
+ cp $file.tex $tmpdir/xputturbobatchoptimizexyz.tex
+
+ engine=$(echo $(ps -p $PPID -o command | sed -e 's/[A-Z]//g'| sed -e 's/ .*//g' | tr -d '\n'))
+ if [ "$engine" = "xelatex" ]; then
+ nopdf="-no-pdf"
+ fi
+ $engine -interaction=batchmode $nopdf --output-directory $tmpdir $tmpdir/xputturbobatchoptimizexyz.tex > /dev/null
+
+ rm -rf $tmpdir
+ fi
+}
+
+batchoptimize() {
+ [ ! -d cache ] && mkdir cache
+
+ length=$(( $# / 15 ))
+ cores=$( nproc )
+ [ $cores -gt $length ] && cores=$length
+
+ while [ $length -gt 0 ]; do
+ filenamecache="$2"
+
+ if [ ! -e cache/"$filenamecache" ]; then
+ index=0
+ while [ $index -lt 15 ]; do
+ if [ $index -eq 0 ]; then
+ item="$1"
+ else
+ item="$item%$1"
+ fi
+
+ shift
+ index=$(( index + 1 ))
+ done
+
+ echo $item > cache/"$filenamecache"
+ else
+ shift 15
+ fi
+
+ length=$(( length - 1 ))
+ done
+
+ cores=$(( cores - 1 ))
+ while [ $cores -gt 0 ]; do
+ _startbatchprocess &
+ sleep 0.01
+ cores=$(( cores - 1 ))
+ done
+}
+
+input=$( echo "$@" | sed -e 's/\\//g' | sed -e 's/ %/%/g' | sed -e 's/% /%/g' )
+IFS="%"
+set -- $input
+IFS=" "
+shift
+
+case "$1" in
+getwidth)
+ shift
+
+ getwidth "$1"
+ ;;
+optimize)
+ shift
+
+ optimize "$@"
+ ;;
+makeshadow)
+ shift
+
+ makeshadow "$@"
+ ;;
+start)
+ shift
+
+ if [ "$1" = "import" ]; then
+ shift
+
+ import "$1"
+
+ shift
+ fi
+
+ if [ "$1" = "turbo" ]; then
+ shift
+
+ startturbo "$1" &
+ fi
+
+ echo ok
+ ;;
+batchoptimize)
+ shift
+
+ batchoptimize "$@" &
+
+ echo ok
+ ;;
+*)
+ echo 🤖 Hi, I serve the Xput LaTeX class.
+esac
Property changes on: trunk/Build/source/texk/texlive/linked_scripts/xput/xputserver
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/aarch64-linux/xputserver
===================================================================
--- trunk/Master/bin/aarch64-linux/xputserver (rev 0)
+++ trunk/Master/bin/aarch64-linux/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/aarch64-linux/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/amd64-freebsd/xputserver
===================================================================
--- trunk/Master/bin/amd64-freebsd/xputserver (rev 0)
+++ trunk/Master/bin/amd64-freebsd/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/amd64-freebsd/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/amd64-netbsd/xputserver
===================================================================
--- trunk/Master/bin/amd64-netbsd/xputserver (rev 0)
+++ trunk/Master/bin/amd64-netbsd/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/amd64-netbsd/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/armhf-linux/xputserver
===================================================================
--- trunk/Master/bin/armhf-linux/xputserver (rev 0)
+++ trunk/Master/bin/armhf-linux/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/armhf-linux/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-cygwin/xputserver
===================================================================
--- trunk/Master/bin/i386-cygwin/xputserver (rev 0)
+++ trunk/Master/bin/i386-cygwin/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/i386-cygwin/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-freebsd/xputserver
===================================================================
--- trunk/Master/bin/i386-freebsd/xputserver (rev 0)
+++ trunk/Master/bin/i386-freebsd/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/i386-freebsd/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-linux/xputserver
===================================================================
--- trunk/Master/bin/i386-linux/xputserver (rev 0)
+++ trunk/Master/bin/i386-linux/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/i386-linux/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-netbsd/xputserver
===================================================================
--- trunk/Master/bin/i386-netbsd/xputserver (rev 0)
+++ trunk/Master/bin/i386-netbsd/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/i386-netbsd/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-solaris/xputserver
===================================================================
--- trunk/Master/bin/i386-solaris/xputserver (rev 0)
+++ trunk/Master/bin/i386-solaris/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/i386-solaris/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/universal-darwin/xputserver
===================================================================
--- trunk/Master/bin/universal-darwin/xputserver (rev 0)
+++ trunk/Master/bin/universal-darwin/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/universal-darwin/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-cygwin/xputserver
===================================================================
--- trunk/Master/bin/x86_64-cygwin/xputserver (rev 0)
+++ trunk/Master/bin/x86_64-cygwin/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/x86_64-cygwin/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-darwinlegacy/xputserver
===================================================================
--- trunk/Master/bin/x86_64-darwinlegacy/xputserver (rev 0)
+++ trunk/Master/bin/x86_64-darwinlegacy/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/x86_64-darwinlegacy/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-linux/xputserver
===================================================================
--- trunk/Master/bin/x86_64-linux/xputserver (rev 0)
+++ trunk/Master/bin/x86_64-linux/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/x86_64-linux/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-linuxmusl/xputserver
===================================================================
--- trunk/Master/bin/x86_64-linuxmusl/xputserver (rev 0)
+++ trunk/Master/bin/x86_64-linuxmusl/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/x86_64-linuxmusl/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-solaris/xputserver
===================================================================
--- trunk/Master/bin/x86_64-solaris/xputserver (rev 0)
+++ trunk/Master/bin/x86_64-solaris/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/xput/xputserver
\ No newline at end of file
Property changes on: trunk/Master/bin/x86_64-solaris/xputserver
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/1x1.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/1x1.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/1x1.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/1x1.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/1x1.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/2x1.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/2x1.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/2x1.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/2x1.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/2x1.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/3x2.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/3x2.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/3x2.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/3x2.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/3x2.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/LICENSE.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/LICENSE.txt (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/LICENSE.txt 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,416 @@
+The LaTeX Project Public License
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+LPPL Version 1.3c 2008-05-04
+
+Copyright 1999 2002-2008 LaTeX3 Project
+ Everyone is allowed to distribute verbatim copies of this
+ license document, but modification of it is not allowed.
+
+
+PREAMBLE
+========
+
+The LaTeX Project Public License (LPPL) is the primary license under
+which the LaTeX kernel and the base LaTeX packages are distributed.
+
+You may use this license for any work of which you hold the copyright
+and which you wish to distribute. This license may be particularly
+suitable if your work is TeX-related (such as a LaTeX package), but
+it is written in such a way that you can use it even if your work is
+unrelated to TeX.
+
+The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE',
+below, gives instructions, examples, and recommendations for authors
+who are considering distributing their works under this license.
+
+This license gives conditions under which a work may be distributed
+and modified, as well as conditions under which modified versions of
+that work may be distributed.
+
+We, the LaTeX3 Project, believe that the conditions below give you
+the freedom to make and distribute modified versions of your work
+that conform with whatever technical specifications you wish while
+maintaining the availability, integrity, and reliability of
+that work. If you do not see how to achieve your goal while
+meeting these conditions, then read the document `cfgguide.tex'
+and `modguide.tex' in the base LaTeX distribution for suggestions.
+
+
+DEFINITIONS
+===========
+
+In this license document the following terms are used:
+
+ `Work'
+ Any work being distributed under this License.
+
+ `Derived Work'
+ Any work that under any applicable law is derived from the Work.
+
+ `Modification'
+ Any procedure that produces a Derived Work under any applicable
+ law -- for example, the production of a file containing an
+ original file associated with the Work or a significant portion of
+ such a file, either verbatim or with modifications and/or
+ translated into another language.
+
+ `Modify'
+ To apply any procedure that produces a Derived Work under any
+ applicable law.
+
+ `Distribution'
+ Making copies of the Work available from one person to another, in
+ whole or in part. Distribution includes (but is not limited to)
+ making any electronic components of the Work accessible by
+ file transfer protocols such as FTP or HTTP or by shared file
+ systems such as Sun's Network File System (NFS).
+
+ `Compiled Work'
+ A version of the Work that has been processed into a form where it
+ is directly usable on a computer system. This processing may
+ include using installation facilities provided by the Work,
+ transformations of the Work, copying of components of the Work, or
+ other activities. Note that modification of any installation
+ facilities provided by the Work constitutes modification of the Work.
+
+ `Current Maintainer'
+ A person or persons nominated as such within the Work. If there is
+ no such explicit nomination then it is the `Copyright Holder' under
+ any applicable law.
+
+ `Base Interpreter'
+ A program or process that is normally needed for running or
+ interpreting a part or the whole of the Work.
+
+ A Base Interpreter may depend on external components but these
+ are not considered part of the Base Interpreter provided that each
+ external component clearly identifies itself whenever it is used
+ interactively. Unless explicitly specified when applying the
+ license to the Work, the only applicable Base Interpreter is a
+ `LaTeX-Format' or in the case of files belonging to the
+ `LaTeX-format' a program implementing the `TeX language'.
+
+
+
+CONDITIONS ON DISTRIBUTION AND MODIFICATION
+===========================================
+
+1. Activities other than distribution and/or modification of the Work
+are not covered by this license; they are outside its scope. In
+particular, the act of running the Work is not restricted and no
+requirements are made concerning any offers of support for the Work.
+
+2. You may distribute a complete, unmodified copy of the Work as you
+received it. Distribution of only part of the Work is considered
+modification of the Work, and no right to distribute such a Derived
+Work may be assumed under the terms of this clause.
+
+3. You may distribute a Compiled Work that has been generated from a
+complete, unmodified copy of the Work as distributed under Clause 2
+above, as long as that Compiled Work is distributed in such a way that
+the recipients may install the Compiled Work on their system exactly
+as it would have been installed if they generated a Compiled Work
+directly from the Work.
+
+4. If you are the Current Maintainer of the Work, you may, without
+restriction, modify the Work, thus creating a Derived Work. You may
+also distribute the Derived Work without restriction, including
+Compiled Works generated from the Derived Work. Derived Works
+distributed in this manner by the Current Maintainer are considered to
+be updated versions of the Work.
+
+5. If you are not the Current Maintainer of the Work, you may modify
+your copy of the Work, thus creating a Derived Work based on the Work,
+and compile this Derived Work, thus creating a Compiled Work based on
+the Derived Work.
+
+6. If you are not the Current Maintainer of the Work, you may
+distribute a Derived Work provided the following conditions are met
+for every component of the Work unless that component clearly states
+in the copyright notice that it is exempt from that condition. Only
+the Current Maintainer is allowed to add such statements of exemption
+to a component of the Work.
+
+ a. If a component of this Derived Work can be a direct replacement
+ for a component of the Work when that component is used with the
+ Base Interpreter, then, wherever this component of the Work
+ identifies itself to the user when used interactively with that
+ Base Interpreter, the replacement component of this Derived Work
+ clearly and unambiguously identifies itself as a modified version
+ of this component to the user when used interactively with that
+ Base Interpreter.
+
+ b. Every component of the Derived Work contains prominent notices
+ detailing the nature of the changes to that component, or a
+ prominent reference to another file that is distributed as part
+ of the Derived Work and that contains a complete and accurate log
+ of the changes.
+
+ c. No information in the Derived Work implies that any persons,
+ including (but not limited to) the authors of the original version
+ of the Work, provide any support, including (but not limited to)
+ the reporting and handling of errors, to recipients of the
+ Derived Work unless those persons have stated explicitly that
+ they do provide such support for the Derived Work.
+
+ d. You distribute at least one of the following with the Derived Work:
+
+ 1. A complete, unmodified copy of the Work;
+ if your distribution of a modified component is made by
+ offering access to copy the modified component from a
+ designated place, then offering equivalent access to copy
+ the Work from the same or some similar place meets this
+ condition, even though third parties are not compelled to
+ copy the Work along with the modified component;
+
+ 2. Information that is sufficient to obtain a complete,
+ unmodified copy of the Work.
+
+7. If you are not the Current Maintainer of the Work, you may
+distribute a Compiled Work generated from a Derived Work, as long as
+the Derived Work is distributed to all recipients of the Compiled
+Work, and as long as the conditions of Clause 6, above, are met with
+regard to the Derived Work.
+
+8. The conditions above are not intended to prohibit, and hence do not
+apply to, the modification, by any method, of any component so that it
+becomes identical to an updated version of that component of the Work as
+it is distributed by the Current Maintainer under Clause 4, above.
+
+9. Distribution of the Work or any Derived Work in an alternative
+format, where the Work or that Derived Work (in whole or in part) is
+then produced by applying some process to that format, does not relax or
+nullify any sections of this license as they pertain to the results of
+applying that process.
+
+10. a. A Derived Work may be distributed under a different license
+ provided that license itself honors the conditions listed in
+ Clause 6 above, in regard to the Work, though it does not have
+ to honor the rest of the conditions in this license.
+
+ b. If a Derived Work is distributed under a different license, that
+ Derived Work must provide sufficient documentation as part of
+ itself to allow each recipient of that Derived Work to honor the
+ restrictions in Clause 6 above, concerning changes from the Work.
+
+11. This license places no restrictions on works that are unrelated to
+the Work, nor does this license place any restrictions on aggregating
+such works with the Work by any means.
+
+12. Nothing in this license is intended to, or may be used to, prevent
+complete compliance by all parties with all applicable laws.
+
+
+NO WARRANTY
+===========
+
+There is no warranty for the Work. Except when otherwise stated in
+writing, the Copyright Holder provides the Work `as is', without
+warranty of any kind, either expressed or implied, including, but not
+limited to, the implied warranties of merchantability and fitness for a
+particular purpose. The entire risk as to the quality and performance
+of the Work is with you. Should the Work prove defective, you assume
+the cost of all necessary servicing, repair, or correction.
+
+In no event unless required by applicable law or agreed to in writing
+will The Copyright Holder, or any author named in the components of the
+Work, or any other party who may distribute and/or modify the Work as
+permitted above, be liable to you for damages, including any general,
+special, incidental or consequential damages arising out of any use of
+the Work or out of inability to use the Work (including, but not limited
+to, loss of data, data being rendered inaccurate, or losses sustained by
+anyone as a result of any failure of the Work to operate with any other
+programs), even if the Copyright Holder or said author or said other
+party has been advised of the possibility of such damages.
+
+
+MAINTENANCE OF THE WORK
+=======================
+
+The Work has the status `author-maintained' if the Copyright Holder
+explicitly and prominently states near the primary copyright notice in
+the Work that the Work can only be maintained by the Copyright Holder
+or simply that it is `author-maintained'.
+
+The Work has the status `maintained' if there is a Current Maintainer
+who has indicated in the Work that they are willing to receive error
+reports for the Work (for example, by supplying a valid e-mail
+address). It is not required for the Current Maintainer to acknowledge
+or act upon these error reports.
+
+The Work changes from status `maintained' to `unmaintained' if there
+is no Current Maintainer, or the person stated to be Current
+Maintainer of the work cannot be reached through the indicated means
+of communication for a period of six months, and there are no other
+significant signs of active maintenance.
+
+You can become the Current Maintainer of the Work by agreement with
+any existing Current Maintainer to take over this role.
+
+If the Work is unmaintained, you can become the Current Maintainer of
+the Work through the following steps:
+
+ 1. Make a reasonable attempt to trace the Current Maintainer (and
+ the Copyright Holder, if the two differ) through the means of
+ an Internet or similar search.
+
+ 2. If this search is successful, then enquire whether the Work
+ is still maintained.
+
+ a. If it is being maintained, then ask the Current Maintainer
+ to update their communication data within one month.
+
+ b. If the search is unsuccessful or no action to resume active
+ maintenance is taken by the Current Maintainer, then announce
+ within the pertinent community your intention to take over
+ maintenance. (If the Work is a LaTeX work, this could be
+ done, for example, by posting to comp.text.tex.)
+
+ 3a. If the Current Maintainer is reachable and agrees to pass
+ maintenance of the Work to you, then this takes effect
+ immediately upon announcement.
+
+ b. If the Current Maintainer is not reachable and the Copyright
+ Holder agrees that maintenance of the Work be passed to you,
+ then this takes effect immediately upon announcement.
+
+ 4. If you make an `intention announcement' as described in 2b. above
+ and after three months your intention is challenged neither by
+ the Current Maintainer nor by the Copyright Holder nor by other
+ people, then you may arrange for the Work to be changed so as
+ to name you as the (new) Current Maintainer.
+
+ 5. If the previously unreachable Current Maintainer becomes
+ reachable once more within three months of a change completed
+ under the terms of 3b) or 4), then that Current Maintainer must
+ become or remain the Current Maintainer upon request provided
+ they then update their communication data within one month.
+
+A change in the Current Maintainer does not, of itself, alter the fact
+that the Work is distributed under the LPPL license.
+
+If you become the Current Maintainer of the Work, you should
+immediately provide, within the Work, a prominent and unambiguous
+statement of your status as Current Maintainer. You should also
+announce your new status to the same pertinent community as
+in 2b) above.
+
+
+WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE
+======================================================
+
+This section contains important instructions, examples, and
+recommendations for authors who are considering distributing their
+works under this license. These authors are addressed as `you' in
+this section.
+
+Choosing This License or Another License
+----------------------------------------
+
+If for any part of your work you want or need to use *distribution*
+conditions that differ significantly from those in this license, then
+do not refer to this license anywhere in your work but, instead,
+distribute your work under a different license. You may use the text
+of this license as a model for your own license, but your license
+should not refer to the LPPL or otherwise give the impression that
+your work is distributed under the LPPL.
+
+The document `modguide.tex' in the base LaTeX distribution explains
+the motivation behind the conditions of this license. It explains,
+for example, why distributing LaTeX under the GNU General Public
+License (GPL) was considered inappropriate. Even if your work is
+unrelated to LaTeX, the discussion in `modguide.tex' may still be
+relevant, and authors intending to distribute their works under any
+license are encouraged to read it.
+
+A Recommendation on Modification Without Distribution
+-----------------------------------------------------
+
+It is wise never to modify a component of the Work, even for your own
+personal use, without also meeting the above conditions for
+distributing the modified component. While you might intend that such
+modifications will never be distributed, often this will happen by
+accident -- you may forget that you have modified that component; or
+it may not occur to you when allowing others to access the modified
+version that you are thus distributing it and violating the conditions
+of this license in ways that could have legal implications and, worse,
+cause problems for the community. It is therefore usually in your
+best interest to keep your copy of the Work identical with the public
+one. Many works provide ways to control the behavior of that work
+without altering any of its licensed components.
+
+How to Use This License
+-----------------------
+
+To use this license, place in each of the components of your work both
+an explicit copyright notice including your name and the year the work
+was authored and/or last substantially modified. Include also a
+statement that the distribution and/or modification of that
+component is constrained by the conditions in this license.
+
+Here is an example of such a notice and statement:
+
+ %% pig.dtx
+ %% Copyright 2005 M. Y. Name
+ %
+ % 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 M. Y. Name.
+ %
+ % This work consists of the files pig.dtx and pig.ins
+ % and the derived file pig.sty.
+
+Given such a notice and statement in a file, the conditions
+given in this license document would apply, with the `Work' referring
+to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being
+generated from `pig.dtx' using `pig.ins'), the `Base Interpreter'
+referring to any `LaTeX-Format', and both `Copyright Holder' and
+`Current Maintainer' referring to the person `M. Y. Name'.
+
+If you do not want the Maintenance section of LPPL to apply to your
+Work, change `maintained' above into `author-maintained'.
+However, we recommend that you use `maintained', as the Maintenance
+section was added in order to ensure that your Work remains useful to
+the community even when you can no longer maintain and support it
+yourself.
+
+Derived Works That Are Not Replacements
+---------------------------------------
+
+Several clauses of the LPPL specify means to provide reliability and
+stability for the user community. They therefore concern themselves
+with the case that a Derived Work is intended to be used as a
+(compatible or incompatible) replacement of the original Work. If
+this is not the case (e.g., if a few lines of code are reused for a
+completely different task), then clauses 6b and 6d shall not apply.
+
+
+Important Recommendations
+-------------------------
+
+ Defining What Constitutes the Work
+
+ The LPPL requires that distributions of the Work contain all the
+ files of the Work. It is therefore important that you provide a
+ way for the licensee to determine which files constitute the Work.
+ This could, for example, be achieved by explicitly listing all the
+ files of the Work near the copyright notice of each file or by
+ using a line such as:
+
+ % This work consists of all files listed in manifest.txt.
+
+ in that place. In the absence of an unequivocal list it might be
+ impossible for the licensee to determine what is considered by you
+ to comprise the Work and, in such a case, the licensee would be
+ entitled to make reasonable conjectures as to which files comprise
+ the Work.
+
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/LICENSE.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/README.md (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/README.md 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,46 @@
+# Xput
+
+__Declarative Desktop Publishing with LaTeX__
+
+The Xput LaTeX class provides a collection of macros that wrap the macro put to offer a more desktop-publishing-like experience for creating graphic rich documents like photo books.
+With Xput you can create single- and double-sided documents, create pages with margins, safety margins and bleed, use templates, align text and graphics in a grid, wrap text across multiple pages and use before pages.
+Generic templates, automatic grid layout and a simple and consistent user interface make it easier than ever to create graphic rich documents with LaTeX.
+Under the hood Xput uses the TikZ and tcolorbox packages, ImageMagick and Inkscape.
+
+Xput is distributed under the [LaTeX Project Public License](https://www.latex-project.org/lppl/lppl-1-3c/) version 1.3c or later.
+
+To submit bug reports and feature requests go to the official repository on [GitHub](https://github.com/friedemannbartels/xput/issues).
+
+## Installation
+
+In general, you should use the package manager shipped with your TeX distribution to install Xput. Alternatively you can copy the contents of [xput-1.0.1.tds.zip](https://github.com/friedemannbartels/xput/releases/download/1.0.1/xput-1.0.1.tds.zip) to your local TeX directory tree.
+
+### Command Line Tools
+
+For image optimization, shadow creation and preflight perform these installation steps:
+
+- Add the directory `tex/latex/xput/scripts` in your local TeX file tree to your `$PATH`.
+- Add `xputserver` to the list of `shell_escape_commands` in your `texmf.cnf`.
+- Install ImageMagick 7.0 or newer and Inkscape 1.0 or newer.
+
+The setup is tested with the engines `xelatex`, `pdflatex` and `lualatex` and the shells `zsh`, `bash` and `dash`.
+
+## Known Issues
+
+### LuaLaTeX
+
+Setting the page width and height as document option or in the preamble does not work with LuaLaTeX. You need to set the page width and height after `begin{document}`.
+Multi-threaded batch processing of images does not work with LuaLaTeX too.
+
+### LuaLaTeX and pdfLaTeX
+
+LuaLaTeX and pdfLaTeX only work with restricted shell access. When running with unrestricted shell access (`--shell-escape`), image optimization, shadow creation and preflight do not work.
+
+## Development
+
+Run visual regression tests with the following command:
+
+ cd test
+ xput test
+
+The tests are not included in the [CTAN](https://www.ctan.org/pkg/xput) package. You find the tests on [GitHub](https://github.com/friedemannbartels/xput/tree/main/test).
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-book.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/example-book.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-book.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-book.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-book.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-book.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-book.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-book.tex 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,111 @@
+%%
+%% Copyright (C) 2022 by Friedemann Bartels
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c 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.3c or later is part of all distributions of
+%% LaTeX version 2008/05/04 or later.
+%%
+
+\documentclass[
+ draft,
+ twoside,
+ beginright,
+ % fanfold,
+ import,
+ optimize={quality=50, density=144}
+]{xput}
+
+\usepackage{lipsum}
+\usepackage{tgheros}
+\usepackage[T1]{fontenc}
+\renewcommand*\familydefault{\sfdefault}
+
+\pagewidth=200mm
+\pageheight=200mm
+\margin=20mm
+\innermargin=40mm
+\gutter=10mm
+\bleed=3mm
+\safetymargin=5mm
+\spinewidth=7mm
+
+\safezone
+
+\newbeforepage{primary}{
+ \setgrid[height=\margin, y=0mm]{{{}}}
+
+ \leftpage{
+ \text[center]{\thepage}
+ }
+
+ \rightpage{
+ \text[center]{\hspace*{\fill}\thepage}
+ }
+}
+\setbeforepage{primary}
+
+\begin{document}
+ \Large
+ \pagenumbering{roman}
+
+ \template[back cover,margin=0mm, inner margin=0mm]{f}{}
+
+ \page[front cover,color=white,page graphic=koepi, inner margin=\margin]{
+ \setgrid[width=100mm]{{{1}}}
+
+ \text[bottom]{
+ \fontsize{41.3mm}{46mm}\selectfont
+ \hskip -3mm
+ Berlin
+ \fontsize{7.5mm}{13mm}\selectfont%
+ \mbox{Photos by Friedemann Bartels}
+ }
+
+ \ifspine{
+ \setgrid[width=\spinewidth,x=-\spinewidth]{{{1}}}
+ \place{0 0 1 1}
+ \tikzgraphic{
+ \node[rotate=90] at (0.5\width,0.5\height){
+ \fontsize{4mm}{8mm}\selectfont
+ Xput\ \
+ };
+ }
+ }
+ }
+
+ \page{
+ \text{
+ \strut
+ \tableofcontents
+ }
+ }
+
+ \pagenumbering{arabic}
+
+ \setcounter{page}{0}
+ \page[before page=]{}
+
+ \page{
+ \text{
+ \strut
+ \section{Introduction}
+ \lipsum[1][1-7]
+ }
+ }
+
+ \newgraphic{koepi wide}{vpos=0.43, file=koepi}
+ \page[double, page graphic=koepi wide, before page=, color=white]{
+ \rightpage{
+ \text[bottom]{
+ \lipsum[1][8-10]
+ }
+ }
+ }
+
+\end{document}
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-book.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.tex 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,52 @@
+%%
+%% Copyright (C) 2022 by Friedemann Bartels
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c 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.3c or later is part of all distributions of
+%% LaTeX version 2008/05/04 or later.
+%%
+
+\documentclass[draft]{xput}
+\usepackage{lipsum}
+
+\pagewidth=15cm
+\pageheight=15cm
+\gutter=10mm
+
+\newborder{my border}{width=2mm, color=magenta, radius=5mm}
+\newshadow{my shadow}{size=5, color=magenta, opacity=1}
+
+\begin{document}
+
+ \template{ff-ff}{
+ \graphic[
+ border=my border,
+ border radius=10mm
+ ]{1x1}
+
+ \graphic[
+ border=my border,
+ shadow=my shadow
+ ]{1x1}
+
+ \text[
+ shadow=my shadow,
+ shadow color=black,
+ shadow opacity=0.2
+ ]{\lipsum[1][1-5]}
+
+ \graphic[
+ shadow size=5,
+ shadow opacity=0.6,
+ shadow xshift=1mm,
+ shadow yshift=1mm
+ ]{1x1}
+ }
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-borders-and-shadows.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-graphic.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/example-graphic.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-graphic.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-graphic.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-graphic.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-graphic.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-graphic.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-graphic.tex 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,35 @@
+%%
+%% Copyright (C) 2022 by Friedemann Bartels
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c 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.3c or later is part of all distributions of
+%% LaTeX version 2008/05/04 or later.
+%%
+
+\documentclass{xput}
+
+\pagewidth=20cm
+\pageheight=20cm
+\bleed=3mm
+
+\optimize[quality=50, density=144]
+\preflight
+\safezone
+
+\newgraphic{koepi scaled}{scale=1.02, hpos=0.2, vpos=1, file=koepi}
+
+\begin{document}
+
+ \page{
+ \graphic[hpos=0, scale=1.2]{3x2}
+ }
+
+ \page[page graphic=koepi scaled]{}
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-graphic.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-grid.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/example-grid.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-grid.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-grid.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-grid.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-grid.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-grid.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-grid.tex 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,150 @@
+%%
+%% Copyright (C) 2022 by Friedemann Bartels
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c 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.3c or later is part of all distributions of
+%% LaTeX version 2008/05/04 or later.
+%%
+
+\documentclass{xput}
+\usepackage{lipsum}
+
+\pagewidth=20cm
+\pageheight=20cm
+\gutter=10mm
+
+\grid
+
+\begin{document}
+
+ \page{
+ \setgrid{
+ {{1}{1}}
+ {{1}{1}}
+ }
+
+ \text{
+ A grid with two rows and two cells in each row.
+ }
+ }
+
+ \page{
+ \setgrid{
+ {{3}{2}}
+ {{2}{3}}
+ }
+
+ \text{
+ A grid with a width relation between cells.
+ }
+ }
+
+ \page{
+ \setgrid{
+ {[3]{1}{1}}
+ {[1]{1}{1}}
+ }
+
+ \text{
+ A grid with a height relation between rows.
+ }
+ }
+
+ \page{
+ \setgrid{
+ {[2]{1}{3!}}
+ {[2]{1}{2!}}
+ }
+
+ \text{
+ A grid with a fixed aspect ratio of some cells.
+ }
+
+ \graphic{3x2}
+
+ \place{1 1 2 2}
+ \graphic{1x1}
+ }
+
+ \page{
+ \setgrid{
+ {[1]{1!}{1!}{1!}}
+ {[2]{4!}{3!}}
+ }
+
+ \text{
+ A grid with a fixed aspect ratio of all cells.
+ }
+
+ \place{0 0 1 1}
+ \graphic{1x1}
+
+ \graphic{1x1}
+
+ \graphic{1x1}
+
+ \graphic{2x1}
+
+ \graphic{3x2}
+ }
+
+ \page{
+ \setgrid{
+ {[2]{2!}{2!}{2!}}
+ {[2!]{4!}{3}}
+ }
+
+ \graphic{1x1}
+
+ \graphic{1x1}
+
+ \graphic{1x1}
+
+ \graphic{2x1}
+
+ \text{
+ A grid with a fixed height relation between rows.
+ }
+ }
+
+ \page[gutter=10mm]{
+ \setgrid[
+ width=0.5\width,
+ x=\margin
+ ]{
+ {{1}}
+ }
+ \text{
+ Multiple grids on one page.
+ }
+ \setgrid[
+ width=0.5\width-\gutter,
+ x=\margin+0.5\width+\gutter
+ ]{
+ {{1}}
+ {{1}}
+ {{1}}
+ }
+ }
+
+ \page{
+ \setgrid[width=\height]{
+ {{1}{1}}
+ {{1}{1}}
+ }
+ \text{
+ A grid with free positioned content. The gutter is preserved.
+ }
+ \place{0.5 0.5 1.5 1.5}
+ \graphic{1x1}
+ \place{1.5 1.5 2 2}
+ \graphic{1x1}
+ }
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-grid.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-template.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/example-template.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-template.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-template.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-template.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-template.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-template.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-template.tex 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,46 @@
+%%
+%% Copyright (C) 2022 by Friedemann Bartels
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c 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.3c or later is part of all distributions of
+%% LaTeX version 2008/05/04 or later.
+%%
+
+\documentclass[draft]{xput}
+\usepackage{lipsum}
+
+\pagewidth=15cm
+\pageheight=15cm
+\gutter=10mm
+
+\begin{document}
+
+ \template[gutter=5mm]{so-gs}{
+ \text{
+ This is a generic template.
+ }
+ }
+
+ \newtemplate{my template}{
+ \setgrid[height=\height-20mm]{
+ {[1]{1!}{1}}
+ {[1]{1!}{1}}
+ }
+ \placeholder{0 0 1 1}
+ \placeholder{1 0 2 1}
+ \placeholder{0 1 2 2}
+ }
+
+ \template[outer margin=10mm]{my template}{
+ \text{
+ This is a custom template.
+ }
+ }
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-template.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-text.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/example-text.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-text.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-text.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-text.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/example-text.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/example-text.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/example-text.tex 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,53 @@
+%%
+%% Copyright (C) 2022 by Friedemann Bartels
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c 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.3c or later is part of all distributions of
+%% LaTeX version 2008/05/04 or later.
+%%
+
+\documentclass{xput}
+\usepackage{lipsum}
+
+\pagewidth=15cm
+\pageheight=15cm
+\gutter=10mm
+
+\setgrid{
+ {{1}{1}}
+}
+
+\begin{document}
+
+ \page{
+ \text[breakable, name=lorem]{
+ \lipsum[2-3]
+ \par
+ \lipsum[4]
+ }
+ \usetext[lorem]
+ }
+
+ \page{
+ \usetext[lorem]
+ \tcbset{
+ boxrule=1mm,
+ boxsep=1mm,left=2mm,right=2mm,top=2mm,bottom=2mm,
+ colback=yellow,
+ colframe=red!75!black,
+ opacityframe=1,
+ opacityback=1,
+ arc=1mm
+ }
+ \text{
+ Text boxes use the package tcolorbox, so you can style these with the tcolorbox macro \texttt{tcbset}
+ }
+ }
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/example-text.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/koepi.jpg
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/koepi.jpg
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/koepi.jpg 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/koepi.jpg 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/koepi.jpg
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.tex 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,40 @@
+%%
+%% Copyright (C) 2022 by Friedemann Bartels
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c 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.3c or later is part of all distributions of
+%% LaTeX version 2008/05/04 or later.
+%%
+
+\documentclass[
+ bleed=3mm,
+ margin=10mm,
+ gutter=5mm,
+ page width=20cm,
+ page height=20cm,
+ draft,
+ safezone,
+ grid,
+ graphpaper
+]{xput}
+
+\begin{document}
+
+ \newtemplate{layoutguidesexample}{
+ \setgrid{
+ {{6}{1}}
+ }
+ \placeholder{0 1 1 2}
+ \placeholder{0 0 1 1}
+ }
+ \template{layoutguidesexample}{
+
+ }
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/xputmanual-layout-guides.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/xputmanual.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/xput/xputmanual.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/xputmanual.pdf 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/texmf-dist/doc/latex/xput/xputmanual.pdf 2022-12-21 20:56:12 UTC (rev 65325)
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/xputmanual.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xput/xputmanual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xput/xputmanual.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xput/xputmanual.tex 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,473 @@
+%%
+%% Copyright (C) 2022 by Friedemann Bartels
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c 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.3c or later is part of all distributions of
+%% LaTeX version 2008/05/04 or later.
+%%
+
+\documentclass[a4paper]{ltxdoc}
+\usepackage{microtype}
+\usepackage{hyperref}
+\usepackage{tikz}
+\OnlyDescription
+\hypersetup{pdfborder={0 0 0}}
+\def\Xputversion{1.0.1}
+
+\begin{document}
+
+\title{
+ \Huge The \textsf{Xput} class\\
+ \Large\url{https://github.com/friedemannbartels/xput}\\
+ \Large Manual for Version \Xputversion
+}
+
+\author{\href{mailto:mail at friedemannbartels.de}{Friedemann Bartels}}
+
+\maketitle
+
+\tableofcontents
+
+\newpage
+
+\section{Introduction}
+
+When Apple discontinued its photo book feature in Apple Photos, I was missing an easy-to-use photo book application.
+In 2020, I started to develop my own solution.
+What started with some SVG templates and shell scripts ended up in the Xput class, a declarative desktop publishing approach.
+\par
+With Xput you can create single- and double-sided documents, create pages with margins, safety margins, and bleed, use templates, align text and graphics in a grid, wrap text across multiple pages and use before pages.
+Generic templates, automatic grid layout and a simple and consistent user interface make it easier than ever to create graphics-rich documents with \LaTeX.
+Under the hood Xput uses the TikZ and tcolorbox packages, ImageMagick and Inkscape.
+
+\section{Document}\label{sec:document}
+
+The document options described in the following can be either set as a document option (|\documentclass[twoside]{xput}|) or with a macro (|\twoside|) in the preamble.
+
+\DescribeMacro {\documentclass}
+Use the class and define your options with the |\documentclass|\oarg{options}|{xput}| macro.
+A single sided document is the default.
+\begin{figure}[h!]
+\begin{tikzpicture}
+ \draw[black, thin] (0,0) rectangle (1,1);
+ \draw[black, line width=1.5pt,line cap=round] (0,0) -- (0,1);
+ \draw[black, thin] (1.25,0) rectangle (2.25,1);
+ \draw[black, line width=1.5pt,line cap=round] (1.25,0) -- (1.25,1);
+ \draw[black, thin] (2.5,0) rectangle (3.5,1);
+ \draw[black, line width=1.5pt,line cap=round] (2.5,0) -- (2.5,1);
+\end{tikzpicture}
+\end{figure}
+
+\DescribeMacro {\twoside}
+Using the document option |twoside| results in a document with left and right pages.
+When you create a two-sided document, your document always has an even number of pages.
+If you create a document with an odd number of pages, an additional page is automatically inserted.
+Two-sided documents start with a right page by default.
+\begin{figure}[h!]
+\begin{tikzpicture}
+ \draw[black, thin] (0,0) rectangle (1,1);
+ \draw[black, line width=1.5pt,line cap=round] (0,0) -- (0,1);
+ \draw[black, thin] (1.25,0) rectangle (2.25,1);
+ \draw[black, line width=1.5pt,line cap=round] (2.25,0) -- (2.25,1);
+ \draw[black, thin] (2.35,0) rectangle (3.35,1);
+ \draw[black, line width=1.5pt,line cap=round] (2.35,0) -- (2.35,1);
+ \draw[black, thin] (3.6,0) rectangle (4.6,1);
+ \draw[black, line width=1.5pt,line cap=round] (4.6,0) -- (4.6,1);
+\end{tikzpicture}
+\end{figure}
+
+\DescribeMacro {\beginleft}
+Use the option |beginleft| to begin with a left page.
+\begin{figure}[h!]
+\begin{tikzpicture}
+ \draw[black, thin] (0,0) rectangle (1,1);
+ \draw[black, line width=1.5pt,line cap=round] (1,0) -- (1,1);
+ \draw[black, thin] (1.1,0) rectangle (2.1,1);
+ \draw[black, line width=1.5pt,line cap=round] (1.1,0) -- (1.1,1);
+ \draw[black, thin] (2.35,0) rectangle (3.35,1);
+ \draw[black, line width=1.5pt,line cap=round] (3.35,0) -- (3.35,1);
+ \draw[black, thin] (3.45,0) rectangle (4.45,1);
+ \draw[black, line width=1.5pt,line cap=round] (3.45,0) -- (3.45,1);
+\end{tikzpicture}
+\end{figure}
+
+By default, each page is placed on one paper.
+\DescribeMacro {\fanfold}
+With the |fanfold| option you can change this behavior so that a left and a right page are placed on one paper.
+In this case, the first page is a left one by default.
+\begin{figure}[h!]
+\begin{tikzpicture}
+ \draw[black, thin] (0,0) rectangle (1,1);
+ \draw[black, thin] (1,0) rectangle (2,1);
+ \draw[black, line width=1.5pt,line cap=round] (1,0) -- (1,1);
+ \draw[black, thin] (2.25,0) rectangle (3.25,1);
+ \draw[black, thin] (3.25,0) rectangle (4.25,1);
+ \draw[black, line width=1.5pt,line cap=round] (3.25,0) -- (3.25,1);
+\end{tikzpicture}
+\end{figure}
+
+\DescribeMacro {\cover}
+The |cover| option is similar to the |fanfold| option, but only applied to cover pages.
+Read more about cover pages in section~\ref{sec:pages}.
+\begin{figure}[h!]
+\begin{tikzpicture}
+ \draw[black, thin] (0,0) rectangle (2.3,1);
+ \draw[black, line width=1.5pt,line cap=round] (1,0) -- (1,1);
+(3.25,1);
+ \draw[black, line width=1.5pt,line cap=round] (1.3,0) -- (1.3,1);
+(3.25,1);
+\end{tikzpicture}
+\end{figure}
+
+\DescribeMacro {\beginright}
+If you want your fanfold document to start with a right hand page, you can use the option |beginright|.
+\begin{figure}[h!]
+\begin{tikzpicture}
+ \draw[black, thin] (0,0) rectangle (1,1);
+ \draw[black, thin] (0,0) -- (1,1);
+ \draw[black, thin] (0,1) -- (1,0);
+ \draw[black, thin] (1,0) rectangle (2,1);
+ \draw[black, line width=1.5pt,line cap=round] (1,0) -- (1,1);
+ \draw[black, thin] (2.25,0) rectangle (3.25,1);
+ \draw[black, thin] (3.25,0) rectangle (4.25,1);
+ \draw[black, line width=1.5pt,line cap=round] (3.25,0) -- (3.25,1);
+ \draw[black, thin] (4.5,0) rectangle (5.5,1);
+ \draw[black, thin] (5.5,0) rectangle (6.5,1);
+ \draw[black, thin] (5.5,0) -- (6.5,1);
+ \draw[black, thin] (5.5,1) -- (6.5,0);
+ \draw[black, line width=1.5pt,line cap=round] (5.5,0) -- (5.5,1);
+\end{tikzpicture}
+\end{figure}
+
+\subsection{Lengths}\label{subsec:size}
+
+The document lengths described below can be set either as a document option (|\documentclass[page width=21cm]{xput}|) or by assigning the dimension directly (|\pagewidth=21cm|) in the preamble or in the document.
+
+\DescribeMacro {\pagewidth}
+\DescribeMacro {\pageheight}
+You can set the lengths |page width| and |page height|.
+The default page size is |210mm| by |297mm|.
+
+\DescribeMacro {\bleed}
+You can set the |bleed| length.
+It applies to all paper edges.
+The default bleed is |0mm|.
+You can override the bleed for each edge separately by defining the lengths |top bleed|, |inner bleed|, |bottom bleed|, |outer bleed|.
+The paper size results from the page size and the bleed.
+
+\DescribeMacro {\safetymargin}
+The |safety margin| is the only length that has no influence on the final result.
+Its only purpose is to control the safe zone during editing.
+It is |0mm| by default and can be configured for each edge by defining |top safety margin|, |inner safety margin|, |bottom safety margin| and |outer safety margin|.
+
+\DescribeMacro {\margin}
+\DescribeMacro {\gutter}
+You can set the lengths |margin| and |gutter| for the document, for a page (see section~\ref{sec:pages}) or for a grid (see section~\ref{sec:grid}).
+The default margin is |20mm|, the default gutter is |0mm|.
+Similar to bleed and safety margin, the margin can be defined for each edge individually by setting |top margin|, |outer margin|, |bottom margin| and |inner margin|.
+
+You can create documents with cover pages.
+\DescribeMacro {\coverwidth}
+\DescribeMacro {\coverheight}
+Read more about creating cover pages in section~\ref{sec:pages}.
+You can set the lengths |coverwidth| and |coverheight|.
+By default, the cover pages are the same size as the inside pages.
+If you want to create a cover with a spine, use the |fanfold| or |cover| option described in section~\ref{sec:document}.
+In this case the length |spinewidth| takes effect.
+The default spine width is |3mm|.
+\par
+You can overwrite the bleed and the safety margin for cover pages.
+To do this, prefix the respective lengths described above.
+For example, define |cover inner bleed| or |cover safety margin|.
+
+\subsection{Page Graphics and Colors}\label{subsec:colors}
+
+You can define a page graphic and a page color with the options |page graphic| and |page color|.
+Set the option |color| to define the text color.
+These options can be defined for the document or for each page (see section~\ref{sec:pages}).
+\par
+Read how to set the scale and crop of a page graphic with the |\newgraphic| macro in section~\ref{sec:content}.
+
+\subsection{Layout Guides}
+
+The layout guides described in the following can be either set as a document option (|\documentclass[grid]{xput}|) or using a macro (|\grid|) in the preamble or the document.
+Layout guides can be switched on (|\safezone|) or off (|\nosafezone|).
+
+\DescribeMacro {\grid}
+The |grid| option visualizes the margin and the grid gutters with green lines.
+Read more about the grid in section~\ref{sec:grid}.
+\DescribeMacro {\safezone}
+The |safezone| layout guide shows a red border for the bleed and a thin pink line to indicate the safety margin.
+\DescribeMacro {\cuttingmarks}
+As an alternative to |safezone|, you can also use |cutting marks| to display cutting marks.
+\DescribeMacro {\graphpaper}
+Show a graph paper with the |graph paper| option.
+
+\begin{figure}[h]
+\begin{tikzpicture}
+ \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[trim={15cm 16.5cm 0cm 0},clip,scale=1,page=1]{xputmanual-layout-guides.pdf}};
+ \node[anchor=south west,text depth=0mm,text width=4cm] (bleed) at (65mm,33mm) {Bleed};
+ \draw (bleed) -- ++(-32mm,0);
+ \node[anchor=south west,text depth=0mm,text width=4cm] (bleed) at (65mm,27mm) {Safety margin};
+ \draw (bleed) -- ++(-35mm,0.0);
+ \node[anchor=south west,text depth=0mm,text width=4cm] (margin) at (65mm,21mm) {Margin};
+ \draw (margin) -- ++(-43mm,0.0);
+ \node[anchor=south west,text depth=0mm,text width=4cm] (gutter) at (65mm,15mm) {Gutter};
+ \draw (gutter) -- ++(-70mm,0.0);
+ \node[anchor=south west,text depth=0mm,text width=4cm] (placeholder) at (65mm,9mm) {Placeholder};
+ \draw (placeholder) -- ++(-50mm,0.0);
+ \node[anchor=south west,text depth=0mm,text width=4cm] (graphpaper) at (65mm,3mm) {Graph paper};
+ \draw (graphpaper) -- ++(-40mm,0.0);
+\end{tikzpicture}%
+\end{figure}
+
+\DescribeMacro {\placeholders}
+The |placeholders| option shows template placeholders.
+Read more about templates in section~\ref{sec:templates}.
+\DescribeMacro {\fillpages}
+If you create a document with a cover and a first right hand page, use the |fill pages| option during editing to add blank pages to get a better impression of the final result.
+
+\subsection{Draft Mode}\label{subsec:draftmode}
+
+The |draft| option is a shortcut to enable the options |placeholders|, |cutting marks| and |fill pages|.
+It also speeds up rebuilding the PDF when changing the document.
+
+\section{Pages}\label{sec:pages}
+
+\DescribeMacro {\page}
+Create a page with the macro |\page|\oarg{options}\marg{content}.
+You can overwrite the document options |margin|, |top margin|, |bottom margin|, |inner margin|, |outer margin|, |gutter|, |page color|, |page graphic| and |color| for each page.
+
+Use the option |double| to create a double page.
+When creating a double page after a left page, a right page is automatically inserted before the double page.
+The option |double| is only recognized for double sided documents.
+\par
+Use the options |front cover| or |back cover| to create a front or back cover.
+If you have a back cover and a front cover, the back cover page must be defined first.
+If no option is active, the front cover is placed as the first page and the back cover as the last page of the document.
+In this case, the only difference from normal pages is that the cover pages are not counted in the page numbering.
+\par
+If the option |fanfold| or |cover| is selected, the back and front covers are laid out on one paper so that the cover is suitable for a book with a hard or soft cover (see section~\ref{sec:document}).
+Space is reserved between the back and front covers for the spine.
+Set the |spine width| document option as described in section~\ref{subsec:size}.
+\par
+With the options |hpos| and |vpos| you can set the default grid alignment for a page.
+Read more about the grid in the next section.
+
+\DescribeMacro {\setpagecolor}Alternativly to the option you can use the macro |\setpagecolor|\marg{color} to set the page color for all following pages.
+
+\DescribeMacro {\setpagegraphic}With the macro |\setpagegraphic|\oarg{options}\marg{name} you can define a page graphic for all following pages.
+The name references a graphic version created with the |\newgraphic| macro (see section~\ref{sec:content}).
+If no graphic version with the given name exists, the macro uses the name as the file name.
+You can change the clipping by defining relative decimal values for the options |scale| (>1), |hpos| and |vpos| (0-1).
+
+\DescribeMacro {\newbeforepage}With the macro |\newbeforepage|\marg{name}\marg{content} you can create a reusable page layer, that can be set before pages.
+\DescribeMacro {\setbeforepage}
+Use the macro |\setbeforepage|\marg{name} to define a before page for all following pages or use the page option |before page| to specify a before page for a individual page.
+
+\DescribeMacro {\ifleftpage}
+\DescribeMacro {\ifrightpage}
+Use the condition |\ifleftpage|\marg{content} and |\ifrightpage|\marg{content} to check for the current page alignment.
+
+\DescribeMacro {\leftpage}
+Within a page scope you can use the |\leftpage|\marg{content} macro to place content only on a left page.
+In comparison to the |\ifleftpage|\marg{content} condition, the macro sets a grid for a single page.
+That way you can combine single with double page layouts.
+\DescribeMacro {\rightpage}
+Accordingly you can use the |\rightpage|\marg{content} macro.
+
+\section{Grid}\label{sec:grid}
+
+The grid allows you to create rows with cells.
+You can define width and height relations between rows and cells.
+All definitions are relative.
+The size and position results from these relations and the configured dimensions page width, page height, margin and gutter.
+
+\DescribeMacro{\setgrid}
+Create a grid with the macro |\setgrid|\oarg{options}\marg{config}.
+The grid configuration is a nested list of rows and cells.
+A cell is defined by a number that describes the width ratio to the other cells in the row.
+The default grid describes a row with one cell:
+
+\begin{verbatim}
+ \setgrid{
+ {{}}}
+\end{verbatim}
+
+You can define a width relation between cells by adding a integer value for each cell:
+
+\begin{verbatim}
+ \setgrid{
+ {{1}{2}}}
+\end{verbatim}
+
+With an optional integer value for each row you can set a height relation between rows:
+
+\begin{verbatim}
+ \setgrid{
+ {[2]{1}{2}}
+ {[1]{1}{2}}}
+\end{verbatim}
+
+You can set an aspect ratio for a cell by adding a |!| to the width.
+This way the aspect ratio is defined by the width of the cell and the height of the row.
+If all cells in a row have a fixed aspect ratio, the aspect ratio of the row is fixed too.
+In the following, a row with only fixed cells is named a fixed row.
+Because the height of a fixed row is determined by the aspect ratios of the cells, the height relation to the flexible rows is broken.
+In this case, you can force a height relation between flexible and fixed rows by adding a |!| to the height of the flexible row.
+In the following, a row with a forced height is named a forced row.
+
+The example defines a first fixed row with one cell and an aspect ratio of 3:2.
+The height of the second row is forced half of the height of the first row.
+The cells in the second row share the available width in the ratio one to two:
+
+\begin{verbatim}
+ \setgrid{
+ {[2]{3!}}
+ {[1!]{1}{2}}}
+\end{verbatim}
+
+If the height of fixed and forced rows exceeds the available height, the grid shrinks to fit the available space.
+The defined aspect ratios of the cells are preserved and the grid is centered horizontally.
+In this case you can define the |hpos| option to align the grid horizontally.
+A value of |0| aligns the grid to the left, a value of |1| aligns the grid to the right.
+The default is a value of |0.5|.
+
+If the height of fixed and forced rows is less than the available height, all flexible rows share the excess height.
+If there are no flexible rows, the grid is centered vertically.
+In this case you can define the |vpos| option to align the grid vertically.
+A value of |0| aligns the grid to the top, a value of |1| aligns the grid to the bottom.
+The default is a value of |0.5|.
+
+As for a document or a page you can set |margin| and |gutter| options for a specific grid.
+With the options |width|, |height|, |x| and |y| you can override the intrinsic grid size and position.
+When overriding the grid size and position, you can calculate with the intrinsic values, for example |x=\x-1cm|.
+
+\subsection{Placing Content}
+
+The grid aligns content (see section~\ref{sec:content}) automatically in the given grid cells.
+To set the position of a content box manually use the macro |\place|\marg{fromrow fromcell torow tocell}.
+\DescribeMacro{\place}
+To place content in the first row and first cell use the macro |\place{0 0 1 1}| before the content.
+The definded place applies only for the following content box.
+The next boxes are then again placed with auto layout.
+\par
+The macro accepts decimals.
+That allows you to place content everywhere within the grid.
+The |gutter| is taken into account when calculating the positions.
+
+\section{Content}\label{sec:content}
+
+\subsection{Text}
+
+\DescribeMacro{\text}
+With the macro |\text|\oarg{options}\marg{text} you can place text.
+Align the text vertically with the |center| and |bottom| options.
+\par
+The |\text| macro uses the package tcolorbox and accepts tcolorbox options, for example to set text, frame or background color and transparency.
+The tcolorbox behaves slightly diffenrent then the standalone version: spacings, rules and background are removed by default.
+You can change the behaviour with the tcolorbox macro |\tcbset|\marg{options}.
+Also the |arc| options behaves different: if you set the |arc| to |0pt| the |outer arc| is also set to |0pt|.
+\par
+Add the option |breakable| to break text over multiple boxes and pages.
+\DescribeMacro{\usetext}
+Use the macro |\usetext|\oarg{name} to place the following text boxes in the grid.
+If you want to use multiple breakable text boxes you can initialize the text with the |name| option and define a name that you then can pass to the |\usetext| option.
+\par
+The |\text| macro accepts the options |shadow|, |shadow size|, |shadow color|, |shadow opacity|, |shadow xshift|, |shadow yshift|, |border|, |border width|,\break |border color| and |border radius|.
+Read more about shadows and borders in section~\ref{subsec:borders}.
+
+\subsection{Graphics}
+
+\DescribeMacro{\newgraphic}
+Create a reusable graphic version with the |\newgraphic|\marg{name}\marg{options} macro.
+Define the options |scale| (>1), |hpos| and |vpos| (0-1) to set the clipping of the graphic.
+With the option |file| you can link a file.
+If no file is defined, the name is used as the file name.
+
+\DescribeMacro{\graphic}
+The |\graphic|\oarg{options}\marg{name} macro places a graphic.
+The name references a graphic version created with the |\newgraphic| macro.
+If no graphic version with the given name exists, the macro uses the name as the file name.
+
+The graphic is scaled to fit in the content box.
+If the aspect ratio of the graphic differs from that of the defined content box, the graphic is cropped.
+You can change the cropping by defining relative decimal values for the options |scale| (>1), |hpos| and |vpos| (0-1).
+Same as the |\text| macro, the |\graphic| macro accepts the |border| and |shadow| options described in section~\ref{subsec:borders}.
+
+\DescribeMacro{\graphicspath}
+You can use the macro |\graphicspath|\marg{dir-list} of the graphics package to specify a list of directories in which to search for graphic files.
+
+\subsection{Other}
+
+\DescribeMacro{\xput}
+The macro |\xput|\marg{code} is an easy way to place arbitrary content in the grid.
+Within the code block the dimensions |\width| and |\height| represent the size of the content area and can be used to create graphics, that fit and adapt to the available size.
+\par
+\DescribeMacro{\tikzgraphic}
+The macro |\tikzgraphic|\marg{tikz code} works like the |\xput| macro, but wraps your input in a |tikzpicture|.
+
+\subsection{Shadows and Borders}\label{subsec:borders}
+
+Text and graphic content can be placed with a border or a shadow.
+You can define a border or shadow for a specific content box by using the options |border width|, |border color|, |border radius| to add a border or |shadow size|, |shadow color|, |shadow opacity|, |shadow xshift|, |shadow yshift| to add a shadow.
+\par
+\DescribeMacro{\newborder}
+\DescribeMacro{\newshadow}
+Define a reusable border or shadow with the macros |\newborder|\marg{name}\marg{options} or |\newshadow|\marg{name}\marg{options}.
+Apply the border or shadow to |\text| or |\graphic| with the option |border| or |shadow|.
+\par
+\DescribeMacro{\setborder}
+\DescribeMacro{\setshadow}
+To set a border or shadow within a page or document scope, use the macros |\setborder|\oarg{options}\marg{name} or |\setshadow|\oarg{options}\marg{name}.
+
+\section{Templates}\label{sec:templates}
+
+\DescribeMacro{\newtemplate}
+With the macro |\newtemplate|\marg{name}\marg{layout} you can create a reusable layout.
+Creating a template works the same way as creating a page.
+In addition to graphics and text you can define placeholders.
+\DescribeMacro{\placeholder}
+Use the macro |\placeholder|\marg{fromrow fromcell torow tocell} to define a content area that can later be filled with a text or a graphic.
+
+\DescribeMacro{\template}
+To use a template use the macro |\template|\oarg{options}\marg{name}\marg{content}.
+The available options are the same as for pages.
+
+The macro |\template| comes with an easy way to generate templates by using a name pattern.
+For example the template name \textit{sp} creates a template with a square and a portrait format placeholder.
+In this case the letter |s| specifies a square (1:1) and the letter |p| a portrait (2:3) format placeholder.
+Use the letter |l| to define a landscape ratio (3:2), |g| for golden ratio (5:3), |o| for golden upright ratio (3:5), |w| for wide ratio (2:1) or |f| for a flexible ratio.
+With the character |-| you can start a new row.
+Within a row you can mix the fixed placeholders (|s|, |p|, |l|, |g|, |o|, |w|) or use only flexible placeholders~(|f|).
+
+\section{Image Optimization}\label{sec:optimization}
+
+\DescribeMacro{\optimize}
+With the macro |\optimize|\oarg{options} you can enable image optimization.
+When enabled, JPG and PNG images are croped, resized and cached.
+This results in fast rebuilds when changing the document.
+You can set the options |density|, |quality|, |unsharp| and |downsample threshold|.
+The |density| option takes a number of the pixels per inch (default |300|), the |quality| option takes numbers between 1 and 100, the |unsharp| option an ImageMagick unsharp configuration (default |2x1|) and the |downsample threshold| a decimal value greater or equal 1 (default |1.2|).
+The |unsharp| option can also be applied for individual graphics.
+\par
+If you use image optimization and change the original graphics files, you must delete the cached versions so that the cache will update.
+\DescribeMacro{\import}
+The |\import| macro helps you to streamline this process.
+When enabled, you need an import directory in which to place the modified files.
+When the document is created, the files are moved to your image directory and the corresponding cached versions are automatically regenerated.
+The import directory is either the directory \emph{import} in your working directory.
+Or you can set a system wide import directory by defining the shell variable |XPUT_IMPORT_DIRECTORY|.
+\par
+\DescribeMacro{\preflight}
+Use the |\preflight| macro to proof the image resolution.
+If images have a final resolution less then 300 ppi you get a warning, if less then 200 ppi you get an error.
+With preflight enabled the maximum possible resolution is shown next to each graphic.
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/latex/xput/xputmanual.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/scripts/xput/xput
===================================================================
--- trunk/Master/texmf-dist/scripts/xput/xput (rev 0)
+++ trunk/Master/texmf-dist/scripts/xput/xput 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,509 @@
+#!/bin/sh
+#
+# Copyright (C) 2022 by Friedemann Bartels
+#
+# This file may be distributed and/or modified under the
+# conditions of the LaTeX Project Public License, either
+# version 1.3c 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.3c or later is part of all distributions of
+# LaTeX version 2008/05/04 or later.
+#
+
+OK="$( tput setaf 2 )•$( tput sgr0 )"
+FAILED="$( tput setaf 1 )$( tput bold )x$( tput sgr0 )"
+NEW="$( tput setaf 3 )$( tput bold )+$( tput sgr0 )"
+REMOVED="$( tput setaf 5 )$( tput bold )-$( tput sgr0 )"
+ERROR="$( tput setaf 1 )$( tput bold )!$( tput sgr0 )"
+
+_playok() {
+ if [ -f /System/Library/Sounds/Glass.aiff ]; then
+ afplay /System/Library/Sounds/Glass.aiff >/dev/null 2>&1
+ fi
+}
+
+_playhm() {
+ if [ -f /System/Library/Sounds/Basso.aiff ]; then
+ afplay /System/Library/Sounds/Basso.aiff >/dev/null 2>&1
+ fi
+}
+
+_playerror() {
+ if [ -f /System/Library/Sounds/Sosumi.aiff ]; then
+ afplay /System/Library/Sounds/Sosumi.aiff >/dev/null 2>&1
+ fi
+}
+
+_gettime() {
+ if command -v gdate &> /dev/null; then
+ echo $( gdate +%s%3N )
+ else
+ if command -v date &> /dev/null; then
+ milliseconds=$( date +%3N )
+ if [ $milliseconds = 3N ]; then
+ echo $(( SECONDS * 1000 ))
+ else
+ echo $( date +%s%3N )
+ fi
+ else
+ echo $(( SECONDS * 1000 ))
+ fi
+ fi
+}
+
+_starttimer() {
+ starttime=$( _gettime )
+}
+
+_stoptimer() {
+ endtime=$( _gettime )
+
+ elapsedtime=$(( endtime - starttime ))
+ elapsedseconds=$(( elapsedtime / 1000 ))
+ elapsedmilliseconds=$(( elapsedtime % 1000 ))
+ elapsed=$elapsedseconds.$( printf "%03d" "$elapsedmilliseconds" )
+}
+
+test() {
+ _starttimer
+ tmpdir=$( mktemp -d 2>/dev/null )/textest$( date "+%Y%m%d%H%M%S" )$RANDOM
+ mkdir $tmpdir
+
+ if [ $3 = true ] && [ -d cache ]; then
+ rm -rf cache
+ fi
+
+ okcount=0
+ failedcount=0
+ newcount=0
+ removedcount=0
+ fileokcount=0
+ filefailedcount=0
+ defaultfiller=23
+
+ echo ""
+ for entry in *$5*.tex
+ do
+ if [ $entry != "*$5*.tex" ]; then
+ name=$( echo $entry | sed -e 's/\.tex$//g' )
+ if [ ${name:0:1} != _ ]; then
+ printf "$( tput sgr0 )$name"
+
+ runtwice=0
+ if [ "${name:$(( ${#name} - 2 )):2}" = "@2" ]; then
+ runtwice=1
+ fi
+
+ if [ "$4" != "xelatex" ]; then
+ name="$name.$4"
+ fi
+
+ passed=1
+ rm -f $name.failed.*
+
+ cp $entry $tmpdir/$name.tex
+ shell=""
+ if [ $1 = true ]; then
+ shell="--shell-escape"
+ fi
+ $4 -interaction=batchmode $shell --output-directory $tmpdir $tmpdir/$name.tex > /dev/null
+ if [ $? -eq 1 ]; then
+ passed=0
+ fi
+ if [ $runtwice -eq 1 ]; then
+ $4 -interaction=batchmode $shell --output-directory $tmpdir $tmpdir/$name.tex > /dev/null
+ if [ $? -eq 1 ]; then
+ passed=0
+ fi
+ fi
+
+ magick convert -density $2 -quiet $tmpdir/$name.pdf $tmpdir/$name.png
+ if [ -f "$tmpdir/$name.png" ]; then
+ mv $tmpdir/$name.png $tmpdir/$name-0.png
+ fi
+
+ if [ -f "$name.approved.pdf" ]; then
+ magick convert -density $2 -quiet $name.approved.pdf $tmpdir/$name.approved.png
+ if [ -f "$tmpdir/$name.approved.png" ]; then
+ mv $tmpdir/$name.approved.png $tmpdir/$name.approved-0.png
+ fi
+ fi
+
+ if [ $passed -eq 0 ]; then
+ filler=$(( defaultfiller - ${#name} - 2 ))
+ else
+ filler=$(( defaultfiller - ${#name} ))
+ fi
+ while [ 0 -le $filler ]; do
+ printf " "
+ filler=$(( filler - 1 ))
+ done
+ if [ $passed -eq 0 ]; then
+ printf " $ERROR"
+ fi
+
+ index=0
+ while [ -f "$tmpdir/$name-$index.png" ]; do
+ if [ -f "$tmpdir/$name.approved-$index.png" ]; then
+ changedpixels=$( magick compare -quiet -metric AE $tmpdir/$name-$index.png $tmpdir/$name.approved-$index.png null: 2>&1 )
+ if [ $changedpixels -eq 0 ]; then
+ okcount=$(( okcount + 1 ))
+ printf " $OK"
+ else
+ failedcount=$(( failedcount + 1 ))
+ passed=0
+ printf " $FAILED"
+ magick compare -quiet $tmpdir/$name-$index.png $tmpdir/$name.approved-$index.png $name.failed.$(( index + 1 )).png
+ if [ -f "$tmpdir/$name.pdf" ]; then
+ mv $tmpdir/$name.pdf $name.failed.pdf
+ fi
+ fi
+ else
+ newcount=$(( newcount + 1 ))
+ passed=0
+ printf " $NEW"
+ mv $tmpdir/$name-$index.png $name.failed.$(( index + 1 )).png
+ if [ -f "$tmpdir/$name.pdf" ]; then
+ mv $tmpdir/$name.pdf $name.failed.pdf
+ fi
+ fi
+ index=$(( index + 1 ))
+ if [ `expr $index % 20` -eq 0 ] && [ -f "$tmpdir/$name-$index.png" ]; then
+ echo ""
+ filler=$defaultfiller
+ while [ 0 -le $filler ]; do
+ printf " "
+ filler=$(( filler - 1 ))
+ done
+ fi
+ done
+ while [ -f "$tmpdir/$name.approved-$index.png" ]; do
+ removedcount=$(( removedcount + 1 ))
+ passed=0
+ printf " $REMOVED"
+ mv $tmpdir/$name.approved-$index.png $name.failed.$(( index + 1 )).png
+ if [ -f "$tmpdir/$name.pdf" ]; then
+ mv $tmpdir/$name.pdf $name.failed.pdf
+ fi
+ index=$(( index + 1 ))
+ if [ `expr $index % 20` -eq 0 ] && [ -f "$tmpdir/$name.approved-$index.png" ]; then
+ echo ""
+ filler=$defaultfiller
+ while [ 0 -le $filler ]; do
+ printf " "
+ filler=$(( filler - 1 ))
+ done
+ fi
+ done
+
+ if [ $passed -eq 1 ]; then
+ fileokcount=$(( fileokcount + 1 ))
+ else
+ filefailedcount=$(( filefailedcount + 1 ))
+ fi
+
+ echo ""
+ fi
+ fi
+ done
+
+ rm -rf $tmpdir
+ _stoptimer
+ seconds=$( printf "%.1f" "$elapsed" )
+
+ filecount=$(( fileokcount + filefailedcount ))
+
+ if [ $filecount -gt 0 ]; then
+ echo ""
+ fi
+ if [ $filecount -eq $fileokcount ]; then
+ if [ $filecount -eq 0 ]; then
+ _playhm &
+ echo "$( tput sgr0 )Tested 0 files 🧐."
+ else
+ _playok &
+ echo "$( tput sgr0 )Successfully tested $filecount files in $seconds seconds 🎉."
+ fi
+ echo ""
+ else
+ _playerror &
+ echo "$( tput sgr0 )Tested $filecount files in $seconds seconds."
+ echo ""
+
+ if [ $fileokcount -gt 0 ]; then
+ filler=$(( 6 + ${#filecount} - ${#fileokcount} ))
+ while [ 0 -le $filler ]; do
+ printf " "
+ filler=$(( filler - 1 ))
+ done
+ printf "$( tput setaf 2 )$fileokcount OK$( tput sgr0 )"
+ echo ""
+ fi
+ if [ $filefailedcount -gt 0 ]; then
+ filler=$(( 6 + ${#filecount} - ${#filefailedcount} ))
+ while [ 0 -le $filler ]; do
+ printf " "
+ filler=$(( filler - 1 ))
+ done
+ printf "$( tput setaf 1 )$filefailedcount Failed$( tput sgr0 )"
+ echo ""
+ fi
+ echo ""
+ exit 1
+ fi
+}
+
+approve() {
+ filecount=0
+
+ suffix=""
+ if [ "$1" != "xelatex" ]; then
+ suffix=".$1"
+ fi
+
+ echo ""
+ for entry in *$2*$suffix.failed.pdf
+ do
+ if [ $entry != "*$2*$suffix.failed.pdf" ]; then
+ filecount=$(( filecount + 1 ))
+ name=$( echo $entry | sed -e "s/$suffix.failed.pdf//" )
+ echo $name
+ rm -f $name$suffix.approved.pdf
+ if [ -f "$name.aux" ]; then
+ cp $name$suffix.failed.pdf $name$suffix.approved.pdf
+ else
+ mv $name$suffix.failed.pdf $name$suffix.approved.pdf
+ fi
+
+ rm -f $name$suffix.failed.*
+ fi
+ done
+
+ if [ $filecount -gt 0 ]; then
+ echo ""
+ fi
+ if [ $filecount -eq 1 ]; then
+ echo "Approved 1 file."
+ else
+ echo "Approved $filecount files."
+ fi
+ echo ""
+}
+
+compare() {
+ filea=$2
+ fileb=$3
+ tmpdir=$( mktemp -d 2>/dev/null)/textest$( date "+%Y%m%d%H%M%S" )$RANDOM
+ mkdir $tmpdir
+
+ namea=$( echo $filea | sed -e 's/\.\///g' | sed -e 's/\.pdf$//g' )
+ nameb=$( echo $fileb | sed -e 's/\.\///g' | sed -e 's/\.pdf$//g' )
+ basenamea=$(basename $namea)
+ basenameb=$(basename $nameb)
+
+ rm -f $namea.diff.*.png
+
+ spacer=""
+ if [ -f "$filea" ]; then
+ if [ -f "$fileb" ]; then
+ magick convert -density $1 -quiet $filea $tmpdir/$basenamea.png
+ if [ -f "$tmpdir/$basenamea.png" ]; then
+ mv $tmpdir/$basenamea.png $tmpdir/$basenamea-0.png
+ fi
+ magick convert -density $1 -quiet $fileb $tmpdir/$basenameb.png
+ if [ -f "$tmpdir/$basenameb.png" ]; then
+ mv $tmpdir/$basenameb.png $tmpdir/$basenameb-0.png
+ fi
+
+ index=0
+ while [ -f "$tmpdir/$basenamea-$index.png" ]; do
+ if [ -f "$tmpdir/$basenameb-$index.png" ]; then
+ changedpixels=$( magick compare -quiet -metric AE $tmpdir/$basenamea-$index.png $tmpdir/$basenameb-$index.png null: 2>&1 )
+ if [ $changedpixels -eq 0 ]; then
+ printf "$spacer$OK"
+ spacer=" "
+ else
+ printf "$spacer$FAILED"
+ spacer=" "
+ magick compare -quiet $tmpdir/$basenamea-$index.png $tmpdir/$basenameb-$index.png $namea.diff.$(( index + 1 )).png
+ fi
+ else
+ printf "$spacer$NEW"
+ spacer=" "
+ fi
+ index=$(( index + 1 ))
+ done
+ while [ -f "$tmpdir/$basenameb-$index.png" ]; do
+ printf "$spacer$REMOVED"
+ spacer=" "
+ index=$(( index + 1 ))
+ done
+ echo ""
+ else
+ echo "File $fileb not found."
+ fi
+ else
+ echo "File $filea not found."
+ fi
+
+ rm -rf $tmpdir
+}
+
+perf() {
+ if [ -f $4 ]; then
+ tmpdir=$( mktemp -d 2>/dev/null )/textestperf$( date "+%Y%m%d%H%M%S" )$RANDOM
+ mkdir $tmpdir
+ basename=$(basename $4)
+
+ if [ $1 = true ] && [ -d cache ]; then
+ rm -rf cache
+ fi
+
+ cp $4 $tmpdir
+ shell=""
+ if [ $2 = true ]; then
+ shell="--shell-escape"
+ fi
+ _starttimer
+ $3 -interaction=batchmode $shell --output-directory $tmpdir $tmpdir/$basename > /dev/null
+ _stoptimer
+ echo "$elapsed"
+
+ rm -rf $tmpdir
+ else
+ echo "File $4 not found."
+ fi
+}
+
+usage() {
+ cat <<HELP_USAGE
+usage: $(basename $0) test [-cs] [-e engine] [-d density] pattern
+ or: $(basename $0) approve [-e engine] pattern
+ or: $(basename $0) compare [-d density] files
+ or: $(basename $0) perf [-cs] [-e engine] file
+
+ -c clear cache
+ -s enable shell escape
+ -d density set density in ppi (default 72)
+ -e engine set latex engine (default xelatex)
+
+ Running \`$(basename $0) test\` creates pdf files for all tex files matching the
+ pattern and performs a visual regression test. If no pattern is specified,
+ all files in the current directory are tested except for files whose names
+ begin with an underscore.
+
+ Running \`$(basename $0) approve\` replaces the reference files with the test files.
+
+ Running \`$(basename $0) compare\` creates a visual diff for two pdf files.
+
+ Running \`$(basename $0) perf\` measures the time for creating a pdf file from the
+ given tex file.
+HELP_USAGE
+}
+
+case "$1" in
+test)
+ shift
+
+ density=72
+ shell=false
+ clear=false
+ engine=xelatex
+
+ while getopts ":e:d:sc" arg; do
+ case "${arg}" in
+ c)
+ clear=true
+ ;;
+ d)
+ density="${OPTARG}"
+ ;;
+ e)
+ engine="${OPTARG}"
+ ;;
+ s)
+ shell=true
+ ;;
+ ?)
+ echo "Invalid option: -${OPTARG}."
+ ;;
+ esac
+ done
+
+ shift "$(( OPTIND - 1 ))"
+
+ test $shell $density $clear $engine $1
+ ;;
+approve)
+ shift
+ engine=xelatex
+
+ while getopts ":e:" arg; do
+ case "${arg}" in
+ e)
+ engine="${OPTARG}"
+ ;;
+ ?)
+ echo "Invalid option: -${OPTARG}."
+ ;;
+ esac
+ done
+
+ shift "$(( OPTIND - 1 ))"
+
+ approve $engine $1
+ ;;
+compare)
+ shift
+
+ density=72
+
+ while getopts ":d:" arg; do
+ case "${arg}" in
+ d)
+ density="${OPTARG}"
+ ;;
+ ?)
+ echo "Invalid option: -${OPTARG}."
+ ;;
+ esac
+ done
+
+ shift "$(( OPTIND - 1 ))"
+
+ compare $density $1 $2
+ ;;
+perf)
+ shift
+
+ shell=false
+ clear=false
+ engine=xelatex
+
+ while getopts ":e:sc" arg; do
+ case "${arg}" in
+ c)
+ clear=true
+ ;;
+ e)
+ engine="${OPTARG}"
+ ;;
+ s)
+ shell=true
+ ;;
+ ?)
+ echo "Invalid option: -${OPTARG}."
+ ;;
+ esac
+ done
+
+ shift "$(( OPTIND - 1 ))"
+
+ perf $clear $shell $engine $1
+ ;;
+*)
+ usage
+esac
Property changes on: trunk/Master/texmf-dist/scripts/xput/xput
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/texmf-dist/scripts/xput/xputserver
===================================================================
--- trunk/Master/texmf-dist/scripts/xput/xputserver (rev 0)
+++ trunk/Master/texmf-dist/scripts/xput/xputserver 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,338 @@
+#!/bin/sh
+#
+# Copyright (C) 2022 by Friedemann Bartels
+#
+# This file may be distributed and/or modified under the
+# conditions of the LaTeX Project Public License, either
+# version 1.3c 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.3c or later is part of all distributions of
+# LaTeX version 2008/05/04 or later.
+#
+
+_convert() {
+ turbo=$1
+ filename=$2
+ filenamecache=$3
+ fileextcache=$4
+ originalwidthsp=$5
+ originalheightsp=$6
+ originalcropleftsp=$7
+ originalcroprightsp=$8
+ originalcroptopsp=$9
+ originalcropbottomsp=${10}
+ density=${11}
+ displaywidth=${12}
+ displayheight=${13}
+ resizethreshold=${14}
+ unsharp=${15}
+ quality="${16}"
+
+ mkdir -p cache/"$filenamecache"
+ originalwidth=$( magick identify -ping -format %w "$filename" )
+ originalheight=$( magick identify -ping -format %h "$filename" )
+ width=$(( (10 * originalwidth * (originalwidthsp - originalcropleftsp - originalcroprightsp) / originalwidthsp + 5) / 10 ))
+ height=$(( (10 * originalheight * (originalheightsp - originalcroptopsp - originalcropbottomsp) / originalheightsp + 5) / 10 ))
+ cropleft=$(( (10 * originalwidth * originalcropleftsp / originalwidthsp + 5) / 10 ))
+ croptop=$(( (10 * originalheight * originalcroptopsp / originalheightsp + 5) / 10 ))
+ resizewidth=$(( (10 * displaywidth * 100 * density / 473628672 + 5) / 10 ))
+ if [ $(( resizewidth * resizethreshold / 100 )) -gt $width ]; then
+ resizewidth=$width
+ resizeheight=$height
+ else
+ resizeheight=$(( resizewidth * height / width + 1 ))
+ fi
+
+ x="x"
+ if [ $turbo = 1 ]; then
+ export MAGICK_THREAD_LIMIT=1
+ fi
+ if [ "$quality" != "" ]; then
+ quality="-quality $quality"
+ fi
+ if [ "$unsharp" != "" ]; then
+ unsharp="-unsharp $unsharp"
+ fi
+
+ magick "$filename" -crop $width$x$height+$cropleft+$croptop -resize $resizewidth$x$resizeheight $unsharp $quality "cache/$filenamecache/.g$fileextcache"
+ mv "cache/$filenamecache/.g$fileextcache" "cache/$filenamecache/g$fileextcache"
+}
+
+_startbatchprocess() {
+ success=0
+ for file in cache/*; do
+ if [ -f "$file" ]; then
+ success=1
+ name=$( basename "${file}" )
+ mv "$file" "cache/.$name" 2> /dev/null
+ if [ $? -eq 0 ]; then
+ line=$(head -n 1 "cache/.$name")
+
+ IFS="%"
+ set -- $line
+ IFS=" "
+ _convert 1 "$@"
+
+ rm "cache/.$name"
+ break
+ fi
+ fi
+ done
+
+ if [ $success -eq 1 ]; then
+ _startbatchprocess
+ fi
+}
+
+getwidth() {
+ if command -v magick >/dev/null 2>&1; then
+ filename=$1
+
+ originalwidth=$( magick identify -ping -format %w "$filename" )
+ echo $originalwidth
+ else
+ echo errormagicknotinstalled
+ fi
+}
+
+optimize() {
+ if command -v magick >/dev/null 2>&1; then
+ filenamecache=$2
+ fileextcache=$3
+
+ if [ -f cache/"$filenamecache" ]; then
+ mv cache/"$filenamecache" cache/."$filenamecache" 2> /dev/null
+ if [ $? -eq 0 ]; then
+ line=$(head -n 1 "cache/.$filenamecache")
+
+ IFS="%"
+ set -- $line
+ IFS=" "
+ _convert 1 "$@"
+
+ rm "cache/.$filenamecache"
+ else
+ while [ ! -f cache/"$filenamecache"/g"$fileextcache" ]; do
+ sleep 0.05
+ done
+ fi
+ elif [ -d cache/"$filenamecache" ]; then
+ while [ ! -f cache/"$filenamecache"/g"$fileextcache" ]; do
+ sleep 0.05
+ done
+ else
+ _convert 0 "$@"
+ fi
+
+ echo ok
+ else
+ echo errormagicknotinstalled
+ fi
+}
+
+makeshadow() {
+ if command -v magick >/dev/null 2>&1; then
+ filename=$1
+ stdDeviation=$2
+ opacity=$3
+ fill=$4
+ width=$5
+ height=$6
+ framewidth=$7
+ frameheight=$8
+ frameborder=$9
+ frameradius=${10}
+
+ [ ! -d cache ] && mkdir cache
+ mkdir -p cache/$filename
+ echo "<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+ <svg
+ width='$width'
+ height='$height'
+ version='1.1'
+ xmlns='http://www.w3.org/2000/svg'
+ xmlns:svg='http://www.w3.org/2000/svg'>
+ <defs>
+ <filter
+ style='color-interpolation-filters:sRGB'
+ id='blur'
+ x='-4'
+ y='-4'
+ width='8'
+ height='8'>
+ <feGaussianBlur
+ stdDeviation='$stdDeviation' />
+ </filter>
+ </defs>
+ <rect
+ style='filter:url(#blur);opacity:$opacity;fill:$fill'
+ width='$framewidth'
+ height='$frameheight'
+ x='$frameborder'
+ y='$frameborder'
+ rx='$frameradius'
+ ry='$frameradius' />
+ </svg>
+ " > cache/$filename/s.svg
+ inkscape cache/$filename/s.svg --export-dpi=600 --export-filename cache/$filename/s.pdf
+ rm cache/$filename/s.svg
+
+ echo ok
+ else
+ echo errorinkscapenotinstalled
+ fi
+}
+
+import() {
+ if [ -d import ]; then
+ importdir=import
+ elif [ "$XPUT_IMPORT_DIRECTORY" != "" ]; then
+ if [ -d "$XPUT_IMPORT_DIRECTORY" ]; then
+ importdir="$XPUT_IMPORT_DIRECTORY"
+ else
+ echo $XPUT_IMPORT_DIRECTORY
+ exit
+ fi
+ else
+ echo errornoimportdir
+ exit
+ fi
+
+ defaultdirectory=$( echo $1 | sed -e 's/^{//g' | sed -e 's/}{.*//g' )
+ directorylist=$( echo $1 | sed -e 's/^{//g' | sed -e 's/}$//g' | sed -e 's/}{/$/g' )
+
+ for entry in "$importdir"/*.*
+ do
+ if [ -f "$entry" ]; then
+ name=$( basename "${entry}" )
+ if [ "$directorylist" != "" ]; then
+ echo "$directorylist" | tr '$' '\n' | while read directory; do
+ if [ -f "$directory$name" ]; then
+ mv "$entry" "$directory"
+ fi
+ done
+ fi
+ if [ -f "$entry" ]; then
+ if [ -d "$defaultdirectory" ]; then
+ mv "$entry" "$defaultdirectory"
+ else
+ mv "$entry" .
+ fi
+ fi
+ cachename=$( echo "$name" | sed -e 's/\.[a-zA-Z]*$//g' )
+ rm -rf cache/"$cachename"*
+ fi
+ done
+}
+
+startturbo() {
+ file=$1
+ if [ -f $file.tex ]; then
+ tmpdir=$( mktemp -d 2>/dev/null )/xputturbo$( date "+%Y%m%d%H%M%S" )$RANDOM
+ mkdir $tmpdir
+
+ cp $file.tex $tmpdir/xputturbobatchoptimizexyz.tex
+
+ engine=$(echo $(ps -p $PPID -o command | sed -e 's/[A-Z]//g'| sed -e 's/ .*//g' | tr -d '\n'))
+ if [ "$engine" = "xelatex" ]; then
+ nopdf="-no-pdf"
+ fi
+ $engine -interaction=batchmode $nopdf --output-directory $tmpdir $tmpdir/xputturbobatchoptimizexyz.tex > /dev/null
+
+ rm -rf $tmpdir
+ fi
+}
+
+batchoptimize() {
+ [ ! -d cache ] && mkdir cache
+
+ length=$(( $# / 15 ))
+ cores=$( nproc )
+ [ $cores -gt $length ] && cores=$length
+
+ while [ $length -gt 0 ]; do
+ filenamecache="$2"
+
+ if [ ! -e cache/"$filenamecache" ]; then
+ index=0
+ while [ $index -lt 15 ]; do
+ if [ $index -eq 0 ]; then
+ item="$1"
+ else
+ item="$item%$1"
+ fi
+
+ shift
+ index=$(( index + 1 ))
+ done
+
+ echo $item > cache/"$filenamecache"
+ else
+ shift 15
+ fi
+
+ length=$(( length - 1 ))
+ done
+
+ cores=$(( cores - 1 ))
+ while [ $cores -gt 0 ]; do
+ _startbatchprocess &
+ sleep 0.01
+ cores=$(( cores - 1 ))
+ done
+}
+
+input=$( echo "$@" | sed -e 's/\\//g' | sed -e 's/ %/%/g' | sed -e 's/% /%/g' )
+IFS="%"
+set -- $input
+IFS=" "
+shift
+
+case "$1" in
+getwidth)
+ shift
+
+ getwidth "$1"
+ ;;
+optimize)
+ shift
+
+ optimize "$@"
+ ;;
+makeshadow)
+ shift
+
+ makeshadow "$@"
+ ;;
+start)
+ shift
+
+ if [ "$1" = "import" ]; then
+ shift
+
+ import "$1"
+
+ shift
+ fi
+
+ if [ "$1" = "turbo" ]; then
+ shift
+
+ startturbo "$1" &
+ fi
+
+ echo ok
+ ;;
+batchoptimize)
+ shift
+
+ batchoptimize "$@" &
+
+ echo ok
+ ;;
+*)
+ echo 🤖 Hi, I serve the Xput LaTeX class.
+esac
Property changes on: trunk/Master/texmf-dist/scripts/xput/xputserver
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/xput/xput.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xput/xput.cls (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/xput/xput.cls 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1,3740 @@
+%%
+%% Copyright (C) 2022 by Friedemann Bartels
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c 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.3c or later is part of all distributions of
+%% LaTeX version 2008/05/04 or later.
+%%
+
+\NeedsTeXFormat{LaTeX2e}[2020/10/01]
+\ProvidesClass{xput}[2022/12/19 declarative desktop publishing]
+\def\Xputversion{1.0.1}
+
+% packages
+\RequirePackage{pgfopts}
+\RequirePackage{tikz}
+\RequirePackage{tcolorbox}
+\tcbuselibrary{magazine}
+
+% helper
+\def\xput at emptystring{}
+\def\xput at striplastexclamationmark#1{\xput at striplastexclamationmarka{#1}#1\end !\end\eend}
+\def\xput at striplastexclamationmarka#1#2!\end#3\eend{\ifx\end#3\end#1\else#2\fi}
+\def\xput at instring#1#2{TT\fi\begingroup\edef\xput at x{\endgroup\noexpand\in@{#1}{#2}}\xput at x\ifin@}
+\def\xput at dimentonumber#1{\strip at pt\dimexpr #1*65536/\number\dimexpr 1\unitlength}
+
+% ifs
+\newif\ifxput at leftpage
+\newif\ifxput at rightpage
+
+\newif\ifxput at twoside
+\newif\ifxput at fanfold
+\newif\ifxput at cover
+\newif\ifxput at beginleft
+\newif\ifxput at beginright
+\newif\ifxput at grid
+\newif\ifxput at preflight
+\newif\ifxput at graphpaper
+\newif\ifxput at placeholder
+\newif\ifxput at safezone
+\newif\ifxput at cuttingmarks
+\newif\ifxput at fillpages
+\newif\ifxput at frontcover
+\newif\ifxput at backcover
+
+\newif\ifxput at hascover
+\newif\ifxput at haspages
+\newif\ifxput at isdoublepage
+\newif\ifxput at ispage
+\newif\ifxput at isemptypage
+\newif\ifxput at haslastemptypage
+\newif\ifxput at hasoddnumberofpages
+\newif\ifxput at cuttingmarksvisible
+\newif\ifxput at isfanfoldopen
+\newif\ifxput at isinitgrid
+\newif\ifxput at haspagegraphic
+\newif\ifxput at isperformancemode
+\newif\ifxput at isturbomode
+\newif\ifxput at isbatchmode
+\newif\ifxput at ismaskrequired
+\newif\ifxput at optimize
+\newif\ifxput at import
+\newif\ifxput at isluatex
+
+% dimensions
+\newdimen\xput at null\xput at null=0pt
+\newdimen\xput at undefdim\xput at undefdim=-1sp
+
+\ifdefined\pagewidth\xput at isluatextrue\else\newdimen\pagewidth\newdimen\pageheight\fi
+\newdimen\bleed\newdimen\outerbleed\newdimen\innerbleed\newdimen\topbleed\newdimen\bottombleed
+\newdimen\safetymargin\newdimen\topsafetymargin\newdimen\bottomsafetymargin\newdimen\innersafetymargin\newdimen\outersafetymargin
+\newdimen\innermargin\newdimen\bottommargin\newdimen\outermargin\newdimen\margin
+\newdimen\gutter\newdimen\spinewidth\newdimen\bindingoffset
+\newdimen\coverwidth\newdimen\coverheight
+\newdimen\coverbleed\newdimen\coverouterbleed\newdimen\coverinnerbleed\newdimen\covertopbleed\newdimen\coverbottombleed
+\newdimen\coversafetymargin\newdimen\covertopsafetymargin\newdimen\coverbottomsafetymargin\newdimen\coverinnersafetymargin\newdimen\coveroutersafetymargin
+
+\newdimen\xput at pagewidth\newdimen\xput at pageheight
+\newdimen\xput at outerbleed\newdimen\xput at innerbleed\newdimen\xput at topbleed\newdimen\xput at bottombleed
+\newdimen\xput at topsafetymargin\newdimen\xput at bottomsafetymargin\newdimen\xput at innersafetymargin\newdimen\xput at outersafetymargin
+\newdimen\xput at topmargin\newdimen\xput at topmargintmp\newdimen\xput at innermargin\newdimen\xput at bottommargin\newdimen\xput at outermargin
+\newdimen\xput at gutter
+\newdimen\xput at x\newdimen\xput at y\newdimen\xput at xx\newdimen\xput at yy\newdimen\width\newdimen\height\newdimen\x\newdimen\y
+\newdimen\xput at gridoffsethorizontal\newdimen\xput at gridoffsetvertical\newdimen\xput at gridoffsethorizontaln\newdimen\xput at gridoffsetverticaln
+\newdimen\xput at graphpaperx\newdimen\xput at graphpapery\newdimen\xput at graphpaperoffset\newdimen\xput at graphpapersnap
+
+% interface
+\newcommand\ifleftpage[1]{\ifxput at leftpage#1\fi}
+\newcommand\ifrightpage[1]{\ifxput at rightpage#1\fi}
+\newcommand\ifspine[1]{\ifxput at cover#1\fi}
+\def\twoside{\xput at twosidetrue}
+\def\fanfold{\xput at fanfoldtrue}
+\def\cover{\xput at covertrue}
+\def\beginleft{\xput at beginlefttrue}
+\def\beginright{\xput at beginrighttrue}
+\def\grid{\xput at gridtrue}\def\nogrid{\xput at gridfalse}
+\def\preflight{\xput at preflighttrue}\def\nopreflight{\xput at preflightfalse}
+\def\graphpaper{\xput at graphpapertrue}\def\nographpaper{\xput at graphpaperfalse}
+\def\placeholders{\xput at placeholdertrue}\def\noplaceholders{\xput at placeholderfalse}
+\def\safezone{\xput at safezonetrue}\def\nosafezone{\xput at safezonefalse}
+\def\cuttingmarks{\xput at cuttingmarkstrue}\def\nocuttingmarks{\xput at cuttingmarksfalse}
+\def\fillpages{\xput at fillpagestrue}\def\nofillpages{\xput at fillpagesfalse}
+\newcommand\optimize[1][]{\xput at optimizetrue\pgfkeys{optimize,#1}}
+\def\density#1{\def\xput at density{#1}}
+\def\quality#1{\def\xput at quality{#1}}
+\def\import{\xput at importtrue}
+
+\def\setgraphpaper#1{
+ \def\xput at graphpaperconfig{#1}
+ \foreach \xput at graphpaperconfigitem in \xput at graphpaperconfig {
+ \global\xput at graphpapersnap=\xput at graphpaperconfigitem
+ }
+}
+\setgraphpaper{1mm,5mm}
+
+\def\xput at pagecolormodel{}
+\def\xput at pagecolor{}
+\renewcommand\pagecolor[2][]{
+ \ifxput at ispage
+ \def\xput at pagecolormodel{#1}
+ \def\xput at pagecolor{#2}
+ \else
+ \global\def\xput at pagecolormodel{#1}
+ \global\def\xput at pagecolor{#2}
+ \fi
+}
+\newcommand\setpagecolor[2][]{\pagecolor[#1]{#2}}
+\def\nopagecolor{\pagecolor{}}
+
+\def\xput at current@color{black}
+\let\xput at originalcolor\color
+\def\color#1{\ifxput at ispage\ifx\xput at current@color#1\else\def\xput at current@color{#1}\xput at originalcolor{#1}\fi\else\def\xputoptions at color{#1}\fi}
+\def\setcolor#1{\color{#1}}
+
+\let\xput at originalpagenumbering\pagenumbering
+\newif\ifxput at pagenumberinghaschanged
+\renewcommand\pagenumbering[1]{\xput at pagenumberinghaschangedtrue\xput at originalpagenumbering{#1}}
+
+% options
+\def\xput at density{300}
+\def\xput at downsamplethreshold{120}
+\def\xput at quality{}
+\def\xput at unsharp{2x1}
+\pgfkeysdef{/optimize/downsample threshold}{
+ \pgfmathqparse{#1pt*100pt}
+ \pgfmathround{\pgfmathresult}
+ \pgfmathint{\pgfmathresult}
+ \edef\xput at downsamplethreshold{\pgfmathresult}
+}
+\pgfkeys{
+ /optimize/.is family,
+ /optimize,
+ density/.store in=\xput at density,
+ quality/.store in=\xput at quality,
+ unsharp/.store in=\xput at unsharp,
+}
+\pgfkeys{
+ /xput/.cd,
+ % page dimensions
+ pagewidth/.code={\setlength{\pagewidth}{#1}},pagewidth=210mm,
+ pageheight/.code={\setlength{\pageheight}{#1}},pageheight=297mm,
+ bleed/.code={\setlength{\bleed}{#1}},bleed=0pt,
+ outerbleed/.code={\setlength{\outerbleed}{#1}},outerbleed=\xput at undefdim,
+ innerbleed/.code={\setlength{\innerbleed}{#1}},innerbleed=\xput at undefdim,
+ topbleed/.code={\setlength{\topbleed}{#1}},topbleed=\xput at undefdim,
+ bottombleed/.code={\setlength{\bottombleed}{#1}},bottombleed=\xput at undefdim,
+ safetymargin/.code={\setlength{\safetymargin}{#1}},safetymargin=0pt,
+ outersafetymargin/.code={\setlength{\outersafetymargin}{#1}},outersafetymargin=\xput at undefdim,
+ innersafetymargin/.code={\setlength{\innersafetymargin}{#1}},innersafetymargin=\xput at undefdim,
+ topsafetymargin/.code={\setlength{\topsafetymargin}{#1}},topsafetymargin=\xput at undefdim,
+ bottomsafetymargin/.code={\setlength{\bottomsafetymargin}{#1}},bottomsafetymargin=\xput at undefdim,
+ % cover dimensions
+ coverwidth/.code={\setlength{\coverwidth}{#1}},coverwidth=\xput at undefdim,
+ coverheight/.code={\setlength{\coverheight}{#1}},coverheight=\xput at undefdim,
+ coverbleed/.code={\setlength{\coverbleed}{#1}},coverbleed=\xput at undefdim,
+ coverouterbleed/.code={\setlength{\coverouterbleed}{#1}},coverouterbleed=\xput at undefdim,
+ coverinnerbleed/.code={\setlength{\coverinnerbleed}{#1}},coverinnerbleed=\xput at undefdim,
+ covertopbleed/.code={\setlength{\covertopbleed}{#1}},covertopbleed=\xput at undefdim,
+ coverbottombleed/.code={\setlength{\coverbottombleed}{#1}},coverbottombleed=\xput at undefdim,
+ coversafetymargin/.code={\setlength{\coversafetymargin}{#1}},coversafetymargin=\xput at undefdim,
+ coveroutersafetymargin/.code={\setlength{\coveroutersafetymargin}{#1}},coveroutersafetymargin=\xput at undefdim,
+ coverinnersafetymargin/.code={\setlength{\coverinnersafetymargin}{#1}},coverinnersafetymargin=\xput at undefdim,
+ covertopsafetymargin/.code={\setlength{\covertopsafetymargin}{#1}},covertopsafetymargin=\xput at undefdim,
+ coverbottomsafetymargin/.code={\setlength{\coverbottomsafetymargin}{#1}},coverbottomsafetymargin=\xput at undefdim,
+ spinewidth/.code={\setlength{\spinewidth}{#1}},spinewidth=3mm,
+ bindingoffset/.code={\setlength{\bindingoffset}{#1}},bindingoffset=0pt,
+ % grid dimensions
+ margin/.code={\setlength{\margin}{#1}},margin=20mm,
+ outermargin/.code={\setlength{\outermargin}{#1}},outermargin=\xput at undefdim,
+ innermargin/.code={\setlength{\innermargin}{#1}},innermargin=\xput at undefdim,
+ topmargin/.store in=\xputoptions at topmargin,topmargin=-1sp,
+ bottommargin/.code={\setlength{\bottommargin}{#1}},bottommargin=\xput at undefdim,
+ gutter/.code={\setlength{\gutter}{#1}},gutter=0pt,
+ pagecolor/.store in=\xput at pagecolor,
+ pagegraphic/.store in=\xputoptions at pagegraphic,pagegraphic=,
+ color/.store in=\xputoptions at color,color=black,
+ grid/.is if=xput at grid,
+ safezone/.is if=xput at safezone,
+ cuttingmarks/.is if=xput at cuttingmarks,
+ graphpaper/.is if=xput at graphpaper,
+ placeholder/.is if=xput at placeholder,
+ fillpages/.is if=xput at fillpages,
+ draft/.code={\xput at placeholdertrue\xput at fillpagestrue\xput at cuttingmarkstrue\xput at isperformancemodetrue},
+ preflight/.is if=xput at preflight,
+ twoside/.is if=xput at twoside,
+ fanfold/.code={\xput at fanfoldtrue\xput at covertrue\xput at twosidetrue\xput at beginlefttrue},
+ cover/.is if=xput at cover,
+ beginleft/.is if=xput at beginleft,
+ beginright/.is if=xput at beginright,
+ optimize/.code={\xput at optimizetrue\pgfkeys{optimize,#1}},
+ density/.store in=\xput at density,
+ quality/.store in=\xput at quality,
+ turbo/.is if=xput at isturbomode,turbo=\ifxput at isluatex false\else true\fi,
+ import/.is if=xput at import
+}
+\ProcessPgfOptions{/xput}
+
+\xput at originalcolor{\xputoptions at color}
+
+\Gin at draftfalse
+
+\LoadClass[multi=picture]{standalone}
+\setlength{\topmargin}{\xputoptions at topmargin}
+
+% grid
+\newdimen\xput at gridoffsetx
+\newdimen\xput at gridwidth\newdimen\xput at gridheight\newdimen\xput at maxgridheight\newdimen\xput at maxgridwidth
+\newcount\xput at gridtmp\newcount\xput at gridtmpRowH
+\newcount\xput at rowscount\newcount\xput at flexrowscount\newcount\xput at fixrowscount\newcount\xput at cellscount
+\newcount\rowsH\newcount\rowsF\newcount\rowsFlex
+\newif\ifxput at gridisflexrow
+\def\xput at set#1#2{
+ \ifcsname xput at data#1\endcsname
+ \else
+ \expandafter\newcount\csname xput at data#1\endcsname
+ \fi
+ \csname xput at data#1\endcsname#2\relax
+}
+\def\xput at get#1{
+ \ifcsname xput at data#1\endcsname
+ \csname xput at data#1\endcsname%
+ \else
+ 0
+ \fi
+}
+\def\xput at advance#1#2{
+ \advance\csname xput at data#1\endcsname by \csname xput at data#2\endcsname
+}
+\newif\ifxput at flexmode
+\newif\ifxput at forcerow
+\newif\ifxput at forcecell
+\def\xput at leftsafetymargin{
+ \ifxput at backcover%
+ \xput at outersafetymargin%
+ \else%
+ \ifxput at frontcover%
+ \xput at innersafetymargin%
+ \else%
+ \ifxput at leftpage%
+ \xput at outersafetymargin%
+ \else%
+ \xput at innersafetymargin%
+ \fi%
+ \fi%
+ \fi%
+}
+\def\xput at rightsafetymargin{
+ \ifxput at backcover%
+ \xput at innersafetymargin%
+ \else%
+ \ifxput at frontcover%
+ \xput at outersafetymargin%
+ \else%
+ \ifxput at leftpage%
+ \xput at innersafetymargin%
+ \else%
+ \xput at outersafetymargin%
+ \fi%
+ \fi%
+ \fi%
+}
+\def\xput at leftbleed{
+ \ifxput at backcover%
+ \xput at outerbleed%
+ \else%
+ \ifxput at frontcover%
+ \xput at innerbleed%
+ \else%
+ \ifxput at leftpage%
+ \xput at outerbleed%
+ \else%
+ \xput at innerbleed%
+ \fi%
+ \fi%
+ \fi%
+}
+\def\xput at rightbleed{
+ \ifxput at backcover%
+ \xput at innerbleed%
+ \else%
+ \ifxput at frontcover%
+ \xput at outerbleed%
+ \else%
+ \ifxput at leftpage%
+ \xput at innerbleed%
+ \else%
+ \xput at outerbleed%
+ \fi%
+ \fi%
+ \fi%
+}
+\def\xput at leftmargin{
+ \ifxput at backcover%
+ \xput at outermargin%
+ \else%
+ \ifxput at frontcover%
+ \xput at innermargin%
+ \else%
+ \ifxput at leftpage%
+ \xput at outermargin%
+ \else%
+ \xput at innermargin%
+ \fi%
+ \fi%
+ \fi%
+}
+\newcommand\xput at addrow[1]{
+ \advance\xput at rowscount by 1
+ \xput at cells#1
+}
+\newdimen\xput at gridheightdiff
+\newdimen\xput at gridwidthdiff
+\newdimen\xput at gridstartxdim
+\newdimen\xput at gridstartydim
+\newcount\looprows
+\newcount\loopcells
+\newcommand\xput at processrows{
+ \advance\looprows 1
+ \ifnum\xput at get{if\the\looprows F}=1
+ \xput at set{\the\looprows HR}{\numexpr(\xput at gridheight-\xput at gutter*\xput at rowscount)*\xput at get{\the\looprows H}/\rowsH+\xput at gutter}
+ \else
+ \ifnum\xput at get{if\the\looprows Fix}=0
+ \xput at set{\the\looprows HR}{\numexpr(\xput at maxgridheight-\xput at gridheight)*\xput at get{\the\looprows H}/\rowsFlex+\xput at gutter}
+ \else
+ \xput at set{\the\looprows HR}{\numexpr(\xput at gridwidth-\xput at gutter*\xput at get{\the\looprows C})*\xput at get{\the\looprows H}/\xput at get{\the\looprows W}+\xput at gutter}
+ \fi
+ \fi
+ \loopcells=0
+ \loop
+ \advance\loopcells 1
+ \ifnum\xput at get{if\the\looprows-\the\loopcells F}=1
+ \xput at set{\the\looprows-\the\loopcells WR}{\numexpr(\xput at get{\the\looprows HR}-\xput at gutter)*\xput at get{\the\looprows-\the\loopcells W}/\xput at get{\the\looprows H}+\xput at gutter}
+ \else
+ \xput at set{\the\looprows-\the\loopcells WR}{\numexpr((\xput at gridwidth-\xput at gutter*\xput at get{\the\looprows C})\ifnum\xput at get{\the\looprows H}>0 -(\xput at get{\the\looprows HR}-\xput at gutter)*\xput at get{\the\looprows F}/\xput at get{\the\looprows H}\fi)*\xput at get{\the\looprows-\the\loopcells W}/(\xput at get{\the\looprows W}-\xput at get{\the\looprows F})+\xput at gutter}
+ \fi
+ \ifnum \loopcells<\xput at get{\the\looprows C}
+ \repeat
+
+ \ifnum \looprows<\xput at rowscount
+ \xput at processrows
+ \fi
+}
+\newcommand\xput at closerows{
+ \xput at topmargin=\ifdim\xput at gridtopmargin=\xput at undefdim\xput at gridmargin\else\xput at gridtopmargin\fi
+ \xput at bottommargin=\ifdim\xput at gridbottommargin=\xput at undefdim\xput at gridmargin\else\xput at gridbottommargin\fi
+ \xput at innermargin=\ifdim\xput at gridinnermargin=\xput at undefdim\xput at gridmargin\else\xput at gridinnermargin\fi
+ \xput at outermargin=\ifdim\xput at gridoutermargin=\xput at undefdim\xput at gridmargin\else\xput at gridoutermargin\fi
+
+ \height=\dimexpr\xput at pageheight - \xput at topmargin - \xput at bottommargin\relax
+ \width=\dimexpr\xput at pagewidth - \xput at innermargin - \xput at outermargin\relax
+ \ifdim\dimexpr\xput at gridoptionheight\relax=\xput at undefdim
+ \else
+ \xput at gridheightdiff=\dimexpr0.5\height - 0.5\dimexpr\xput at gridoptionheight\relax\relax
+ \xput at bottommargin=\dimexpr\xput at bottommargin+\xput at gridheightdiff\relax
+ \xput at topmargin=\dimexpr\xput at topmargin+\xput at gridheightdiff\relax
+ \fi
+ \ifdim\dimexpr\xput at gridoptionwidth\relax=\xput at undefdim
+ \else
+ \xput at gridwidthdiff=\dimexpr\xput at calculaterealgridwidth/2 - 0.5\dimexpr\xput at gridoptionwidth\relax\relax
+ \xput at innermargin=\dimexpr\xput at innermargin+\xput at gridwidthdiff\relax
+ \xput at outermargin=\dimexpr\xput at outermargin+\xput at gridwidthdiff\relax
+ \fi
+
+ \xput at gutter=\xput at gridgutter
+
+ \x=\dimexpr\xput at gridstartx{\xput at undefdim}-\xput at leftbleed\relax
+ \y=\dimexpr\xput at gridstarty{\xput at undefdim}-\xput at bottombleed\relax
+
+ \xput at gridstartxdim=\dimexpr\xput at gridstartx{\xput at gridoptionx}\relax
+ \xput at gridstartydim=\dimexpr\xput at gridstarty{\xput at gridoptiony}\relax
+
+ \xput at gridwidth=\dimexpr\xput at calculatefullgridwidth\relax
+ \ifnum\rowsH>0
+ \xput at calculategridheight
+ \else
+ \xput at gridheight=\dimexpr\xput at gutter*\xput at rowscount\relax
+ \fi
+ \xput at gridoffsetvertical=\xput at null
+ \xput at gridoffsethorizontal=\xput at null
+ \xput at gridoffsetverticaln=\xput at null
+ \xput at gridoffsethorizontaln=\xput at null
+
+ \xput at maxgridheight=\dimexpr\xput at calculatefullgridheight\relax
+ \ifdim\xput at gridheight>\xput at maxgridheight
+ \xput at gridheight=\xput at maxgridheight
+ \xput at calculategridwidth
+ \xput at gridoffsethorizontal=\dimexpr\xput at gridoptionhpos\xput at gridwidth-\xput at gridoptionhpos\xput at maxgridwidth\relax
+ \xput at gridoffsethorizontaln=\dimexpr\xput at gridwidth-\xput at maxgridwidth-\xput at gridoffsethorizontal\relax
+ \xput at gridwidth=\xput at maxgridwidth
+ \else
+ \ifxput at flexmode
+ \else
+ \ifdim\xput at gridheight<\xput at maxgridheight
+ \xput at gridoffsetvertical=\dimexpr\xput at gridoptionvpos\xput at maxgridheight-\xput at gridoptionvpos\xput at gridheight\relax
+ \xput at gridoffsetverticaln=\dimexpr\xput at maxgridheight-\xput at gridheight-\xput at gridoffsetvertical\relax
+ \fi
+ \fi
+ \fi
+
+ \looprows=0
+ \xput at processrows
+}
+\newcommand\xput at addcell[1]{
+ \advance\xput at cellscount by 1
+ \if\xput at instring{!}{#1}
+ \xput at gridtmp \xput at striplastexclamationmark{#1}\relax
+ \xput at forcecelltrue
+ \else
+ \xput at gridisflexrowtrue
+ \ifnum\numexpr0#1\relax=0
+ \xput at gridtmp 1\relax
+ \else
+ \xput at gridtmp #1\relax
+ \fi
+ \xput at forcecellfalse
+ \fi
+ \xput at set{\the\xput at rowscount-\the\xput at cellscount W}{\xput at gridtmp}
+ \ifxput at forcecell
+ \xput at set{if\the\xput at rowscount-\the\xput at cellscount F}{1}
+ \xput at advance{\the\xput at rowscount F}{\the\xput at rowscount-\the\xput at cellscount W}
+ \else
+ \xput at set{if\the\xput at rowscount-\the\xput at cellscount F}{0}
+ \fi
+ \xput at advance{\the\xput at rowscount W}{\the\xput at rowscount-\the\xput at cellscount W}
+}
+\newif\ifxput at gridtop
+\newif\ifxput at gridbottom
+\newif\ifxput at gridleft
+\newif\ifxput at gridright
+\newif\ifxput at gridfull
+\pgfkeys{
+ /grid/.is family,
+ /grid,
+ gutter/.store in=\xput at gridgutter,
+ margin/.store in=\xput at gridmargin,
+ top margin/.store in=\xput at gridtopmargin,
+ bottom margin/.store in=\xput at gridbottommargin,
+ inner margin/.store in=\xput at gridinnermargin,
+ outer margin/.store in=\xput at gridoutermargin,
+ width/.store in=\xput at gridoptionwidth,
+ height/.store in=\xput at gridoptionheight,
+ x/.store in=\xput at gridoptionx,
+ y/.store in=\xput at gridoptiony,
+ vpos/.store in=\xput at gridoptionvpos,
+ hpos/.store in=\xput at gridoptionhpos,
+}
+\def\xput at resetautogrid{
+ \global\xput at gridfullfalse
+ \def\xput at framey{0}\def\xput at framex{0}\def\xput at frameyy{1}\def\xput at framexx{1}
+ \def\xput at frameyymax{0}\def\xput at framexxmax{0}
+}
+\newcommand\setgrid[2][]{
+ \ifxput at haspages
+ \else
+ \def\xput at tmpgrid{\setgrid{#2}}
+ \fi
+ \xput at resetautogrid
+ \pgfkeys{
+ /grid,
+ gutter=\gutter,
+ margin=\margin,
+ top margin=\topmargin,
+ bottom margin=\bottommargin,
+ inner margin=\innermargin,
+ outer margin=\outermargin,
+ width=\xput at undefdim,
+ height=\xput at undefdim,
+ x=\xput at undefdim,
+ y=\xput at undefdim,
+ vpos=\xput at verticalpagealign,
+ hpos=\xput at horizontalpagealign,%
+ #1
+ }
+ \rowsH 0\relax
+ \rowsFlex 0\relax
+ \xput at flexrowscount 0\relax
+ \xput at fixrowscount 0\relax
+ \rowsF 0\relax
+ \xput at rowscount 0\relax
+ \xput at flexmodefalse
+ \def\xput at grid@input{#2}
+ \ifx\xput at grid@input\xput at emptystring
+ \xput at gobblenextrow{{1}}
+ \else
+ \xput at gobblenextrow#2
+ \fi
+}
+\newcommand\xput at gobblenextrow[1]{
+ \xput at addrow{#1}
+ \@ifnextchar\bgroup{
+ \xput at gobblenextrow
+ }{
+ \ifxput at isinitgrid
+ \else
+ \xput at closerows
+ \fi
+ }
+}
+\newcommand\xput at cells[2][1]{
+ \if\xput at instring{!}{#1}
+ \xput at gridtmpRowH \xput at striplastexclamationmark{#1}\relax
+ \xput at forcerowtrue
+ \advance\rowsF by \xput at gridtmpRowH
+ \advance\rowsH by \xput at gridtmpRowH
+ \xput at set{\the\xput at rowscount H}{\xput at gridtmpRowH}
+ \advance \xput at fixrowscount by 1
+ \else
+ \xput at forcerowfalse
+ \xput at gridtmpRowH #1\relax
+ \fi
+
+ \xput at cellscount 0\relax
+ \xput at set{\the\xput at rowscount W}{0}
+ \xput at set{\the\xput at rowscount F}{0}
+ \ifxput at forcerow\xput at set{if\the\xput at rowscount F}{1}\else\xput at set{if\the\xput at rowscount F}{0}\fi
+ \xput at gridisflexrowfalse
+
+ \xput at gobblenextcell{#2}
+}
+\newcommand\xput at gobblenextcell[1]{
+ \xput at addcell{#1}
+ \@ifnextchar\bgroup{
+ \xput at gobblenextcell
+ }{
+ \ifxput at forcerow
+ \else
+ \ifxput at gridisflexrow
+ \xput at flexmodetrue
+ \advance \xput at flexrowscount by 1
+ \advance\rowsFlex by \xput at gridtmpRowH
+ \xput at set{\the\xput at rowscount H}{\xput at gridtmpRowH}
+ \xput at set{if\the\xput at rowscount Fix}{0}
+ \else
+ \advance \xput at fixrowscount by 1
+ \advance\rowsH by \xput at gridtmpRowH
+ \xput at set{\the\xput at rowscount H}{\xput at gridtmpRowH}
+ \xput at set{if\the\xput at rowscount Fix}{1}
+ \fi
+ \fi
+ \xput at set{\the\xput at rowscount C}{\xput at cellscount}
+ }
+}
+
+% grid shortcut
+\def\xput at flexkey{f}
+\def\xput at portraitkey{p}
+\def\xput at squarekey{s}
+\def\xput at landscapekey{l}
+\def\xput at goldenkey{g}
+\def\xput at goldenuprightkey{o}
+\def\xput at widekey{w}
+\def\xput at rowbreakkey{-}
+\newcount\xput at rowcountsc
+\newcount\xput at cellcountsc
+\newcommand\xput at breakrow{
+ \edef\xput at result{\xput at result{[30]\xput at rowindex}}
+}
+\newif\ifxput at isgridvalid
+\newcommand\xput at transformgridconfig[1]{
+ \ifx\xput at rowbreakkey#1
+ \xput at breakrow
+ \def\xput at rowindex{}
+ \else
+ \ifx\xput at flexkey#1
+ \edef\xput at rowindex{\xput at rowindex{1}}
+ \else
+ \ifx\xput at portraitkey#1
+ \edef\xput at rowindex{\xput at rowindex{20!}}
+ \else
+ \ifx\xput at squarekey#1
+ \edef\xput at rowindex{\xput at rowindex{30!}}
+ \else
+ \ifx\xput at landscapekey#1
+ \edef\xput at rowindex{\xput at rowindex{45!}}
+ \else
+ \ifx\xput at widekey#1
+ \edef\xput at rowindex{\xput at rowindex{60!}}
+ \else
+ \ifx\xput at goldenkey#1
+ \edef\xput at rowindex{\xput at rowindex{50!}}
+ \else
+ \ifx\xput at goldenuprightkey#1
+ \edef\xput at rowindex{\xput at rowindex{18!}}
+ \else
+ \xput at isgridvalidfalse
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput at setplaceholder[1]{
+ \ifx\xput at rowbreakkey#1
+ \advance\xput at rowcountsc by 1
+ \xput at cellcountsc 0\relax
+ \else
+ \placeholder{{\xput at rowcountsc} {\xput at cellcountsc} {\numexpr\xput at rowcountsc+1\relax} {\numexpr\xput at cellcountsc+1\relax}}
+ \advance\xput at cellcountsc by 1
+ \fi
+}
+\newcommand\xput at gridsc[1]{
+ \edef\xput at gridsc@input{#1}
+ \def\xput at rowindex{}
+ \def\xput at result{}
+ \xput at isgridvalidtrue
+ \@tfor\next:=#1\do{\xput at transformgridconfig{\next}}%
+ \ifxput at isgridvalid
+ \xput at breakrow
+ \edef\xput at result{{\xput at result}}
+ \expandafter\setgrid\xput at result
+ \xput at rowcountsc 0\relax
+ \xput at cellcountsc 0\relax
+ \@tfor\next:=#1\do{\xput at setplaceholder{\next}}%
+ \else
+ \xput at errmsg@undefined{template}{\xput at gridsc@input}
+ \fi
+}
+
+% grid dimensions
+\newif\ifxput at flexgrid
+\newcommand\xput at calculategridheight{
+ \xput at flexgridtrue
+ \xput at gridheight=\xput at null
+ \looprows=0
+ \loop
+ \advance\looprows 1
+ \ifnum\xput at get{if\the\looprows F}=1
+ \xput at gridheight=\dimexpr\xput at gridheight+\xput at gutter\relax%
+ \else
+ \ifnum\xput at get{if\the\looprows Fix}=0
+ \xput at gridheight=\dimexpr\xput at gridheight+\xput at gutter\relax%
+ \else
+ \xput at flexgridfalse
+ \xput at gridheight=\dimexpr\xput at gridheight+(\xput at gridwidth-\xput at gutter*\xput at get{\the\looprows C})*\xput at get{\the\looprows H}/(\xput at get{\the\looprows W}*(\rowsH-\rowsF))*\rowsH+\xput at gutter\relax
+ \fi
+ \fi
+ \ifnum \looprows<\xput at rowscount
+ \repeat
+ \ifxput at flexgrid
+ \xput at gridheight=\dimexpr\xput at calculatefullgridheight\relax
+ \fi
+}
+\newcommand\xput at calculatefullgridheight{
+ \xput at pageheight - \xput at topmargin - \xput at bottommargin + \xput at gutter
+}
+\newcommand\xput at calculategridwidth{
+ \def\xput at calculategridwidthcalc{(\xput at gridheight*(\rowsH-\rowsF)/\rowsH-\xput at gutter*(\rowsH-\rowsF)*\xput at rowscount/\rowsH}
+ \looprows=0
+ \loop
+ \advance\looprows 1
+ \ifnum\xput at get{if\the\looprows F}=1
+ \else
+ \ifnum\xput at get{if\the\looprows Fix}=0
+ \else
+ \edef\xput at calculategridwidthcalc{\xput at calculategridwidthcalc+\xput at gutter*\xput at get{\the\looprows C}*\xput at get{\the\looprows H}/\xput at get{\the\looprows W}}
+ \fi
+ \fi
+ \ifnum \looprows<\xput at rowscount
+ \repeat
+
+ \edef\xput at calculategridwidthcalc{\xput at calculategridwidthcalc) * 10000 / (\xput at null}
+ \looprows=0
+ \loop
+ \advance\looprows 1
+ \ifnum\xput at get{if\the\looprows F}=1
+ \else
+ \ifnum\xput at get{if\the\looprows Fix}=0
+ \else
+ \edef\xput at calculategridwidthcalc{\xput at calculategridwidthcalc+10000*\xput at get{\the\looprows H}/\xput at get{\the\looprows W}}
+ \fi
+ \fi
+ \ifnum \looprows<\xput at rowscount
+ \repeat
+
+ \edef\xput at calculategridwidthcalc{\xput at calculategridwidthcalc)}
+ \xput at maxgridwidth=\dimexpr\xput at calculategridwidthcalc\relax
+}
+\newcommand\xput at calculatefullgridwidth{
+ \ifxput at isdoublepage
+ \xput at pagewidth * 2 - \xput at outermargin * 2
+ \ifxput at frontcover
+ \else
+ \ifxput at fanfold
+ \else
+ - \bindingoffset * 2
+ \fi
+ \fi
+ \else
+ \xput at pagewidth - \xput at innermargin - \xput at outermargin
+ \fi
+ + \xput at gutter
+}
+\newcommand\xput at calculaterealgridwidth{
+ \ifxput at isdoublepage
+ (\xput at pagewidth * 2 - \xput at outermargin * 2)
+ \else
+ (\xput at pagewidth - \xput at innermargin - \xput at outermargin)
+ \fi
+}
+\newcommand\xput at gridstartx[1]{
+ \ifdim\dimexpr#1\relax=\xput at undefdim
+ \ifxput at isdoublepage
+ (\xput at outermargin + \xput at leftbleed - \xput at gutter / 2
+ \ifxput at frontcover
+ \else
+ \ifxput at fanfold
+ \else
+ \ifxput at rightpage
+ + \bindingoffset * 2
+ \fi
+ \fi
+ \fi
+ )
+ \else
+ (\xput at leftmargin + \xput at leftbleed - \xput at gutter / 2)
+ \fi
+ \else%
+ \ifxput at isdoublepage
+ (#1 + \xput at leftbleed - \xput at gutter / 2
+ \ifxput at frontcover
+ \else
+ \ifxput at fanfold
+ \else
+ \ifxput at rightpage
+ + \bindingoffset * 2
+ \fi
+ \fi
+ \fi
+ )
+ \else
+ (#1 + \xput at leftbleed - \xput at gutter / 2)
+ \fi
+ \fi%
+}
+\newcommand\xput at gridstarty[1]{
+ \ifdim\dimexpr#1\relax=\xput at undefdim
+ (\xput at bottommargin + \xput at bottombleed - \xput at gutter / 2)%
+ \else%
+ (#1 + \xput at bottombleed - \xput at gutter / 2)
+ \fi%
+}
+\newcommand\xput at setdimensions{
+ \global\xput at gridfullfalse
+ \global\def\xput at framey{0}\global\def\xput at framex{0}\global\def\xput at frameyy{1}\global\def\xput at framexx{1}
+ \global\def\xput at frameyymax{0}\global\def\xput at framexxmax{0}
+ \paperheight=\dimexpr(\xput at pageheight + \xput at topbleed + \xput at bottombleed)\relax
+ \xput at gridoffsetx=\xput at null
+
+ \ifxput at isdoublepage
+ % doublepage
+ \ifxput at fanfold
+ \paperwidth=\dimexpr((\xput at pagewidth + \xput at outerbleed) * 2)\relax
+ \else
+ \paperwidth=\dimexpr(\xput at pagewidth + \xput at outerbleed + \xput at innerbleed)\relax
+ \ifxput at rightpage
+ \xput at gridoffsetx=\dimexpr(-\xput at pagewidth)\relax
+ \fi
+ \fi
+ \else
+ \ifxput at frontcover
+ % frontcover
+ \paperwidth=\dimexpr((\xput at pagewidth + \xput at outerbleed) * 2 + \spinewidth)\relax
+ \else
+ % page
+ \ifxput at fanfold
+ \paperwidth=\dimexpr((\xput at pagewidth + \xput at outerbleed) * 2)\relax
+ \ifxput at rightpage
+ \xput at gridoffsetx=\dimexpr(\xput at pagewidth + \xput at outerbleed - \xput at innerbleed)\relax
+ \fi
+ \else
+ \paperwidth=\dimexpr(\xput at pagewidth + \xput at outerbleed + \xput at innerbleed)\relax
+ \fi
+ \fi
+ \fi
+}
+
+% grid coordinates
+\newcommand\xput at coordxrow[3]{\ifdim\dimexpr#2\dimexpr1pt\relax\relax<\dimexpr(#3\dimexpr1pt\relax-#1sp)\relax\the\numexpr#3\relax\else\xput at coordxrow{#1}{#2}{\numexpr#3+1\relax}\fi}
+\newcommand\xput at coordxcell[2]{\ifnum\numexpr(10000*#1)\relax<\numexpr(#2*10000+1)\relax\the\numexpr#2\relax\else\xput at coordxcell{#1}{\numexpr#2+1\relax}\fi}
+\newcommand\xput at coordx[3]{
+ \xput at get{%
+ \xput at coordxrow{#1}{#2}{1}-%
+ \xput at coordxcell{#3}{1}%
+ WR%
+ }
+}
+\newcommand\posxcell[3]{
+ \ifnum#3>0
+ + \xput at coordx{#1}{#2}{#3}sp%
+ \fi%
+ \ifnum#3>1
+ \posxcell{#1}{#2}{\numexpr#3-1\relax}%
+ \fi%
+}
+\newcommand\posxrow[4]{
+ \ifdim#4\dimexpr1pt\relax<\dimexpr#3\dimexpr1pt\relax+1sp\relax
+ \xput at gridstartxdim + #4\dimexpr\xput at coordx{#1}{#2}{#3}sp\relax - \xput at coordx{#1}{#2}{#3}sp * \numexpr#3 - 1\relax\posxcell{#1}{#2}{\numexpr#3-1\relax}%
+ \else%
+ \posxrow{#1}{#2}{\numexpr#3+1\relax}{#4}%
+ \fi%
+}
+\newcommand\posx[4]{
+ \dimexpr(%
+ \posxrow{#1}{#2}{1}{#4}
+ + #3\xput at gutter / 2 + \xput at gridoffsetx + \xput at gridoffsethorizontal%
+ )\relax%
+}
+\newcommand\posycell[1]{
+ \ifnum#1>0
+ - \xput at get{#1HR} sp
+ \fi%
+ \ifnum#1>1
+ \posycell{\the\numexpr#1-1\relax}%
+ \fi%
+}
+\newcommand\posyrow[2]{
+ \ifdim#1\dimexpr1pt\relax<\dimexpr#2\dimexpr1pt\relax+1sp\relax
+ \xput at gridstartydim + \xput at maxgridheight - #1\dimexpr\xput at get{#2HR} sp\relax + \xput at get{#2HR} sp * \numexpr#2 - 1\relax\posycell{\the\numexpr#2-1\relax}%
+ \else
+ \posyrow{#1}{\the\numexpr#2+1\relax}%
+ \fi
+}
+\newcommand\posy[2]{
+ \dimexpr(%
+ \posyrow{#2}{1}
+ - #1\xput at gutter / 2 - \xput at gridoffsetvertical%
+ )\relax%
+}
+\newcommand\xput at gridhalign[1]{
+ \def\xput at horizontalpagealign{#1}
+}
+\newcommand\xput at gridvalign[1]{
+ \def\xput at verticalpagealign{#1}
+}
+\xput at gridhalign{0.5}
+\xput at gridvalign{0.5}
+\xput at isinitgridtrue
+\setgrid{{{1}}}
+
+% graphic
+\newif\ifxput at isvisible
+\newif\ifxput at calculatecrop
+\newdimen\xput at originalgraphicwidth\newdimen\xput at originalgraphicheight
+\newdimen\xput at cropx\newdimen\xput at cropy
+\newdimen\xput at cropleft\newdimen\xput at cropright
+\newdimen\xput at cropbottom\newdimen\xput at croptop
+\newdimen\xput at cropstart\newdimen\xput at cropend
+\newdimen\xput at snapleft\newdimen\xput at snapright
+\newdimen\xput at snapbottom\newdimen\xput at snaptop
+\newdimen\xput at viewportwidth\newdimen\xput at viewportheight
+\newdimen\xput at frameborderwidth
+\newdimen\xput at frameborderradius
+\newdimen\xput at frameshadowradius
+\newdimen\xput at snapcroptmp
+\newdimen\xput at overprint
+\xput at overprint=0pt
+\def\xput at cropleftside{
+ \ifdim\xput at x>\xput at cropstart
+ \ifdim\xput at x<\xput at cropend
+ \xput at snapleft=\dimexpr(\xput at x - \xput at cropstart)\relax
+ \xput at x=\dimexpr(\xput at cropstart)\relax
+ \fi
+ \fi
+}
+\def\xput at croprightside{
+ \ifdim\xput at xx>\xput at cropstart
+ \ifdim\xput at xx<\xput at cropend
+ \xput at snapright=\dimexpr(\xput at cropend - \xput at xx)\relax
+ \xput at xx=\dimexpr(\xput at cropend)\relax
+ \fi
+ \fi
+}
+\def\xput at snapsafezonevertical{
+ \xput at snapbottom=\xput at null
+ \xput at snaptop=\xput at null
+ \xput at cropstart=-\xput at overprint
+ \xput at cropend=\dimexpr(\xput at null + \xput at bottombleed + 1pt)\relax
+ \ifdim\xput at y>\xput at cropstart
+ \ifdim\xput at y<\xput at cropend
+ \xput at snapbottom=\dimexpr(\xput at y - \xput at cropstart)\relax
+ \xput at y=\dimexpr(\xput at cropstart)\relax
+ \fi
+ \fi
+ \xput at cropstart=\dimexpr(\xput at pageheight + \xput at bottombleed - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pageheight + \xput at bottombleed + \xput at topbleed + \xput at overprint)\relax
+ \ifdim\xput at yy>\xput at cropstart
+ \ifdim\xput at yy<\xput at cropend
+ \xput at snaptop=\dimexpr(\xput at cropend - \xput at yy)\relax
+ \xput at yy=\dimexpr(\xput at cropend)\relax
+ \fi
+ \fi
+}
+\def\xput at snapsafezonehorizontal{
+ \xput at snapleft=\xput at null
+ \xput at snapright=\xput at null
+ \ifxput at isdoublepage
+ % doublepage
+ \ifxput at fanfold
+ \xput at cropstart=-\xput at overprint
+ \xput at cropend=\dimexpr(\xput at null + \xput at leftbleed + 1pt)\relax
+ \xput at cropleftside
+ \xput at cropstart=\dimexpr(\xput at pagewidth * 2 + \xput at outerbleed - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth * 2 + \xput at outerbleed * 2 + \xput at overprint)\relax
+ \xput at croprightside
+ \else
+ \xput at cropstart=-\xput at overprint
+ \xput at cropend=\dimexpr(\xput at null + \xput at leftbleed + 1pt)\relax
+ \xput at cropleftside
+ \xput at cropstart=\dimexpr(\xput at pagewidth + \xput at outerbleed + \xput at innerbleed - \xput at rightbleed - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth + \xput at outerbleed + \xput at innerbleed + \xput at overprint)\relax
+ \xput at croprightside
+ \ifxput at leftpage
+ \xput at cropstart=\dimexpr(\xput at pagewidth * 2 + \xput at outerbleed - \bindingoffset * 2 - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth * 2 + \xput at outerbleed + \xput at outerbleed - \bindingoffset * 2 + \xput at overprint)\relax
+ \xput at croprightside
+ \else
+ \xput at cropstart=\dimexpr(\xput at innerbleed -\xput at pagewidth - \xput at outerbleed + \bindingoffset * 2 - \xput at overprint)\relax
+ \xput at cropend=\dimexpr(-\xput at pagewidth + \xput at innerbleed + \bindingoffset * 2 + 1pt)\relax
+ \xput at cropleftside
+ \fi
+ \fi
+ \else
+ % frontcover
+ \ifxput at frontcover
+ \ifxput at cover
+ \ifxput at backcover
+ \xput at cropstart=-\xput at overprint
+ \xput at cropend=\dimexpr(\xput at null + \xput at leftbleed + 1pt)\relax
+ \else
+ \xput at cropstart=\dimexpr(\xput at pagewidth + \xput at outerbleed)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth + \xput at outerbleed + \spinewidth + 1pt)\relax
+ \fi
+ \xput at cropleftside
+ \ifxput at backcover
+ \xput at cropstart=\dimexpr(\xput at pagewidth + \xput at outerbleed - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth + \xput at outerbleed)\relax
+ \else
+ \xput at cropstart=\dimexpr(\xput at pagewidth * 2 + \spinewidth + \xput at outerbleed - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth * 2 + \xput at outerbleed * 2 + \spinewidth + \xput at overprint)\relax
+ \fi
+ \xput at croprightside
+ \else
+ \xput at cropstart=-\xput at overprint
+ \xput at cropend=\dimexpr(\xput at null + \xput at leftbleed + 1pt)\relax
+ \xput at cropleftside
+ \xput at cropstart=\dimexpr(\xput at pagewidth + \xput at outerbleed + \xput at innerbleed - \xput at rightbleed - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth + \xput at outerbleed + \xput at innerbleed + \xput at overprint)\relax
+ \xput at croprightside
+ \fi
+ \else
+ % page
+ \ifxput at fanfold
+ \xput at cropstart=-\xput at overprint
+ \xput at cropend=\dimexpr(\xput at null + \xput at leftbleed + 1pt)\relax
+ \xput at cropleftside
+ \xput at cropstart=\dimexpr(\xput at pagewidth * 2 + \xput at outerbleed - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth * 2 + \xput at outerbleed * 2 + \xput at overprint)\relax
+ \xput at croprightside
+ \else
+ \xput at cropstart=-\xput at overprint
+ \xput at cropend=\dimexpr(\xput at null + \xput at leftbleed + 1pt)\relax
+ \xput at cropleftside
+ \xput at cropstart=\dimexpr(\xput at pagewidth + \xput at outerbleed + \xput at innerbleed - \xput at rightbleed - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth + \xput at outerbleed + \xput at innerbleed + \xput at overprint)\relax
+ \xput at croprightside
+ \fi
+ \fi
+ \fi
+}
+\pgfkeys{
+ /graphic/.is family,
+ /graphic,
+ file/.store in=\xput at graphicoptionfile,
+ scale/.store in=\xput at graphicoptionscale,
+ vpos/.store in=\xput at graphicoptionvpos,
+ hpos/.store in=\xput at graphicoptionhpos,
+ unsharp/.store in=\xput at graphicoptionunsharp,
+ border/.forward to=/defaultborder/name,
+ border radius/.forward to=/defaultborder/radius,
+ border width/.forward to=/defaultborder/width,
+ border color/.forward to=/defaultborder/color,
+ border opacity/.forward to=/defaultborder/opacity,
+ shadow/.forward to=/defaultshadow/name,
+ shadow size/.forward to=/defaultshadow/size,
+ shadow color/.forward to=/defaultshadow/color,
+ shadow opacity/.forward to=/defaultshadow/opacity,
+ shadow xshift/.forward to=/defaultshadow/xshift,
+ shadow yshift/.forward to=/defaultshadow/yshift,
+}
+\def\xput at checkvisibility{
+ \xput at isvisibletrue
+
+ \ifxput at frontcover
+ \else
+ \ifxput at fanfold
+ \else
+ \ifxput at isdoublepage
+ \ifxput at leftpage
+ \xput at cropstart=\dimexpr(\xput at pagewidth + \xput at outerbleed - \bindingoffset - 1pt)\relax
+ \xput at cropend=\dimexpr(\xput at pagewidth + \xput at outerbleed + \xput at innerbleed)\relax
+ \ifdim\xput at x>\xput at cropstart
+ \xput at isvisiblefalse
+ \fi
+ \else
+ \xput at cropstart=\dimexpr(\xput at null)\relax
+ \xput at cropend=\dimexpr(\xput at null + \xput at leftbleed + \bindingoffset + 1pt)\relax
+ \ifdim\xput at xx<\xput at cropend
+ \xput at isvisiblefalse
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\def\xput at snapoptimizedgraphic{
+ \ifdim\xput at snapleft>\xput at null
+ \width=\dimexpr\width+\xput at snapleft\relax
+ \fi
+ \ifdim\xput at snapright>\xput at null
+ \width=\dimexpr\width+\xput at snapright\relax
+ \fi
+ \ifdim\xput at snaptop>\xput at null
+ \height=\dimexpr\height+\xput at snaptop\relax
+ \fi
+ \ifdim\xput at snapbottom>\xput at null
+ \height=\dimexpr\height+\xput at snapbottom\relax
+ \fi
+}
+\def\xput at snapgraphic{
+ \pgfmathqparse{(\xput at originalgraphicheight-\xput at croptop-\xput at cropbottom)/\height}
+ \edef\xput at scale{\pgfmathresult}
+ \pgfmathqparse{\height/(\xput at originalgraphicheight-\xput at croptop-\xput at cropbottom)}
+ \edef\xput at scalerez{\pgfmathresult}
+
+ % snap
+ \ifdim\xput at snapleft>\xput at null
+ \ifdim\xput at cropleft>\xput at null
+ \ifdim\xput at scale\xput at snapleft>\xput at cropleft
+ \xput at snapbleedleft=\xput at cropleft
+ \xput at snapleft=\dimexpr\xput at snapleft-\xput at scalerez\xput at cropleft\relax
+ \width=\dimexpr\width+\xput at scalerez\xput at cropleft\relax
+ \xput at cropleft=\xput at null
+ \else
+ \xput at snapbleedleft=\dimexpr\xput at scale\xput at snapleft\relax
+ \xput at cropleft=\dimexpr\xput at cropleft-\xput at scale\xput at snapleft\relax
+ \width=\dimexpr\width+\xput at snapleft\relax
+ \xput at snapleft=\xput at null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput at snapright>\xput at null
+ \ifdim\xput at cropright>\xput at null
+ \ifdim\xput at scale\xput at snapright>\xput at cropright
+ \xput at snapbleedright=\xput at cropright
+ \xput at snapright=\dimexpr\xput at snapright-\xput at scalerez\xput at cropright\relax
+ \width=\dimexpr\width+\xput at scalerez\xput at cropright\relax
+ \xput at cropright=\xput at null
+ \else
+ \xput at snapbleedright=\dimexpr\xput at scale\xput at snapright\relax
+ \xput at cropright=\dimexpr\xput at cropright-\xput at scale\xput at snapright\relax
+ \width=\dimexpr\width+\xput at snapright\relax
+ \xput at snapright=\xput at null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput at snaptop>\xput at null
+ \ifdim\xput at croptop>\xput at null
+ \ifdim\xput at scale\xput at snaptop>\xput at croptop
+ \xput at snapbleedtop=\xput at croptop
+ \xput at snaptop=\dimexpr\xput at snaptop-\xput at scalerez\xput at croptop\relax
+ \height=\dimexpr\height+\xput at scalerez\xput at croptop\relax
+ \xput at croptop=\xput at null
+ \else
+ \xput at snapbleedtop=\dimexpr\xput at scale\xput at snaptop\relax
+ \xput at croptop=\dimexpr\xput at croptop-\xput at scale\xput at snaptop\relax
+ \height=\dimexpr\height+\xput at snaptop\relax
+ \xput at snaptop=\xput at null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput at snapbottom>\xput at null
+ \ifdim\xput at cropbottom>\xput at null
+ \ifdim\xput at scale\xput at snapbottom>\xput at cropbottom
+ \xput at snapbleedbottom=\xput at cropbottom
+ \xput at snapbottom=\dimexpr\xput at snapbottom-\xput at scalerez\xput at cropbottom\relax
+ \height=\dimexpr\height+\xput at scalerez\xput at cropbottom\relax
+ \xput at cropbottom=\xput at null
+ \else
+ \xput at snapbleedbottom=\dimexpr\xput at scale\xput at snapbottom\relax
+ \xput at cropbottom=\dimexpr\xput at cropbottom-\xput at scale\xput at snapbottom\relax
+ \height=\dimexpr\height+\xput at snapbottom\relax
+ \xput at snapbottom=\xput at null
+ \fi
+ \fi
+ \fi
+
+ % move
+ \ifdim\xput at snapbottom=\xput at null
+ \ifdim\xput at snaptop=\xput at null
+ \ifdim\xput at snapright>\xput at null
+ \ifdim\xput at cropleft>\xput at null
+ \ifdim\xput at scale\xput at snapright>\xput at cropleft
+ \xput at snapright=\dimexpr\xput at snapright-\xput at scalerez\xput at cropleft\relax
+ \width=\dimexpr\width+\xput at scalerez\xput at cropleft\relax
+ \xput at cropleft=\xput at null
+ \else
+ \xput at cropleft=\dimexpr\xput at cropleft-\xput at scale\xput at snapright\relax
+ \width=\dimexpr\width+\xput at snapright\relax
+ \xput at snapright=\xput at null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput at snapleft>\xput at null
+ \ifdim\xput at cropright>\xput at null
+ \ifdim\xput at scale\xput at snapleft>\xput at cropright
+ \xput at snapleft=\dimexpr\xput at snapleft-\xput at scalerez\xput at cropright\relax
+ \width=\dimexpr\width+\xput at scalerez\xput at cropright\relax
+ \xput at cropright=\xput at null
+ \else
+ \xput at cropright=\dimexpr\xput at cropright-\xput at scale\xput at snapleft\relax
+ \width=\dimexpr\width+\xput at snapleft\relax
+ \xput at snapleft=\xput at null
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \ifdim\xput at snapleft=\xput at null
+ \ifdim\xput at snapright=\xput at null
+ \ifdim\xput at snaptop>\xput at null
+ \ifdim\xput at cropbottom>\xput at null
+ \ifdim\xput at scale\xput at snaptop>\xput at cropbottom
+ \xput at snaptop=\dimexpr\xput at snaptop-\xput at scalerez\xput at cropbottom\relax
+ \height=\dimexpr\height+\xput at scalerez\xput at cropbottom\relax
+ \xput at cropbottom=\xput at null
+ \else
+ \xput at cropbottom=\dimexpr\xput at cropbottom-\xput at scale\xput at snaptop\relax
+ \height=\dimexpr\height+\xput at snaptop\relax
+ \xput at snaptop=\xput at null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput at snapbottom>\xput at null
+ \ifdim\xput at croptop>\xput at null
+ \ifdim\xput at scale\xput at snapbottom>\xput at croptop
+ \xput at snapbottom=\dimexpr\xput at snapbottom-\xput at scalerez\xput at croptop\relax
+ \height=\dimexpr\height+\xput at scalerez\xput at croptop\relax
+ \xput at croptop=\xput at null
+ \else
+ \xput at croptop=\dimexpr\xput at croptop-\xput at scale\xput at snapbottom\relax
+ \height=\dimexpr\height+\xput at snapbottom\relax
+ \xput at snapbottom=\xput at null
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newdimen\xput at snapcropoffset
+\newdimen\xput at snapbleedleft\newdimen\xput at snapbleedright
+\newdimen\xput at snapbleedtop\newdimen\xput at snapbleedbottom
+\def\xput at hscalegraphic{
+ \pgfmathqparse{\width/(\width+\xput at snapleft+\xput at snapright)}
+ \edef\xput at snapscale{\pgfmathresult}
+ \xput at snapcroptmp=\dimexpr\xput at originalgraphicheight-\xput at cropbottom-\xput at croptop-\xput at snapscale\xput at originalgraphicheight+\xput at snapscale\xput at cropbottom+\xput at snapscale\xput at croptop\relax
+ \xput at snapcropoffset=\dimexpr\xput at snapbleedbottom-\xput at snapscale\xput at snapbleedbottom-\xput at snapbleedtop+\xput at snapscale\xput at snapbleedtop\relax
+ \xput at cropbottom=\dimexpr\xput at cropbottom+0.5\xput at snapcroptmp+0.5\xput at snapcropoffset\relax
+ \xput at croptop=\dimexpr\xput at croptop+0.5\xput at snapcroptmp-0.5\xput at snapcropoffset\relax
+
+ \width=\dimexpr\width+\xput at snapleft+\xput at snapright\relax
+ \xput at snapright=\xput at null
+ \xput at snapleft=\xput at null
+}
+\def\xput at vscalegraphic{
+ \pgfmathqparse{\height/(\height+\xput at snaptop+\xput at snapbottom)}
+ \edef\xput at snapscale{\pgfmathresult}
+ \xput at snapcroptmp=\dimexpr\xput at originalgraphicwidth-\xput at cropleft-\xput at cropright-\xput at snapscale\xput at originalgraphicwidth+\xput at snapscale\xput at cropleft+\xput at snapscale\xput at cropright\relax
+ \xput at snapcropoffset=\dimexpr\xput at snapbleedleft-\xput at snapscale\xput at snapbleedleft-\xput at snapbleedright+\xput at snapscale\xput at snapbleedright\relax
+ \xput at cropleft=\dimexpr\xput at cropleft+0.5\xput at snapcroptmp+0.5\xput at snapcropoffset\relax
+ \xput at cropright=\dimexpr\xput at cropright+0.5\xput at snapcroptmp-0.5\xput at snapcropoffset\relax
+
+ \height=\dimexpr\height+\xput at snaptop+\xput at snapbottom\relax
+ \xput at snaptop=\xput at null
+ \xput at snapbottom=\xput at null
+}
+\def\xput at getbase#1{\edef\Gin at base{\filename at area\filename at base}\edef\Gin at ext{#1}}
+\let\xput at getbaseorginal\Gin at getbase
+\def\xput at disablegraphicsfilecheck{
+ \let\Gin at getbase\xput at getbase
+}
+\def\xput at enablegraphicsfilecheck{
+ \let\Gin at getbase\xput at getbaseorginal
+}
+\let\xput at setfileorginal\Gin at setfile
+\def\xput at setfile#1#2#3{
+ \global\edef\xput at currfilebase{\Gin at base}
+ \global\edef\xput at currfileext{\Gin at ext}
+ \global\@onelevel at sanitize\xput at currfileext
+}
+\edef\xput at extjpeg{.jpeg}\@onelevel at sanitize\xput at extjpeg
+\edef\xput at extJPEG{.JPEG}\@onelevel at sanitize\xput at extJPEG
+\edef\xput at extjpg{.jpg}\@onelevel at sanitize\xput at extjpg
+\edef\xput at extJPG{.JPG}\@onelevel at sanitize\xput at extJPG
+\edef\xput at extpng{.png}\@onelevel at sanitize\xput at extpng
+\edef\xput at extPNG{.PNG}\@onelevel at sanitize\xput at extPNG
+\def\isoptimizable#1#2{
+ \ifx#1\xput at extjpg
+ \def\xput at optimizedext{.jpg}#2
+ \else
+ \ifx#1\xput at extJPG
+ \def\xput at optimizedext{.jpg}#2
+ \else
+ \ifx#1\xput at extjpeg
+ \def\xput at optimizedext{.jpg}#2
+ \else
+ \ifx#1\xput at extJPEG
+ \def\xput at optimizedext{.jpg}#2
+ \else
+ \ifx#1\xput at extpng
+ \def\xput at optimizedext{.png}#2
+ \else
+ \ifx#1\xput at extPNG
+ \def\xput at optimizedext{.png}#2
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\def\newgraphic#1#2{
+ \expandafter\newcommand\csname xput at graphic@#1\endcsname[2][0]{%
+ \ifnum##1=0
+ \pgfkeys{pagegraphic,file={#1},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput at unsharp,#2,##2}
+ \else
+ \ifnum##1=1
+ \pgfkeys{backcoverpagegraphic,file={#1},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput at unsharp,#2}
+ \else
+ \pgfkeys{graphic,file={#1},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput at unsharp,#2,##2}
+ \fi
+ \fi
+ }%
+}
+\newcommand\xput at putgraphic[6][]{
+ \xput at x=\posx{1}{#2}{1}{#3}
+ \xput at yy=\posy{1}{#2}
+ \xput at xx=\posx{-1}{#4}{-1}{#5}
+ \xput at y=\posy{-1}{#4}
+
+ \xput at checkvisibility
+
+ \ifxput at isvisible
+ \xput at cropleft=\xput at null
+ \xput at cropbottom=\xput at null
+ \xput at cropright=\xput at null
+ \xput at croptop=\xput at null
+
+ \width=\dimexpr(\xput at xx - \xput at x)\relax
+ \height=\dimexpr(\xput at yy - \xput at y)\relax
+
+ % safezone horizontal
+ \xput at snapsafezonehorizontal
+
+ % safezone vertical
+ \xput at snapsafezonevertical
+
+ \xput at snapbleedleft=\xput at null
+ \xput at snapbleedright=\xput at null
+ \xput at snapbleedtop=\xput at null
+ \xput at snapbleedbottom=\xput at null
+
+ \begingroup
+ \xdef\xput at filename{#6-\xput at density-\xput at graphicoptionscale-\xput at graphicoptionhpos-\xput at graphicoptionvpos-\the\numexpr\xput at snaptop\relax-\the\numexpr\xput at snapright\relax-\the\numexpr\xput at snapbottom\relax-\the\numexpr\xput at snapleft\relax-\the\numexpr\width\relax-\the\numexpr\height\relax-\xput at downsamplethreshold-\xput at graphicoptionunsharp-\xput at quality}
+ \ifxput at optimize
+ \IfFileExists{./cache/\xput at filename/g.jpg}{
+ \def\xput at nextincludegraphic{\includegraphics[width=\width]{cache/\xput at filename/g.jpg}}
+ }{
+ \IfFileExists{./cache/\xput at filename/g.png}{
+ \def\xput at nextincludegraphic{\includegraphics[width=\width]{cache/\xput at filename/g.png}}
+ }{
+ \xput at calculatecroptrue
+ }
+ }
+
+ \ifxput at preflight
+ \xput at calculatecroptrue
+ \fi
+ \else
+ \xput at calculatecroptrue
+ \fi
+
+ \ifxput at calculatecrop
+ \global\edef\xput at currfilebase{}
+ \global\edef\xput at currfileext{}
+ \let\Gin at setfile\xput at setfile
+ \Ginclude at graphics#6
+ \let\Gin at setfile\xput at setfileorginal
+ \ifx\xput at currfileext\xput at emptystring
+ \xput at calculatecropfalse
+ \def\xput at nextincludegraphic{}
+ \fi
+ \fi
+
+ \xput at disablegraphicsfilecheck
+ \ifxput at calculatecrop
+ % graphic crop
+ \settowidth{\xput at originalgraphicwidth}{\includegraphics{\xput at currfilebase\xput at currfileext}}
+ \settoheight{\xput at originalgraphicheight}{\includegraphics{\xput at currfilebase\xput at currfileext}}
+ \pgfmathqparse{1pt-\xput at graphicoptionvpos pt}
+ \edef\xput at graphicoptionvpos{\pgfmathresult}
+ \pgfmathqparse{\xput at originalgraphicwidth/\xput at originalgraphicheight}
+ \edef\xput at graphicratio{\pgfmathresult}
+ \pgfmathqparse{\width/\height}
+ \edef\xput at vpratio{\pgfmathresult}
+ \pgfmathqparse{\xput at graphicratio pt>\xput at vpratio pt}
+ \ifnum\pgfmathresult=1
+ \xput at cropx=\dimexpr(\numexpr(\xput at originalgraphicwidth - \width * \xput at originalgraphicheight / \height)\relax sp)\relax
+ \xput at cropy=\xput at null
+ \else
+ \xput at cropy=\dimexpr(\numexpr(\xput at originalgraphicheight - \height * \xput at originalgraphicwidth / \width)\relax sp)\relax
+ \xput at cropx=\xput at null
+ \fi
+ \xput at viewportwidth=\dimexpr\xput at originalgraphicwidth-\xput at cropx\relax
+ \xput at viewportheight=\dimexpr\xput at originalgraphicheight-\xput at cropy\relax
+ \pgfmathqparse{1pt/\xput at graphicoptionscale pt}
+ \edef\xput at reciprocalscale{\pgfmathresult}
+ \xput at cropx=\dimexpr\xput at cropx + \xput at viewportwidth - \xput at reciprocalscale\xput at viewportwidth\relax
+ \xput at cropy=\dimexpr\xput at cropy + \xput at viewportheight - \xput at reciprocalscale\xput at viewportheight\relax
+ \ifdim\xput at cropx>\xput at null
+ \xput at cropleft=\dimexpr(\xput at graphicoptionhpos\xput at cropx)\relax
+ \ifdim\xput at cropleft<\xput at null
+ \xput at cropleft=\xput at null
+ \fi
+ \ifdim\xput at cropleft>\xput at cropx
+ \xput at cropleft=\xput at cropx
+ \fi
+ \xput at cropright=\dimexpr(\xput at cropx - \xput at cropleft)\relax
+ \fi
+ \ifdim\xput at cropy>\xput at null
+ \xput at cropbottom=\dimexpr(\xput at graphicoptionvpos\xput at cropy)\relax
+ \ifdim\xput at cropbottom<\xput at null
+ \xput at cropbottom=\xput at null
+ \fi
+ \ifdim\xput at cropbottom>\xput at cropy
+ \xput at cropbottom=\xput at cropy
+ \fi
+ \xput at croptop=\dimexpr(\xput at cropy - \xput at cropbottom)\relax
+ \fi
+
+ \xput at snapgraphic
+ \ifdim\dimexpr\xput at snapleft+\xput at snapright\relax=\xput at null
+ \ifdim\dimexpr\xput at snaptop+\xput at snapbottom\relax>\xput at null
+ \xput at vscalegraphic
+ \fi
+ \else
+ \ifdim\dimexpr\xput at snaptop+\xput at snapbottom\relax=\xput at null
+ \ifdim\dimexpr\xput at snapleft+\xput at snapright\relax>\xput at null
+ \xput at hscalegraphic
+ \fi
+ \else
+ \ifdim\dimexpr\width/(\xput at snapleft + \xput at snapright)\relax<\dimexpr\height/(\xput at snaptop + \xput at snapbottom)\relax
+ \xput at hscalegraphic
+
+ \xput at snapgraphic
+ \else
+ \xput at vscalegraphic
+
+ \xput at snapgraphic
+ \fi
+ \fi
+ \fi
+
+ \ifdim\xput at snapleft>\xput at null
+ \xput at x=\dimexpr\xput at x+\xput at snapleft\relax
+ \fi
+ \ifdim\xput at snapbottom>\xput at null
+ \xput at y=\dimexpr\xput at y+\xput at snapbottom\relax
+ \fi
+ \else
+ \xput at snapoptimizedgraphic
+ \fi
+
+ \ifdefined\xput at nextincludegraphic
+ \else
+ \ifxput at optimize
+ \ifxput at isbatchmode
+ \isoptimizable{\xput at currfileext}{\xput at addtobatchlist{\xput at currfilebase}{\xput at currfileext}}
+ \def\xput at nextincludegraphic{}
+ \else
+ \isoptimizable{\xput at currfileext}{\xput at optimizegraphic{\xput at currfilebase}{\xput at currfileext}}
+ \ifdefined\xput at optimizedext
+ \IfFileExists{./cache/\xput at filename/g\xput at optimizedext}{
+ \def\xput at nextincludegraphic{\includegraphics[width=\width]{cache/\xput at filename/g\xput at optimizedext}}
+ }{
+ \ifx\xput at processresult\xput at ok
+ \ClassError{Xput}{Unexpected error. File not optimized}{File `cache/#6/g\xput at optimizedext' not found.\MessageBreak Try to delete the `cache' directory.\MessageBreak\MessageBreak\@ehc}
+ \fi
+ \def\xput at nextincludegraphic{\includegraphics[trim={\xput at cropleft} {\xput at cropbottom} {\xput at cropright} {\xput at croptop},\xput at clip,width=\width]{\xput at currfilebase\xput at currfileext}}
+ }
+ \else
+ \def\xput at nextincludegraphic{\includegraphics[trim={\xput at cropleft} {\xput at cropbottom} {\xput at cropright} {\xput at croptop},\xput at clip,width=\width]{\xput at currfilebase\xput at currfileext}}
+ \fi
+ \fi
+ \else
+ \def\xput at nextincludegraphic{\includegraphics[trim={\xput at cropleft} {\xput at cropbottom} {\xput at cropright} {\xput at croptop},\xput at clip,width=\width]{\xput at currfilebase\xput at currfileext}}
+ \fi
+ \fi
+
+ \ifdim\xput at defaultborderradius>0.5\height
+ \def\xput at defaultborderradius{0.5\height}
+ \fi
+ \ifdim\xput at defaultborderradius>0.5\width
+ \def\xput at defaultborderradius{0.5\width}
+ \fi
+
+ \xput at frameborderwidth=\dimexpr\xput at defaultborderwidth\relax
+ \ifdim\xput at defaultborderradius=0pt
+ \xput at frameborderradius=0pt
+ \xput at frameshadowradius=0pt
+ \else
+ \xput at frameborderradius=\dimexpr\xput at defaultborderradius+0.5\xput at frameborderwidth\relax
+ \xput at frameshadowradius=\dimexpr\xput at defaultborderradius+\xput at frameborderwidth\relax
+ \fi
+
+ % draw shadow
+ \ifxput at isbatchmode
+ \else
+ \def\xput at frameshadowoffsetx{\xput at frameborderwidth}
+ \def\xput at frameshadowoffsety{\xput at frameborderwidth}
+ \def\xput at frameshadowwidth{\dimexpr\width+10cm+2\xput at frameborderwidth\relax}
+ \def\xput at frameshadowheight{\dimexpr\height+10cm+2\xput at frameborderwidth\relax}
+ \def\xput at frameshadowframewidth{\dimexpr\width+2\xput at frameborderwidth\relax}
+ \def\xput at frameshadowframeheight{\dimexpr\height+2\xput at frameborderwidth\relax}
+ \def\xput at frameshadowborder{\dimexpr5cm\relax}
+ \xput at drawshadow
+ \fi
+
+ % draw graphic and border
+ \ifxput at isbatchmode
+ \xput at ismaskrequiredfalse
+ \def\xput at nextincludegraphic{}
+ \else
+ \ifxput at isperformancemode
+ \ifdim\xput at defaultborderwidth>0pt
+ \xput at ismaskrequiredtrue
+ \else
+ \ifdim\xput at defaultborderradius>0pt
+ \xput at ismaskrequiredtrue
+ \else
+ \xput at ismaskrequiredfalse
+ \fi
+ \fi
+ \else
+ \xput at ismaskrequiredtrue
+ \fi
+ \fi
+
+ \ifxput at ismaskrequired
+ \def\xput at clip{}%
+ \else
+ \def\xput at clip{clip}%
+ \fi
+
+ \put(\xput at dimentonumber{\xput at x},\xput at dimentonumber{\xput at y}){%
+ \ifxput at ismaskrequired%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \ifdim\xput at defaultborderwidth>0pt
+ \draw[draw=\xput at defaultbordercolor,draw opacity=\xput at defaultborderopacity,line width=\xput at frameborderwidth,rounded corners=\xput at frameborderradius] (-0.5\xput at frameborderwidth,-0.5\xput at frameborderwidth) rectangle ++(\width+\xput at frameborderwidth,\height+\xput at frameborderwidth);%
+ \fi
+
+ \draw[draw opacity=0,rounded corners=\xput at defaultborderradius,path picture={
+ \node at (0.5\width,0.5\height){
+ \xput at nextincludegraphic
+ };
+ }] (0,0) rectangle ++(\width,\height);%
+ \end{tikzpicture}%
+ \else%
+ \xput at nextincludegraphic
+ \fi%
+ }
+
+ \xput at enablegraphicsfilecheck
+
+ % draw ppi
+ \ifxput at preflight
+ \ifx\xput at nextincludegraphic\xput at emptystring
+ \else
+ \isoptimizable{\xput at currfileext}{\xput at getppi{\xput at currfilebase\xput at currfileext}}
+ \ifdefined\xput at graphicdensity
+ \xput at drawppi{#2}{#3}{#4}{#5}{#6}{\xput at graphicdensity}
+ \fi
+ \fi
+ \fi
+ \endgroup
+ \fi
+}
+\newcommand\xput at drawppi[6]{
+ \xput at x=\posx{1}{#1}{1}{#2}
+ \xput at yy=\posy{1}{#1}
+ \xput at xx=\posx{-1}{#3}{-1}{#4}
+ \xput at y=\posy{-1}{#3}
+ \width=\dimexpr(\xput at xx - \xput at x)\relax
+ \height=\dimexpr(\xput at yy - \xput at y)\relax
+ \def\xput at ppicolor{green!50!black}
+ \def\xput at ppicolortext{white}
+ \ifnum#6<300
+ \def\xput at ppicolor{yellow}
+ \def\xput at ppicolortext{black}
+ \ifnum#6<200
+ \def\xput at ppicolor{red}
+ \def\xput at ppicolortext{white}
+ \xput at errmsg@lowdensity{1}{#5}{#6}
+ \else
+ \xput at errmsg@lowdensity{0}{#5}{#6}
+ \fi
+ \fi
+ \put(\xput at dimentonumber{\xput at x},\xput at dimentonumber{\xput at y}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \node[fill=\xput at ppicolor,fill opacity=0.9,line width=0pt,anchor=north east] at (\width,\height){
+ \color{\xput at ppicolortext}\textbf{#6ppi}
+ };
+ \end{tikzpicture}%
+ }
+}
+
+% pagegraphic
+\def\xput at pagegraphic{}
+\pgfkeys{
+ /pagegraphic/.is family,
+ /pagegraphic,
+ file/.store in=\xput at pagegraphic,
+ scale/.store in=\xput at pagegraphicoptionscale,
+ vpos/.store in=\xput at pagegraphicoptionvpos,
+ hpos/.store in=\xput at pagegraphicoptionhpos,
+ unsharp/.store in=\xput at pagegraphicoptionunsharp,
+}
+\pgfkeys{
+ /backcoverpagegraphic/.is family,
+ /backcoverpagegraphic,
+ file/.store in=\xput at backcoveroptionpagegraphicfile,
+ scale/.store in=\xput at backcoveroptionpagegraphicscale,
+ vpos/.store in=\xput at backcoveroptionpagegraphicvpos,
+ hpos/.store in=\xput at backcoveroptionpagegraphichpos,
+ unsharp/.store in=\xput at backcoveroptionpagegraphicunsharp,
+}
+\def\xput at putpagegraphic{
+ \begingroup
+ \margin=\xput at null
+ \topmargin=\xput at null
+ \bottommargin=\xput at null
+ \innermargin=\xput at null
+ \outermargin=\xput at null
+ \setgrid{{{1}}}
+ \pgfkeys{graphic,scale=\xput at pagegraphicoptionscale,hpos=\xput at pagegraphicoptionhpos,vpos=\xput at pagegraphicoptionvpos,unsharp=\xput at pagegraphicoptionunsharp,border width=0pt,border radius=0pt,shadow size=0}
+ \xput at putgraphic{0}{0}{1}{1}{\xput at pagegraphic}
+ \endgroup
+}
+\newcommand\setpagegraphic[2][]{
+ \ifcsname xput at graphic@#2\endcsname%
+ \csname xput at graphic@#2\endcsname{#1}
+ \else%
+ \pgfkeys{pagegraphic,file={#2},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput at unsharp,#1}
+ \fi
+}
+\def\nopagegraphic{\setpagegraphic{}}
+
+% text
+\newdimen\xput at textboxheight
+\newdimen\xput at textboxwidth
+\newdimen\xput at leftwidth
+\newdimen\xput at rightwidth
+\newcommand\xput at checkside[1]{
+ \ifxput at fanfold
+ \ifxput at isdoublepage
+ \xput at leftwidth=\dimexpr(\xput at pagewidth + \xput at outerbleed - \xput at x)\relax
+ \xput at rightwidth=\dimexpr(\xput at xx - \xput at pagewidth - \xput at outerbleed)\relax
+ \ifdim\xput at rightwidth>\xput at leftwidth
+ \ifnum#1=1
+ \xput at leftpagefalse
+ \xput at rightpagetrue
+ \else
+ \xput at leftpagetrue
+ \xput at rightpagefalse
+ \fi
+ \addtocounter{page}{#1}
+ \fi
+ \fi
+ \fi
+}
+\def\xput at textoptionbottom{bottom}
+\def\xput at textoptioncenter{center}
+\newif\ifxput at text@option at top
+\newif\ifxput at text@option at center
+\newif\ifxput at text@option at bottom
+\newif\ifxput at text@option at parbox
+\newif\ifxput at text@option at breakable
+\let\originaltcbset\tcbset
+\pgfkeys{
+ /inittext/.is family,
+ /inittext,
+ color/.code={\color{#1}},
+ coltext/.forward to=/inittext/color,
+ boxrule/.code={\def\xput at defaultborderwidth{#1}\def\xput at text@option at leftrule{#1}\def\xput at text@option at rightrule{#1}\def\xput at text@option at toprule{#1}\def\xput at text@option at bottomrule{#1}},
+ toprule/.code={\def\xput at text@option at toprule{#1}},
+ rightrule/.code={\def\xput at text@option at rightrule{#1}},
+ bottomrule/.code={\def\xput at text@option at bottomrule{#1}},
+ leftrule/.code={\def\xput at text@option at leftrule{#1}},
+ height/.code={\def\xput at text@option at height{#1}},
+ arc/.code={\ifdim\xput at null=\dimexpr#1\relax\originaltcbset{outer arc=#1}\else\originaltcbset{auto outer arc}\fi\def\xput at defaultborderradius{#1}},
+ colframe/.store in=\xput at defaultbordercolor,
+ opacityframe/.store in=\xput at defaultborderopacity,
+ breakable/.is if=xput at text@option at breakable,
+ .unknown/.code=,
+ library/.unknown/.code=,
+}
+\renewcommand\tcbset[1]{\originaltcbset{#1}\pgfkeys{inittext,#1}}
+\tcbset{
+ boxrule=0pt,
+ boxsep=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,
+ opacityframe=1,
+ colframe=black,
+ opacityback=0,
+ arc=0pt,
+}
+\pgfkeysdef{/text/border}{
+ \ifcsname xput at border@#1\endcsname
+ \csname xput at border@#1\endcsname[1]{}
+ \else
+ \pgfkeys{textborder,opacity=1,width=0pt,color=black,radius=0pt}
+ \xput at errmsg@undefined{border}{#1}
+ \fi
+}
+\pgfkeys{
+ /text/.is family,
+ /text,
+ name/.store in=\xput at text@option at name,
+ color/.code={\originaltcbset{coltext=#1}\def\xput at text@option at color{#1}},
+ opacity/.code={\originaltcbset{opacitytext=#1}},
+ top/.code={\originaltcbset{valign=top}\xput at text@option at toptrue},
+ center/.code={\originaltcbset{valign=center}\xput at text@option at centertrue},
+ bottom/.code={\originaltcbset{valign=bottom}\xput at text@option at bottomtrue},
+ boxrule/.code={\originaltcbset{boxrule=#1}\def\xput at defaultborderwidth{#1}\def\xput at text@option at leftrule{#1}\def\xput at text@option at rightrule{#1}\def\xput at text@option at toprule{#1}\def\xput at text@option at bottomrule{#1}},
+ toprule/.code={\originaltcbset{toprule=#1}\def\xput at text@option at toprule{#1}},
+ rightrule/.code={\originaltcbset{rightrule=#1}\def\xput at text@option at rightrule{#1}},
+ bottomrule/.code={\originaltcbset{bottomrule=#1}\def\xput at text@option at bottomrule{#1}},
+ leftrule/.code={\originaltcbset{leftrule=#1}\def\xput at text@option at leftrule{#1}},
+ height/.code={\originaltcbset{height=#1}\def\xput at text@option at height{#1}},
+ parbox/.is if=xput at text@option at parbox,
+ breakable/.is if=xput at text@option at breakable,
+ border radius/.code={\originaltcbset{arc=#1}\ifdim\xput at null=\dimexpr#1\relax\originaltcbset{outer arc=#1}\else\originaltcbset{auto outer arc}\fi\def\xput at defaultborderradius{#1}},
+ arc/.forward to=/text/border radius,
+ border width/.forward to=/text/boxrule,
+ border color/.code={\originaltcbset{colframe=#1}\def\xput at defaultbordercolor{#1}},
+ border opacity/.code={\originaltcbset{opacityframe=#1}\def\xput at defaultborderopacity{#1}},
+ shadow/.forward to=/defaultshadow/name,
+ shadow size/.forward to=/defaultshadow/size,
+ shadow color/.forward to=/defaultshadow/color,
+ shadow opacity/.forward to=/defaultshadow/opacity,
+ shadow xshift/.forward to=/defaultshadow/xshift,
+ shadow yshift/.forward to=/defaultshadow/yshift,
+ .unknown/.code={\originaltcbset{\pgfkeyscurrentname=#1}}
+}
+\newdimen\xput at tcbheight
+\newcommand\xput at puttext[5]{
+ \ifxput at isbatchmode
+ \else
+ \xput at x=\posx{1}{#1}{1}{#2}
+ \xput at xx=\posx{-1}{#3}{-1}{#4}
+ \xput at y=\posy{-1}{#3}
+ \xput at yy=\posy{1}{#1}
+
+ \xput at xx=\dimexpr\xput at xx+\xput at text@option at rightrule\relax
+ \xput at x=\dimexpr\xput at x-\xput at text@option at leftrule\relax
+ \xput at yy=\dimexpr\xput at yy+\xput at text@option at toprule\relax
+ \xput at y=\dimexpr\xput at y-\xput at text@option at bottomrule\relax
+
+ \width=\dimexpr(\xput at xx - \xput at x)\relax
+ \height=\dimexpr(\xput at yy - \xput at y)\relax
+ \xput at textboxwidth=\dimexpr(\xput at xx - \xput at x)\relax
+ \xput at textboxheight=\dimexpr(\xput at yy - \xput at y)\relax
+
+ \ifdefined\xput at text@option at height
+ \ifdim\xput at text@option at height=\height
+ \else
+ \xput at tcbheight=\dimexpr\xput at text@option at height\ifdefined\xput at text@option at toprule+\xput at text@option at toprule\else\ifdefined\xput at defaultborderwidth+\xput at defaultborderwidth\fi\fi\ifdefined\xput at text@option at bottomrule+\xput at text@option at bottomrule\else\ifdefined\xput at defaultborderwidth+\xput at defaultborderwidth\fi\fi\relax
+ \originaltcbset{height=\xput at tcbheight}
+ \fi
+ \else
+ \fi
+
+ \xput at checkvisibility
+ \ifxput at isvisible
+ \xput at checkside{1}
+ \ifxput at text@option at parbox
+ \ifdim\xput at textboxheight<\xput at null
+ \xput at yy=\dimexpr\xput at yy-\xput at textboxheight\relax
+ \xput at textboxheight=\dimexpr-1\xput at textboxheight\relax
+ \fi
+ \put(\xput at dimentonumber{\xput at x},\xput at dimentonumber{\xput at yy}){%
+ \parbox[t][\xput at textboxheight][\ifxput at text@option at center c\else\ifxput at text@option at bottom b\else t\fi\fi]{\xput at textboxwidth}{\vskip \xput at null
+ \color{\xput at text@option at color}%
+ #5%
+ }
+ }
+ \else
+ \ifdim\xput at text@option at bottomrule<\xput at text@option at toprule
+ \def\xput at text@minvborderwidth{\xput at text@option at bottomrule}
+ \def\xput at text@maxvborderwidth{\xput at text@option at toprule}
+ \else
+ \def\xput at text@minvborderwidth{\xput at text@option at toprule}
+ \def\xput at text@maxvborderwidth{\xput at text@option at bottomrule}
+ \fi
+ \ifdim\xput at text@option at leftrule<\xput at text@option at rightrule
+ \def\xput at text@minhborderwidth{\xput at text@option at leftrule}
+ \def\xput at text@maxhborderwidth{\xput at text@option at rightrule}
+ \else
+ \def\xput at text@minhborderwidth{\xput at text@option at rightrule}
+ \def\xput at text@maxhborderwidth{\xput at text@option at leftrule}
+ \fi
+ \ifdim\xput at text@minvborderwidth<\xput at text@minhborderwidth
+ \def\xput at text@minborderwidth{\xput at text@minvborderwidth}
+ \def\xput at text@maxborderwidth{\xput at text@maxhborderwidth}
+ \else
+ \def\xput at text@minborderwidth{\xput at text@minhborderwidth}
+ \def\xput at text@maxborderwidth{\xput at text@maxvborderwidth}
+ \fi
+ \ifdim\xput at text@maxborderwidth=\xput at null
+ \originaltcbset{opacityframe=0}
+ \fi
+
+ \ifxput at text@option at breakable
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @offsetx\endcsname{\xput at text@option at leftrule}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @offsety\endcsname{\xput at text@option at bottomrule}
+ \else
+ \def\xput at text@option at name{xput at unbreakable}
+ \fi
+ \ifcsname xput at textarray@\xput at text@option at name @index\endcsname
+ \global\expandafter\csname xput at textarray@\xput at text@option at name @index\endcsname 0 \relax%
+ \boxarrayclear[\xput at text@option at name]
+ \else
+ \global\expandafter\newcount\csname xput at textarray@\xput at text@option at name @index\endcsname%
+ \newboxarray{\xput at text@option at name}
+ \fi
+ \put(0,0){
+ \ifxput at text@option at breakable%
+ \begin{tcolorbox}[
+ standard jigsaw,
+ width=\width,
+ enforce breakable,
+ break at=\height,
+ height fixed for=all,
+ reset box array=\xput at text@option at name,
+ store to box array=\xput at text@option at name,
+ ]%
+ #5
+ \end{tcolorbox}%
+ \else%
+ \begin{tcolorbox}[
+ standard jigsaw,
+ width=\width,
+ reset box array=\xput at text@option at name,
+ store to box array=\xput at text@option at name,
+ ]%
+ #5
+ \end{tcolorbox}%
+ \fi%
+ }
+ \global\expandafter\advance\csname xput at textarray@\xput at text@option at name @index\endcsname by 1%
+
+ \boxarraygetheight[\xput at text@option at name]{\xput at text@height}{1}
+ \ifxput at text@option at bottom
+ \xput at yy=\dimexpr\xput at yy-(\xput at textboxheight-\xput at text@height)\relax
+ \else
+ \ifxput at text@option at center
+ \xput at yy=\dimexpr\xput at yy-(\xput at textboxheight-\xput at text@height)/2\relax
+ \fi
+ \fi
+ \xput at textboxheight=\xput at text@height
+ \xput at y=\dimexpr\xput at yy-\xput at textboxheight\relax
+
+ % draw shadow
+ \xput at ifshadow{
+ \ifdefined\xput at defaultborderradius
+ \ifdim\xput at defaultborderradius=0pt
+ \xput at frameshadowradius=0pt
+ \else
+ \xput at frameshadowradius=\dimexpr\xput at defaultborderradius+\xput at text@minborderwidth\relax
+ \fi
+ \else
+ \xput at frameshadowradius=0pt
+ \fi
+
+ \def\xput at frameshadowoffsetx{0pt}
+ \def\xput at frameshadowoffsety{0pt}
+
+ \def\xput at frameshadowwidth{\dimexpr\width+10cm\relax}
+ \def\xput at frameshadowheight{\dimexpr\xput at textboxheight+10cm\relax}
+ \def\xput at frameshadowframewidth{\width}
+ \def\xput at frameshadowframeheight{\xput at textboxheight}
+ \def\xput at frameshadowborder{\dimexpr5cm\relax}
+ \ifxput at text@option at breakable
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @shadowsize\endcsname{\xput at defaultshadowsize}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @shadowcolor\endcsname{\xput at defaultshadowcolor}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @shadowopacity\endcsname{\xput at defaultshadowopacity}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @shadowxshift\endcsname{\xput at defaultshadowxshift}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @shadowyshift\endcsname{\xput at defaultshadowyshift}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @frameshadowwidth\endcsname{\the\xput at frameshadowwidth}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @frameshadowheight\endcsname{\the\xput at frameshadowheight}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @frameshadowframewidth\endcsname{\the\xput at frameshadowframewidth}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @frameshadowframeheight\endcsname{\the\xput at frameshadowframeheight}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @frameshadowborder\endcsname{\the\xput at frameshadowborder}
+ \expandafter\xdef\csname xput at textarray@\xput at text@option at name @frameshadowradius\endcsname{\the\xput at frameshadowradius}
+ \fi
+ \xput at drawshadow
+ }
+
+ \put(\xput at dimentonumber{\xput at x},\xput at dimentonumber{\xput at y}){%
+ \consumeboxarray[\xput at text@option at name]{\the\csname xput at textarray@\xput at text@option at name @index\endcsname}%
+ }
+ \fi
+ \xput at checkside{-1}
+ \fi
+ \fi
+}
+\newcommand\xput at putusetext[5][default]{
+ \ifxput at isbatchmode
+ \else
+ \xput at x=\posx{1}{#2}{1}{#3}
+ \xput at xx=\posx{-1}{#4}{-1}{#5}
+ \xput at y=\posy{-1}{#4}
+ \xput at yy=\posy{1}{#2}
+ \width=\dimexpr(\xput at xx - \xput at x)\relax
+ \height=\dimexpr(\xput at yy - \xput at y)\relax
+ \xput at textboxwidth=\dimexpr(\xput at xx - \xput at x)\relax
+ \xput at textboxheight=\dimexpr(\xput at yy - \xput at y)\relax
+
+ \xput at checkvisibility
+ \ifxput at isvisible
+ \ifcsname xput at textarray@#1 at index\endcsname
+ \global\expandafter\advance\csname xput at textarray@#1 at index\endcsname by 1%
+
+ \xput at y=\dimexpr\xput at yy-\xput at textboxheight\relax
+
+ \ifcsname xput at textarray@#1 at shadowsize\endcsname
+ \def\xput at frameshadowoffsetx{\expandafter\csname xput at textarray@#1 at offsetx\endcsname}
+ \def\xput at frameshadowoffsety{\expandafter\csname xput at textarray@#1 at offsety\endcsname}
+
+ \def\xput at frameshadowwidth{\dimexpr\expandafter\csname xput at textarray@#1 at frameshadowwidth\endcsname\relax}
+ \def\xput at frameshadowheight{\dimexpr\expandafter\csname xput at textarray@#1 at frameshadowheight\endcsname\relax}
+ \def\xput at frameshadowframewidth{\dimexpr\expandafter\csname xput at textarray@#1 at frameshadowframewidth\endcsname\relax}
+ \def\xput at frameshadowframeheight{\dimexpr\expandafter\csname xput at textarray@#1 at frameshadowframeheight\endcsname\relax}
+ \def\xput at frameshadowborder{\dimexpr\expandafter\csname xput at textarray@#1 at frameshadowborder\endcsname\relax}
+ \def\xput at frameshadowradius{\dimexpr\expandafter\csname xput at textarray@#1 at frameshadowradius\endcsname\relax}
+
+ \def\xput at defaultshadowsize{\expandafter\csname xput at textarray@#1 at shadowsize\endcsname}
+ \def\xput at defaultshadowcolor{\expandafter\csname xput at textarray@#1 at shadowcolor\endcsname}
+ \def\xput at defaultshadowopacity{\expandafter\csname xput at textarray@#1 at shadowopacity\endcsname}
+ \def\xput at defaultshadowxshift{\dimexpr\expandafter\csname xput at textarray@#1 at shadowxshift\endcsname\relax}
+ \def\xput at defaultshadowyshift{\dimexpr\expandafter\csname xput at textarray@#1 at shadowyshift\endcsname\relax}
+
+ \xput at drawshadow
+ \fi
+
+ \xput at checkside{1}
+ \put(\xput at dimentonumber{\xput at x-\expandafter\csname xput at textarray@#1 at offsetx\endcsname},\xput at dimentonumber{\xput at y-\expandafter\csname xput at textarray@#1 at offsety\endcsname}){%
+ \consumeboxarray[#1]{\the\csname xput at textarray@#1 at index\endcsname}%
+ }
+ \xput at checkside{-1}
+ \else
+ \xput at errmsg@undefined{breakable text}{#1}
+ \fi
+ \fi
+ \fi
+}
+
+% xput
+\newcommand\xput at putxput[6][0]{
+ \xput at x=\posx{1}{#2}{1}{#3}
+ \xput at xx=\posx{-1}{#4}{-1}{#5}
+ \xput at y=\posy{-1}{#4}
+ \xput at yy=\posy{1}{#2}
+
+ \xput at checkvisibility
+ \ifxput at isvisible
+ \ifnum#1=1
+ \xput at snapsafezonehorizontal
+ \xput at snapsafezonevertical
+ \fi
+
+ \width=\dimexpr(\xput at xx - \xput at x)\relax
+ \height=\dimexpr(\xput at yy - \xput at y)\relax
+
+ \put(\xput at dimentonumber{\xput at x},\xput at dimentonumber{\xput at y}){%
+ \ifx\xput at pageoptioncolor\xput at emptystring
+ \color{\xputoptions at color}%
+ \else
+ \color{\xput at pageoptioncolor}%
+ \fi
+ #6
+ }
+ \fi
+}
+
+% tikzgraphic
+\newcommand\xput at puttikz[6][0]{
+ \ifxput at isbatchmode
+ \else
+ \xput at putxput[#1]{#2}{#3}{#4}{#5}{%
+ \begin{tikzpicture}
+ \pgflowlevelsynccm
+ #6
+ \end{tikzpicture}
+ }
+ \fi
+}
+
+% border
+\def\xput at defaultborderwidth{0pt}
+\def\xput at defaultborderradius{0pt}
+\def\xput at defaultbordercolor{black}
+\def\xput at defaultborderopacity{1}
+\pgfkeysdef{/defaultborder/name}{
+ \ifcsname xput at border@#1\endcsname
+ \csname xput at border@#1\endcsname{}
+ \else
+ \pgfkeys{defaultborder,opacity=1,width=0pt,color=black,radius=0pt}
+ \xput at errmsg@undefined{border}{#1}
+ \fi
+}
+\newcommand\newborder[2]{
+ \expandafter\newcommand\csname xput at border@#1\endcsname[2][0]{%
+ \ifnum##1=1
+ \pgfkeys{textborder,opacity=1,width=0pt,color=black,radius=0pt,#2}
+ \else
+ \pgfkeys{defaultborder,opacity=1,width=0pt,color=black,radius=0pt,#2,##2}
+ \fi
+ }%
+}
+\pgfkeys{
+ /textborder/.is family,
+ /textborder,
+ radius/.forward to=/text/border radius,
+ width/.forward to=/text/border width,
+ color/.forward to=/text/border color,
+ opacity/.forward to=/text/border opacity,
+}
+\pgfkeys{
+ /defaultborder/.is family,
+ /defaultborder,
+ radius/.store in=\xput at defaultborderradius,
+ width/.store in=\xput at defaultborderwidth,
+ color/.store in=\xput at defaultbordercolor,
+ opacity/.store in=\xput at defaultborderopacity,
+}
+\newcommand\setborder[2][]{
+ \ifxput at placeholdermode
+ \ifnum\xput at contentcounter<\xput at placeholdercounter
+ \xput at border{#1}{#2}
+ \fi
+ \else
+ \xput at border{#1}{#2}
+ \fi
+}
+\def\noborder{\setborder{}}
+\newcommand\xput at border[2]{
+ \pgfkeys{defaultborder,width=0pt,color=black,opacity=1,radius=0pt,#1}
+ \ifcsname xput at border@#2\endcsname
+ \csname xput at border@#2\endcsname{#1}
+ \fi
+}
+
+% shadow
+\def\xput at defaultshadowsize{0}
+\def\xput at defaultshadowopacity{0.4}
+\def\xput at defaultshadowcolor{black}
+\def\xput at defaultshadowxshift{0pt}
+\def\xput at defaultshadowyshift{0pt}
+\pgfkeysdef{/defaultshadow/name}{
+ \ifcsname xput at shadow@#1\endcsname
+ \csname xput at shadow@#1\endcsname{}
+ \else
+ \pgfkeys{defaultshadow,opacity=0.4,size=0,color=black,xshift=0pt,yshift=0pt}
+ \xput at errmsg@undefined{shadow}{#1}
+ \fi
+}
+\newcommand\newshadow[2]{
+ \expandafter\newcommand\csname xput at shadow@#1\endcsname[1]{%
+ \pgfkeys{defaultshadow,opacity=0.4,size=0,color=black,xshift=0pt,yshift=0pt,#2,##1}
+ }%
+}
+\pgfkeys{
+ /defaultshadow/.is family,
+ /defaultshadow,
+ size/.store in=\xput at defaultshadowsize,
+ color/.store in=\xput at defaultshadowcolor,
+ opacity/.store in=\xput at defaultshadowopacity,
+ xshift/.store in=\xput at defaultshadowxshift,
+ yshift/.store in=\xput at defaultshadowyshift,
+}
+\newcommand\setshadow[2][]{
+ \ifxput at placeholdermode
+ \ifnum\xput at contentcounter<\xput at placeholdercounter
+ \xput at shadow{#1}{#2}
+ \fi
+ \else
+ \xput at shadow{#1}{#2}
+ \fi
+}
+\def\noshadow{\setshadow{}}
+\newcommand\xput at shadow[2]{
+ \pgfkeys{defaultshadow,size=0pt,color=black,opacity=1,xshift=0pt,yshift=0pt,#1}
+ \ifcsname xput at shadow@#2\endcsname
+ \csname xput at shadow@#2\endcsname{#1}
+ \fi
+}
+\newcommand\xput at ifshadow[1]{
+ \ifdim\dimexpr\xput at defaultshadowsize pt\relax>\xput at null
+ #1
+ \else
+ \ifdim\xput at defaultshadowxshift>\xput at null
+ #1
+ \else
+ \ifdim\xput at defaultshadowyshift>\xput at null
+ #1
+ \fi
+ \fi
+ \fi
+}
+\def\xput at drawshadow{
+ \xput at ifshadow{
+ \xdef\xput at shadowid{shadow-\xput at defaultshadowsize-\xput at defaultshadowcolor-\xput at defaultshadowopacity-\the\numexpr\xput at frameshadowwidth\relax-\the\numexpr\xput at frameshadowheight\relax-\the\numexpr\xput at frameshadowradius\relax-\the\numexpr\xput at frameshadowborder\relax}
+ \IfFileExists{./cache/\xput at shadowid/s.pdf}{
+ \put(\xput at dimentonumber{\dimexpr\xput at x-5cm-\xput at frameshadowoffsetx+\xput at defaultshadowxshift\relax},\xput at dimentonumber{\dimexpr\xput at y-5cm-\xput at frameshadowoffsety-\xput at defaultshadowyshift\relax}){%
+ \includegraphics[width=\xput at frameshadowwidth]{cache/\xput at shadowid/s.pdf}
+ }
+ }{
+ \xput at makeshadow{\xput at shadowid}
+ \IfFileExists{./cache/\xput at shadowid/s.pdf}{
+ \put(\xput at dimentonumber{\dimexpr\xput at x-5cm-\xput at frameshadowoffsetx+\xput at defaultshadowxshift\relax},\xput at dimentonumber{\dimexpr\xput at y-5cm-\xput at frameshadowoffsety-\xput at defaultshadowyshift\relax}){%
+ \includegraphics[width=\xput at frameshadowwidth]{cache/\xput at shadowid/s.pdf}
+ }
+ }{
+ \ifx\xput at processresult\xput at ok
+ \ClassError{Xput}{Unexpected error. Shadow not created}{File `cache/\xput at shadowid/s.pdf' not\MessageBreak found.\MessageBreak\MessageBreak\@ehc}
+ \fi
+ }
+ }
+ }
+}
+
+% layout helper
+\def\xput at gridcolor{green!90!black}
+\def\xput at gridopacity{0.8}
+\def\xput at gutteropacity{0.2}
+\newdimen\xput at gridx
+\newdimen\xput at gridxx
+\newdimen\xput at gridy
+\newdimen\xput at gridyy
+\newcommand\xput at putgrid{
+ \ifxput at isemptypage
+ \else
+ \ifxput at grid
+ \xput at gridx=\posx{1}{1}{1}{0}
+ \xput at gridxx=\posx{-1}{1}{-1}{\xput at get{1C}}
+ \xput at gridy=\posy{1}{0}
+ \xput at gridyy=\posy{-1}{\xput at rowscount}
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \foreach \rowI in {1,...,\xput at rowscount} {
+ \ifnum\rowI<\xput at rowscount
+ \ifdim\xput at gutter=\xput at null
+ \draw[line cap=rect,line width=0.2mm,draw=\xput at gridcolor,opacity=\xput at gridopacity] ({\xput at gridx+0.05mm},{\posy{0}{\rowI}}) -- ({\xput at gridxx-0.05mm},{\posy{0}{\rowI}});%
+ \else
+ \draw[line cap=rect,line width=\xput at gutter,draw=\xput at gridcolor,opacity=\xput at gutteropacity] ({\xput at gridx+\xput at gutter/2},{\posy{0}{\rowI}}) -- ({\xput at gridxx-\xput at gutter/2},{\posy{0}{\rowI}});%
+ \fi
+ \fi
+ \ifnum\numexpr\xput at get{\rowI C} - 1\relax>0
+ \foreach \cellI in {1,...,\numexpr\xput at get{\rowI C} - 1\relax} {
+ \ifdim\xput at gutter=\xput at null
+ \draw[line width=0.2mm,draw=\xput at gridcolor,opacity=\xput at gridopacity] ({\posx{-1}{\rowI}{0}{\cellI}},{\posy{1}{\numexpr\rowI - 1\relax}}) -- ({\posx{-1}{\rowI}{0}{\cellI}},{\posy{-1}{\rowI}});%
+ \else
+ \draw[line width=\xput at gutter,draw=\xput at gridcolor,opacity=\xput at gutteropacity] ({\posx{-1}{\rowI}{0}{\cellI}},{\posy{1}{\numexpr\rowI - 1\relax}}) -- ({\posx{-1}{\rowI}{0}{\cellI}},{\posy{-1}{\rowI}});%
+ \fi
+ }
+ \fi
+ }
+ \draw[line width=0.2mm,draw=\xput at gridcolor,opacity=\xput at gridopacity] ({\xput at gridx},{\xput at gridy}) rectangle ({\xput at gridxx},{\xput at gridyy});%
+ \ifdim\xput at gridoffsethorizontal>0.001pt
+ \draw[line width=0.2mm,dash pattern={on 1mm off 1mm},draw=\xput at gridcolor,opacity=\xput at gridopacity] (\xput at gridx,\xput at gridy) -- (\xput at gridx-\xput at gridoffsethorizontal,\xput at gridy) -- (\xput at gridx-\xput at gridoffsethorizontal,\xput at gridyy) -- (\xput at gridx,\xput at gridyy);%
+ \fi
+ \ifdim\xput at gridoffsethorizontaln>0.001pt
+ \draw[line width=0.2mm,dash pattern={on 1mm off 1mm},draw=\xput at gridcolor,opacity=\xput at gridopacity] (\xput at gridxx,\xput at gridy) -- (\xput at gridxx+\xput at gridoffsethorizontaln,\xput at gridy) -- (\xput at gridxx+\xput at gridoffsethorizontaln,\xput at gridyy) -- (\xput at gridxx,\xput at gridyy);%
+ \fi
+ \ifdim\xput at gridoffsetvertical>0.001pt
+ \draw[line width=0.2mm,dash pattern={on 1mm off 1mm},draw=\xput at gridcolor,opacity=\xput at gridopacity] (\xput at gridx,\xput at gridy) -- (\xput at gridx,\xput at gridy+\xput at gridoffsetvertical)-- (\xput at gridxx,\xput at gridy+\xput at gridoffsetvertical) -- (\xput at gridxx,\xput at gridy);%
+ \fi
+ \ifdim\xput at gridoffsetverticaln>0.001pt
+ \draw[line width=0.2mm,dash pattern={on 1mm off 1mm},draw=\xput at gridcolor,opacity=\xput at gridopacity] ({\xput at gridx},{\xput at gridyy}) --({\xput at gridx},{\xput at gridyy-\xput at gridoffsetverticaln}) -- ({\xput at gridxx},{\xput at gridyy-\xput at gridoffsetverticaln}) -- ({\xput at gridxx},{\xput at gridyy});%
+ \fi
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+}
+\def\xput at bleedcolor{red}
+\def\xput at bleedopacity{0.5}
+\newif\ifxput at putbleed
+\newcommand\xput at checkbleed{
+ \ifdim\xput at topbleed>\xput at null
+ \xput at putbleedtrue
+ \else
+ \ifdim\xput at bottombleed>\xput at null
+ \xput at putbleedtrue
+ \else
+ \ifdim\xput at innerbleed>\xput at null
+ \xput at putbleedtrue
+ \else
+ \ifdim\xput at outerbleed>\xput at null
+ \xput at putbleedtrue
+ \else
+ \xput at putbleedfalse
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput at putbleed{
+ \ifxput at isemptypage
+ \else
+ \ifxput at safezone
+ \xput at checkbleed
+ \ifxput at putbleed
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \ifxput at frontcover
+ \ifxput at backcover
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, \xput at pageheight + \xput at bottombleed) rectangle ++(\xput at pagewidth + \xput at outerbleed,\xput at topbleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, 0) rectangle ++(\xput at pagewidth + \xput at outerbleed,\xput at bottombleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, \xput at bottombleed) rectangle ++(\xput at outerbleed,\xput at pageheight);%
+ \else
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (\xput at pagewidth + \xput at outerbleed, \xput at pageheight + \xput at bottombleed) rectangle ++(\xput at pagewidth + \xput at outerbleed + \spinewidth,\xput at topbleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (\xput at pagewidth + \xput at outerbleed, 0) rectangle ++(\xput at pagewidth + \xput at outerbleed + \spinewidth,\xput at bottombleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (\xput at pagewidth * 2 + \xput at outerbleed + \spinewidth, \xput at bottombleed) rectangle ++(\xput at outerbleed,\xput at pageheight);%
+ \fi
+ \else
+ \ifxput at fanfold
+ \ifxput at isdoublepage
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, \xput at pageheight + \xput at bottombleed) rectangle ++(\xput at pagewidth * 2 + \xput at outerbleed * 2,\xput at topbleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, 0) rectangle ++(\xput at pagewidth * 2 + \xput at outerbleed * 2,\xput at bottombleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, \xput at bottombleed) rectangle ++(\xput at outerbleed,\xput at pageheight);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (\xput at pagewidth * 2 + \xput at outerbleed, \xput at bottombleed) rectangle ++(\xput at outerbleed,\xput at pageheight);%
+ \else
+ \ifxput at leftpage
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, \xput at pageheight + \xput at bottombleed) rectangle ++(\xput at pagewidth + \xput at outerbleed,\xput at topbleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, 0) rectangle ++(\xput at pagewidth + \xput at outerbleed,\xput at bottombleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, \xput at bottombleed) rectangle ++(\xput at outerbleed,\xput at pageheight);%
+ \else
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (\xput at pagewidth + \xput at outerbleed, \xput at pageheight + \xput at bottombleed) rectangle ++(\xput at pagewidth + \xput at outerbleed,\xput at topbleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (\xput at pagewidth + \xput at outerbleed, 0) rectangle ++(\xput at pagewidth + \xput at outerbleed,\xput at bottombleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (\xput at pagewidth * 2 + \xput at outerbleed, \xput at bottombleed) rectangle ++(\xput at outerbleed,\xput at pageheight);%
+ \fi
+ \fi
+ \else
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, \xput at pageheight + \xput at bottombleed) rectangle ++(\xput at pagewidth + \xput at leftbleed + \xput at rightbleed,\xput at topbleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, 0) rectangle ++(\xput at pagewidth + \xput at leftbleed + \xput at rightbleed,\xput at bottombleed);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (0, \xput at bottombleed) rectangle ++(\xput at leftbleed,\xput at pageheight);%
+ \fill[\xput at bleedcolor,opacity=\xput at bleedopacity] (\xput at pagewidth + \xput at leftbleed, \xput at bottombleed) rectangle ++(\xput at rightbleed,\xput at pageheight);%
+ \fi
+ \fi
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \fi
+}
+\newdimen\xput at cuttingmarka
+\newdimen\xput at cuttingmarkb
+\xput at cuttingmarka=-3mm
+\xput at cuttingmarkb=-1mm
+\newcommand\xput at putcuttingmarks{
+ \ifxput at isemptypage
+ \ifxput at fanfold
+ \xput at cuttingmarksvisibletrue
+ \fi
+ \else
+ \xput at cuttingmarksvisibletrue
+ \fi
+ \ifxput at cuttingmarksvisible
+ \ifxput at cuttingmarks
+ \ifxput at safezone
+ \else
+ \xput at checkbleed
+ \ifxput at putbleed
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \ifxput at frontcover
+ \ifxput at backcover
+ \draw[\xput at pageoptioncolor,line width=0.15mm](\xput at outerbleed + \xput at cuttingmarka, \xput at bottombleed) -- (\xput at outerbleed + \xput at cuttingmarkb, \xput at bottombleed);%
+ \draw[\xput at pageoptioncolor,line width=0.15mm](\xput at outerbleed, \xput at bottombleed + \xput at cuttingmarka) -- (\xput at outerbleed, \xput at bottombleed + \xput at cuttingmarkb);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed + \xput at cuttingmarka, \xput at bottombleed+\xput at pageheight) -- (\xput at outerbleed + \xput at cuttingmarkb, \xput at bottombleed + \xput at pageheight);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed, \xput at bottombleed + \xput at pageheight - \xput at cuttingmarka) -- (\xput at outerbleed, \xput at bottombleed + \xput at pageheight - \xput at cuttingmarkb);%
+ \else
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed + \spinewidth - \xput at cuttingmarka, \xput at bottombleed) -- (2\xput at pagewidth + \xput at outerbleed + \spinewidth - \xput at cuttingmarkb, \xput at bottombleed);%
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed + \spinewidth, \xput at bottombleed + \xput at cuttingmarka) -- (2\xput at pagewidth + \xput at outerbleed + \spinewidth, \xput at bottombleed + \xput at cuttingmarkb);%
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed + \spinewidth - \xput at cuttingmarka, \xput at bottombleed+\xput at pageheight) -- (2\xput at pagewidth + \xput at outerbleed + \spinewidth - \xput at cuttingmarkb, \xput at bottombleed+\xput at pageheight);%
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed + \spinewidth, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarka) -- (2\xput at pagewidth + \xput at outerbleed + \spinewidth, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarkb);%
+ \fi
+ \else
+ \ifxput at fanfold
+ \ifxput at isdoublepage
+ \draw[\xput at pageoptioncolor](\xput at outerbleed + \xput at cuttingmarka, \xput at bottombleed) -- (\xput at outerbleed + \xput at cuttingmarkb, \xput at bottombleed);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed, \xput at bottombleed + \xput at cuttingmarka) -- (\xput at outerbleed, \xput at bottombleed + \xput at cuttingmarkb);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed + \xput at cuttingmarka, \xput at bottombleed+\xput at pageheight) -- (\xput at outerbleed + \xput at cuttingmarkb, \xput at bottombleed+\xput at pageheight);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarka) -- (\xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarkb);%
+
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarka, \xput at bottombleed) -- (2\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarkb, \xput at bottombleed);%
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed, \xput at bottombleed + \xput at cuttingmarka) -- (2\xput at pagewidth + \xput at outerbleed, \xput at bottombleed + \xput at cuttingmarkb);%
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarka, \xput at bottombleed+\xput at pageheight) -- (2\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarkb, \xput at bottombleed+\xput at pageheight);%
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarka) -- (2\xput at pagewidth + \xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarkb);%
+ \else
+ \ifxput at leftpage
+ \draw[\xput at pageoptioncolor](\xput at outerbleed + \xput at cuttingmarka, \xput at bottombleed) -- (\xput at outerbleed + \xput at cuttingmarkb, \xput at bottombleed);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed, \xput at bottombleed + \xput at cuttingmarka) -- (\xput at outerbleed, \xput at bottombleed + \xput at cuttingmarkb);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed + \xput at cuttingmarka, \xput at bottombleed+\xput at pageheight) -- (\xput at outerbleed + \xput at cuttingmarkb, \xput at bottombleed+\xput at pageheight);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarka) -- (\xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarkb);%
+ \else
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarka, \xput at bottombleed) -- (2\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarkb, \xput at bottombleed);%
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed, \xput at bottombleed + \xput at cuttingmarka) -- (2\xput at pagewidth + \xput at outerbleed, \xput at bottombleed + \xput at cuttingmarkb);%
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarka, \xput at bottombleed+\xput at pageheight) -- (2\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarkb, \xput at bottombleed+\xput at pageheight);%
+ \draw[\xput at pageoptioncolor](2\xput at pagewidth + \xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarka) -- (2\xput at pagewidth + \xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarkb);%
+ \fi
+ \fi
+ \else
+ \draw[\xput at pageoptioncolor](\xput at outerbleed + \xput at cuttingmarka, \xput at bottombleed) -- (\xput at outerbleed + \xput at cuttingmarkb, \xput at bottombleed);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed, \xput at bottombleed + \xput at cuttingmarka) -- (\xput at outerbleed, \xput at bottombleed + \xput at cuttingmarkb);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed + \xput at cuttingmarka, \xput at bottombleed+\xput at pageheight) -- (\xput at outerbleed + \xput at cuttingmarkb, \xput at bottombleed+\xput at pageheight);%
+ \draw[\xput at pageoptioncolor](\xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarka) -- (\xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarkb);%
+ \draw[\xput at pageoptioncolor](\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarka, \xput at bottombleed) -- (\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarkb, \xput at bottombleed);%
+ \draw[\xput at pageoptioncolor](\xput at pagewidth + \xput at outerbleed, \xput at bottombleed + \xput at cuttingmarka) -- (\xput at pagewidth + \xput at outerbleed, \xput at bottombleed + \xput at cuttingmarkb);%
+ \draw[\xput at pageoptioncolor](\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarka, \xput at bottombleed+\xput at pageheight) -- (\xput at pagewidth + \xput at outerbleed - \xput at cuttingmarkb, \xput at bottombleed+\xput at pageheight);%
+ \draw[\xput at pageoptioncolor](\xput at pagewidth + \xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarka) -- (\xput at pagewidth + \xput at outerbleed, \xput at bottombleed+\xput at pageheight - \xput at cuttingmarkb);%
+ \fi
+ \fi
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\def\xput at safetymargincolor{pink}
+\def\xput at safetymarginopacity{0.8}
+\newif\ifxput at putsafezone
+\newcommand\xput at checksafezone{
+ \ifdim\xput at topsafetymargin>\xput at null
+ \xput at putsafezonetrue
+ \else
+ \ifdim\xput at bottomsafetymargin>\xput at null
+ \xput at putsafezonetrue
+ \else
+ \ifdim\xput at innersafetymargin>\xput at null
+ \xput at putsafezonetrue
+ \else
+ \ifdim\xput at outersafetymargin>\xput at null
+ \xput at putsafezonetrue
+ \else
+ \xput at putsafezonefalse
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput at putsafezone{
+ \ifxput at isemptypage
+ \else
+ \ifxput at safezone
+ \xput at checksafezone
+ \ifxput at putsafezone
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \ifxput at frontcover
+ \ifxput at backcover
+ \else
+ \draw[line cap=rect,line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\xput at pagewidth + \xput at outerbleed,0.05mm) -- (\xput at pagewidth + \xput at outerbleed,\paperheight-0.05mm);%
+ \draw[line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\xput at outersafetymargin + \xput at outerbleed,\xput at bottomsafetymargin + \xput at bottombleed) rectangle (\xput at pagewidth + \xput at outerbleed - \xput at innersafetymargin,\paperheight - \xput at topsafetymargin - \xput at topbleed);%
+ \draw[line cap=rect,line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\xput at pagewidth + \xput at outerbleed + \spinewidth,0.05mm) -- (\xput at pagewidth + \xput at outerbleed + \spinewidth,\paperheight-0.05mm);%
+ \draw[line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\xput at pagewidth + \xput at outerbleed + \spinewidth + \xput at innersafetymargin,\xput at bottomsafetymargin + \xput at bottombleed) rectangle (\paperwidth - \xput at outerbleed - \xput at outersafetymargin,\paperheight - \xput at topsafetymargin - \xput at topbleed);%
+ \fi
+ \else
+ \ifxput at fanfold
+ \ifxput at isdoublepage
+ \draw[line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\xput at outersafetymargin + \xput at outerbleed,\xput at bottomsafetymargin + \xput at bottombleed) rectangle (\paperwidth / 2 - \xput at innersafetymargin,\paperheight - \xput at topsafetymargin - \xput at topbleed);%
+ \draw[line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\paperwidth / 2 + \xput at innersafetymargin,\xput at bottomsafetymargin + \xput at bottombleed) rectangle (\paperwidth - \xput at outerbleed - \xput at outersafetymargin,\paperheight - \xput at topsafetymargin - \xput at topbleed);%
+ \else
+ \ifxput at leftpage
+ \draw[line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\xput at outersafetymargin + \xput at outerbleed,\xput at bottomsafetymargin + \xput at bottombleed) rectangle (\paperwidth / 2 - \xput at innersafetymargin,\paperheight - \xput at topsafetymargin - \xput at topbleed);%
+ \else
+ \draw[line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\paperwidth / 2 + \xput at innersafetymargin,\xput at bottomsafetymargin + \xput at bottombleed) rectangle (\paperwidth - \xput at outerbleed - \xput at outersafetymargin,\paperheight - \xput at topsafetymargin - \xput at topbleed);%
+ \fi
+ \fi
+ \draw[line cap=rect,line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\paperwidth / 2,0.05mm) -- (\paperwidth / 2,\paperheight-0.05mm);%
+ \else
+ \draw[line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\xput at leftsafetymargin + \xput at leftbleed,\xput at bottomsafetymargin + \xput at bottombleed) rectangle (\paperwidth - \xput at rightsafetymargin - \xput at rightbleed,\paperheight - \xput at topsafetymargin - \xput at topbleed);%
+ \fi
+ \fi
+ \end{tikzpicture}%
+ }
+ \else
+ \ifxput at frontcover
+ \ifxput at backcover
+ \else
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \draw[line cap=rect,line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\xput at pagewidth + \xput at outerbleed,0.05mm) -- (\xput at pagewidth + \xput at outerbleed,\paperheight-0.05mm);%
+ \draw[line cap=rect,line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\xput at pagewidth + \xput at outerbleed + \spinewidth,0.05mm) -- (\xput at pagewidth + \xput at outerbleed + \spinewidth,\paperheight-0.05mm);%
+ \end{tikzpicture}%
+ }
+ \fi
+ \else
+ \ifxput at fanfold
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \draw[line cap=rect,line width=0.1mm,draw=\xput at safetymargincolor,opacity=\xput at safetymarginopacity] (\paperwidth / 2,0.05mm) -- (\paperwidth / 2,\paperheight-0.05mm);%
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\def\xput at graphpapercolor{gray!70}
+\def\xput at graphpaperopacity{0.2}
+\newcommand\xput at calcgraphpaperx{
+ \ifdim\xput at graphpaperx>\xput at null
+ \xput at graphpaperx=\dimexpr\xput at graphpaperx-\xput at graphpapersnap\relax
+ \xput at calcgraphpaperx
+ \fi
+}
+\newcommand\xput at calcgraphpapery{
+ \ifdim\xput at graphpapery>\xput at null
+ \xput at graphpapery=\dimexpr\xput at graphpapery-\xput at graphpapersnap\relax
+ \xput at calcgraphpapery
+ \fi
+}
+\newcommand\xput at calcgraphpaperoffset{
+ \xput at graphpaperoffset=\xput at null
+
+ \xput at graphpaperoffsetsnap \numexpr\number\xput at pagewidth/\xput at graphpapersnap\relax
+ \xput at graphpaperoffset=\dimexpr\xput at pagewidth-\xput at graphpapersnap*\xput at graphpaperoffsetsnap\relax
+ \ifdim\xput at graphpaperoffset<\xput at null
+ \xput at graphpaperoffset=\dimexpr\xput at graphpaperoffset+\xput at graphpapersnap\relax
+ \fi
+ \xput at graphpaperx=\dimexpr\xput at graphpaperx-\xput at graphpaperoffset\relax
+}
+\newcount\xput at graphpaperoffsetsnap
+\newcommand\xput at putgraphpaper{
+ \ifxput at graphpaper
+ \xput at graphpapery=\xput at bottombleed
+ \xput at calcgraphpapery
+ \xput at graphpaperx=\xput at leftbleed
+ \xput at calcgraphpaperx
+
+ \ifxput at frontcover
+ \ifxput at backcover
+ \put(\xput at dimentonumber{\xput at graphpaperx},\xput at dimentonumber{\xput at graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput at graphpaperconfigitem in \xput at graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput at graphpaperconfigitem,\xput at graphpapercolor,opacity=\xput at graphpaperopacity] (0pt,0pt) grid ++(\xput at pagewidth-\xput at graphpaperx+\xput at outerbleed,\paperheight-\xput at graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \else
+ \xput at graphpaperx=\dimexpr\xput at pagewidth+\xput at outerbleed\relax
+ \put(\xput at dimentonumber{\xput at graphpaperx},\xput at dimentonumber{\xput at graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput at graphpaperconfigitem in \xput at graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput at graphpaperconfigitem,\xput at graphpapercolor,opacity=\xput at graphpaperopacity] (0pt,0pt) grid ++(\spinewidth,\paperheight-\xput at graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \xput at graphpaperx=\dimexpr\xput at pagewidth+\xput at outerbleed+\spinewidth\relax
+ \put(\xput at dimentonumber{\xput at graphpaperx},\xput at dimentonumber{\xput at graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput at graphpaperconfigitem in \xput at graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput at graphpaperconfigitem,\xput at graphpapercolor,opacity=\xput at graphpaperopacity] (0pt,0pt) grid ++(\xput at pagewidth+\xput at outerbleed,\paperheight-\xput at graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \fi
+ \else
+ \ifxput at fanfold
+ \ifxput at isdoublepage
+ \put(\xput at dimentonumber{\xput at graphpaperx},\xput at dimentonumber{\xput at graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput at graphpaperconfigitem in \xput at graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput at graphpaperconfigitem,\xput at graphpapercolor,opacity=\xput at graphpaperopacity] (0pt,0pt) grid ++(\paperwidth-\xput at graphpaperx,\paperheight-\xput at graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \else
+ \ifxput at leftpage
+ \put(\xput at dimentonumber{\xput at graphpaperx},\xput at dimentonumber{\xput at graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput at graphpaperconfigitem in \xput at graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput at graphpaperconfigitem,\xput at graphpapercolor,opacity=\xput at graphpaperopacity] (0pt,0pt) grid ++(\xput at pagewidth-\xput at graphpaperx+\xput at outerbleed,\paperheight-\xput at graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \else
+ \xput at graphpaperx=\dimexpr\xput at pagewidth+\xput at outerbleed\relax
+ \put(\xput at dimentonumber{\xput at graphpaperx},\xput at dimentonumber{\xput at graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput at graphpaperconfigitem in \xput at graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput at graphpaperconfigitem,\xput at graphpapercolor,opacity=\xput at graphpaperopacity] (0pt,0pt) grid ++(\xput at pagewidth+\xput at outerbleed,\paperheight-\xput at graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \else
+ \ifxput at isdoublepage
+ \ifxput at rightpage
+ \xput at calcgraphpaperoffset
+ \fi
+ \fi
+
+ \put(\xput at dimentonumber{\xput at graphpaperx},\xput at dimentonumber{\xput at graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput at graphpaperconfigitem in \xput at graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput at graphpaperconfigitem,\xput at graphpapercolor,opacity=\xput at graphpaperopacity] (0pt,0pt) grid ++(\paperwidth-\xput at graphpaperx,\paperheight-\xput at graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \fi
+}
+
+% pages
+\newif\ifxput at isbeforepage
+\def\xput at currentbeforepage{}
+\newcommand\setbeforepage[1]{
+ \ifxput at ispage
+ \def\xput at currentbeforepage{#1}
+ \else
+ \global\def\xput at currentbeforepage{#1}
+ \fi
+}
+\def\nobeforepage{\setbeforepage{}}
+\newcommand\newbeforepage[2]{
+ \expandafter\newcommand\csname xput at before@#1\endcsname{%
+ \begingroup%
+ #2
+ \endgroup%
+ }%
+}
+\newcommand\xput at putbeforepage{
+ \ifx\xput at pagegraphic\xput at emptystring
+ \else
+ \xput at putpagegraphic
+ \fi
+ \ifx\xput at currentbeforepage\xput at emptystring
+ \else
+ \ifcsname xput at before@\xput at currentbeforepage\endcsname%
+ \xput at isbeforepagetrue
+ \csname xput at before@\xput at currentbeforepage\endcsname
+ \xput at isbeforepagefalse
+ \else
+ \xput at errmsg@undefined{before page}{\xput at currentbeforepage}
+ \fi
+ \fi
+ \xput at resetautogrid
+}
+\newcommand\xput at beforepage{
+ \xput at closerows
+ \ifx\xput at pagecolor\xput at emptystring
+ \else
+ \begingroup
+ \margin=\xput at null
+ \topmargin=\xput at null
+ \bottommargin=\xput at null
+ \innermargin=\xput at null
+ \outermargin=\xput at null
+ \setgrid{{{1}}}
+ \ifx\xput at pagecolormodel\xput at emptystring
+ \else
+ \definecolor{tmpcolor}{\xput at pagecolormodel}{\xput at pagecolor}
+ \setpagecolor{tmpcolor}
+ \fi
+ \xput at putxput[1]{0}{0}{1}{1}{%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \fill[\xput at pagecolor] (0,0) rectangle ++(\width,\height);
+ \end{tikzpicture}%
+ }
+ \endgroup
+ \fi
+
+ \ifxput at isemptypage
+ \else
+ \xput at putgraphpaper
+ \fi
+}
+\newcommand\xput at setuppage{
+ \global\gutter=\gutter
+ \global\margin=\margin
+ \global\innermargin=\innermargin
+ \global\outermargin=\outermargin
+ \global\bottommargin=\bottommargin
+ \global\topmargin=\topmargin
+ \ifxput at grid\global\xput at gridtrue\else\global\xput at gridfalse\fi
+ \ifxput at graphpaper\global\xput at graphpapertrue\else\global\xput at graphpaperfalse\fi
+ \ifxput at safezone\global\xput at safezonetrue\else\global\xput at safezonefalse\fi
+ \ifxput at placeholder\global\xput at placeholdertrue\else\global\xput at placeholderfalse\fi
+ \global\let\xput at defaultborderwidth\xput at defaultborderwidth
+ \global\let\xput at defaultborderradius\xput at defaultborderradius
+ \global\let\xput at defaultborderopacity\xput at defaultborderopacity
+ \global\let\xput at defaultbordercolor\xput at defaultbordercolor
+ \global\let\xput at defaultshadowsize\xput at defaultshadowsize
+ \global\let\xput at defaultshadowopacity\xput at defaultshadowopacity
+ \global\let\xput at defaultshadowcolor\xput at defaultshadowcolor
+ \global\let\xput at defaultshadowxshift\xput at defaultshadowxshift
+ \global\let\xput at defaultshadowyshift\xput at defaultshadowyshift
+ \global\let\xput at pagegraphicoptionscale\xput at pagegraphicoptionscale
+ \global\let\xput at pagegraphicoptionvpos\xput at pagegraphicoptionvpos
+ \global\let\xput at pagegraphicoptionhpos\xput at pagegraphicoptionhpos
+ \global\let\xput at pagegraphicoptionunsharp\xput at pagegraphicoptionunsharp
+
+ \xput at pagewidth=\pagewidth
+ \xput at pageheight=\pageheight
+ \xput at outerbleed=\ifdim\outerbleed=\xput at undefdim\bleed\else\outerbleed\fi
+ \xput at innerbleed=\ifdim\innerbleed=\xput at undefdim\bleed\else\innerbleed\fi
+ \xput at topbleed=\ifdim\topbleed=\xput at undefdim\bleed\else\topbleed\fi
+ \xput at bottombleed=\ifdim\bottombleed=\xput at undefdim\bleed\else\bottombleed\fi
+ \xput at outersafetymargin=\ifdim\outersafetymargin=\xput at undefdim\safetymargin\else\outersafetymargin\fi
+ \xput at innersafetymargin=\ifdim\innersafetymargin=\xput at undefdim\safetymargin\else\innersafetymargin\fi
+ \xput at topsafetymargin=\ifdim\topsafetymargin=\xput at undefdim\safetymargin\else\topsafetymargin\fi
+ \xput at bottomsafetymargin=\ifdim\bottomsafetymargin=\xput at undefdim\safetymargin\else\bottomsafetymargin\fi
+
+ \ifxput at haspages
+ \ifxput at twoside
+ \ifxput at leftpage
+ \global\xput at rightpagetrue
+ \global\xput at leftpagefalse
+ \else
+ \global\xput at rightpagefalse
+ \global\xput at leftpagetrue
+ \fi
+ \fi
+ \else
+ \xput at isinitgridfalse
+ \ifxput at beginleft
+ \global\xput at leftpagetrue
+ \fi
+ \ifxput at beginright
+ \global\xput at beginleftfalse
+ \global\xput at beginrightfalse
+ \global\xput at leftpagefalse
+ \fi
+ \ifxput at leftpage
+ \xput at haspagestrue
+ \global\xput at leftpagetrue
+ \global\xput at rightpagefalse
+ \else
+ \ifxput at fanfold
+ \global\xput at rightpagefalse
+ \global\xput at leftpagetrue
+ \setcounter{page}{0}
+ \xput at emptypage
+ \global\xput at rightpagetrue
+ \global\xput at leftpagefalse
+ \global\xput at haslastemptypagetrue
+ \else
+ \ifxput at hascover
+ \ifxput at fillpages
+ \ifxput at twoside
+ \global\xput at rightpagefalse
+ \global\xput at leftpagetrue
+ \setcounter{page}{0}
+ \xput at emptypage
+ \global\xput at rightpagetrue
+ \global\xput at leftpagefalse
+ \global\xput at haslastemptypagetrue
+ \else
+ \xput at haspagestrue
+ \global\xput at rightpagetrue
+ \fi
+ \else
+ \xput at haspagestrue
+ \global\xput at rightpagetrue
+ \fi
+ \else
+ \xput at haspagestrue
+ \global\xput at rightpagetrue
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput at setupcover{
+ \xput at isinitgridfalse
+ \xput at pagewidth=\ifdim\coverwidth=\xput at undefdim\pagewidth\else\coverwidth\fi
+ \xput at pageheight=\ifdim\coverheight=\xput at undefdim\pageheight\else\coverheight\fi
+ \xput at outerbleed=\ifdim\coverouterbleed=\xput at undefdim\ifdim\coverbleed=\xput at undefdim\ifdim\outerbleed=\xput at undefdim\bleed\else\outerbleed\fi\else\coverbleed\fi\else\coverouterbleed\fi
+ \xput at innerbleed=\ifdim\coverinnerbleed=\xput at undefdim\ifdim\coverbleed=\xput at undefdim\ifdim\innerbleed=\xput at undefdim\bleed\else\innerbleed\fi\else\coverbleed\fi\else\coverinnerbleed\fi
+ \xput at topbleed=\ifdim\covertopbleed=\xput at undefdim\ifdim\coverbleed=\xput at undefdim\ifdim\topbleed=\xput at undefdim\bleed\else\topbleed\fi\else\coverbleed\fi\else\covertopbleed\fi
+ \xput at bottombleed=\ifdim\coverbottombleed=\xput at undefdim\ifdim\coverbleed=\xput at undefdim\ifdim\bottombleed=\xput at undefdim\bleed\else\bottombleed\fi\else\coverbleed\fi\else\coverbottombleed\fi
+ \xput at outersafetymargin=\ifdim\coveroutersafetymargin=\xput at undefdim\ifdim\coversafetymargin=\xput at undefdim\ifdim\outersafetymargin=\xput at undefdim\safetymargin\else\outersafetymargin\fi\else\coversafetymargin\fi\else\coveroutersafetymargin\fi
+ \xput at innersafetymargin=\ifdim\coverinnersafetymargin=\xput at undefdim\ifdim\coversafetymargin=\xput at undefdim\ifdim\innersafetymargin=\xput at undefdim\safetymargin\else\innersafetymargin\fi\else\coversafetymargin\fi\else\coverinnersafetymargin\fi
+ \xput at topsafetymargin=\ifdim\covertopsafetymargin=\xput at undefdim\ifdim\coversafetymargin=\xput at undefdim\ifdim\topsafetymargin=\xput at undefdim\safetymargin\else\topsafetymargin\fi\else\coversafetymargin\fi\else\covertopsafetymargin\fi
+ \xput at bottomsafetymargin=\ifdim\coverbottomsafetymargin=\xput at undefdim\ifdim\coversafetymargin=\xput at undefdim\ifdim\bottomsafetymargin=\xput at undefdim\safetymargin\else\bottomsafetymargin\fi\else\coversafetymargin\fi\else\coverbottomsafetymargin\fi
+}
+\newif\ifxput at pageoptiondouble
+\newif\ifxput at pageoptionfrontcover
+\newif\ifxput at pageoptionbackcover
+\newdimen\xput at backcovergutter
+\newdimen\xput at backcovermargin
+\newdimen\xput at backcovertopmargin
+\newdimen\xput at backcoverbottommargin
+\newdimen\xput at backcoverinnermargin
+\newdimen\xput at backcoveroutermargin
+\pgfkeys{
+ /pagetype/.is family,
+ /pagetype,
+ double/.is if=xput at pageoptiondouble,
+ front cover/.is if=xput at pageoptionfrontcover,
+ back cover/.is if=xput at pageoptionbackcover,
+ .unknown/.code=
+}
+\pgfkeys{
+ /page/.is family,
+ /page,
+ gutter/.store in=\xput at pageoptiongutter,
+ gutter=\gutter,
+ margin/.store in=\xput at pageoptionmargin,
+ margin=\margin,
+ top margin/.store in=\xput at pageoptiontopmargin,
+ top margin=\topmargin,
+ bottom margin/.store in=\xput at pageoptionbottommargin,
+ bottom margin=\bottommargin,
+ inner margin/.store in=\xput at pageoptioninnermargin,
+ inner margin=\innermargin,
+ outer margin/.store in=\xput at pageoptionoutermargin,
+ outer margin=\outermargin,
+ vpos/.code={\xput at gridvalign{#1}},
+ hpos/.code={\xput at gridhalign{#1}},
+ color/.store in=\xput at pageoptioncolor,
+ color=,
+ page color/.code={\setpagecolor{#1}},
+ page graphic/.code={\setpagegraphic{#1}},
+ before page/.code={\setbeforepage{#1}},
+ double/.code={},
+ front cover/.code={},
+ back cover/.code={},
+}
+\pgfkeys{
+ /backcover/.is family,
+ /backcover,
+ gutter/.store in=\xput at backcoveroptiongutter,
+ gutter=\gutter,
+ margin/.store in=\xput at backcoveroptionmargin,
+ margin=\margin,
+ top margin/.store in=\xput at backcoveroptiontopmargin,
+ top margin=\topmargin,
+ bottom margin/.store in=\xput at backcoveroptionbottommargin,
+ bottom margin=\bottommargin,
+ inner margin/.store in=\xput at backcoveroptioninnermargin,
+ inner margin=\innermargin,
+ outer margin/.store in=\xput at backcoveroptionoutermargin,
+ outer margin=\outermargin,
+ vpos/.store in=\xput at backcoveroptionvpos,
+ vpos=0.5,
+ hpos/.store in=\xput at backcoveroptionhpos,
+ hpos=0.5,
+ color/.store in=\xput at backcoveroptioncolor,
+ color=,
+ page color/.store in=\xput at backcoveroptionpagecolor,
+ page color=,
+ page graphic/.store in=\xput at backcoveroptionpagegraphic,
+ page graphic=,
+ before page/.code={},
+ double/.code={},
+ front cover/.code={},
+ back cover/.code={},
+}
+\newcommand\xput at applypageoptions[1]{
+ \pgfkeys{/page,#1}
+ \gutter=\xput at pageoptiongutter
+ \margin=\xput at pageoptionmargin
+ \topmargin=\xput at pageoptiontopmargin
+ \bottommargin=\xput at pageoptionbottommargin
+ \innermargin=\xput at pageoptioninnermargin
+ \outermargin=\xput at pageoptionoutermargin
+
+ \xput at beforepage
+}
+\newcommand\xput at applybackcoveroptions{
+ \xput at gridvalign{\xput at backcoveroptionvpos}
+ \xput at gridhalign{\xput at backcoveroptionhpos}
+
+ \ifx\xput at backcoveroptionpagecolor\xput at emptystring
+ \def\xput at pagecolor{}
+ \else
+ \setpagecolor{\xput at backcoveroptionpagecolor}
+ \fi
+ \ifx\xput at backcoveroptionpagegraphic\xput at emptystring
+ \def\xput at pagegraphic{}
+ \else
+ \def\xput at pagegraphic{\xput at backcoveroptionpagegraphicfile}
+ \def\xput at pagegraphicoptionscale{\xput at backcoveroptionpagegraphicscale}
+ \def\xput at pagegraphicoptionvpos{\xput at backcoveroptionpagegraphicvpos}
+ \def\xput at pagegraphicoptionhpos{\xput at backcoveroptionpagegraphichpos}
+ \def\xput at pagegraphicoptionunsharp{\xput at backcoveroptionpagegraphicunsharp}
+ \fi
+ \ifx\xput at backcoveroptioncolor\xput at emptystring
+ \def\xput at pageoptioncolor{\xput at backcovercolor}
+ \else
+ \def\xput at pageoptioncolor{\xput at backcoveroptioncolor}
+ \fi
+ \setborder[radius=\xput at backcoveroptionborderradius,width=\xput at backcoveroptionborderwidth,opacity=\xput at backcoveroptionborderopacity,color=\xput at backcoveroptionbordercolor]{}
+ \setshadow[size=\xput at backcoveroptionshadowsize,opacity=\xput at backcoveroptionshadowopacity,color=\xput at backcoveroptionshadowcolor,xshift=\xput at backcoveroptionshadowxshift,yshift=\xput at backcoveroptionshadowyshift]{}
+ \gutter=\xput at backcovergutter
+ \margin=\xput at backcovermargin
+ \topmargin=\xput at backcovertopmargin
+ \bottommargin=\xput at backcoverbottommargin
+ \innermargin=\xput at backcoverinnermargin
+ \outermargin=\xput at backcoveroutermargin
+
+ \ifdefined\xput at backcovergrid
+ \xput at backcovergrid
+ \fi
+
+ \xput at beforepage
+}
+\newcommand\page[2][]{
+ \xput at pageoptiondoublefalse
+ \xput at pageoptionfrontcoverfalse
+ \xput at pageoptionbackcoverfalse
+ \pgfkeys{/pagetype,#1}
+ \ifxput at pageoptiondouble
+ \xput at doublepage[#1]{#2}
+ \else
+ \ifxput at pageoptionfrontcover
+ \xput at frontcover[#1]{#2}
+ \else
+ \ifxput at pageoptionbackcover
+ \xput at backcover[#1]{#2}
+ \else
+ \xput at standardpage[#1]{#2}
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput at standardpage[2][]{
+ \global\xput at placeholdercounter=0\relax
+ \ifxput at backcover
+ \xput at setupcover
+ \else
+ \xput at setuppage
+ \fi
+ \xput at ispagetrue
+ \global\xput at topmargintmp=\topmargin\global\topmargin=\xput at undefdim
+ \xput at setdimensions
+ \ifxput at fanfold
+ \ifxput at leftpage
+ \global\xput at isfanfoldopentrue
+ \begin{picture}(\xput at dimentonumber\paperwidth,\xput at dimentonumber\paperheight)
+ \fi
+ \else
+ \begin{picture}(\xput at dimentonumber\paperwidth,\xput at dimentonumber\paperheight)
+ \fi
+ \topmargin=\xput at topmargintmp
+ \begingroup
+ \ifxput at fanfold
+ \ifxput at pagenumberinghaschanged
+ \global\xput at pagenumberinghaschangedfalse
+ \else
+ \ifxput at rightpage
+ \global\addtocounter{page}{1}
+ \fi
+ \fi
+ \fi
+ \ifxput at backcover
+ \xput at applybackcoveroptions
+ \else
+ \xput at applypageoptions{#1}
+ \fi
+ \xput at putbeforepage
+ #2
+ \xput at putbleed
+ \xput at putgrid
+ \xput at putcuttingmarks
+ \xput at putsafezone
+ \endgroup
+ \ifxput at fanfold
+ \ifxput at rightpage
+ \ifnum\xput at tocfixpageoffset=-1
+ \addtocounter{page}{-1}
+ \fi
+ \global\xput at isfanfoldopenfalse
+ \end{picture}
+ \ifnum\xput at tocfixpageoffset=-1
+ \addtocounter{page}{1}
+ \global\def\xput at tocfixpageoffset{0}
+ \fi
+ \fi
+ \else
+ \end{picture}
+ \fi
+ \global\topmargin=\xput at topmargintmp
+ \xput at ispagefalse
+}
+\newcommand\xput at doublepage[2][]{
+ \global\xput at placeholdercounter=0\relax
+ \ifxput at twoside
+ \ifxput at haspages
+ \ifxput at leftpage\page{}\fi
+ \else
+ \ifxput at beginleft
+ \ifxput at beginright
+ \page{}
+ \fi
+ \else
+ \page{}
+ \fi
+ \fi
+ \xput at ispagetrue
+ \global\xput at isdoublepagetrue
+ \xput at setuppage
+ \global\xput at topmargintmp=\topmargin\global\topmargin=\xput at undefdim
+ \xput at setdimensions
+ \begin{picture}(\xput at dimentonumber\paperwidth,\xput at dimentonumber\paperheight)
+ \topmargin=\xput at topmargintmp
+ \xput at applypageoptions{#1}
+ \xput at putbeforepage
+ #2
+ \xput at putbleed
+ \xput at putgrid
+ \xput at putcuttingmarks
+ \xput at putsafezone
+ \ifnum\xput at tocfixpageoffset=1
+ \addtocounter{page}{1}
+ \fi
+ \end{picture}
+
+ \xput at setuppage
+ \ifxput at fanfold
+ \ifnum\xput at tocfixpageoffset=1
+ \global\def\xput at tocfixpageoffset{0}
+ \else
+ \addtocounter{page}{1}
+ \fi
+ \else
+ \xput at setdimensions
+ \begin{picture}(\xput at dimentonumber\paperwidth,\xput at dimentonumber\paperheight)
+ \topmargin=\xput at topmargintmp
+ \xput at applypageoptions{#1}
+ \global\xput at placeholdercounter=0\relax
+ \xput at putbeforepage
+ #2
+ \xput at putbleed
+ \xput at putgrid
+ \xput at putcuttingmarks
+ \xput at putsafezone
+ \end{picture}
+ \fi
+ \global\xput at isdoublepagefalse
+ \global\topmargin=\xput at topmargintmp
+ \xput at ispagefalse
+ \else
+ \xput at standardpage[#1]{#2}
+ \fi
+}
+\newcommand\xput at backcover[2][]{
+ \ifxput at hascover
+ \xput at errmsg@backcoverdefinedafterfrontcover
+ \else
+ \ifdefined\xput at tmpgrid
+ \let\xput at backcovergrid\xput at tmpgrid
+ \fi
+ \edef\xput at backcovercolor{\xputoptions at color}
+ \pgfkeys{/backcover,#1}
+ \xput at backcovergutter=\xput at backcoveroptiongutter
+ \xput at backcovermargin=\xput at backcoveroptionmargin
+ \xput at backcovertopmargin=\xput at backcoveroptiontopmargin
+ \xput at backcoverbottommargin=\xput at backcoveroptionbottommargin
+ \xput at backcoverinnermargin=\xput at backcoveroptioninnermargin
+ \xput at backcoveroutermargin=\xput at backcoveroptionoutermargin
+ \ifx\xput at backcoveroptionpagecolor\xput at emptystring
+ \let\xput at backcoveroptionpagecolor\xput at pagecolor
+ \fi
+ \ifx\xput at backcoveroptionpagegraphic\xput at emptystring
+ \let\xput at backcoveroptionpagegraphic\xput at pagegraphic
+ \let\xput at backcoveroptionpagegraphicfile\xput at pagegraphic
+ \ifdefined\xput at pagegraphicoptionscale
+ \let\xput at backcoveroptionpagegraphicscale\xput at pagegraphicoptionscale
+ \fi
+ \ifdefined\xput at pagegraphicoptionhpos
+ \let\xput at backcoveroptionpagegraphichpos\xput at pagegraphicoptionhpos
+ \fi
+ \ifdefined\xput at pagegraphicoptionvpos
+ \let\xput at backcoveroptionpagegraphicvpos\xput at pagegraphicoptionvpos
+ \fi
+ \ifdefined\xput at pagegraphicoptionunsharp
+ \let\xput at backcoveroptionpagegraphicunsharp\xput at pagegraphicoptionunsharp
+ \fi
+ \else
+ \ifcsname xput at graphic@\xput at backcoveroptionpagegraphic\endcsname
+ \csname xput at graphic@\xput at backcoveroptionpagegraphic\endcsname[1]{}
+ \else
+ \def\xput at backcoveroptionpagegraphicfile{\xput at backcoveroptionpagegraphic}
+ \def\xput at backcoveroptionpagegraphicscale{1}
+ \def\xput at backcoveroptionpagegraphichpos{0.5}
+ \def\xput at backcoveroptionpagegraphicvpos{0.5}
+ \def\xput at backcoveroptionpagegraphicunsharp{\xput at unsharp}
+ \fi
+ \fi
+ \let\xput at backcoveroptionborderradius\xput at defaultborderradius
+ \let\xput at backcoveroptionborderopacity\xput at defaultborderopacity
+ \let\xput at backcoveroptionborderwidth\xput at defaultborderwidth
+ \let\xput at backcoveroptionbordercolor\xput at defaultbordercolor
+ \let\xput at backcoveroptionshadowopacity\xput at defaultshadowopacity
+ \let\xput at backcoveroptionshadowsize\xput at defaultshadowsize
+ \let\xput at backcoveroptionshadowcolor\xput at defaultshadowcolor
+ \let\xput at backcoveroptionshadowxshift\xput at defaultshadowxshift
+ \let\xput at backcoveroptionshadowyshift\xput at defaultshadowyshift
+
+ \ifdefined\xput at currentcontents
+ \let\xput at backcovercontent\xput at currentcontents
+ \def\xput at backcovertemplate{#2}
+ \else
+ \def\xput at backcovercontent{#2}
+ \fi
+ \fi
+}
+\newcommand\xput at frontcover[2][]{
+ \xput at ispagetrue
+ \xput at hascovertrue
+ \xput at setupcover
+ \setcounter{page}{0}
+ \global\xput at topmargintmp=\topmargin\global\topmargin=\xput at undefdim
+ \ifxput at cover
+ \global\xput at frontcovertrue
+ \xput at setdimensions
+ \begin{picture}(\xput at dimentonumber\paperwidth,\xput at dimentonumber\paperheight)
+ \topmargin=\xput at topmargintmp
+ \global\xput at backcovertrue
+ \def\xput at currentbeforepage{}
+ \begingroup
+ \ifdefined\xput at backcovercontent
+ \xput at applybackcoveroptions
+ \xput at putbeforepage
+ \ifdefined\xput at backcovertemplate
+ \xput at placeholdercounter 0\relax%
+ \let\xput at currentcontents\xput at backcovercontent%
+ \xput at backcovertemplate%
+ \else
+ \xput at backcovercontent
+ \fi
+ \fi
+ \xput at putbleed
+ \xput at putgrid
+ \xput at putcuttingmarks
+ \xput at putsafezone
+ \endgroup
+ \global\xput at backcoverfalse
+ \xput at resetautogrid
+ \xput at gridoffsetx=\dimexpr(\xput at pagewidth + \xput at outerbleed - \xput at innerbleed + \spinewidth)\relax
+ \xput at applypageoptions{#1}
+ \global\xput at placeholdercounter=0\relax
+ \xput at putbeforepage
+ #2
+ \xput at putbleed
+ \xput at putgrid
+ \xput at putcuttingmarks
+ \xput at putsafezone
+ \end{picture}
+ \global\xput at frontcoverfalse
+ \let\xput at backcovercontent\undefined
+ \else
+ \xput at setdimensions
+ \begin{picture}(\xput at dimentonumber\paperwidth,\xput at dimentonumber\paperheight)
+ \topmargin=\xput at topmargintmp
+ \xput at applypageoptions{#1}
+ \def\xput at currentbeforepage{}
+ \xput at putbeforepage
+ #2
+ \xput at putbleed
+ \xput at putgrid
+ \xput at putcuttingmarks
+ \xput at putsafezone
+ \end{picture}
+ \fi
+ \global\topmargin=\xput at topmargintmp
+ \xput at ispagefalse
+}
+\newcommand\leftpage[1]{
+ \ifxput at leftpage
+ \xput at renderleftpage{#1}
+ \else
+ \ifxput at fanfold
+ \ifxput at isdoublepage
+ \xput at renderleftpage{#1}
+ \fi
+ \else
+ \ifxput at isdoublepage
+ \xput at renderleftpage[1]{#1}
+ \fi
+ \fi
+ \fi
+}
+\newcommand\rightpage[1]{
+ \ifxput at rightpage
+ \xput at renderrightpage{#1}
+ \else
+ \ifxput at fanfold
+ \ifxput at isdoublepage
+ \xput at renderrightpage{#1}
+ \fi
+ \else
+ \ifxput at isdoublepage
+ \xput at renderrightpage[1]{#1}
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput at renderleftpage[2][0]{
+ \begingroup
+ \xput at isdoublepagefalse
+ \xput at setdimensions
+ \xput at closerows
+ \ifnum#1=1
+ \xput at drymodetrue
+ \fi
+ #2
+ \ifnum#1=1
+ \xput at drymodefalse
+ \else
+ \ifxput at isbeforepage
+ \else
+ \xput at putgrid
+ \fi
+ \fi
+ \endgroup
+}
+\newif\ifxput at wasdoublepage
+\newif\ifxput at renderrightpage
+\newcommand\xput at renderrightpage[2][0]{
+ \xput at renderrightpagetrue
+ \begingroup
+ \ifxput at fanfold
+ \ifxput at isdoublepage
+ \xput at wasdoublepagetrue
+ \addtocounter{page}{1}
+ \fi
+ \fi
+ \xput at isdoublepagefalse
+ \xput at rightpagetrue
+ \xput at leftpagefalse
+ \xput at setdimensions
+ \xput at closerows
+ \ifnum#1=1
+ \xput at drymodetrue
+ \fi
+ #2
+ \ifnum#1=1
+ \xput at drymodefalse
+ \else
+ \ifxput at isbeforepage
+ \else
+ \xput at putgrid
+ \fi
+ \fi
+ \ifxput at fanfold
+ \ifxput at wasdoublepage
+ \xput at wasdoublepagefalse
+ \addtocounter{page}{-1}
+ \fi
+ \fi
+ \endgroup
+ \xput at renderrightpagefalse
+}
+
+% templates
+\newif\ifxput at drymode
+\newif\ifxput at placeholderoptions
+\newif\ifxput at placeholdermode
+\newif\ifxput at isplace
+\xput at placeholderoptionstrue
+\newcount\xput at placeholdercounter
+\newcount\xput at contentcounter
+\newdimen\xput at placeholderfontsize
+\def\xput at frameyymax{0}
+\def\xput at framexxmax{0}
+\def\xput at setgridframe#1 #2 #3 #4 \\{
+ \def\xput at framey{#1}
+ \def\xput at framex{#2}
+ \def\xput at frameyy{#3}
+ \def\xput at framexx{#4}
+}
+\def\xput at setdefaultgridframe#1 #2 #3 #4 \\{
+ \def\xput at defaultframey{#1}
+ \def\xput at defaultframex{#2}
+ \def\xput at defaultframeyy{#3}
+ \def\xput at defaultframexx{#4}
+ \xput at setgridframe #1 #2 #3 #4 \\
+}
+\def\xput at resetgridframe{
+ \global\xput at isplacefalse
+ \pgfmathceil{\xput at frameyy}
+ \pgfmathint{\pgfmathresult}
+ \global\edef\xput at currentrow{\pgfmathresult}
+ \ifnum\xput at currentrow>\xput at frameyymax
+ \global\edef\xput at frameyymax{\xput at currentrow}
+ \global\def\xput at framexxmax{0}
+ \fi
+ \pgfmathceil{\xput at framexx}
+ \pgfmathint{\pgfmathresult}
+ \global\edef\xput at currentcell{\pgfmathresult}
+ \ifnum\xput at currentcell>\xput at framexxmax
+ \global\edef\xput at framexxmax{\xput at currentcell}
+ \fi
+
+ \pgfmathqparse{\xput at get{\xput at frameyymax C}pt>\xput at framexxmax pt}
+ \ifnum\pgfmathresult=1
+ \global\edef\xput at framey{\the\numexpr\xput at frameyymax-1\relax}
+ \global\edef\xput at framex{\xput at framexxmax}
+ \global\edef\xput at frameyy{\xput at frameyymax}
+ \global\edef\xput at framexx{\the\numexpr\xput at framexxmax+1\relax}
+ \else
+ \ifnum\xput at frameyymax=\xput at rowscount
+ \global\xput at gridfulltrue
+ \else
+ \global\edef\xput at framey{\xput at frameyymax}
+ \global\edef\xput at framex{0}
+ \global\edef\xput at frameyy{\the\numexpr\xput at frameyymax+1\relax}
+ \global\edef\xput at framexx{1}
+ \fi
+ \fi
+}
+\newcommand\placeholder[2][0]{
+ \begingroup
+ \ifx#2\xput at emptystring
+ \else
+ \global\xput at isplacetrue
+ \fi
+ \def\xput at currentplaceholder{}
+ \ifnum#1=0
+ \global\advance \xput at placeholdercounter by 1
+ \else
+ \global\xput at placeholdercounter=#1
+ \fi
+ \xput at contentcounter 0\relax
+ \def\xput at tmp{\xput at currentcontents}
+ \xput at placeholdermode{1}
+ \xput at tmp
+ \xput at placeholdermode{0}
+ \xput at putcontent{
+ \ifx\xput at emptystring\xput at currentplaceholder
+ \ifxput at placeholder
+ \ifx#2\xput at emptystring
+ \else
+ \xput at setgridframe #2 \\
+ \fi
+ \xput at textboxheight=\dimexpr(\posy{1}{\xput at framey} - \posy{-1}{\xput at frameyy})\relax
+ \xput at textboxwidth=\dimexpr(\posx{-1}{\xput at frameyy}{-1}{\xput at framexx} - \posx{1}{\xput at framey}{1}{\xput at framex})\relax
+ \ifdim\xput at textboxwidth>\xput at textboxheight
+ \xput at placeholderfontsize=0.5\xput at textboxheight
+ \else
+ \xput at placeholderfontsize=0.5\xput at textboxwidth
+ \fi
+ \ifdim\xput at placeholderfontsize>1000pt
+ \xput at placeholderfontsize=1000pt
+ \fi
+ \xput at putxput{\xput at framey}{\xput at framex}{\xput at frameyy}{\xput at framexx}{%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \filldraw[line width=0.1mm,draw=cyan!60,fill=cyan!30,opacity=0.3] (0,0) rectangle ++(\width,\height);
+ \ifdim\xput at placeholderfontsize>5mm
+ \node[opacity=0.3] at (0.5\width,0.5\height){
+ \fontsize{\xput at placeholderfontsize}{0pt}\selectfont\textcolor{cyan!60}{\textbf{\the\xput at placeholdercounter}}
+ };
+ \fi
+ \end{tikzpicture}%
+ }
+ \xput at resetgridframe
+ \else
+ \ifx\xput at currentplaceholdertype\xput at placeholdertypeusetext
+ \ifx#2\xput at emptystring
+ \else
+ \xput at setgridframe #2 \\
+ \fi
+ \ifx\xput at currentplaceholderoptions\xput at emptystring
+ \xput at placeholderoptionsfalse
+ \csname \xput at currentplaceholdertype\endcsname
+ \xput at placeholderoptionstrue
+ \else
+ \csname \xput at currentplaceholdertype\endcsname[\xput at currentplaceholderoptions]
+ \fi
+ \fi
+ \fi
+ \else
+ \ifx#2\xput at emptystring
+ \else
+ \xput at setgridframe #2 \\
+ \fi
+ \ifx\xput at currentplaceholderoptions\xput at emptystring
+ \xput at placeholderoptionsfalse
+ \csname \xput at currentplaceholdertype\endcsname{\xput at currentplaceholder}
+ \xput at placeholderoptionstrue
+ \else
+ \csname \xput at currentplaceholdertype\endcsname[\xput at currentplaceholderoptions]{\xput at currentplaceholder}
+ \fi
+ \fi
+ }
+ \endgroup
+}
+\newcommand\xput at graphic[2][]{
+ \advance \xput at contentcounter by 1
+ \ifnum\xput at contentcounter=\xput at placeholdercounter
+ \def\xput at currentplaceholdertype{graphic}
+ \def\xput at currentplaceholderoptions{}
+ \pgfkeys{graphic,file={#2},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput at unsharp,#1}
+ \ifcsname xput at graphic@#2\endcsname%
+ \csname xput at graphic@#2\endcsname[2]{#1}%
+ \fi
+
+ \edef\xput at currentplaceholder{\xput at graphicoptionfile}
+ \fi
+}
+\newcommand\xput at xput[1]{
+ \advance \xput at contentcounter by 1
+ \ifnum\xput at contentcounter=\xput at placeholdercounter
+ \def\xput at currentplaceholdertype{xput}
+ \def\xput at currentplaceholderoptions{}
+ \def\xput at currentplaceholder{#1}
+ \fi
+}
+\newcommand\xput at tikz[1]{
+ \advance \xput at contentcounter by 1
+ \ifnum\xput at contentcounter=\xput at placeholdercounter
+ \def\xput at currentplaceholdertype{tikzgraphic}
+ \def\xput at currentplaceholderoptions{}
+ \def\xput at currentplaceholder{#1}
+ \fi
+}
+\newcommand\xput at text[2][]{
+ \advance \xput at contentcounter by 1
+ \ifnum\xput at contentcounter=\xput at placeholdercounter
+ \def\xput at currentplaceholdertype{text}
+ \def\xput at currentplaceholderoptions{}
+ \edef\xput at currentborderradius{\xput at defaultborderradius}
+ \edef\xput at currentborderwidth{\xput at defaultborderwidth}
+ \edef\xput at currentbordercolor{\xput at defaultbordercolor}
+ \edef\xput at currentborderopacity{\xput at defaultborderopacity}
+ \pgfkeys{text,name=default,color=\ifx\xput at pageoptioncolor\xput at emptystring\xputoptions at color\else\xput at pageoptioncolor\fi,border radius=\xput at currentborderradius,border width=\xput at currentborderwidth,border color=\xput at currentbordercolor,border opacity=\xput at currentborderopacity,#1}
+ \def\xput at currentplaceholder{#2}
+ \fi
+}
+\def\xput at placeholdertypeusetext{usetext}
+\newcommand\xput at usetext[1][default]{
+ \advance \xput at contentcounter by 1
+ \ifnum\xput at contentcounter=\xput at placeholdercounter
+ \edef\xput at currentplaceholdertype{\xput at placeholdertypeusetext}
+ \def\xput at currentplaceholderoptions{#1}
+ \def\xput at currentplaceholder{}
+ \fi
+}
+\newcommand\xput at rendertemplate[3]{
+ \xput at placeholdercounter 0\relax%
+ \global\def\xput at currentcontents{#2}%
+ \page[#1]{%
+ #3
+ }%
+}
+\newcommand{\newtemplate}[3][]{
+ \expandafter\newcommand\csname xput at template@#2\endcsname[2][]{%
+ \xput at rendertemplate{#1,##1}{##2}{#3}
+ }%
+}
+\newcommand\template[3][]{
+ \ifcsname xput at template@#2\endcsname%
+ \else%
+ \newtemplate[]{#2}{
+ \xput at gridsc{#2}
+ }
+ \fi
+ \csname xput at template@#2\endcsname[#1]{
+ #3
+ }
+}
+\newcommand\graphic{}
+\newcommand\xput{}
+\newcommand\tikzgraphic{}
+\newcommand\usetext{}
+\newcommand\text{}
+\newcommand\xput at putcontent[1]{
+ \ifxput at drymode
+ \else
+ \begingroup
+ \ifxput at gridfull
+ \ifxput at isplace#1\fi
+ \else
+ #1
+ \fi
+ \endgroup
+ \fi
+}
+\newcommand\xput at placeholdermode[1]{
+ \xput at placeholdermodefalse
+ \ifnum#1=0%
+ \renewcommand\graphic[2][]{%
+ \xput at putcontent{%
+ \def\xput at graphicoptionfile{##2}
+ \ifxput at placeholderoptions
+ \ifcsname xput at graphic@##2\endcsname%
+ \csname xput at graphic@##2\endcsname[2]{##1}
+ \else
+ \pgfkeys{graphic,file={##2},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput at unsharp,##1}
+ \fi
+ \fi
+ \xput at putgraphic{\xput at framey}{\xput at framex}{\xput at frameyy}{\xput at framexx}{\xput at graphicoptionfile}%
+ \xput at resetgridframe
+ }
+ }%
+ \renewcommand\xput[1]{%
+ \xput at putcontent{%
+ \xput at putxput{\xput at framey}{\xput at framex}{\xput at frameyy}{\xput at framexx}{##1}%
+ \xput at resetgridframe
+ }
+ }%
+ \renewcommand\tikzgraphic[1]{%
+ \xput at putcontent{%
+ \xput at puttikz{\xput at framey}{\xput at framex}{\xput at frameyy}{\xput at framexx}{##1}%
+ \xput at resetgridframe
+ }
+ }%
+ \renewcommand\usetext[1][default]{%
+ \xput at putcontent{%
+ \xput at putusetext[##1]{\xput at framey}{\xput at framex}{\xput at frameyy}{\xput at framexx}%
+ \xput at resetgridframe
+ }
+ }%
+ \renewcommand\text[2][]{%
+ \xput at putcontent{%
+ \edef\xput at currentborderradius{\xput at defaultborderradius}
+ \edef\xput at currentborderwidth{\xput at defaultborderwidth}
+ \edef\xput at currentbordercolor{\xput at defaultbordercolor}
+ \edef\xput at currentborderopacity{\xput at defaultborderopacity}
+ \pgfkeys{text,name=default,color=\ifx\xput at pageoptioncolor\xput at emptystring\xputoptions at color\else\xput at pageoptioncolor\fi,border radius=\xput at currentborderradius,border width=\xput at currentborderwidth,border color=\xput at currentbordercolor,border opacity=\xput at currentborderopacity,##1}
+ \xput at puttext{\xput at framey}{\xput at framex}{\xput at frameyy}{\xput at framexx}{##2}%
+ \xput at resetgridframe
+ }
+ }%
+ \else%
+ \xput at placeholdermodetrue
+ \renewcommand\graphic[2][]{%
+ \xput at graphic[##1]{##2}%
+ }%
+ \renewcommand\xput[1]{%
+ \xput at xput{##1}%
+ }%
+ \renewcommand\tikzgraphic[1]{%
+ \xput at tikz{##1}%
+ }%
+ \renewcommand\usetext[1][default]{%
+ \xput at usetext[##1]%
+ }
+ \renewcommand\text[2][]{%
+ \xput at text[##1]{##2}%
+ }
+ \fi%
+}
+\xput at placeholdermode{0}
+\newcommand\place[1]{
+ \xput at isplacetrue
+ \xput at setgridframe #1 \\
+}
+\xput at setdefaultgridframe 0 0 1 1 \\
+
+\newcommand\xput at emptypage{
+ \global\xput at isemptypagetrue
+ \page[before page=,page graphic=,page color=]{}
+ \global\xput at isemptypagefalse
+}
+
+\def\xput at tocfixpageoffset{0}
+\def\sectioncalled{
+ \ifxput at fanfold
+ \ifxput at isdoublepage
+ \ifxput at rightpage
+ \global\def\xput at tocfixpageoffset{1}
+ \fi
+ \else
+ \ifxput at renderrightpage
+ \global\def\xput at tocfixpageoffset{1}
+ \else
+ \ifxput at leftpage
+ \global\def\xput at tocfixpageoffset{-1}
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+\def\xput at turbojobname{xputturbobatchoptimizexyz}
+\edef\xput at turbojobname{\meaning\xput at turbojobname}
+\edef\xput at jobname{\jobname}
+\edef\xput at jobname{\meaning\xput at jobname}
+\AtBeginDocument{
+ % fanfold toc partial fix
+ \let\xput at originalsection\section
+ \def\xput at nextsection#1{
+ \sectioncalled
+ \@ifnextchar\bgroup{\xput at originalsection*}{\xput at originalsection{#1}}}
+ \let\section\xput at nextsection
+ \let\xput at originalsubsection\subsection
+ \def\xput at nextsubsection#1{
+ \sectioncalled
+ \@ifnextchar\bgroup{\xput at originalsubsection*}{\xput at originalsubsection{#1}}}
+ \let\subsection\xput at nextsubsection
+
+ \ifxput at optimize
+ \else
+ \xput at isturbomodefalse
+ \fi
+
+ \ifxput at isturbomode
+ \ifx\xput at jobname\xput at turbojobname
+ \xput at placeholderfalse
+ \xput at gridfalse
+ \xput at safezonefalse
+ \xput at cuttingmarksfalse
+ \xput at fillpagesfalse
+ \xput at graphpaperfalse
+ \xput at preflightfalse
+
+ \xput at isbatchmodetrue
+ \else
+ \xput at start
+ \fi
+ \else
+ \ifxput at import
+ \xput at start
+ \fi
+ \fi
+
+ \ifx\xput at pagegraphic\xput at emptystring
+ \ifx\xputoptions at pagegraphic\xput at emptystring
+ \else
+ \setpagegraphic{\xputoptions at pagegraphic}
+ \fi
+ \fi
+
+ \ifxput at fanfold
+ \xput at covertrue
+ \fi
+}
+\AtEndDocument{
+ \ifxput at beginleft
+ \ifxput at leftpage
+ \xput at hasoddnumberofpagestrue
+ \fi
+ \else
+ \ifxput at rightpage
+ \xput at hasoddnumberofpagestrue
+ \fi
+ \fi
+ \ifdefined\xput at backcovercontent
+ \xput at haspagestrue
+ \ifxput at haslastemptypage
+ \ifxput at hasoddnumberofpages
+ \xput at standardpage[before page=]{}
+ \xput at emptypage
+ \else
+ \xput at emptypage
+ \fi
+ \else
+ \ifxput at twoside
+ \ifxput at hasoddnumberofpages\page[before page=]{}\fi
+ \fi
+ \fi
+ \xput at leftpagetrue
+ \xput at rightpagefalse
+ \xput at backcovertrue
+ \ifdefined\xput at backcovertemplate
+ \xput at placeholdercounter 0\relax%
+ \let\xput at currentcontents\xput at backcovercontent%
+ \def\xput at currentbeforepage{}
+ \xput at standardpage{%
+ \xput at backcovertemplate%
+ }%
+ \else
+ \def\xput at currentbeforepage{}
+ \xput at standardpage{
+ \xput at backcovercontent
+ }
+ \fi
+ \else
+ \ifxput at haspages
+ \ifxput at fanfold
+ \ifxput at isfanfoldopen
+ \ifxput at beginleft
+ \xput at standardpage[before page=]{}
+ \else
+ \xput at emptypage
+ \fi
+ \else
+ \ifxput at beginleft
+ \else
+ \xput at standardpage[before page=]{}
+ \xput at emptypage
+ \fi
+ \fi
+ \else
+ \ifxput at haslastemptypage
+ \ifxput at hasoddnumberofpages
+ \xput at standardpage[before page=]{}
+ \xput at emptypage
+ \else
+ \xput at emptypage
+ \fi
+ \else
+ \ifxput at twoside
+ \ifxput at hasoddnumberofpages\xput at standardpage[before page=]{}\fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \ifxput at isbatchmode
+ \xput at batchoptimize
+ \fi
+}
+
+% scripts
+\newread\xput at scriptresult
+\def\xput at batchlist{}
+\def\xput at ok{ok}
+\def\xput at err@shellaccessforbidden{errorshellaccessforbidden}
+\def\xput at err@importdirnotfound{errorimportdirnotfound}
+\def\xput at err@noimportdir{errornoimportdir}
+\def\xput at err@magicknotinstalled{errormagicknotinstalled}
+\def\xput at err@inkscapenotinstalled{errorinkscapenotinstalled}
+\def\preventunrestrictedshellexecution{";-)" \%}
+\newcommand\xput at getppi[1]{
+ \immediate\openin\xput at scriptresult={|xputserver \preventunrestrictedshellexecution getwidth\% "#1"}
+ \ifeof\xput at scriptresult
+ \xput at errmsg@shellaccessforbidden{Ppi not calculated}
+ \else
+ \endlinechar=-1
+ \read\xput at scriptresult to \xput at graphicwidth
+ \endlinechar=13
+ \ifx\xput at graphicwidth\xput at emptystring
+ \xput at errmsg@shellaccessfailed{Ppi not calculated}
+ \else
+ \ifx\xput at graphicwidth\xput at err@magicknotinstalled
+ \xput at errmsg@magicknotinstalled{Ppi not calculated}
+ \else
+ \pgfmathqparse{(\xput at originalgraphicwidth - \xput at cropleft - \xput at cropright) / \xput at originalgraphicwidth * \xput at graphicwidth pt / \the\width * 72.27pt}
+
+ \pgfmathint{\pgfmathresult}
+ \edef\xput at graphicdensity{\pgfmathresult}
+ \fi
+ \fi
+ \fi
+ \immediate\closein\xput at scriptresult
+}
+\newcommand\xput at optimizegraphic[2]{
+ \immediate\openin\xput at scriptresult={|xputserver \preventunrestrictedshellexecution optimize\% "#1#2" \% "\xput at filename" \%\xput at optimizedext\%\the\numexpr\xput at originalgraphicwidth\%\the\numexpr\xput at originalgraphicheight\%\the\numexpr\xput at cropleft\%\the\numexpr\xput at cropright\%\the\numexpr\xput at croptop\%\the\numexpr\xput at cropbottom\%\the\numexpr\xput at density\%\the\numexpr\width\%\the\numexpr\height\%\xput at downsamplethreshold\%\xput at graphicoptionunsharp\%\xput at quality}
+ \ifeof\xput at scriptresult
+ \xput at errmsg@shellaccessforbidden{File not optimized}
+ \else
+ \endlinechar=-1
+ \read\xput at scriptresult to \xput at processresult
+ \endlinechar=13
+ \ifx\xput at processresult\xput at emptystring
+ \xput at errmsg@shellaccessfailed{File not optimized}
+ \else
+ \ifx\xput at processresult\xput at err@magicknotinstalled
+ \xput at errmsg@magicknotinstalled{File not optimized}
+ \fi
+ \fi
+ \fi
+ \immediate\closein\xput at scriptresult
+}
+\newcommand\xput at makeshadow[1]{
+ \immediate\openin\xput at scriptresult={|xputserver \preventunrestrictedshellexecution makeshadow\%#1\%\xput at defaultshadowsize\%\xput at defaultshadowopacity\%\xput at defaultshadowcolor\%\the\xput at frameshadowwidth\%\the\xput at frameshadowheight\%\the\xput at frameshadowframewidth\%\the\xput at frameshadowframeheight\%\the\xput at frameshadowborder\%\the\xput at frameshadowradius}
+ \ifeof\xput at scriptresult
+ \edef\xput at processresult{\xput at err@shellaccessforbidden}
+ \xput at errmsg@shellaccessforbidden{Shadow not created}
+ \else
+ \endlinechar=-1
+ \read\xput at scriptresult to \xput at processresult
+ \endlinechar=13
+ \ifx\xput at processresult\xput at emptystring
+ \xput at errmsg@shellaccessfailed{Shadow not created}
+ \else
+ \ifx\xput at processresult\xput at err@inkscapenotinstalled
+ \xput at errmsg@inkscapenotinstalled{Shadow not created}
+ \else
+ \fi
+ \fi
+ \fi
+ \immediate\closein\xput at scriptresult
+}
+\def\xput at start{
+ \immediate\openin\xput at scriptresult={|xputserver \preventunrestrictedshellexecution start\ifxput at import\%import\% "\ifdefined\Ginput at path\Ginput at path\fi" \fi\ifxput at isturbomode\%turbo\% "\jobname" \fi}
+ \ifeof\xput at scriptresult
+ \ifxput at import
+ \xput at errmsg@shellaccessforbidden{Import not working}
+ \fi
+ \else
+ \endlinechar=-1
+ \read\xput at scriptresult to \xput at processresult
+ \endlinechar=13
+ \ifx\xput at processresult\xput at emptystring
+ \ifxput at import
+ \xput at errmsg@shellaccessfailed{Import not working}
+ \fi
+ \else
+ \ifx\xput at processresult\xput at ok
+ \else
+ \ifx\xput at processresult\xput at err@noimportdir
+ \xput at errmsg@noimportdir
+ \else
+ \xput at errmsg@importdirnotfound{\xput at processresult}
+ \fi
+ \fi
+ \fi
+ \fi
+ \immediate\closein\xput at scriptresult
+}
+\newcommand\xput at addtobatchlist[2]{
+ \global\edef\xput at batchlist{\xput at batchlist\% "#1#2" \% "\xput at filename" \%\xput at optimizedext\%\the\numexpr\xput at originalgraphicwidth\%\the\numexpr\xput at originalgraphicheight\%\the\numexpr\xput at cropleft\%\the\numexpr\xput at cropright\%\the\numexpr\xput at croptop\%\the\numexpr\xput at cropbottom\%\the\numexpr\xput at density\%\the\numexpr\width\%\the\numexpr\height\%\xput at downsamplethreshold\%\xput at graphicoptionunsharp\%\xput at quality}
+}
+\newcommand\xput at batchoptimize{
+ \immediate\openin\xput at scriptresult={|xputserver \preventunrestrictedshellexecution batchoptimize\xput at batchlist}
+ \ifeof\xput at scriptresult
+ \else
+ \endlinechar=-1
+ \read\xput at scriptresult to \xput at processresult
+ \endlinechar=13
+ \fi
+ \immediate\closein\xput at scriptresult
+}
+
+% errors
+\def\xput at errmsg@undefined#1#2{
+ \ifx#2\xput at emptystring
+ \else
+ \ClassError{Xput}{Undefined #1 `#2'}{Check the name `#2'.\MessageBreak\MessageBreak\@ehc}
+ \fi
+}
+\def\xput at errmsg@backcoverdefinedafterfrontcover{
+ \ClassError{Xput}{Back cover needs to be defined before front cover}{Define the back cover before the front cover.\MessageBreak\MessageBreak\@ehc}
+}
+\def\xput at errmsg@shellaccessforbidden#1{
+ \ClassError{Xput}{Shell access forbidden. #1}{Make sure `xputserver' is added to the list of shell escape commands\MessageBreak(shell_escape_commands = xputserver) in your `texmf.cnf'.\MessageBreak\MessageBreak\@ehc}
+}
+\def\xput at errmsg@shellaccessfailed#1{
+ \ifdefined\XeTeXversion
+ \ClassError{Xput}{Shell access failed. #1}{Make sure the xput `scripts' folder is added to your path.\MessageBreak\MessageBreak\@ehc}
+ \else
+ \ClassError{Xput}{Shell access failed. #1}{Make sure the xput `scripts' folder is added to your path.\MessageBreak Shell access does not work in unrestricted mode (--shell-escape).\MessageBreak Make sure `xputserver' is added to the list of shell escape commands\MessageBreak(shell_escape_commands = xputserver) in your `texmf.cnf'.\MessageBreak\MessageBreak\@ehc}
+ \fi
+}
+\def\xput at errmsg@inkscapenotinstalled#1{
+ \ClassError{Xput}{Inkscape not installed. #1}{Make sure Inkscape is installed.\MessageBreak\MessageBreak\@ehc}
+}
+\def\xput at errmsg@magicknotinstalled#1{
+ \ClassError{Xput}{ImageMagick not installed. #1}{Make sure ImageMagick is installed.\MessageBreak\MessageBreak\@ehc}
+}
+\def\xput at errmsg@importdirnotfound#1{
+ \ClassError{Xput}{Import directory `#1' not found}{Create the directory `#1'.\MessageBreak\MessageBreak\@ehc}
+}
+\def\xput at errmsg@noimportdir{
+ \ClassError{Xput}{Import directory not found}{Create the directory `import' in your working directory\MessageBreak or define the shell variable `XPUT_IMPORT_DIRECTORY'.\MessageBreak\MessageBreak\@ehc}
+}
+\def\xput at errmsg@lowdensity#1#2#3{
+ \ifnum#1=0
+ \ClassWarning{Xput}{The file `#2' has a low pixel density of #3 ppi}
+ \else
+ \ClassError{Xput}{The file `#2' has a very low a pixel density of #3 ppi}{Replace the image with one of higher resolution or reduce the display size.\MessageBreak\MessageBreak\@ehc}
+ \fi
+}
Property changes on: trunk/Master/texmf-dist/tex/latex/xput/xput.cls
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2022-12-21 20:56:12 UTC (rev 65325)
@@ -889,7 +889,7 @@
xifthen xii xii-lat xindex xindy-persian xint xintsession xistercian xits
xkcdcolors xkeyval xlop xltabular xltxtra
xml2pmx xmltex xmpincl xmuthesis xnewcommand
- xoptarg xpatch xpeek xpiano xpicture xpinyin xprintlen xpunctuate
+ xoptarg xpatch xpeek xpiano xpicture xpinyin xprintlen xpunctuate xput
xq xsavebox xsim xskak xstring xtab xtuthesis xunicode xurl
xwatermark xyling xymtex xypic xypic-tut-pt xytree
yafoot yagusylo yaletter yamlvars yannisgr yathesis yax yazd-thesis
Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/tlpkg/libexec/ctan2tds 2022-12-21 20:56:12 UTC (rev 65325)
@@ -3529,6 +3529,7 @@
'tex4ebook' => '\.lua$',
'texosquery' => '\.jar$',
'tlcockpit' => '\.jar$',
+ 'xput' => 'xput$',
);
@@ -3663,6 +3664,7 @@
'wordcount' => '\.sh$',
'wheretotrim' => '\.pl$',
'xindex' => 'xindex\.lua$',
+ 'xput' => 'xputserver$',
'yplan' => 'yplan$',
);
@@ -4548,6 +4550,7 @@
next if $s =~ /dtx(file)?gen/;
next if $s =~ /(git-latexdiff|latexfileversion|ltxfileinfo)$/;
next if $s =~ /pdf(book2|xup)/;
+ next if $package eq "xput";
next if $package eq "pdfjam";
next if $package eq "pdftex-quiet";
next if $package eq "tikztosvg";
Modified: trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc 2022-12-21 20:48:01 UTC (rev 65324)
+++ trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc 2022-12-21 20:56:12 UTC (rev 65325)
@@ -236,4 +236,5 @@
depend worldflags
depend xistercian
depend xpicture
+depend xput
depend xypic
Added: trunk/Master/tlpkg/tlpsrc/xput.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/xput.tlpsrc (rev 0)
+++ trunk/Master/tlpkg/tlpsrc/xput.tlpsrc 2022-12-21 20:56:12 UTC (rev 65325)
@@ -0,0 +1 @@
+binpattern f bin/${ARCH}/${PKGNAME}server
More information about the tex-live-commits
mailing list.