summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bookcover
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-05-02 01:30:50 +0000
committerKarl Berry <karl@freefriends.org>2016-05-02 01:30:50 +0000
commit222123b2bd4582710423d93e4308b081c3559ca5 (patch)
tree328333313a0dbc8304c9a3de2ef64a91d5aa2f28 /Master/texmf-dist/tex/latex/bookcover
parent7ccea4b0af687f2124e13bca34803f61fd31c235 (diff)
bookcover (30apr16)
git-svn-id: svn://tug.org/texlive/trunk@40827 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bookcover')
-rw-r--r--Master/texmf-dist/tex/latex/bookcover/bookcover.cls225
1 files changed, 164 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/latex/bookcover/bookcover.cls b/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
index 6e9f31bd74a..2327b08d4d9 100644
--- a/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
+++ b/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
@@ -18,9 +18,9 @@
%% LaTeX version 1999/12/01 or later.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesClass{bookcover}[2015/03/04 v1.0 class for book covers and dust jackets]
+\ProvidesClass{bookcover}[2016/05/01 v1.1 class for book covers and dust jackets]
%%
-%% Options
+%% OPTIONS
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=bookcover,prefix=bookcover@}
\DeclareVoidOption{10pt}{\PassOptionsToClass{10pt}{article}}
@@ -36,17 +36,21 @@
\DeclareStringOption[5mm]{bleedwidth}
\DeclareStringOption[red]{markcolor}
\DeclareBoolOption[false]{trimmed}
+\DeclareBoolOption[false]{bgtikznodes}
+\DeclareBoolOption[false]{bgtikzclip}
\ProcessKeyvalOptions{bookcover}
-%% Loading class and packages
+%% LOADING CLASS
\LoadClass{article}
+
+%% LOADING PACKAGES
\RequirePackage{geometry,graphicx,calc,xcolor,ifthen,tikz,eso-pic}
\RequirePackage[absolute]{textpos}
-%% Page style is empty
+%% PAGE STYLE
\pagestyle{empty}
-%% New length commands
+%% USER LENGTHS
\newlength{\coverwidth}
\newlength{\coverheight}
\newlength{\spinewidth}
@@ -54,12 +58,16 @@
\newlength{\marklength}
\newlength{\markthick}
\newlength{\bleedwidth}
+
+%% INTERNAL LENGTHS
\newlength{\bookcover@xpos@}
\newlength{\bookcover@ypos@}
\newlength{\bookcover@partwidth@}
\newlength{\bookcover@partheight@}
+\newlength{\bookcover@bgtikz@trimmed@part@width@minus}
+\newlength{\bookcover@bgtikz@trimmed@part@push@right}
-%% Set length commands
+%% USER LENGTHS SETTING
\setlength{\coverwidth}{\bookcover@coverwidth}
\setlength{\coverheight}{\bookcover@coverheight}
\setlength{\spinewidth}{\bookcover@spinewidth}
@@ -71,40 +79,128 @@
\setlength{\paperheight}{2\marklength+2\bleedwidth+\coverheight}
\setlength{\parindent}{0pt}
-%% If grid is true, then mark thick is 2pt and mark color is red
-\ifESO@grid\setlength{\markthick}{2pt}\def\bookcover@markcolor{red}\fi
+%% IF GRID
+\ifESO@grid
+ \setlength{\markthick}{2pt}
+ \def\bookcover@markcolor{red}\fi
-%% Internal macros
+%% COMMANDS FOR INTERNAL LENGTHS SETTING
\def\bookcover@xpos#1{\setlength{\bookcover@xpos@}{#1}}
\def\bookcover@ypos#1{\setlength{\bookcover@ypos@}{#1}}
\def\bookcover@partwidth#1{\setlength{\bookcover@partwidth@}{#1}}
\def\bookcover@partheight#1{\setlength{\bookcover@partheight@}{#1}}
+\def\bookcover@bgtikz@trimmed@part@param#1#2{%
+ \setlength{\bookcover@bgtikz@trimmed@part@width@minus}{#1}%
+ \setlength{\bookcover@bgtikz@trimmed@part@push@right}{#2}}
+
+%% MACROS FOR OUTPUTS OF PARTS
+%% bgcolor
\def\bookcover@bgcolor#1{
\begin{textblock*}{\bookcover@partwidth@}(\bookcover@xpos@,\bookcover@ypos@)
- \tikz\expandafter\fill#1 (0mm,0mm) rectangle (\bookcover@partwidth@,\bookcover@partheight@);
+ \tikz\expandafter\fill#1 (0,0) rectangle (\bookcover@partwidth@,\bookcover@partheight@);
\end{textblock*}}
+%% bgpic
\def\bookcover@bgpic#1{
\begin{textblock*}{\bookcover@partwidth@}(\bookcover@xpos@,\bookcover@ypos@)
\includegraphics[width=\bookcover@partwidth@,height=\bookcover@partheight@]{#1}
\end{textblock*}}
+%% bgtikz
\def\bookcover@bgtikz#1{
\begin{textblock*}{\bookcover@partwidth@}(\bookcover@xpos@,\bookcover@ypos@)
- \begin{tikzpicture}
+ \ifbookcover@bgtikzclip\bookcover@bgtikznodestrue\fi
+ \ifbookcover@bgtikznodes
+ \begin{tikzpicture}[overlay,yshift=-\bookcover@partheight@]
+ \begin{scope}[transparent,line width=0pt]
+ \pgfset{minimum width=\bookcover@partwidth@,minimum height=\bookcover@partheight@}
+ \pgfnode{rectangle}{south west}{}{current part}{\pgfusepath{draw}}
+ \pgfset{minimum width=\bookcover@partwidth@-\bookcover@bgtikz@trimmed@part@width@minus,
+ minimum height=\bookcover@partheight@-2\bleedwidth}
+ \pgftransformshift{\pgfpoint{\bookcover@bgtikz@trimmed@part@push@right}{\bleedwidth}}
+ \pgfnode{rectangle}{south west}{}{current trimmed part}{\pgfusepath{draw}}
+ \end{scope}
+ \ifbookcover@bgtikzclip
+ \clip (current part.south west) rectangle (current part.north east);\fi
+ \else\begin{tikzpicture}\fi
#1
\end{tikzpicture}
\end{textblock*}}
+%% fg
\def\bookcover@fg#1{
\begin{textblock*}{\bookcover@partwidth@}(\bookcover@xpos@,\bookcover@ypos@)
\parbox[t][\bookcover@partheight@][t]{\bookcover@partwidth@}{#1}
\end{textblock*}}
+%% remark
+\def\bookcover@remark#1{
+ \begin{textblock*}{\bookcover@partwidth@}(\bookcover@xpos@,\bookcover@ypos@)
+ \parbox[t][\bookcover@partheight@][c]{\bookcover@partwidth@}
+ {\centering#1\par}
+ \end{textblock*}}
+
+%% MACROS FOR MARKS
+%% vertical mark
\def\bookcover@vmark{
\begin{textblock*}{\bookcover@partwidth@}(\bookcover@xpos@,\bookcover@ypos@)
{\color{\bookcover@markcolor}\rule[0pt]{\markthick}{\marklength}}
\end{textblock*}}
+%% horizontal mark
\def\bookcover@hmark{
\begin{textblock*}{\bookcover@partwidth@}(\bookcover@xpos@,\bookcover@ypos@)
{\color{\bookcover@markcolor}\rule[0pt]{\marklength}{\markthick}}
\end{textblock*}}
+
+%% MACRO FOR TRIMMING
+\def\bookcover@trimming{
+ \begin{textblock*}{\paperwidth}(0mm,0mm)
+ \begin{tikzpicture}
+ \begin{scope}[color=white]
+ \fill(0,0)--
+ (\paperwidth,0)--
+ (\paperwidth,\marklength+\bleedwidth)--
+ (0,\marklength+\bleedwidth)--cycle;
+ \fill(0,\paperheight)--
+ (\paperwidth,\paperheight)--
+ (\paperwidth,\paperheight-\marklength-\bleedwidth)--
+ (0,\paperheight-\marklength-\bleedwidth)--cycle;
+ \fill(0,0)--
+ (\marklength+\bleedwidth,0)--
+ (\marklength+\bleedwidth,\paperheight)--
+ (0,\paperheight)--cycle;
+ \fill(\paperwidth-\marklength-\bleedwidth,0)--
+ (\paperwidth,0)--
+ (\paperwidth,\paperheight)--
+ (\paperwidth-\marklength-\bleedwidth,\paperheight)--cycle;
+ \end{scope}
+ \draw[color=\bookcover@markcolor,line width=\markthick]
+ (\marklength+\bleedwidth,\marklength+\bleedwidth)--
+ (\paperwidth-\marklength-\bleedwidth,\marklength+\bleedwidth)--
+ (\paperwidth-\marklength-\bleedwidth,\paperheight-\marklength-\bleedwidth)--
+ (\marklength+\bleedwidth,\paperheight-\marklength-\bleedwidth)--cycle;
+ \end{tikzpicture}
+ \end{textblock*}
+ \bookcover@ypos{\bleedwidth}
+ \bookcover@partwidth{\markthick}
+ \ifdim\flapwidth>0mm
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth-.5\markthick}
+ \bookcover@vmark
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth+2\coverwidth+\spinewidth-.5\markthick}
+ \bookcover@vmark\fi
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth+\coverwidth-.5\markthick}
+ \bookcover@vmark
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth+\coverwidth+\spinewidth-.5\markthick}
+ \bookcover@vmark
+ \bookcover@ypos{\paperheight-\marklength-\bleedwidth}
+ \bookcover@partwidth{\markthick}
+ \ifdim\flapwidth>0mm
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth-.5\markthick}
+ \bookcover@vmark
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth+2\coverwidth+\spinewidth-.5\markthick}
+ \bookcover@vmark\fi
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth+\coverwidth-.5\markthick}
+ \bookcover@vmark
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth+\coverwidth+\spinewidth-.5\markthick}
+ \bookcover@vmark}
+
+%% RESET DATAS
\def\bookcover@reset{
\def\bookcover@bgcolor@whole{}
\def\bookcover@bgcolor@wholewf{}
@@ -132,17 +228,18 @@
\def\bookcover@fgfirst@spine{}
\def\bookcover@fgfirst@backflap{}
\def\bookcover@fgfirst@frontflap{}
- \def\bookcover@fgfirst@remark{}
+ \def\bookcover@fgfirst@abovefront{}
+ \def\bookcover@fgfirst@belowfront{}
+ \def\bookcover@fgfirst@aboveback{}
+ \def\bookcover@fgfirst@belowback{}
\def\bookcover@fgsecond@back{}
\def\bookcover@fgsecond@front{}
\def\bookcover@fgsecond@spine{}
\def\bookcover@fgsecond@backflap{}
\def\bookcover@fgsecond@frontflap{}}
-
-%% Reset datas
\bookcover@reset
-%% Definition of command \setbookcover
+%% SETBOOKCOVER
\long\def\setbookcover#1#2#3{
\ifthenelse{\equal{#1}{bgcolor}}{
\ifthenelse{\equal{#2}{whole}}{\def\bookcover@bgcolor@whole{[#3]}}{}
@@ -174,7 +271,11 @@
\ifthenelse{\equal{#2}{spine}}{\def\bookcover@fgfirst@spine{#3}}{}
\ifthenelse{\equal{#2}{back flap}}{\def\bookcover@fgfirst@backflap{#3}}{}
\ifthenelse{\equal{#2}{front flap}}{\def\bookcover@fgfirst@frontflap{#3}}{}
- \ifthenelse{\equal{#2}{remark}}{\def\bookcover@fgfirst@remark{#3}}{}}{}
+ \ifthenelse{\equal{#2}{remark}}{\def\bookcover@fgfirst@abovefront{#3}}{}% for version 1.0
+ \ifthenelse{\equal{#2}{above front}}{\def\bookcover@fgfirst@abovefront{#3}}{}
+ \ifthenelse{\equal{#2}{below front}}{\def\bookcover@fgfirst@belowfront{#3}}{}
+ \ifthenelse{\equal{#2}{above back}}{\def\bookcover@fgfirst@aboveback{#3}}{}
+ \ifthenelse{\equal{#2}{below back}}{\def\bookcover@fgfirst@belowback{#3}}{}}{}
\ifthenelse{\equal{#1}{fgsecond}}{
\ifthenelse{\equal{#2}{back}}{\def\bookcover@fgsecond@back{#3}}{}
\ifthenelse{\equal{#2}{front}}{\def\bookcover@fgsecond@front{#3}}{}
@@ -182,9 +283,9 @@
\ifthenelse{\equal{#2}{back flap}}{\def\bookcover@fgsecond@backflap{#3}}{}
\ifthenelse{\equal{#2}{front flap}}{\def\bookcover@fgsecond@frontflap{#3}}{}}{}}
-%% Definition of command \makebookcover
+%% MAKEBOOKCOVER
\def\makebookcover{
-%% Background
+%% background parameters
\bookcover@ypos{\marklength}
\bookcover@partheight{\coverheight+2\bleedwidth}
%% {bgcolor}{whole}
@@ -285,50 +386,60 @@
\ifx\bookcover@bgtikz@whole\@empty\else
\bookcover@xpos{\marklength}
\bookcover@partwidth{2\coverwidth+2\bleedwidth+2\flapwidth+\spinewidth}
+ \bookcover@bgtikz@trimmed@part@param{2\bleedwidth}{\bleedwidth}
\bookcover@bgtikz{\bookcover@bgtikz@whole}\fi
%% {bgtikz}{whole without flaps}
\ifx\bookcover@bgtikz@wholewf\@empty\else
\ifdim\flapwidth>0mm
\bookcover@xpos{\marklength+\bleedwidth+\flapwidth}
\bookcover@partwidth{2\coverwidth+\spinewidth}
+ \bookcover@bgtikz@trimmed@part@param{0pt}{0pt}
\else
\bookcover@xpos{\marklength}
- \bookcover@partwidth{2\coverwidth+2\bleedwidth+\spinewidth}\fi
+ \bookcover@partwidth{2\coverwidth+2\bleedwidth+\spinewidth}
+ \bookcover@bgtikz@trimmed@part@param{2\bleedwidth}{\bleedwidth}\fi
\bookcover@bgtikz{\bookcover@bgtikz@wholewf}\fi
%% {bgtikz}{back flap}
\ifx\bookcover@bgtikz@backflap\@empty\else\ifdim\flapwidth>0mm
\bookcover@xpos{\marklength}
\bookcover@partwidth{\flapwidth+\bleedwidth}
+ \bookcover@bgtikz@trimmed@part@param{\bleedwidth}{\bleedwidth}
\bookcover@bgtikz{\bookcover@bgtikz@backflap}\fi\fi
%% {bgtikz}{back}
\ifx\bookcover@bgtikz@back\@empty\else
\ifdim\flapwidth>0mm
\bookcover@xpos{\marklength+\bleedwidth+\flapwidth}
\bookcover@partwidth{\coverwidth}
+ \bookcover@bgtikz@trimmed@part@param{0pt}{0pt}
\else
\bookcover@xpos{\marklength}
- \bookcover@partwidth{\coverwidth+\bleedwidth}\fi
+ \bookcover@partwidth{\coverwidth+\bleedwidth}
+ \bookcover@bgtikz@trimmed@part@param{\bleedwidth}{\bleedwidth}\fi
\bookcover@bgtikz{\bookcover@bgtikz@back}\fi
%% {bgtikz}{spine}
\ifx\bookcover@bgtikz@spine\@empty\else
\bookcover@xpos{\marklength+\bleedwidth+\flapwidth+\coverwidth}
\bookcover@partwidth{\spinewidth}
+ \bookcover@bgtikz@trimmed@part@param{0pt}{0pt}
\bookcover@bgtikz{\bookcover@bgtikz@spine}\fi
%% {bgtikz}{front}
\ifx\bookcover@bgtikz@front\@empty\else
\ifdim\flapwidth>0mm
\bookcover@xpos{\marklength+\bleedwidth+\flapwidth+\coverwidth+\spinewidth}
\bookcover@partwidth{\coverwidth}
+ \bookcover@bgtikz@trimmed@part@param{0pt}{0pt}
\else
\bookcover@xpos{\marklength+\bleedwidth+\coverwidth+\spinewidth}
- \bookcover@partwidth{\coverwidth+\bleedwidth}\fi
+ \bookcover@partwidth{\coverwidth+\bleedwidth}
+ \bookcover@bgtikz@trimmed@part@param{\bleedwidth}{0pt}\fi
\bookcover@bgtikz{\bookcover@bgtikz@front}\fi
%% {bgtikz}{front flap}
\ifx\bookcover@bgtikz@frontflap\@empty\else\ifdim\flapwidth>0mm
\bookcover@xpos{\marklength+\bleedwidth+\flapwidth+2\coverwidth+\spinewidth}
\bookcover@partwidth{\flapwidth+\bleedwidth}
+ \bookcover@bgtikz@trimmed@part@param{\bleedwidth}{0pt}
\bookcover@bgtikz{\bookcover@bgtikz@frontflap}\fi\fi
-%% Foreground
+%% foreground parameters
\bookcover@ypos{\marklength+\bleedwidth}
\bookcover@partheight{\coverheight}
%% {fgsecond}{back flap}
@@ -381,18 +492,35 @@
\bookcover@xpos{\marklength+\bleedwidth+\flapwidth+2\coverwidth+\spinewidth}
\bookcover@partwidth{\flapwidth}
\bookcover@fg{\bookcover@fgfirst@frontflap}\fi\fi
-%% {fgfirst}{remark}
-\ifx\bookcover@fgfirst@remark\@empty\else\ifdim\marklength>0mm
+%% {fgfirst}{above front} = {fgfirst}{remark} in version 1.0
+\ifx\bookcover@fgfirst@abovefront\@empty\else\ifdim\marklength>0mm
\bookcover@xpos{\marklength+\bleedwidth+\flapwidth+\coverwidth+\spinewidth}
\bookcover@ypos{0mm}
\bookcover@partwidth{\coverwidth}
\bookcover@partheight{\marklength}
- \begin{textblock*}{\bookcover@partwidth@}(\bookcover@xpos@,\bookcover@ypos@)
- \parbox[t][\bookcover@partheight@][c]{\bookcover@partwidth@}
- {\centering\bookcover@fgfirst@remark\par}
- \end{textblock*}\fi\fi
-%% Marks
-%% mark top
+ \bookcover@remark{\bookcover@fgfirst@abovefront}\fi\fi
+%% {fgfirst}{below front}
+\ifx\bookcover@fgfirst@belowfront\@empty\else\ifdim\marklength>0mm
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth+\coverwidth+\spinewidth}
+ \bookcover@ypos{\marklength+2\bleedwidth+\coverheight}
+ \bookcover@partwidth{\coverwidth}
+ \bookcover@partheight{\marklength}
+ \bookcover@remark{\bookcover@fgfirst@belowfront}\fi\fi
+%% {fgfirst}{above back}
+\ifx\bookcover@fgfirst@aboveback\@empty\else\ifdim\marklength>0mm
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth}
+ \bookcover@ypos{0mm}
+ \bookcover@partwidth{\coverwidth}
+ \bookcover@partheight{\marklength}
+ \bookcover@remark{\bookcover@fgfirst@aboveback}\fi\fi
+%% {fgfirst}{below back}
+\ifx\bookcover@fgfirst@belowback\@empty\else\ifdim\marklength>0mm
+ \bookcover@xpos{\marklength+\bleedwidth+\flapwidth}
+ \bookcover@ypos{\marklength+2\bleedwidth+\coverheight}
+ \bookcover@partwidth{\coverwidth}
+ \bookcover@partheight{\marklength}
+ \bookcover@remark{\bookcover@fgfirst@belowback}\fi\fi
+%% mark top parameters
\bookcover@ypos{0mm}
\bookcover@partwidth{\markthick}
%% mark top 1
@@ -415,7 +543,7 @@
%% mark top 6
\bookcover@xpos{\marklength+\bleedwidth+2\flapwidth+2\coverwidth+\spinewidth-.5\markthick}
\bookcover@vmark
-%% mark bottom
+%% mark bottom parameters
\bookcover@ypos{\paperheight-\marklength}
\bookcover@partwidth{\markthick}
%% mark bottom 1
@@ -438,7 +566,7 @@
%% mark bottom 6
\bookcover@xpos{\marklength+\bleedwidth+2\flapwidth+2\coverwidth+\spinewidth-.5\markthick}
\bookcover@vmark
-%% mark left
+%% mark left parameters
\bookcover@xpos{0mm}
\bookcover@partwidth{\marklength}
%% mark left 1
@@ -447,7 +575,7 @@
%% mark left 2
\bookcover@ypos{\marklength+\bleedwidth+\coverheight-.5\markthick}
\bookcover@hmark
-%% mark right
+%% mark right parameters
\bookcover@xpos{\paperwidth-\marklength}
\bookcover@partwidth{\marklength}
%% mark right 1
@@ -456,35 +584,10 @@
%% mark right 2
\bookcover@ypos{\marklength+\bleedwidth+\coverheight-.5\markthick}
\bookcover@hmark
-%% Trim
+%% trimming
\ifbookcover@trimmed
- \begin{textblock*}{\paperwidth}(0mm,0mm)
- \begin{tikzpicture}
- \begin{scope}[color=white]
- \fill(0mm,\marklength-2pt)--
- (\paperwidth,\marklength-2pt)--
- (\paperwidth,\marklength+\bleedwidth)--
- (0mm,\marklength+\bleedwidth)--cycle;
- \fill(0mm,\paperheight-\marklength+2pt)--
- (\paperwidth,\paperheight-\marklength+2pt)--
- (\paperwidth,\paperheight-\marklength-\bleedwidth)--
- (0mm,\paperheight-\marklength-\bleedwidth)--cycle;
- \fill(0mm,0mm)--
- (\marklength+\bleedwidth,0mm)--
- (\marklength+\bleedwidth,\paperheight)--
- (0mm,\paperheight)--cycle;
- \fill(\paperwidth-\marklength-\bleedwidth,0mm)--
- (\paperwidth,0mm)--
- (\paperwidth,\paperheight)--
- (\paperwidth-\marklength-\bleedwidth,\paperheight)--cycle;
- \end{scope}
- \draw(\marklength+\bleedwidth,\marklength+\bleedwidth)--
- (\paperwidth-\marklength-\bleedwidth,\marklength+\bleedwidth)--
- (\paperwidth-\marklength-\bleedwidth,\paperheight-\marklength-\bleedwidth)--
- (\marklength+\bleedwidth,\paperheight-\marklength-\bleedwidth)--cycle;
- \end{tikzpicture}
- \end{textblock*}\fi
-%% New book cover
+ \bookcover@trimming\fi
+%% new book cover
\mbox{}
\newpage
\bookcover@reset}