sphinx-doc and pdf as booklet

19 views
Skip to first unread message

Oleh Kravchenko

unread,
Apr 28, 2024, 11:48:27 PMApr 28
to sphinx-users
Hello, Sphinx-Doc community!

I'm looking for a way to generate a PDF file as booklet.
Is it possible with Sphinx-Doc?

I'm a newbie with Sphinx-Doc and Latex.
Maybe someone point me to a good example?

Daniel Woste

unread,
Apr 29, 2024, 7:05:09 AMApr 29
to sphinx-users
Hello Oleh,

if Latex is not a must-have, you can also try Sphinx-SimplePDF:
https://sphinx-simplepdf.readthedocs.io

It's based on HTML and CSS  only and comes with a nice default theme.
Two PDF examples are available on its website.
But I'm not sure if these examples already fulfill your requirements for a booklet.

Disclaimer: I'm the maintainer of this extension, so please forgive me for the little advertising.

Greetings,
  Daniel

Steevie

unread,
Apr 30, 2024, 2:17:53 AMApr 30
to sphinx...@googlegroups.com
On Sun, 28 Apr 2024 03:31:04 -0700 (PDT), Oleh Kravchenko wrote:

> Hello, Sphinx-Doc community!
>
> I'm looking for a way to generate a PDF file as booklet.
> Is it possible with Sphinx-Doc?
There are AFAIK two packages that allow to print a latex document as a
booklet: booklet and 2up.
You can put them (like any latex packages and configuration) in conf.py
using variable latex_elements[preamble]. For example, here is an excerpt
of such configuration I used some time ago:

latex_elements['preamble'] = """
\\usepackage{graphics}
\\usepackage{fontawesome}

%remove this to clear "draft" watermark
%\\AddToShipoutPicture{%
% \\AtTextCenter{%
% \\makebox(0,0)[c]{%
% \\resizebox{0.45\\textwidth}{!}{%
% \\rotatebox{90}{\\textsf{\\textbf{\\textcolor[gray]{0.80}
{Draft}}}}}}}}
"""

Note that you have to double all backslashes to correctly escape them.

If you add the booklet or 2up package and its configuration, you just
need
to "make latexpdf" to get your booklet.

HTH,
Stefano

PS: I never tried sphinx-simplepdf, it seems nice and I'll give it a try
soon, thanks Daniel


Reply all
Reply to author
Forward
0 new messages