texlive[57151] Master/texmf-dist: bookcover (16dec20)

commits+karl at tug.org commits+karl at tug.org
Wed Dec 16 22:29:49 CET 2020


Revision: 57151
          http://tug.org/svn/texlive?view=revision&revision=57151
Author:   karl
Date:     2020-12-16 22:29:48 +0100 (Wed, 16 Dec 2020)
Log Message:
-----------
bookcover (16dec20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example1.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example1.tex
    trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example2.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example2.tex
    trunk/Master/texmf-dist/doc/latex/bookcover/bookcover.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-barcode.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-parts.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-tikz.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-tikzclip.pdf
    trunk/Master/texmf-dist/source/latex/bookcover/bookcover.dtx
    trunk/Master/texmf-dist/tex/latex/bookcover/bookcover.cls

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-description.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-dustjacket.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-foldingmargin.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-margins.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-foldingmargin.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withflaps.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withoutflaps.pdf

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-einstein.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-result.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme.pdf
    trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-sizes.pdf

Modified: trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example1.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example1.tex	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example1.tex	2020-12-16 21:29:48 UTC (rev 57151)
@@ -1,5 +1,10 @@
-\documentclass[coverwidth=15cm,coverheight=20cm,spinewidth=25mm,
-               flapwidth=6cm,wrapwidth=5mm]{bookcover}
+\documentclass[
+    coverwidth=15cm,
+    coverheight=20cm,
+    spinewidth=25mm,
+    flapwidth=6cm,
+    wrapwidth=5mm,
+    ]{bookcover}
 
 \newbookcovercomponenttype{center rotate}{
     \vfill
@@ -9,8 +14,8 @@
 
 \usepackage[outline]{contour}% It doesn't work with xelatex and lualatex
 \contourlength{1pt}
-\usepackage[latin]{babel}
-\usepackage{lipsum,microtype}
+\usepackage[english]{babel}
+\usepackage{kantlipsum,microtype}
 
 \begin{document}
 
@@ -67,12 +72,12 @@
 
 % Text on the back cover
 \begin{bookcoverelement}{normal}{back}[2cm,2cm,2cm,2cm]
-    \color{white}\lipsum[1]
+    \color{white}\kant[1]
 \end{bookcoverelement}
 
 % Text and picture on the front flap
 \begin{bookcoverelement}{normal}{front flap}[1cm,1cm,1cm,2cm]
-    \color{white}\lipsum[2]
+    \color{white}\kant[2]
     \vfill
     {\centering\includegraphics{./figures/bookcover-dice.pdf}\par}
 \end{bookcoverelement}
@@ -79,7 +84,7 @@
 
 % Text on the back flap
 \begin{bookcoverelement}{normal}{back flap}[1cm,2cm,1cm,2cm]
-    \color{white}\lipsum[2]
+    \color{white}\kant[3]
 \end{bookcoverelement}
 
 \end{bookcover}

Modified: trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example2.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example2.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example2.tex	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/doc/latex/bookcover/bookcover-example2.tex	2020-12-16 21:29:48 UTC (rev 57151)
@@ -1,10 +1,17 @@
-\documentclass[markcolor=black,spinewidth=15mm]{bookcover}
+\documentclass[
+    spinewidth=15mm,
+    markcolor=black,
+    ]{bookcover}
+
 \usepackage[latin]{babel}
 \usepackage{lipsum,microtype}
 
 \begin{document}
 
+% ----------------------------------------------------------------------
 % Outside cover
+% ----------------------------------------------------------------------
+
 \begin{bookcover}
 
 % Remark
@@ -45,7 +52,10 @@
 
 \end{bookcover}
 
+% ----------------------------------------------------------------------
 % Inside cover
+% ----------------------------------------------------------------------
+
 \begin{bookcover}
 
 % Remark

Modified: trunk/Master/texmf-dist/doc/latex/bookcover/bookcover.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-barcode.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-description.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-description.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-description.pdf	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-description.pdf	2020-12-16 21:29:48 UTC (rev 57151)

Property changes on: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-description.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-dustjacket.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-dustjacket.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-dustjacket.pdf	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-dustjacket.pdf	2020-12-16 21:29:48 UTC (rev 57151)

Property changes on: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-dustjacket.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-einstein.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-foldingmargin.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-foldingmargin.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-foldingmargin.pdf	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-foldingmargin.pdf	2020-12-16 21:29:48 UTC (rev 57151)

Property changes on: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-foldingmargin.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-margins.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-margins.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-margins.pdf	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-margins.pdf	2020-12-16 21:29:48 UTC (rev 57151)

Property changes on: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-margins.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-parts.pdf
===================================================================
(Binary files differ)

Deleted: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-result.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-foldingmargin.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-foldingmargin.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-foldingmargin.pdf	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-foldingmargin.pdf	2020-12-16 21:29:48 UTC (rev 57151)

Property changes on: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-foldingmargin.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withflaps.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withflaps.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withflaps.pdf	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withflaps.pdf	2020-12-16 21:29:48 UTC (rev 57151)

Property changes on: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withflaps.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withoutflaps.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withoutflaps.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withoutflaps.pdf	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withoutflaps.pdf	2020-12-16 21:29:48 UTC (rev 57151)

Property changes on: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme-withoutflaps.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-scheme.pdf
===================================================================
(Binary files differ)

Deleted: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-sizes.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-tikz.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/bookcover/figures/bookcover-tikzclip.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/bookcover/bookcover.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/bookcover/bookcover.dtx	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/source/latex/bookcover/bookcover.dtx	2020-12-16 21:29:48 UTC (rev 57151)
@@ -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,26 +133,39 @@
 % \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}
 % \documentclass[!<options>!]{bookcover}
@@ -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,7 +254,7 @@
 %     \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}
@@ -234,42 +261,184 @@
 % \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}
-% 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:
+% \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}
+%
+% \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,160 +606,142 @@
 % \end{document}
 % \end{examplelst}
 %
-% \section{Parts}\label{sec:parts}
+% \newpage\section{Examples}
 %
-% 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}.
+% \subsection{Barcode and QR code}
 %
-% 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.
+% \begin{center}
+% \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{figures/bookcover-barcode}}
+% \end{center}
 %
-% 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{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}
 %
-% \subsection{Book cover widthout flaps, background parts}
+% \begin{document}
 %
-% \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{bookcover}
 %
-% \subsection{Book cover widthout flaps, foreground parts}
+% \bookcovercomponent{color}{bg whole}{blue!50}
 %
-% \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{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}}}
 %
-% \subsection{Book cover widthout flaps, other parts}
+% \end{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}<17\repeat
-% \fbox{\includegraphics[page=\thepartfig]{figures/bookcover-parts.pdf}}\stepcounter{partfig}
+% \end{document}
+% \end{examplelst}
 %
-% \subsection{Book cover width flaps, background parts}
+% \newpage\subsection{Description}\label{subsec:desc}
 %
-% \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
+% \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}
 %
-% \subsection{Book cover width flaps, foreground parts}
+% \newpage
+% \begin{examplelst}
+% \documentclass[markcolor=black,spinewidth=15mm]{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}<74\repeat
+% \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}
 %
-% \subsection{Book cover width flaps, other parts}
+% \newpage\subsection{Usage of margins}
 %
-% \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}}
+% \begin{center}
+% \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{figures/bookcover-margins}}
+% \end{center}
 %
-% \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{examplelst}
+% \documentclass[spinewidth=30mm]{bookcover}
+% \begin{document}
 %
-% \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{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}
 %
-% 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.
+% \end{document}
+% \end{examplelst}
 %
-% 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}
+% or its equivalent
 %
-% \begin{center}
-% \includegraphics{./figures/bookcover-newpart}
-% \end{center}
+% \bigskip
+% \begin{examplelst}
+% \documentclass[spinewidth=30mm]{bookcover}
 %
-% To give the previous lengths, you can use the following length commands, which are declared by the options of the document class:
+% \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]
 %
-% \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}
+% \begin{document}
 %
-% \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}}
@@ -595,13 +748,24 @@
 % \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}
 %
-% 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!
+% \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}
 %
-% \medskip
+% 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!
+%
+% \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}
 % 
+% %\bookcovertrimmedpart{front} % Trimmed part is the front cover
+% %\bookcovertrimmedpart{back} % Trimmed part is the back cover
+% %\bookcovertrimmedpart{spine} % Trimmed part is the spine
+% 
+% \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}
 % 
-% % Description text
-% \begin{bookcoverdescription}
-%     \title{Description}
-%     \author{John Taylor}
-%     \date{}
-%     \maketitle
-%     \begin{multicols}{3}
-%         \lipsum
-%     \end{multicols}
-% \end{bookcoverdescription}
+% \begin{bookcover}
 % 
-% % 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 at templength@}
+\newlength{\bookcover at templength@a}
+\newlength{\bookcover at templength@b}
+\newlength{\bookcover at templength@c}
+\newlength{\bookcover at templength@d}
 \newlength{\bookcover at xpos@}
 \newlength{\bookcover at ypos@}
 \newlength{\bookcover at partwidth@}
@@ -751,9 +967,8 @@
 \setlength{\coverwidth}{\bookcover at coverwidth}
 \setlength{\coverheight}{\bookcover at coverheight}
 \setlength{\spinewidth}{\bookcover at spinewidth}
-\setlength{\flapwidth}{\bookcover at flapwidth}
-\setlength{\wrapwidth}{\bookcover at wrapwidth}
-\ifdim\flapwidth=0pt\setlength{\wrapwidth}{0pt}\fi
+\ifbookcover at foldingmargin\else\setlength{\flapwidth}{\bookcover at flapwidth}\fi
+\ifdim\flapwidth>0pt\setlength{\wrapwidth}{\bookcover at wrapwidth}\fi
 \setlength{\marklength}{\bookcover at marklength}
 \setlength{\markthick}{\bookcover at markthick}
 \setlength{\bleedwidth}{\bookcover at bleedwidth}
@@ -803,8 +1018,8 @@
 %% POSBOX
 
 \newcommand{\bookcover at posbox}[5]{%
-    \setlength{\bookcover at templength@}{#4}%
-    \put(#3,-\bookcover at templength@){%
+    \setlength{\bookcover at templength@a}{#4}%
+    \put(#3,-\bookcover at 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 at 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 at trimmedpart{#1}\def\bookcover at trimmedmargin{#2}}
-\def\bookcover at trimmedpart{bookcoverpart at whole}
-\def\bookcover at trimmedmargin{,,,}
+\bookcovertrimmedpart{bookcoverpart at whole}
 
 %% BOOKCOVER ENVIRONMENT
 
@@ -873,16 +1096,34 @@
 %% BOOKCOVER COMPONENT
 
 \def\bookcover at setpartmargin(#1,#2,#3,#4){%
-    \ifblank{#1}{}{%
-        \addtolength{\bookcover at xpos@}{#1}%
-        \addtolength{\bookcover at partwidth@}{-#1}}%
-    \ifblank{#2}{}{%
-        \addtolength{\bookcover at partheight@}{-#2}}%
-    \ifblank{#3}{}{%
-        \addtolength{\bookcover at partwidth@}{-#3}}%
-    \ifblank{#4}{}{%
-        \addtolength{\bookcover at ypos@}{#4}%
-        \addtolength{\bookcover at partheight@}{-#4}}}
+    \setlength{\bookcover at templength@a}{0mm}
+    \setlength{\bookcover at templength@b}{0mm}
+    \setlength{\bookcover at templength@c}{0mm}
+    \setlength{\bookcover at templength@d}{0mm}
+    \ifblank{#1}{}{\setlength{\bookcover at templength@a}{#1}}%
+    \ifblank{#2}{}{\setlength{\bookcover at templength@b}{#2}}%
+    \ifblank{#3}{}{\setlength{\bookcover at templength@c}{#3}}%
+    \ifblank{#4}{}{\setlength{\bookcover at templength@d}{#4}}%
+    \addtolength{\bookcover at xpos@}{\bookcover at templength@a}%
+    \addtolength{\bookcover at partwidth@}{-\bookcover at templength@a}%
+    \addtolength{\bookcover at partheight@}{-\bookcover at templength@b}%
+    \addtolength{\bookcover at partwidth@}{-\bookcover at templength@c}%
+    \addtolength{\bookcover at ypos@}{\bookcover at templength@d}%
+    \addtolength{\bookcover at partheight@}{-\bookcover at templength@d}%
+    \ifdim\bookcover at tikz@trimmed at part@width at minus>\dimexpr\bookcover at tikz@trimmed at part@push at right+\bookcover at templength@c\relax%
+        \addtolength{\bookcover at tikz@trimmed at part@width at minus}{-\bookcover at tikz@trimmed at part@push at right-\bookcover at templength@c}%
+        \else\setlength{\bookcover at tikz@trimmed at part@width at minus}{0mm}\fi%
+    \ifdim\bookcover at tikz@trimmed at part@push at right>\bookcover at templength@a%
+        \addtolength{\bookcover at tikz@trimmed at part@push at right}{-\bookcover at templength@a}%
+        \else\setlength{\bookcover at tikz@trimmed at part@push at right}{0mm}\fi%
+    \addtolength{\bookcover at tikz@trimmed at part@width at minus}{\bookcover at tikz@trimmed at part@push at right}%
+    \ifdim\bookcover at tikz@trimmed at part@height at minus>\dimexpr\bookcover at tikz@trimmed at part@push at up+\bookcover at templength@d\relax%
+        \addtolength{\bookcover at tikz@trimmed at part@height at minus}{-\bookcover at tikz@trimmed at part@push at up-\bookcover at templength@d}%
+        \else\setlength{\bookcover at tikz@trimmed at part@height at minus}{0mm}\fi%
+    \ifdim\bookcover at tikz@trimmed at part@push at up>\bookcover at templength@b%
+        \addtolength{\bookcover at tikz@trimmed at part@push at up}{-\bookcover at templength@b}%
+        \else\setlength{\bookcover at tikz@trimmed at part@push at up}{0mm}\fi%
+    \addtolength{\bookcover at tikz@trimmed at part@height at minus}{\bookcover at tikz@trimmed at part@push at up}}
 
 \NewDocumentCommand{\bookcovercomponent}{ m m O{,,,} +m }{%
     \if at inbookcoverenv\else%
@@ -928,10 +1169,12 @@
 
 %% LET NAME BOOKCOVER PART
 
-\def\letnamebookcoverpart#1#2{%
+\NewDocumentCommand{\letnamebookcoverpart}{ m m O{,,,} }{%
     \@ifundefined{bookcover at part@param@#1}{%
         \@ifundefined{bookcover at part@param@#2}{\@latexerr{Part '#2' is undefined.}{}}{%
-            \csletcs{bookcover at part@param@#1}{bookcover at part@param@#2}}}
+            \csletcs{bookcover at part@baseparam@#1}{bookcover at part@param@#2}%
+            \protected at csedef{bookcover at part@margin@#1}{\bookcover at setpartmargin(#3)}%
+            \protected at csedef{bookcover at part@param@#1}{\csuse{bookcover at part@baseparam@#1}\csuse{bookcover at part@margin@#1}}}}
     {\@latexerr{Part '#1' is already defined.}{}}}
 
 %% NEW BOOKCOVER COMPONENT TYPE
@@ -975,7 +1218,7 @@
 \newbookcovercomponenttype{picture}{%
     \includegraphics[width=\bookcover at partwidth@,height=\bookcover at partheight@]{#1}}
 
-\newbookcovercomponenttype{tikz}{%
+\long\def\bookcover at tikz@content#1{%
     \begin{tikzpicture}[overlay,yshift=-\bookcover at partheight@]
     \begin{scope}[transparent,line width=0pt]
         \pgfset{minimum width=\bookcover at partwidth@,minimum height=\bookcover at partheight@}
@@ -989,26 +1232,15 @@
     #1
     \end{tikzpicture}}
 
+\newbookcovercomponenttype{tikz}{\bookcover at tikz@content{#1}}
+
 \letnamebookcovercomponenttype{bookcovertype at tikz}{tikz} % bookcovertype at tikz is protected type
 
-\newbookcovercomponenttype{tikz clip}{%
-    \begin{tikzpicture}[overlay,yshift=-\bookcover at partheight@]
-    \begin{scope}[transparent,line width=0pt]
-        \pgfset{minimum width=\bookcover at partwidth@,minimum height=\bookcover at partheight@}
-        \pgfnode{rectangle}{south west}{}{part}{\pgfusepath{draw}}
-        \pgfset{minimum width=\bookcover at partwidth@-\bookcover at tikz@trimmed at part@width at minus,
-                minimum height=\bookcover at partheight@-\bookcover at tikz@trimmed at part@height at minus}
-        \pgftransformshift{\pgfpoint{\bookcover at tikz@trimmed at part@push at right}
-                                    {\bookcover at tikz@trimmed at part@push at 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 at 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 at setruler\expandafter(#1)}
 

Modified: trunk/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bookcover/bookcover.cls	2020-12-16 04:19:58 UTC (rev 57150)
+++ trunk/Master/texmf-dist/tex/latex/bookcover/bookcover.cls	2020-12-16 21:29:48 UTC (rev 57151)
@@ -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 at templength@}
+\newlength{\bookcover at templength@a}
+\newlength{\bookcover at templength@b}
+\newlength{\bookcover at templength@c}
+\newlength{\bookcover at templength@d}
 \newlength{\bookcover at xpos@}
 \newlength{\bookcover at ypos@}
 \newlength{\bookcover at partwidth@}
@@ -87,9 +91,8 @@
 \setlength{\coverwidth}{\bookcover at coverwidth}
 \setlength{\coverheight}{\bookcover at coverheight}
 \setlength{\spinewidth}{\bookcover at spinewidth}
-\setlength{\flapwidth}{\bookcover at flapwidth}
-\setlength{\wrapwidth}{\bookcover at wrapwidth}
-\ifdim\flapwidth=0pt\setlength{\wrapwidth}{0pt}\fi
+\ifbookcover at foldingmargin\else\setlength{\flapwidth}{\bookcover at flapwidth}\fi
+\ifdim\flapwidth>0pt\setlength{\wrapwidth}{\bookcover at wrapwidth}\fi
 \setlength{\marklength}{\bookcover at marklength}
 \setlength{\markthick}{\bookcover at markthick}
 \setlength{\bleedwidth}{\bookcover at bleedwidth}
@@ -139,8 +142,8 @@
 %% POSBOX
 
 \newcommand{\bookcover at posbox}[5]{%
-    \setlength{\bookcover at templength@}{#4}%
-    \put(#3,-\bookcover at templength@){%
+    \setlength{\bookcover at templength@a}{#4}%
+    \put(#3,-\bookcover at 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 at 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 at trimmedpart{#1}\def\bookcover at trimmedmargin{#2}}
-\def\bookcover at trimmedpart{bookcoverpart at whole}
-\def\bookcover at trimmedmargin{,,,}
+\bookcovertrimmedpart{bookcoverpart at whole}
 
 %% BOOKCOVER ENVIRONMENT
 
@@ -209,16 +220,34 @@
 %% BOOKCOVER COMPONENT
 
 \def\bookcover at setpartmargin(#1,#2,#3,#4){%
-    \ifblank{#1}{}{%
-        \addtolength{\bookcover at xpos@}{#1}%
-        \addtolength{\bookcover at partwidth@}{-#1}}%
-    \ifblank{#2}{}{%
-        \addtolength{\bookcover at partheight@}{-#2}}%
-    \ifblank{#3}{}{%
-        \addtolength{\bookcover at partwidth@}{-#3}}%
-    \ifblank{#4}{}{%
-        \addtolength{\bookcover at ypos@}{#4}%
-        \addtolength{\bookcover at partheight@}{-#4}}}
+    \setlength{\bookcover at templength@a}{0mm}
+    \setlength{\bookcover at templength@b}{0mm}
+    \setlength{\bookcover at templength@c}{0mm}
+    \setlength{\bookcover at templength@d}{0mm}
+    \ifblank{#1}{}{\setlength{\bookcover at templength@a}{#1}}%
+    \ifblank{#2}{}{\setlength{\bookcover at templength@b}{#2}}%
+    \ifblank{#3}{}{\setlength{\bookcover at templength@c}{#3}}%
+    \ifblank{#4}{}{\setlength{\bookcover at templength@d}{#4}}%
+    \addtolength{\bookcover at xpos@}{\bookcover at templength@a}%
+    \addtolength{\bookcover at partwidth@}{-\bookcover at templength@a}%
+    \addtolength{\bookcover at partheight@}{-\bookcover at templength@b}%
+    \addtolength{\bookcover at partwidth@}{-\bookcover at templength@c}%
+    \addtolength{\bookcover at ypos@}{\bookcover at templength@d}%
+    \addtolength{\bookcover at partheight@}{-\bookcover at templength@d}%
+    \ifdim\bookcover at tikz@trimmed at part@width at minus>\dimexpr\bookcover at tikz@trimmed at part@push at right+\bookcover at templength@c\relax%
+        \addtolength{\bookcover at tikz@trimmed at part@width at minus}{-\bookcover at tikz@trimmed at part@push at right-\bookcover at templength@c}%
+        \else\setlength{\bookcover at tikz@trimmed at part@width at minus}{0mm}\fi%
+    \ifdim\bookcover at tikz@trimmed at part@push at right>\bookcover at templength@a%
+        \addtolength{\bookcover at tikz@trimmed at part@push at right}{-\bookcover at templength@a}%
+        \else\setlength{\bookcover at tikz@trimmed at part@push at right}{0mm}\fi%
+    \addtolength{\bookcover at tikz@trimmed at part@width at minus}{\bookcover at tikz@trimmed at part@push at right}%
+    \ifdim\bookcover at tikz@trimmed at part@height at minus>\dimexpr\bookcover at tikz@trimmed at part@push at up+\bookcover at templength@d\relax%
+        \addtolength{\bookcover at tikz@trimmed at part@height at minus}{-\bookcover at tikz@trimmed at part@push at up-\bookcover at templength@d}%
+        \else\setlength{\bookcover at tikz@trimmed at part@height at minus}{0mm}\fi%
+    \ifdim\bookcover at tikz@trimmed at part@push at up>\bookcover at templength@b%
+        \addtolength{\bookcover at tikz@trimmed at part@push at up}{-\bookcover at templength@b}%
+        \else\setlength{\bookcover at tikz@trimmed at part@push at up}{0mm}\fi%
+    \addtolength{\bookcover at tikz@trimmed at part@height at minus}{\bookcover at tikz@trimmed at part@push at up}}
 
 \NewDocumentCommand{\bookcovercomponent}{ m m O{,,,} +m }{%
     \if at inbookcoverenv\else%
@@ -264,10 +293,12 @@
 
 %% LET NAME BOOKCOVER PART
 
-\def\letnamebookcoverpart#1#2{%
+\NewDocumentCommand{\letnamebookcoverpart}{ m m O{,,,} }{%
     \@ifundefined{bookcover at part@param@#1}{%
         \@ifundefined{bookcover at part@param@#2}{\@latexerr{Part '#2' is undefined.}{}}{%
-            \csletcs{bookcover at part@param@#1}{bookcover at part@param@#2}}}
+            \csletcs{bookcover at part@baseparam@#1}{bookcover at part@param@#2}%
+            \protected at csedef{bookcover at part@margin@#1}{\bookcover at setpartmargin(#3)}%
+            \protected at csedef{bookcover at part@param@#1}{\csuse{bookcover at part@baseparam@#1}\csuse{bookcover at part@margin@#1}}}}
     {\@latexerr{Part '#1' is already defined.}{}}}
 
 %% NEW BOOKCOVER COMPONENT TYPE
@@ -311,7 +342,7 @@
 \newbookcovercomponenttype{picture}{%
     \includegraphics[width=\bookcover at partwidth@,height=\bookcover at partheight@]{#1}}
 
-\newbookcovercomponenttype{tikz}{%
+\long\def\bookcover at tikz@content#1{%
     \begin{tikzpicture}[overlay,yshift=-\bookcover at partheight@]
     \begin{scope}[transparent,line width=0pt]
         \pgfset{minimum width=\bookcover at partwidth@,minimum height=\bookcover at partheight@}
@@ -325,26 +356,15 @@
     #1
     \end{tikzpicture}}
 
+\newbookcovercomponenttype{tikz}{\bookcover at tikz@content{#1}}
+
 \letnamebookcovercomponenttype{bookcovertype at tikz}{tikz} % bookcovertype at tikz is protected type
 
-\newbookcovercomponenttype{tikz clip}{%
-    \begin{tikzpicture}[overlay,yshift=-\bookcover at partheight@]
-    \begin{scope}[transparent,line width=0pt]
-        \pgfset{minimum width=\bookcover at partwidth@,minimum height=\bookcover at partheight@}
-        \pgfnode{rectangle}{south west}{}{part}{\pgfusepath{draw}}
-        \pgfset{minimum width=\bookcover at partwidth@-\bookcover at tikz@trimmed at part@width at minus,
-                minimum height=\bookcover at partheight@-\bookcover at tikz@trimmed at part@height at minus}
-        \pgftransformshift{\pgfpoint{\bookcover at tikz@trimmed at part@push at right}
-                                    {\bookcover at tikz@trimmed at part@push at 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 at 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 at setruler\expandafter(#1)}
 



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