summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bookcover
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-01-22 22:48:08 +0000
committerKarl Berry <karl@freefriends.org>2018-01-22 22:48:08 +0000
commit362e328e33bb4ae48fbc7be834631952ed6028f8 (patch)
tree6acd934b85dc6c4e2ec1c7558050d7d6253d604a /Master/texmf-dist/tex/latex/bookcover
parent01961fc557f91eac6c8b730202c4999c837f2f87 (diff)
bookcover (22jan18)
git-svn-id: svn://tug.org/texlive/trunk@46410 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bookcover')
-rw-r--r--Master/texmf-dist/tex/latex/bookcover/bookcover.cls179
1 files changed, 40 insertions, 139 deletions
diff --git a/Master/texmf-dist/tex/latex/bookcover/bookcover.cls b/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
index a66e512eee5..9987eb0cac1 100644
--- a/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
+++ b/Master/texmf-dist/tex/latex/bookcover/bookcover.cls
@@ -18,7 +18,7 @@
%% LaTeX version 1999/12/01 or later.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesClass{bookcover}[2018/01/09 v2.2 class for book covers and dust jackets]
+\ProvidesClass{bookcover}[2018/01/21 v2.3 class for book covers and dust jackets]
%%
%% OPTIONS
\RequirePackage{kvoptions}
@@ -26,7 +26,6 @@
\DeclareVoidOption{10pt}{\PassOptionsToClass{10pt}{article}}
\DeclareVoidOption{11pt}{\PassOptionsToClass{11pt}{article}}
\DeclareVoidOption{12pt}{\PassOptionsToClass{12pt}{article}}
-\DeclareVoidOption{grid}{\PassOptionsToPackage{grid}{eso-pic}}
\DeclareStringOption[170mm]{coverwidth}
\DeclareStringOption[240mm]{coverheight}
\DeclareStringOption[5mm]{spinewidth}
@@ -36,20 +35,20 @@
\DeclareStringOption[5mm]{bleedwidth}
\DeclareStringOption[red]{markcolor}
\DeclareBoolOption[false]{trimmed}
-\DeclareBoolOption[false]{bgtikznodes}% for old method
-\DeclareBoolOption[false]{bgtikzclip}% for old method
+\DeclareBoolOption[false]{bgtikznodes}% for obsolete method
+\DeclareBoolOption[false]{bgtikzclip}% for obsolete method
\ProcessKeyvalOptions{bookcover}
-\ifbookcover@bgtikzclip\bookcover@bgtikznodestrue\fi% for old method
+\ifbookcover@bgtikzclip\bookcover@bgtikznodestrue\fi% for obsolete method
%% CLASS AND PACKAGES
+%%
+%% Don't use 'absolute' option of 'textpos'! It causes problems in some cases:
+%% xelatex.exe + pst-barcode
+%% pdflatex.exe or lualatex.exe + pst-barcode + auto-pst-pdf
+%%
\LoadClass{article}
-\RequirePackage{ifxetex}
-\ifxetex
-\RequirePackage{textpos} % 'absolute' option with xelatex.exe is not compatible with pst-barcode package (see an example in the document).
-\else
-\RequirePackage[absolute]{textpos}
-\fi
-\RequirePackage{geometry,graphicx,calc,ifthen,tikz,eso-pic}
+\RequirePackage{textpos,geometry,graphicx,calc,ifthen,tikz}
+\RequirePackage[nonefgrulers]{fgruler}
%% PAGE STYLE
\pagestyle{empty}
@@ -75,8 +74,8 @@
\newlength{\bookcover@tikz@trimmed@part@height@minus}
\newlength{\bookcover@tikz@trimmed@part@push@right}
\newlength{\bookcover@tikz@trimmed@part@push@up}
-\newlength{\bookcover@ruler@xshift}
-\newlength{\bookcover@ruler@yshift}
+\newlength{\bookcover@rulerwidth@}
+\newlength{\bookcover@rulerheight@}
\let\partheight\bookcover@partheight@
\let\partwidth\bookcover@partwidth@
@@ -88,18 +87,11 @@
\setlength{\marklength}{\bookcover@marklength}
\setlength{\markthick}{\bookcover@markthick}
\setlength{\bleedwidth}{\bookcover@bleedwidth}
-\setlength{\paperwidth}{2\marklength+2\bleedwidth+2\coverwidth+2\flapwidth+\spinewidth}
-\setlength{\paperheight}{2\marklength+2\bleedwidth+\coverheight}
-
-%% IN CASE XELATEX, MOVE THE POSITION TO THE UPPER LEFT CORNER OF THE PAGE (because of we don't use the 'absolute' option of textpos package)
-\ifxetex
-\setlength{\hoffset}{-1in}
-\setlength{\voffset}{-1in-1em}
-\setlength{\oddsidemargin}{0pt}
-\setlength{\topmargin}{0pt}
-\setlength{\headheight}{0pt}
-\setlength{\headsep}{0pt}
-\fi
+
+%% PAGE DIMENSIONS SETTING
+\geometry{left=0pt,right=0pt,bottom=0pt,top=-1em,
+ paperwidth=2\marklength+2\bleedwidth+2\coverwidth+2\flapwidth+\spinewidth,
+ paperheight=2\marklength+2\bleedwidth+\coverheight}
%% NO PARAGRAPH INDENTATION
\setlength{\parindent}{0pt}
@@ -115,18 +107,13 @@
\setlength{\bookcover@tikz@trimmed@part@push@right}{#3}
\setlength{\bookcover@tikz@trimmed@part@push@up}{#4}}
\def\bookcover@bgtikz@trimmed@part@param#1#2{
- \bookcover@tikz@trimmed@part@param{#1}{2\bleedwidth}{#2}{\bleedwidth}}% for old method
+ \bookcover@tikz@trimmed@part@param{#1}{2\bleedwidth}{#2}{\bleedwidth}}% for obsolete method
\let\setpartposx\bookcover@xpos
\let\setpartposy\bookcover@ypos
\let\setpartwidth\bookcover@partwidth
\let\setpartheight\bookcover@partheight
\let\settrimmedpart\bookcover@tikz@trimmed@part@param
-%% GRID
-\ifESO@grid
- \setlength{\markthick}{2pt}
- \def\bookcover@markcolor{red}\fi
-
%% MARKS
\def\bookcover@vmark{
\begin{textblock*}{\bookcover@partwidth@}(\bookcover@xpos@,\bookcover@ypos@)
@@ -347,110 +334,24 @@
\parbox[t][\bookcover@partheight@][c]{\bookcover@partwidth@}{\begin{center}#1\end{center}}}
\newbookcovercomponenttype{ruler}{
- \begin{tikzpicture}[overlay,x=1mm,y=1mm,inner sep=0pt,outer sep=3pt,yshift=-\bookcover@partheight@]
- #1
- \pgfmathsetmacro\xmax{round(.351459804*(\bookcover@partwidth@-\bookcover@ruler@xshift))}
- \pgfmathsetmacro\xnummax{round(.0351459804*(\bookcover@partwidth@-\bookcover@ruler@xshift))}
- \pgfmathsetmacro\ymax{round(.351459804*(\bookcover@partheight@-\bookcover@ruler@yshift))}
- \pgfmathsetmacro\ynummax{round(.0351459804*(\bookcover@partheight@-\bookcover@ruler@yshift))}
- \ifthenelse{\equal{\bookcover@ruler@coordsys}{lower left}}{
- \begin{scope}[xshift=\bookcover@ruler@xshift,yshift=\bookcover@ruler@yshift]
- \foreach \num in {0,1,...,\xmax}
- \draw (\num,0)--++(0,1);
- \foreach \num in {0,5,...,\xmax}
- \draw (\num,0)--++(0,1.5);
- \foreach \num in {0,10,...,\xmax}
- \draw (\num,0)--++(0,2);
- \foreach \num in {1,2,...,\xnummax}
- \node[anchor=south] at (10*\num,2)
- {\sffamily\scriptsize\num};
- \foreach \num in {0,1,...,\ymax}
- \draw (0,\num)--++(1,0);
- \foreach \num in {0,5,...,\ymax}
- \draw (0,\num)--++(1.5,0);
- \foreach \num in {0,10,...,\ymax}
- \draw (0,\num)--++(2,0);
- \foreach \num in {1,2,...,\ynummax}
- \node[anchor=west] at (2,10*\num)
- {\sffamily\scriptsize\num};
- \node[anchor=south] at (5,2)
- {\sffamily\scriptsize cm};
- \end{scope}}{}
- \ifthenelse{\equal{\bookcover@ruler@coordsys}{lower right}}{
- \begin{scope}[xshift=-\bookcover@ruler@xshift,yshift=\bookcover@ruler@yshift]
- \foreach \num in {0,1,...,\xmax}
- \draw (\bookcover@partwidth@-\num mm,0)--++(0,1);
- \foreach \num in {0,5,...,\xmax}
- \draw (\bookcover@partwidth@-\num mm,0)--++(0,1.5);
- \foreach \num in {0,10,...,\xmax}
- \draw (\bookcover@partwidth@-\num mm,0)--++(0,2);
- \foreach \num in {1,2,...,\xnummax}
- \node[anchor=south] at (\bookcover@partwidth@-10*\num mm,2)
- {\sffamily\scriptsize\num};
- \foreach \num in {0,1,...,\ymax}
- \draw (\bookcover@partwidth@,\num)--++(-1,0);
- \foreach \num in {0,5,...,\ymax}
- \draw (\bookcover@partwidth@,\num)--++(-1.5,0);
- \foreach \num in {0,10,...,\ymax}
- \draw (\bookcover@partwidth@,\num)--++(-2,0);
- \foreach \num in {1,2,...,\ynummax}
- \node[anchor=east] at (\bookcover@partwidth@-2mm,10*\num)
- {\sffamily\scriptsize\num};
- \node[anchor=south] at (\bookcover@partwidth@-5mm,2)
- {\sffamily\scriptsize cm};
- \end{scope}}{}
- \ifthenelse{\equal{\bookcover@ruler@coordsys}{upper left}}{
- \begin{scope}[xshift=\bookcover@ruler@xshift,yshift=-\bookcover@ruler@yshift]
- \foreach \num in {0,1,...,\xmax}
- \draw (\num,\bookcover@partheight@)--++(0,-1);
- \foreach \num in {0,5,...,\xmax}
- \draw (\num,\bookcover@partheight@)--++(0,-1.5);
- \foreach \num in {0,10,...,\xmax}
- \draw (\num,\bookcover@partheight@)--++(0,-2);
- \foreach \num in {1,2,...,\xnummax}
- \node[anchor=north] at (10*\num,\bookcover@partheight@-2mm)
- {\sffamily\scriptsize\num};
- \foreach \num in {0,1,...,\ymax}
- \draw (0,\bookcover@partheight@-\num mm)--++(1,0);
- \foreach \num in {0,5,...,\ymax}
- \draw (0,\bookcover@partheight@-\num mm)--++(1.5,0);
- \foreach \num in {0,10,...,\ymax}
- \draw (0,\bookcover@partheight@-\num mm)--++(2,0);
- \foreach \num in {1,2,...,\ynummax}
- \node[anchor=west] at (2,\bookcover@partheight@-10*\num mm)
- {\sffamily\scriptsize\num};
- \node[anchor=north] at (5,\bookcover@partheight@-2mm)
- {\sffamily\scriptsize\vphantom{1}cm};
- \end{scope}}{}
- \ifthenelse{\equal{\bookcover@ruler@coordsys}{upper right}}{
- \begin{scope}[xshift=-\bookcover@ruler@xshift,yshift=-\bookcover@ruler@yshift]
- \foreach \num in {0,1,...,\xmax}
- \draw (\bookcover@partwidth@-\num mm,\bookcover@partheight@)--++(0,-1);
- \foreach \num in {0,5,...,\xmax}
- \draw (\bookcover@partwidth@-\num mm,\bookcover@partheight@)--++(0,-1.5);
- \foreach \num in {0,10,...,\xmax}
- \draw (\bookcover@partwidth@-\num mm,\bookcover@partheight@)--++(0,-2);
- \foreach \num in {1,2,...,\xnummax}
- \node[anchor=north] at (\bookcover@partwidth@-10*\num mm,\bookcover@partheight@-2mm)
- {\sffamily\scriptsize\num};
- \foreach \num in {0,1,...,\ymax}
- \draw (\bookcover@partwidth@,\bookcover@partheight@-\num mm)--++(-1,0);
- \foreach \num in {0,5,...,\ymax}
- \draw (\bookcover@partwidth@,\bookcover@partheight@-\num mm)--++(-1.5,0);
- \foreach \num in {0,10,...,\ymax}
- \draw (\bookcover@partwidth@,\bookcover@partheight@-\num mm)--++(-2,0);
- \foreach \num in {1,2,...,\ynummax}
- \node[anchor=east] at (\bookcover@partwidth@-2mm,\bookcover@partheight@-10*\num mm)
- {\sffamily\scriptsize\num};
- \node[anchor=north] at (\bookcover@partwidth@-5mm,\bookcover@partheight@-2mm)
- {\sffamily\scriptsize\vphantom{1}cm};
- \end{scope}}{}
- \end{tikzpicture}}
-\def\setruler#1#2#3#4{
- \def\bookcover@ruler@coordsys{#1}
- \setlength{\bookcover@ruler@xshift}{#2}
- \setlength{\bookcover@ruler@yshift}{#3}
- \color{#4}}
+ \parbox[t][\bookcover@partheight@][t]{\bookcover@partwidth@}{#1}}
+\newcommand{\setruler}[5][cm]{%
+ \rulernorotatenum%
+ \rulerparams{}{}{#5}{}{}%
+ \setlength{\bookcover@rulerwidth@}{\bookcover@partwidth@-#3}%
+ \setlength{\bookcover@rulerheight@}{\bookcover@partheight@-#4}%
+ \ifthenelse{\equal{#2}{upper left}}{%
+ \vspace{#4}%
+ \hspace{#3}%
+ \squareruler[#1]{upperleft}{\bookcover@rulerwidth@}{\bookcover@rulerheight@}}{}%
+ \ifthenelse{\equal{#2}{upper right}}{%
+ \vspace{#4}%
+ \squareruler[#1]{upperright}{\bookcover@rulerwidth@}{\bookcover@rulerheight@}}{}%
+ \ifthenelse{\equal{#2}{lower left}}{%
+ \hspace{#3}%
+ \squareruler[#1]{lowerleft}{\bookcover@rulerwidth@}{\bookcover@rulerheight@}}{}%
+ \ifthenelse{\equal{#2}{lower right}}{%
+ \squareruler[#1]{lowerright}{\bookcover@rulerwidth@}{\bookcover@rulerheight@}}{}}
%% BOOKCOVER PARTS
\newbookcoverpart{bg back flap}{
@@ -716,9 +617,9 @@
\bookcover@xpos{\marklength+\bleedwidth}
\bookcover@partwidth{2\coverwidth+2\flapwidth+\spinewidth}}
-%%%%%%%%%%%%%%%%
-%% OLD METHOD %%
-%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%
+%% OBSOLETE METHOD %%
+%%%%%%%%%%%%%%%%%%%%%
%% MAIN LAYERS
\def\bookcover@bgcolor#1{