diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/bookcover')
-rw-r--r-- | Master/texmf-dist/source/latex/bookcover/bookcover.dtx | 230 |
1 files changed, 135 insertions, 95 deletions
diff --git a/Master/texmf-dist/source/latex/bookcover/bookcover.dtx b/Master/texmf-dist/source/latex/bookcover/bookcover.dtx index b9ab7e69ccd..876bae71424 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/11/12} -\newcommand{\eifilever}{v2.4} +\newcommand{\eifiledate}{2020/11/16} +\newcommand{\eifilever}{v2.5} %</driver> %<class> -%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01] -%<class>\ProvidesClass{bookcover}[2020/11/12 v2.4 class for book covers and dust jackets] +%<class>\NeedsTeXFormat{LaTeX2e}[2020/10/01] +%<class>\ProvidesClass{bookcover}[2020/11/16 v2.5 class for book covers and dust jackets] % %<*driver> \documentclass{ltxdoc} @@ -131,7 +131,7 @@ % % \section{Loading class} % The class \texttt{bookcover} requires the services of the class \texttt{article} and the following packages: -% \texttt{kvoptions}, \texttt{geometry}, \texttt{graphicx}, \texttt{calc}, \texttt{ifthen}, \texttt{tikz}, \texttt{fgruler}. +% \texttt{kvoptions}, \texttt{geometry}, \texttt{graphicx}, \texttt{calc}, \texttt{ifthen}, \texttt{tikz}, \texttt{environ}, \texttt{fgruler}. % % \medskip\noindent % Load the class as usual, with @@ -168,26 +168,29 @@ % \end{examplelst} % % \section{Creating book cover}\label{sec:mainmethod} -% \subsection{Commands} -% Use \commandinline{bookcover} environment to make a new book cover. In this environment, you can create a component of the book cover by the following command: +% \subsection{Commands and environments} +% Use \commandinline{bookcover} environment in the body of the document to make a new book cover. In this environment, you can create a component of the book cover by the following command or environment: % \begin{commandlst} % \bookcovercomponent{!<component type>!}{!<part>!}{!<content>!} % \end{commandlst} -% \meta{component type} See Subsection \ref{subsec:componenttypes}. -% -% \medskip\noindent -% \meta{part} See Subsection \ref{subsec:parts-main-method} or Section~\ref{sec:illustration-parts}. +% or +% \begin{commandlst} +% \begin{bookcoverelement}{!<component type>!}{!<part>!} +% !<content>! +% \end{bookcoverelement} +% \end{commandlst} +% See the subsection~\ref{subsec:componenttypes} for the description of \meta{component type}. You can read the description of \meta{part} in subsection~\ref{subsec:parts-main-method} and section~\ref{sec:illustration-parts}. The \meta{content} depends on the \meta{component type} (see subsection~\ref{subsec:componenttypes}). % % \medskip\noindent -% \meta{content} It depends on the \meta{component type}. See Subsection \ref{subsec:componenttypes}. +% 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. % % \medskip\noindent -% Every |\bookcovercomponent| generates a layer on the sheet. The first one generates the bottom layer and the last one generates the top layer. +% The following two examples are equivalent. % -% \bigskip\noindent\example +% \medskip\noindent\example % \begin{examplelst} % \begin{bookcover} -% \bookcovercomponent{color}{bg whole}{color=blue} +% \bookcovercomponent{color}{bg whole}{blue} % \bookcovercomponent{normal}{front}{ % \vspace{5cm} % \begin{center} @@ -196,8 +199,29 @@ % \end{bookcover} % \end{examplelst} % +% \noindent\example +% \begin{examplelst} +% \begin{bookcover} +% \begin{bookcoverelement}{color}{bg whole} +% blue +% \end{bookcoverelement} +% \begin{bookcoverelement}{normal}{front} +% \vspace{5cm} +% \begin{center} +% \bfseries\huge Book title +% \end{center} +% \end{bookcoverelement} +% \end{bookcover} +% \end{examplelst} +% +% \noindent Use \commandinline{bookcoverdescription} environment in the body of the document 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} +% See the \meta{geometry parameteres} in the |geometry| package. Its default value is |margin=1in|. See an example in the subsection~\ref{subsec:desc}. +% % \subsection{Parts}\label{subsec:parts-main-method} -% Important: The background parts are expanded onto the bleed, taking account of slight inaccuracy when trimming! +% It is important, that the background parts are expanded onto the bleed, taking account of slight inaccuracy when trimming! % \subsubsection{One-piece background parts} % \commandinline{bg back flap}, \commandinline{bg back}, \commandinline{bg spine}, \commandinline{bg front}, \commandinline{bg front flap} % @@ -223,7 +247,7 @@ % \end{center} % % \subsubsection{Combined parts} -% The following combined parts are defined. You can see illustrations in the Section~\ref{sec:illustration-parts}. +% The following combined parts are defined. You can see illustrations in the section~\ref{sec:illustration-parts}. % \begin{center} % \begin{tabular}{@{}>{\color{command}\ttfamily}l@{\hspace{1cm}}>{\color{command}\ttfamily}l@{}} % {\rmfamily\bfseries\textcolor{black}{background}}&{\rmfamily\bfseries\textcolor{black}{foreground}}\\ @@ -245,14 +269,11 @@ % \subsection{Component types}\label{subsec:componenttypes} % The following component types are defined: \commandinline{color}, \commandinline{picture}, \commandinline{tikz}, \commandinline{tikz clip}, \commandinline{normal}, \commandinline{center}, \commandinline{ruler}. % \subsubsection[color]{Component type: \texttt{color}} -% \begin{commandlst} -% \bookcovercomponent{color}{!<part>!}{!<colors>!} -% \end{commandlst} -% It determines the color of the part. +% It determines the color of the part. The \meta{content} is the options of the |\fill| in the \texttt{tikz} package: % -% \medskip\noindent -% \meta{colors} The options of the |\fill| in the \texttt{tikz} package:\label{page:color}\\ -% \indent\commandinline{color=!<color name>!} See \meta{color name} in the \texttt{xcolor} package.\\ +% \medskip +% \indent\commandinline{!<color name>!} (See it in the \texttt{xcolor} package.)\\ +% \indent\commandinline{color=!<color name>!} (It is equivalent to the previous one.)\\ % \indent\commandinline{top color=!<color name>!}\\ % \indent\commandinline{bottom color=!<color name>!}\\ % \indent\commandinline{middle color=!<color name>!}\\ @@ -261,43 +282,41 @@ % \indent\commandinline{ball color=!<color name>!}\\ % \indent\commandinline{shading angle=!<degree>!} It rotates the shading by the given angle. % -% \pagebreak\bigskip\noindent\example +% \bigskip\noindent\example +% \begin{examplelst} +% \bookcovercomponent{color}{bg whole without flaps}{red} +% \end{examplelst} +% +% \noindent\example\ It is equivalent to the previous example. % \begin{examplelst} -% \begin{bookcover} -% \bookcovercomponent{color}{bg whole without flaps}{ -% top color=white, bottom color=blue!50!black, shading angle=60} -% \end{bookcover} +% \bookcovercomponent{color}{bg whole without flaps}{color=red} +% \end{examplelst} +% +% \noindent\example +% \begin{examplelst} +% \bookcovercomponent{color}{bg whole without flaps}{ +% top color=white, bottom color=blue!50!black, shading angle=60} % \end{examplelst} % % \subsubsection[picture]{Component type: \texttt{picture}} -% \begin{commandlst} -% \bookcovercomponent{picture}{!<part>!}{!<picture file>!} -% \end{commandlst} -% The picture will be rescaled according to the sizes of the \meta{part}. +% The \meta{content} is a picture file, which will be rescaled according to the sizes of the \meta{part}. % % \bigskip\noindent\example % \begin{examplelst} -% \begin{bookcover} -% \bookcovercomponent{picture}{bg front flap}{fig.png} -% \end{bookcover} +% \bookcovercomponent{picture}{bg front flap}{fig.png} % \end{examplelst} % % \subsubsection[tikz]{Component type: \texttt{tikz}} -% \begin{commandlst} -% \bookcovercomponent{tikz}{!<part>!}{!<tikz code>!} -% \end{commandlst} -% The origin of the Ti\emph{k}Z figure is the lower left corner of the \meta{part}. Two rectangle nodes come into being: \commandinline{part} and \commandinline{trimmed part}. (Thanks to Zunbeltz Izaola for the idea.) +% The \meta{content} is a Ti\emph{k}Z code without |\tikz| command and |tikzpicture| environment. The origin of the Ti\emph{k}Z figure is the lower left corner of the \meta{part}. Two rectangle nodes come into being: \commandinline{part} and \commandinline{trimmed part}. (Thanks to Zunbeltz Izaola for the idea.) % % \bigskip\noindent\example % \begin{examplelst} -% \begin{bookcover} % \bookcovercomponent{tikz}{bg whole}{ % \fill[yellow] (part.south west) rectangle (part.north east); % \fill[gray] (trimmed part.south east) rectangle (trimmed part.north west); % \draw[green] (0,0) circle [radius=10mm];} % \bookcovercomponent{tikz}{bg spine}{ % \fill[orange] (part.center) circle [radius=8mm];} -% \end{bookcover} % \end{examplelst} % \begin{center} % \setlength{\fboxsep}{0pt}\setlength{\fboxrule}{.4pt} @@ -305,21 +324,16 @@ % \end{center} % % \subsubsection[tikz clip]{Component type: \texttt{tikz clip}} -% \begin{commandlst} -% \bookcovercomponent{tikz clip}{!<part>!}{!<tikz code>!} -% \end{commandlst} % It works the same as the \texttt{tikz} component type, but it clips the \meta{part}. % % \bigskip\noindent\example % \begin{examplelst} -% \begin{bookcover} % \bookcovercomponent{tikz clip}{bg whole}{ % \fill[yellow] (part.south west) rectangle (part.north east); % \fill[gray] (trimmed part.south east) rectangle (trimmed part.north west); % \draw[green] (0,0) circle [radius=10mm];} % \bookcovercomponent{tikz clip}{bg spine}{ % \fill[orange] (part.center) circle [radius=8mm];} -% \end{bookcover} % \end{examplelst} % \begin{center} % \setlength{\fboxsep}{0pt}\setlength{\fboxrule}{.4pt} @@ -327,43 +341,33 @@ % \end{center} % % \subsubsection[normal]{Component type: \texttt{normal}} -% \begin{commandlst} -% \bookcovercomponent{normal}{!<part>!}{!<content>!} -% \end{commandlst} % In this case, the \meta{content} is not specific. You can choose it as text or picture etc. % % \bigskip\noindent\example % \begin{examplelst} -% \begin{bookcover} -% \bookcovercomponent{normal}{front}{ -% \vspace{5cm} -% \begin{center} -% {\bfseries\huge Book title}\\[5mm] -% \includegraphics[width=6cm]{fig.png} -% \end{center}} -% \end{bookcover} +% \bookcovercomponent{normal}{front}{ +% \vspace{5cm} +% \begin{center} +% {\bfseries\huge Book title}\\[5mm] +% \includegraphics[width=6cm]{fig.png} +% \end{center}} % \end{examplelst} % % \subsubsection[center]{Component type: \texttt{center}} -% \begin{commandlst} -% \bookcovercomponent{center}{!<part>!}{!<content>!} -% \end{commandlst} % It works the same as the \texttt{normal} component type, but the position of the content is the center of the part (horizontally and vertically). % % \bigskip\noindent\example % \begin{examplelst} -% \begin{bookcover} -% \bookcovercomponent{center}{above front}{ -% \color{blue}Remark above front} -% \bookcovercomponent{center}{spine}{ -% \rotatebox[origin=c]{90}{\bfseries\Large Book title}} -% \end{bookcover} +% \bookcovercomponent{center}{above front}{ +% \textcolor{blue}{Remark above front}} +% \bookcovercomponent{center}{spine}{ +% \rotatebox[origin=c]{90}{\bfseries\Large Book title}} % \end{examplelst} % % \subsubsection[ruler]{Component type: \texttt{ruler}} -% Use the \texttt{ruler} component type to check the sizes of the part. +% Use the \texttt{ruler} component type to check the sizes of the part. The \meta{content} is % \begin{commandlst} -% \bookcovercomponent{ruler}{!<part>!}{\setruler[!<unit>!]{!<coordsys>!}{!<shift x>!}{!<shift y>!}{!<color>!}} +% \setruler[!<unit>!]{!<coordsys>!}{!<shift x>!}{!<shift y>!}{!<color>!} % \end{commandlst} % \meta{unit} The ruler unit:\\ % \indent\commandinline{cm} Metric ruler (centimeter). Default value.\\ @@ -382,14 +386,12 @@ % \medskip\noindent % \meta{color} The color of the ruler. % -% \pagebreak\bigskip\noindent\example +% \bigskip\noindent\example % \begin{examplelst} -% \begin{bookcover} -% \bookcovercomponent{ruler}{back}{\setruler{upper left}{0cm}{0cm}{blue}} -% \bookcovercomponent{ruler}{back}{\setruler{upper left}{2cm}{1cm}{black}} -% \bookcovercomponent{ruler}{front}{\setruler{lower right}{0cm}{0cm}{green}} -% \bookcovercomponent{ruler}{front}{\setruler{lower right}{2cm}{1cm}{gray}} -% \end{bookcover} +% \bookcovercomponent{ruler}{back}{\setruler{upper left}{0cm}{0cm}{blue}} +% \bookcovercomponent{ruler}{back}{\setruler{upper left}{2cm}{1cm}{black}} +% \bookcovercomponent{ruler}{front}{\setruler{lower right}{0cm}{0cm}{green}} +% \bookcovercomponent{ruler}{front}{\setruler{lower right}{2cm}{1cm}{gray}} % \end{examplelst} % \begin{center} % \setlength{\fboxsep}{0pt}\setlength{\fboxrule}{.4pt} @@ -467,9 +469,9 @@ % \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{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} @@ -482,23 +484,27 @@ % \includepdf[pages=27-35,pagecommand={}]{figures/parts.pdf} % \includepdf[pages=43-52,pagecommand={\subsection{Foreground parts (cover widthout flaps)}}]{figures/parts.pdf} % -% \newpage\section{Full examples} +% \newpage\section{Examples} % \subsection{A dust jacket} -% \lstinputlisting[style=examplefile]{bookcover-example1.tex} % \begin{center} % \setlength{\fboxsep}{0pt}\setlength{\fboxrule}{.4pt} % \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{bookcover-example1}}\label{page:example1} % \end{center} +% \lstinputlisting[style=examplefile]{bookcover-example1.tex} % -% \subsection{A two-sided book cover} -% \lstinputlisting[style=examplefile]{bookcover-example2.tex} +% \newpage\subsection{A two-sided book cover} % \begin{center} % \setlength{\fboxsep}{0pt}\setlength{\fboxrule}{.4pt}% % \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} +% \newpage\lstinputlisting[style=examplefile]{bookcover-example2.tex} % -% \newpage\subsection{Barcode} +% \subsection{Barcode} +% \begin{center} +% \setlength{\fboxsep}{0pt}\setlength{\fboxrule}{.4pt} +% \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{figures/barcode}} +% \end{center} % \begin{examplelst} % \documentclass{bookcover} % \usepackage{pst-barcode} @@ -521,11 +527,31 @@ % \end{examplelst} % In this case, the \texttt{pdflatex} or \texttt{lualatex} must be called with the \texttt{-shell-escape} option. % -% \bigskip -% \begin{center} -% \setlength{\fboxsep}{0pt}\setlength{\fboxrule}{.4pt} -% \fcolorbox{black!50}{white}{\includegraphics[width=\textwidth-.8pt]{figures/barcode}} -% \end{center} +% \subsection{Adding description}\label{subsec:desc} +% \begin{examplelst} +% \documentclass{bookcover} +% \usepackage[latin]{babel} +% \usepackage{lipsum,multicol} +% \bookcoverdescgeometry{vmargin=25mm,hmargin=9cm} +% +% \begin{document} +% +% \begin{bookcoverdescription} +% \title{Description} +% \author{John Taylor} +% \date{} +% \maketitle +% \begin{multicols}{3} +% \lipsum +% \end{multicols} +% \end{bookcoverdescription} +% +% \begin{bookcover} +% % book cover components +% \end{bookcover} +% +% \end{document} +% \end{examplelst} % % \StopEventually{} % @@ -552,12 +578,13 @@ %% CLASS AND PACKAGES \LoadClass{article} -\RequirePackage{geometry,graphicx,calc,ifthen,tikz} +\RequirePackage{geometry,graphicx,calc,ifthen,tikz,environ} \RequirePackage[nonefgrulers]{fgruler} %% PAGE STYLE \pagestyle{empty} +\def\ps@plain{} %% NEW IF @@ -606,10 +633,6 @@ paperwidth=2\marklength+2\bleedwidth+2\coverwidth+2\flapwidth+\spinewidth, paperheight=2\marklength+2\bleedwidth+\coverheight} -%% NO PARAGRAPH INDENTATION - -\setlength{\parindent}{0pt} - %% INTERNAL LENGTHS SETTING \def\bookcover@xpos#1{\setlength{\bookcover@xpos@}{#1}} @@ -627,6 +650,18 @@ \let\setpartheight\bookcover@partheight \let\settrimmedpart\bookcover@tikz@trimmed@part@param +%% BOOKCOVERDESCGEOMETRY + +\def\bookcoverdescgeometry#1{\def\bookcover@descgeometry{#1}} +\def\bookcover@descgeometry{margin=1in} + +%% BOOKCOVERDESCRIPTION + +\newenvironment{bookcoverdescription}{% + \if@inbookcoverenv\@latexerr{Don't use 'bookcoverdescription' in 'bookcover' environment!}{}\fi}{} +\AddToHook{env/bookcoverdescription/before}{\expandafter\newgeometry\expandafter{\bookcover@descgeometry}} +\AddToHook{env/bookcoverdescription/after}{\restoregeometry} + %% POSBOX \newcommand{\bookcover@posbox}[4]{% @@ -746,6 +781,7 @@ \def\bookcover{% \@inbookcoverenvtrue% \newpage% + \noindent% \begin{picture}(\paperwidth,\paperheight)(0,-\paperheight)} \def\endbookcover{% @@ -772,6 +808,10 @@ \ifdim\bookcover@partheight@>0mm \csname bookcover@componenttype@#1\endcsname{#3}\fi\fi\fi}}} +%% BOOKCOVERELEMENT ENVIRONMENT + +\NewEnviron{bookcoverelement}[2]{\bookcovercomponent{#1}{#2}{\BODY}} + %% NEW BOOKCOVER PART \def\newbookcoverpart#1#2{ @@ -821,7 +861,7 @@ %% COMPONENT TYPES \newbookcovercomponenttype{color}{ - \tikz\fill[#1] (0,0) rectangle (\bookcover@partwidth@,\bookcover@partheight@);} + \tikz\fill\expandafter[#1] (0,0) rectangle (\bookcover@partwidth@,\bookcover@partheight@);} \newbookcovercomponenttype{picture}{ \includegraphics[width=\bookcover@partwidth@,height=\bookcover@partheight@]{#1}} |