diff options
author | Karl Berry <karl@freefriends.org> | 2025-01-02 20:33:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2025-01-02 20:33:47 +0000 |
commit | da0372dbcaed79e78057cc9d2c237ed5a5c1fc48 (patch) | |
tree | d9fcaa1b7628be82901f43baca7af7d1499a1cf4 /Master | |
parent | 37929848e536ed580ef7b4a42f3821b53cc9c362 (diff) |
kdpcover (2jan25)
git-svn-id: svn://tug.org/texlive/trunk@73275 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt | 20 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/kdpcover/LICENSE.txt | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/kdpcover/README.md | 27 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdf | bin | 368603 -> 366035 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/kdpcover/kdpcover.dtx | 121 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/kdpcover/kdpcover.ins | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls | 114 |
7 files changed, 173 insertions, 115 deletions
diff --git a/Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt b/Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt index e07680365e0..9ec3ba03e56 100644 --- a/Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt +++ b/Master/texmf-dist/doc/latex/kdpcover/DEPENDS.txt @@ -1,10 +1,18 @@ -hard iexec -hard xkeyval hard anyfontsize -hard pgf +hard etoolbox +hard geometry +hard iexec hard microtype -hard xcolor +hard pgf +hard pgfopts hard setspace -hard geometry hard textpos -hard etoolbox
\ No newline at end of file +hard xcolor +soft docshots +soft href-ul +soft hypdoc +soft l3build +soft libertine +soft scheme-basic +soft tools +soft xetex diff --git a/Master/texmf-dist/doc/latex/kdpcover/LICENSE.txt b/Master/texmf-dist/doc/latex/kdpcover/LICENSE.txt index bd949ffdabc..1f211e02878 100644 --- a/Master/texmf-dist/doc/latex/kdpcover/LICENSE.txt +++ b/Master/texmf-dist/doc/latex/kdpcover/LICENSE.txt @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2021-2022 Yegor Bugayenko +Copyright (c) 2021-2024 Yegor Bugayenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal diff --git a/Master/texmf-dist/doc/latex/kdpcover/README.md b/Master/texmf-dist/doc/latex/kdpcover/README.md index 6563185c6e9..2dd649e4f8d 100644 --- a/Master/texmf-dist/doc/latex/kdpcover/README.md +++ b/Master/texmf-dist/doc/latex/kdpcover/README.md @@ -1,19 +1,26 @@ +# LaTeX Class for KDP Book Covers + [![make](https://github.com/yegor256/kdpcover/actions/workflows/l3build.yml/badge.svg)](https://github.com/yegor256/kdpcover/actions/workflows/l3build.yml) [![CTAN](https://img.shields.io/ctan/v/kdpcover)](https://ctan.org/pkg/kdpcover) [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/kdpcover/blob/master/LICENSE.txt) -This LaTeX class I use to format covers for [my books](https://www.yegor256.com/books.html), +This LaTeX class I use to format covers for +[my books](https://www.yegor256.com/books.html), which I sell [on Amazon](https://www.amazon.com/Yegor-Bugayenko/e/B01AM1QMDK). -The problem this class solves is [the necessity](https://kdp.amazon.com/en_US/help/topic/G201953020) -to change the size of the cover PDF respectfully +The problem this class solves is +[the necessity](https://kdp.amazon.com/en_US/help/topic/G201953020) +to change the size of the cover PDF respectfully to the number of pages in the book — the bigger the book, the larger must be the cover. The provided class makes necessary -calculations on-fly, using the [`qpdf`](http://qpdf.sourceforge.net/) tool. Obviously, +calculations on-fly, using the [`qpdf`](http://qpdf.sourceforge.net/) tool. +Obviously, you need to have it installed. Also, you must -run `pdflatex` with the `--shell-escape` option, in order to allow LaTeX to run `qpdf`. +run `pdflatex` with the `--shell-escape` option, +in order to allow LaTeX to run `qpdf`. -First, [install it](https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages) -from [CTAN](https://ctan.org/pkg/kdpcover) +First, +[install it](https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages) +from [CTAN](https://ctan.org/pkg/kdpcover) and then use in the preamble: ```tex @@ -26,7 +33,11 @@ and then use in the preamble: \end{document} ``` -If you want to contribute yourself, make a fork, then create a branch, +Otherwise, you can download +[`kdpcover.sty`](https://yegor256.github.io/kdpcover/kdpcover.sty) and +add to your project. + +If you want to contribute yourself, make a fork, then create a branch, then run `make` in the root directory. It should compile everything without errors. If not, submit an issue and wait. Otherwise, make your changes and then run `make` again. If the build is diff --git a/Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdf b/Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdf Binary files differindex 6280c2cb4ea..893605f2cc8 100644 --- a/Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdf +++ b/Master/texmf-dist/doc/latex/kdpcover/kdpcover.pdf diff --git a/Master/texmf-dist/source/latex/kdpcover/kdpcover.dtx b/Master/texmf-dist/source/latex/kdpcover/kdpcover.dtx index da1ab39d4d3..c8a668bb207 100644 --- a/Master/texmf-dist/source/latex/kdpcover/kdpcover.dtx +++ b/Master/texmf-dist/source/latex/kdpcover/kdpcover.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % (The MIT License) % -% Copyright (c) 2021-2022 Yegor Bugayenko +% Copyright (c) 2021-2024 Yegor Bugayenko % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the 'Software'), to deal @@ -50,7 +50,7 @@ %<class>\NeedsTeXFormat{LaTeX2e} %<class>\ProvidesClass{kdpcover} %<*class> -[2022.11.30 0.5.1 Cover for Kindle Direct Publishing books] +[2025/01/02 0.6.0 Cover for Kindle Direct Publishing books] %</class> %<*driver> \documentclass{ltxdoc} @@ -91,7 +91,7 @@ % \begin{document} % \putSpine{kdpcover, a LaTeX class for KDP books} % \putVolume{1} -% \putVersion{0.5.1} +% \putVersion{0.6.0} % \putPrice{\$0.00} % \putCopyright{\the\year}{Yegor Bugayenko} % \putTitle{kdpcover} @@ -245,41 +245,53 @@ % Then, we define a few internal commands: % \begin{macrocode} \makeatletter -\newcommand*\kdp@pages{100} +\newcount\kdp@pages + \kdp@pages=100 \newlength\kdp@xsize -\setlength\kdp@xsize{6in} + \setlength\kdp@xsize{6in} \newlength\kdp@ysize -\setlength\kdp@ysize{9in} + \setlength\kdp@ysize{9in} \makeatother % \end{macrocode} -% Then, we include |iexec| for being able to execute |qpdf|: +% Then, we include |iexec| for being able to execute |qpdf| and |git|: % \begin{macrocode} \RequirePackage{iexec} % \end{macrocode} -% Then, we parse class options: +% Then, we parse class options with the help of the |pgfopts| package: % \begin{macrocode} -\RequirePackage{xkeyval} +\RequirePackage{pgfopts} \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}} -\newif\ifkdp@barless -\DeclareOptionX{barless}{\kdp@barlesstrue} -\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% +\pgfkeys{ + /kdp/.cd, + barless/.store in = \kdp@barless, + pdf/.code = { + \iexec[trace,quiet,stdout=kdpcover-pages-count.txt] + {qpdf --show-npages --no-warn #1 | tr -d '[[:space:]]'} + \openin1=kdpcover-pages-count.txt + \read1 to \temp + \closein1 + \kdp@pages=\temp + }, + 6x9/.code = { + \setlength\kdp@xsize{6in} + \setlength\kdp@ysize{9in} + }, + 7x10/.code = { + \setlength\kdp@xsize{7in} + \setlength\kdp@ysize{10in} + }, + 8x10/.code = { + \setlength\kdp@xsize{8in} + \setlength\kdp@ysize{10in} + }, + pages/.code = { + \kdp@pages=#1 + } } -\ProcessOptionsX\relax\makeatother +\ProcessPgfPackageOptions{/kdp} +\makeatother % \end{macrocode} % Then, we include a few useful packages: @@ -298,20 +310,20 @@ \setstretch{1.2} % \end{macrocode} -% Then, we set calculate size. +% Then, we calculate size. % The height of the page is 9 inches plus 0.125 "bleed" on top and % on the bottom, see \href{https://kdp.amazon.com/en_US/help/topic/G201953020}{this}. % 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. % \begin{macrocode} \makeatletter - \newlength\kdp@height +\newlength\kdp@height \setlength\kdp@height{0.125in + \kdp@ysize + 0.125in} - \newlength\kdp@width +\newlength\kdp@width \setlength\kdp@width{ 0.125in + \kdp@xsize - + 0.0025in * \kdp@pages - + \kdp@xsize + 0.125in} + + 0.125in + \kdp@xsize + + 0.0025in * \kdp@pages} \makeatother % \end{macrocode} @@ -319,8 +331,14 @@ % \begin{macrocode} \RequirePackage{geometry} \makeatletter -\geometry{paperwidth=\kdp@width,paperheight=\kdp@height, - left=0pt,right=0pt,top=0pt,bottom=0pt} +\geometry{ + paperwidth=\kdp@width, + paperheight=\kdp@height, + left=0pt, + right=0pt, + top=0pt, + bottom=0pt +} \makeatother % \end{macrocode} @@ -333,8 +351,9 @@ % \begin{macro}{\putSpine} % Then, we define |\putSpine|: % \begin{macrocode} -\makeatletter\newcommand\putSpine[2][kdpcover-signature]{% - \ifkdp@barless\else +\makeatletter +\newcommand\putSpine[2][kdpcover-signature]{% + \ifdefined\kdp@barless\else% \begin{textblock}{2.4}[0.5,0](8,0)% \begin{tikzpicture}% \node [rectangle, inner sep=0em, fill=black, @@ -342,19 +361,20 @@ minimum height=16\TPVertModule] at (0,0) {}; \end{tikzpicture}% \end{textblock}% - \fi + \fi% \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 #2 - };% + \Large #2% + }; \end{tikzpicture}% \end{textblock}% \begin{textblock}{2.4}[0.5,1](8,14)% \centerline{\includegraphics[width=0.32in]{#1}}% \end{textblock}% -}\makeatother +} +\makeatother % \end{macrocode} % \end{macro} @@ -374,8 +394,8 @@ % \begin{macrocode} \newcommand\putVolume[1]{% \begin{textblock}{2}[1,1](15,14)% - \raggedleft - \includegraphics[height=0.4in]{kdpcover-vol-#1} + \raggedleft% + \includegraphics[height=0.4in]{kdpcover-vol-#1}% \end{textblock}% } % \end{macrocode} @@ -386,7 +406,7 @@ % \begin{macrocode} \newcommand\putPrice[1]{% \begin{textblock}{4}[0,1](1,2)% - \small #1 + \small #1% \end{textblock}% } % \end{macrocode} @@ -397,7 +417,7 @@ % \begin{macrocode} \newcommand\putBack[1]{% \begin{textblock}{5}[0,0](1,3)% - \small #1 + \small #1% \end{textblock}% } % \end{macrocode} @@ -408,7 +428,7 @@ % \begin{macrocode} \newcommand\putTitle[1]{% \begin{textblock}{5}(10,9)% - \fontsize{32}{32}\selectfont #1 + \fontsize{32}{32}\selectfont #1% \end{textblock}% } % \end{macrocode} @@ -419,7 +439,7 @@ % \begin{macrocode} \newcommand\putAuthor[1]{% \begin{textblock}{4}(10,10)% - \large by #1 + \large by #1% \end{textblock}% } % \end{macrocode} @@ -430,7 +450,7 @@ % \begin{macrocode} \newcommand\putTLDR[1]{% \begin{textblock}{5}(10,11)% - TL;DR #1 + TL;DR #1% \end{textblock}% } % \end{macrocode} @@ -441,10 +461,10 @@ % \begin{macrocode} \newcommand\putVersion[1]{% \begin{textblock}{4}[0,1](10,14)% - #1 + #1% \IfFileExists{.git} {\quad\iexec{git log -n 1 --pretty='format:\%ad' --date='format:\%e-\%b-\%Y'}} - {} + {}% \end{textblock}% } % \end{macrocode} @@ -455,8 +475,8 @@ % \begin{macrocode} \newcommand\putCopyright[2]{% \begin{textblock}{4}[0,1](1,14)% - \small (c) - #1 #2 + \small (c)% + #1 #2% \end{textblock}% } % \end{macrocode} @@ -471,6 +491,7 @@ \setlength\parskip{0pt}% \interfootnotelinepenalty=10000% } +\endinput % \end{macrocode} % \Finale diff --git a/Master/texmf-dist/source/latex/kdpcover/kdpcover.ins b/Master/texmf-dist/source/latex/kdpcover/kdpcover.ins index 64a5d011068..8fafd2220e8 100644 --- a/Master/texmf-dist/source/latex/kdpcover/kdpcover.ins +++ b/Master/texmf-dist/source/latex/kdpcover/kdpcover.ins @@ -1,6 +1,6 @@ %% (The MIT License) %% -%% Copyright (c) 2021-2022 Yegor Bugayenko +%% Copyright (c) 2021-2024 Yegor Bugayenko %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the 'Software'), to deal @@ -26,7 +26,7 @@ \preamble (The MIT License) -Copyright (c) 2021-2022 Yegor Bugayenko +Copyright (c) 2021-2024 Yegor Bugayenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal diff --git a/Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls b/Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls index 125fa6c0526..5ec4f4ac5e4 100644 --- a/Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls +++ b/Master/texmf-dist/tex/latex/kdpcover/kdpcover.cls @@ -7,7 +7,7 @@ %% kdpcover.dtx (with options: `class') %% (The MIT License) %% -%% Copyright (c) 2021-2022 Yegor Bugayenko +%% Copyright (c) 2021-2024 Yegor Bugayenko %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the 'Software'), to deal @@ -31,7 +31,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesClass{kdpcover} -[2022.11.30 0.5.1 Cover for Kindle Direct Publishing books] +[2025/01/02 0.6.0 Cover for Kindle Direct Publishing books] @@ -58,35 +58,47 @@ \LoadClass{article} \makeatletter -\newcommand*\kdp@pages{100} +\newcount\kdp@pages + \kdp@pages=100 \newlength\kdp@xsize -\setlength\kdp@xsize{6in} + \setlength\kdp@xsize{6in} \newlength\kdp@ysize -\setlength\kdp@ysize{9in} + \setlength\kdp@ysize{9in} \makeatother \RequirePackage{iexec} -\RequirePackage{xkeyval} +\RequirePackage{pgfopts} \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}} -\newif\ifkdp@barless -\DeclareOptionX{barless}{\kdp@barlesstrue} -\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% +\pgfkeys{ + /kdp/.cd, + barless/.store in = \kdp@barless, + pdf/.code = { + \iexec[trace,quiet,stdout=kdpcover-pages-count.txt] + {qpdf --show-npages --no-warn #1 | tr -d '[[:space:]]'} + \openin1=kdpcover-pages-count.txt + \read1 to \temp + \closein1 + \kdp@pages=\temp + }, + 6x9/.code = { + \setlength\kdp@xsize{6in} + \setlength\kdp@ysize{9in} + }, + 7x10/.code = { + \setlength\kdp@xsize{7in} + \setlength\kdp@ysize{10in} + }, + 8x10/.code = { + \setlength\kdp@xsize{8in} + \setlength\kdp@ysize{10in} + }, + pages/.code = { + \kdp@pages=#1 + } } -\ProcessOptionsX\relax\makeatother +\ProcessPgfPackageOptions{/kdp} +\makeatother \RequirePackage{anyfontsize} \RequirePackage{tikz} @@ -99,26 +111,33 @@ \setstretch{1.2} \makeatletter - \newlength\kdp@height +\newlength\kdp@height \setlength\kdp@height{0.125in + \kdp@ysize + 0.125in} - \newlength\kdp@width +\newlength\kdp@width \setlength\kdp@width{ 0.125in + \kdp@xsize - + 0.0025in * \kdp@pages - + \kdp@xsize + 0.125in} + + 0.125in + \kdp@xsize + + 0.0025in * \kdp@pages} \makeatother \RequirePackage{geometry} \makeatletter -\geometry{paperwidth=\kdp@width,paperheight=\kdp@height, - left=0pt,right=0pt,top=0pt,bottom=0pt} +\geometry{ + paperwidth=\kdp@width, + paperheight=\kdp@height, + left=0pt, + right=0pt, + top=0pt, + bottom=0pt +} \makeatother \RequirePackage[absolute]{textpos} \TPGrid{16}{16} -\makeatletter\newcommand\putSpine[2][kdpcover-signature]{% - \ifkdp@barless\else +\makeatletter +\newcommand\putSpine[2][kdpcover-signature]{% + \ifdefined\kdp@barless\else% \begin{textblock}{2.4}[0.5,0](8,0)% \begin{tikzpicture}% \node [rectangle, inner sep=0em, fill=black, @@ -126,19 +145,20 @@ minimum height=16\TPVertModule] at (0,0) {}; \end{tikzpicture}% \end{textblock}% - \fi + \fi% \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 #2 - };% + \Large #2% + }; \end{tikzpicture}% \end{textblock}% \begin{textblock}{2.4}[0.5,1](8,14)% \centerline{\includegraphics[width=0.32in]{#1}}% \end{textblock}% -}\makeatother +} +\makeatother \newcommand\putPicture[1]{% \begin{textblock}{4}(10,2)% @@ -148,54 +168,54 @@ \newcommand\putVolume[1]{% \begin{textblock}{2}[1,1](15,14)% - \raggedleft - \includegraphics[height=0.4in]{kdpcover-vol-#1} + \raggedleft% + \includegraphics[height=0.4in]{kdpcover-vol-#1}% \end{textblock}% } \newcommand\putPrice[1]{% \begin{textblock}{4}[0,1](1,2)% - \small #1 + \small #1% \end{textblock}% } \newcommand\putBack[1]{% \begin{textblock}{5}[0,0](1,3)% - \small #1 + \small #1% \end{textblock}% } \newcommand\putTitle[1]{% \begin{textblock}{5}(10,9)% - \fontsize{32}{32}\selectfont #1 + \fontsize{32}{32}\selectfont #1% \end{textblock}% } \newcommand\putAuthor[1]{% \begin{textblock}{4}(10,10)% - \large by #1 + \large by #1% \end{textblock}% } \newcommand\putTLDR[1]{% \begin{textblock}{5}(10,11)% - TL;DR #1 + TL;DR #1% \end{textblock}% } \newcommand\putVersion[1]{% \begin{textblock}{4}[0,1](10,14)% - #1 + #1% \IfFileExists{.git} {\quad\iexec{git log -n 1 --pretty='format:\%ad' --date='format:\%e-\%b-\%Y'}} - {} + {}% \end{textblock}% } \newcommand\putCopyright[2]{% \begin{textblock}{4}[0,1](1,14)% - \small (c) - #1 #2 + \small (c)% + #1 #2% \end{textblock}% } @@ -206,8 +226,6 @@ \setlength\parskip{0pt}% \interfootnotelinepenalty=10000% } - - \endinput %% %% End of file `kdpcover.cls'. |