| 1 |
# LaTeX Class for KDP Book Covers |
| 2 |
|
| 3 |
[](https://github.com/yegor256/kdpcover/actions/workflows/l3build.yml) |
| 4 |
[](https://ctan.org/pkg/kdpcover) |
| 5 |
[](https://github.com/yegor256/kdpcover/blob/master/LICENSE.txt) |
| 6 |
|
| 7 |
This LaTeX class I use to format covers for |
| 8 |
[my books](https://www.yegor256.com/books.html), |
| 9 |
which I sell [on Amazon](https://www.amazon.com/Yegor-Bugayenko/e/B01AM1QMDK). |
| 10 |
The problem this class solves is |
| 11 |
[the necessity](https://kdp.amazon.com/en_US/help/topic/G201953020) |
| 12 |
to change the size of the cover PDF according |
| 13 |
to the number of pages in the book — the bigger |
| 14 |
the book, the larger must be the cover. The provided class makes necessary |
| 15 |
calculations on-the-fly, using the [`qpdf`](http://qpdf.sourceforge.net/) tool. |
| 16 |
Obviously, |
| 17 |
you need to have it installed. Also, you must |
| 18 |
run `pdflatex` with the `--shell-escape` option, |
| 19 |
in order to allow LaTeX to run `qpdf`. |
| 20 |
|
| 21 |
First, |
| 22 |
[install it](https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages) |
| 23 |
from [CTAN](https://ctan.org/pkg/kdpcover) |
| 24 |
and then use in the preamble: |
| 25 |
|
| 26 |
```tex |
| 27 |
\documentclass[pdf=my-book.pdf]{kdpcover} |
| 28 |
\begin{document} |
| 29 |
% Here you print the cover as you wish, but I recommend |
| 30 |
% you to use the commands available in the class, such as: |
| 31 |
\putSpine{my book, vol. 1} |
| 32 |
\putAuthor{Yegor Bugayenko} |
| 33 |
\end{document} |
| 34 |
``` |
| 35 |
|
| 36 |
Otherwise, you can download |
| 37 |
[`kdpcover.cls`](https://yegor256.github.io/kdpcover/kdpcover.cls) and |
| 38 |
use in your document. |
| 39 |
|
| 40 |
If you want to contribute yourself, make a fork, then create a branch, |
| 41 |
then run `l3build check` in the root directory. |
| 42 |
It should compile everything without errors. If not, submit an issue and wait. |
| 43 |
Otherwise, make your changes and then run `l3build check` again. If the build is |
| 44 |
still clean, submit a pull request. |