summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-12-20 03:01:10 +0000
committerNorbert Preining <norbert@preining.info>2022-12-20 03:01:10 +0000
commitb1e1420cbf53db6acb48b1a88e8b16904f238db2 (patch)
tree1c27c3466baeb4cc563a2097d412a1d13c344f51 /macros
parent8e3f2f40eaf97ca4b3f8023f4c58bdcd98f63e63 (diff)
CTAN sync 202212200301
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/ibrackets/README.md28
-rw-r--r--macros/latex/contrib/ibrackets/ibrackets.dtx200
-rw-r--r--macros/latex/contrib/ibrackets/ibrackets.ins55
-rw-r--r--macros/latex/contrib/ibrackets/ibrackets.pdfbin0 -> 96262 bytes
-rw-r--r--macros/latex/contrib/pdfpages/pdfpages.dtx22
-rw-r--r--macros/latex/contrib/pdfpages/pdfpages.pdfbin301211 -> 301555 bytes
-rw-r--r--macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdfbin755212 -> 767395 bytes
-rw-r--r--macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex731
-rw-r--r--macros/latex/contrib/proflycee/tex/ProfLycee.sty182
-rw-r--r--macros/latex/contrib/xput/LICENSE.txt416
-rw-r--r--macros/latex/contrib/xput/README.md46
-rw-r--r--macros/latex/contrib/xput/doc/1x1.pdfbin0 -> 1028 bytes
-rw-r--r--macros/latex/contrib/xput/doc/2x1.pdfbin0 -> 1064 bytes
-rw-r--r--macros/latex/contrib/xput/doc/3x2.pdfbin0 -> 1067 bytes
-rw-r--r--macros/latex/contrib/xput/doc/example-book.pdfbin0 -> 498079 bytes
-rw-r--r--macros/latex/contrib/xput/doc/example-book.tex111
-rw-r--r--macros/latex/contrib/xput/doc/example-borders-and-shadows.pdfbin0 -> 133420 bytes
-rw-r--r--macros/latex/contrib/xput/doc/example-borders-and-shadows.tex52
-rw-r--r--macros/latex/contrib/xput/doc/example-graphic.pdfbin0 -> 125432 bytes
-rw-r--r--macros/latex/contrib/xput/doc/example-graphic.tex35
-rw-r--r--macros/latex/contrib/xput/doc/example-grid.pdfbin0 -> 12036 bytes
-rw-r--r--macros/latex/contrib/xput/doc/example-grid.tex150
-rw-r--r--macros/latex/contrib/xput/doc/example-template.pdfbin0 -> 6305 bytes
-rw-r--r--macros/latex/contrib/xput/doc/example-template.tex46
-rw-r--r--macros/latex/contrib/xput/doc/example-text.pdfbin0 -> 11123 bytes
-rw-r--r--macros/latex/contrib/xput/doc/example-text.tex53
-rw-r--r--macros/latex/contrib/xput/doc/koepi.jpgbin0 -> 11951047 bytes
-rw-r--r--macros/latex/contrib/xput/doc/xputmanual-layout-guides.pdfbin0 -> 6452 bytes
-rw-r--r--macros/latex/contrib/xput/doc/xputmanual-layout-guides.tex40
-rw-r--r--macros/latex/contrib/xput/doc/xputmanual.pdfbin0 -> 77006 bytes
-rw-r--r--macros/latex/contrib/xput/doc/xputmanual.tex473
-rwxr-xr-xmacros/latex/contrib/xput/scripts/xput509
-rwxr-xr-xmacros/latex/contrib/xput/scripts/xputserver338
-rw-r--r--macros/latex/contrib/xput/tex/xput.cls3740
-rw-r--r--macros/unicodetex/latex/bithesis/bithesis.dtx11
-rw-r--r--macros/unicodetex/latex/bithesis/bithesis.pdfbin1046235 -> 1047736 bytes
36 files changed, 6877 insertions, 361 deletions
diff --git a/macros/latex/contrib/ibrackets/README.md b/macros/latex/contrib/ibrackets/README.md
new file mode 100644
index 0000000000..87ee53c951
--- /dev/null
+++ b/macros/latex/contrib/ibrackets/README.md
@@ -0,0 +1,28 @@
+# Intelligent brackets - The ibrackets package
+
+
+## Presentation
+
+This small package provides a new definition of brackets [ and ] as active characters
+to get correct blank spaces in mathematical mode when using for open intervals
+instead of parenthesis: ]-\infty, 0[ is equivalent to (-\infty, 0).
+
+
+## Installation
+
+- run LaTeX on ibrackets.ins, you obtain the file ibrackets.sty,
+- if then you run pdfLaTeX on ibrackets.dtx you get the file ibrackets.pdf which is also in the archive,
+- put the files ibrackets.sty and ibrackets.pdf in your TeX Directory Structure.
+
+
+## Author
+
+Antoine Missier
+
+Email: antoine.missier@ac-toulouse.fr
+
+
+## License
+
+Released under the LaTeX Project Public License v1.3 or later.
+See http://www.latex-project.org/lppl.txt
diff --git a/macros/latex/contrib/ibrackets/ibrackets.dtx b/macros/latex/contrib/ibrackets/ibrackets.dtx
new file mode 100644
index 0000000000..897cb36de8
--- /dev/null
+++ b/macros/latex/contrib/ibrackets/ibrackets.dtx
@@ -0,0 +1,200 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2022 by Antoine Missier <antoine.missier@ac-toulouse.fr>
+%
+% This file 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.
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{ibrackets.dtx}
+%</driver>
+%<*package>
+\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+\ProvidesPackage{ibrackets}
+ [2022/12/19 v1.0 .dtx ibrackets file]
+%</package>
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[english]{babel}
+\usepackage[charter]{mathdesign}
+\usepackage{ibrackets}
+
+\renewcommand\pi{\piup}
+\DeclareMathSymbol{\OB}\mathopen{operators}{091} % open bracket [
+\DeclareMathSymbol{\CB}\mathclose{operators}{093} % close bracket ]
+
+\DisableCrossrefs
+%\CodelineIndex
+%\RecordChanges
+\usepackage{hyperref}
+\hypersetup{%
+ colorlinks,
+ linkcolor=blue,
+ citecolor=red,
+ pdftitle={ibrackets},
+ pdfsubject={LaTeX package},
+ pdfauthor={Antoine Missier}
+}
+\MakeShortVerb{"}
+\begin{document}
+\DocInput{ibrackets.dtx}
+%\PrintChanges
+%\PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{49}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \changes{v1.0}{2022/12/19}{Initial version, creating dtx and ins files}
+%
+% \GetFileInfo{ibrackets.sty}
+%
+% \title{Intelligent brackets \\ The \textsf{ibrackets} package\thanks{This document
+% corresponds to \textsf{ibrackets}~\fileversion, dated \filedate.}}
+% \author{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}}
+% \date{December 19, 2022}
+% \maketitle
+%
+% \section{Introduction}
+%
+% Open intervals are usually represented with parenthesis $(0, +\infty)$
+% but sometimes we find also
+% brackets $]0, +\infty[$, for example in French mathematics.
+% In that case the space around them is often unsuitable, e.g.\@ $x \in \CB 0, +\infty\OB$.
+% This small package redefines brackets symbols $[$ and $]$ for mathematical mode
+% to get correct spacing: $x \in ]0, +\infty[$.
+%
+% \medskip
+% Originally implemented in the \textsf{mismath} package~\cite{MIS}
+% and also in \textsf{frenchmath}~\cite{FR}
+% since version 2.1, our previous redefinitions produce however incorrect spacing
+% when the left boundary of the interval begins with a sign - or +,
+% which was then interpreted as a binary operation. Thus blank
+% spaces surrounding the sign would have been too large.
+% This problem was pointed out by Jean-François Burnol, and
+% an easy solution, that has been documented, consisted to nest the operator
+% or the left boundary
+% within a pair of braces, e.g.\@ |$x \in ]{-}\infty, 0]$|, or use |\left| and |\right|
+% or even |\mathopen{]}|.
+%
+% \medskip
+% Inspired by the \textsf{icomma} package~\cite{ICOMMA} of Walter Schmidt, we now provide
+% an improved bracket definition that works correctly without
+% these pair of brackets.
+%
+% \medskip
+% Let us also mention other approaches e.g.\@ |\DeclarePairedDelimiters|, a macro from
+% the \textsf{mathtools} package~\cite{TOOL}, or
+% the \textsf{interval} package~\cite{INT} with his
+% |\interval| macro. Nevertheless our solution is lighter.
+%
+% \section{Usage}
+% You just have to type intervals in an easy way:
+% |$x\in ]0,\pi[ \cup ]2\pi,3\pi[$|
+% produce
+% \[ x\in ]0, \pi[ \cup ]2\pi, 3\pi[ \mbox{\quad with \textsf{ibrackets}}, \]
+% instead of
+% \[ x\in \CB 0,\pi \OB \cup \CB 2\pi, 3\pi \OB \mbox{\quad without \textsf{ibrackets}}. \]
+
+% Generally $[$ and $]$ symbols are not defined anymore as delimiters,
+% but as ordinary characters.
+% Thereby a line break could occur between the two brackets, but
+% it is always possible to transform them
+% into delimiters with |\left| and |\right|.
+%
+% \medskip
+% The problem of a sign following the first bracket is solved with this package,
+% so the example in the introduction is simply obtained with |$x \in ]-\infty, 0]$|
+% which gives $x \in ]-\infty, 0]$.
+%
+% \medskip
+% \emph{However, you don't have to leave a space between the first bracket and the sign}: e.g.\@
+% |$x \in ] -\infty, 0]$| yields $x \in ] -\infty, 0]$ with bad spacing around the
+% minus sign.
+% Contrariwise, when you want to write algebra on intervals then
+% \emph{you must leave a blank space between the second bracket and the} +/- \emph{operations},
+% e.g.\@ |$[a, b] + [c, d]$| yields $[a, b] + [c, d]$
+% but |$[a, b]+ [c, d]$| yields $[a, b]+ [c, d]$.
+% To summarize the new behavior of a bracket: it is an ordinary character,
+% but an open delimiter when it is immediately followed by a + or - character.
+%
+% \StopEventually{}
+%
+% \section{Implementation}
+% At |\begin{document}|, we memorize the "\mathcode" of the original brackets,
+% in the |\math...bracket| macros, and we make the brackets in math mode active:
+% \begin{macrocode}
+\AtBeginDocument{%
+ \mathchardef\mathopenbracket\mathcode`[%
+ \mathcode`[="8000
+ \mathchardef\mathclosebracket\mathcode`]%
+ \mathcode`]="8000
+% \end{macrocode}
+% The active brackets check the next input character. If this is a - or a +,
+% the active brackets return |\mathopen| with the saved |\math...bracket|
+% so that no space will be added after the bracket;
+% otherwise, |\mathord\math...bracket| is returned :
+% \begin{macrocode}
+}
+{\catcode`[=\active
+ \gdef[{\futurelet\@next\sm@rtopenbracket}
+}
+\def\sm@rtopenbracket{%
+ \ifx\@next- \mathopen \else
+ \ifx\@next+ \mathopen \else
+ \mathord\fi\fi \mathopenbracket}
+
+{\catcode`]=\active
+ \gdef]{\futurelet\@next\sm@rtclosebracket}
+}
+\def\sm@rtclosebracket{%
+ \ifx\@next- \mathopen \else
+ \ifx\@next+ \mathopen \else
+ \mathord\fi\fi \mathclosebracket}
+% \end{macrocode}
+% We could have use the internal \TeX\ command |\@ifnextchar|
+% to skip blank spaces after the bracket, and look if there is a + or - after,
+% but then it would become tricky when you really want
+% to follow an interval with an operation plus or minus.
+%
+% \begin{thebibliography}{5}
+% \bibitem{MIS} \emph{\textsf{mismath} -- Miscellaneus mathematical macros}.
+% Antoine Missier, CTAN, v2.0 2022/11/11.
+% \bibitem{FR} \emph{L'extension \textsf{frenchmath}}. Antoine Missier, CTAN, v2.2 2022/12/15.
+% \bibitem{ICOMMA} \emph{The \textsf{icomma} package for \LaTeXe}.
+% Walter Schmidt, CTAN, v2.0 2002/03/10.
+% \bibitem{TOOL} \emph{The \textsf{mathtool} package}. Morten Høgholm, Lars Madsen, CTAN,
+% v1.21 2018/01/08.
+% \bibitem{INT} \emph{The \textsf{interval} package}. Lars Madsen, CTAN,
+% v0.4 2019/03/06.
+% \end{thebibliography}
+% \Finale
+\endinput
diff --git a/macros/latex/contrib/ibrackets/ibrackets.ins b/macros/latex/contrib/ibrackets/ibrackets.ins
new file mode 100644
index 0000000000..05e63feb5b
--- /dev/null
+++ b/macros/latex/contrib/ibrackets/ibrackets.ins
@@ -0,0 +1,55 @@
+%%
+%% Copyright (C) 2022 by Antoine Missier <antoine.missier@ac-toulouse.fr>
+%%
+%% This file 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.
+%%
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{tex/latex/ibrackets}
+
+\preamble
+
+This is a generated file.
+
+Copyright (C) 2022 by Antoine Missier <antoine.missier@ac-toulouse.fr>
+
+This file 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.
+
+\endpreamble
+
+\generate{\file{ibrackets.sty}{\from{ibrackets.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* files into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* ibrackets.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file *}
+\Msg{* ibrackets.dtx through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
diff --git a/macros/latex/contrib/ibrackets/ibrackets.pdf b/macros/latex/contrib/ibrackets/ibrackets.pdf
new file mode 100644
index 0000000000..a45c0dc20f
--- /dev/null
+++ b/macros/latex/contrib/ibrackets/ibrackets.pdf
Binary files differ
diff --git a/macros/latex/contrib/pdfpages/pdfpages.dtx b/macros/latex/contrib/pdfpages/pdfpages.dtx
index 7496cc82d0..8dea875318 100644
--- a/macros/latex/contrib/pdfpages/pdfpages.dtx
+++ b/macros/latex/contrib/pdfpages/pdfpages.dtx
@@ -27,12 +27,12 @@
%<*dtx>
\makeatletter
%</dtx>
-\def\AM@fileversion{v0.5w}
+\def\AM@fileversion{v0.5x}
\def\AM@Git@Date@process$#1: #2 #3${\AM@Git@Date@process@i#2\END}
\def\AM@Git@Date@process@i#1-#2-#3\END{\def\AM@Git@Date{#1/#2/#3}}
\def\AM@Git@SHA@process$#1: #2${\def\AM@Git@SHA{#2}}
-\AM@Git@Date@process$Date: 2022-10-09 23:29:26 +0200 $
-\AM@Git@SHA@process$SHA-1: b912335fcefa15a5e7de97ef3732a2dcb82fe755 $
+\AM@Git@Date@process$Date: 2022-12-19 22:46:31 +0100 $
+\AM@Git@SHA@process$SHA-1: 730ca37af6c475efcbb518a30f4e6a615378fa58 $
%</!(example1,example2,example3,installer)>
%
%
@@ -3054,10 +3054,10 @@
\def\@fs@capt##1##2{}% float.sty
\AM@addtolist@hook
\@ifundefined{hyper@@anchor}{%
- \expandafter\caption\expandafter{\AM@lof@heading}%
+ \expandafter\caption\expandafter{\the\AM@lof@heading}%
}{%
\hyper@makecurrent{\@captype}%
- \expandafter\caption\expandafter{\AM@lof@heading}%
+ \expandafter\caption\expandafter{\the\AM@lof@heading}%
\hyper@@anchor{\@currentHref}{\relax}%
\let\Hy@float@currentHref\@undefined
}%
@@ -3074,11 +3074,12 @@
}
% \end{macrocode}
% \begin{macrocode}
+\newtoks\AM@lof@heading
\newcommand{\AM@parse@loflisti}{}
\def\AM@parse@loflisti#1,#2,#3,#4,#5\END{%
\edef\AM@lof@page{\AM@trim@space{#1}}%
\edef\AM@lof@list{\AM@trim@space{#2}}%
- \def\AM@lof@heading{\ignorespaces #3}%
+ \AM@lof@heading{\ignorespaces #3}%
\edef\AM@lof@label{\AM@trim@space{#4}}%
\AM@checkinteger{\AM@lof@page}%
\ifAM@integer\else
@@ -3242,8 +3243,8 @@
\else\AM@outputfalse\fi}
\define@key{pdfpages}{xr-prefix}{\edef\AM@xrprefix{#1}}
\define@key{pdfpages}{fitpaper}[true]{\setboolean{AM@fitpaper}{#1}}
-\define@key{pdfpages}{addtotoc}{\edef\AM@toclist{#1,}}
-\define@key{pdfpages}{addtolist}{\edef\AM@loflist{#1,}}
+\define@key{pdfpages}{addtotoc}{\protected@edef\AM@toclist{#1,}}
+\define@key{pdfpages}{addtolist}{\protected@edef\AM@loflist{#1,}}
\define@key{pdfpages}{doublepages}[true]%
{\setboolean{AM@doublepages}{#1}}
\define@key{pdfpages}{doublepagestwist}[true]%
@@ -4871,6 +4872,11 @@
% \begin{itemize}
% \item Keyval arguments get fully expanded.
% \end{itemize}
+%
+% \subsection*{2022/12/19 v0.5x}
+% \begin{itemize}
+% \item Expand args of addtotoc and addtolist more graciously.
+% \end{itemize}
% \Finale
%
% \iffalse
diff --git a/macros/latex/contrib/pdfpages/pdfpages.pdf b/macros/latex/contrib/pdfpages/pdfpages.pdf
index 918fc0a62f..6c8e9d74b2 100644
--- a/macros/latex/contrib/pdfpages/pdfpages.pdf
+++ b/macros/latex/contrib/pdfpages/pdfpages.pdf
Binary files differ
diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf
index ab2a1ab273..3aadbd377b 100644
--- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf
+++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex
index 75756a5bb8..b3c364786e 100644
--- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex
+++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex
@@ -6,7 +6,7 @@
\documentclass{article}
\usepackage[french]{babel}
-\usepackage{ProfLycee}
+\usepackage[pythontex]{ProfLycee}
\usepackage{mathtools}
\usepackage{lualatex-math}
\usepackage{luatexbase}
@@ -62,8 +62,8 @@
\setlength{\parindent}{0pt}
\definecolor{LightGray}{gray}{0.9}
-\def\PLversion{2.0.9}
-\def\PLdate{15 Décembre 2022}
+\def\PLversion{2.1.0}
+\def\PLdate{18 Décembre 2022}
\tcbset{vignettes/.style={%
nobeforeafter,box align=base,boxsep=0pt,enhanced,sharp corners=all,rounded corners=southeast,%
@@ -221,7 +221,7 @@
\thispagestyle{empty}
-{\Large {\bfseries Résumé} : Quelques commandes pour faciliter l'utilisation de \LaTeX{} pour les enseignants de mathématiques en lycée.}
+{\large {\bfseries Résumé} : Quelques commandes pour faciliter l'utilisation de \LaTeX{} pour les enseignants de mathématiques en lycée.}
\medskip
@@ -265,7 +265,9 @@ Une commande pour, en \TikZ, créer des arbres de probas \og classiques \fg.
Une commande pour générer des listes d'entiers aléatoires (avec ou sans répétitions).
-\vspace{1.5cm}
+\ldots
+
+~
\hfill{}\textit{Merci à Anne pour ses retours et sa relecture !}
@@ -279,13 +281,13 @@ Une commande pour générer des listes d'entiers aléatoires (avec ou sans rép
\medskip
-\begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}}
- {\huge \LaTeX} & & & & &\\
- & {\huge \pdfLaTeX} & & & & \\
- & & {\huge \LuaLaTeX} & & & \\
- & & & {\huge \TikZ} & & \\
- & & & & {\huge \TeXLive} & \\
- & & & & & {\huge \MiKTeX} \\
+\begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily\LARGE}}
+ {\LaTeX} & & & & &\\
+ & {\pdfLaTeX} & & & & \\
+ & & {\LuaLaTeX} & & & \\
+ & & & {\TikZ} & & \\
+ & & & & {\TeXLive} & \\
+ & & & & & {\MiKTeX} \\
\end{tblr}
\medskip
@@ -345,20 +347,19 @@ J'ai utilisé les {packages} de C. Tellechea, je vous conseille d'aller jeter un
\begin{codetex}[listing only]
%exemple de chargement pour une compilation en (pdf)latex
\documentclass{article}
-\usepackage[french]{babel}
\usepackage{ProfLycee}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
+\usepackage[french]{babel}
...
\end{codetex}
\begin{codetex}[listing only]
%exemple de chargement pour une compilation en (xe/lua)latex
\documentclass{article}
-\usepackage[french]{babel}
\usepackage{ProfLycee}
-\usepackage{mathtools}
\usepackage{fontspec}
+\usepackage[french]{babel}
...
\end{codetex}
@@ -377,6 +378,18 @@ Cependant, si vous ne \underline{souhaitez pas} charger (et utiliser) \ctex{mint
...
\end{codetex}
+\begin{codeattention}
+\cmaj{2.1.0} Le package\ctex{pythontex} nécessitant une chaîne de compilation particulière, j'ai décidé de le mettre en \textit{option}.
+
+Pour utiliser le package \ctex{pythontex} et utiliser les commandes définies à partir de lui, il faut désormais charger \ctex{ProfLycee} avec l'option \Cle{pythontex}.
+\end{codeattention}
+
+\begin{codetex}[listing only]
+...
+\usepackage[pythontex]{ProfLycee}
+...
+\end{codetex}
+
\begin{codeinfo}
En compilant (notamment avec les packages \ctex{minted} et \ctex{pythontex}) on peut spécifier des répertoires particuliers pour les (ou des) fichiers auxiliaires.
@@ -402,6 +415,8 @@ Les options précédentes sont cumulables, et, pour info, elles conditionnent le
\end{itemize}
\end{codeinfo}
+\pagebreak
+
\section{Compléments}
\subsection{Changements à partir de cette version !!}
@@ -483,6 +498,8 @@ Les \textsf{clés} ou \textsf{options} seront présentées dans des \textsf{boî
À noter que certaines commandes disponibles sont liées à un environnement \ctex{tikzpicture}, elles ne sont pas autonomes mais permettent de conserver -- en parallèle -- toute commande liée à \TikZ{} !
\end{codeinfo}
+\pagebreak
+
\subsection{Compilateur(s)}
\begin{codeinfo}
@@ -516,12 +533,20 @@ Certains packages ont une fâcheuse tendance à être tatillons sur leurs option
En dehors de cela, ce sont des tests multiples et variés qui permettront de détecter d'éventuels bugs !
\end{codeinfo}
+\pagebreak
+
+~
+
\vfill
-\hfill{\Huge $\leftrightsquigarrow$ Bonne(s) découverte(s) $\leftrightsquigarrow$}\hfill~
+%\hfill{\Huge $\leftrightsquigarrow$ Bonne(s) découverte(s) $\leftrightsquigarrow$}\hfill~
+
+\hfill\tikz \draw (0,0) node[above right=0pt,inner sep=0pt,outer sep=0pt,rotate=25,scale=4] {$\leftrightsquigarrow$ Bonne(s) découverte(s) $\leftrightsquigarrow$} ;\hfill~
\vfill
+~
+
\newpage
\part{Liste des commandes, par thème}
@@ -540,6 +565,10 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent
%Présentation d'une solution par balayage (TVI)
\SolutionTVI[<options>]{<fonction>}{<valeur>}
+%schémas pour le signe affine/trinôme, dans un environnement tikz
+\MiniSchemaSignes[<clés>]
+\MiniSchemaSignesTkzTab[<options>]{<numligne>}[<echelle>][<décalage horizontal>]
+
%Calculer le terme d'une suite récurrente simple, toile pour une suite récurrente simple
\CalculTermeRecurrence[<options>]{<fonction associée>}
\ToileRecurrence[<clés>][<options du tracé>][<option supplémentaire des termes>]
@@ -556,10 +585,10 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent
%présentation de code Python
\begin{CodePythonLst}(*)[<largeur>]{<commandes tcbox>}...\end{CodePythonLst}
\begin{CodePiton}[<options>]...\end{CodePiton}
-\begin{CodePythontex}[<options>]...\end{CodePythontex}
+\begin{CodePythontex}[<options>]...\end{CodePythontex} %avec l'option [pythontex]
\begin{CodePythonMinted}(*)[<largeur>][<options>]...\end{CodePythonMinted}
-%console Python
+%console Python avec l'option [pythontex]
\begin{ConsolePythontex}[<options>]...\end{ConsolePythontex}
%présentation de pseudocode
@@ -610,24 +639,26 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent
\BinomP(*)[prec]{n}{p}{k}
\BinomC(*)[prec]{n}{p}{a}{b}
-%loi de Poisson P (l)
+%loi de Poisson P(l)
\CalcPoissP{l}{k}
\CalcPoissC{l}{a}{b}
\PoissonP(*)[prec]{l}{k}
\PoissonC(*)[prec]{l}{a}{b}
-%loi géométrique G (p)
+%loi géométrique G(p)
\CalcGeomP{p}{k}
\CalcGeomC{l}{a}{b}
\GeomP{p}{k}
\GeomC{l}{a}{b}
-%loi hypergéométrique H (N,n,m)
+%loi hypergéométrique H(N,n,m)
\CalcHypergeomP{N}{n}{m}{k}
\CalcHypergeomP{N}{n}{m}{a}{b}
\HypergeomP{N}{n}{m}{k}
\HypergeomC{N}{n}{m}{a}{b}
+\end{codetex}
+\begin{codetex}[listing only]
%loi normale N(m,s)
\CalcNormC{m}{s}{a}{b}
\NormaleC(*)[prec]{m}{s}{a}{b}
@@ -646,6 +677,17 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent
\end{codetex}
\begin{codetex}[listing only]
+%entier aléatoire entre a et b
+\NbAlea{a}{b}{<macro>}
+%nombre décimal (n chiffres après la virgule) aléatoire entre a et b+1 (exclus)
+\NbAlea[n]{a}{b}{<macro>}
+%création d'un nombre aléatoire sous forme d'une macro
+\VarNbAlea{<macro>}{<calculs>}
+%liste d'entiers aléatoires
+\TirageAleatoireEntiers[<options>]{<macro>}
+\end{codetex}
+
+\begin{codetex}[listing only]
%conversions
\ConversionDecBin(*)[<clés>]{<nombre>}
\ConversionBinHex[<clés>]{<nombre>}
@@ -658,16 +700,13 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent
\end{codetex}
\begin{codetex}[listing only]
-%conversion en fraction
+%conversion en fraction, simplification de racine
\ConversionFraction[<option>]{<argument>}
+\SimplificationRacine{<expression>}
%ensemble d'éléments
\EcritureEnsemble[<clés>]{<liste>}
-%schémas pour le signe affine/trinôme, dans un environnement tikz
-\MiniSchemaSignes[<clés>]
-\MiniSchemaSignesTkzTab[<options>]{<numligne>}[<echelle>][<décalage horizontal>]
-
%trinôme, trinôme aléatoire
\EcritureTrinome[<options>]{a}{b}{c}
\end{codetex}
@@ -1023,7 +1062,7 @@ Plusieurs \Cle{Clés} sont disponibles pour cette commande, relative donc à une
\item la clé \Cle{Precision} qui est la précision des calculs pour les images ;\hfill{}défaut \Cle{2}
\item la clé \Cle{Stretch} qui permet d'espacer les lignes ;\hfill{}défaut \Cle{1.15}
\item les booléens \Cle{Balayage} ou \Cle{Calculatrice} pour afficher un texte en amont ;\hfill{}défaut \Cle{false}
- \item le booléen qui affiche un texte avant, en spécifiant la calculatrice ;\hfill{}défaut \Cle{false}
+ %\item le booléen \Cle{Simple} pour une présentation plus \textit{neutre} ;\hfill{}défaut \Cle{false}
\item le booléen \Cle{Majuscule} qui affiche le texte avant, avec une majuscule au début ;\hfill{}défaut \Cle{true}
\end{itemize}
@@ -1048,6 +1087,210 @@ On s'intéresse à $g(x)=\num{1,5}$ avec $g(x)=\ln(x)$.
\newpage
+\section{Petits schémas pour le signe d'une fonction affine ou d'un trinôme}\label{aidesigne}
+
+\subsection{Idée}
+
+\begin{codeidee}
+L'idée est d'obtenir une commande pour tracer (en \TikZ) un petit schéma pour \textit{visualiser} le signe d'une fonction affine ou d'un trinôme.
+
+Le code est très largement inspiré de celui du package \ctex{tnsana} même si la philosophie est légèrement différente.
+
+\smallskip
+
+Comme pour les autres commandes \TikZ, l'idée est de laisser l'utilisateur définir et créer son environnement \TikZ, et d'insérer la commande \ctex{MiniSchemaSignes} pour afficher le schéma.
+\end{codeidee}
+
+\begin{codetex}[tikz lower]
+%code tikz
+\MiniSchemaSignes[<clés>]
+\end{codetex}
+
+\subsection{Commandes}
+
+\begin{codetex}[listing only]
+...
+\begin{tikzpicture}[<options>]
+ ...
+ \MiniSchemaSignes[<clés>]
+ ...
+\end{tikzpicture}
+\end{codetex}
+
+\begin{codetex}[listing only]
+... {\tikz[<options>] \MiniSchemaSignes[<clés>]}...
+\end{codetex}
+
+\begin{codecles}
+Plusieurs \Cle{Clés} sont disponibles pour cette commande :
+
+\begin{itemize}
+ \item la clé \Cle{Code} qui permet de définir le type d'expression (voir en-dessous) ;\hfill{}défaut \Cle{da+}
+ \item la clé \Cle{Couleur} qui donne la couleur de la représentation ;\hfill{}défaut \Cle{red}
+ \item la clé \Cle{Racines} qui définit la ou les racines ;\hfill{}défaut \Cle{2}
+ \item la clé \Cle{Largeur} qui est la largeur du schéma ;\hfill{}défaut \Cle{2}
+ \item la clé \Cle{Hauteur} qui est la hauteur du schéma ;\hfill{}défaut \Cle{1}
+ \item un booléen \Cle{Cadre} qui affiche un cadre autour du schéma.\hfill{}défaut \Cle{true}
+\end{itemize}
+\end{codecles}
+
+\begin{codecles}
+Pour la clé \Cle{code}, il est construit par le type (\textsf{a} pour affine ou \textsf{p} comme parabole) puis les éléments caractéristiques (\textsf{a+} pour $a>0$, \textsf{d0} pour $\Delta=0$, etc) :
+
+\begin{itemize}
+ \item \Cle{Code=da+} := une droite croissante ;
+ \item \Cle{Code=da-} := une droite décroissante ;
+ \item \Cle{Code=pa+d+} := une parabole \textit{souriante} avec deux racines ;
+ \item etc
+\end{itemize}
+\end{codecles}
+
+\pagebreak
+
+\begin{codetex}[listing only]
+\begin{center}
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=da+,Racines=-4]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=da-,Racines={h},Couleur=blue,Largeur=3,Cadre=false]
+ \end{tikzpicture}
+\end{center}
+%
+\begin{center}
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa+d+,Racines={1/2},Couleur=orange]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa+d-,Couleur=ForestGreen]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa+d0,Racines={5},Couleur=purple]
+ \end{tikzpicture}
+\end{center}
+%
+\begin{center}
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa-d+,Racines={-3/0},Couleur=yellow]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa-d-,Couleur=cyan]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa-d0,Racines={-1},Couleur=magenta]
+ \end{tikzpicture}
+\end{center}
+\end{codetex}
+
+\begin{codesortie}
+\begin{center}
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=da+,Racines=-4]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=da-,Racines={h},Couleur=blue,Largeur=3,Cadre=false]
+ \end{tikzpicture}
+\end{center}
+%
+\begin{center}
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa+d+,Racines={1/2},Couleur=orange]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa+d-,Couleur=ForestGreen]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa+d0,Racines={5},Couleur=purple]
+ \end{tikzpicture}
+\end{center}
+%
+\begin{center}
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa-d+,Racines={-3/0},Couleur=yellow]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa-d-,Couleur=cyan]
+ \end{tikzpicture}
+ ~~~~
+ \begin{tikzpicture}
+ \MiniSchemaSignes[Code=pa-d0,Racines={-1},Couleur=magenta]
+ \end{tikzpicture}
+\end{center}
+\end{codesortie}
+
+\begin{codetex}[tikz lower]
+%code tikz
+\MiniSchemaSignes[Largeur=3.5,Hauteur=1.5,Code=da-,Racines=\tfrac{-b}{a},Couleur=Plum]
+\end{codetex}
+
+\subsection{Intégration avec tkz-tab}
+
+\begin{codeidee}
+Ces schémas peuvent être de plus utilisés, via la commande \ctex{MiniSchemaSignesTkzTab} pour illustrer les signes obtenus dans un tableau de signes présentés grâce au package \ctex{tkz-tab}.
+
+Pour des raisons internes, le fonctionnement de la commande \ctex{aidesignetkztabPL} est légèrement différent et, pour des raisons que j'ignore, le code est légèrement différent en \textit{interne} (avec une \textit{déconnexion} des caractères \textsf{:} et \textsf{\textbackslash}) pour que la librairie \TikZ{} \ctex{calc} puisse fonctionner (mystère pour le moment\ldots)
+\end{codeidee}
+
+\begin{codetex}[listing only]
+\begin{tikzpicture}
+ %commandes tkztab
+ \MiniSchemaSignesTkzTab[<options>]{<numligne>}[<echelle>][<décalage horizontal>]
+\end{tikzpicture}
+\end{codetex}
+
+\begin{codecles}
+Les \Cle{Clés} pour le premier argument optionnel sont les mêmes que pour la version \textit{initiale} de la commande précédente.
+
+En ce qui concerne les autres arguments :
+
+\begin{itemize}
+ \item le deuxième argument, mandataire, est le numéro de la ligne à côté de laquelle placer le schéma ;
+ \item le troisième argument, optionnel et valant \Cle{0.85} par défaut, est l'échelle à appliquer sur l'ensemble du schéma (à ajuster en fonction de la hauteur de la ligne) ;
+ \item le quatrième argument, optionnel et valant \Cle{1.5} par défait, est lié à l'écart horizontal entre le bord de la ligne du tableau et le schéma.
+\end{itemize}
+
+À noter que si l'un des arguments optionnels (le n°3 et/ou le n°4) sont utilisés, il vaut mieux préciser les 2 !
+\end{codecles}
+
+\begin{codetex}[listing only]
+\begin{center}
+ \begin{tikzpicture}
+ \tkzTabInit[]{$x$/1,$-2x+5$/1,$2x+4$/1,$p(x)$/1}{$-\infty$,$-2$,${2,5}$,$+\infty$}
+ \tkzTabLine{,+,t,+,z,-,}
+ \tkzTabLine{,-,z,+,t,+,}
+ \tkzTabLine{,-,z,+,z,-,}
+ \MiniSchemaSignesTkzTab[Code=da-,Racines={2,5},Couleur=blue]{1}
+ \MiniSchemaSignesTkzTab[Code=da+,Racines={-2},Couleur=purple]{2}
+ \MiniSchemaSignesTkzTab[Code=pa-d+,Racines={-2/2,5},Couleur=orange]{3}[0.85][2]
+ \end{tikzpicture}
+\end{center}
+\end{codetex}
+
+\begin{codesortie}
+\begin{center}
+ \begin{tikzpicture}
+ \tkzTabInit[]{$x$/1,$-2x+5$/1,$2x+4$/1,$p(x)$/1}{$-\infty$,$-2$,${2,5}$,$+\infty$}
+ \tkzTabLine{,+,t,+,z,-,}
+ \tkzTabLine{,-,z,+,t,+,}
+ \tkzTabLine{,-,z,+,z,-,}
+ \MiniSchemaSignesTkzTab[Code=da-,Racines={2,5},Couleur=blue]{1}
+ \MiniSchemaSignesTkzTab[Code=da+,Racines={-2},Couleur=purple]{2}
+ \MiniSchemaSignesTkzTab[Code=pa-d+,Racines={-2/2,5},Couleur=orange]{3}[0.85][2]
+ \end{tikzpicture}
+\end{center}
+\end{codesortie}
+
+\newpage
+
\section{Suites récurrentes simples}\label{calcrecurr}
\subsection{Idées}
@@ -1062,7 +1305,7 @@ On s'intéresse à $g(x)=\num{1,5}$ avec $g(x)=\ln(x)$.
\end{codeidee}
\begin{codeattention}
-Le code pour le seuil ne trouve pas la solution (\ldots), il met \textit{juste} en forme et effectue quand même les calculs d'images.
+\cmaj{2.1.0} Le code pour le seuil \textbf{trouve} également le rang cherché, il met en forme et effectue les calculs d'images.
\smallskip
@@ -1127,13 +1370,15 @@ Plusieurs \Cle{Clés} sont disponibles pour la commande du seuil :
\item la clé \Cle{NomSuite} qui est le nom de la suite ;\hfill~défaut \Cle{u}
\item la clé \Cle{No} qui est le rang initial de la suite ;
\item la clé \Cle{UNo} qui est le terme initial de la suite ;
- \item la clé \Cle{SolN} qui est la valeur de l'indice cherché ;
+ %\item la clé \Cle{SolN} qui est la valeur de l'indice cherché ;
\item la clé \Cle{Precision} qui précise l'arrondi éventuel ;\hfill{}défaut \Cle{2}
\item la clé \Cle{Stretch} qui permet d'espacer les lignes ;\hfill{}défaut \Cle{1.15}
\item les booléens \Cle{Balayage} ou \Cle{Calculatrice} pour afficher un texte en amont ;\hfill{}défaut \Cle{false}
- \item le booléen qui affiche un texte avant, en spécifiant la calculatrice ;\hfill{}défaut \Cle{false}
+ \item le booléen \Cle{Simple} pour une présentation plus \textit{neutre} ;\hfill{}défaut \Cle{false}
\item le booléen \Cle{Majuscule} qui affiche le texte avant, avec une majuscule au début ;\hfill{}défaut \Cle{true}
- \item la clé \Cle{Sens} (parmi \Cle{<} ou \Cle{>}) pour indiquer le type de seuil.\hfill{}défaut \Cle{>}
+ \item le booléen \Cle{Exact} qui affiche \ctex{=} au lieu de \ctex{\textbackslash approx} ;\hfill{}défaut \Cle{false}
+ \item le booléen \Cle{Conclusion} pour afficher la conclusion ou non ;\hfill{}défaut \Cle{true}
+ \item la clé \Cle{Sens} parmi \Cle{< / > / <= / >=} pour indiquer le type de seuil.\hfill{}défaut \Cle{>}
\end{itemize}
\smallskip
@@ -1144,8 +1389,8 @@ Le premier argument mandataire est la fonction associée à la suite, en syntaxe
\begin{codetex}[]
Avec $\begin{dcases} u_1 = 2 \\ u_{n+1}=1+\dfrac{1+u_n^2}{1+u_n} \end{dcases}$,
on cherche $n$ tel que $u_n > 5$.\\
-\SolutionSeuil[Balayage,No=1,UNo=2,SolN=8]{1+(1+x**2)/(1+x)}{5}.\\
-\SolutionSeuil[Calculatrice,Precision=3,No=1,UNo=2,SolN=8]{1+(1+x**2)/(1+x)}{5}.\\
+\SolutionSeuil[Balayage,No=1,UNo=2]{1+(1+x**2)/(1+x)}{5}.
+~\SolutionSeuil[Calculatrice,Precision=4,No=1,UNo=2,Conclusion=false]{1+(1+x**2)/(1+x)}{5}.\\
\end{codetex}
\subsection{Exemple d'utilisation}
@@ -1157,7 +1402,9 @@ on obtient le tableau de valeurs suivant :
$n$ & $u_n$ \\ \hline
1 & 2 \\
\xintFor* #1 in {\xintSeq{2}{8}} \do {#1 & \CalculTermeRecurrence[No=1,UNo=2,N=#1]{1+(1+x**2)/(1+x)} \\}
-\end{tabular}
+\end{tabular}\\
+
+\SolutionSeuil[Precision=4,No=1,UNo=2,Simple]{1+(1+x**2)/(1+x)}{10} (Ainsi $u_n > 10$ à partir de $n=\the\CompteurSeuil$)
\end{codetex}
\newpage
@@ -1776,6 +2023,8 @@ Le {package} \ctex{pythontex} permet d'insérer et d'exécuter du code Python. O
\begin{codeattention}
\textbf{Attention : }il faut dans ce cas une compilation en plusieurs étapes, comme par exemple \textsf{pdflatex puis pythontex puis pdflatex} !
+\cmaj{2.1.0} Il faut de plus penser à charger le package avec l'option \Cle{pythontex}.
+
Voir par exemple \url{http://lesmathsduyeti.fr/fr/informatique/latex/pythontex/} !
\end{codeattention}
@@ -1905,6 +2154,8 @@ Plusieurs \Cle{arguments} (optionnels) sont disponibles :
\ctex{pythontex} permet également de \textit{simuler} (en exécutant également !) du code python dans une \textit{console}.
C'est l'environnement \ctex{ConsolePythontex} qui permet de le faire.
+
+\cmaj{2.1.0} Il ne faut donc pas oublier de charger le package \ctex{ProfLycee} avec l'option \Cle{pythontex}.
\end{codeidee}
\begin{codetex}[listing only]
@@ -2679,6 +2930,75 @@ Les \Cle{Clés} pour cette possibilité sont :
\newpage
+\section{Style \og main levée \fg{} en \TikZ}\label{mainlevee}
+
+\subsection{Idée}
+
+\begin{codeidee}
+L'idée est de \textit{proposer} un style \textit{tout prêt} pour simuler un tracé, en \TikZ, à \og main levée \fg.
+
+Il s'agit d'un style \textit{basique} utilisant la librairie \ctex{decorations} avec \textsf{random steps}.
+\end{codeidee}
+
+\begin{codetex}[listing only]
+\tikzset{%
+ mainlevee/.style args={#1et#2}{decorate,decoration={random steps, segment length=#1,amplitude=#2}},
+ mainlevee/.default={5mm et 0.6pt}
+}
+\end{codetex}
+
+\subsection{Utilisation basique}
+
+\begin{codeinfo}
+Il s'agit ni plus ni moins d'un style \TikZ{} à intégrer dans les tracés et constructions \TikZ !
+\end{codeinfo}
+
+\begin{codecles}
+Concernant le style en lui-même, deux paramètres peuvent être précisés via \Cle{mainlevee=\#1 et \#2} :
+
+\begin{itemize}
+ \item \Cle{\#1} correspond à l'option \textsf{segment length} (longueur des segments \textit{types}) ;\hfill{}défaut \Cle{5mm}
+ \item \Cle{\#2} correspond à l'option \textsf{amplitude} (amplitude maximale de la \textit{déformation}).\hfill{}défaut \Cle{0.6pt}
+\end{itemize}
+
+Les valeurs \Cle{mainlevee=5mm et 0.6pt} donnent des résultats -- à mon sens -- satisfaisants, mais l'utilisateur pourra modifier à loisir ces paramètres !
+\end{codecles}
+
+\begin{codetex}[listing only]
+%la grille a été rajoutée pour la sortie
+\begin{tikzpicture}
+ \draw[thick,mainlevee] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
+\end{tikzpicture}
+
+\begin{tikzpicture}
+ \draw[thick,mainlevee=5mm et 2pt] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
+\end{tikzpicture}
+
+\begin{tikzpicture}
+ \draw[thick,mainlevee=10mm et 3mm] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
+\end{tikzpicture}
+\end{codetex}
+
+\begin{codesortie}
+\hfill~\begin{tikzpicture}
+ \draw[xstep=0.5,ystep=0.5,ultra thin,lightgray] (0,0) grid (4,4);
+ \draw[thick,mainlevee] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
+\end{tikzpicture}
+\hspace{1.5cm}
+\begin{tikzpicture}
+ \draw[xstep=0.5,ystep=0.5,ultra thin,lightgray] (0,0) grid (4,4);
+ \draw[thick,mainlevee=5mm et 2pt] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
+\end{tikzpicture}
+\hspace{1.5cm}
+\begin{tikzpicture}
+ \draw[xstep=0.5,ystep=0.5,ultra thin,lightgray] (0,0) grid (4,4);
+ \draw[thick,mainlevee=10mm et 3mm] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
+\end{tikzpicture}
+\hfill~
+\end{codesortie}
+
+\newpage
+
\part{Outils pour les statistiques}
\section{Paramètres d'une régression linéaire par la méthode des moindres carrés}\label{reglin}
@@ -3204,7 +3524,7 @@ Cette commande permet de tracer les axes, avec des \Cle{clés} :
\begin{codetex}[listing only]
%...code tikz
\AxexTikz[<options>]{valeurs}
- \AxexTikz[<options>]{valeurs}
+ \AxeyTikz[<options>]{valeurs}
\end{codetex}
\begin{codecles}
@@ -4144,7 +4464,7 @@ Entier entre 1 et 50 : \NbAlea{1}{50}{\PremierNbAlea}\PremierNbAlea
%nombre aléatoire créé à partir du 1er, stocké dans \DeuxiemeNbAlea
Entier à partir du précédent : \VarNbAlea{\DeuxiemeNbAlea}{\PremierNbAlea+randint(0,10)}\DeuxiemeNbAlea
-%nombre aléatoire décimal (au millième) entre 0 et 10+1 (exlus), stocké dans \PremierDecAlea
+%nombre aléatoire décimal (au millième) entre 0 et 10+1 (exclus), stocké dans \PremierDecAlea
Décimal entre 0 et $10,999\ldots$ : \NbAlea[3]{0}{10}{\PremierDecAlea}\PremierDecAlea
%liste de 6 nombres, sans répétitions, entre 1 et 50
@@ -4587,11 +4907,11 @@ $\left[ \PresentationPGCD[AfficheConclusion=false,AfficheDelimiteurs=false]{1234
\newpage
-\part{Outils divers et variés}
+\part{Écritures, simplifications}
-\section{Fractions, ensembles}
+\section{Simplification sous forme d'une fractions}\label{convfrac}
-\subsection{Fractions}\label{convfrac}
+\subsection{Idée}
\begin{codeidee}
L'idée est d'obtenir une commande pour \textit{simplifier} un calcul sous forme de fraction irréductible.
@@ -4601,6 +4921,8 @@ L'idée est d'obtenir une commande pour \textit{simplifier} un calcul sous forme
\ConversionFraction[<option>]{<argument>}
\end{codetex}
+\subsection{Commande et options}
+
\begin{codecles}
Peu d'options pour ces commandes :
@@ -4680,7 +5002,9 @@ A priori le package \ctex{xint} permet de s'en sortir pour des calculs \og simpl
\pagebreak
-\subsection{Ensembles}\label{ensembles}
+\section{Ensembles}\label{ensembles}
+
+\subsection{Idée}
\begin{codeidee}
L'idée est d'obtenir une commande pour simplifier l'écriture d'un ensemble d'éléments, en laissant gérer les espaces.
@@ -4692,6 +5016,8 @@ Les délimiteurs de l'ensemble créé sont toujours \textsf{\{~~\}}.
\EcritureEnsemble[<clés>]{<liste>}
\end{codetex}
+\subsection{Commande et options}
+
\begin{codecles}
Peu d'options pour ces commandes :
@@ -4740,282 +5066,8 @@ Attention cependant au comportement de la commande avec des éléments en mode \
\newpage
-\section{Petits schémas pour le signe d'une fonction affine ou d'un trinôme}\label{aidesigne}
-
-\subsection{Idée}
-
-\begin{codeidee}
-L'idée est d'obtenir une commande pour tracer (en \TikZ) un petit schéma pour \textit{visualiser} le signe d'une fonction affine ou d'un trinôme.
-
-Le code est très largement inspiré de celui du package \ctex{tnsana} même si la philosophie est légèrement différente.
-
-\smallskip
-
-Comme pour les autres commandes \TikZ, l'idée est de laisser l'utilisateur définir et créer son environnement \TikZ, et d'insérer la commande \ctex{MiniSchemaSignes} pour afficher le schéma.
-\end{codeidee}
-
-\begin{codetex}[tikz lower]
-%code tikz
-\MiniSchemaSignes[<clés>]
-\end{codetex}
-
-\subsection{Commandes}
-
-\begin{codetex}[listing only]
-...
-\begin{tikzpicture}[<options>]
- ...
- \MiniSchemaSignes[<clés>]
- ...
-\end{tikzpicture}
-\end{codetex}
-
-\begin{codetex}[listing only]
-... {\tikz[<options>] \MiniSchemaSignes[<clés>]}...
-\end{codetex}
-
-\begin{codecles}
-Plusieurs \Cle{Clés} sont disponibles pour cette commande :
-
-\begin{itemize}
- \item la clé \Cle{Code} qui permet de définir le type d'expression (voir en-dessous) ;\hfill{}défaut \Cle{da+}
- \item la clé \Cle{Couleur} qui donne la couleur de la représentation ;\hfill{}défaut \Cle{red}
- \item la clé \Cle{Racines} qui définit la ou les racines ;\hfill{}défaut \Cle{2}
- \item la clé \Cle{Largeur} qui est la largeur du schéma ;\hfill{}défaut \Cle{2}
- \item la clé \Cle{Hauteur} qui est la hauteur du schéma ;\hfill{}défaut \Cle{1}
- \item un booléen \Cle{Cadre} qui affiche un cadre autour du schéma.\hfill{}défaut \Cle{true}
-\end{itemize}
-\end{codecles}
-
-\begin{codecles}
-Pour la clé \Cle{code}, il est construit par le type (\textsf{a} pour affine ou \textsf{p} comme parabole) puis les éléments caractéristiques (\textsf{a+} pour $a>0$, \textsf{d0} pour $\Delta=0$, etc) :
-
-\begin{itemize}
- \item \Cle{Code=da+} := une droite croissante ;
- \item \Cle{Code=da-} := une droite décroissante ;
- \item \Cle{Code=pa+d+} := une parabole \textit{souriante} avec deux racines ;
- \item etc
-\end{itemize}
-\end{codecles}
-
-\pagebreak
-
-\begin{codetex}[listing only]
-\begin{center}
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=da+,Racines=-4]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=da-,Racines={h},Couleur=blue,Largeur=3,Cadre=false]
- \end{tikzpicture}
-\end{center}
-%
-\begin{center}
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa+d+,Racines={1/2},Couleur=orange]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa+d-,Couleur=ForestGreen]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa+d0,Racines={5},Couleur=purple]
- \end{tikzpicture}
-\end{center}
-%
-\begin{center}
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa-d+,Racines={-3/0},Couleur=yellow]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa-d-,Couleur=cyan]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa-d0,Racines={-1},Couleur=magenta]
- \end{tikzpicture}
-\end{center}
-\end{codetex}
-
-\begin{codesortie}
-\begin{center}
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=da+,Racines=-4]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=da-,Racines={h},Couleur=blue,Largeur=3,Cadre=false]
- \end{tikzpicture}
-\end{center}
-%
-\begin{center}
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa+d+,Racines={1/2},Couleur=orange]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa+d-,Couleur=ForestGreen]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa+d0,Racines={5},Couleur=purple]
- \end{tikzpicture}
-\end{center}
-%
-\begin{center}
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa-d+,Racines={-3/0},Couleur=yellow]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa-d-,Couleur=cyan]
- \end{tikzpicture}
- ~~~~
- \begin{tikzpicture}
- \MiniSchemaSignes[Code=pa-d0,Racines={-1},Couleur=magenta]
- \end{tikzpicture}
-\end{center}
-\end{codesortie}
-
-\begin{codetex}[tikz lower]
-%code tikz
-\MiniSchemaSignes[Largeur=3.5,Hauteur=1.5,Code=da-,Racines=\tfrac{-b}{a},Couleur=Plum]
-\end{codetex}
-
-\subsection{Intégration avec tkz-tab}
-
-\begin{codeidee}
-Ces schémas peuvent être de plus utilisés, via la commande \ctex{MiniSchemaSignesTkzTab} pour illustrer les signes obtenus dans un tableau de signes présentés grâce au package \ctex{tkz-tab}.
-
-Pour des raisons internes, le fonctionnement de la commande \ctex{aidesignetkztabPL} est légèrement différent et, pour des raisons que j'ignore, le code est légèrement différent en \textit{interne} (avec une \textit{déconnexion} des caractères \textsf{:} et \textsf{\textbackslash}) pour que la librairie \TikZ{} \ctex{calc} puisse fonctionner (mystère pour le moment\ldots)
-\end{codeidee}
-
-\begin{codetex}[listing only]
-\begin{tikzpicture}
- %commandes tkztab
- \MiniSchemaSignesTkzTab[<options>]{<numligne>}[<echelle>][<décalage horizontal>]
-\end{tikzpicture}
-\end{codetex}
-
-\begin{codecles}
-Les \Cle{Clés} pour le premier argument optionnel sont les mêmes que pour la version \textit{initiale} de la commande précédente.
-
-En ce qui concerne les autres arguments :
-
-\begin{itemize}
- \item le deuxième argument, mandataire, est le numéro de la ligne à côté de laquelle placer le schéma ;
- \item le troisième argument, optionnel et valant \Cle{0.85} par défaut, est l'échelle à appliquer sur l'ensemble du schéma (à ajuster en fonction de la hauteur de la ligne) ;
- \item le quatrième argument, optionnel et valant \Cle{1.5} par défait, est lié à l'écart horizontal entre le bord de la ligne du tableau et le schéma.
-\end{itemize}
-
-À noter que si l'un des arguments optionnels (le n°3 et/ou le n°4) sont utilisés, il vaut mieux préciser les 2 !
-\end{codecles}
-
-\begin{codetex}[listing only]
-\begin{center}
- \begin{tikzpicture}
- \tkzTabInit[]{$x$/1,$-2x+5$/1,$2x+4$/1,$p(x)$/1}{$-\infty$,$-2$,${2,5}$,$+\infty$}
- \tkzTabLine{,+,t,+,z,-,}
- \tkzTabLine{,-,z,+,t,+,}
- \tkzTabLine{,-,z,+,z,-,}
- \MiniSchemaSignesTkzTab[Code=da-,Racines={2,5},Couleur=blue]{1}
- \MiniSchemaSignesTkzTab[Code=da+,Racines={-2},Couleur=purple]{2}
- \MiniSchemaSignesTkzTab[Code=pa-d+,Racines={-2/2,5},Couleur=orange]{3}[0.85][2]
- \end{tikzpicture}
-\end{center}
-\end{codetex}
-
-\begin{codesortie}
-\begin{center}
- \begin{tikzpicture}
- \tkzTabInit[]{$x$/1,$-2x+5$/1,$2x+4$/1,$p(x)$/1}{$-\infty$,$-2$,${2,5}$,$+\infty$}
- \tkzTabLine{,+,t,+,z,-,}
- \tkzTabLine{,-,z,+,t,+,}
- \tkzTabLine{,-,z,+,z,-,}
- \MiniSchemaSignesTkzTab[Code=da-,Racines={2,5},Couleur=blue]{1}
- \MiniSchemaSignesTkzTab[Code=da+,Racines={-2},Couleur=purple]{2}
- \MiniSchemaSignesTkzTab[Code=pa-d+,Racines={-2/2,5},Couleur=orange]{3}[0.85][2]
- \end{tikzpicture}
-\end{center}
-\end{codesortie}
-
-\newpage
-
-\section{Style \og main levée \fg{} en \TikZ}\label{mainlevee}
-
-\subsection{Idée}
-
-\begin{codeidee}
-L'idée est de \textit{proposer} un style \textit{tout prêt} pour simuler un tracé, en \TikZ, à \og main levée \fg.
-
-Il s'agit d'un style \textit{basique} utilisant la librairie \ctex{decorations} avec \textsf{random steps}.
-\end{codeidee}
-
-\begin{codetex}[listing only]
-\tikzset{%
- mainlevee/.style args={#1et#2}{decorate,decoration={random steps, segment length=#1,amplitude=#2}},
- mainlevee/.default={5mm et 0.6pt}
-}
-\end{codetex}
-
-\subsection{Utilisation basique}
-
-\begin{codeinfo}
-Il s'agit ni plus ni moins d'un style \TikZ{} à intégrer dans les tracés et constructions \TikZ !
-\end{codeinfo}
-
-\begin{codecles}
-Concernant le style en lui-même, deux paramètres peuvent être précisés via \Cle{mainlevee=\#1 et \#2} :
-
-\begin{itemize}
- \item \Cle{\#1} correspond à l'option \textsf{segment length} (longueur des segments \textit{types}) ;\hfill{}défaut \Cle{5mm}
- \item \Cle{\#2} correspond à l'option \textsf{amplitude} (amplitude maximale de la \textit{déformation}).\hfill{}défaut \Cle{0.6pt}
-\end{itemize}
-
-Les valeurs \Cle{mainlevee=5mm et 0.6pt} donnent des résultats -- à mon sens -- satisfaisants, mais l'utilisateur pourra modifier à loisir ces paramètres !
-\end{codecles}
-
-\begin{codetex}[listing only]
-%la grille a été rajoutée pour la sortie
-\begin{tikzpicture}
- \draw[thick,mainlevee] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
-\end{tikzpicture}
-
-\begin{tikzpicture}
- \draw[thick,mainlevee=5mm et 2pt] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
-\end{tikzpicture}
-
-\begin{tikzpicture}
- \draw[thick,mainlevee=10mm et 3mm] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
-\end{tikzpicture}
-\end{codetex}
-
-\begin{codesortie}
-\hfill~\begin{tikzpicture}
- \draw[xstep=0.5,ystep=0.5,ultra thin,lightgray] (0,0) grid (4,4);
- \draw[thick,mainlevee] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
-\end{tikzpicture}
-\hspace{1.5cm}
-\begin{tikzpicture}
- \draw[xstep=0.5,ystep=0.5,ultra thin,lightgray] (0,0) grid (4,4);
- \draw[thick,mainlevee=5mm et 2pt] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
-\end{tikzpicture}
-\hspace{1.5cm}
-\begin{tikzpicture}
- \draw[xstep=0.5,ystep=0.5,ultra thin,lightgray] (0,0) grid (4,4);
- \draw[thick,mainlevee=10mm et 3mm] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ;
-\end{tikzpicture}
-\hfill~
-\end{codesortie}
-
-\newpage
-
\section{Écriture d'un trinôme, trinôme aléatoire}\label{trinome}
-
\subsection{Idée}
\begin{codeidee}
@@ -5072,6 +5124,51 @@ Avec $a$ entre 1 et 10 (forcément positif) puis $b$ entre $-2$ et 2 puis $c$ en
\newpage
+\section{Simplification de racines}\label{simplracine}
+
+\subsection{Idée}
+
+\begin{codeidee}
+\cmaj{2.1.0} L'idée est de proposer une commande pour simplifier \textit{automatiquement} une racine carrée, sous la forme $\frac{a\sqrt{b}}{c}$ avec $\frac{a}{c}$ irréductible et $b$ le \frquote{plus petit possible}.
+\end{codeidee}
+
+\begin{codetex}[listing only]
+\SimplificationRacine{<expression ou calcul>}
+\end{codetex}
+
+\begin{codetex}[]
+\SimplificationRacine{48}\\
+\SimplificationRacine{100/34}\\
+\SimplificationRacine{99999}\\
+\SimplificationRacine{1500*0.31*(1-0.31)}\\
+\end{codetex}
+
+\begin{codeinfo}
+C'est -- comme souvent -- le package \ctex{xint} qui s'occupe en interne des calculs, et qui devrait donner des résultats satisfaisant dans la majorité des cas (attention aux \textit{grands nombres}\ldots)
+
+\smallskip
+
+La commande ne fait pas office de \textit{calculatrice}, elle ne permet \textit{que} de simplifier \textit{une} racine carrée (donc transformer si besoin !).
+\end{codeinfo}
+
+\subsection{Exemples}
+
+\begin{codetex}[]
+%Simplification d'un module de complexe
+$\left| 4+6\text{i}\right| = \sqrt{4^2+6^2} = \sqrt{\xinteval{4**2+6**2}}=\SimplificationRacine{4**2+6**2}$
+
+%Simplification n°1
+$\frac{1}{\sqrt{6}}=\left(\sqrt{\frac{1}{6}}\right)=\SimplificationRacine{1/6}$
+
+%Simplification n°2
+$\frac{42}{\sqrt{5}}=\left(\sqrt{\frac{42^2}{5}}\right)=\SimplificationRacine{(42*42)/5}$
+
+%Écart-type d'une loi binomiale
+$\sqrt{\num{150}\times\num{0.35}\times(1-\num{0.35})}=\displaystyle\SimplificationRacine{150*0.35*(1-0.35)}$
+\end{codetex}
+
+\newpage
+
\part{Jeux et récréations}
\section{PixelART via un fichier csv, en \TikZ}\label{pixelart}
@@ -5573,6 +5670,12 @@ La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0
\part{Historique}
+{\small \bverb|v 2.1.0|~:~~~~Calcul du seuil, en interne désormais (page \pageref{calcrecurr})
+
+{\small \bverb| |~:~~~~Commande pour simplifier une racine carrée (page \pageref{simplracine})
+
+{\small \bverb| |~:~~~~Option \textsf{[pythontex]} pour charger le nécessaire pour \textsf{pythontex}
+
{\small \bverb|v 2.0.9|~:~~~~Nombres aléatoires, tirages aléatoires d'entiers (page \pageref{entiersaleatoires})
{\small \bverb|v 2.0.8|~:~~~~Ajout d'un environnement pour présenter du code \LaTeX{} (page \pageref{prescode})
diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty
index 6cc5b21e24..7efeb2040a 100644
--- a/macros/latex/contrib/proflycee/tex/ProfLycee.sty
+++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty
@@ -3,7 +3,8 @@
% or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ProfLycee}[2022/12/15 2.0.9 Aide pour l'utilisation de LaTeX en lycee]
+\ProvidesPackage{ProfLycee}[2022/12/18 2.1.0 Aide pour l'utilisation de LaTeX en lycee]
+% 2.1.0 Ajout du calcul du seuil pour les suites récurrentes + racines de nombres décimaux + option pour pythontex
% 2.0.9 Ajouts de commandes pour générer des nombres et listes aléatoires
% 2.0.8 Ajout d'options pour stretch et fonte env python(s) (pas tous...)
% 2.0.6 Quelques modifications sur les codes python (taille police et marges)...
@@ -58,6 +59,8 @@
\DeclareOption{nonshellescape}{\@nonshellescapetrue}
\newif\if@build \@buildfalse
\DeclareOption{build}{\@buildtrue}
+\newif\if@pythontex \@pythontexfalse
+\DeclareOption{pythontex}{\@pythontextrue}
\newif\if@csvii \@csviifalse
\DeclareOption{csvii}{\@csviitrue}
\DeclareOption*{}
@@ -65,7 +68,6 @@
%------Packages utiles
\RequirePackage{mathtools}
-%\RequirePackage{amssymb}
\RequirePackage[table,svgnames]{xcolor}%Gestion des couleurs
\RequirePackage{tikz}
\RequirePackage{tkz-tab}
@@ -73,7 +75,6 @@
\RequirePackage{ifthen}
\RequirePackage{xparse}
\RequirePackage{xkeyval}
-%\RequirePackage{xfp} %plus utile
\RequirePackage{xstring}
\RequirePackage{xintexpr}
\RequirePackage{xintbinhex}
@@ -83,15 +84,14 @@
\RequirePackage{listofitems}
\RequirePackage{tabularray}
\RequirePackage{hvlogos}
+\RequirePackage{fancyvrb}
\RequirePackage{siunitx} %test avec v3
-\sisetup{%
- locale=FR,%
- mode = match, propagate-math-font = true,%
- reset-math-version = false, reset-text-family = false,%
- reset-text-series = false, reset-text-shape = false,%
- text-family-to-math = true, text-series-to-math = true,%
- output-decimal-marker={,},%
-% group-minimum-digits=4%
+\sisetup{locale=FR,output-decimal-marker={,},%
+ mode = match, propagate-math-font = true,%
+ reset-math-version = false, reset-text-family = false,%
+ reset-text-series = false, reset-text-shape = false,%
+ text-family-to-math = true, text-series-to-math = true,%
+ group-minimum-digits=4%
}%
\RequirePackage{fontawesome5}
\if@csvii
@@ -113,13 +113,16 @@
\RequirePackage[most]{tcolorbox}
%divers
\RequirePackage{iftex}
+
%python
-\RequirePackage{fancyvrb}
-\RequirePackage[gobble=auto]{pythontex}
-\setpythontexlistingenv{pythont} %pour ne pas télescoper lstlistings (?)
-\if@build
- \setpythontexoutputdir{./build/pythontex-files-\jobname} %essai de modif pythontex répertoire build
+\if@pythontex
+ \RequirePackage[gobble=auto]{pythontex}
+ \setpythontexlistingenv{pythont} %pour ne pas télescoper lstlistings (?)
+ \if@build
+ \setpythontexoutputdir{./build/pythontex-files-\jobname} %essai de modif pythontex répertoire build
+ \fi
\fi
+
%shellescape
\if@nonshellescape
%on ne charge pas minted et la librairie tcbox
@@ -365,6 +368,7 @@
{}
}
+\if@pythontex
%=========CONSOLEPYTHON=========== OK !!
\defKV[envpythonconsole]{%
Largeur=\def\CSPYlargeur{#1},%
@@ -481,6 +485,7 @@
{\end{tcpythontexcodeno}}
\verbcenterpost
}
+\fi
%=========PYTHONMINTED========= OK !!
\tcbset{pytmintedno/.style={%
@@ -497,7 +502,7 @@
}
}
-\DeclareTCBListing{CodePythonMinted}{ s D<>{12cm} O{} }{% étoilée sans numéro, taille puis options...
+\DeclareTCBListing{CodePythonMinted}{ s O{12cm} O{} }{% étoilée sans numéro, taille puis options...
\IfBooleanTF{#1}{pytmintedno}{pytminted},
enhanced,width=#2,#3,
colframe=Green,colback=ForestGreen!5,%
@@ -702,7 +707,7 @@
\newcommand\algomathttPL[1]{\mathtt{#1}}
\fi
-\DeclareTCBListing{PseudoCode}{ s D<>{12cm} O{} }{% étoilée sans numéro, <taille> puis option...
+\DeclareTCBListing{PseudoCode}{ s O{12cm} O{} }{% étoilée sans numéro, <taille> puis option...
width=#2,#3,
stylepseudocodePL,
listing only,listing engine=listings,
@@ -763,7 +768,7 @@
\end{tblr}
}
-\DeclareTCBListing{TerminalWin}{ D<>{\linewidth} m !O{} }{%<taille> puis {Titre=...} puis [option]
+\DeclareTCBListing{TerminalWin}{ O{\linewidth} m !O{} }{%<taille> puis {Titre=...} puis [option]
PLfaketermwin,title={\termwintitre[#2]},%
listing only,listing engine=listings,%
listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},%
@@ -814,7 +819,7 @@
\end{tblr}
}
-\DeclareTCBListing{TerminalUnix}{ D<>{\linewidth} m !O{} }{%<taille> puis {Titre=...} puis [option]
+\DeclareTCBListing{TerminalUnix}{ O{\linewidth} m !O{} }{%<taille> puis {Titre=...} puis [option]
PLtermlinux,title={\termnuxtitre[#2]},%
listing only,listing engine=listings,%
listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},%
@@ -864,7 +869,7 @@
\end{tblr}
}
-\DeclareTCBListing{TerminalOSX}{ D<>{\linewidth} m !O{} }{%<taille> puis {Titre=...} puis [option]
+\DeclareTCBListing{TerminalOSX}{ O{\linewidth} m !O{} }{%<taille> puis {Titre=...} puis [option]
PLfaketermosx,title={\termosxtitre[#2]},%
listing only,listing engine=listings,%
listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},%
@@ -1029,7 +1034,7 @@
\IfStrEq{#1}{t}{\ensuremath{\tfrac{\num{\numerateur}}{\num{\denominateur}}}}{}%si l'arg opt est t
}{%si non := entier
\num{\calculargument}%on affiche l'entier, avec le package siunitx
- }
+ }%
}
%================CabWeb================ OK !!
@@ -2070,7 +2075,7 @@
Grille=true,%
}
-\DeclareDocumentCommand\FenetreSimpleTikz{ O{} D<>{} m D<>{} m }{%
+\DeclareDocumentCommand\FenetreSimpleTikz{ O{} D<>{} m D<>{} m }{%
\useKVdefault[PLsimplewindow]%
\setKV[PLsimplewindow]{#1}% on paramètres les nouvelles clés et on les simplifie
\ifboolKV[PLsimplewindow]{Grille}%
@@ -3214,6 +3219,46 @@
\xintFloatToDecimal{\vartmp}%
}
+\newcount\CompteurSeuil%
+\NewDocumentCommand\CalculSeuil{ m m m m m }{%N0 / UN0 / fct / sgn / seuil := en interne
+ \xintdeffloatfunc varfct(x) := #3 ;%
+ \xdef\vartmp{\fpeval{#2}}%
+ \CompteurSeuil=#1%
+ %symbole de comparaison inversé et boucle
+ \IfEq{#4}{>}%
+ {%
+ \whiledo{\xintLtorEq{\vartmp}{#5} = 1}%
+ {%
+ \xdef\vartmp{\xintfloateval{varfct(\vartmp)}}%
+ \CompteurSeuil=\numexpr\CompteurSeuil+1%
+ }%
+ }{}%
+ \IfEq{#4}{<}%
+ {%
+ \whiledo{\xintGtorEq{\vartmp}{#5} = 1}%
+ {%
+ \xdef\vartmp{\xintfloateval{varfct(\vartmp)}}%
+ \CompteurSeuil=\numexpr\CompteurSeuil+1%
+ }%
+ }{}%
+ \IfEq{#4}{>=}%
+ {%
+ \whiledo{\xintLt{\vartmp}{#5} = 1}%
+ {%
+ \xdef\vartmp{\xintfloateval{varfct(\vartmp)}}%
+ \CompteurSeuil=\numexpr\CompteurSeuil+1%
+ }%
+ }{}%
+ \IfEq{#4}{<=}%
+ {%
+ \whiledo{\xintGt{\vartmp}{#5} = 1}%
+ {%
+ \xdef\vartmp{\xintfloateval{varfct(\vartmp)}}%
+ \CompteurSeuil=\numexpr\CompteurSeuil+1%
+ }%
+ }{}%
+}
+
\defKV[calculsuiterecur]{%
No=\def\SRninit{#1},%
UNo=\def\SRuninit{#1},%
@@ -3252,7 +3297,7 @@
No=\def\SEUILindiceinit{#1},%
UNo=\def\SEUILtermeinit{#1},%
NomSuite=\def\SEUILnomsuite{#1},%
- SolN=\def\SEUILn{#1},%
+ %SolN=\def\SEUILn{#1},%
Precision=\def\SEUILprec{#1},%
Stretch=\def\SEUILstretch{#1},%
Sens=\def\SEUILsens{#1}
@@ -3265,27 +3310,52 @@
Balayage=false,%
Calculatrice=false,%
Majuscule=true,%
- Sens=>
+ Sens={>},%
+ Exact=false,%
+ Conclusion=true,%
+ Simple=false
}
\newcommand\SolutionSeuil[3][]{%1=options + %2 = fonction + %3 = seuil
\useKVdefault[suiteseuil]%
\setKV[suiteseuil]{#1}%
- \def\SEUILnmu{\inteval{\SEUILn-1}}%
+ %on détermine le seuil, directement et on stocke les bascules !!!
+ \CalculSeuil{\SEUILindiceinit}{\SEUILtermeinit}{#2}{\SEUILsens}{#3}%
+ \def\SEUILn{\inteval{\the\CompteurSeuil}}%
+ \def\SEUILnmu{\inteval{\the\CompteurSeuil-1}}%
+ %formatage de la sortie des signes
\IfEq{\SEUILsens}{>}%
{\def\SensDeb{\leqslant}\def\SensFin{>}}%
+ {}%
+ \IfEq{\SEUILsens}{<}%
{\def\SensDeb{\geqslant}\def\SensFin{<}}%
+ {}%
+ \IfEq{\SEUILsens}{>=}%
+ {\def\SensDeb{<}\def\SensFin{\geqslant}}%
+ {}%
+ \IfEq{\SEUILsens}{<=}%
+ {\def\SensDeb{>}\def\SensFin{\leqslant}}%
+ {}%
+ %formatage
\ifboolKV[suiteseuil]{Balayage}{\ifboolKV[suiteseuil]{Majuscule}{P}{p}ar balayage, on obtient }{}%
\ifboolKV[suiteseuil]{Calculatrice}{\ifboolKV[suiteseuil]{Majuscule}{P}{p}ar calculatrice, on obtient }{}%
- \ensuremath{%
- \left\lbrace \begin{tblr}{stretch=\SEUILstretch,colsep=1pt,rll}%
- \SEUILnomsuite_{\SEUILnmu} &\approx \CalculTermeRecurrence[Precision=\SEUILprec,No=\SEUILindiceinit,UNo=\SEUILtermeinit,N=\SEUILnmu]{#2} & \SensDeb\num{#3} \: \\ %
- \SEUILnomsuite_{\SEUILn} &\approx \CalculTermeRecurrence[Precision=\SEUILprec,No=\SEUILindiceinit,UNo=\SEUILtermeinit,N=\SEUILn]{#2} & \SensFin\num{#3} \: %
- \end{tblr}%
- \right|%
- \Rightarrow%
- n \geqslant \SEUILn%
- }%
+ \ifboolKV[suiteseuil]{Simple}%
+ {%
+ \ensuremath{\SEUILnomsuite_{\SEUILnmu} \ifboolKV[suiteseuil]{Exact}{=}{\approx} \CalculTermeRecurrence[Precision=\SEUILprec,No=\SEUILindiceinit,UNo=\SEUILtermeinit,N=\SEUILnmu]{#2} \SensDeb\num{#3}}%
+ \text{~et~}%
+ \ensuremath{\SEUILnomsuite_{\SEUILn} \ifboolKV[suiteseuil]{Exact}{=}{\approx} \CalculTermeRecurrence[Precision=\SEUILprec,No=\SEUILindiceinit,UNo=\SEUILtermeinit,N=\SEUILn]{#2} \SensFin\num{#3}}%
+ }%
+ {%
+ \ensuremath{%
+ \left\lbrace \begin{tblr}{stretch=\SEUILstretch,colsep=1pt,rll}%
+ \SEUILnomsuite_{\SEUILnmu} &\ifboolKV[suiteseuil]{Exact}{=}{\approx} \CalculTermeRecurrence[Precision=\SEUILprec,No=\SEUILindiceinit,UNo=\SEUILtermeinit,N=\SEUILnmu]{#2} & \SensDeb\num{#3} \: \\ %
+ \SEUILnomsuite_{\SEUILn} &\ifboolKV[suiteseuil]{Exact}{=}{\approx} \CalculTermeRecurrence[Precision=\SEUILprec,No=\SEUILindiceinit,UNo=\SEUILtermeinit,N=\SEUILn]{#2} & \SensFin\num{#3} \: %
+ \end{tblr}%
+ \ifboolKV[suiteseuil]{Conclusion}%
+ {\right| \Rightarrow n \geqslant \SEUILn}%
+ {\right.}%
+ }%
+ }%
}
%=================ALEATOIRES============= OK!
@@ -3367,4 +3437,46 @@
\StrSubstitute{#2}{,}{\TAEEsep}[#2]%on change le séparateur si besoin
}
+%================SIMPLIFRACINES============ OK!
+\DeclareDocumentCommand\SimplificationRacine{ m }{% argument mandataire {calcul ou fraction}
+ \xdef\calculargument{\xintIrr{\xinteval{#1}}}%
+ \IfEndWith{\calculargument}{/1}%
+ {%si c'est un entier !
+ \xdef\calculargument{\xintiieval{#1}}%
+ \xdef\ExtractRacStop{\xintiFloor{\xintfloateval{sqrt(\calculargument)}}}%
+ \xintFor* ##1 in {\xintSeq{1}{\ExtractRacStop}}\do{%
+ \xintifboolexpr{ \xintiiRem{\calculargument}{\xintiieval{##1*##1}} == 0}%si le carré divise
+ {\xdef\ExtractRacID{##1}}%
+ {}%
+ }%
+ \xdef\ExtracReste{\xintiieval{\calculargument/(\ExtractRacID*\ExtractRacID)}}%
+ \ensuremath{\xintifboolexpr{\ExtractRacID == 1 && \ExtracReste == 1}%
+ {1}%
+ { \xintifboolexpr{\ExtractRacID == 1}{}{\num{\xintiieval{\ExtractRacID}}}%
+ \xintifboolexpr{\ExtracReste == 1}{}{\sqrt{\num{\ExtracReste}}} }}%
+% }%
+ }%
+ {%on va mettre sous forme a\sqrt(d)/b := buggue avec des millièmes...
+ \StrBefore{\calculargument}{/}[\numerateur]%on extrait le numérateur
+ \StrBehind{\calculargument}{/}[\denominateur]%on extrait le dénominateur
+ \xdef\ExtractRacNNum{\xintiieval{\numerateur*\denominateur}}%
+ \xdef\ExtractRacStop{\xintiFloor{\xintfloateval{sqrt(\ExtractRacNNum)}}}%
+ \xintFor* ##1 in {\xintSeq{1}{\ExtractRacStop}}\do{%
+ \xintifboolexpr{ \xintiiRem{\ExtractRacNNum}{\xintiieval{##1*##1}} == 0}%si le carré divise
+ {\xdef\ExtractRacID{##1}}%
+ {}
+ }%
+ \xdef\ExtractRacGCD{\xintiiGCD{\ExtractRacID}{\denominateur}}%
+ \xdef\RacNumSimpl{\xintiieval{\ExtractRacID/\ExtractRacGCD}}%simpl num
+ \xdef\RacDenomSimpl{\xintiieval{\denominateur/\ExtractRacGCD}}%
+ \xdef\RacRacSimpl{\xintiieval{\ExtractRacNNum/(\ExtractRacID*\ExtractRacID)}}%
+ \ensuremath{\frac{%
+ \xintifboolexpr{\RacNumSimpl == 1 && \RacRacSimpl == 1}%
+ {1}%
+ { \xintifboolexpr{\RacNumSimpl == 1}{}{\RacNumSimpl} \xintifboolexpr{\RacRacSimpl == 1}{}{\sqrt{\RacRacSimpl}} }%
+ }%
+ { \RacDenomSimpl }}%
+ }%
+}
+
\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/xput/LICENSE.txt b/macros/latex/contrib/xput/LICENSE.txt
new file mode 100644
index 0000000000..2244313901
--- /dev/null
+++ b/macros/latex/contrib/xput/LICENSE.txt
@@ -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.
+
diff --git a/macros/latex/contrib/xput/README.md b/macros/latex/contrib/xput/README.md
new file mode 100644
index 0000000000..8843656c15
--- /dev/null
+++ b/macros/latex/contrib/xput/README.md
@@ -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).
diff --git a/macros/latex/contrib/xput/doc/1x1.pdf b/macros/latex/contrib/xput/doc/1x1.pdf
new file mode 100644
index 0000000000..5c1a747af1
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/1x1.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/2x1.pdf b/macros/latex/contrib/xput/doc/2x1.pdf
new file mode 100644
index 0000000000..ebbd75abe9
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/2x1.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/3x2.pdf b/macros/latex/contrib/xput/doc/3x2.pdf
new file mode 100644
index 0000000000..a68c035432
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/3x2.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/example-book.pdf b/macros/latex/contrib/xput/doc/example-book.pdf
new file mode 100644
index 0000000000..26a78856c1
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-book.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/example-book.tex b/macros/latex/contrib/xput/doc/example-book.tex
new file mode 100644
index 0000000000..f770532e69
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-book.tex
@@ -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
diff --git a/macros/latex/contrib/xput/doc/example-borders-and-shadows.pdf b/macros/latex/contrib/xput/doc/example-borders-and-shadows.pdf
new file mode 100644
index 0000000000..41096e77a3
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-borders-and-shadows.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/example-borders-and-shadows.tex b/macros/latex/contrib/xput/doc/example-borders-and-shadows.tex
new file mode 100644
index 0000000000..7c555a6507
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-borders-and-shadows.tex
@@ -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}
diff --git a/macros/latex/contrib/xput/doc/example-graphic.pdf b/macros/latex/contrib/xput/doc/example-graphic.pdf
new file mode 100644
index 0000000000..8c66224900
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-graphic.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/example-graphic.tex b/macros/latex/contrib/xput/doc/example-graphic.tex
new file mode 100644
index 0000000000..dcfa7b3a65
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-graphic.tex
@@ -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}
diff --git a/macros/latex/contrib/xput/doc/example-grid.pdf b/macros/latex/contrib/xput/doc/example-grid.pdf
new file mode 100644
index 0000000000..1263d4883f
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-grid.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/example-grid.tex b/macros/latex/contrib/xput/doc/example-grid.tex
new file mode 100644
index 0000000000..1a5c707dac
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-grid.tex
@@ -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}
diff --git a/macros/latex/contrib/xput/doc/example-template.pdf b/macros/latex/contrib/xput/doc/example-template.pdf
new file mode 100644
index 0000000000..def352592f
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-template.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/example-template.tex b/macros/latex/contrib/xput/doc/example-template.tex
new file mode 100644
index 0000000000..a70acfd481
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-template.tex
@@ -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}
diff --git a/macros/latex/contrib/xput/doc/example-text.pdf b/macros/latex/contrib/xput/doc/example-text.pdf
new file mode 100644
index 0000000000..34212cb021
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-text.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/example-text.tex b/macros/latex/contrib/xput/doc/example-text.tex
new file mode 100644
index 0000000000..421532418e
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/example-text.tex
@@ -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}
diff --git a/macros/latex/contrib/xput/doc/koepi.jpg b/macros/latex/contrib/xput/doc/koepi.jpg
new file mode 100644
index 0000000000..148819751d
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/koepi.jpg
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/xputmanual-layout-guides.pdf b/macros/latex/contrib/xput/doc/xputmanual-layout-guides.pdf
new file mode 100644
index 0000000000..ec1763bf5d
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/xputmanual-layout-guides.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/xputmanual-layout-guides.tex b/macros/latex/contrib/xput/doc/xputmanual-layout-guides.tex
new file mode 100644
index 0000000000..1e53fb0bf7
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/xputmanual-layout-guides.tex
@@ -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}
diff --git a/macros/latex/contrib/xput/doc/xputmanual.pdf b/macros/latex/contrib/xput/doc/xputmanual.pdf
new file mode 100644
index 0000000000..7ce8804b7a
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/xputmanual.pdf
Binary files differ
diff --git a/macros/latex/contrib/xput/doc/xputmanual.tex b/macros/latex/contrib/xput/doc/xputmanual.tex
new file mode 100644
index 0000000000..fbfc3805c5
--- /dev/null
+++ b/macros/latex/contrib/xput/doc/xputmanual.tex
@@ -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@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}
diff --git a/macros/latex/contrib/xput/scripts/xput b/macros/latex/contrib/xput/scripts/xput
new file mode 100755
index 0000000000..3727bb3dc1
--- /dev/null
+++ b/macros/latex/contrib/xput/scripts/xput
@@ -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
diff --git a/macros/latex/contrib/xput/scripts/xputserver b/macros/latex/contrib/xput/scripts/xputserver
new file mode 100755
index 0000000000..924bfe0da0
--- /dev/null
+++ b/macros/latex/contrib/xput/scripts/xputserver
@@ -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
diff --git a/macros/latex/contrib/xput/tex/xput.cls b/macros/latex/contrib/xput/tex/xput.cls
new file mode 100644
index 0000000000..6da33ee25d
--- /dev/null
+++ b/macros/latex/contrib/xput/tex/xput.cls
@@ -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@emptystring{}
+\def\xput@striplastexclamationmark#1{\xput@striplastexclamationmarka{#1}#1\end !\end\eend}
+\def\xput@striplastexclamationmarka#1#2!\end#3\eend{\ifx\end#3\end#1\else#2\fi}
+\def\xput@instring#1#2{TT\fi\begingroup\edef\xput@x{\endgroup\noexpand\in@{#1}{#2}}\xput@x\ifin@}
+\def\xput@dimentonumber#1{\strip@pt\dimexpr #1*65536/\number\dimexpr 1\unitlength}
+
+% ifs
+\newif\ifxput@leftpage
+\newif\ifxput@rightpage
+
+\newif\ifxput@twoside
+\newif\ifxput@fanfold
+\newif\ifxput@cover
+\newif\ifxput@beginleft
+\newif\ifxput@beginright
+\newif\ifxput@grid
+\newif\ifxput@preflight
+\newif\ifxput@graphpaper
+\newif\ifxput@placeholder
+\newif\ifxput@safezone
+\newif\ifxput@cuttingmarks
+\newif\ifxput@fillpages
+\newif\ifxput@frontcover
+\newif\ifxput@backcover
+
+\newif\ifxput@hascover
+\newif\ifxput@haspages
+\newif\ifxput@isdoublepage
+\newif\ifxput@ispage
+\newif\ifxput@isemptypage
+\newif\ifxput@haslastemptypage
+\newif\ifxput@hasoddnumberofpages
+\newif\ifxput@cuttingmarksvisible
+\newif\ifxput@isfanfoldopen
+\newif\ifxput@isinitgrid
+\newif\ifxput@haspagegraphic
+\newif\ifxput@isperformancemode
+\newif\ifxput@isturbomode
+\newif\ifxput@isbatchmode
+\newif\ifxput@ismaskrequired
+\newif\ifxput@optimize
+\newif\ifxput@import
+\newif\ifxput@isluatex
+
+% dimensions
+\newdimen\xput@null\xput@null=0pt
+\newdimen\xput@undefdim\xput@undefdim=-1sp
+
+\ifdefined\pagewidth\xput@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@pagewidth\newdimen\xput@pageheight
+\newdimen\xput@outerbleed\newdimen\xput@innerbleed\newdimen\xput@topbleed\newdimen\xput@bottombleed
+\newdimen\xput@topsafetymargin\newdimen\xput@bottomsafetymargin\newdimen\xput@innersafetymargin\newdimen\xput@outersafetymargin
+\newdimen\xput@topmargin\newdimen\xput@topmargintmp\newdimen\xput@innermargin\newdimen\xput@bottommargin\newdimen\xput@outermargin
+\newdimen\xput@gutter
+\newdimen\xput@x\newdimen\xput@y\newdimen\xput@xx\newdimen\xput@yy\newdimen\width\newdimen\height\newdimen\x\newdimen\y
+\newdimen\xput@gridoffsethorizontal\newdimen\xput@gridoffsetvertical\newdimen\xput@gridoffsethorizontaln\newdimen\xput@gridoffsetverticaln
+\newdimen\xput@graphpaperx\newdimen\xput@graphpapery\newdimen\xput@graphpaperoffset\newdimen\xput@graphpapersnap
+
+% interface
+\newcommand\ifleftpage[1]{\ifxput@leftpage#1\fi}
+\newcommand\ifrightpage[1]{\ifxput@rightpage#1\fi}
+\newcommand\ifspine[1]{\ifxput@cover#1\fi}
+\def\twoside{\xput@twosidetrue}
+\def\fanfold{\xput@fanfoldtrue}
+\def\cover{\xput@covertrue}
+\def\beginleft{\xput@beginlefttrue}
+\def\beginright{\xput@beginrighttrue}
+\def\grid{\xput@gridtrue}\def\nogrid{\xput@gridfalse}
+\def\preflight{\xput@preflighttrue}\def\nopreflight{\xput@preflightfalse}
+\def\graphpaper{\xput@graphpapertrue}\def\nographpaper{\xput@graphpaperfalse}
+\def\placeholders{\xput@placeholdertrue}\def\noplaceholders{\xput@placeholderfalse}
+\def\safezone{\xput@safezonetrue}\def\nosafezone{\xput@safezonefalse}
+\def\cuttingmarks{\xput@cuttingmarkstrue}\def\nocuttingmarks{\xput@cuttingmarksfalse}
+\def\fillpages{\xput@fillpagestrue}\def\nofillpages{\xput@fillpagesfalse}
+\newcommand\optimize[1][]{\xput@optimizetrue\pgfkeys{optimize,#1}}
+\def\density#1{\def\xput@density{#1}}
+\def\quality#1{\def\xput@quality{#1}}
+\def\import{\xput@importtrue}
+
+\def\setgraphpaper#1{
+ \def\xput@graphpaperconfig{#1}
+ \foreach \xput@graphpaperconfigitem in \xput@graphpaperconfig {
+ \global\xput@graphpapersnap=\xput@graphpaperconfigitem
+ }
+}
+\setgraphpaper{1mm,5mm}
+
+\def\xput@pagecolormodel{}
+\def\xput@pagecolor{}
+\renewcommand\pagecolor[2][]{
+ \ifxput@ispage
+ \def\xput@pagecolormodel{#1}
+ \def\xput@pagecolor{#2}
+ \else
+ \global\def\xput@pagecolormodel{#1}
+ \global\def\xput@pagecolor{#2}
+ \fi
+}
+\newcommand\setpagecolor[2][]{\pagecolor[#1]{#2}}
+\def\nopagecolor{\pagecolor{}}
+
+\def\xput@current@color{black}
+\let\xput@originalcolor\color
+\def\color#1{\ifxput@ispage\ifx\xput@current@color#1\else\def\xput@current@color{#1}\xput@originalcolor{#1}\fi\else\def\xputoptions@color{#1}\fi}
+\def\setcolor#1{\color{#1}}
+
+\let\xput@originalpagenumbering\pagenumbering
+\newif\ifxput@pagenumberinghaschanged
+\renewcommand\pagenumbering[1]{\xput@pagenumberinghaschangedtrue\xput@originalpagenumbering{#1}}
+
+% options
+\def\xput@density{300}
+\def\xput@downsamplethreshold{120}
+\def\xput@quality{}
+\def\xput@unsharp{2x1}
+\pgfkeysdef{/optimize/downsample threshold}{
+ \pgfmathqparse{#1pt*100pt}
+ \pgfmathround{\pgfmathresult}
+ \pgfmathint{\pgfmathresult}
+ \edef\xput@downsamplethreshold{\pgfmathresult}
+}
+\pgfkeys{
+ /optimize/.is family,
+ /optimize,
+ density/.store in=\xput@density,
+ quality/.store in=\xput@quality,
+ unsharp/.store in=\xput@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@undefdim,
+ innerbleed/.code={\setlength{\innerbleed}{#1}},innerbleed=\xput@undefdim,
+ topbleed/.code={\setlength{\topbleed}{#1}},topbleed=\xput@undefdim,
+ bottombleed/.code={\setlength{\bottombleed}{#1}},bottombleed=\xput@undefdim,
+ safetymargin/.code={\setlength{\safetymargin}{#1}},safetymargin=0pt,
+ outersafetymargin/.code={\setlength{\outersafetymargin}{#1}},outersafetymargin=\xput@undefdim,
+ innersafetymargin/.code={\setlength{\innersafetymargin}{#1}},innersafetymargin=\xput@undefdim,
+ topsafetymargin/.code={\setlength{\topsafetymargin}{#1}},topsafetymargin=\xput@undefdim,
+ bottomsafetymargin/.code={\setlength{\bottomsafetymargin}{#1}},bottomsafetymargin=\xput@undefdim,
+ % cover dimensions
+ coverwidth/.code={\setlength{\coverwidth}{#1}},coverwidth=\xput@undefdim,
+ coverheight/.code={\setlength{\coverheight}{#1}},coverheight=\xput@undefdim,
+ coverbleed/.code={\setlength{\coverbleed}{#1}},coverbleed=\xput@undefdim,
+ coverouterbleed/.code={\setlength{\coverouterbleed}{#1}},coverouterbleed=\xput@undefdim,
+ coverinnerbleed/.code={\setlength{\coverinnerbleed}{#1}},coverinnerbleed=\xput@undefdim,
+ covertopbleed/.code={\setlength{\covertopbleed}{#1}},covertopbleed=\xput@undefdim,
+ coverbottombleed/.code={\setlength{\coverbottombleed}{#1}},coverbottombleed=\xput@undefdim,
+ coversafetymargin/.code={\setlength{\coversafetymargin}{#1}},coversafetymargin=\xput@undefdim,
+ coveroutersafetymargin/.code={\setlength{\coveroutersafetymargin}{#1}},coveroutersafetymargin=\xput@undefdim,
+ coverinnersafetymargin/.code={\setlength{\coverinnersafetymargin}{#1}},coverinnersafetymargin=\xput@undefdim,
+ covertopsafetymargin/.code={\setlength{\covertopsafetymargin}{#1}},covertopsafetymargin=\xput@undefdim,
+ coverbottomsafetymargin/.code={\setlength{\coverbottomsafetymargin}{#1}},coverbottomsafetymargin=\xput@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@undefdim,
+ innermargin/.code={\setlength{\innermargin}{#1}},innermargin=\xput@undefdim,
+ topmargin/.store in=\xputoptions@topmargin,topmargin=-1sp,
+ bottommargin/.code={\setlength{\bottommargin}{#1}},bottommargin=\xput@undefdim,
+ gutter/.code={\setlength{\gutter}{#1}},gutter=0pt,
+ pagecolor/.store in=\xput@pagecolor,
+ pagegraphic/.store in=\xputoptions@pagegraphic,pagegraphic=,
+ color/.store in=\xputoptions@color,color=black,
+ grid/.is if=xput@grid,
+ safezone/.is if=xput@safezone,
+ cuttingmarks/.is if=xput@cuttingmarks,
+ graphpaper/.is if=xput@graphpaper,
+ placeholder/.is if=xput@placeholder,
+ fillpages/.is if=xput@fillpages,
+ draft/.code={\xput@placeholdertrue\xput@fillpagestrue\xput@cuttingmarkstrue\xput@isperformancemodetrue},
+ preflight/.is if=xput@preflight,
+ twoside/.is if=xput@twoside,
+ fanfold/.code={\xput@fanfoldtrue\xput@covertrue\xput@twosidetrue\xput@beginlefttrue},
+ cover/.is if=xput@cover,
+ beginleft/.is if=xput@beginleft,
+ beginright/.is if=xput@beginright,
+ optimize/.code={\xput@optimizetrue\pgfkeys{optimize,#1}},
+ density/.store in=\xput@density,
+ quality/.store in=\xput@quality,
+ turbo/.is if=xput@isturbomode,turbo=\ifxput@isluatex false\else true\fi,
+ import/.is if=xput@import
+}
+\ProcessPgfOptions{/xput}
+
+\xput@originalcolor{\xputoptions@color}
+
+\Gin@draftfalse
+
+\LoadClass[multi=picture]{standalone}
+\setlength{\topmargin}{\xputoptions@topmargin}
+
+% grid
+\newdimen\xput@gridoffsetx
+\newdimen\xput@gridwidth\newdimen\xput@gridheight\newdimen\xput@maxgridheight\newdimen\xput@maxgridwidth
+\newcount\xput@gridtmp\newcount\xput@gridtmpRowH
+\newcount\xput@rowscount\newcount\xput@flexrowscount\newcount\xput@fixrowscount\newcount\xput@cellscount
+\newcount\rowsH\newcount\rowsF\newcount\rowsFlex
+\newif\ifxput@gridisflexrow
+\def\xput@set#1#2{
+ \ifcsname xput@data#1\endcsname
+ \else
+ \expandafter\newcount\csname xput@data#1\endcsname
+ \fi
+ \csname xput@data#1\endcsname#2\relax
+}
+\def\xput@get#1{
+ \ifcsname xput@data#1\endcsname
+ \csname xput@data#1\endcsname%
+ \else
+ 0
+ \fi
+}
+\def\xput@advance#1#2{
+ \advance\csname xput@data#1\endcsname by \csname xput@data#2\endcsname
+}
+\newif\ifxput@flexmode
+\newif\ifxput@forcerow
+\newif\ifxput@forcecell
+\def\xput@leftsafetymargin{
+ \ifxput@backcover%
+ \xput@outersafetymargin%
+ \else%
+ \ifxput@frontcover%
+ \xput@innersafetymargin%
+ \else%
+ \ifxput@leftpage%
+ \xput@outersafetymargin%
+ \else%
+ \xput@innersafetymargin%
+ \fi%
+ \fi%
+ \fi%
+}
+\def\xput@rightsafetymargin{
+ \ifxput@backcover%
+ \xput@innersafetymargin%
+ \else%
+ \ifxput@frontcover%
+ \xput@outersafetymargin%
+ \else%
+ \ifxput@leftpage%
+ \xput@innersafetymargin%
+ \else%
+ \xput@outersafetymargin%
+ \fi%
+ \fi%
+ \fi%
+}
+\def\xput@leftbleed{
+ \ifxput@backcover%
+ \xput@outerbleed%
+ \else%
+ \ifxput@frontcover%
+ \xput@innerbleed%
+ \else%
+ \ifxput@leftpage%
+ \xput@outerbleed%
+ \else%
+ \xput@innerbleed%
+ \fi%
+ \fi%
+ \fi%
+}
+\def\xput@rightbleed{
+ \ifxput@backcover%
+ \xput@innerbleed%
+ \else%
+ \ifxput@frontcover%
+ \xput@outerbleed%
+ \else%
+ \ifxput@leftpage%
+ \xput@innerbleed%
+ \else%
+ \xput@outerbleed%
+ \fi%
+ \fi%
+ \fi%
+}
+\def\xput@leftmargin{
+ \ifxput@backcover%
+ \xput@outermargin%
+ \else%
+ \ifxput@frontcover%
+ \xput@innermargin%
+ \else%
+ \ifxput@leftpage%
+ \xput@outermargin%
+ \else%
+ \xput@innermargin%
+ \fi%
+ \fi%
+ \fi%
+}
+\newcommand\xput@addrow[1]{
+ \advance\xput@rowscount by 1
+ \xput@cells#1
+}
+\newdimen\xput@gridheightdiff
+\newdimen\xput@gridwidthdiff
+\newdimen\xput@gridstartxdim
+\newdimen\xput@gridstartydim
+\newcount\looprows
+\newcount\loopcells
+\newcommand\xput@processrows{
+ \advance\looprows 1
+ \ifnum\xput@get{if\the\looprows F}=1
+ \xput@set{\the\looprows HR}{\numexpr(\xput@gridheight-\xput@gutter*\xput@rowscount)*\xput@get{\the\looprows H}/\rowsH+\xput@gutter}
+ \else
+ \ifnum\xput@get{if\the\looprows Fix}=0
+ \xput@set{\the\looprows HR}{\numexpr(\xput@maxgridheight-\xput@gridheight)*\xput@get{\the\looprows H}/\rowsFlex+\xput@gutter}
+ \else
+ \xput@set{\the\looprows HR}{\numexpr(\xput@gridwidth-\xput@gutter*\xput@get{\the\looprows C})*\xput@get{\the\looprows H}/\xput@get{\the\looprows W}+\xput@gutter}
+ \fi
+ \fi
+ \loopcells=0
+ \loop
+ \advance\loopcells 1
+ \ifnum\xput@get{if\the\looprows-\the\loopcells F}=1
+ \xput@set{\the\looprows-\the\loopcells WR}{\numexpr(\xput@get{\the\looprows HR}-\xput@gutter)*\xput@get{\the\looprows-\the\loopcells W}/\xput@get{\the\looprows H}+\xput@gutter}
+ \else
+ \xput@set{\the\looprows-\the\loopcells WR}{\numexpr((\xput@gridwidth-\xput@gutter*\xput@get{\the\looprows C})\ifnum\xput@get{\the\looprows H}>0 -(\xput@get{\the\looprows HR}-\xput@gutter)*\xput@get{\the\looprows F}/\xput@get{\the\looprows H}\fi)*\xput@get{\the\looprows-\the\loopcells W}/(\xput@get{\the\looprows W}-\xput@get{\the\looprows F})+\xput@gutter}
+ \fi
+ \ifnum \loopcells<\xput@get{\the\looprows C}
+ \repeat
+
+ \ifnum \looprows<\xput@rowscount
+ \xput@processrows
+ \fi
+}
+\newcommand\xput@closerows{
+ \xput@topmargin=\ifdim\xput@gridtopmargin=\xput@undefdim\xput@gridmargin\else\xput@gridtopmargin\fi
+ \xput@bottommargin=\ifdim\xput@gridbottommargin=\xput@undefdim\xput@gridmargin\else\xput@gridbottommargin\fi
+ \xput@innermargin=\ifdim\xput@gridinnermargin=\xput@undefdim\xput@gridmargin\else\xput@gridinnermargin\fi
+ \xput@outermargin=\ifdim\xput@gridoutermargin=\xput@undefdim\xput@gridmargin\else\xput@gridoutermargin\fi
+
+ \height=\dimexpr\xput@pageheight - \xput@topmargin - \xput@bottommargin\relax
+ \width=\dimexpr\xput@pagewidth - \xput@innermargin - \xput@outermargin\relax
+ \ifdim\dimexpr\xput@gridoptionheight\relax=\xput@undefdim
+ \else
+ \xput@gridheightdiff=\dimexpr0.5\height - 0.5\dimexpr\xput@gridoptionheight\relax\relax
+ \xput@bottommargin=\dimexpr\xput@bottommargin+\xput@gridheightdiff\relax
+ \xput@topmargin=\dimexpr\xput@topmargin+\xput@gridheightdiff\relax
+ \fi
+ \ifdim\dimexpr\xput@gridoptionwidth\relax=\xput@undefdim
+ \else
+ \xput@gridwidthdiff=\dimexpr\xput@calculaterealgridwidth/2 - 0.5\dimexpr\xput@gridoptionwidth\relax\relax
+ \xput@innermargin=\dimexpr\xput@innermargin+\xput@gridwidthdiff\relax
+ \xput@outermargin=\dimexpr\xput@outermargin+\xput@gridwidthdiff\relax
+ \fi
+
+ \xput@gutter=\xput@gridgutter
+
+ \x=\dimexpr\xput@gridstartx{\xput@undefdim}-\xput@leftbleed\relax
+ \y=\dimexpr\xput@gridstarty{\xput@undefdim}-\xput@bottombleed\relax
+
+ \xput@gridstartxdim=\dimexpr\xput@gridstartx{\xput@gridoptionx}\relax
+ \xput@gridstartydim=\dimexpr\xput@gridstarty{\xput@gridoptiony}\relax
+
+ \xput@gridwidth=\dimexpr\xput@calculatefullgridwidth\relax
+ \ifnum\rowsH>0
+ \xput@calculategridheight
+ \else
+ \xput@gridheight=\dimexpr\xput@gutter*\xput@rowscount\relax
+ \fi
+ \xput@gridoffsetvertical=\xput@null
+ \xput@gridoffsethorizontal=\xput@null
+ \xput@gridoffsetverticaln=\xput@null
+ \xput@gridoffsethorizontaln=\xput@null
+
+ \xput@maxgridheight=\dimexpr\xput@calculatefullgridheight\relax
+ \ifdim\xput@gridheight>\xput@maxgridheight
+ \xput@gridheight=\xput@maxgridheight
+ \xput@calculategridwidth
+ \xput@gridoffsethorizontal=\dimexpr\xput@gridoptionhpos\xput@gridwidth-\xput@gridoptionhpos\xput@maxgridwidth\relax
+ \xput@gridoffsethorizontaln=\dimexpr\xput@gridwidth-\xput@maxgridwidth-\xput@gridoffsethorizontal\relax
+ \xput@gridwidth=\xput@maxgridwidth
+ \else
+ \ifxput@flexmode
+ \else
+ \ifdim\xput@gridheight<\xput@maxgridheight
+ \xput@gridoffsetvertical=\dimexpr\xput@gridoptionvpos\xput@maxgridheight-\xput@gridoptionvpos\xput@gridheight\relax
+ \xput@gridoffsetverticaln=\dimexpr\xput@maxgridheight-\xput@gridheight-\xput@gridoffsetvertical\relax
+ \fi
+ \fi
+ \fi
+
+ \looprows=0
+ \xput@processrows
+}
+\newcommand\xput@addcell[1]{
+ \advance\xput@cellscount by 1
+ \if\xput@instring{!}{#1}
+ \xput@gridtmp \xput@striplastexclamationmark{#1}\relax
+ \xput@forcecelltrue
+ \else
+ \xput@gridisflexrowtrue
+ \ifnum\numexpr0#1\relax=0
+ \xput@gridtmp 1\relax
+ \else
+ \xput@gridtmp #1\relax
+ \fi
+ \xput@forcecellfalse
+ \fi
+ \xput@set{\the\xput@rowscount-\the\xput@cellscount W}{\xput@gridtmp}
+ \ifxput@forcecell
+ \xput@set{if\the\xput@rowscount-\the\xput@cellscount F}{1}
+ \xput@advance{\the\xput@rowscount F}{\the\xput@rowscount-\the\xput@cellscount W}
+ \else
+ \xput@set{if\the\xput@rowscount-\the\xput@cellscount F}{0}
+ \fi
+ \xput@advance{\the\xput@rowscount W}{\the\xput@rowscount-\the\xput@cellscount W}
+}
+\newif\ifxput@gridtop
+\newif\ifxput@gridbottom
+\newif\ifxput@gridleft
+\newif\ifxput@gridright
+\newif\ifxput@gridfull
+\pgfkeys{
+ /grid/.is family,
+ /grid,
+ gutter/.store in=\xput@gridgutter,
+ margin/.store in=\xput@gridmargin,
+ top margin/.store in=\xput@gridtopmargin,
+ bottom margin/.store in=\xput@gridbottommargin,
+ inner margin/.store in=\xput@gridinnermargin,
+ outer margin/.store in=\xput@gridoutermargin,
+ width/.store in=\xput@gridoptionwidth,
+ height/.store in=\xput@gridoptionheight,
+ x/.store in=\xput@gridoptionx,
+ y/.store in=\xput@gridoptiony,
+ vpos/.store in=\xput@gridoptionvpos,
+ hpos/.store in=\xput@gridoptionhpos,
+}
+\def\xput@resetautogrid{
+ \global\xput@gridfullfalse
+ \def\xput@framey{0}\def\xput@framex{0}\def\xput@frameyy{1}\def\xput@framexx{1}
+ \def\xput@frameyymax{0}\def\xput@framexxmax{0}
+}
+\newcommand\setgrid[2][]{
+ \ifxput@haspages
+ \else
+ \def\xput@tmpgrid{\setgrid{#2}}
+ \fi
+ \xput@resetautogrid
+ \pgfkeys{
+ /grid,
+ gutter=\gutter,
+ margin=\margin,
+ top margin=\topmargin,
+ bottom margin=\bottommargin,
+ inner margin=\innermargin,
+ outer margin=\outermargin,
+ width=\xput@undefdim,
+ height=\xput@undefdim,
+ x=\xput@undefdim,
+ y=\xput@undefdim,
+ vpos=\xput@verticalpagealign,
+ hpos=\xput@horizontalpagealign,%
+ #1
+ }
+ \rowsH 0\relax
+ \rowsFlex 0\relax
+ \xput@flexrowscount 0\relax
+ \xput@fixrowscount 0\relax
+ \rowsF 0\relax
+ \xput@rowscount 0\relax
+ \xput@flexmodefalse
+ \def\xput@grid@input{#2}
+ \ifx\xput@grid@input\xput@emptystring
+ \xput@gobblenextrow{{1}}
+ \else
+ \xput@gobblenextrow#2
+ \fi
+}
+\newcommand\xput@gobblenextrow[1]{
+ \xput@addrow{#1}
+ \@ifnextchar\bgroup{
+ \xput@gobblenextrow
+ }{
+ \ifxput@isinitgrid
+ \else
+ \xput@closerows
+ \fi
+ }
+}
+\newcommand\xput@cells[2][1]{
+ \if\xput@instring{!}{#1}
+ \xput@gridtmpRowH \xput@striplastexclamationmark{#1}\relax
+ \xput@forcerowtrue
+ \advance\rowsF by \xput@gridtmpRowH
+ \advance\rowsH by \xput@gridtmpRowH
+ \xput@set{\the\xput@rowscount H}{\xput@gridtmpRowH}
+ \advance \xput@fixrowscount by 1
+ \else
+ \xput@forcerowfalse
+ \xput@gridtmpRowH #1\relax
+ \fi
+
+ \xput@cellscount 0\relax
+ \xput@set{\the\xput@rowscount W}{0}
+ \xput@set{\the\xput@rowscount F}{0}
+ \ifxput@forcerow\xput@set{if\the\xput@rowscount F}{1}\else\xput@set{if\the\xput@rowscount F}{0}\fi
+ \xput@gridisflexrowfalse
+
+ \xput@gobblenextcell{#2}
+}
+\newcommand\xput@gobblenextcell[1]{
+ \xput@addcell{#1}
+ \@ifnextchar\bgroup{
+ \xput@gobblenextcell
+ }{
+ \ifxput@forcerow
+ \else
+ \ifxput@gridisflexrow
+ \xput@flexmodetrue
+ \advance \xput@flexrowscount by 1
+ \advance\rowsFlex by \xput@gridtmpRowH
+ \xput@set{\the\xput@rowscount H}{\xput@gridtmpRowH}
+ \xput@set{if\the\xput@rowscount Fix}{0}
+ \else
+ \advance \xput@fixrowscount by 1
+ \advance\rowsH by \xput@gridtmpRowH
+ \xput@set{\the\xput@rowscount H}{\xput@gridtmpRowH}
+ \xput@set{if\the\xput@rowscount Fix}{1}
+ \fi
+ \fi
+ \xput@set{\the\xput@rowscount C}{\xput@cellscount}
+ }
+}
+
+% grid shortcut
+\def\xput@flexkey{f}
+\def\xput@portraitkey{p}
+\def\xput@squarekey{s}
+\def\xput@landscapekey{l}
+\def\xput@goldenkey{g}
+\def\xput@goldenuprightkey{o}
+\def\xput@widekey{w}
+\def\xput@rowbreakkey{-}
+\newcount\xput@rowcountsc
+\newcount\xput@cellcountsc
+\newcommand\xput@breakrow{
+ \edef\xput@result{\xput@result{[30]\xput@rowindex}}
+}
+\newif\ifxput@isgridvalid
+\newcommand\xput@transformgridconfig[1]{
+ \ifx\xput@rowbreakkey#1
+ \xput@breakrow
+ \def\xput@rowindex{}
+ \else
+ \ifx\xput@flexkey#1
+ \edef\xput@rowindex{\xput@rowindex{1}}
+ \else
+ \ifx\xput@portraitkey#1
+ \edef\xput@rowindex{\xput@rowindex{20!}}
+ \else
+ \ifx\xput@squarekey#1
+ \edef\xput@rowindex{\xput@rowindex{30!}}
+ \else
+ \ifx\xput@landscapekey#1
+ \edef\xput@rowindex{\xput@rowindex{45!}}
+ \else
+ \ifx\xput@widekey#1
+ \edef\xput@rowindex{\xput@rowindex{60!}}
+ \else
+ \ifx\xput@goldenkey#1
+ \edef\xput@rowindex{\xput@rowindex{50!}}
+ \else
+ \ifx\xput@goldenuprightkey#1
+ \edef\xput@rowindex{\xput@rowindex{18!}}
+ \else
+ \xput@isgridvalidfalse
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput@setplaceholder[1]{
+ \ifx\xput@rowbreakkey#1
+ \advance\xput@rowcountsc by 1
+ \xput@cellcountsc 0\relax
+ \else
+ \placeholder{{\xput@rowcountsc} {\xput@cellcountsc} {\numexpr\xput@rowcountsc+1\relax} {\numexpr\xput@cellcountsc+1\relax}}
+ \advance\xput@cellcountsc by 1
+ \fi
+}
+\newcommand\xput@gridsc[1]{
+ \edef\xput@gridsc@input{#1}
+ \def\xput@rowindex{}
+ \def\xput@result{}
+ \xput@isgridvalidtrue
+ \@tfor\next:=#1\do{\xput@transformgridconfig{\next}}%
+ \ifxput@isgridvalid
+ \xput@breakrow
+ \edef\xput@result{{\xput@result}}
+ \expandafter\setgrid\xput@result
+ \xput@rowcountsc 0\relax
+ \xput@cellcountsc 0\relax
+ \@tfor\next:=#1\do{\xput@setplaceholder{\next}}%
+ \else
+ \xput@errmsg@undefined{template}{\xput@gridsc@input}
+ \fi
+}
+
+% grid dimensions
+\newif\ifxput@flexgrid
+\newcommand\xput@calculategridheight{
+ \xput@flexgridtrue
+ \xput@gridheight=\xput@null
+ \looprows=0
+ \loop
+ \advance\looprows 1
+ \ifnum\xput@get{if\the\looprows F}=1
+ \xput@gridheight=\dimexpr\xput@gridheight+\xput@gutter\relax%
+ \else
+ \ifnum\xput@get{if\the\looprows Fix}=0
+ \xput@gridheight=\dimexpr\xput@gridheight+\xput@gutter\relax%
+ \else
+ \xput@flexgridfalse
+ \xput@gridheight=\dimexpr\xput@gridheight+(\xput@gridwidth-\xput@gutter*\xput@get{\the\looprows C})*\xput@get{\the\looprows H}/(\xput@get{\the\looprows W}*(\rowsH-\rowsF))*\rowsH+\xput@gutter\relax
+ \fi
+ \fi
+ \ifnum \looprows<\xput@rowscount
+ \repeat
+ \ifxput@flexgrid
+ \xput@gridheight=\dimexpr\xput@calculatefullgridheight\relax
+ \fi
+}
+\newcommand\xput@calculatefullgridheight{
+ \xput@pageheight - \xput@topmargin - \xput@bottommargin + \xput@gutter
+}
+\newcommand\xput@calculategridwidth{
+ \def\xput@calculategridwidthcalc{(\xput@gridheight*(\rowsH-\rowsF)/\rowsH-\xput@gutter*(\rowsH-\rowsF)*\xput@rowscount/\rowsH}
+ \looprows=0
+ \loop
+ \advance\looprows 1
+ \ifnum\xput@get{if\the\looprows F}=1
+ \else
+ \ifnum\xput@get{if\the\looprows Fix}=0
+ \else
+ \edef\xput@calculategridwidthcalc{\xput@calculategridwidthcalc+\xput@gutter*\xput@get{\the\looprows C}*\xput@get{\the\looprows H}/\xput@get{\the\looprows W}}
+ \fi
+ \fi
+ \ifnum \looprows<\xput@rowscount
+ \repeat
+
+ \edef\xput@calculategridwidthcalc{\xput@calculategridwidthcalc) * 10000 / (\xput@null}
+ \looprows=0
+ \loop
+ \advance\looprows 1
+ \ifnum\xput@get{if\the\looprows F}=1
+ \else
+ \ifnum\xput@get{if\the\looprows Fix}=0
+ \else
+ \edef\xput@calculategridwidthcalc{\xput@calculategridwidthcalc+10000*\xput@get{\the\looprows H}/\xput@get{\the\looprows W}}
+ \fi
+ \fi
+ \ifnum \looprows<\xput@rowscount
+ \repeat
+
+ \edef\xput@calculategridwidthcalc{\xput@calculategridwidthcalc)}
+ \xput@maxgridwidth=\dimexpr\xput@calculategridwidthcalc\relax
+}
+\newcommand\xput@calculatefullgridwidth{
+ \ifxput@isdoublepage
+ \xput@pagewidth * 2 - \xput@outermargin * 2
+ \ifxput@frontcover
+ \else
+ \ifxput@fanfold
+ \else
+ - \bindingoffset * 2
+ \fi
+ \fi
+ \else
+ \xput@pagewidth - \xput@innermargin - \xput@outermargin
+ \fi
+ + \xput@gutter
+}
+\newcommand\xput@calculaterealgridwidth{
+ \ifxput@isdoublepage
+ (\xput@pagewidth * 2 - \xput@outermargin * 2)
+ \else
+ (\xput@pagewidth - \xput@innermargin - \xput@outermargin)
+ \fi
+}
+\newcommand\xput@gridstartx[1]{
+ \ifdim\dimexpr#1\relax=\xput@undefdim
+ \ifxput@isdoublepage
+ (\xput@outermargin + \xput@leftbleed - \xput@gutter / 2
+ \ifxput@frontcover
+ \else
+ \ifxput@fanfold
+ \else
+ \ifxput@rightpage
+ + \bindingoffset * 2
+ \fi
+ \fi
+ \fi
+ )
+ \else
+ (\xput@leftmargin + \xput@leftbleed - \xput@gutter / 2)
+ \fi
+ \else%
+ \ifxput@isdoublepage
+ (#1 + \xput@leftbleed - \xput@gutter / 2
+ \ifxput@frontcover
+ \else
+ \ifxput@fanfold
+ \else
+ \ifxput@rightpage
+ + \bindingoffset * 2
+ \fi
+ \fi
+ \fi
+ )
+ \else
+ (#1 + \xput@leftbleed - \xput@gutter / 2)
+ \fi
+ \fi%
+}
+\newcommand\xput@gridstarty[1]{
+ \ifdim\dimexpr#1\relax=\xput@undefdim
+ (\xput@bottommargin + \xput@bottombleed - \xput@gutter / 2)%
+ \else%
+ (#1 + \xput@bottombleed - \xput@gutter / 2)
+ \fi%
+}
+\newcommand\xput@setdimensions{
+ \global\xput@gridfullfalse
+ \global\def\xput@framey{0}\global\def\xput@framex{0}\global\def\xput@frameyy{1}\global\def\xput@framexx{1}
+ \global\def\xput@frameyymax{0}\global\def\xput@framexxmax{0}
+ \paperheight=\dimexpr(\xput@pageheight + \xput@topbleed + \xput@bottombleed)\relax
+ \xput@gridoffsetx=\xput@null
+
+ \ifxput@isdoublepage
+ % doublepage
+ \ifxput@fanfold
+ \paperwidth=\dimexpr((\xput@pagewidth + \xput@outerbleed) * 2)\relax
+ \else
+ \paperwidth=\dimexpr(\xput@pagewidth + \xput@outerbleed + \xput@innerbleed)\relax
+ \ifxput@rightpage
+ \xput@gridoffsetx=\dimexpr(-\xput@pagewidth)\relax
+ \fi
+ \fi
+ \else
+ \ifxput@frontcover
+ % frontcover
+ \paperwidth=\dimexpr((\xput@pagewidth + \xput@outerbleed) * 2 + \spinewidth)\relax
+ \else
+ % page
+ \ifxput@fanfold
+ \paperwidth=\dimexpr((\xput@pagewidth + \xput@outerbleed) * 2)\relax
+ \ifxput@rightpage
+ \xput@gridoffsetx=\dimexpr(\xput@pagewidth + \xput@outerbleed - \xput@innerbleed)\relax
+ \fi
+ \else
+ \paperwidth=\dimexpr(\xput@pagewidth + \xput@outerbleed + \xput@innerbleed)\relax
+ \fi
+ \fi
+ \fi
+}
+
+% grid coordinates
+\newcommand\xput@coordxrow[3]{\ifdim\dimexpr#2\dimexpr1pt\relax\relax<\dimexpr(#3\dimexpr1pt\relax-#1sp)\relax\the\numexpr#3\relax\else\xput@coordxrow{#1}{#2}{\numexpr#3+1\relax}\fi}
+\newcommand\xput@coordxcell[2]{\ifnum\numexpr(10000*#1)\relax<\numexpr(#2*10000+1)\relax\the\numexpr#2\relax\else\xput@coordxcell{#1}{\numexpr#2+1\relax}\fi}
+\newcommand\xput@coordx[3]{
+ \xput@get{%
+ \xput@coordxrow{#1}{#2}{1}-%
+ \xput@coordxcell{#3}{1}%
+ WR%
+ }
+}
+\newcommand\posxcell[3]{
+ \ifnum#3>0
+ + \xput@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@gridstartxdim + #4\dimexpr\xput@coordx{#1}{#2}{#3}sp\relax - \xput@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@gutter / 2 + \xput@gridoffsetx + \xput@gridoffsethorizontal%
+ )\relax%
+}
+\newcommand\posycell[1]{
+ \ifnum#1>0
+ - \xput@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@gridstartydim + \xput@maxgridheight - #1\dimexpr\xput@get{#2HR} sp\relax + \xput@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@gutter / 2 - \xput@gridoffsetvertical%
+ )\relax%
+}
+\newcommand\xput@gridhalign[1]{
+ \def\xput@horizontalpagealign{#1}
+}
+\newcommand\xput@gridvalign[1]{
+ \def\xput@verticalpagealign{#1}
+}
+\xput@gridhalign{0.5}
+\xput@gridvalign{0.5}
+\xput@isinitgridtrue
+\setgrid{{{1}}}
+
+% graphic
+\newif\ifxput@isvisible
+\newif\ifxput@calculatecrop
+\newdimen\xput@originalgraphicwidth\newdimen\xput@originalgraphicheight
+\newdimen\xput@cropx\newdimen\xput@cropy
+\newdimen\xput@cropleft\newdimen\xput@cropright
+\newdimen\xput@cropbottom\newdimen\xput@croptop
+\newdimen\xput@cropstart\newdimen\xput@cropend
+\newdimen\xput@snapleft\newdimen\xput@snapright
+\newdimen\xput@snapbottom\newdimen\xput@snaptop
+\newdimen\xput@viewportwidth\newdimen\xput@viewportheight
+\newdimen\xput@frameborderwidth
+\newdimen\xput@frameborderradius
+\newdimen\xput@frameshadowradius
+\newdimen\xput@snapcroptmp
+\newdimen\xput@overprint
+\xput@overprint=0pt
+\def\xput@cropleftside{
+ \ifdim\xput@x>\xput@cropstart
+ \ifdim\xput@x<\xput@cropend
+ \xput@snapleft=\dimexpr(\xput@x - \xput@cropstart)\relax
+ \xput@x=\dimexpr(\xput@cropstart)\relax
+ \fi
+ \fi
+}
+\def\xput@croprightside{
+ \ifdim\xput@xx>\xput@cropstart
+ \ifdim\xput@xx<\xput@cropend
+ \xput@snapright=\dimexpr(\xput@cropend - \xput@xx)\relax
+ \xput@xx=\dimexpr(\xput@cropend)\relax
+ \fi
+ \fi
+}
+\def\xput@snapsafezonevertical{
+ \xput@snapbottom=\xput@null
+ \xput@snaptop=\xput@null
+ \xput@cropstart=-\xput@overprint
+ \xput@cropend=\dimexpr(\xput@null + \xput@bottombleed + 1pt)\relax
+ \ifdim\xput@y>\xput@cropstart
+ \ifdim\xput@y<\xput@cropend
+ \xput@snapbottom=\dimexpr(\xput@y - \xput@cropstart)\relax
+ \xput@y=\dimexpr(\xput@cropstart)\relax
+ \fi
+ \fi
+ \xput@cropstart=\dimexpr(\xput@pageheight + \xput@bottombleed - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pageheight + \xput@bottombleed + \xput@topbleed + \xput@overprint)\relax
+ \ifdim\xput@yy>\xput@cropstart
+ \ifdim\xput@yy<\xput@cropend
+ \xput@snaptop=\dimexpr(\xput@cropend - \xput@yy)\relax
+ \xput@yy=\dimexpr(\xput@cropend)\relax
+ \fi
+ \fi
+}
+\def\xput@snapsafezonehorizontal{
+ \xput@snapleft=\xput@null
+ \xput@snapright=\xput@null
+ \ifxput@isdoublepage
+ % doublepage
+ \ifxput@fanfold
+ \xput@cropstart=-\xput@overprint
+ \xput@cropend=\dimexpr(\xput@null + \xput@leftbleed + 1pt)\relax
+ \xput@cropleftside
+ \xput@cropstart=\dimexpr(\xput@pagewidth * 2 + \xput@outerbleed - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth * 2 + \xput@outerbleed * 2 + \xput@overprint)\relax
+ \xput@croprightside
+ \else
+ \xput@cropstart=-\xput@overprint
+ \xput@cropend=\dimexpr(\xput@null + \xput@leftbleed + 1pt)\relax
+ \xput@cropleftside
+ \xput@cropstart=\dimexpr(\xput@pagewidth + \xput@outerbleed + \xput@innerbleed - \xput@rightbleed - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth + \xput@outerbleed + \xput@innerbleed + \xput@overprint)\relax
+ \xput@croprightside
+ \ifxput@leftpage
+ \xput@cropstart=\dimexpr(\xput@pagewidth * 2 + \xput@outerbleed - \bindingoffset * 2 - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth * 2 + \xput@outerbleed + \xput@outerbleed - \bindingoffset * 2 + \xput@overprint)\relax
+ \xput@croprightside
+ \else
+ \xput@cropstart=\dimexpr(\xput@innerbleed -\xput@pagewidth - \xput@outerbleed + \bindingoffset * 2 - \xput@overprint)\relax
+ \xput@cropend=\dimexpr(-\xput@pagewidth + \xput@innerbleed + \bindingoffset * 2 + 1pt)\relax
+ \xput@cropleftside
+ \fi
+ \fi
+ \else
+ % frontcover
+ \ifxput@frontcover
+ \ifxput@cover
+ \ifxput@backcover
+ \xput@cropstart=-\xput@overprint
+ \xput@cropend=\dimexpr(\xput@null + \xput@leftbleed + 1pt)\relax
+ \else
+ \xput@cropstart=\dimexpr(\xput@pagewidth + \xput@outerbleed)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth + \xput@outerbleed + \spinewidth + 1pt)\relax
+ \fi
+ \xput@cropleftside
+ \ifxput@backcover
+ \xput@cropstart=\dimexpr(\xput@pagewidth + \xput@outerbleed - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth + \xput@outerbleed)\relax
+ \else
+ \xput@cropstart=\dimexpr(\xput@pagewidth * 2 + \spinewidth + \xput@outerbleed - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth * 2 + \xput@outerbleed * 2 + \spinewidth + \xput@overprint)\relax
+ \fi
+ \xput@croprightside
+ \else
+ \xput@cropstart=-\xput@overprint
+ \xput@cropend=\dimexpr(\xput@null + \xput@leftbleed + 1pt)\relax
+ \xput@cropleftside
+ \xput@cropstart=\dimexpr(\xput@pagewidth + \xput@outerbleed + \xput@innerbleed - \xput@rightbleed - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth + \xput@outerbleed + \xput@innerbleed + \xput@overprint)\relax
+ \xput@croprightside
+ \fi
+ \else
+ % page
+ \ifxput@fanfold
+ \xput@cropstart=-\xput@overprint
+ \xput@cropend=\dimexpr(\xput@null + \xput@leftbleed + 1pt)\relax
+ \xput@cropleftside
+ \xput@cropstart=\dimexpr(\xput@pagewidth * 2 + \xput@outerbleed - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth * 2 + \xput@outerbleed * 2 + \xput@overprint)\relax
+ \xput@croprightside
+ \else
+ \xput@cropstart=-\xput@overprint
+ \xput@cropend=\dimexpr(\xput@null + \xput@leftbleed + 1pt)\relax
+ \xput@cropleftside
+ \xput@cropstart=\dimexpr(\xput@pagewidth + \xput@outerbleed + \xput@innerbleed - \xput@rightbleed - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth + \xput@outerbleed + \xput@innerbleed + \xput@overprint)\relax
+ \xput@croprightside
+ \fi
+ \fi
+ \fi
+}
+\pgfkeys{
+ /graphic/.is family,
+ /graphic,
+ file/.store in=\xput@graphicoptionfile,
+ scale/.store in=\xput@graphicoptionscale,
+ vpos/.store in=\xput@graphicoptionvpos,
+ hpos/.store in=\xput@graphicoptionhpos,
+ unsharp/.store in=\xput@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@checkvisibility{
+ \xput@isvisibletrue
+
+ \ifxput@frontcover
+ \else
+ \ifxput@fanfold
+ \else
+ \ifxput@isdoublepage
+ \ifxput@leftpage
+ \xput@cropstart=\dimexpr(\xput@pagewidth + \xput@outerbleed - \bindingoffset - 1pt)\relax
+ \xput@cropend=\dimexpr(\xput@pagewidth + \xput@outerbleed + \xput@innerbleed)\relax
+ \ifdim\xput@x>\xput@cropstart
+ \xput@isvisiblefalse
+ \fi
+ \else
+ \xput@cropstart=\dimexpr(\xput@null)\relax
+ \xput@cropend=\dimexpr(\xput@null + \xput@leftbleed + \bindingoffset + 1pt)\relax
+ \ifdim\xput@xx<\xput@cropend
+ \xput@isvisiblefalse
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\def\xput@snapoptimizedgraphic{
+ \ifdim\xput@snapleft>\xput@null
+ \width=\dimexpr\width+\xput@snapleft\relax
+ \fi
+ \ifdim\xput@snapright>\xput@null
+ \width=\dimexpr\width+\xput@snapright\relax
+ \fi
+ \ifdim\xput@snaptop>\xput@null
+ \height=\dimexpr\height+\xput@snaptop\relax
+ \fi
+ \ifdim\xput@snapbottom>\xput@null
+ \height=\dimexpr\height+\xput@snapbottom\relax
+ \fi
+}
+\def\xput@snapgraphic{
+ \pgfmathqparse{(\xput@originalgraphicheight-\xput@croptop-\xput@cropbottom)/\height}
+ \edef\xput@scale{\pgfmathresult}
+ \pgfmathqparse{\height/(\xput@originalgraphicheight-\xput@croptop-\xput@cropbottom)}
+ \edef\xput@scalerez{\pgfmathresult}
+
+ % snap
+ \ifdim\xput@snapleft>\xput@null
+ \ifdim\xput@cropleft>\xput@null
+ \ifdim\xput@scale\xput@snapleft>\xput@cropleft
+ \xput@snapbleedleft=\xput@cropleft
+ \xput@snapleft=\dimexpr\xput@snapleft-\xput@scalerez\xput@cropleft\relax
+ \width=\dimexpr\width+\xput@scalerez\xput@cropleft\relax
+ \xput@cropleft=\xput@null
+ \else
+ \xput@snapbleedleft=\dimexpr\xput@scale\xput@snapleft\relax
+ \xput@cropleft=\dimexpr\xput@cropleft-\xput@scale\xput@snapleft\relax
+ \width=\dimexpr\width+\xput@snapleft\relax
+ \xput@snapleft=\xput@null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput@snapright>\xput@null
+ \ifdim\xput@cropright>\xput@null
+ \ifdim\xput@scale\xput@snapright>\xput@cropright
+ \xput@snapbleedright=\xput@cropright
+ \xput@snapright=\dimexpr\xput@snapright-\xput@scalerez\xput@cropright\relax
+ \width=\dimexpr\width+\xput@scalerez\xput@cropright\relax
+ \xput@cropright=\xput@null
+ \else
+ \xput@snapbleedright=\dimexpr\xput@scale\xput@snapright\relax
+ \xput@cropright=\dimexpr\xput@cropright-\xput@scale\xput@snapright\relax
+ \width=\dimexpr\width+\xput@snapright\relax
+ \xput@snapright=\xput@null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput@snaptop>\xput@null
+ \ifdim\xput@croptop>\xput@null
+ \ifdim\xput@scale\xput@snaptop>\xput@croptop
+ \xput@snapbleedtop=\xput@croptop
+ \xput@snaptop=\dimexpr\xput@snaptop-\xput@scalerez\xput@croptop\relax
+ \height=\dimexpr\height+\xput@scalerez\xput@croptop\relax
+ \xput@croptop=\xput@null
+ \else
+ \xput@snapbleedtop=\dimexpr\xput@scale\xput@snaptop\relax
+ \xput@croptop=\dimexpr\xput@croptop-\xput@scale\xput@snaptop\relax
+ \height=\dimexpr\height+\xput@snaptop\relax
+ \xput@snaptop=\xput@null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput@snapbottom>\xput@null
+ \ifdim\xput@cropbottom>\xput@null
+ \ifdim\xput@scale\xput@snapbottom>\xput@cropbottom
+ \xput@snapbleedbottom=\xput@cropbottom
+ \xput@snapbottom=\dimexpr\xput@snapbottom-\xput@scalerez\xput@cropbottom\relax
+ \height=\dimexpr\height+\xput@scalerez\xput@cropbottom\relax
+ \xput@cropbottom=\xput@null
+ \else
+ \xput@snapbleedbottom=\dimexpr\xput@scale\xput@snapbottom\relax
+ \xput@cropbottom=\dimexpr\xput@cropbottom-\xput@scale\xput@snapbottom\relax
+ \height=\dimexpr\height+\xput@snapbottom\relax
+ \xput@snapbottom=\xput@null
+ \fi
+ \fi
+ \fi
+
+ % move
+ \ifdim\xput@snapbottom=\xput@null
+ \ifdim\xput@snaptop=\xput@null
+ \ifdim\xput@snapright>\xput@null
+ \ifdim\xput@cropleft>\xput@null
+ \ifdim\xput@scale\xput@snapright>\xput@cropleft
+ \xput@snapright=\dimexpr\xput@snapright-\xput@scalerez\xput@cropleft\relax
+ \width=\dimexpr\width+\xput@scalerez\xput@cropleft\relax
+ \xput@cropleft=\xput@null
+ \else
+ \xput@cropleft=\dimexpr\xput@cropleft-\xput@scale\xput@snapright\relax
+ \width=\dimexpr\width+\xput@snapright\relax
+ \xput@snapright=\xput@null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput@snapleft>\xput@null
+ \ifdim\xput@cropright>\xput@null
+ \ifdim\xput@scale\xput@snapleft>\xput@cropright
+ \xput@snapleft=\dimexpr\xput@snapleft-\xput@scalerez\xput@cropright\relax
+ \width=\dimexpr\width+\xput@scalerez\xput@cropright\relax
+ \xput@cropright=\xput@null
+ \else
+ \xput@cropright=\dimexpr\xput@cropright-\xput@scale\xput@snapleft\relax
+ \width=\dimexpr\width+\xput@snapleft\relax
+ \xput@snapleft=\xput@null
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \ifdim\xput@snapleft=\xput@null
+ \ifdim\xput@snapright=\xput@null
+ \ifdim\xput@snaptop>\xput@null
+ \ifdim\xput@cropbottom>\xput@null
+ \ifdim\xput@scale\xput@snaptop>\xput@cropbottom
+ \xput@snaptop=\dimexpr\xput@snaptop-\xput@scalerez\xput@cropbottom\relax
+ \height=\dimexpr\height+\xput@scalerez\xput@cropbottom\relax
+ \xput@cropbottom=\xput@null
+ \else
+ \xput@cropbottom=\dimexpr\xput@cropbottom-\xput@scale\xput@snaptop\relax
+ \height=\dimexpr\height+\xput@snaptop\relax
+ \xput@snaptop=\xput@null
+ \fi
+ \fi
+ \fi
+ \ifdim\xput@snapbottom>\xput@null
+ \ifdim\xput@croptop>\xput@null
+ \ifdim\xput@scale\xput@snapbottom>\xput@croptop
+ \xput@snapbottom=\dimexpr\xput@snapbottom-\xput@scalerez\xput@croptop\relax
+ \height=\dimexpr\height+\xput@scalerez\xput@croptop\relax
+ \xput@croptop=\xput@null
+ \else
+ \xput@croptop=\dimexpr\xput@croptop-\xput@scale\xput@snapbottom\relax
+ \height=\dimexpr\height+\xput@snapbottom\relax
+ \xput@snapbottom=\xput@null
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newdimen\xput@snapcropoffset
+\newdimen\xput@snapbleedleft\newdimen\xput@snapbleedright
+\newdimen\xput@snapbleedtop\newdimen\xput@snapbleedbottom
+\def\xput@hscalegraphic{
+ \pgfmathqparse{\width/(\width+\xput@snapleft+\xput@snapright)}
+ \edef\xput@snapscale{\pgfmathresult}
+ \xput@snapcroptmp=\dimexpr\xput@originalgraphicheight-\xput@cropbottom-\xput@croptop-\xput@snapscale\xput@originalgraphicheight+\xput@snapscale\xput@cropbottom+\xput@snapscale\xput@croptop\relax
+ \xput@snapcropoffset=\dimexpr\xput@snapbleedbottom-\xput@snapscale\xput@snapbleedbottom-\xput@snapbleedtop+\xput@snapscale\xput@snapbleedtop\relax
+ \xput@cropbottom=\dimexpr\xput@cropbottom+0.5\xput@snapcroptmp+0.5\xput@snapcropoffset\relax
+ \xput@croptop=\dimexpr\xput@croptop+0.5\xput@snapcroptmp-0.5\xput@snapcropoffset\relax
+
+ \width=\dimexpr\width+\xput@snapleft+\xput@snapright\relax
+ \xput@snapright=\xput@null
+ \xput@snapleft=\xput@null
+}
+\def\xput@vscalegraphic{
+ \pgfmathqparse{\height/(\height+\xput@snaptop+\xput@snapbottom)}
+ \edef\xput@snapscale{\pgfmathresult}
+ \xput@snapcroptmp=\dimexpr\xput@originalgraphicwidth-\xput@cropleft-\xput@cropright-\xput@snapscale\xput@originalgraphicwidth+\xput@snapscale\xput@cropleft+\xput@snapscale\xput@cropright\relax
+ \xput@snapcropoffset=\dimexpr\xput@snapbleedleft-\xput@snapscale\xput@snapbleedleft-\xput@snapbleedright+\xput@snapscale\xput@snapbleedright\relax
+ \xput@cropleft=\dimexpr\xput@cropleft+0.5\xput@snapcroptmp+0.5\xput@snapcropoffset\relax
+ \xput@cropright=\dimexpr\xput@cropright+0.5\xput@snapcroptmp-0.5\xput@snapcropoffset\relax
+
+ \height=\dimexpr\height+\xput@snaptop+\xput@snapbottom\relax
+ \xput@snaptop=\xput@null
+ \xput@snapbottom=\xput@null
+}
+\def\xput@getbase#1{\edef\Gin@base{\filename@area\filename@base}\edef\Gin@ext{#1}}
+\let\xput@getbaseorginal\Gin@getbase
+\def\xput@disablegraphicsfilecheck{
+ \let\Gin@getbase\xput@getbase
+}
+\def\xput@enablegraphicsfilecheck{
+ \let\Gin@getbase\xput@getbaseorginal
+}
+\let\xput@setfileorginal\Gin@setfile
+\def\xput@setfile#1#2#3{
+ \global\edef\xput@currfilebase{\Gin@base}
+ \global\edef\xput@currfileext{\Gin@ext}
+ \global\@onelevel@sanitize\xput@currfileext
+}
+\edef\xput@extjpeg{.jpeg}\@onelevel@sanitize\xput@extjpeg
+\edef\xput@extJPEG{.JPEG}\@onelevel@sanitize\xput@extJPEG
+\edef\xput@extjpg{.jpg}\@onelevel@sanitize\xput@extjpg
+\edef\xput@extJPG{.JPG}\@onelevel@sanitize\xput@extJPG
+\edef\xput@extpng{.png}\@onelevel@sanitize\xput@extpng
+\edef\xput@extPNG{.PNG}\@onelevel@sanitize\xput@extPNG
+\def\isoptimizable#1#2{
+ \ifx#1\xput@extjpg
+ \def\xput@optimizedext{.jpg}#2
+ \else
+ \ifx#1\xput@extJPG
+ \def\xput@optimizedext{.jpg}#2
+ \else
+ \ifx#1\xput@extjpeg
+ \def\xput@optimizedext{.jpg}#2
+ \else
+ \ifx#1\xput@extJPEG
+ \def\xput@optimizedext{.jpg}#2
+ \else
+ \ifx#1\xput@extpng
+ \def\xput@optimizedext{.png}#2
+ \else
+ \ifx#1\xput@extPNG
+ \def\xput@optimizedext{.png}#2
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\def\newgraphic#1#2{
+ \expandafter\newcommand\csname xput@graphic@#1\endcsname[2][0]{%
+ \ifnum##1=0
+ \pgfkeys{pagegraphic,file={#1},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput@unsharp,#2,##2}
+ \else
+ \ifnum##1=1
+ \pgfkeys{backcoverpagegraphic,file={#1},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput@unsharp,#2}
+ \else
+ \pgfkeys{graphic,file={#1},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput@unsharp,#2,##2}
+ \fi
+ \fi
+ }%
+}
+\newcommand\xput@putgraphic[6][]{
+ \xput@x=\posx{1}{#2}{1}{#3}
+ \xput@yy=\posy{1}{#2}
+ \xput@xx=\posx{-1}{#4}{-1}{#5}
+ \xput@y=\posy{-1}{#4}
+
+ \xput@checkvisibility
+
+ \ifxput@isvisible
+ \xput@cropleft=\xput@null
+ \xput@cropbottom=\xput@null
+ \xput@cropright=\xput@null
+ \xput@croptop=\xput@null
+
+ \width=\dimexpr(\xput@xx - \xput@x)\relax
+ \height=\dimexpr(\xput@yy - \xput@y)\relax
+
+ % safezone horizontal
+ \xput@snapsafezonehorizontal
+
+ % safezone vertical
+ \xput@snapsafezonevertical
+
+ \xput@snapbleedleft=\xput@null
+ \xput@snapbleedright=\xput@null
+ \xput@snapbleedtop=\xput@null
+ \xput@snapbleedbottom=\xput@null
+
+ \begingroup
+ \xdef\xput@filename{#6-\xput@density-\xput@graphicoptionscale-\xput@graphicoptionhpos-\xput@graphicoptionvpos-\the\numexpr\xput@snaptop\relax-\the\numexpr\xput@snapright\relax-\the\numexpr\xput@snapbottom\relax-\the\numexpr\xput@snapleft\relax-\the\numexpr\width\relax-\the\numexpr\height\relax-\xput@downsamplethreshold-\xput@graphicoptionunsharp-\xput@quality}
+ \ifxput@optimize
+ \IfFileExists{./cache/\xput@filename/g.jpg}{
+ \def\xput@nextincludegraphic{\includegraphics[width=\width]{cache/\xput@filename/g.jpg}}
+ }{
+ \IfFileExists{./cache/\xput@filename/g.png}{
+ \def\xput@nextincludegraphic{\includegraphics[width=\width]{cache/\xput@filename/g.png}}
+ }{
+ \xput@calculatecroptrue
+ }
+ }
+
+ \ifxput@preflight
+ \xput@calculatecroptrue
+ \fi
+ \else
+ \xput@calculatecroptrue
+ \fi
+
+ \ifxput@calculatecrop
+ \global\edef\xput@currfilebase{}
+ \global\edef\xput@currfileext{}
+ \let\Gin@setfile\xput@setfile
+ \Ginclude@graphics#6
+ \let\Gin@setfile\xput@setfileorginal
+ \ifx\xput@currfileext\xput@emptystring
+ \xput@calculatecropfalse
+ \def\xput@nextincludegraphic{}
+ \fi
+ \fi
+
+ \xput@disablegraphicsfilecheck
+ \ifxput@calculatecrop
+ % graphic crop
+ \settowidth{\xput@originalgraphicwidth}{\includegraphics{\xput@currfilebase\xput@currfileext}}
+ \settoheight{\xput@originalgraphicheight}{\includegraphics{\xput@currfilebase\xput@currfileext}}
+ \pgfmathqparse{1pt-\xput@graphicoptionvpos pt}
+ \edef\xput@graphicoptionvpos{\pgfmathresult}
+ \pgfmathqparse{\xput@originalgraphicwidth/\xput@originalgraphicheight}
+ \edef\xput@graphicratio{\pgfmathresult}
+ \pgfmathqparse{\width/\height}
+ \edef\xput@vpratio{\pgfmathresult}
+ \pgfmathqparse{\xput@graphicratio pt>\xput@vpratio pt}
+ \ifnum\pgfmathresult=1
+ \xput@cropx=\dimexpr(\numexpr(\xput@originalgraphicwidth - \width * \xput@originalgraphicheight / \height)\relax sp)\relax
+ \xput@cropy=\xput@null
+ \else
+ \xput@cropy=\dimexpr(\numexpr(\xput@originalgraphicheight - \height * \xput@originalgraphicwidth / \width)\relax sp)\relax
+ \xput@cropx=\xput@null
+ \fi
+ \xput@viewportwidth=\dimexpr\xput@originalgraphicwidth-\xput@cropx\relax
+ \xput@viewportheight=\dimexpr\xput@originalgraphicheight-\xput@cropy\relax
+ \pgfmathqparse{1pt/\xput@graphicoptionscale pt}
+ \edef\xput@reciprocalscale{\pgfmathresult}
+ \xput@cropx=\dimexpr\xput@cropx + \xput@viewportwidth - \xput@reciprocalscale\xput@viewportwidth\relax
+ \xput@cropy=\dimexpr\xput@cropy + \xput@viewportheight - \xput@reciprocalscale\xput@viewportheight\relax
+ \ifdim\xput@cropx>\xput@null
+ \xput@cropleft=\dimexpr(\xput@graphicoptionhpos\xput@cropx)\relax
+ \ifdim\xput@cropleft<\xput@null
+ \xput@cropleft=\xput@null
+ \fi
+ \ifdim\xput@cropleft>\xput@cropx
+ \xput@cropleft=\xput@cropx
+ \fi
+ \xput@cropright=\dimexpr(\xput@cropx - \xput@cropleft)\relax
+ \fi
+ \ifdim\xput@cropy>\xput@null
+ \xput@cropbottom=\dimexpr(\xput@graphicoptionvpos\xput@cropy)\relax
+ \ifdim\xput@cropbottom<\xput@null
+ \xput@cropbottom=\xput@null
+ \fi
+ \ifdim\xput@cropbottom>\xput@cropy
+ \xput@cropbottom=\xput@cropy
+ \fi
+ \xput@croptop=\dimexpr(\xput@cropy - \xput@cropbottom)\relax
+ \fi
+
+ \xput@snapgraphic
+ \ifdim\dimexpr\xput@snapleft+\xput@snapright\relax=\xput@null
+ \ifdim\dimexpr\xput@snaptop+\xput@snapbottom\relax>\xput@null
+ \xput@vscalegraphic
+ \fi
+ \else
+ \ifdim\dimexpr\xput@snaptop+\xput@snapbottom\relax=\xput@null
+ \ifdim\dimexpr\xput@snapleft+\xput@snapright\relax>\xput@null
+ \xput@hscalegraphic
+ \fi
+ \else
+ \ifdim\dimexpr\width/(\xput@snapleft + \xput@snapright)\relax<\dimexpr\height/(\xput@snaptop + \xput@snapbottom)\relax
+ \xput@hscalegraphic
+
+ \xput@snapgraphic
+ \else
+ \xput@vscalegraphic
+
+ \xput@snapgraphic
+ \fi
+ \fi
+ \fi
+
+ \ifdim\xput@snapleft>\xput@null
+ \xput@x=\dimexpr\xput@x+\xput@snapleft\relax
+ \fi
+ \ifdim\xput@snapbottom>\xput@null
+ \xput@y=\dimexpr\xput@y+\xput@snapbottom\relax
+ \fi
+ \else
+ \xput@snapoptimizedgraphic
+ \fi
+
+ \ifdefined\xput@nextincludegraphic
+ \else
+ \ifxput@optimize
+ \ifxput@isbatchmode
+ \isoptimizable{\xput@currfileext}{\xput@addtobatchlist{\xput@currfilebase}{\xput@currfileext}}
+ \def\xput@nextincludegraphic{}
+ \else
+ \isoptimizable{\xput@currfileext}{\xput@optimizegraphic{\xput@currfilebase}{\xput@currfileext}}
+ \ifdefined\xput@optimizedext
+ \IfFileExists{./cache/\xput@filename/g\xput@optimizedext}{
+ \def\xput@nextincludegraphic{\includegraphics[width=\width]{cache/\xput@filename/g\xput@optimizedext}}
+ }{
+ \ifx\xput@processresult\xput@ok
+ \ClassError{Xput}{Unexpected error. File not optimized}{File `cache/#6/g\xput@optimizedext' not found.\MessageBreak Try to delete the `cache' directory.\MessageBreak\MessageBreak\@ehc}
+ \fi
+ \def\xput@nextincludegraphic{\includegraphics[trim={\xput@cropleft} {\xput@cropbottom} {\xput@cropright} {\xput@croptop},\xput@clip,width=\width]{\xput@currfilebase\xput@currfileext}}
+ }
+ \else
+ \def\xput@nextincludegraphic{\includegraphics[trim={\xput@cropleft} {\xput@cropbottom} {\xput@cropright} {\xput@croptop},\xput@clip,width=\width]{\xput@currfilebase\xput@currfileext}}
+ \fi
+ \fi
+ \else
+ \def\xput@nextincludegraphic{\includegraphics[trim={\xput@cropleft} {\xput@cropbottom} {\xput@cropright} {\xput@croptop},\xput@clip,width=\width]{\xput@currfilebase\xput@currfileext}}
+ \fi
+ \fi
+
+ \ifdim\xput@defaultborderradius>0.5\height
+ \def\xput@defaultborderradius{0.5\height}
+ \fi
+ \ifdim\xput@defaultborderradius>0.5\width
+ \def\xput@defaultborderradius{0.5\width}
+ \fi
+
+ \xput@frameborderwidth=\dimexpr\xput@defaultborderwidth\relax
+ \ifdim\xput@defaultborderradius=0pt
+ \xput@frameborderradius=0pt
+ \xput@frameshadowradius=0pt
+ \else
+ \xput@frameborderradius=\dimexpr\xput@defaultborderradius+0.5\xput@frameborderwidth\relax
+ \xput@frameshadowradius=\dimexpr\xput@defaultborderradius+\xput@frameborderwidth\relax
+ \fi
+
+ % draw shadow
+ \ifxput@isbatchmode
+ \else
+ \def\xput@frameshadowoffsetx{\xput@frameborderwidth}
+ \def\xput@frameshadowoffsety{\xput@frameborderwidth}
+ \def\xput@frameshadowwidth{\dimexpr\width+10cm+2\xput@frameborderwidth\relax}
+ \def\xput@frameshadowheight{\dimexpr\height+10cm+2\xput@frameborderwidth\relax}
+ \def\xput@frameshadowframewidth{\dimexpr\width+2\xput@frameborderwidth\relax}
+ \def\xput@frameshadowframeheight{\dimexpr\height+2\xput@frameborderwidth\relax}
+ \def\xput@frameshadowborder{\dimexpr5cm\relax}
+ \xput@drawshadow
+ \fi
+
+ % draw graphic and border
+ \ifxput@isbatchmode
+ \xput@ismaskrequiredfalse
+ \def\xput@nextincludegraphic{}
+ \else
+ \ifxput@isperformancemode
+ \ifdim\xput@defaultborderwidth>0pt
+ \xput@ismaskrequiredtrue
+ \else
+ \ifdim\xput@defaultborderradius>0pt
+ \xput@ismaskrequiredtrue
+ \else
+ \xput@ismaskrequiredfalse
+ \fi
+ \fi
+ \else
+ \xput@ismaskrequiredtrue
+ \fi
+ \fi
+
+ \ifxput@ismaskrequired
+ \def\xput@clip{}%
+ \else
+ \def\xput@clip{clip}%
+ \fi
+
+ \put(\xput@dimentonumber{\xput@x},\xput@dimentonumber{\xput@y}){%
+ \ifxput@ismaskrequired%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \ifdim\xput@defaultborderwidth>0pt
+ \draw[draw=\xput@defaultbordercolor,draw opacity=\xput@defaultborderopacity,line width=\xput@frameborderwidth,rounded corners=\xput@frameborderradius] (-0.5\xput@frameborderwidth,-0.5\xput@frameborderwidth) rectangle ++(\width+\xput@frameborderwidth,\height+\xput@frameborderwidth);%
+ \fi
+
+ \draw[draw opacity=0,rounded corners=\xput@defaultborderradius,path picture={
+ \node at (0.5\width,0.5\height){
+ \xput@nextincludegraphic
+ };
+ }] (0,0) rectangle ++(\width,\height);%
+ \end{tikzpicture}%
+ \else%
+ \xput@nextincludegraphic
+ \fi%
+ }
+
+ \xput@enablegraphicsfilecheck
+
+ % draw ppi
+ \ifxput@preflight
+ \ifx\xput@nextincludegraphic\xput@emptystring
+ \else
+ \isoptimizable{\xput@currfileext}{\xput@getppi{\xput@currfilebase\xput@currfileext}}
+ \ifdefined\xput@graphicdensity
+ \xput@drawppi{#2}{#3}{#4}{#5}{#6}{\xput@graphicdensity}
+ \fi
+ \fi
+ \fi
+ \endgroup
+ \fi
+}
+\newcommand\xput@drawppi[6]{
+ \xput@x=\posx{1}{#1}{1}{#2}
+ \xput@yy=\posy{1}{#1}
+ \xput@xx=\posx{-1}{#3}{-1}{#4}
+ \xput@y=\posy{-1}{#3}
+ \width=\dimexpr(\xput@xx - \xput@x)\relax
+ \height=\dimexpr(\xput@yy - \xput@y)\relax
+ \def\xput@ppicolor{green!50!black}
+ \def\xput@ppicolortext{white}
+ \ifnum#6<300
+ \def\xput@ppicolor{yellow}
+ \def\xput@ppicolortext{black}
+ \ifnum#6<200
+ \def\xput@ppicolor{red}
+ \def\xput@ppicolortext{white}
+ \xput@errmsg@lowdensity{1}{#5}{#6}
+ \else
+ \xput@errmsg@lowdensity{0}{#5}{#6}
+ \fi
+ \fi
+ \put(\xput@dimentonumber{\xput@x},\xput@dimentonumber{\xput@y}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \node[fill=\xput@ppicolor,fill opacity=0.9,line width=0pt,anchor=north east] at (\width,\height){
+ \color{\xput@ppicolortext}\textbf{#6ppi}
+ };
+ \end{tikzpicture}%
+ }
+}
+
+% pagegraphic
+\def\xput@pagegraphic{}
+\pgfkeys{
+ /pagegraphic/.is family,
+ /pagegraphic,
+ file/.store in=\xput@pagegraphic,
+ scale/.store in=\xput@pagegraphicoptionscale,
+ vpos/.store in=\xput@pagegraphicoptionvpos,
+ hpos/.store in=\xput@pagegraphicoptionhpos,
+ unsharp/.store in=\xput@pagegraphicoptionunsharp,
+}
+\pgfkeys{
+ /backcoverpagegraphic/.is family,
+ /backcoverpagegraphic,
+ file/.store in=\xput@backcoveroptionpagegraphicfile,
+ scale/.store in=\xput@backcoveroptionpagegraphicscale,
+ vpos/.store in=\xput@backcoveroptionpagegraphicvpos,
+ hpos/.store in=\xput@backcoveroptionpagegraphichpos,
+ unsharp/.store in=\xput@backcoveroptionpagegraphicunsharp,
+}
+\def\xput@putpagegraphic{
+ \begingroup
+ \margin=\xput@null
+ \topmargin=\xput@null
+ \bottommargin=\xput@null
+ \innermargin=\xput@null
+ \outermargin=\xput@null
+ \setgrid{{{1}}}
+ \pgfkeys{graphic,scale=\xput@pagegraphicoptionscale,hpos=\xput@pagegraphicoptionhpos,vpos=\xput@pagegraphicoptionvpos,unsharp=\xput@pagegraphicoptionunsharp,border width=0pt,border radius=0pt,shadow size=0}
+ \xput@putgraphic{0}{0}{1}{1}{\xput@pagegraphic}
+ \endgroup
+}
+\newcommand\setpagegraphic[2][]{
+ \ifcsname xput@graphic@#2\endcsname%
+ \csname xput@graphic@#2\endcsname{#1}
+ \else%
+ \pgfkeys{pagegraphic,file={#2},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput@unsharp,#1}
+ \fi
+}
+\def\nopagegraphic{\setpagegraphic{}}
+
+% text
+\newdimen\xput@textboxheight
+\newdimen\xput@textboxwidth
+\newdimen\xput@leftwidth
+\newdimen\xput@rightwidth
+\newcommand\xput@checkside[1]{
+ \ifxput@fanfold
+ \ifxput@isdoublepage
+ \xput@leftwidth=\dimexpr(\xput@pagewidth + \xput@outerbleed - \xput@x)\relax
+ \xput@rightwidth=\dimexpr(\xput@xx - \xput@pagewidth - \xput@outerbleed)\relax
+ \ifdim\xput@rightwidth>\xput@leftwidth
+ \ifnum#1=1
+ \xput@leftpagefalse
+ \xput@rightpagetrue
+ \else
+ \xput@leftpagetrue
+ \xput@rightpagefalse
+ \fi
+ \addtocounter{page}{#1}
+ \fi
+ \fi
+ \fi
+}
+\def\xput@textoptionbottom{bottom}
+\def\xput@textoptioncenter{center}
+\newif\ifxput@text@option@top
+\newif\ifxput@text@option@center
+\newif\ifxput@text@option@bottom
+\newif\ifxput@text@option@parbox
+\newif\ifxput@text@option@breakable
+\let\originaltcbset\tcbset
+\pgfkeys{
+ /inittext/.is family,
+ /inittext,
+ color/.code={\color{#1}},
+ coltext/.forward to=/inittext/color,
+ boxrule/.code={\def\xput@defaultborderwidth{#1}\def\xput@text@option@leftrule{#1}\def\xput@text@option@rightrule{#1}\def\xput@text@option@toprule{#1}\def\xput@text@option@bottomrule{#1}},
+ toprule/.code={\def\xput@text@option@toprule{#1}},
+ rightrule/.code={\def\xput@text@option@rightrule{#1}},
+ bottomrule/.code={\def\xput@text@option@bottomrule{#1}},
+ leftrule/.code={\def\xput@text@option@leftrule{#1}},
+ height/.code={\def\xput@text@option@height{#1}},
+ arc/.code={\ifdim\xput@null=\dimexpr#1\relax\originaltcbset{outer arc=#1}\else\originaltcbset{auto outer arc}\fi\def\xput@defaultborderradius{#1}},
+ colframe/.store in=\xput@defaultbordercolor,
+ opacityframe/.store in=\xput@defaultborderopacity,
+ breakable/.is if=xput@text@option@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@border@#1\endcsname
+ \csname xput@border@#1\endcsname[1]{}
+ \else
+ \pgfkeys{textborder,opacity=1,width=0pt,color=black,radius=0pt}
+ \xput@errmsg@undefined{border}{#1}
+ \fi
+}
+\pgfkeys{
+ /text/.is family,
+ /text,
+ name/.store in=\xput@text@option@name,
+ color/.code={\originaltcbset{coltext=#1}\def\xput@text@option@color{#1}},
+ opacity/.code={\originaltcbset{opacitytext=#1}},
+ top/.code={\originaltcbset{valign=top}\xput@text@option@toptrue},
+ center/.code={\originaltcbset{valign=center}\xput@text@option@centertrue},
+ bottom/.code={\originaltcbset{valign=bottom}\xput@text@option@bottomtrue},
+ boxrule/.code={\originaltcbset{boxrule=#1}\def\xput@defaultborderwidth{#1}\def\xput@text@option@leftrule{#1}\def\xput@text@option@rightrule{#1}\def\xput@text@option@toprule{#1}\def\xput@text@option@bottomrule{#1}},
+ toprule/.code={\originaltcbset{toprule=#1}\def\xput@text@option@toprule{#1}},
+ rightrule/.code={\originaltcbset{rightrule=#1}\def\xput@text@option@rightrule{#1}},
+ bottomrule/.code={\originaltcbset{bottomrule=#1}\def\xput@text@option@bottomrule{#1}},
+ leftrule/.code={\originaltcbset{leftrule=#1}\def\xput@text@option@leftrule{#1}},
+ height/.code={\originaltcbset{height=#1}\def\xput@text@option@height{#1}},
+ parbox/.is if=xput@text@option@parbox,
+ breakable/.is if=xput@text@option@breakable,
+ border radius/.code={\originaltcbset{arc=#1}\ifdim\xput@null=\dimexpr#1\relax\originaltcbset{outer arc=#1}\else\originaltcbset{auto outer arc}\fi\def\xput@defaultborderradius{#1}},
+ arc/.forward to=/text/border radius,
+ border width/.forward to=/text/boxrule,
+ border color/.code={\originaltcbset{colframe=#1}\def\xput@defaultbordercolor{#1}},
+ border opacity/.code={\originaltcbset{opacityframe=#1}\def\xput@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@tcbheight
+\newcommand\xput@puttext[5]{
+ \ifxput@isbatchmode
+ \else
+ \xput@x=\posx{1}{#1}{1}{#2}
+ \xput@xx=\posx{-1}{#3}{-1}{#4}
+ \xput@y=\posy{-1}{#3}
+ \xput@yy=\posy{1}{#1}
+
+ \xput@xx=\dimexpr\xput@xx+\xput@text@option@rightrule\relax
+ \xput@x=\dimexpr\xput@x-\xput@text@option@leftrule\relax
+ \xput@yy=\dimexpr\xput@yy+\xput@text@option@toprule\relax
+ \xput@y=\dimexpr\xput@y-\xput@text@option@bottomrule\relax
+
+ \width=\dimexpr(\xput@xx - \xput@x)\relax
+ \height=\dimexpr(\xput@yy - \xput@y)\relax
+ \xput@textboxwidth=\dimexpr(\xput@xx - \xput@x)\relax
+ \xput@textboxheight=\dimexpr(\xput@yy - \xput@y)\relax
+
+ \ifdefined\xput@text@option@height
+ \ifdim\xput@text@option@height=\height
+ \else
+ \xput@tcbheight=\dimexpr\xput@text@option@height\ifdefined\xput@text@option@toprule+\xput@text@option@toprule\else\ifdefined\xput@defaultborderwidth+\xput@defaultborderwidth\fi\fi\ifdefined\xput@text@option@bottomrule+\xput@text@option@bottomrule\else\ifdefined\xput@defaultborderwidth+\xput@defaultborderwidth\fi\fi\relax
+ \originaltcbset{height=\xput@tcbheight}
+ \fi
+ \else
+ \fi
+
+ \xput@checkvisibility
+ \ifxput@isvisible
+ \xput@checkside{1}
+ \ifxput@text@option@parbox
+ \ifdim\xput@textboxheight<\xput@null
+ \xput@yy=\dimexpr\xput@yy-\xput@textboxheight\relax
+ \xput@textboxheight=\dimexpr-1\xput@textboxheight\relax
+ \fi
+ \put(\xput@dimentonumber{\xput@x},\xput@dimentonumber{\xput@yy}){%
+ \parbox[t][\xput@textboxheight][\ifxput@text@option@center c\else\ifxput@text@option@bottom b\else t\fi\fi]{\xput@textboxwidth}{\vskip \xput@null
+ \color{\xput@text@option@color}%
+ #5%
+ }
+ }
+ \else
+ \ifdim\xput@text@option@bottomrule<\xput@text@option@toprule
+ \def\xput@text@minvborderwidth{\xput@text@option@bottomrule}
+ \def\xput@text@maxvborderwidth{\xput@text@option@toprule}
+ \else
+ \def\xput@text@minvborderwidth{\xput@text@option@toprule}
+ \def\xput@text@maxvborderwidth{\xput@text@option@bottomrule}
+ \fi
+ \ifdim\xput@text@option@leftrule<\xput@text@option@rightrule
+ \def\xput@text@minhborderwidth{\xput@text@option@leftrule}
+ \def\xput@text@maxhborderwidth{\xput@text@option@rightrule}
+ \else
+ \def\xput@text@minhborderwidth{\xput@text@option@rightrule}
+ \def\xput@text@maxhborderwidth{\xput@text@option@leftrule}
+ \fi
+ \ifdim\xput@text@minvborderwidth<\xput@text@minhborderwidth
+ \def\xput@text@minborderwidth{\xput@text@minvborderwidth}
+ \def\xput@text@maxborderwidth{\xput@text@maxhborderwidth}
+ \else
+ \def\xput@text@minborderwidth{\xput@text@minhborderwidth}
+ \def\xput@text@maxborderwidth{\xput@text@maxvborderwidth}
+ \fi
+ \ifdim\xput@text@maxborderwidth=\xput@null
+ \originaltcbset{opacityframe=0}
+ \fi
+
+ \ifxput@text@option@breakable
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @offsetx\endcsname{\xput@text@option@leftrule}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @offsety\endcsname{\xput@text@option@bottomrule}
+ \else
+ \def\xput@text@option@name{xput@unbreakable}
+ \fi
+ \ifcsname xput@textarray@\xput@text@option@name @index\endcsname
+ \global\expandafter\csname xput@textarray@\xput@text@option@name @index\endcsname 0 \relax%
+ \boxarrayclear[\xput@text@option@name]
+ \else
+ \global\expandafter\newcount\csname xput@textarray@\xput@text@option@name @index\endcsname%
+ \newboxarray{\xput@text@option@name}
+ \fi
+ \put(0,0){
+ \ifxput@text@option@breakable%
+ \begin{tcolorbox}[
+ standard jigsaw,
+ width=\width,
+ enforce breakable,
+ break at=\height,
+ height fixed for=all,
+ reset box array=\xput@text@option@name,
+ store to box array=\xput@text@option@name,
+ ]%
+ #5
+ \end{tcolorbox}%
+ \else%
+ \begin{tcolorbox}[
+ standard jigsaw,
+ width=\width,
+ reset box array=\xput@text@option@name,
+ store to box array=\xput@text@option@name,
+ ]%
+ #5
+ \end{tcolorbox}%
+ \fi%
+ }
+ \global\expandafter\advance\csname xput@textarray@\xput@text@option@name @index\endcsname by 1%
+
+ \boxarraygetheight[\xput@text@option@name]{\xput@text@height}{1}
+ \ifxput@text@option@bottom
+ \xput@yy=\dimexpr\xput@yy-(\xput@textboxheight-\xput@text@height)\relax
+ \else
+ \ifxput@text@option@center
+ \xput@yy=\dimexpr\xput@yy-(\xput@textboxheight-\xput@text@height)/2\relax
+ \fi
+ \fi
+ \xput@textboxheight=\xput@text@height
+ \xput@y=\dimexpr\xput@yy-\xput@textboxheight\relax
+
+ % draw shadow
+ \xput@ifshadow{
+ \ifdefined\xput@defaultborderradius
+ \ifdim\xput@defaultborderradius=0pt
+ \xput@frameshadowradius=0pt
+ \else
+ \xput@frameshadowradius=\dimexpr\xput@defaultborderradius+\xput@text@minborderwidth\relax
+ \fi
+ \else
+ \xput@frameshadowradius=0pt
+ \fi
+
+ \def\xput@frameshadowoffsetx{0pt}
+ \def\xput@frameshadowoffsety{0pt}
+
+ \def\xput@frameshadowwidth{\dimexpr\width+10cm\relax}
+ \def\xput@frameshadowheight{\dimexpr\xput@textboxheight+10cm\relax}
+ \def\xput@frameshadowframewidth{\width}
+ \def\xput@frameshadowframeheight{\xput@textboxheight}
+ \def\xput@frameshadowborder{\dimexpr5cm\relax}
+ \ifxput@text@option@breakable
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @shadowsize\endcsname{\xput@defaultshadowsize}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @shadowcolor\endcsname{\xput@defaultshadowcolor}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @shadowopacity\endcsname{\xput@defaultshadowopacity}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @shadowxshift\endcsname{\xput@defaultshadowxshift}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @shadowyshift\endcsname{\xput@defaultshadowyshift}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @frameshadowwidth\endcsname{\the\xput@frameshadowwidth}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @frameshadowheight\endcsname{\the\xput@frameshadowheight}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @frameshadowframewidth\endcsname{\the\xput@frameshadowframewidth}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @frameshadowframeheight\endcsname{\the\xput@frameshadowframeheight}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @frameshadowborder\endcsname{\the\xput@frameshadowborder}
+ \expandafter\xdef\csname xput@textarray@\xput@text@option@name @frameshadowradius\endcsname{\the\xput@frameshadowradius}
+ \fi
+ \xput@drawshadow
+ }
+
+ \put(\xput@dimentonumber{\xput@x},\xput@dimentonumber{\xput@y}){%
+ \consumeboxarray[\xput@text@option@name]{\the\csname xput@textarray@\xput@text@option@name @index\endcsname}%
+ }
+ \fi
+ \xput@checkside{-1}
+ \fi
+ \fi
+}
+\newcommand\xput@putusetext[5][default]{
+ \ifxput@isbatchmode
+ \else
+ \xput@x=\posx{1}{#2}{1}{#3}
+ \xput@xx=\posx{-1}{#4}{-1}{#5}
+ \xput@y=\posy{-1}{#4}
+ \xput@yy=\posy{1}{#2}
+ \width=\dimexpr(\xput@xx - \xput@x)\relax
+ \height=\dimexpr(\xput@yy - \xput@y)\relax
+ \xput@textboxwidth=\dimexpr(\xput@xx - \xput@x)\relax
+ \xput@textboxheight=\dimexpr(\xput@yy - \xput@y)\relax
+
+ \xput@checkvisibility
+ \ifxput@isvisible
+ \ifcsname xput@textarray@#1@index\endcsname
+ \global\expandafter\advance\csname xput@textarray@#1@index\endcsname by 1%
+
+ \xput@y=\dimexpr\xput@yy-\xput@textboxheight\relax
+
+ \ifcsname xput@textarray@#1@shadowsize\endcsname
+ \def\xput@frameshadowoffsetx{\expandafter\csname xput@textarray@#1@offsetx\endcsname}
+ \def\xput@frameshadowoffsety{\expandafter\csname xput@textarray@#1@offsety\endcsname}
+
+ \def\xput@frameshadowwidth{\dimexpr\expandafter\csname xput@textarray@#1@frameshadowwidth\endcsname\relax}
+ \def\xput@frameshadowheight{\dimexpr\expandafter\csname xput@textarray@#1@frameshadowheight\endcsname\relax}
+ \def\xput@frameshadowframewidth{\dimexpr\expandafter\csname xput@textarray@#1@frameshadowframewidth\endcsname\relax}
+ \def\xput@frameshadowframeheight{\dimexpr\expandafter\csname xput@textarray@#1@frameshadowframeheight\endcsname\relax}
+ \def\xput@frameshadowborder{\dimexpr\expandafter\csname xput@textarray@#1@frameshadowborder\endcsname\relax}
+ \def\xput@frameshadowradius{\dimexpr\expandafter\csname xput@textarray@#1@frameshadowradius\endcsname\relax}
+
+ \def\xput@defaultshadowsize{\expandafter\csname xput@textarray@#1@shadowsize\endcsname}
+ \def\xput@defaultshadowcolor{\expandafter\csname xput@textarray@#1@shadowcolor\endcsname}
+ \def\xput@defaultshadowopacity{\expandafter\csname xput@textarray@#1@shadowopacity\endcsname}
+ \def\xput@defaultshadowxshift{\dimexpr\expandafter\csname xput@textarray@#1@shadowxshift\endcsname\relax}
+ \def\xput@defaultshadowyshift{\dimexpr\expandafter\csname xput@textarray@#1@shadowyshift\endcsname\relax}
+
+ \xput@drawshadow
+ \fi
+
+ \xput@checkside{1}
+ \put(\xput@dimentonumber{\xput@x-\expandafter\csname xput@textarray@#1@offsetx\endcsname},\xput@dimentonumber{\xput@y-\expandafter\csname xput@textarray@#1@offsety\endcsname}){%
+ \consumeboxarray[#1]{\the\csname xput@textarray@#1@index\endcsname}%
+ }
+ \xput@checkside{-1}
+ \else
+ \xput@errmsg@undefined{breakable text}{#1}
+ \fi
+ \fi
+ \fi
+}
+
+% xput
+\newcommand\xput@putxput[6][0]{
+ \xput@x=\posx{1}{#2}{1}{#3}
+ \xput@xx=\posx{-1}{#4}{-1}{#5}
+ \xput@y=\posy{-1}{#4}
+ \xput@yy=\posy{1}{#2}
+
+ \xput@checkvisibility
+ \ifxput@isvisible
+ \ifnum#1=1
+ \xput@snapsafezonehorizontal
+ \xput@snapsafezonevertical
+ \fi
+
+ \width=\dimexpr(\xput@xx - \xput@x)\relax
+ \height=\dimexpr(\xput@yy - \xput@y)\relax
+
+ \put(\xput@dimentonumber{\xput@x},\xput@dimentonumber{\xput@y}){%
+ \ifx\xput@pageoptioncolor\xput@emptystring
+ \color{\xputoptions@color}%
+ \else
+ \color{\xput@pageoptioncolor}%
+ \fi
+ #6
+ }
+ \fi
+}
+
+% tikzgraphic
+\newcommand\xput@puttikz[6][0]{
+ \ifxput@isbatchmode
+ \else
+ \xput@putxput[#1]{#2}{#3}{#4}{#5}{%
+ \begin{tikzpicture}
+ \pgflowlevelsynccm
+ #6
+ \end{tikzpicture}
+ }
+ \fi
+}
+
+% border
+\def\xput@defaultborderwidth{0pt}
+\def\xput@defaultborderradius{0pt}
+\def\xput@defaultbordercolor{black}
+\def\xput@defaultborderopacity{1}
+\pgfkeysdef{/defaultborder/name}{
+ \ifcsname xput@border@#1\endcsname
+ \csname xput@border@#1\endcsname{}
+ \else
+ \pgfkeys{defaultborder,opacity=1,width=0pt,color=black,radius=0pt}
+ \xput@errmsg@undefined{border}{#1}
+ \fi
+}
+\newcommand\newborder[2]{
+ \expandafter\newcommand\csname xput@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@defaultborderradius,
+ width/.store in=\xput@defaultborderwidth,
+ color/.store in=\xput@defaultbordercolor,
+ opacity/.store in=\xput@defaultborderopacity,
+}
+\newcommand\setborder[2][]{
+ \ifxput@placeholdermode
+ \ifnum\xput@contentcounter<\xput@placeholdercounter
+ \xput@border{#1}{#2}
+ \fi
+ \else
+ \xput@border{#1}{#2}
+ \fi
+}
+\def\noborder{\setborder{}}
+\newcommand\xput@border[2]{
+ \pgfkeys{defaultborder,width=0pt,color=black,opacity=1,radius=0pt,#1}
+ \ifcsname xput@border@#2\endcsname
+ \csname xput@border@#2\endcsname{#1}
+ \fi
+}
+
+% shadow
+\def\xput@defaultshadowsize{0}
+\def\xput@defaultshadowopacity{0.4}
+\def\xput@defaultshadowcolor{black}
+\def\xput@defaultshadowxshift{0pt}
+\def\xput@defaultshadowyshift{0pt}
+\pgfkeysdef{/defaultshadow/name}{
+ \ifcsname xput@shadow@#1\endcsname
+ \csname xput@shadow@#1\endcsname{}
+ \else
+ \pgfkeys{defaultshadow,opacity=0.4,size=0,color=black,xshift=0pt,yshift=0pt}
+ \xput@errmsg@undefined{shadow}{#1}
+ \fi
+}
+\newcommand\newshadow[2]{
+ \expandafter\newcommand\csname xput@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@defaultshadowsize,
+ color/.store in=\xput@defaultshadowcolor,
+ opacity/.store in=\xput@defaultshadowopacity,
+ xshift/.store in=\xput@defaultshadowxshift,
+ yshift/.store in=\xput@defaultshadowyshift,
+}
+\newcommand\setshadow[2][]{
+ \ifxput@placeholdermode
+ \ifnum\xput@contentcounter<\xput@placeholdercounter
+ \xput@shadow{#1}{#2}
+ \fi
+ \else
+ \xput@shadow{#1}{#2}
+ \fi
+}
+\def\noshadow{\setshadow{}}
+\newcommand\xput@shadow[2]{
+ \pgfkeys{defaultshadow,size=0pt,color=black,opacity=1,xshift=0pt,yshift=0pt,#1}
+ \ifcsname xput@shadow@#2\endcsname
+ \csname xput@shadow@#2\endcsname{#1}
+ \fi
+}
+\newcommand\xput@ifshadow[1]{
+ \ifdim\dimexpr\xput@defaultshadowsize pt\relax>\xput@null
+ #1
+ \else
+ \ifdim\xput@defaultshadowxshift>\xput@null
+ #1
+ \else
+ \ifdim\xput@defaultshadowyshift>\xput@null
+ #1
+ \fi
+ \fi
+ \fi
+}
+\def\xput@drawshadow{
+ \xput@ifshadow{
+ \xdef\xput@shadowid{shadow-\xput@defaultshadowsize-\xput@defaultshadowcolor-\xput@defaultshadowopacity-\the\numexpr\xput@frameshadowwidth\relax-\the\numexpr\xput@frameshadowheight\relax-\the\numexpr\xput@frameshadowradius\relax-\the\numexpr\xput@frameshadowborder\relax}
+ \IfFileExists{./cache/\xput@shadowid/s.pdf}{
+ \put(\xput@dimentonumber{\dimexpr\xput@x-5cm-\xput@frameshadowoffsetx+\xput@defaultshadowxshift\relax},\xput@dimentonumber{\dimexpr\xput@y-5cm-\xput@frameshadowoffsety-\xput@defaultshadowyshift\relax}){%
+ \includegraphics[width=\xput@frameshadowwidth]{cache/\xput@shadowid/s.pdf}
+ }
+ }{
+ \xput@makeshadow{\xput@shadowid}
+ \IfFileExists{./cache/\xput@shadowid/s.pdf}{
+ \put(\xput@dimentonumber{\dimexpr\xput@x-5cm-\xput@frameshadowoffsetx+\xput@defaultshadowxshift\relax},\xput@dimentonumber{\dimexpr\xput@y-5cm-\xput@frameshadowoffsety-\xput@defaultshadowyshift\relax}){%
+ \includegraphics[width=\xput@frameshadowwidth]{cache/\xput@shadowid/s.pdf}
+ }
+ }{
+ \ifx\xput@processresult\xput@ok
+ \ClassError{Xput}{Unexpected error. Shadow not created}{File `cache/\xput@shadowid/s.pdf' not\MessageBreak found.\MessageBreak\MessageBreak\@ehc}
+ \fi
+ }
+ }
+ }
+}
+
+% layout helper
+\def\xput@gridcolor{green!90!black}
+\def\xput@gridopacity{0.8}
+\def\xput@gutteropacity{0.2}
+\newdimen\xput@gridx
+\newdimen\xput@gridxx
+\newdimen\xput@gridy
+\newdimen\xput@gridyy
+\newcommand\xput@putgrid{
+ \ifxput@isemptypage
+ \else
+ \ifxput@grid
+ \xput@gridx=\posx{1}{1}{1}{0}
+ \xput@gridxx=\posx{-1}{1}{-1}{\xput@get{1C}}
+ \xput@gridy=\posy{1}{0}
+ \xput@gridyy=\posy{-1}{\xput@rowscount}
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \foreach \rowI in {1,...,\xput@rowscount} {
+ \ifnum\rowI<\xput@rowscount
+ \ifdim\xput@gutter=\xput@null
+ \draw[line cap=rect,line width=0.2mm,draw=\xput@gridcolor,opacity=\xput@gridopacity] ({\xput@gridx+0.05mm},{\posy{0}{\rowI}}) -- ({\xput@gridxx-0.05mm},{\posy{0}{\rowI}});%
+ \else
+ \draw[line cap=rect,line width=\xput@gutter,draw=\xput@gridcolor,opacity=\xput@gutteropacity] ({\xput@gridx+\xput@gutter/2},{\posy{0}{\rowI}}) -- ({\xput@gridxx-\xput@gutter/2},{\posy{0}{\rowI}});%
+ \fi
+ \fi
+ \ifnum\numexpr\xput@get{\rowI C} - 1\relax>0
+ \foreach \cellI in {1,...,\numexpr\xput@get{\rowI C} - 1\relax} {
+ \ifdim\xput@gutter=\xput@null
+ \draw[line width=0.2mm,draw=\xput@gridcolor,opacity=\xput@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@gutter,draw=\xput@gridcolor,opacity=\xput@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@gridcolor,opacity=\xput@gridopacity] ({\xput@gridx},{\xput@gridy}) rectangle ({\xput@gridxx},{\xput@gridyy});%
+ \ifdim\xput@gridoffsethorizontal>0.001pt
+ \draw[line width=0.2mm,dash pattern={on 1mm off 1mm},draw=\xput@gridcolor,opacity=\xput@gridopacity] (\xput@gridx,\xput@gridy) -- (\xput@gridx-\xput@gridoffsethorizontal,\xput@gridy) -- (\xput@gridx-\xput@gridoffsethorizontal,\xput@gridyy) -- (\xput@gridx,\xput@gridyy);%
+ \fi
+ \ifdim\xput@gridoffsethorizontaln>0.001pt
+ \draw[line width=0.2mm,dash pattern={on 1mm off 1mm},draw=\xput@gridcolor,opacity=\xput@gridopacity] (\xput@gridxx,\xput@gridy) -- (\xput@gridxx+\xput@gridoffsethorizontaln,\xput@gridy) -- (\xput@gridxx+\xput@gridoffsethorizontaln,\xput@gridyy) -- (\xput@gridxx,\xput@gridyy);%
+ \fi
+ \ifdim\xput@gridoffsetvertical>0.001pt
+ \draw[line width=0.2mm,dash pattern={on 1mm off 1mm},draw=\xput@gridcolor,opacity=\xput@gridopacity] (\xput@gridx,\xput@gridy) -- (\xput@gridx,\xput@gridy+\xput@gridoffsetvertical)-- (\xput@gridxx,\xput@gridy+\xput@gridoffsetvertical) -- (\xput@gridxx,\xput@gridy);%
+ \fi
+ \ifdim\xput@gridoffsetverticaln>0.001pt
+ \draw[line width=0.2mm,dash pattern={on 1mm off 1mm},draw=\xput@gridcolor,opacity=\xput@gridopacity] ({\xput@gridx},{\xput@gridyy}) --({\xput@gridx},{\xput@gridyy-\xput@gridoffsetverticaln}) -- ({\xput@gridxx},{\xput@gridyy-\xput@gridoffsetverticaln}) -- ({\xput@gridxx},{\xput@gridyy});%
+ \fi
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+}
+\def\xput@bleedcolor{red}
+\def\xput@bleedopacity{0.5}
+\newif\ifxput@putbleed
+\newcommand\xput@checkbleed{
+ \ifdim\xput@topbleed>\xput@null
+ \xput@putbleedtrue
+ \else
+ \ifdim\xput@bottombleed>\xput@null
+ \xput@putbleedtrue
+ \else
+ \ifdim\xput@innerbleed>\xput@null
+ \xput@putbleedtrue
+ \else
+ \ifdim\xput@outerbleed>\xput@null
+ \xput@putbleedtrue
+ \else
+ \xput@putbleedfalse
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput@putbleed{
+ \ifxput@isemptypage
+ \else
+ \ifxput@safezone
+ \xput@checkbleed
+ \ifxput@putbleed
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \ifxput@frontcover
+ \ifxput@backcover
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, \xput@pageheight + \xput@bottombleed) rectangle ++(\xput@pagewidth + \xput@outerbleed,\xput@topbleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, 0) rectangle ++(\xput@pagewidth + \xput@outerbleed,\xput@bottombleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, \xput@bottombleed) rectangle ++(\xput@outerbleed,\xput@pageheight);%
+ \else
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (\xput@pagewidth + \xput@outerbleed, \xput@pageheight + \xput@bottombleed) rectangle ++(\xput@pagewidth + \xput@outerbleed + \spinewidth,\xput@topbleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (\xput@pagewidth + \xput@outerbleed, 0) rectangle ++(\xput@pagewidth + \xput@outerbleed + \spinewidth,\xput@bottombleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (\xput@pagewidth * 2 + \xput@outerbleed + \spinewidth, \xput@bottombleed) rectangle ++(\xput@outerbleed,\xput@pageheight);%
+ \fi
+ \else
+ \ifxput@fanfold
+ \ifxput@isdoublepage
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, \xput@pageheight + \xput@bottombleed) rectangle ++(\xput@pagewidth * 2 + \xput@outerbleed * 2,\xput@topbleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, 0) rectangle ++(\xput@pagewidth * 2 + \xput@outerbleed * 2,\xput@bottombleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, \xput@bottombleed) rectangle ++(\xput@outerbleed,\xput@pageheight);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (\xput@pagewidth * 2 + \xput@outerbleed, \xput@bottombleed) rectangle ++(\xput@outerbleed,\xput@pageheight);%
+ \else
+ \ifxput@leftpage
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, \xput@pageheight + \xput@bottombleed) rectangle ++(\xput@pagewidth + \xput@outerbleed,\xput@topbleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, 0) rectangle ++(\xput@pagewidth + \xput@outerbleed,\xput@bottombleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, \xput@bottombleed) rectangle ++(\xput@outerbleed,\xput@pageheight);%
+ \else
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (\xput@pagewidth + \xput@outerbleed, \xput@pageheight + \xput@bottombleed) rectangle ++(\xput@pagewidth + \xput@outerbleed,\xput@topbleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (\xput@pagewidth + \xput@outerbleed, 0) rectangle ++(\xput@pagewidth + \xput@outerbleed,\xput@bottombleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (\xput@pagewidth * 2 + \xput@outerbleed, \xput@bottombleed) rectangle ++(\xput@outerbleed,\xput@pageheight);%
+ \fi
+ \fi
+ \else
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, \xput@pageheight + \xput@bottombleed) rectangle ++(\xput@pagewidth + \xput@leftbleed + \xput@rightbleed,\xput@topbleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, 0) rectangle ++(\xput@pagewidth + \xput@leftbleed + \xput@rightbleed,\xput@bottombleed);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (0, \xput@bottombleed) rectangle ++(\xput@leftbleed,\xput@pageheight);%
+ \fill[\xput@bleedcolor,opacity=\xput@bleedopacity] (\xput@pagewidth + \xput@leftbleed, \xput@bottombleed) rectangle ++(\xput@rightbleed,\xput@pageheight);%
+ \fi
+ \fi
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \fi
+}
+\newdimen\xput@cuttingmarka
+\newdimen\xput@cuttingmarkb
+\xput@cuttingmarka=-3mm
+\xput@cuttingmarkb=-1mm
+\newcommand\xput@putcuttingmarks{
+ \ifxput@isemptypage
+ \ifxput@fanfold
+ \xput@cuttingmarksvisibletrue
+ \fi
+ \else
+ \xput@cuttingmarksvisibletrue
+ \fi
+ \ifxput@cuttingmarksvisible
+ \ifxput@cuttingmarks
+ \ifxput@safezone
+ \else
+ \xput@checkbleed
+ \ifxput@putbleed
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \ifxput@frontcover
+ \ifxput@backcover
+ \draw[\xput@pageoptioncolor,line width=0.15mm](\xput@outerbleed + \xput@cuttingmarka, \xput@bottombleed) -- (\xput@outerbleed + \xput@cuttingmarkb, \xput@bottombleed);%
+ \draw[\xput@pageoptioncolor,line width=0.15mm](\xput@outerbleed, \xput@bottombleed + \xput@cuttingmarka) -- (\xput@outerbleed, \xput@bottombleed + \xput@cuttingmarkb);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed + \xput@cuttingmarka, \xput@bottombleed+\xput@pageheight) -- (\xput@outerbleed + \xput@cuttingmarkb, \xput@bottombleed + \xput@pageheight);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed, \xput@bottombleed + \xput@pageheight - \xput@cuttingmarka) -- (\xput@outerbleed, \xput@bottombleed + \xput@pageheight - \xput@cuttingmarkb);%
+ \else
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed + \spinewidth - \xput@cuttingmarka, \xput@bottombleed) -- (2\xput@pagewidth + \xput@outerbleed + \spinewidth - \xput@cuttingmarkb, \xput@bottombleed);%
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed + \spinewidth, \xput@bottombleed + \xput@cuttingmarka) -- (2\xput@pagewidth + \xput@outerbleed + \spinewidth, \xput@bottombleed + \xput@cuttingmarkb);%
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed + \spinewidth - \xput@cuttingmarka, \xput@bottombleed+\xput@pageheight) -- (2\xput@pagewidth + \xput@outerbleed + \spinewidth - \xput@cuttingmarkb, \xput@bottombleed+\xput@pageheight);%
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed + \spinewidth, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarka) -- (2\xput@pagewidth + \xput@outerbleed + \spinewidth, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarkb);%
+ \fi
+ \else
+ \ifxput@fanfold
+ \ifxput@isdoublepage
+ \draw[\xput@pageoptioncolor](\xput@outerbleed + \xput@cuttingmarka, \xput@bottombleed) -- (\xput@outerbleed + \xput@cuttingmarkb, \xput@bottombleed);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed, \xput@bottombleed + \xput@cuttingmarka) -- (\xput@outerbleed, \xput@bottombleed + \xput@cuttingmarkb);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed + \xput@cuttingmarka, \xput@bottombleed+\xput@pageheight) -- (\xput@outerbleed + \xput@cuttingmarkb, \xput@bottombleed+\xput@pageheight);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarka) -- (\xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarkb);%
+
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarka, \xput@bottombleed) -- (2\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarkb, \xput@bottombleed);%
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed, \xput@bottombleed + \xput@cuttingmarka) -- (2\xput@pagewidth + \xput@outerbleed, \xput@bottombleed + \xput@cuttingmarkb);%
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarka, \xput@bottombleed+\xput@pageheight) -- (2\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarkb, \xput@bottombleed+\xput@pageheight);%
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarka) -- (2\xput@pagewidth + \xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarkb);%
+ \else
+ \ifxput@leftpage
+ \draw[\xput@pageoptioncolor](\xput@outerbleed + \xput@cuttingmarka, \xput@bottombleed) -- (\xput@outerbleed + \xput@cuttingmarkb, \xput@bottombleed);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed, \xput@bottombleed + \xput@cuttingmarka) -- (\xput@outerbleed, \xput@bottombleed + \xput@cuttingmarkb);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed + \xput@cuttingmarka, \xput@bottombleed+\xput@pageheight) -- (\xput@outerbleed + \xput@cuttingmarkb, \xput@bottombleed+\xput@pageheight);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarka) -- (\xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarkb);%
+ \else
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarka, \xput@bottombleed) -- (2\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarkb, \xput@bottombleed);%
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed, \xput@bottombleed + \xput@cuttingmarka) -- (2\xput@pagewidth + \xput@outerbleed, \xput@bottombleed + \xput@cuttingmarkb);%
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarka, \xput@bottombleed+\xput@pageheight) -- (2\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarkb, \xput@bottombleed+\xput@pageheight);%
+ \draw[\xput@pageoptioncolor](2\xput@pagewidth + \xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarka) -- (2\xput@pagewidth + \xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarkb);%
+ \fi
+ \fi
+ \else
+ \draw[\xput@pageoptioncolor](\xput@outerbleed + \xput@cuttingmarka, \xput@bottombleed) -- (\xput@outerbleed + \xput@cuttingmarkb, \xput@bottombleed);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed, \xput@bottombleed + \xput@cuttingmarka) -- (\xput@outerbleed, \xput@bottombleed + \xput@cuttingmarkb);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed + \xput@cuttingmarka, \xput@bottombleed+\xput@pageheight) -- (\xput@outerbleed + \xput@cuttingmarkb, \xput@bottombleed+\xput@pageheight);%
+ \draw[\xput@pageoptioncolor](\xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarka) -- (\xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarkb);%
+ \draw[\xput@pageoptioncolor](\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarka, \xput@bottombleed) -- (\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarkb, \xput@bottombleed);%
+ \draw[\xput@pageoptioncolor](\xput@pagewidth + \xput@outerbleed, \xput@bottombleed + \xput@cuttingmarka) -- (\xput@pagewidth + \xput@outerbleed, \xput@bottombleed + \xput@cuttingmarkb);%
+ \draw[\xput@pageoptioncolor](\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarka, \xput@bottombleed+\xput@pageheight) -- (\xput@pagewidth + \xput@outerbleed - \xput@cuttingmarkb, \xput@bottombleed+\xput@pageheight);%
+ \draw[\xput@pageoptioncolor](\xput@pagewidth + \xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarka) -- (\xput@pagewidth + \xput@outerbleed, \xput@bottombleed+\xput@pageheight - \xput@cuttingmarkb);%
+ \fi
+ \fi
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\def\xput@safetymargincolor{pink}
+\def\xput@safetymarginopacity{0.8}
+\newif\ifxput@putsafezone
+\newcommand\xput@checksafezone{
+ \ifdim\xput@topsafetymargin>\xput@null
+ \xput@putsafezonetrue
+ \else
+ \ifdim\xput@bottomsafetymargin>\xput@null
+ \xput@putsafezonetrue
+ \else
+ \ifdim\xput@innersafetymargin>\xput@null
+ \xput@putsafezonetrue
+ \else
+ \ifdim\xput@outersafetymargin>\xput@null
+ \xput@putsafezonetrue
+ \else
+ \xput@putsafezonefalse
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput@putsafezone{
+ \ifxput@isemptypage
+ \else
+ \ifxput@safezone
+ \xput@checksafezone
+ \ifxput@putsafezone
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \ifxput@frontcover
+ \ifxput@backcover
+ \else
+ \draw[line cap=rect,line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\xput@pagewidth + \xput@outerbleed,0.05mm) -- (\xput@pagewidth + \xput@outerbleed,\paperheight-0.05mm);%
+ \draw[line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\xput@outersafetymargin + \xput@outerbleed,\xput@bottomsafetymargin + \xput@bottombleed) rectangle (\xput@pagewidth + \xput@outerbleed - \xput@innersafetymargin,\paperheight - \xput@topsafetymargin - \xput@topbleed);%
+ \draw[line cap=rect,line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\xput@pagewidth + \xput@outerbleed + \spinewidth,0.05mm) -- (\xput@pagewidth + \xput@outerbleed + \spinewidth,\paperheight-0.05mm);%
+ \draw[line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\xput@pagewidth + \xput@outerbleed + \spinewidth + \xput@innersafetymargin,\xput@bottomsafetymargin + \xput@bottombleed) rectangle (\paperwidth - \xput@outerbleed - \xput@outersafetymargin,\paperheight - \xput@topsafetymargin - \xput@topbleed);%
+ \fi
+ \else
+ \ifxput@fanfold
+ \ifxput@isdoublepage
+ \draw[line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\xput@outersafetymargin + \xput@outerbleed,\xput@bottomsafetymargin + \xput@bottombleed) rectangle (\paperwidth / 2 - \xput@innersafetymargin,\paperheight - \xput@topsafetymargin - \xput@topbleed);%
+ \draw[line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\paperwidth / 2 + \xput@innersafetymargin,\xput@bottomsafetymargin + \xput@bottombleed) rectangle (\paperwidth - \xput@outerbleed - \xput@outersafetymargin,\paperheight - \xput@topsafetymargin - \xput@topbleed);%
+ \else
+ \ifxput@leftpage
+ \draw[line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\xput@outersafetymargin + \xput@outerbleed,\xput@bottomsafetymargin + \xput@bottombleed) rectangle (\paperwidth / 2 - \xput@innersafetymargin,\paperheight - \xput@topsafetymargin - \xput@topbleed);%
+ \else
+ \draw[line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\paperwidth / 2 + \xput@innersafetymargin,\xput@bottomsafetymargin + \xput@bottombleed) rectangle (\paperwidth - \xput@outerbleed - \xput@outersafetymargin,\paperheight - \xput@topsafetymargin - \xput@topbleed);%
+ \fi
+ \fi
+ \draw[line cap=rect,line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\paperwidth / 2,0.05mm) -- (\paperwidth / 2,\paperheight-0.05mm);%
+ \else
+ \draw[line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\xput@leftsafetymargin + \xput@leftbleed,\xput@bottomsafetymargin + \xput@bottombleed) rectangle (\paperwidth - \xput@rightsafetymargin - \xput@rightbleed,\paperheight - \xput@topsafetymargin - \xput@topbleed);%
+ \fi
+ \fi
+ \end{tikzpicture}%
+ }
+ \else
+ \ifxput@frontcover
+ \ifxput@backcover
+ \else
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \draw[line cap=rect,line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\xput@pagewidth + \xput@outerbleed,0.05mm) -- (\xput@pagewidth + \xput@outerbleed,\paperheight-0.05mm);%
+ \draw[line cap=rect,line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\xput@pagewidth + \xput@outerbleed + \spinewidth,0.05mm) -- (\xput@pagewidth + \xput@outerbleed + \spinewidth,\paperheight-0.05mm);%
+ \end{tikzpicture}%
+ }
+ \fi
+ \else
+ \ifxput@fanfold
+ \put(0,0){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \draw[line cap=rect,line width=0.1mm,draw=\xput@safetymargincolor,opacity=\xput@safetymarginopacity] (\paperwidth / 2,0.05mm) -- (\paperwidth / 2,\paperheight-0.05mm);%
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\def\xput@graphpapercolor{gray!70}
+\def\xput@graphpaperopacity{0.2}
+\newcommand\xput@calcgraphpaperx{
+ \ifdim\xput@graphpaperx>\xput@null
+ \xput@graphpaperx=\dimexpr\xput@graphpaperx-\xput@graphpapersnap\relax
+ \xput@calcgraphpaperx
+ \fi
+}
+\newcommand\xput@calcgraphpapery{
+ \ifdim\xput@graphpapery>\xput@null
+ \xput@graphpapery=\dimexpr\xput@graphpapery-\xput@graphpapersnap\relax
+ \xput@calcgraphpapery
+ \fi
+}
+\newcommand\xput@calcgraphpaperoffset{
+ \xput@graphpaperoffset=\xput@null
+
+ \xput@graphpaperoffsetsnap \numexpr\number\xput@pagewidth/\xput@graphpapersnap\relax
+ \xput@graphpaperoffset=\dimexpr\xput@pagewidth-\xput@graphpapersnap*\xput@graphpaperoffsetsnap\relax
+ \ifdim\xput@graphpaperoffset<\xput@null
+ \xput@graphpaperoffset=\dimexpr\xput@graphpaperoffset+\xput@graphpapersnap\relax
+ \fi
+ \xput@graphpaperx=\dimexpr\xput@graphpaperx-\xput@graphpaperoffset\relax
+}
+\newcount\xput@graphpaperoffsetsnap
+\newcommand\xput@putgraphpaper{
+ \ifxput@graphpaper
+ \xput@graphpapery=\xput@bottombleed
+ \xput@calcgraphpapery
+ \xput@graphpaperx=\xput@leftbleed
+ \xput@calcgraphpaperx
+
+ \ifxput@frontcover
+ \ifxput@backcover
+ \put(\xput@dimentonumber{\xput@graphpaperx},\xput@dimentonumber{\xput@graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput@graphpaperconfigitem in \xput@graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput@graphpaperconfigitem,\xput@graphpapercolor,opacity=\xput@graphpaperopacity] (0pt,0pt) grid ++(\xput@pagewidth-\xput@graphpaperx+\xput@outerbleed,\paperheight-\xput@graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \else
+ \xput@graphpaperx=\dimexpr\xput@pagewidth+\xput@outerbleed\relax
+ \put(\xput@dimentonumber{\xput@graphpaperx},\xput@dimentonumber{\xput@graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput@graphpaperconfigitem in \xput@graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput@graphpaperconfigitem,\xput@graphpapercolor,opacity=\xput@graphpaperopacity] (0pt,0pt) grid ++(\spinewidth,\paperheight-\xput@graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \xput@graphpaperx=\dimexpr\xput@pagewidth+\xput@outerbleed+\spinewidth\relax
+ \put(\xput@dimentonumber{\xput@graphpaperx},\xput@dimentonumber{\xput@graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput@graphpaperconfigitem in \xput@graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput@graphpaperconfigitem,\xput@graphpapercolor,opacity=\xput@graphpaperopacity] (0pt,0pt) grid ++(\xput@pagewidth+\xput@outerbleed,\paperheight-\xput@graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \fi
+ \else
+ \ifxput@fanfold
+ \ifxput@isdoublepage
+ \put(\xput@dimentonumber{\xput@graphpaperx},\xput@dimentonumber{\xput@graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput@graphpaperconfigitem in \xput@graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput@graphpaperconfigitem,\xput@graphpapercolor,opacity=\xput@graphpaperopacity] (0pt,0pt) grid ++(\paperwidth-\xput@graphpaperx,\paperheight-\xput@graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \else
+ \ifxput@leftpage
+ \put(\xput@dimentonumber{\xput@graphpaperx},\xput@dimentonumber{\xput@graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput@graphpaperconfigitem in \xput@graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput@graphpaperconfigitem,\xput@graphpapercolor,opacity=\xput@graphpaperopacity] (0pt,0pt) grid ++(\xput@pagewidth-\xput@graphpaperx+\xput@outerbleed,\paperheight-\xput@graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \else
+ \xput@graphpaperx=\dimexpr\xput@pagewidth+\xput@outerbleed\relax
+ \put(\xput@dimentonumber{\xput@graphpaperx},\xput@dimentonumber{\xput@graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput@graphpaperconfigitem in \xput@graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput@graphpaperconfigitem,\xput@graphpapercolor,opacity=\xput@graphpaperopacity] (0pt,0pt) grid ++(\xput@pagewidth+\xput@outerbleed,\paperheight-\xput@graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \else
+ \ifxput@isdoublepage
+ \ifxput@rightpage
+ \xput@calcgraphpaperoffset
+ \fi
+ \fi
+
+ \put(\xput@dimentonumber{\xput@graphpaperx},\xput@dimentonumber{\xput@graphpapery}){%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+
+ \foreach \xput@graphpaperconfigitem in \xput@graphpaperconfig {
+ \draw[line cap=rect,line width=0.05mm,step=\xput@graphpaperconfigitem,\xput@graphpapercolor,opacity=\xput@graphpaperopacity] (0pt,0pt) grid ++(\paperwidth-\xput@graphpaperx,\paperheight-\xput@graphpapery);%
+ }
+ \end{tikzpicture}%
+ }
+ \fi
+ \fi
+ \fi
+}
+
+% pages
+\newif\ifxput@isbeforepage
+\def\xput@currentbeforepage{}
+\newcommand\setbeforepage[1]{
+ \ifxput@ispage
+ \def\xput@currentbeforepage{#1}
+ \else
+ \global\def\xput@currentbeforepage{#1}
+ \fi
+}
+\def\nobeforepage{\setbeforepage{}}
+\newcommand\newbeforepage[2]{
+ \expandafter\newcommand\csname xput@before@#1\endcsname{%
+ \begingroup%
+ #2
+ \endgroup%
+ }%
+}
+\newcommand\xput@putbeforepage{
+ \ifx\xput@pagegraphic\xput@emptystring
+ \else
+ \xput@putpagegraphic
+ \fi
+ \ifx\xput@currentbeforepage\xput@emptystring
+ \else
+ \ifcsname xput@before@\xput@currentbeforepage\endcsname%
+ \xput@isbeforepagetrue
+ \csname xput@before@\xput@currentbeforepage\endcsname
+ \xput@isbeforepagefalse
+ \else
+ \xput@errmsg@undefined{before page}{\xput@currentbeforepage}
+ \fi
+ \fi
+ \xput@resetautogrid
+}
+\newcommand\xput@beforepage{
+ \xput@closerows
+ \ifx\xput@pagecolor\xput@emptystring
+ \else
+ \begingroup
+ \margin=\xput@null
+ \topmargin=\xput@null
+ \bottommargin=\xput@null
+ \innermargin=\xput@null
+ \outermargin=\xput@null
+ \setgrid{{{1}}}
+ \ifx\xput@pagecolormodel\xput@emptystring
+ \else
+ \definecolor{tmpcolor}{\xput@pagecolormodel}{\xput@pagecolor}
+ \setpagecolor{tmpcolor}
+ \fi
+ \xput@putxput[1]{0}{0}{1}{1}{%
+ \begin{tikzpicture}%
+ \pgflowlevelsynccm%
+ \fill[\xput@pagecolor] (0,0) rectangle ++(\width,\height);
+ \end{tikzpicture}%
+ }
+ \endgroup
+ \fi
+
+ \ifxput@isemptypage
+ \else
+ \xput@putgraphpaper
+ \fi
+}
+\newcommand\xput@setuppage{
+ \global\gutter=\gutter
+ \global\margin=\margin
+ \global\innermargin=\innermargin
+ \global\outermargin=\outermargin
+ \global\bottommargin=\bottommargin
+ \global\topmargin=\topmargin
+ \ifxput@grid\global\xput@gridtrue\else\global\xput@gridfalse\fi
+ \ifxput@graphpaper\global\xput@graphpapertrue\else\global\xput@graphpaperfalse\fi
+ \ifxput@safezone\global\xput@safezonetrue\else\global\xput@safezonefalse\fi
+ \ifxput@placeholder\global\xput@placeholdertrue\else\global\xput@placeholderfalse\fi
+ \global\let\xput@defaultborderwidth\xput@defaultborderwidth
+ \global\let\xput@defaultborderradius\xput@defaultborderradius
+ \global\let\xput@defaultborderopacity\xput@defaultborderopacity
+ \global\let\xput@defaultbordercolor\xput@defaultbordercolor
+ \global\let\xput@defaultshadowsize\xput@defaultshadowsize
+ \global\let\xput@defaultshadowopacity\xput@defaultshadowopacity
+ \global\let\xput@defaultshadowcolor\xput@defaultshadowcolor
+ \global\let\xput@defaultshadowxshift\xput@defaultshadowxshift
+ \global\let\xput@defaultshadowyshift\xput@defaultshadowyshift
+ \global\let\xput@pagegraphicoptionscale\xput@pagegraphicoptionscale
+ \global\let\xput@pagegraphicoptionvpos\xput@pagegraphicoptionvpos
+ \global\let\xput@pagegraphicoptionhpos\xput@pagegraphicoptionhpos
+ \global\let\xput@pagegraphicoptionunsharp\xput@pagegraphicoptionunsharp
+
+ \xput@pagewidth=\pagewidth
+ \xput@pageheight=\pageheight
+ \xput@outerbleed=\ifdim\outerbleed=\xput@undefdim\bleed\else\outerbleed\fi
+ \xput@innerbleed=\ifdim\innerbleed=\xput@undefdim\bleed\else\innerbleed\fi
+ \xput@topbleed=\ifdim\topbleed=\xput@undefdim\bleed\else\topbleed\fi
+ \xput@bottombleed=\ifdim\bottombleed=\xput@undefdim\bleed\else\bottombleed\fi
+ \xput@outersafetymargin=\ifdim\outersafetymargin=\xput@undefdim\safetymargin\else\outersafetymargin\fi
+ \xput@innersafetymargin=\ifdim\innersafetymargin=\xput@undefdim\safetymargin\else\innersafetymargin\fi
+ \xput@topsafetymargin=\ifdim\topsafetymargin=\xput@undefdim\safetymargin\else\topsafetymargin\fi
+ \xput@bottomsafetymargin=\ifdim\bottomsafetymargin=\xput@undefdim\safetymargin\else\bottomsafetymargin\fi
+
+ \ifxput@haspages
+ \ifxput@twoside
+ \ifxput@leftpage
+ \global\xput@rightpagetrue
+ \global\xput@leftpagefalse
+ \else
+ \global\xput@rightpagefalse
+ \global\xput@leftpagetrue
+ \fi
+ \fi
+ \else
+ \xput@isinitgridfalse
+ \ifxput@beginleft
+ \global\xput@leftpagetrue
+ \fi
+ \ifxput@beginright
+ \global\xput@beginleftfalse
+ \global\xput@beginrightfalse
+ \global\xput@leftpagefalse
+ \fi
+ \ifxput@leftpage
+ \xput@haspagestrue
+ \global\xput@leftpagetrue
+ \global\xput@rightpagefalse
+ \else
+ \ifxput@fanfold
+ \global\xput@rightpagefalse
+ \global\xput@leftpagetrue
+ \setcounter{page}{0}
+ \xput@emptypage
+ \global\xput@rightpagetrue
+ \global\xput@leftpagefalse
+ \global\xput@haslastemptypagetrue
+ \else
+ \ifxput@hascover
+ \ifxput@fillpages
+ \ifxput@twoside
+ \global\xput@rightpagefalse
+ \global\xput@leftpagetrue
+ \setcounter{page}{0}
+ \xput@emptypage
+ \global\xput@rightpagetrue
+ \global\xput@leftpagefalse
+ \global\xput@haslastemptypagetrue
+ \else
+ \xput@haspagestrue
+ \global\xput@rightpagetrue
+ \fi
+ \else
+ \xput@haspagestrue
+ \global\xput@rightpagetrue
+ \fi
+ \else
+ \xput@haspagestrue
+ \global\xput@rightpagetrue
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput@setupcover{
+ \xput@isinitgridfalse
+ \xput@pagewidth=\ifdim\coverwidth=\xput@undefdim\pagewidth\else\coverwidth\fi
+ \xput@pageheight=\ifdim\coverheight=\xput@undefdim\pageheight\else\coverheight\fi
+ \xput@outerbleed=\ifdim\coverouterbleed=\xput@undefdim\ifdim\coverbleed=\xput@undefdim\ifdim\outerbleed=\xput@undefdim\bleed\else\outerbleed\fi\else\coverbleed\fi\else\coverouterbleed\fi
+ \xput@innerbleed=\ifdim\coverinnerbleed=\xput@undefdim\ifdim\coverbleed=\xput@undefdim\ifdim\innerbleed=\xput@undefdim\bleed\else\innerbleed\fi\else\coverbleed\fi\else\coverinnerbleed\fi
+ \xput@topbleed=\ifdim\covertopbleed=\xput@undefdim\ifdim\coverbleed=\xput@undefdim\ifdim\topbleed=\xput@undefdim\bleed\else\topbleed\fi\else\coverbleed\fi\else\covertopbleed\fi
+ \xput@bottombleed=\ifdim\coverbottombleed=\xput@undefdim\ifdim\coverbleed=\xput@undefdim\ifdim\bottombleed=\xput@undefdim\bleed\else\bottombleed\fi\else\coverbleed\fi\else\coverbottombleed\fi
+ \xput@outersafetymargin=\ifdim\coveroutersafetymargin=\xput@undefdim\ifdim\coversafetymargin=\xput@undefdim\ifdim\outersafetymargin=\xput@undefdim\safetymargin\else\outersafetymargin\fi\else\coversafetymargin\fi\else\coveroutersafetymargin\fi
+ \xput@innersafetymargin=\ifdim\coverinnersafetymargin=\xput@undefdim\ifdim\coversafetymargin=\xput@undefdim\ifdim\innersafetymargin=\xput@undefdim\safetymargin\else\innersafetymargin\fi\else\coversafetymargin\fi\else\coverinnersafetymargin\fi
+ \xput@topsafetymargin=\ifdim\covertopsafetymargin=\xput@undefdim\ifdim\coversafetymargin=\xput@undefdim\ifdim\topsafetymargin=\xput@undefdim\safetymargin\else\topsafetymargin\fi\else\coversafetymargin\fi\else\covertopsafetymargin\fi
+ \xput@bottomsafetymargin=\ifdim\coverbottomsafetymargin=\xput@undefdim\ifdim\coversafetymargin=\xput@undefdim\ifdim\bottomsafetymargin=\xput@undefdim\safetymargin\else\bottomsafetymargin\fi\else\coversafetymargin\fi\else\coverbottomsafetymargin\fi
+}
+\newif\ifxput@pageoptiondouble
+\newif\ifxput@pageoptionfrontcover
+\newif\ifxput@pageoptionbackcover
+\newdimen\xput@backcovergutter
+\newdimen\xput@backcovermargin
+\newdimen\xput@backcovertopmargin
+\newdimen\xput@backcoverbottommargin
+\newdimen\xput@backcoverinnermargin
+\newdimen\xput@backcoveroutermargin
+\pgfkeys{
+ /pagetype/.is family,
+ /pagetype,
+ double/.is if=xput@pageoptiondouble,
+ front cover/.is if=xput@pageoptionfrontcover,
+ back cover/.is if=xput@pageoptionbackcover,
+ .unknown/.code=
+}
+\pgfkeys{
+ /page/.is family,
+ /page,
+ gutter/.store in=\xput@pageoptiongutter,
+ gutter=\gutter,
+ margin/.store in=\xput@pageoptionmargin,
+ margin=\margin,
+ top margin/.store in=\xput@pageoptiontopmargin,
+ top margin=\topmargin,
+ bottom margin/.store in=\xput@pageoptionbottommargin,
+ bottom margin=\bottommargin,
+ inner margin/.store in=\xput@pageoptioninnermargin,
+ inner margin=\innermargin,
+ outer margin/.store in=\xput@pageoptionoutermargin,
+ outer margin=\outermargin,
+ vpos/.code={\xput@gridvalign{#1}},
+ hpos/.code={\xput@gridhalign{#1}},
+ color/.store in=\xput@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@backcoveroptiongutter,
+ gutter=\gutter,
+ margin/.store in=\xput@backcoveroptionmargin,
+ margin=\margin,
+ top margin/.store in=\xput@backcoveroptiontopmargin,
+ top margin=\topmargin,
+ bottom margin/.store in=\xput@backcoveroptionbottommargin,
+ bottom margin=\bottommargin,
+ inner margin/.store in=\xput@backcoveroptioninnermargin,
+ inner margin=\innermargin,
+ outer margin/.store in=\xput@backcoveroptionoutermargin,
+ outer margin=\outermargin,
+ vpos/.store in=\xput@backcoveroptionvpos,
+ vpos=0.5,
+ hpos/.store in=\xput@backcoveroptionhpos,
+ hpos=0.5,
+ color/.store in=\xput@backcoveroptioncolor,
+ color=,
+ page color/.store in=\xput@backcoveroptionpagecolor,
+ page color=,
+ page graphic/.store in=\xput@backcoveroptionpagegraphic,
+ page graphic=,
+ before page/.code={},
+ double/.code={},
+ front cover/.code={},
+ back cover/.code={},
+}
+\newcommand\xput@applypageoptions[1]{
+ \pgfkeys{/page,#1}
+ \gutter=\xput@pageoptiongutter
+ \margin=\xput@pageoptionmargin
+ \topmargin=\xput@pageoptiontopmargin
+ \bottommargin=\xput@pageoptionbottommargin
+ \innermargin=\xput@pageoptioninnermargin
+ \outermargin=\xput@pageoptionoutermargin
+
+ \xput@beforepage
+}
+\newcommand\xput@applybackcoveroptions{
+ \xput@gridvalign{\xput@backcoveroptionvpos}
+ \xput@gridhalign{\xput@backcoveroptionhpos}
+
+ \ifx\xput@backcoveroptionpagecolor\xput@emptystring
+ \def\xput@pagecolor{}
+ \else
+ \setpagecolor{\xput@backcoveroptionpagecolor}
+ \fi
+ \ifx\xput@backcoveroptionpagegraphic\xput@emptystring
+ \def\xput@pagegraphic{}
+ \else
+ \def\xput@pagegraphic{\xput@backcoveroptionpagegraphicfile}
+ \def\xput@pagegraphicoptionscale{\xput@backcoveroptionpagegraphicscale}
+ \def\xput@pagegraphicoptionvpos{\xput@backcoveroptionpagegraphicvpos}
+ \def\xput@pagegraphicoptionhpos{\xput@backcoveroptionpagegraphichpos}
+ \def\xput@pagegraphicoptionunsharp{\xput@backcoveroptionpagegraphicunsharp}
+ \fi
+ \ifx\xput@backcoveroptioncolor\xput@emptystring
+ \def\xput@pageoptioncolor{\xput@backcovercolor}
+ \else
+ \def\xput@pageoptioncolor{\xput@backcoveroptioncolor}
+ \fi
+ \setborder[radius=\xput@backcoveroptionborderradius,width=\xput@backcoveroptionborderwidth,opacity=\xput@backcoveroptionborderopacity,color=\xput@backcoveroptionbordercolor]{}
+ \setshadow[size=\xput@backcoveroptionshadowsize,opacity=\xput@backcoveroptionshadowopacity,color=\xput@backcoveroptionshadowcolor,xshift=\xput@backcoveroptionshadowxshift,yshift=\xput@backcoveroptionshadowyshift]{}
+ \gutter=\xput@backcovergutter
+ \margin=\xput@backcovermargin
+ \topmargin=\xput@backcovertopmargin
+ \bottommargin=\xput@backcoverbottommargin
+ \innermargin=\xput@backcoverinnermargin
+ \outermargin=\xput@backcoveroutermargin
+
+ \ifdefined\xput@backcovergrid
+ \xput@backcovergrid
+ \fi
+
+ \xput@beforepage
+}
+\newcommand\page[2][]{
+ \xput@pageoptiondoublefalse
+ \xput@pageoptionfrontcoverfalse
+ \xput@pageoptionbackcoverfalse
+ \pgfkeys{/pagetype,#1}
+ \ifxput@pageoptiondouble
+ \xput@doublepage[#1]{#2}
+ \else
+ \ifxput@pageoptionfrontcover
+ \xput@frontcover[#1]{#2}
+ \else
+ \ifxput@pageoptionbackcover
+ \xput@backcover[#1]{#2}
+ \else
+ \xput@standardpage[#1]{#2}
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput@standardpage[2][]{
+ \global\xput@placeholdercounter=0\relax
+ \ifxput@backcover
+ \xput@setupcover
+ \else
+ \xput@setuppage
+ \fi
+ \xput@ispagetrue
+ \global\xput@topmargintmp=\topmargin\global\topmargin=\xput@undefdim
+ \xput@setdimensions
+ \ifxput@fanfold
+ \ifxput@leftpage
+ \global\xput@isfanfoldopentrue
+ \begin{picture}(\xput@dimentonumber\paperwidth,\xput@dimentonumber\paperheight)
+ \fi
+ \else
+ \begin{picture}(\xput@dimentonumber\paperwidth,\xput@dimentonumber\paperheight)
+ \fi
+ \topmargin=\xput@topmargintmp
+ \begingroup
+ \ifxput@fanfold
+ \ifxput@pagenumberinghaschanged
+ \global\xput@pagenumberinghaschangedfalse
+ \else
+ \ifxput@rightpage
+ \global\addtocounter{page}{1}
+ \fi
+ \fi
+ \fi
+ \ifxput@backcover
+ \xput@applybackcoveroptions
+ \else
+ \xput@applypageoptions{#1}
+ \fi
+ \xput@putbeforepage
+ #2
+ \xput@putbleed
+ \xput@putgrid
+ \xput@putcuttingmarks
+ \xput@putsafezone
+ \endgroup
+ \ifxput@fanfold
+ \ifxput@rightpage
+ \ifnum\xput@tocfixpageoffset=-1
+ \addtocounter{page}{-1}
+ \fi
+ \global\xput@isfanfoldopenfalse
+ \end{picture}
+ \ifnum\xput@tocfixpageoffset=-1
+ \addtocounter{page}{1}
+ \global\def\xput@tocfixpageoffset{0}
+ \fi
+ \fi
+ \else
+ \end{picture}
+ \fi
+ \global\topmargin=\xput@topmargintmp
+ \xput@ispagefalse
+}
+\newcommand\xput@doublepage[2][]{
+ \global\xput@placeholdercounter=0\relax
+ \ifxput@twoside
+ \ifxput@haspages
+ \ifxput@leftpage\page{}\fi
+ \else
+ \ifxput@beginleft
+ \ifxput@beginright
+ \page{}
+ \fi
+ \else
+ \page{}
+ \fi
+ \fi
+ \xput@ispagetrue
+ \global\xput@isdoublepagetrue
+ \xput@setuppage
+ \global\xput@topmargintmp=\topmargin\global\topmargin=\xput@undefdim
+ \xput@setdimensions
+ \begin{picture}(\xput@dimentonumber\paperwidth,\xput@dimentonumber\paperheight)
+ \topmargin=\xput@topmargintmp
+ \xput@applypageoptions{#1}
+ \xput@putbeforepage
+ #2
+ \xput@putbleed
+ \xput@putgrid
+ \xput@putcuttingmarks
+ \xput@putsafezone
+ \ifnum\xput@tocfixpageoffset=1
+ \addtocounter{page}{1}
+ \fi
+ \end{picture}
+
+ \xput@setuppage
+ \ifxput@fanfold
+ \ifnum\xput@tocfixpageoffset=1
+ \global\def\xput@tocfixpageoffset{0}
+ \else
+ \addtocounter{page}{1}
+ \fi
+ \else
+ \xput@setdimensions
+ \begin{picture}(\xput@dimentonumber\paperwidth,\xput@dimentonumber\paperheight)
+ \topmargin=\xput@topmargintmp
+ \xput@applypageoptions{#1}
+ \global\xput@placeholdercounter=0\relax
+ \xput@putbeforepage
+ #2
+ \xput@putbleed
+ \xput@putgrid
+ \xput@putcuttingmarks
+ \xput@putsafezone
+ \end{picture}
+ \fi
+ \global\xput@isdoublepagefalse
+ \global\topmargin=\xput@topmargintmp
+ \xput@ispagefalse
+ \else
+ \xput@standardpage[#1]{#2}
+ \fi
+}
+\newcommand\xput@backcover[2][]{
+ \ifxput@hascover
+ \xput@errmsg@backcoverdefinedafterfrontcover
+ \else
+ \ifdefined\xput@tmpgrid
+ \let\xput@backcovergrid\xput@tmpgrid
+ \fi
+ \edef\xput@backcovercolor{\xputoptions@color}
+ \pgfkeys{/backcover,#1}
+ \xput@backcovergutter=\xput@backcoveroptiongutter
+ \xput@backcovermargin=\xput@backcoveroptionmargin
+ \xput@backcovertopmargin=\xput@backcoveroptiontopmargin
+ \xput@backcoverbottommargin=\xput@backcoveroptionbottommargin
+ \xput@backcoverinnermargin=\xput@backcoveroptioninnermargin
+ \xput@backcoveroutermargin=\xput@backcoveroptionoutermargin
+ \ifx\xput@backcoveroptionpagecolor\xput@emptystring
+ \let\xput@backcoveroptionpagecolor\xput@pagecolor
+ \fi
+ \ifx\xput@backcoveroptionpagegraphic\xput@emptystring
+ \let\xput@backcoveroptionpagegraphic\xput@pagegraphic
+ \let\xput@backcoveroptionpagegraphicfile\xput@pagegraphic
+ \ifdefined\xput@pagegraphicoptionscale
+ \let\xput@backcoveroptionpagegraphicscale\xput@pagegraphicoptionscale
+ \fi
+ \ifdefined\xput@pagegraphicoptionhpos
+ \let\xput@backcoveroptionpagegraphichpos\xput@pagegraphicoptionhpos
+ \fi
+ \ifdefined\xput@pagegraphicoptionvpos
+ \let\xput@backcoveroptionpagegraphicvpos\xput@pagegraphicoptionvpos
+ \fi
+ \ifdefined\xput@pagegraphicoptionunsharp
+ \let\xput@backcoveroptionpagegraphicunsharp\xput@pagegraphicoptionunsharp
+ \fi
+ \else
+ \ifcsname xput@graphic@\xput@backcoveroptionpagegraphic\endcsname
+ \csname xput@graphic@\xput@backcoveroptionpagegraphic\endcsname[1]{}
+ \else
+ \def\xput@backcoveroptionpagegraphicfile{\xput@backcoveroptionpagegraphic}
+ \def\xput@backcoveroptionpagegraphicscale{1}
+ \def\xput@backcoveroptionpagegraphichpos{0.5}
+ \def\xput@backcoveroptionpagegraphicvpos{0.5}
+ \def\xput@backcoveroptionpagegraphicunsharp{\xput@unsharp}
+ \fi
+ \fi
+ \let\xput@backcoveroptionborderradius\xput@defaultborderradius
+ \let\xput@backcoveroptionborderopacity\xput@defaultborderopacity
+ \let\xput@backcoveroptionborderwidth\xput@defaultborderwidth
+ \let\xput@backcoveroptionbordercolor\xput@defaultbordercolor
+ \let\xput@backcoveroptionshadowopacity\xput@defaultshadowopacity
+ \let\xput@backcoveroptionshadowsize\xput@defaultshadowsize
+ \let\xput@backcoveroptionshadowcolor\xput@defaultshadowcolor
+ \let\xput@backcoveroptionshadowxshift\xput@defaultshadowxshift
+ \let\xput@backcoveroptionshadowyshift\xput@defaultshadowyshift
+
+ \ifdefined\xput@currentcontents
+ \let\xput@backcovercontent\xput@currentcontents
+ \def\xput@backcovertemplate{#2}
+ \else
+ \def\xput@backcovercontent{#2}
+ \fi
+ \fi
+}
+\newcommand\xput@frontcover[2][]{
+ \xput@ispagetrue
+ \xput@hascovertrue
+ \xput@setupcover
+ \setcounter{page}{0}
+ \global\xput@topmargintmp=\topmargin\global\topmargin=\xput@undefdim
+ \ifxput@cover
+ \global\xput@frontcovertrue
+ \xput@setdimensions
+ \begin{picture}(\xput@dimentonumber\paperwidth,\xput@dimentonumber\paperheight)
+ \topmargin=\xput@topmargintmp
+ \global\xput@backcovertrue
+ \def\xput@currentbeforepage{}
+ \begingroup
+ \ifdefined\xput@backcovercontent
+ \xput@applybackcoveroptions
+ \xput@putbeforepage
+ \ifdefined\xput@backcovertemplate
+ \xput@placeholdercounter 0\relax%
+ \let\xput@currentcontents\xput@backcovercontent%
+ \xput@backcovertemplate%
+ \else
+ \xput@backcovercontent
+ \fi
+ \fi
+ \xput@putbleed
+ \xput@putgrid
+ \xput@putcuttingmarks
+ \xput@putsafezone
+ \endgroup
+ \global\xput@backcoverfalse
+ \xput@resetautogrid
+ \xput@gridoffsetx=\dimexpr(\xput@pagewidth + \xput@outerbleed - \xput@innerbleed + \spinewidth)\relax
+ \xput@applypageoptions{#1}
+ \global\xput@placeholdercounter=0\relax
+ \xput@putbeforepage
+ #2
+ \xput@putbleed
+ \xput@putgrid
+ \xput@putcuttingmarks
+ \xput@putsafezone
+ \end{picture}
+ \global\xput@frontcoverfalse
+ \let\xput@backcovercontent\undefined
+ \else
+ \xput@setdimensions
+ \begin{picture}(\xput@dimentonumber\paperwidth,\xput@dimentonumber\paperheight)
+ \topmargin=\xput@topmargintmp
+ \xput@applypageoptions{#1}
+ \def\xput@currentbeforepage{}
+ \xput@putbeforepage
+ #2
+ \xput@putbleed
+ \xput@putgrid
+ \xput@putcuttingmarks
+ \xput@putsafezone
+ \end{picture}
+ \fi
+ \global\topmargin=\xput@topmargintmp
+ \xput@ispagefalse
+}
+\newcommand\leftpage[1]{
+ \ifxput@leftpage
+ \xput@renderleftpage{#1}
+ \else
+ \ifxput@fanfold
+ \ifxput@isdoublepage
+ \xput@renderleftpage{#1}
+ \fi
+ \else
+ \ifxput@isdoublepage
+ \xput@renderleftpage[1]{#1}
+ \fi
+ \fi
+ \fi
+}
+\newcommand\rightpage[1]{
+ \ifxput@rightpage
+ \xput@renderrightpage{#1}
+ \else
+ \ifxput@fanfold
+ \ifxput@isdoublepage
+ \xput@renderrightpage{#1}
+ \fi
+ \else
+ \ifxput@isdoublepage
+ \xput@renderrightpage[1]{#1}
+ \fi
+ \fi
+ \fi
+}
+\newcommand\xput@renderleftpage[2][0]{
+ \begingroup
+ \xput@isdoublepagefalse
+ \xput@setdimensions
+ \xput@closerows
+ \ifnum#1=1
+ \xput@drymodetrue
+ \fi
+ #2
+ \ifnum#1=1
+ \xput@drymodefalse
+ \else
+ \ifxput@isbeforepage
+ \else
+ \xput@putgrid
+ \fi
+ \fi
+ \endgroup
+}
+\newif\ifxput@wasdoublepage
+\newif\ifxput@renderrightpage
+\newcommand\xput@renderrightpage[2][0]{
+ \xput@renderrightpagetrue
+ \begingroup
+ \ifxput@fanfold
+ \ifxput@isdoublepage
+ \xput@wasdoublepagetrue
+ \addtocounter{page}{1}
+ \fi
+ \fi
+ \xput@isdoublepagefalse
+ \xput@rightpagetrue
+ \xput@leftpagefalse
+ \xput@setdimensions
+ \xput@closerows
+ \ifnum#1=1
+ \xput@drymodetrue
+ \fi
+ #2
+ \ifnum#1=1
+ \xput@drymodefalse
+ \else
+ \ifxput@isbeforepage
+ \else
+ \xput@putgrid
+ \fi
+ \fi
+ \ifxput@fanfold
+ \ifxput@wasdoublepage
+ \xput@wasdoublepagefalse
+ \addtocounter{page}{-1}
+ \fi
+ \fi
+ \endgroup
+ \xput@renderrightpagefalse
+}
+
+% templates
+\newif\ifxput@drymode
+\newif\ifxput@placeholderoptions
+\newif\ifxput@placeholdermode
+\newif\ifxput@isplace
+\xput@placeholderoptionstrue
+\newcount\xput@placeholdercounter
+\newcount\xput@contentcounter
+\newdimen\xput@placeholderfontsize
+\def\xput@frameyymax{0}
+\def\xput@framexxmax{0}
+\def\xput@setgridframe#1 #2 #3 #4 \\{
+ \def\xput@framey{#1}
+ \def\xput@framex{#2}
+ \def\xput@frameyy{#3}
+ \def\xput@framexx{#4}
+}
+\def\xput@setdefaultgridframe#1 #2 #3 #4 \\{
+ \def\xput@defaultframey{#1}
+ \def\xput@defaultframex{#2}
+ \def\xput@defaultframeyy{#3}
+ \def\xput@defaultframexx{#4}
+ \xput@setgridframe #1 #2 #3 #4 \\
+}
+\def\xput@resetgridframe{
+ \global\xput@isplacefalse
+ \pgfmathceil{\xput@frameyy}
+ \pgfmathint{\pgfmathresult}
+ \global\edef\xput@currentrow{\pgfmathresult}
+ \ifnum\xput@currentrow>\xput@frameyymax
+ \global\edef\xput@frameyymax{\xput@currentrow}
+ \global\def\xput@framexxmax{0}
+ \fi
+ \pgfmathceil{\xput@framexx}
+ \pgfmathint{\pgfmathresult}
+ \global\edef\xput@currentcell{\pgfmathresult}
+ \ifnum\xput@currentcell>\xput@framexxmax
+ \global\edef\xput@framexxmax{\xput@currentcell}
+ \fi
+
+ \pgfmathqparse{\xput@get{\xput@frameyymax C}pt>\xput@framexxmax pt}
+ \ifnum\pgfmathresult=1
+ \global\edef\xput@framey{\the\numexpr\xput@frameyymax-1\relax}
+ \global\edef\xput@framex{\xput@framexxmax}
+ \global\edef\xput@frameyy{\xput@frameyymax}
+ \global\edef\xput@framexx{\the\numexpr\xput@framexxmax+1\relax}
+ \else
+ \ifnum\xput@frameyymax=\xput@rowscount
+ \global\xput@gridfulltrue
+ \else
+ \global\edef\xput@framey{\xput@frameyymax}
+ \global\edef\xput@framex{0}
+ \global\edef\xput@frameyy{\the\numexpr\xput@frameyymax+1\relax}
+ \global\edef\xput@framexx{1}
+ \fi
+ \fi
+}
+\newcommand\placeholder[2][0]{
+ \begingroup
+ \ifx#2\xput@emptystring
+ \else
+ \global\xput@isplacetrue
+ \fi
+ \def\xput@currentplaceholder{}
+ \ifnum#1=0
+ \global\advance \xput@placeholdercounter by 1
+ \else
+ \global\xput@placeholdercounter=#1
+ \fi
+ \xput@contentcounter 0\relax
+ \def\xput@tmp{\xput@currentcontents}
+ \xput@placeholdermode{1}
+ \xput@tmp
+ \xput@placeholdermode{0}
+ \xput@putcontent{
+ \ifx\xput@emptystring\xput@currentplaceholder
+ \ifxput@placeholder
+ \ifx#2\xput@emptystring
+ \else
+ \xput@setgridframe #2 \\
+ \fi
+ \xput@textboxheight=\dimexpr(\posy{1}{\xput@framey} - \posy{-1}{\xput@frameyy})\relax
+ \xput@textboxwidth=\dimexpr(\posx{-1}{\xput@frameyy}{-1}{\xput@framexx} - \posx{1}{\xput@framey}{1}{\xput@framex})\relax
+ \ifdim\xput@textboxwidth>\xput@textboxheight
+ \xput@placeholderfontsize=0.5\xput@textboxheight
+ \else
+ \xput@placeholderfontsize=0.5\xput@textboxwidth
+ \fi
+ \ifdim\xput@placeholderfontsize>1000pt
+ \xput@placeholderfontsize=1000pt
+ \fi
+ \xput@putxput{\xput@framey}{\xput@framex}{\xput@frameyy}{\xput@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@placeholderfontsize>5mm
+ \node[opacity=0.3] at (0.5\width,0.5\height){
+ \fontsize{\xput@placeholderfontsize}{0pt}\selectfont\textcolor{cyan!60}{\textbf{\the\xput@placeholdercounter}}
+ };
+ \fi
+ \end{tikzpicture}%
+ }
+ \xput@resetgridframe
+ \else
+ \ifx\xput@currentplaceholdertype\xput@placeholdertypeusetext
+ \ifx#2\xput@emptystring
+ \else
+ \xput@setgridframe #2 \\
+ \fi
+ \ifx\xput@currentplaceholderoptions\xput@emptystring
+ \xput@placeholderoptionsfalse
+ \csname \xput@currentplaceholdertype\endcsname
+ \xput@placeholderoptionstrue
+ \else
+ \csname \xput@currentplaceholdertype\endcsname[\xput@currentplaceholderoptions]
+ \fi
+ \fi
+ \fi
+ \else
+ \ifx#2\xput@emptystring
+ \else
+ \xput@setgridframe #2 \\
+ \fi
+ \ifx\xput@currentplaceholderoptions\xput@emptystring
+ \xput@placeholderoptionsfalse
+ \csname \xput@currentplaceholdertype\endcsname{\xput@currentplaceholder}
+ \xput@placeholderoptionstrue
+ \else
+ \csname \xput@currentplaceholdertype\endcsname[\xput@currentplaceholderoptions]{\xput@currentplaceholder}
+ \fi
+ \fi
+ }
+ \endgroup
+}
+\newcommand\xput@graphic[2][]{
+ \advance \xput@contentcounter by 1
+ \ifnum\xput@contentcounter=\xput@placeholdercounter
+ \def\xput@currentplaceholdertype{graphic}
+ \def\xput@currentplaceholderoptions{}
+ \pgfkeys{graphic,file={#2},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput@unsharp,#1}
+ \ifcsname xput@graphic@#2\endcsname%
+ \csname xput@graphic@#2\endcsname[2]{#1}%
+ \fi
+
+ \edef\xput@currentplaceholder{\xput@graphicoptionfile}
+ \fi
+}
+\newcommand\xput@xput[1]{
+ \advance \xput@contentcounter by 1
+ \ifnum\xput@contentcounter=\xput@placeholdercounter
+ \def\xput@currentplaceholdertype{xput}
+ \def\xput@currentplaceholderoptions{}
+ \def\xput@currentplaceholder{#1}
+ \fi
+}
+\newcommand\xput@tikz[1]{
+ \advance \xput@contentcounter by 1
+ \ifnum\xput@contentcounter=\xput@placeholdercounter
+ \def\xput@currentplaceholdertype{tikzgraphic}
+ \def\xput@currentplaceholderoptions{}
+ \def\xput@currentplaceholder{#1}
+ \fi
+}
+\newcommand\xput@text[2][]{
+ \advance \xput@contentcounter by 1
+ \ifnum\xput@contentcounter=\xput@placeholdercounter
+ \def\xput@currentplaceholdertype{text}
+ \def\xput@currentplaceholderoptions{}
+ \edef\xput@currentborderradius{\xput@defaultborderradius}
+ \edef\xput@currentborderwidth{\xput@defaultborderwidth}
+ \edef\xput@currentbordercolor{\xput@defaultbordercolor}
+ \edef\xput@currentborderopacity{\xput@defaultborderopacity}
+ \pgfkeys{text,name=default,color=\ifx\xput@pageoptioncolor\xput@emptystring\xputoptions@color\else\xput@pageoptioncolor\fi,border radius=\xput@currentborderradius,border width=\xput@currentborderwidth,border color=\xput@currentbordercolor,border opacity=\xput@currentborderopacity,#1}
+ \def\xput@currentplaceholder{#2}
+ \fi
+}
+\def\xput@placeholdertypeusetext{usetext}
+\newcommand\xput@usetext[1][default]{
+ \advance \xput@contentcounter by 1
+ \ifnum\xput@contentcounter=\xput@placeholdercounter
+ \edef\xput@currentplaceholdertype{\xput@placeholdertypeusetext}
+ \def\xput@currentplaceholderoptions{#1}
+ \def\xput@currentplaceholder{}
+ \fi
+}
+\newcommand\xput@rendertemplate[3]{
+ \xput@placeholdercounter 0\relax%
+ \global\def\xput@currentcontents{#2}%
+ \page[#1]{%
+ #3
+ }%
+}
+\newcommand{\newtemplate}[3][]{
+ \expandafter\newcommand\csname xput@template@#2\endcsname[2][]{%
+ \xput@rendertemplate{#1,##1}{##2}{#3}
+ }%
+}
+\newcommand\template[3][]{
+ \ifcsname xput@template@#2\endcsname%
+ \else%
+ \newtemplate[]{#2}{
+ \xput@gridsc{#2}
+ }
+ \fi
+ \csname xput@template@#2\endcsname[#1]{
+ #3
+ }
+}
+\newcommand\graphic{}
+\newcommand\xput{}
+\newcommand\tikzgraphic{}
+\newcommand\usetext{}
+\newcommand\text{}
+\newcommand\xput@putcontent[1]{
+ \ifxput@drymode
+ \else
+ \begingroup
+ \ifxput@gridfull
+ \ifxput@isplace#1\fi
+ \else
+ #1
+ \fi
+ \endgroup
+ \fi
+}
+\newcommand\xput@placeholdermode[1]{
+ \xput@placeholdermodefalse
+ \ifnum#1=0%
+ \renewcommand\graphic[2][]{%
+ \xput@putcontent{%
+ \def\xput@graphicoptionfile{##2}
+ \ifxput@placeholderoptions
+ \ifcsname xput@graphic@##2\endcsname%
+ \csname xput@graphic@##2\endcsname[2]{##1}
+ \else
+ \pgfkeys{graphic,file={##2},scale=1,vpos=0.5,hpos=0.5,unsharp=\xput@unsharp,##1}
+ \fi
+ \fi
+ \xput@putgraphic{\xput@framey}{\xput@framex}{\xput@frameyy}{\xput@framexx}{\xput@graphicoptionfile}%
+ \xput@resetgridframe
+ }
+ }%
+ \renewcommand\xput[1]{%
+ \xput@putcontent{%
+ \xput@putxput{\xput@framey}{\xput@framex}{\xput@frameyy}{\xput@framexx}{##1}%
+ \xput@resetgridframe
+ }
+ }%
+ \renewcommand\tikzgraphic[1]{%
+ \xput@putcontent{%
+ \xput@puttikz{\xput@framey}{\xput@framex}{\xput@frameyy}{\xput@framexx}{##1}%
+ \xput@resetgridframe
+ }
+ }%
+ \renewcommand\usetext[1][default]{%
+ \xput@putcontent{%
+ \xput@putusetext[##1]{\xput@framey}{\xput@framex}{\xput@frameyy}{\xput@framexx}%
+ \xput@resetgridframe
+ }
+ }%
+ \renewcommand\text[2][]{%
+ \xput@putcontent{%
+ \edef\xput@currentborderradius{\xput@defaultborderradius}
+ \edef\xput@currentborderwidth{\xput@defaultborderwidth}
+ \edef\xput@currentbordercolor{\xput@defaultbordercolor}
+ \edef\xput@currentborderopacity{\xput@defaultborderopacity}
+ \pgfkeys{text,name=default,color=\ifx\xput@pageoptioncolor\xput@emptystring\xputoptions@color\else\xput@pageoptioncolor\fi,border radius=\xput@currentborderradius,border width=\xput@currentborderwidth,border color=\xput@currentbordercolor,border opacity=\xput@currentborderopacity,##1}
+ \xput@puttext{\xput@framey}{\xput@framex}{\xput@frameyy}{\xput@framexx}{##2}%
+ \xput@resetgridframe
+ }
+ }%
+ \else%
+ \xput@placeholdermodetrue
+ \renewcommand\graphic[2][]{%
+ \xput@graphic[##1]{##2}%
+ }%
+ \renewcommand\xput[1]{%
+ \xput@xput{##1}%
+ }%
+ \renewcommand\tikzgraphic[1]{%
+ \xput@tikz{##1}%
+ }%
+ \renewcommand\usetext[1][default]{%
+ \xput@usetext[##1]%
+ }
+ \renewcommand\text[2][]{%
+ \xput@text[##1]{##2}%
+ }
+ \fi%
+}
+\xput@placeholdermode{0}
+\newcommand\place[1]{
+ \xput@isplacetrue
+ \xput@setgridframe #1 \\
+}
+\xput@setdefaultgridframe 0 0 1 1 \\
+
+\newcommand\xput@emptypage{
+ \global\xput@isemptypagetrue
+ \page[before page=,page graphic=,page color=]{}
+ \global\xput@isemptypagefalse
+}
+
+\def\xput@tocfixpageoffset{0}
+\def\sectioncalled{
+ \ifxput@fanfold
+ \ifxput@isdoublepage
+ \ifxput@rightpage
+ \global\def\xput@tocfixpageoffset{1}
+ \fi
+ \else
+ \ifxput@renderrightpage
+ \global\def\xput@tocfixpageoffset{1}
+ \else
+ \ifxput@leftpage
+ \global\def\xput@tocfixpageoffset{-1}
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+\def\xput@turbojobname{xputturbobatchoptimizexyz}
+\edef\xput@turbojobname{\meaning\xput@turbojobname}
+\edef\xput@jobname{\jobname}
+\edef\xput@jobname{\meaning\xput@jobname}
+\AtBeginDocument{
+ % fanfold toc partial fix
+ \let\xput@originalsection\section
+ \def\xput@nextsection#1{
+ \sectioncalled
+ \@ifnextchar\bgroup{\xput@originalsection*}{\xput@originalsection{#1}}}
+ \let\section\xput@nextsection
+ \let\xput@originalsubsection\subsection
+ \def\xput@nextsubsection#1{
+ \sectioncalled
+ \@ifnextchar\bgroup{\xput@originalsubsection*}{\xput@originalsubsection{#1}}}
+ \let\subsection\xput@nextsubsection
+
+ \ifxput@optimize
+ \else
+ \xput@isturbomodefalse
+ \fi
+
+ \ifxput@isturbomode
+ \ifx\xput@jobname\xput@turbojobname
+ \xput@placeholderfalse
+ \xput@gridfalse
+ \xput@safezonefalse
+ \xput@cuttingmarksfalse
+ \xput@fillpagesfalse
+ \xput@graphpaperfalse
+ \xput@preflightfalse
+
+ \xput@isbatchmodetrue
+ \else
+ \xput@start
+ \fi
+ \else
+ \ifxput@import
+ \xput@start
+ \fi
+ \fi
+
+ \ifx\xput@pagegraphic\xput@emptystring
+ \ifx\xputoptions@pagegraphic\xput@emptystring
+ \else
+ \setpagegraphic{\xputoptions@pagegraphic}
+ \fi
+ \fi
+
+ \ifxput@fanfold
+ \xput@covertrue
+ \fi
+}
+\AtEndDocument{
+ \ifxput@beginleft
+ \ifxput@leftpage
+ \xput@hasoddnumberofpagestrue
+ \fi
+ \else
+ \ifxput@rightpage
+ \xput@hasoddnumberofpagestrue
+ \fi
+ \fi
+ \ifdefined\xput@backcovercontent
+ \xput@haspagestrue
+ \ifxput@haslastemptypage
+ \ifxput@hasoddnumberofpages
+ \xput@standardpage[before page=]{}
+ \xput@emptypage
+ \else
+ \xput@emptypage
+ \fi
+ \else
+ \ifxput@twoside
+ \ifxput@hasoddnumberofpages\page[before page=]{}\fi
+ \fi
+ \fi
+ \xput@leftpagetrue
+ \xput@rightpagefalse
+ \xput@backcovertrue
+ \ifdefined\xput@backcovertemplate
+ \xput@placeholdercounter 0\relax%
+ \let\xput@currentcontents\xput@backcovercontent%
+ \def\xput@currentbeforepage{}
+ \xput@standardpage{%
+ \xput@backcovertemplate%
+ }%
+ \else
+ \def\xput@currentbeforepage{}
+ \xput@standardpage{
+ \xput@backcovercontent
+ }
+ \fi
+ \else
+ \ifxput@haspages
+ \ifxput@fanfold
+ \ifxput@isfanfoldopen
+ \ifxput@beginleft
+ \xput@standardpage[before page=]{}
+ \else
+ \xput@emptypage
+ \fi
+ \else
+ \ifxput@beginleft
+ \else
+ \xput@standardpage[before page=]{}
+ \xput@emptypage
+ \fi
+ \fi
+ \else
+ \ifxput@haslastemptypage
+ \ifxput@hasoddnumberofpages
+ \xput@standardpage[before page=]{}
+ \xput@emptypage
+ \else
+ \xput@emptypage
+ \fi
+ \else
+ \ifxput@twoside
+ \ifxput@hasoddnumberofpages\xput@standardpage[before page=]{}\fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \ifxput@isbatchmode
+ \xput@batchoptimize
+ \fi
+}
+
+% scripts
+\newread\xput@scriptresult
+\def\xput@batchlist{}
+\def\xput@ok{ok}
+\def\xput@err@shellaccessforbidden{errorshellaccessforbidden}
+\def\xput@err@importdirnotfound{errorimportdirnotfound}
+\def\xput@err@noimportdir{errornoimportdir}
+\def\xput@err@magicknotinstalled{errormagicknotinstalled}
+\def\xput@err@inkscapenotinstalled{errorinkscapenotinstalled}
+\def\preventunrestrictedshellexecution{";-)" \%}
+\newcommand\xput@getppi[1]{
+ \immediate\openin\xput@scriptresult={|xputserver \preventunrestrictedshellexecution getwidth\% "#1"}
+ \ifeof\xput@scriptresult
+ \xput@errmsg@shellaccessforbidden{Ppi not calculated}
+ \else
+ \endlinechar=-1
+ \read\xput@scriptresult to \xput@graphicwidth
+ \endlinechar=13
+ \ifx\xput@graphicwidth\xput@emptystring
+ \xput@errmsg@shellaccessfailed{Ppi not calculated}
+ \else
+ \ifx\xput@graphicwidth\xput@err@magicknotinstalled
+ \xput@errmsg@magicknotinstalled{Ppi not calculated}
+ \else
+ \pgfmathqparse{(\xput@originalgraphicwidth - \xput@cropleft - \xput@cropright) / \xput@originalgraphicwidth * \xput@graphicwidth pt / \the\width * 72.27pt}
+
+ \pgfmathint{\pgfmathresult}
+ \edef\xput@graphicdensity{\pgfmathresult}
+ \fi
+ \fi
+ \fi
+ \immediate\closein\xput@scriptresult
+}
+\newcommand\xput@optimizegraphic[2]{
+ \immediate\openin\xput@scriptresult={|xputserver \preventunrestrictedshellexecution optimize\% "#1#2" \% "\xput@filename" \%\xput@optimizedext\%\the\numexpr\xput@originalgraphicwidth\%\the\numexpr\xput@originalgraphicheight\%\the\numexpr\xput@cropleft\%\the\numexpr\xput@cropright\%\the\numexpr\xput@croptop\%\the\numexpr\xput@cropbottom\%\the\numexpr\xput@density\%\the\numexpr\width\%\the\numexpr\height\%\xput@downsamplethreshold\%\xput@graphicoptionunsharp\%\xput@quality}
+ \ifeof\xput@scriptresult
+ \xput@errmsg@shellaccessforbidden{File not optimized}
+ \else
+ \endlinechar=-1
+ \read\xput@scriptresult to \xput@processresult
+ \endlinechar=13
+ \ifx\xput@processresult\xput@emptystring
+ \xput@errmsg@shellaccessfailed{File not optimized}
+ \else
+ \ifx\xput@processresult\xput@err@magicknotinstalled
+ \xput@errmsg@magicknotinstalled{File not optimized}
+ \fi
+ \fi
+ \fi
+ \immediate\closein\xput@scriptresult
+}
+\newcommand\xput@makeshadow[1]{
+ \immediate\openin\xput@scriptresult={|xputserver \preventunrestrictedshellexecution makeshadow\%#1\%\xput@defaultshadowsize\%\xput@defaultshadowopacity\%\xput@defaultshadowcolor\%\the\xput@frameshadowwidth\%\the\xput@frameshadowheight\%\the\xput@frameshadowframewidth\%\the\xput@frameshadowframeheight\%\the\xput@frameshadowborder\%\the\xput@frameshadowradius}
+ \ifeof\xput@scriptresult
+ \edef\xput@processresult{\xput@err@shellaccessforbidden}
+ \xput@errmsg@shellaccessforbidden{Shadow not created}
+ \else
+ \endlinechar=-1
+ \read\xput@scriptresult to \xput@processresult
+ \endlinechar=13
+ \ifx\xput@processresult\xput@emptystring
+ \xput@errmsg@shellaccessfailed{Shadow not created}
+ \else
+ \ifx\xput@processresult\xput@err@inkscapenotinstalled
+ \xput@errmsg@inkscapenotinstalled{Shadow not created}
+ \else
+ \fi
+ \fi
+ \fi
+ \immediate\closein\xput@scriptresult
+}
+\def\xput@start{
+ \immediate\openin\xput@scriptresult={|xputserver \preventunrestrictedshellexecution start\ifxput@import\%import\% "\ifdefined\Ginput@path\Ginput@path\fi" \fi\ifxput@isturbomode\%turbo\% "\jobname" \fi}
+ \ifeof\xput@scriptresult
+ \ifxput@import
+ \xput@errmsg@shellaccessforbidden{Import not working}
+ \fi
+ \else
+ \endlinechar=-1
+ \read\xput@scriptresult to \xput@processresult
+ \endlinechar=13
+ \ifx\xput@processresult\xput@emptystring
+ \ifxput@import
+ \xput@errmsg@shellaccessfailed{Import not working}
+ \fi
+ \else
+ \ifx\xput@processresult\xput@ok
+ \else
+ \ifx\xput@processresult\xput@err@noimportdir
+ \xput@errmsg@noimportdir
+ \else
+ \xput@errmsg@importdirnotfound{\xput@processresult}
+ \fi
+ \fi
+ \fi
+ \fi
+ \immediate\closein\xput@scriptresult
+}
+\newcommand\xput@addtobatchlist[2]{
+ \global\edef\xput@batchlist{\xput@batchlist\% "#1#2" \% "\xput@filename" \%\xput@optimizedext\%\the\numexpr\xput@originalgraphicwidth\%\the\numexpr\xput@originalgraphicheight\%\the\numexpr\xput@cropleft\%\the\numexpr\xput@cropright\%\the\numexpr\xput@croptop\%\the\numexpr\xput@cropbottom\%\the\numexpr\xput@density\%\the\numexpr\width\%\the\numexpr\height\%\xput@downsamplethreshold\%\xput@graphicoptionunsharp\%\xput@quality}
+}
+\newcommand\xput@batchoptimize{
+ \immediate\openin\xput@scriptresult={|xputserver \preventunrestrictedshellexecution batchoptimize\xput@batchlist}
+ \ifeof\xput@scriptresult
+ \else
+ \endlinechar=-1
+ \read\xput@scriptresult to \xput@processresult
+ \endlinechar=13
+ \fi
+ \immediate\closein\xput@scriptresult
+}
+
+% errors
+\def\xput@errmsg@undefined#1#2{
+ \ifx#2\xput@emptystring
+ \else
+ \ClassError{Xput}{Undefined #1 `#2'}{Check the name `#2'.\MessageBreak\MessageBreak\@ehc}
+ \fi
+}
+\def\xput@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@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@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@errmsg@inkscapenotinstalled#1{
+ \ClassError{Xput}{Inkscape not installed. #1}{Make sure Inkscape is installed.\MessageBreak\MessageBreak\@ehc}
+}
+\def\xput@errmsg@magicknotinstalled#1{
+ \ClassError{Xput}{ImageMagick not installed. #1}{Make sure ImageMagick is installed.\MessageBreak\MessageBreak\@ehc}
+}
+\def\xput@errmsg@importdirnotfound#1{
+ \ClassError{Xput}{Import directory `#1' not found}{Create the directory `#1'.\MessageBreak\MessageBreak\@ehc}
+}
+\def\xput@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@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
+}
diff --git a/macros/unicodetex/latex/bithesis/bithesis.dtx b/macros/unicodetex/latex/bithesis/bithesis.dtx
index 7669b65639..2bcc47bbbd 100644
--- a/macros/unicodetex/latex/bithesis/bithesis.dtx
+++ b/macros/unicodetex/latex/bithesis/bithesis.dtx
@@ -21,7 +21,7 @@
%<thesis>\ProvidesExplClass{bithesis}
%<report>\ProvidesExplClass{bitreport}
%<beamer>\ProvidesExplClass{bitbeamer}
-%<cls>{2022-12-02}{3.2.0}{BIT Thesis Templates}
+%<cls>{2022-12-17}{3.2.1}{BIT Thesis Templates}
%
%<oldcls>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
%<book>\ProvidesClass{bitbook}
@@ -30,7 +30,7 @@
%<oldcls> [2022/05/09 v2.1.1 BIT Thesis Templates]
%
%<*driver>
-\ProvidesFile{bithesis.dtx}[2022/12/02 3.2.0 BIT Thesis Templates]
+\ProvidesFile{bithesis.dtx}[2022/12/17 3.2.1 BIT Thesis Templates]
\documentclass[letterpaper]{l3doc}
\usepackage{dtx-style}
@@ -2229,7 +2229,7 @@
\RequirePackage{tikz}
\RequirePackage{etoolbox}
% Hide color and border in hyperref.
-\RequirePackage[hidelinks]{hyperref}
+\RequirePackage[hidelinks,bookmarksnumbered]{hyperref}
\RequirePackage{xcolor}
\RequirePackage{caption}
\RequirePackage{array}
@@ -3594,6 +3594,7 @@
\chapter{\c_@@_label_abstract_tl}
} {
\chapter*{\c_@@_label_abstract_tl}
+ \currentpdfbookmark{\c_@@_label_abstract_tl}{ch:abstract}
}
}
\vspace*{1mm}
@@ -3664,6 +3665,7 @@
\chapter{\c_@@_label_abstract_en_tl}
} {
\chapter*{\c_@@_label_abstract_en_tl}
+ \currentpdfbookmark{\c_@@_label_abstract_en_tl}{ch:abstract:en}
}
}
}
@@ -4034,7 +4036,7 @@
% \end{environment}
% \begin{environment}{symbols}
-% 生成主要术语对照包。
+% 生成主要术语对照表。
% \begin{macrocode}
\NewDocumentEnvironment {symbols} {}
{
@@ -4042,6 +4044,7 @@
\chapter{\c_@@_label_symbols_tl}
} {
\chapter*{\c_@@_label_symbols_tl}
+ \currentpdfbookmark{\c_@@_label_symbols_tl}{ch:symbols}
}
\zihao{-4}
\begin{itemize}[
diff --git a/macros/unicodetex/latex/bithesis/bithesis.pdf b/macros/unicodetex/latex/bithesis/bithesis.pdf
index 0636baeb21..a8113bf551 100644
--- a/macros/unicodetex/latex/bithesis/bithesis.pdf
+++ b/macros/unicodetex/latex/bithesis/bithesis.pdf
Binary files differ