summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bookcover
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-12-16 21:29:48 +0000
committerKarl Berry <karl@freefriends.org>2020-12-16 21:29:48 +0000
commit8bf408bb66dfe68280d0c320ac7a9f8e0fbe1396 (patch)
tree093f5143576d9d053cc1083f749d8d1adf87b28d /Master/texmf-dist/tex/latex/bookcover
parente047bbf1c29b1b63ce70098b2a9815a177af1f03 (diff)
bookcover (16dec20)
git-svn-id: svn://tug.org/texlive/trunk@57151 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bookcover')
-rw-r--r--Master/texmf-dist/tex/latex/bookcover/bookcover.cls94
1 files changed, 57 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/latex/bookcover/bookcover.cls b/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
index 61b1a8403f5..225473ea2d0 100644
--- a/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
+++ b/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
@@ -19,7 +19,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-\ProvidesClass{bookcover}[2020/12/06 v3.0 class for book covers and dust jackets]
+\ProvidesClass{bookcover}[2020/12/16 v3.1 class for book covers and dust jackets]
%% OPTIONS
@@ -40,6 +40,7 @@
\DeclareStringOption[white]{pagecolor}
\DeclareStringOption[white]{trimmingcolor}
\DeclareBoolOption[false]{trimmed}
+\DeclareBoolOption[false]{foldingmargin}
\ProcessKeyvalOptions{bookcover}
%% CLASS AND PACKAGES
@@ -70,7 +71,10 @@
%% INTERNAL LENGTHS
-\newlength{\bookcover@templength@}
+\newlength{\bookcover@templength@a}
+\newlength{\bookcover@templength@b}
+\newlength{\bookcover@templength@c}
+\newlength{\bookcover@templength@d}
\newlength{\bookcover@xpos@}
\newlength{\bookcover@ypos@}
\newlength{\bookcover@partwidth@}
@@ -87,9 +91,8 @@
\setlength{\coverwidth}{\bookcover@coverwidth}
\setlength{\coverheight}{\bookcover@coverheight}
\setlength{\spinewidth}{\bookcover@spinewidth}
-\setlength{\flapwidth}{\bookcover@flapwidth}
-\setlength{\wrapwidth}{\bookcover@wrapwidth}
-\ifdim\flapwidth=0pt\setlength{\wrapwidth}{0pt}\fi
+\ifbookcover@foldingmargin\else\setlength{\flapwidth}{\bookcover@flapwidth}\fi
+\ifdim\flapwidth>0pt\setlength{\wrapwidth}{\bookcover@wrapwidth}\fi
\setlength{\marklength}{\bookcover@marklength}
\setlength{\markthick}{\bookcover@markthick}
\setlength{\bleedwidth}{\bookcover@bleedwidth}
@@ -139,8 +142,8 @@
%% POSBOX
\newcommand{\bookcover@posbox}[5]{%
- \setlength{\bookcover@templength@}{#4}%
- \put(#3,-\bookcover@templength@){%
+ \setlength{\bookcover@templength@a}{#4}%
+ \put(#3,-\bookcover@templength@a){%
\parbox[b][0pt][t]{#1}{%
\parbox[t][#2][t]{#1}{#5}}}}
@@ -164,6 +167,15 @@
\draw (0,\marklength+\bleedwidth) -- +(\marklength,0);
\draw (\paperwidth,\paperheight-\marklength-\bleedwidth) -- +(-\marklength,0);
\draw (\paperwidth,\marklength+\bleedwidth) -- +(-\marklength,0);
+ \ifbookcover@foldingmargin
+ \draw (\marklength,0) -- +(0,\marklength);
+ \draw (\paperwidth-\marklength,0) -- +(0,\marklength);
+ \draw (\marklength,\paperheight) -- +(0,-\marklength);
+ \draw (\paperwidth-\marklength,\paperheight) -- +(0,-\marklength);
+ \draw (0,\marklength) -- +(\marklength,0);
+ \draw (0,\paperheight-\marklength) -- +(\marklength,0);
+ \draw (\paperwidth,\marklength) -- +(-\marklength,0);
+ \draw (\paperwidth,\paperheight-\marklength) -- +(-\marklength,0);\fi
\end{scope}}}
%% TRIMMING
@@ -188,8 +200,7 @@
\endgroup}}
\NewDocumentCommand{\bookcovertrimmedpart}{ m O{,,,} }{\def\bookcover@trimmedpart{#1}\def\bookcover@trimmedmargin{#2}}
-\def\bookcover@trimmedpart{bookcoverpart@whole}
-\def\bookcover@trimmedmargin{,,,}
+\bookcovertrimmedpart{bookcoverpart@whole}
%% BOOKCOVER ENVIRONMENT
@@ -209,16 +220,34 @@
%% BOOKCOVER COMPONENT
\def\bookcover@setpartmargin(#1,#2,#3,#4){%
- \ifblank{#1}{}{%
- \addtolength{\bookcover@xpos@}{#1}%
- \addtolength{\bookcover@partwidth@}{-#1}}%
- \ifblank{#2}{}{%
- \addtolength{\bookcover@partheight@}{-#2}}%
- \ifblank{#3}{}{%
- \addtolength{\bookcover@partwidth@}{-#3}}%
- \ifblank{#4}{}{%
- \addtolength{\bookcover@ypos@}{#4}%
- \addtolength{\bookcover@partheight@}{-#4}}}
+ \setlength{\bookcover@templength@a}{0mm}
+ \setlength{\bookcover@templength@b}{0mm}
+ \setlength{\bookcover@templength@c}{0mm}
+ \setlength{\bookcover@templength@d}{0mm}
+ \ifblank{#1}{}{\setlength{\bookcover@templength@a}{#1}}%
+ \ifblank{#2}{}{\setlength{\bookcover@templength@b}{#2}}%
+ \ifblank{#3}{}{\setlength{\bookcover@templength@c}{#3}}%
+ \ifblank{#4}{}{\setlength{\bookcover@templength@d}{#4}}%
+ \addtolength{\bookcover@xpos@}{\bookcover@templength@a}%
+ \addtolength{\bookcover@partwidth@}{-\bookcover@templength@a}%
+ \addtolength{\bookcover@partheight@}{-\bookcover@templength@b}%
+ \addtolength{\bookcover@partwidth@}{-\bookcover@templength@c}%
+ \addtolength{\bookcover@ypos@}{\bookcover@templength@d}%
+ \addtolength{\bookcover@partheight@}{-\bookcover@templength@d}%
+ \ifdim\bookcover@tikz@trimmed@part@width@minus>\dimexpr\bookcover@tikz@trimmed@part@push@right+\bookcover@templength@c\relax%
+ \addtolength{\bookcover@tikz@trimmed@part@width@minus}{-\bookcover@tikz@trimmed@part@push@right-\bookcover@templength@c}%
+ \else\setlength{\bookcover@tikz@trimmed@part@width@minus}{0mm}\fi%
+ \ifdim\bookcover@tikz@trimmed@part@push@right>\bookcover@templength@a%
+ \addtolength{\bookcover@tikz@trimmed@part@push@right}{-\bookcover@templength@a}%
+ \else\setlength{\bookcover@tikz@trimmed@part@push@right}{0mm}\fi%
+ \addtolength{\bookcover@tikz@trimmed@part@width@minus}{\bookcover@tikz@trimmed@part@push@right}%
+ \ifdim\bookcover@tikz@trimmed@part@height@minus>\dimexpr\bookcover@tikz@trimmed@part@push@up+\bookcover@templength@d\relax%
+ \addtolength{\bookcover@tikz@trimmed@part@height@minus}{-\bookcover@tikz@trimmed@part@push@up-\bookcover@templength@d}%
+ \else\setlength{\bookcover@tikz@trimmed@part@height@minus}{0mm}\fi%
+ \ifdim\bookcover@tikz@trimmed@part@push@up>\bookcover@templength@b%
+ \addtolength{\bookcover@tikz@trimmed@part@push@up}{-\bookcover@templength@b}%
+ \else\setlength{\bookcover@tikz@trimmed@part@push@up}{0mm}\fi%
+ \addtolength{\bookcover@tikz@trimmed@part@height@minus}{\bookcover@tikz@trimmed@part@push@up}}
\NewDocumentCommand{\bookcovercomponent}{ m m O{,,,} +m }{%
\if@inbookcoverenv\else%
@@ -264,10 +293,12 @@
%% LET NAME BOOKCOVER PART
-\def\letnamebookcoverpart#1#2{%
+\NewDocumentCommand{\letnamebookcoverpart}{ m m O{,,,} }{%
\@ifundefined{bookcover@part@param@#1}{%
\@ifundefined{bookcover@part@param@#2}{\@latexerr{Part '#2' is undefined.}{}}{%
- \csletcs{bookcover@part@param@#1}{bookcover@part@param@#2}}}
+ \csletcs{bookcover@part@baseparam@#1}{bookcover@part@param@#2}%
+ \protected@csedef{bookcover@part@margin@#1}{\bookcover@setpartmargin(#3)}%
+ \protected@csedef{bookcover@part@param@#1}{\csuse{bookcover@part@baseparam@#1}\csuse{bookcover@part@margin@#1}}}}
{\@latexerr{Part '#1' is already defined.}{}}}
%% NEW BOOKCOVER COMPONENT TYPE
@@ -311,7 +342,7 @@
\newbookcovercomponenttype{picture}{%
\includegraphics[width=\bookcover@partwidth@,height=\bookcover@partheight@]{#1}}
-\newbookcovercomponenttype{tikz}{%
+\long\def\bookcover@tikz@content#1{%
\begin{tikzpicture}[overlay,yshift=-\bookcover@partheight@]
\begin{scope}[transparent,line width=0pt]
\pgfset{minimum width=\bookcover@partwidth@,minimum height=\bookcover@partheight@}
@@ -325,26 +356,15 @@
#1
\end{tikzpicture}}
+\newbookcovercomponenttype{tikz}{\bookcover@tikz@content{#1}}
+
\letnamebookcovercomponenttype{bookcovertype@tikz}{tikz} % bookcovertype@tikz is protected type
-\newbookcovercomponenttype{tikz clip}{%
- \begin{tikzpicture}[overlay,yshift=-\bookcover@partheight@]
- \begin{scope}[transparent,line width=0pt]
- \pgfset{minimum width=\bookcover@partwidth@,minimum height=\bookcover@partheight@}
- \pgfnode{rectangle}{south west}{}{part}{\pgfusepath{draw}}
- \pgfset{minimum width=\bookcover@partwidth@-\bookcover@tikz@trimmed@part@width@minus,
- minimum height=\bookcover@partheight@-\bookcover@tikz@trimmed@part@height@minus}
- \pgftransformshift{\pgfpoint{\bookcover@tikz@trimmed@part@push@right}
- {\bookcover@tikz@trimmed@part@push@up}}
- \pgfnode{rectangle}{south west}{}{trimmed part}{\pgfusepath{draw}}
- \end{scope}
- \clip (part.south west) rectangle (part.north east);
- #1
- \end{tikzpicture}}
+\newbookcovercomponenttype{tikz clip}{\bookcover@tikz@content{\clip (part.south west) rectangle (part.north east);#1}}
\newbookcovercomponenttype{normal}{#1}
-\newbookcovercomponenttype{center}{\vfill\begin{center}#1\end{center}\vfill}
+\newbookcovercomponenttype{center}{\vfill{\centering#1\\}\vfill}
\newbookcovercomponenttype{ruler}{\expandafter\bookcover@setruler\expandafter(#1)}