summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
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/source
parente047bbf1c29b1b63ce70098b2a9815a177af1f03 (diff)
bookcover (16dec20)
git-svn-id: svn://tug.org/texlive/trunk@57151 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/bookcover/bookcover.dtx710
1 files changed, 471 insertions, 239 deletions
diff --git a/Master/texmf-dist/source/latex/bookcover/bookcover.dtx b/Master/texmf-dist/source/latex/bookcover/bookcover.dtx
index 630d8abf43f..ffb26a6b09a 100644
--- a/Master/texmf-dist/source/latex/bookcover/bookcover.dtx
+++ b/Master/texmf-dist/source/latex/bookcover/bookcover.dtx
@@ -17,12 +17,12 @@
% \iffalse
%<*driver>
\ProvidesFile{bookcover.dtx}
-\newcommand{\eifiledate}{2020/12/06}
-\newcommand{\eifilever}{v3.0}
+\newcommand{\eifiledate}{2020/12/16}
+\newcommand{\eifilever}{v3.1}
%</driver>
%<class>
%<class>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-%<class>\ProvidesClass{bookcover}[2020/12/06 v3.0 class for book covers and dust jackets]
+%<class>\ProvidesClass{bookcover}[2020/12/16 v3.1 class for book covers and dust jackets]
%
%<*driver>
\documentclass{ltxdoc}
@@ -90,11 +90,11 @@
\def\BookCover{{\def\sfdefault{ugq}\sffamily\bfseries
\color{black!90}\mbox{}\lower.15ex\hbox{[B}ook%
- \color{red!80!black}\lower.15ex\hbox{C}over\lower.15ex\hbox{]}}}
+ \color{red!70!black}\lower.15ex\hbox{C}over\lower.15ex\hbox{]}}}
\setlength{\parindent}{0pt}
\setlength{\parskip}{8pt}
-\renewcommand{\descriptionlabel}[1]{\hspace{5mm}}
+\renewcommand{\descriptionlabel}[1]{\hspace{0mm}}
\setlength{\fboxsep}{0pt}
\newcounter{partfig}
@@ -133,25 +133,38 @@
% \AddToShipoutPictureBG*{\tikz[overlay]\fill[top color=black!50, bottom color=white] (current page.north west) rectangle +(\paperwidth,-11cm);}
%
% \section{Introduction}
-% In the following picture you can see a typical book cover with flaps, i.e.\ a dust jacket. Its parts are back flap, back cover, spine, front cover and front flap. The dust jacket is removable, whereas a book cover without flaps is a fixed part of the book.
+%
+% The \texttt{bookcover} document class can be used to create dust jackets and book covers of hardcover and paperback books.
+%
+% \paragraph{Dust jacket.}
+%
+% In the following picture you can see a typical dust jacket of a hardcover book, which is a detachable outer book cover. Its parts are back flap, back cover, spine, front cover and front flap.
% \begin{center}
-% \includegraphics{figures/bookcover-einstein}
+% \includegraphics{figures/bookcover-dustjacket}
% \end{center}
-% When you prepare a book cover for printing, some marks are needed to know where to trim or fold the paper. The crop marks determine a special area of the sheet, which is called ``bleed'' (see the green area in the next figure). The background will be expanded onto the bleed, taking account of slight inaccuracy when trimming. If there is no bleed, the likelihood of having a white strip on the edge of the finished product is high. In the next schematics figure, the red lines are the marks. The scissors symbols show the crop marks, and the other ones are the fold marks. The blue frame is the border of the printed area.
+% When you prepare a dust jacket for printing, some marks are needed to know where to trim or fold the cover. The crop marks determine a special area of the sheet, which is called ``bleed'' (see the gray area in the next figure). The bleed will be trimmed off. The background will be expanded onto the bleed, taking account of slight inaccuracy when trimming. If there is no bleed, the likelihood of having a white strip on the edge of the finished product is high. In the next schematics figure, the red lines are the marks. The marks closest to the corners are the crop marks, and the other ones are the fold marks.
% \begin{center}
-% \includegraphics{figures/bookcover-scheme}
+% \includegraphics{figures/bookcover-scheme-withflaps}
% \end{center}
-% The ``wraps'' are the areas between the front cover and front flap, and back cover and back flap (see the gray area in the previous figure). The reason this is defined is that if the front and back covers have background colors or images that continue to the foreedge of each cover, they must continue onto the flap. Because putting the edge of color right at the edge of the board would result in an unsightly boundary line when the book is closed.
+% The back/front ``wraps'' (see the black area in the previous figure) are the areas between the front cover and front flap, and back cover and back flap. The reason this is defined is that if the front and back covers have background colors or images that continue to the foreedge of each cover, they must continue onto the flap. Because putting the edge of color right at the edge of the board would result in an unsightly boundary line when the book is closed.
%
-% We get the following result after trimming:
+% \paragraph{Book cover for paperback book.}
+%
+% A book cover of a paperback book is glued to the spine of the book and usually has no flaps. The function of the bleed here is the same as before. The crop marks are closest to the corners, and the other ones are the fold marks.
% \begin{center}
-% \includegraphics{figures/bookcover-result}
+% \includegraphics{figures/bookcover-scheme-withoutflaps}
% \end{center}
-% The \texttt{bookcover} document class can be used to create such book covers.
+% Rarely, a book cover of a paperback book may have flaps. In this case, its scheme is similar to a dust jacket.
%
-% \section{Loading class}\label{sec:class}
-% The \texttt{bookcover} class requires the services of the \texttt{article} class and the following packages:
-% \texttt{kvoptions}, \texttt{geometry}, \texttt{graphicx}, \texttt{calc}, \texttt{tikz}, \texttt{xparse}, \texttt{etoolbox}, \texttt{fgruler}.
+% \paragraph{Book cover for hardcover book.}
+%
+% The outside of the cover of a hardcover book is glued to the boards of the book. Of course, this never has flaps.
+% \begin{center}
+% \includegraphics{figures/bookcover-scheme-foldingmargin}
+% \end{center}
+% In this case, the function of the bleed is not to eliminate cutting inaccuracies. It will not be trimmed off, but it will be a margin which is folded back and glued onto the inside of the book boards. This way, it will cover all the edges of the boards. The crop marks are closest to the corners, and the other ones are the fold marks.
+%
+% \section{Loading class and options}\label{sec:class}
%
% Load the class as usual, with
% \begin{commandlst}
@@ -165,14 +178,11 @@
% \item[]\commandinline|coverwidth=!<length>!| Front/back cover width (default \texttt{coverwidth=170mm}).
% \item[]\commandinline|spinewidth=!<length>!| Spine width (default \texttt{spinewidth=5mm}).
% \item[]\commandinline|flapwidth=!<length>!| Flap width (default \texttt{flapwidth=0mm}).
-% \item[]\commandinline|wrapwidth=!<length>!| Wrap width (default \texttt{wrapwidth=0mm}). It only has an effect if the flap width is positive.
+% \item[]\commandinline|wrapwidth=!<length>!| Wrap width (default \texttt{wrapwidth=0mm}). It has no effect with \texttt{flapwidth=0mm} option.
% \item[]\commandinline|bleedwidth=!<length>!| Bleed width (default \texttt{bleedwidth=5mm}).
% \item[]\commandinline|marklength=!<length>!| Mark length (default \texttt{marklength=10mm}).
-% \end{compactdesc}
-% \begin{center}
-% \includegraphics{figures/bookcover-sizes}
-% \end{center}
-% \begin{compactdesc}
+% \item[]\commandinline|foldingmargin| or \commandinline|foldingmargin=true| The bleed will not a trimmed area but a folding margin. The crop marks will be placed at the corners of the bleed and the options \texttt{flapwidth} and \texttt{wrapwidth} will be ineffective, meaning there will be no flaps.
+% \item[]\commandinline|foldingmargin=false| (Default.)
% \item[]\commandinline|10pt| (Default.) Normal font size is 10\,pt.
% \item[]\commandinline|11pt| Normal font size is 11\,pt.
% \item[]\commandinline|12pt| Normal font size is 12\,pt.
@@ -184,8 +194,10 @@
% \item[]\commandinline|trimmingcolor=!<color name>!| Color of trimming (default \texttt{trimmingcolor=white}).
% \end{compactdesc}
%
+% The \texttt{bookcover.cls} requires the services of the \texttt{article} class and the following packages: \texttt{kvoptions}, \texttt{geometry}, \texttt{graphicx}, \texttt{calc}, \texttt{tikz}, \texttt{xparse}, \texttt{etoolbox}, \texttt{fgruler}.
+%
% \section{Commands and environments}
-% Use \commandinline{bookcover} environment in the document body to make a new book cover. If you need to edit both sides of the cover, you can do it with two \texttt{bookcover} environments (see an example in subsection~\ref{subsec-two-sided-example}). You can create a component of the book cover by the following command or environment in the \texttt{bookcover} environment:
+% Use \commandinline{bookcover} environment in the document body to make a new book cover. If you need to edit both sides of the cover, you can do it with two \texttt{bookcover} environments (see an example in the Subsection~\ref{subsec-two-sided-example}). You can create a component of the book cover by the following command or environment in the \texttt{bookcover} environment:
% \begin{commandlst}
% \bookcovercomponent{!<component type>!}{!<part>!}[!<left>!,!<bottom>!,!<right>!,!<top>!]{!<content>!}
% \end{commandlst}
@@ -195,11 +207,25 @@
% !<content>!
% \end{bookcoverelement}
% \end{commandlst}
-% See the section~\ref{sec:componenttypes} for the description of \meta{component type}. You can read the description of \meta{part} in section~\ref{sec:parts}. The \meta{left}, \meta{bottom}, \meta{right} and \meta{top} are the margins of the \meta{part}. The default value of every margin is \texttt{0mm}. If the \meta{left}, \meta{bottom}, \meta{right} or \meta{top} is empty or space, then its value will be \texttt{0mm}. The \meta{content} depends on the \meta{component type} (see section~\ref{sec:componenttypes}). You can use the following length commands in \meta{content}:
+%
+% \begin{description}
+% \item[]\meta{component type} It determines the bookcover component type (see the Section~\ref{sec:componenttypes}). Predefined component types: \commandinline{color}, \commandinline{tikz}, \commandinline{tikz clip}, \commandinline{picture}, \commandinline{normal}, \commandinline{center}, \commandinline{ruler}.
+% \item[]\meta{part} This determines where in the book cover the \meta{content} is located. You can read the description of \meta{part} in the Section~\ref{sec:parts}. Some predefined parts: \commandinline{front} (front cover), \commandinline{bg front} (front cover expanded onto the bleed), \commandinline{back} (back cover), \commandinline{bg back} (back cover expanded onto the bleed), \commandinline{whole} (whole book cover), \commandinline{bg whole} (whole book cover expanded onto the bleed), \commandinline{spine}, etc.
+% \item[]\meta{left},\meta{bottom},\meta{right},\meta{top} These are the margins of the \meta{part}. The default value of every margin is \texttt{0mm}. If the \meta{left}, \meta{bottom}, \meta{right} or \meta{top} is empty or space, then its value will be \texttt{0mm}. If the value of a margin is negative, the part size will increase instead of decrease.
+% \item[]\meta{content} This can be text, image, color, etc., which depends on the \meta{component type} (see the Section~\ref{sec:componenttypes}). This will be located in the \meta{part}.
+% \end{description}
+% You can use the following length commands in the \meta{content} and to specify the margins of the \meta{part}:
%
% \begin{compactdesc}
-% \item[]\commandinline{\partwidth} The width of the \meta{part} reduced by \meta{left} and \meta{right}.
-% \item[]\commandinline{\partheight} The height of the \meta{part} reduced by \meta{bottom} and \meta{top}.
+% \item[]\commandinline{\partheight} The height of the \meta{part} (reduced by \meta{bottom} and \meta{top} in \meta{content}).
+% \item[]\commandinline{\partwidth} The width of the \meta{part} (reduced by \meta{left} and \meta{right} in \meta{content}).
+% \item[]\commandinline{\coverheight} Cover height.
+% \item[]\commandinline{\coverwidth} Front/back cover width.
+% \item[]\commandinline{\spinewidth} Spine width.
+% \item[]\commandinline{\flapwidth} Flap width.
+% \item[]\commandinline{\wrapwidth} Wrap width.
+% \item[]\commandinline{\bleedwidth} Bleed width.
+% \item[]\commandinline{\marklength} Mark length.
% \end{compactdesc}
%
% Every |\bookcovercomponent| command and |bookcoverelement| environment generates a layer on the sheet. The first one generates the bottom layer and the last one generates the top layer.
@@ -212,7 +238,8 @@
% \begin{document}
% \begin{bookcover}
% \bookcovercomponent{color}{bg whole}{orange}
-% \bookcovercomponent{normal}{front}[,,,5cm]{\centering\bfseries\huge Book title\par}
+% \bookcovercomponent{normal}{front}[,,,0.4\partheight]{
+% \centering\bfseries\huge Book title\par}
% \end{bookcover}
% \end{document}
% \end{examplelst}
@@ -227,49 +254,191 @@
% \begin{bookcoverelement}{color}{bg whole}
% orange
% \end{bookcoverelement}
-% \begin{bookcoverelement}{normal}{front}[,,,5cm]
+% \begin{bookcoverelement}{normal}{front}[,,,0.4\partheight]
% \centering\bfseries\huge Book title\par
% \end{bookcoverelement}
% \end{bookcover}
% \end{document}
% \end{examplelst}
%
+% Use \commandinline{bookcoverdescription} environment in the document body for adding the description of the book cover and other information. Don't use it in |bookcover| environment! You can set the page geometry of the description by the following command:
+% \begin{commandlst}
+% \bookcoverdescgeometry{!<geometry parameteres>!}
+% \end{commandlst}
+% The possible \meta{geometry parameteres} are the same as for |\newgeometry| in the |geometry| package. Its default value is |margin=1in|. Unlike |\newgeometry|, it can be used in the preamble as well. See an example in the Subsection~\ref{subsec:desc}.
+%
% If the value of the \texttt{trimmed} option is \texttt{true}, then you can set the trimmed part by the following command before any \texttt{bookcover} environment:
% \begin{commandlst}
% \bookcovertrimmedpart{!<trimmed part>!}[!<left>!,!<bottom>!,!<right>!,!<top>!]
% \end{commandlst}
%
-% Without this command, or if the \meta{trimmed part} is empty or space, then its value will be \texttt{whole} (see section~\ref{sec:parts}). The \meta{left}, \meta{bottom}, \meta{right} and \meta{top} are the margins of the \meta{part}. The default value of every margin is \texttt{0mm}. If the \meta{left}, \meta{bottom}, \meta{right} or \meta{top} is empty or space, then its value will be \texttt{0mm}. The trimmed area will be the \meta{trimmed part} reduced by the margins.
+% Without this command, or if the \meta{trimmed part} is empty or space, then its value will be \texttt{whole} (see the Section~\ref{sec:parts}). The \meta{left}, \meta{bottom}, \meta{right} and \meta{top} are the margins of the \meta{trimmed part}. The default value of every margin is \texttt{0mm}. If the \meta{left}, \meta{bottom}, \meta{right} or \meta{top} is empty or space, then its value will be \texttt{0mm}. The trimmed area will be the \meta{trimmed part} reduced by the margins. If the value of a margin is negative, the \meta{trimmed part} size will increase instead of decrease.
%
% You can change some options before any \texttt{bookcover} environment by the following command:
% \begin{commandlst}
% \setbookcover{!<options>!}
% \end{commandlst}
-% The \meta{options} can be as follows: \commandinline|markthick=!<length>!|, \commandinline|markcolor=!<color name>!|, \commandinline|pagecolor=!<color name>!|, \commandinline|trimmed|, \commandinline|trimmed=false|, \commandinline|trimmingcolor=!<color name>!| (see section~\ref{sec:class}). See an example in the subsection~\ref{subsec:trimming}
+% The \meta{options} can be as follows: \commandinline|markthick=!<length>!|, \commandinline|markcolor=!<color name>!|, \commandinline|pagecolor=!<color name>!|, \commandinline|trimmed|, \commandinline|trimmed=false|, \commandinline|trimmingcolor=!<color name>!| (see the Section~\ref{sec:class}). See an example in the Subsection~\ref{subsec:trimming}
%
-% Use \commandinline{bookcoverdescription} environment in the document body for adding the description of the book cover and other information. Don't use it in |bookcover| environment! You can set the page geometry of the description by the following command:
+% \section{Book cover parts}\label{sec:parts}
+%
+% Each predefined \meta{part} is illustrated in this section.
+%
+% The background parts are expanded onto the bleed, taking account of slight inaccuracy when trimming. In contrast, the foreground parts do not extend onto the bleed. The names of the background parts start with \commandinline{bg}.
+%
+% If your book will also have printing on the inside cover, the layout for the inside cover will be the exact opposite of the outside cover. Therefore, these parts also have synonymous names. The synonymous names contain \commandinline{inside front} instead of \commandinline{back} and \commandinline{inside back} instead of \commandinline{front}. For example \commandinline{bg front} is the same as \commandinline{bg inside back}, \commandinline{above back} is the same as \commandinline{above inside front}, etc.
+%
+% You can also use short names to specify foreground and background parts. The elements of the abbreviations are as follows: \commandinline{F} (flap), \commandinline{W} (wrap), \commandinline{C} (cover), \commandinline{S} (spine), \commandinline{l} (a part to the left of the spine), \commandinline{r} (a part to the right of the spine). For example \commandinline{lC} is the abbreviation of the left cover, i.e.\ the back cover of the outside cover, or the inside front cover of the inside cover. It is not extended onto the bleed, i.e.\ it is a foreground part. If you want to extend that part onto the bleed, type \commandinline{bg} and then a space in the front of the name. For example \commandinline{bg lC} is the left cover extended onto the bleed. Use a hyphen to specify multi-piece parts. For example \commandinline{lW-S} is the part from the left wrap to the spine, which is not extended onto the bleed.
+%
+% The following figures also show the normal and abbreviated names of the blue parts.
+%
+% \subsection{Book cover widthout flaps, background parts}
+%
+% \setcounter{partfig}{1}
+% \loop
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
+% \ifnum\value{partfig}<7\repeat
+%
+% \subsection{Book cover widthout flaps, foreground parts}
+%
+% \loop
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
+% \ifnum\value{partfig}<13\repeat
+%
+% \subsection{Book cover widthout flaps, other parts}
+%
+% \loop
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
+% \ifnum\value{partfig}<17\repeat
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\stepcounter{partfig}
+%
+% \subsection{Book cover width flaps, background parts}
+%
+% \loop
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
+% \ifnum\value{partfig}<46\repeat
+%
+% \subsection{Book cover width flaps, foreground parts}
+%
+% \loop
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
+% \ifnum\value{partfig}<74\repeat
+%
+% \subsection{Book cover width flaps, other parts}
+%
+% \loop
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
+% \ifnum\value{partfig}<78\repeat
+% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}
+%
+% \subsection{Defining part}
+% You can define a new rectangular part or redefine a defined part with the following commands:
% \begin{commandlst}
-% \bookcoverdescgeometry{!<geometry parameteres>!}
+% \newbookcoverpart{!<new part>!}{!<setting>!}
+% \renewbookcoverpart{!<defined part>!}{!<setting>!}
+% \end{commandlst}
+%
+% \medskip In \meta{setting} you have to set the new part sizes, the coordinates of its upper left corner (the origin is the upper left corner of the printed area), and the parameters of the \texttt{trimmed part} rectangle node in \texttt{tikz} and \texttt{tikz clip} component types (see in the Section~\ref{sec:componenttypes}). For this purpose, use the following commands:
+% \begin{commandlst}
+% \setpartposx{!<coord x>!}
+% \setpartposy{!<coord y>!}
+% \setpartwidth{!<width>!}
+% \setpartheight{!<height>!}
+% \settrimmedpart{!<width minus>!}{!<height minus>!}{!<shift x>!}{!<shift y>!}
% \end{commandlst}
-% The possible \meta{geometry parameteres} are the same as for |\newgeometry| in the |geometry| package. Its default value is |margin=1in|. Unlike |\newgeometry|, it can be used in the preamble as well. See an example in the subsection~\ref{subsec:desc}.
%
-% You can use the following length commands, which are declared by the options of the document class:
+% \begin{center}
+% \includegraphics{./figures/bookcover-newpart}
+% \end{center}
+%
+% To give the previous lengths, you can use the following length commands, which are declared by the options of the document class:
+%
% \begin{compactdesc}
-% \item[]\commandinline{\coverwidth}
-% \item[]\commandinline{\coverheight}
-% \item[]\commandinline{\spinewidth}
-% \item[]\commandinline{\flapwidth}
-% \item[]\commandinline{\wrapwidth}
-% \item[]\commandinline{\marklength}
-% \item[]\commandinline{\bleedwidth}
+% \item[]\commandinline{\coverheight} Cover height.
+% \item[]\commandinline{\coverwidth} Front/back cover width.
+% \item[]\commandinline{\spinewidth} Spine width.
+% \item[]\commandinline{\flapwidth} Flap width.
+% \item[]\commandinline{\wrapwidth} Wrap width.
+% \item[]\commandinline{\bleedwidth} Bleed width.
+% \item[]\commandinline{\marklength} Mark length.
% \end{compactdesc}
%
-% \section{Component types}\label{sec:componenttypes}
+% \example
+% \begin{examplelst}
+% \documentclass[flapwidth=3cm]{bookcover} % Also try it with flapwidth=0cm option!
%
-% Predefined component types: \commandinline{color}, \commandinline{tikz}, \commandinline{tikz clip}, \commandinline{picture}, \commandinline{normal}, \commandinline{center}, \commandinline{ruler}.
+% \newbookcoverpart{bg half front}{
+% \setpartposx{\marklength+\bleedwidth+\flapwidth+\wrapwidth+\spinewidth+1.5\coverwidth}
+% \setpartposy{\marklength}
+% \setpartheight{\coverheight+2\bleedwidth}
+% \ifdim\flapwidth>0mm
+% \setpartwidth{.5\coverwidth}
+% \settrimmedpart{0pt}{2\bleedwidth}{0pt}{\bleedwidth}
+% \else
+% \setpartwidth{.5\coverwidth+\bleedwidth}
+% \settrimmedpart{\bleedwidth}{2\bleedwidth}{0pt}{\bleedwidth}\fi}
+%
+% \begin{document}
+%
+% \begin{bookcover}
+% \bookcovercomponent{tikz}{bg half front}{
+% \fill[blue] (part.south west) rectangle (part.north east);
+% \fill[green] (trimmed part.south west) rectangle (trimmed part.north east);}
+% \end{bookcover}
+%
+% \end{document}
+% \end{examplelst}
+%
+% You can rename a defined part with the following commands:
+% \begin{commandlst}
+% \newnamebookcoverpart{!<new part>!}{!<defined part>!}
+% \letnamebookcoverpart{!<new part>!}{!<defined part>!}[!<left>!,!<bottom>!,!<right>!,!<top>!]
+% \end{commandlst}
+%
+% \medskip Using |\newnamebookcoverpart|, the definition of the \meta{new part} and the \meta{defined part} are always the same, even if you redefine the \meta{defined part} later with the |\renewbookcoverpart|.
+%
+% Using |\letnamebookcoverpart|, the definition of the \meta{new part} is the same as the current definition of the \meta{defined part} reduced by the \meta{left}, \meta{bottom}, \meta{right} and \meta{top} margins. If you change the \meta{defined part} later with the |\renewbookcoverpart|, the \meta{new part} doesn't change with it. The default value of every margin is \texttt{0mm}. If the \meta{left}, \meta{bottom}, \meta{right} or \meta{top} is empty or space, then its value will be \texttt{0mm}. If the value of a margin is negative, the part size will increase instead of decrease. You can use the following length commands to specify the margins:
+%
+% \begin{compactdesc}
+% \item[]\commandinline{\partheight} The height of the \meta{defined part}.
+% \item[]\commandinline{\partwidth} The width of the \meta{defined part}.
+% \item[]\commandinline{\coverheight} Cover height.
+% \item[]\commandinline{\coverwidth} Front/back cover width.
+% \item[]\commandinline{\spinewidth} Spine width.
+% \item[]\commandinline{\flapwidth} Flap width.
+% \item[]\commandinline{\wrapwidth} Wrap width.
+% \item[]\commandinline{\bleedwidth} Bleed width.
+% \item[]\commandinline{\marklength} Mark length.
+% \end{compactdesc}
+%
+% \example
+% \begin{examplelst}
+% \documentclass[spinewidth=2cm]{bookcover}
+%
+% \letnamebookcoverpart{extended bg spine}{bg spine}[-\spinewidth,,-\spinewidth,]
+%
+% \begin{document}
+%
+% \begin{bookcover}
+% \bookcovercomponent{color}{bg whole}{blue}
+% \bookcovercomponent{color}{extended bg spine}{opacity=0.5}
+% \end{bookcover}
+%
+% \end{document}
+% \end{examplelst}
+%
+% \section{Book cover component types}\label{sec:componenttypes}
+%
+% Predefined \meta{component type}: \commandinline{color}, \commandinline{tikz}, \commandinline{tikz clip}, \commandinline{picture}, \commandinline{normal}, \commandinline{center}, \commandinline{ruler}.
%
% \subsection{The color component type}
-% It determines the color of the part. The \meta{content} is the options of the |\fill| in the \texttt{tikz} package:
+% It determines the color of the \meta{part}. The \meta{content} is the options of the |\fill| in the \texttt{tikz} package:
% \begin{compactdesc}
% \item[]\commandinline{!<color name>!} (See it in the \texttt{xcolor} package.)
% \item[]\commandinline{color=!<color name>!} (It is equivalent to the previous one.)
@@ -300,10 +469,10 @@
% \begin{examplelst}
% \begin{bookcover}
% \bookcovercomponent{tikz}{bg whole}{
-% \fill[yellow] (part.south west) rectangle (part.north east);
+% \fill[black] (part.south west) rectangle (part.north east);
% \fill[gray] (trimmed part.south east) rectangle (trimmed part.north west);}
% \bookcovercomponent{tikz}{bg front}{
-% \fill[green] (part.south west) -- (part.center) -- (part.north west) -- cycle;}
+% \fill[blue] (part.south west) -- (part.center) -- (part.north west) -- cycle;}
% \end{bookcover}
% \end{examplelst}
% \end{minipage}
@@ -318,9 +487,9 @@
% \begin{examplelst}
% \begin{bookcover}
% \bookcovercomponent{tikz clip}{front}{
-% \fill[green] (part.west) circle [radius=8mm];}
+% \fill[blue] (part.west) circle [radius=8mm];}
% \bookcovercomponent{tikz}{front}{
-% \fill[orange] (part.west) circle [radius=4mm];}
+% \fill[gray] (part.west) circle [radius=4mm];}
% \end{bookcover}
% \end{examplelst}
% \begin{center}
@@ -369,13 +538,14 @@
% !<unit>!,!<origin>!,!<color name>!
% \end{commandlst}
%
-% \medskip\meta{unit} The ruler unit:
+% \begin{description}
+% \item[]\meta{unit} The ruler unit:
% \begin{compactdesc}
% \item[]\commandinline{cm} Metric ruler (centimeter). If the \meta{unit} is empty or space, then its value will be \texttt{cm}.
% \item[]\commandinline{in} English ruler (inch).
% \end{compactdesc}
%
-% \meta{origin} The origin of the square ruler:
+% \item[]\meta{origin} The origin of the square ruler:
% \begin{compactdesc}
% \item[]\commandinline{upperleft } The origin is the upper left corner of the part. Directions: down and right. If the \meta{origin} is empty or space, then its value will be \texttt{upperleft}.
% \item[]\commandinline{upperright} The origin is the upper right corner of the part. Directions: down and left.
@@ -383,7 +553,8 @@
% \item[]\commandinline{lowerright} The origin is the lower right corner of the part. Directions: up and left.
% \end{compactdesc}
%
-% \meta{color name} The color of the ruler. If it is empty or space, then its value will be the color of the marks.
+% \item[]\meta{color name} The color of the ruler. If it is empty or space, then its value will be the color of the marks.
+% \end{description}
%
% \example
% \begin{examplelst}
@@ -401,15 +572,15 @@
% \subsection{Defining component type}
% You can define a new component type, redefine or rename a defined component type with the following commands:
% \begin{commandlst}
-% \newbookcovercomponenttype{!<new component type name>!}{!<formatting>!}
-% \renewbookcovercomponenttype{!<defined component type name>!}{!<formatting>!}
-% \newnamebookcovercomponenttype{!<new component type name>!}{!<defined component type name>!}
-% \letnamebookcovercomponenttype{!<new component type name>!}{!<defined component type name>!}
+% \newbookcovercomponenttype{!<new component type>!}{!<formatting>!}
+% \renewbookcovercomponenttype{!<defined component type>!}{!<formatting>!}
+% \newnamebookcovercomponenttype{!<new component type>!}{!<defined component type>!}
+% \letnamebookcovercomponenttype{!<new component type>!}{!<defined component type>!}
% \end{commandlst}
%
-% \medskip Using |\newnamebookcovercomponenttype|, the definition of \meta{new component type name} and \meta{defined component type name} are always the same, even if you redefine \meta{defined component type name} later with |\renewbookcovercomponenttype|.
+% \medskip Using |\newnamebookcovercomponenttype|, the definition of the \meta{new component type} and the \meta{defined component type} are always the same, even if you redefine the \meta{defined component type} later with the |\renewbookcovercomponenttype|.
%
-% Using |\letnamebookcovercomponenttype|, the definition of \meta{new component type name} is the same as the current definition of \meta{defined component type name}. If you change \meta{defined component type name} later with |\renewbookcovercomponenttype|, \meta{new component type name} doesn't change with it.
+% Using |\letnamebookcovercomponenttype|, the definition of the \meta{new component type} is the same as the current definition of the \meta{defined component type}. If you change the \meta{defined component type} later with |\renewbookcovercomponenttype|, the \meta{new component type} doesn't change with it.
%
% You can use the following length commands in \meta{formatting}:
%
@@ -435,173 +606,166 @@
% \end{document}
% \end{examplelst}
%
-% \section{Parts}\label{sec:parts}
-%
-% Each predefined part is illustrated below. The background parts are expanded onto the bleed, taking account of slight inaccuracy when trimming. In contrast, the foreground parts do not extend onto the bleed. The names of the background parts start with \commandinline{bg}.
+% \newpage\section{Examples}
%
-% If your book will also have printing on the inside cover, the layout for the inside cover will be the exact opposite of the outside cover. Therefore, these parts also have synonymous names. The synonymous names contain \commandinline{inside front} instead of \commandinline{back} and \commandinline{inside back} instead of \commandinline{front}. For example \commandinline{bg front} is the same as \commandinline{bg inside back}, \commandinline{above back} is the same as \commandinline{above inside front}, etc.
+% \subsection{Barcode and QR code}
%
-% You can also use short names to specify foreground and background parts. The elements of the abbreviations are as follows:
-% \begin{compactdesc}
-% \item[]\commandinline{F}: flap
-% \item[]\commandinline{W}: wrap
-% \item[]\commandinline{C}: cover
-% \item[]\commandinline{S}: spine
-% \item[]\commandinline{l}: left (a part to the left of the spine)
-% \item[]\commandinline{r}: right (a part to the right of the spine)
-% \end{compactdesc}
-% For example \commandinline{lC} is the abbreviation of the left cover, i.e.\ the back cover of the outside cover, or the inside front cover of the inside cover. It is not extended onto the bleed, i.e.\ it is a foreground part. If you want to extend that part onto the bleed, type \commandinline{bg} and then a space in the front of the name. For example \commandinline{bg lC} is the left cover extended onto the bleed. Use a hyphen to specify multi-piece parts. For example \commandinline{lW-S} is the part from the left wrap to the spine, which is not extended onto the bleed.
-%
-% The following figures also show the normal and abbreviated names of the yellow parts.
+% \begin{center}
+% \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{figures/bookcover-barcode}}
+% \end{center}
%
-% \subsection{Book cover widthout flaps, background parts}
+% \begin{examplelst}
+% \documentclass[spinewidth=15mm]{bookcover}
+% % The pdflatex or lualatex should be called with the -shell-escape option.
+% % The next line is only required for pdflatex and lualatex.
+% \usepackage{pst-barcode}
+% \usepackage[pdfcrop={-hires}]{auto-pst-pdf}
%
-% \setcounter{partfig}{1}
-% \loop
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
-% \ifnum\value{partfig}<7\repeat
+% \begin{document}
%
-% \subsection{Book cover widthout flaps, foreground parts}
+% \begin{bookcover}
%
-% \loop
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
-% \ifnum\value{partfig}<13\repeat
+% \bookcovercomponent{color}{bg whole}{blue!50}
%
-% \subsection{Book cover widthout flaps, other parts}
+% \bookcovercomponent{normal}{back}[,1cm,,]{
+% \vfill
+% \centering
+% \setlength{\fboxsep}{2mm}
+% \colorbox{white}{%
+% \begin{pspicture}(1.5in,1in)
+% \psbarcode{1787-6117}{includetext width=1.5 height=1}{issn}
+% \end{pspicture}\qquad
+% \begin{pspicture}(1.2in,1.2in)
+% \psbarcode{https://www.ctan.org/pkg/bookcover}{includetext width=1.2 height=1.2}{qrcode}
+% \end{pspicture}}}
%
-% \loop
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
-% \ifnum\value{partfig}<17\repeat
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\stepcounter{partfig}
+% \end{bookcover}
%
-% \subsection{Book cover width flaps, background parts}
+% \end{document}
+% \end{examplelst}
%
-% \loop
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
-% \ifnum\value{partfig}<46\repeat
+% \newpage\subsection{Description}\label{subsec:desc}
%
-% \subsection{Book cover width flaps, foreground parts}
+% \begin{center}
+% \fcolorbox{black!50}{white}{\includegraphics[page=1,width=\textwidth-.8pt]{figures/bookcover-description}}\\[5mm]
+% \fcolorbox{black!50}{white}{\includegraphics[page=2,width=\textwidth-.8pt]{figures/bookcover-description}}
+% \end{center}
%
-% \loop
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
-% \ifnum\value{partfig}<74\repeat
+% \newpage
+% \begin{examplelst}
+% \documentclass[markcolor=black,spinewidth=15mm]{bookcover}
%
-% \subsection{Book cover width flaps, other parts}
+% \usepackage[english]{babel}
+% \usepackage{kantlipsum,multicol,microtype}
+% \bookcoverdescgeometry{vmargin=25mm,hmargin=9cm}
+%
+% \begin{document}
+%
+% % Description text
+% \begin{bookcoverdescription}
+% \title{Description}
+% \author{John Taylor}
+% \date{}
+% \maketitle
+% \begin{multicols}{3}
+% \kant[1-5]
+% \end{multicols}
+% \end{bookcoverdescription}
+%
+% % Book cover
+% \begin{bookcover}
+% \bookcovercomponent{center}{front}{\Huge BOOK TITLE}
+% \end{bookcover}
+%
+% \end{document}
+% \end{examplelst}
%
-% \loop
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\hfill\stepcounter{partfig}
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\par\smallskip\stepcounter{partfig}
-% \ifnum\value{partfig}<78\repeat
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}
+% \newpage\subsection{Usage of margins}
%
-% \subsection{Defining part}
-% You can define a new rectangular part, redefine or rename a defined part with the following commands:
-% \begin{commandlst}
-% \newbookcoverpart{!<new part name>!}{!<setting>!}
-% \renewbookcoverpart{!<defined part name>!}{!<setting>!}
-% \newnamebookcoverpart{!<new part name>!}{!<defined part name>!}
-% \letnamebookcoverpart{!<new part name>!}{!<defined part name>!}
-% \end{commandlst}
+% \begin{center}
+% \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{figures/bookcover-margins}}
+% \end{center}
%
-% \medskip Using |\newnamebookcoverpart|, the definition of \meta{new part name} and \meta{defined part name} are always the same, even if you redefine \meta{defined part name} later with |\renewbookcoverpart|.
+% \begin{examplelst}
+% \documentclass[spinewidth=30mm]{bookcover}
+% \begin{document}
%
-% Using |\letnamebookcoverpart|, the definition of \meta{new part name} is the same as the current definition of \meta{defined part name}. If you change \meta{defined part name} later with |\renewbookcoverpart|, \meta{new part name} doesn't change with it.
+% \begin{bookcover}
+% \bookcovercomponent{color}{bg whole}{gray}
+% \bookcovercomponent{color}{back}{blue}
+% \bookcovercomponent{color}{back}[5mm,5mm,5mm,5mm]{blue!50}
+% \bookcovercomponent{color}{front}{red}
+% \bookcovercomponent{color}{front}[5mm,5mm,5mm,5mm]{red!50}
+% \bookcovercomponent{color}{spine}{green!50!black}
+% \bookcovercomponent{color}{spine}[5mm,5mm,5mm,5mm]{green!50}
+% \bookcovercomponent{color}{spine}
+% [-\spinewidth,15mm,-\spinewidth,\partheight-\spinewidth-15mm]{opacity=0.5}
+% \end{bookcover}
%
-% In \meta{setting} you have to set the new part sizes, the coordinates of its upper left corner (the origin is the upper left corner of the printed area), and the parameters of the \texttt{trimmed part} rectangle node in \texttt{tikz} and \texttt{tikz clip} component types. For this purpose, use the following commands:
-% \begin{commandlst}
-% \setpartposx{!<coord x>!}
-% \setpartposy{!<coord y>!}
-% \setpartwidth{!<width>!}
-% \setpartheight{!<height>!}
-% \settrimmedpart{!<width minus>!}{!<height minus>!}{!<shift x>!}{!<shift y>!}
-% \end{commandlst}
+% \end{document}
+% \end{examplelst}
%
-% \begin{center}
-% \includegraphics{./figures/bookcover-newpart}
-% \end{center}
+% or its equivalent
%
-% To give the previous lengths, you can use the following length commands, which are declared by the options of the document class:
+% \bigskip
+% \begin{examplelst}
+% \documentclass[spinewidth=30mm]{bookcover}
%
-% \begin{compactdesc}
-% \item[]\commandinline{\coverwidth}
-% \item[]\commandinline{\coverheight}
-% \item[]\commandinline{\spinewidth}
-% \item[]\commandinline{\flapwidth}
-% \item[]\commandinline{\wrapwidth}
-% \item[]\commandinline{\marklength}
-% \item[]\commandinline{\bleedwidth}
-% \end{compactdesc}
+% \letnamebookcoverpart{back typing area}{back}[5mm,5mm,5mm,5mm]
+% \letnamebookcoverpart{front typing area}{front}[5mm,5mm,5mm,5mm]
+% \letnamebookcoverpart{spine typing area}{spine}[5mm,5mm,5mm,5mm]
+% \letnamebookcoverpart{spine bottom}{spine}
+% [-\spinewidth,15mm,-\spinewidth,\partheight-\spinewidth-15mm]
%
-% \example
-% \begin{examplelst}
-% \documentclass[flapwidth=3cm]{bookcover} % Also try it with flapwidth=0cm option!
-% \newbookcoverpart{bg half front}{
-% \setpartposx{\marklength+\bleedwidth+\flapwidth+\wrapwidth+\spinewidth+1.5\coverwidth}
-% \setpartposy{\marklength}
-% \setpartheight{\coverheight+2\bleedwidth}
-% \ifdim\flapwidth>0mm
-% \setpartwidth{.5\coverwidth}
-% \settrimmedpart{0pt}{2\bleedwidth}{0pt}{\bleedwidth}
-% \else
-% \setpartwidth{.5\coverwidth+\bleedwidth}
-% \settrimmedpart{\bleedwidth}{2\bleedwidth}{0pt}{\bleedwidth}\fi}
% \begin{document}
+%
% \begin{bookcover}
-% \bookcovercomponent{tikz}{bg half front}{
-% \fill[blue] (part.south west) rectangle (part.north east);
-% \fill[green] (trimmed part.south west) rectangle (trimmed part.north east);}
+% \bookcovercomponent{color}{bg whole}{gray}
+% \bookcovercomponent{color}{back}{blue}
+% \bookcovercomponent{color}{back typing area}{blue!50}
+% \bookcovercomponent{color}{front}{red}
+% \bookcovercomponent{color}{front typing area}{red!50}
+% \bookcovercomponent{color}{spine}{green!50!black}
+% \bookcovercomponent{color}{spine typing area}{green!50}
+% \bookcovercomponent{color}{spine bottom}{opacity=0.5}
% \end{bookcover}
+%
% \end{document}
% \end{examplelst}
%
-% \section{Examples}
-% \subsection{A dust jacket}
+% \newpage\subsection{A dust jacket}
+%
% \begin{center}
% \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{bookcover-example1}}
% \end{center}
% \lstinputlisting[style=examplefile]{bookcover-example1.tex}
%
-% \subsection{Barcode}
-% \begin{center}
-% \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{figures/bookcover-barcode}}
-% \end{center}
-% \begin{examplelst}
-% \documentclass{bookcover}
-% % The pdflatex or lualatex should be called with the -shell-escape option.
-% % The next line is only required for pdflatex and lualatex.
-% \usepackage[pdfcrop={-hires}]{auto-pst-pdf}
-% \usepackage{pst-barcode}
-% \begin{document}
-% \begin{bookcover}
-% \bookcovercomponent{normal}{back}[0mm,5mm,0mm,0mm]{
-% \vfill
-% \centering
-% \begin{pspicture}(1.5in,1in)
-% \psbarcode{1787-6117}{includetext height=1 width=1.5}{issn}
-% \end{pspicture}}
-% \end{bookcover}
-% \end{document}
-% \end{examplelst}
+% \newpage\subsection{A two-sided book cover}\label{subsec-two-sided-example}
%
-% \subsection{A two-sided book cover}\label{subsec-two-sided-example}
% \begin{center}
% \fcolorbox{black!50}{white}{\includegraphics[page=1,width=\textwidth-.8pt]{bookcover-example2}}\\[5mm]
% \fcolorbox{black!50}{white}{\includegraphics[page=2,width=\textwidth-.8pt]{bookcover-example2}}
% \end{center}
% \lstinputlisting[style=examplefile]{bookcover-example2.tex}
%
-% \subsection{Trimming and checking dimensions}\label{subsec:trimming}
+% \newpage\subsection{Trimming and checking dimensions}\label{subsec:trimming}
+%
+% \begin{center}
+% \fcolorbox{black!50}{white}{\includegraphics[page=1,width=\textwidth-.8pt]{figures/bookcover-trimming}}\\[5mm]
+% \fcolorbox{black!50}{white}{\includegraphics[page=2,width=\textwidth-.8pt]{figures/bookcover-trimming}}
+% \end{center}
%
-% The next example shows the usage of the \texttt{trimmed} option and the |\bookcovertrimmedpart| command. These allow you to view the finished product for demonstration purposes. We also check the cover dimensions. Set the value of the \texttt{trimmed} option \texttt{false} and clear \texttt{ruler} component type before printing!
+% This example shows the usage of the \texttt{trimmed} option and the |\bookcovertrimmedpart| command. These allow you to view the finished product for demonstration purposes. We also check the cover dimensions. Set the value of the \texttt{trimmed} option \texttt{false} and clear \texttt{ruler} component type before printing!
%
-% \medskip
+% \bigskip
% \begin{examplelst}
-% \documentclass[markcolor=black,spinewidth=15mm,trimmed,trimmingcolor=gray]{bookcover}
+% \documentclass[
+% spinewidth=15mm,
+% markcolor=black,
+% trimmed,
+% trimmingcolor=gray,
+% ]{bookcover}
+%
% \usepackage[latin]{babel}
% \usepackage{lipsum,microtype}
%
@@ -649,33 +813,81 @@
% \end{document}
% \end{examplelst}
%
-% \newpage\begin{center}
-% \fcolorbox{black!50}{white}{\includegraphics[page=1,width=\textwidth-.8pt]{figures/bookcover-trimming}}\\[5mm]
-% \fcolorbox{black!50}{white}{\includegraphics[page=2,width=\textwidth-.8pt]{figures/bookcover-trimming}}
-% \end{center}%
-% \subsection{Adding description}\label{subsec:desc}
+% \newpage\subsection{A book cover with folding margin for hardcover book}
+%
+% \begin{center}
+% \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{figures/bookcover-foldingmargin}}
+% \end{center}
+%
% \begin{examplelst}
-% \documentclass{bookcover}
-% \usepackage[latin]{babel}
-% \usepackage{lipsum,multicol,microtype}
-% \bookcoverdescgeometry{vmargin=25mm,hmargin=9cm}
+% \documentclass[
+% coverwidth=150mm,
+% coverheight=220mm,
+% spinewidth=25mm,
+% bleedwidth=20mm,
+% markcolor=black,
+% foldingmargin,
+% 12pt,
+% % trimmed % Show only trimmed part!
+% ]{bookcover}
%
-% \begin{document}
+% %\bookcovertrimmedpart{front} % Trimmed part is the front cover
+% %\bookcovertrimmedpart{back} % Trimmed part is the back cover
+% %\bookcovertrimmedpart{spine} % Trimmed part is the spine
%
-% % Description text
-% \begin{bookcoverdescription}
-% \title{Description}
-% \author{John Taylor}
-% \date{}
-% \maketitle
-% \begin{multicols}{3}
-% \lipsum
-% \end{multicols}
-% \end{bookcoverdescription}
+% \letnamebookcoverpart{front with margin}{front}[5mm,5mm,5mm,5mm]
+% \letnamebookcoverpart{front upper third}{front with margin}[,2\partheight/3,,]
+% \letnamebookcoverpart{front lower third}{front with margin}[,,,2\partheight/3]
+% \letnamebookcoverpart{back with margin}{back}[5mm,5mm,5mm,5mm]
+% \letnamebookcoverpart{back text area}{back}[27mm,,22mm,27mm]
+% \letnamebookcoverpart{bg spine bottom}{bg spine}[,,,\partheight-\bleedwidth-\spinewidth]
+%
+% \newbookcovercomponenttype{center rotate}{
+% \vfill\centering\rotatebox[origin=c]{-90}{#1}\vfill}
+%
+% \usepackage[english]{babel}
+% \usepackage{kantlipsum,microtype}
+% \usepackage{transparent} % It works only with pdflatex
+%
+% \begin{document}
%
-% % Book cover
% \begin{bookcover}
-% \bookcovercomponent{center}{front}{\Huge TITULUS LIBRIA}
+%
+% \bookcovercomponent{color}{bg whole}{orange}
+%
+% \bookcovercomponent{color}{front upper third}{red!60!black}
+%
+% \bookcovercomponent{color}{front lower third}{red!60!black}
+%
+% \bookcovercomponent{color}{back with margin}{red!60!black}
+%
+% \bookcovercomponent{tikz}{front with margin}{
+% \draw[opacity=0.4,red,line width=10mm] (\partwidth-15mm,0) -- +(0,\partheight);}
+%
+% \bookcovercomponent{tikz}{back with margin}{
+% \draw[opacity=0.4,red,line width=10mm] (15mm,0) -- +(0,\partheight);}
+%
+% \bookcovercomponent{tikz}{whole}[5mm,,5mm,]{
+% \draw[opacity=0.4,red,line width=10mm] (0,\partheight-20mm) -- +(\partwidth,0);}
+%
+% \bookcovercomponent{color}{bg spine bottom}{black}
+%
+% \bookcovercomponent{center}{front upper third}{
+% \resizebox*{\partwidth-5mm}{\partheight-5mm}{%
+% \color{white}\transparent{0.1}\bfseries\LaTeX}}
+%
+% \bookcovercomponent{center}{front lower third}{
+% \resizebox*{\partwidth-5mm}{\partheight-5mm}{%
+% \color{white}\transparent{0.1}\bfseries\LaTeX}}
+%
+% \bookcovercomponent{center}{front}{
+% \resizebox{90mm}{!}{\bfseries\color{white}\LaTeX}}
+%
+% \bookcovercomponent{normal}{back text area}{\color{white}\kant[1-2]}
+%
+% \bookcovercomponent{center rotate}{spine}{
+% \resizebox{50mm}{!}{\bfseries\color{white}\LaTeX}}
+%
% \end{bookcover}
%
% \end{document}
@@ -704,6 +916,7 @@
\DeclareStringOption[white]{pagecolor}
\DeclareStringOption[white]{trimmingcolor}
\DeclareBoolOption[false]{trimmed}
+\DeclareBoolOption[false]{foldingmargin}
\ProcessKeyvalOptions{bookcover}
%% CLASS AND PACKAGES
@@ -734,7 +947,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@}
@@ -751,9 +967,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}
@@ -803,8 +1018,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}}}}
@@ -828,6 +1043,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
@@ -852,8 +1076,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
@@ -873,16 +1096,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%
@@ -928,10 +1169,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
@@ -975,7 +1218,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@}
@@ -989,26 +1232,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)}