Is there any way to force page breaks in pdf generation?
--Tom
Via latex or via rst2pdf?
--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)
Well... just generally inserting page breaks in my Sphinx scripts. I
don't have any preference regarding the specific technique.
--Tom
Oh, that's easy ;-)
In your conf.py, add
pdf_break_level = 1
And you get pagebreaks in top-level sections, 2 for breaks on subsections, and
so on.
You may also want to add
pdf_breakside = "odd"
or "even" or "any".
Best regards,
They are builder-specific, I think. For example, for HTML they make no sense.
For rst2pdf:
.. raw:: pdf
PageBreak
There are CSS print styles to affect HTML print documents. Untested example:
.. raw:: html
<br style="page-break-after: always" />
Another approach might be:
.. cssclass:: pagebreak
Paragraph or section or whatever...
Then add to the stylesheet:
.pagebreak { page-break-before: always }
--
--Max Battcher--
http://worldmaker.net
* There is no generally supported page-break element in the
reStructuredText markup language.
* You can configure page-breaks at certain elements (e.g. before level-1
sections) in the custom style sheets.
Custom style sheets are writer dependent, so it matters, whether you
use rst2latex, rst2newlatex, or the rst2pdf extension.
With rst2latex:
* Page breaks before top-level sections are the default with a
documentclass that provides "chapters", e.g. "book", "memoir" or
"scrbook".
* Redefining the \section or \section* command in a
style sheet is possible too.
* `Raw latex` can be used::
.. raw:: latex
\newpage % hard pagebreak at exactly this position
or
.. raw:: latex
\pagebreak[2] % recommended page break after line end (precedence 1...4)
* The transition element can be re-defined to produce a page break,
e.g.
in a style sheet::
\newcommand*{\DUtransition}{\pagebreak[4]}
or in the document::
.. raw:: latex
\renewcommand*{\DUtransition}{\pagebreak[4]}
(The redefining of the transition element requires a recent snapshot of
the Docutils and might not (yet) work with Sphinx.)
Günter
Or just .. class:: once the code directive renaming takes place, of course.
> Paragraph or section or whatever...
>
> Then add to the stylesheet:
>
> .pagebreak { page-break-before: always }
Following this approach to its logical conclusion... Would it make sense
to standardize on a class name here and then encourage all of the Sphinx
builders that have some sort of print form to look for a standard class
name and always page break before/after items tagged with it? (That is,
make it a part of the default stylesheets of as many builders as possible.)
It seems to me that a generic class that most or even all builders
respond to for "forcing" page breaks in print layouts might be handy to
have (and to document having).
>> .pagebreak { page-break-before: always }
Sensible idea. Could you file it at as a feature request to the Docutils
tracker http://sourceforge.net/tracker/?group_id=38414&atid=422033
please? This way it will be remembered.
Günter