summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-01-08 21:36:01 +0000
committerKarl Berry <karl@freefriends.org>2022-01-08 21:36:01 +0000
commit82d8373b6729b5962a4cf62e6f74688a2e8c58b5 (patch)
treea5e947490b6fc107d410eadfcd30189918ec19e9
parente20ffca55d8295daca2e358aecccb6959204d17d (diff)
kdpcover (8jan22)
git-svn-id: svn://tug.org/texlive/trunk@61540 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt4
-rw-r--r--Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdfbin103977 -> 104864 bytes
-rw-r--r--Master/texmf-dist/doc/latex/kdpcover/kdpcover.tex2
-rw-r--r--Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls139
4 files changed, 80 insertions, 65 deletions
diff --git a/Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt b/Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt
index 75af288d41d..ea48e500f93 100644
--- a/Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt
+++ b/Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt
@@ -1,11 +1,11 @@
-hard iexec
+hard /code/iexec/iexec
hard xkeyval
hard anyfontsize
hard tikz
hard microtype
-hard xifthen
hard xcolor
hard graphicx
+hard calc
hard setspace
hard geometry
hard textpos
diff --git a/Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdf b/Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdf
index aad909aa9d2..b48b7b05c3e 100644
--- a/Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdf
+++ b/Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/kdpcover/kdpcover.tex b/Master/texmf-dist/doc/latex/kdpcover/kdpcover.tex
index 8f09b9f9b2a..2fda6e5bfd4 100644
--- a/Master/texmf-dist/doc/latex/kdpcover/kdpcover.tex
+++ b/Master/texmf-dist/doc/latex/kdpcover/kdpcover.tex
@@ -45,7 +45,7 @@
% Here we print the version and it will also add the date of the latest
% Git commit in the current directory. If it's not a Git repository,
% the date won't be printed.
-\putVersion{0.2.2}
+\putVersion{0.2.3}
% This prints the price, which is a good practice to mention, I believe.
\putPrice{\$0.00}
diff --git a/Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls b/Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls
index 9f3355f0261..612510d48e9 100644
--- a/Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls
+++ b/Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls
@@ -21,127 +21,142 @@
% SOFTWARE.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{kdpcover}[2021/09/02 0.2.2 Cover for Kindle Direct Publishing books]
+\ProvidesClass{kdpcover}[2022/01/08 0.2.3 Cover for Kindle Direct Publishing books]
\LoadClass{article}
-\newcommand*\kdppages{100}
-\newlength\kdpxsize
-\newlength\kdpysize
+\makeatletter
+\newcommand*\kdp@pages{100}
+\newlength\kdp@xsize
+\setlength\kdp@xsize{6in}
+\newlength\kdp@ysize
+\setlength\kdp@ysize{9in}
+\makeatother
+
+\RequirePackage{/code/iexec/iexec}
-\RequirePackage{iexec}
\RequirePackage{xkeyval}
-\DeclareOptionX{6x9}{\setlength\kdpxsize{6in}\setlength\kdpysize{9in}}
-\DeclareOptionX{7x10}{\setlength\kdpxsize{7in}\setlength\kdpysize{10in}}
-\DeclareOptionX{8x10}{\setlength\kdpxsize{8in}\setlength\kdpysize{10in}}
-\DeclareOptionX{pages}{\renewcommand*\kdppages{#1}}
-\DeclareOptionX{pdf}{\renewcommand*{\kdppages}{\iexec{qpdf --show-npages #1 | tr -d '[[:space:]]' | \{ cat; echo \%; \}}}}
-\ProcessOptionsX\relax
+
+\makeatletter
+\DeclareOptionX{6x9}{\setlength\kdp@xsize{6in}\setlength\kdp@ysize{9in}}
+\DeclareOptionX{7x10}{\setlength\kdp@xsize{7in}\setlength\kdp@ysize{10in}}
+\DeclareOptionX{8x10}{\setlength\kdp@xsize{8in}\setlength\kdp@ysize{10in}}
+\DeclareOptionX{pages}{\renewcommand*\kdp@pages{#1}}
+\DeclareOptionX{pdf}{%
+ \iexec[trace,quiet,stdout=kdpcover-pages-count.txt]{qpdf --show-npages #1 | tr -d '[[:space:]]' | \{ cat; echo \%; \}}%
+ \newread\kdp@pagescount%
+ \openin\kdp@pagescount=kdpcover-pages-count.txt
+ \read\kdp@pagescount to \kdp@pages%
+}
+\ProcessOptionsX\relax\makeatother
\RequirePackage{anyfontsize}
\RequirePackage{tikz}
\RequirePackage[letterspace=-50]{microtype}
-\RequirePackage{xifthen}
\RequirePackage{xcolor}
\RequirePackage{graphicx}
+\RequirePackage{calc}
+
\RequirePackage{setspace}
\setstretch{1.2}
+
% The height of the page is 9 inches plus 0.125 "bleed" on top and
% on the bottom.
% Check this doc: https://kdp.amazon.com/en_US/help/topic/G201953020
-\newlength\kdpheight
-\setlength\kdpheight{0.125in + \kdpysize + 0.125in}
+\makeatletter\newlength\kdp@height\makeatother%
+\makeatletter\setlength\kdp@height{0.125in + \kdp@ysize + 0.125in}\makeatother%
% The width is 6 inches plus 0.125 "bleed" on each side. The width of the
-% "spine" depends on the amount of pages in the book. Also, there is a
-%
-\newlength\kdpwidth
-\setlength\kdpwidth{0.125in + \kdpxsize + 0.0025in * \kdppages + \kdpxsize + 0.125in}
+% "spine" depends on the amount of pages in the book.
+\makeatletter\newlength\kdp@width\makeatother
+\makeatletter\setlength\kdp@width{0.125in + \kdp@xsize + 0.0025in * \kdp@pages + \kdp@xsize + 0.125in}\makeatother
\RequirePackage{geometry}
- \geometry{paperwidth=\kdpwidth,paperheight=\kdpheight,left=0pt,right=0pt,top=0pt,bottom=0pt}
+ \makeatletter
+ \geometry{paperwidth=\kdp@width,paperheight=\kdp@height,left=0pt,right=0pt,top=0pt,bottom=0pt}
+ \makeatother
\RequirePackage[absolute]{textpos}
\TPGrid{16}{16}
-\newcommand\putSpine[2][kdpcover-signature]{
- \begin{textblock}{2.4}[0.5,0](8,0)
- \begin{tikzpicture}
+\newcommand\putSpine[2][kdpcover-signature]{%
+ \begin{textblock}{2.4}[0.5,0](8,0)%
+ \begin{tikzpicture}%
\node [rectangle, inner sep=0em, fill=black, minimum width=2.4\TPHorizModule, minimum height=16\TPVertModule] at (0,0) {};
- \end{tikzpicture}
- \end{textblock}
- \begin{textblock}{1}[0.5,0](8,2)
- \begin{tikzpicture}
+ \end{tikzpicture}%
+ \end{textblock}%
+ \begin{textblock}{1}[0.5,0](8,2)%
+ \begin{tikzpicture}%
\node [color=white, inner sep=0cm, outer sep=0cm, rotate=270, minimum height=\TPHorizModule] at (0,0) {
- \Large #1
- };
- \end{tikzpicture}
- \end{textblock}
- \begin{textblock}{2.4}[0.5,1](8,14)
- \centerline{\includegraphics[width=0.32in]{#1}}
- \end{textblock}
+ \Large #2
+ };%
+ \end{tikzpicture}%
+ \end{textblock}%
+ \begin{textblock}{2.4}[0.5,1](8,14)%
+ \centerline{\includegraphics[width=0.32in]{#1}}%
+ \end{textblock}%
}
-\newcommand\putPicture[1]{
- \begin{textblock}{4}(10,2)
+\newcommand\putPicture[1]{%
+ \begin{textblock}{4}(10,2)%
\includegraphics[width=\textwidth]{#1}
- \end{textblock}
+ \end{textblock}%
}
-\newcommand\putVolume[1]{
- \begin{textblock}{2}[1,1](15,14)
+\newcommand\putVolume[1]{%
+ \begin{textblock}{2}[1,1](15,14)%
\raggedleft
\includegraphics[height=0.4in]{kdpcover-vol-#1}
- \end{textblock}
+ \end{textblock}%
}
-\newcommand\putPrice[1]{
- \begin{textblock}{4}[0,1](1,2)
+\newcommand\putPrice[1]{%
+ \begin{textblock}{4}[0,1](1,2)%
\small #1
- \end{textblock}
+ \end{textblock}%
}
-\newcommand\putBack[1]{
- \begin{textblock}{5}[0,0](1,3)
+\newcommand\putBack[1]{%
+ \begin{textblock}{5}[0,0](1,3)%
\small #1
- \end{textblock}
+ \end{textblock}%
}
-\newcommand\putTitle[1]{
- \begin{textblock}{5}(10,9)
+\newcommand\putTitle[1]{%
+ \begin{textblock}{5}(10,9)%
\fontsize{32}{32}\selectfont #1
- \end{textblock}
+ \end{textblock}%
}
-\newcommand\putAuthor[1]{
- \begin{textblock}{4}(10,10)
+\newcommand\putAuthor[1]{%
+ \begin{textblock}{4}(10,10)%
\large by #1
- \end{textblock}
+ \end{textblock}%
}
-\newcommand\putTLDR[1]{
- \begin{textblock}{5}(10,11)
+\newcommand\putTLDR[1]{%
+ \begin{textblock}{5}(10,11)%
TL;DR #1
- \end{textblock}
+ \end{textblock}%
}
-\newcommand\putVersion[1]{
- \begin{textblock}{4}[0,1](10,14)
+\newcommand\putVersion[1]{%
+ \begin{textblock}{4}[0,1](10,14)%
#1
\quad
\iexec{git log -n 1 --pretty='format:\%ad' --date='format:\%e-\%b-\%Y'}
- \end{textblock}
+ \end{textblock}%
}
-\newcommand\putCopyright[2]{
- \begin{textblock}{4}[0,1](1,14)
+\newcommand\putCopyright[2]{%
+ \begin{textblock}{4}[0,1](1,14)%
\small (c)
#1 #2
- \end{textblock}
+ \end{textblock}%
}
-\AtBeginDocument{
+\AtBeginDocument{%
\ttfamily%
\raggedright%
\setlength\parindent{0pt}%
\setlength\parskip{0pt}%
- \interfootnotelinepenalty=10000
+ \interfootnotelinepenalty=10000%
}
\endinput