Add support for pagebreaks for LaTeX input and HTML output.
This patch requires a new type in pandoc-types. I have submitted a pull request there too. Depends on https://github.com/DavidGriffith/pandoc-types/commit/4aa6b78bb83f85714055fafd72240dec79a95a03 in pandoc-types
I suspect that build error is because of the above-mentioned dependency.
This is a start, but really the new element needs to be supported in all of the writers, and possibly in some auxiliary functions as well. (Otherwise we'll get compiler warnings about non-exhaustive pattern matches, and runtime errors if people try to use a writer that doesn't support the new element on a document that has it.)
You're seeing compiler warnings when you compile the code with your patch, right?
Ah, yes. I'll research what constitutes a page break for the other outputs, add that, and resubmit.
For ConTeXt, page breaks are introduced by \page.
I am currently using \clearpage and \cleardoublepage which are the appropriate LaTeX Commands. If Pandoc has a feature like this, IMHO it should be marked as such. In particular it should have the option to break to the next odd page.
+++ Bernhard Weichel [Apr 06 13 07:03 ]:
I am currently using \clearpage and \cleardoublepage which are the appropriate LaTeX Commands. If Pandoc has a feature like this, IMHO it should be marked as such. In particular it should have the option to break to the next odd page.
Are there any cases where you need "break to next odd page" other than chapter starts (which LaTeX already handles that way automatically)?
yes there are. For example if I am writing a quality manual which includes forms. If such a form has two pages, I want to start it at an odd page, such if someone prints the document, he gets the form on one sheet of paper.
Another uscase is, that if i deliberately want that a diagram starts on the left page such that the explanation comes to the right page. In this case, I want to break to the next even page.
On Sat, 6 Apr 2013, Bernhard Weichel wrote:
yes there are. For example if I am writing a quality manual which includes forms. If such a form has two pages, I want to start it at an odd page, such if someone prints the document, he gets the form on one sheet of paper.
Another uscase is, that if i deliberately want that a diagram starts on the left page such that the explanation comes to the right page. In this case, I want to break to the next even page.
I added "NewPage" to Pandoc-types. Perhaps I should add "ClearPage" and "ClearDoublePage" too?
David Griffith [email protected]
+++ David Griffith [Apr 07 13 16:00 ]:
I added "NewPage" to Pandoc-types. Perhaps I should add "ClearPage" and "ClearDoublePage" too?
LaTeX has \newpage, \clearpage, and \cleardoublepage.
They are all different, and there are situations where each is
appropriate. (\newpage breaks a column in two-column mode,
while \clearpage forces a new page.)
I'm a bit concerned about the idea that pandoc should support all of these. Pandoc tries to support a common core of document features that can be rendered in most of the output formats. This was part of my hesitation about adding NewPage at all -- page breaks don't even make sense in some of the output formats. And certainly most formats don't provide the kind of fine-grained control that LaTeX does.
If we were to attempt to support these fine-grained options, they might make more sense as attributes or parameters of NewPage. e.g.
NewPage { oddPage :: Bool }
I'm not sure.
On Sun, 7 Apr 2013, John MacFarlane wrote:
+++ David Griffith [Apr 07 13 16:00 ]:
I added "NewPage" to Pandoc-types. Perhaps I should add "ClearPage" and "ClearDoublePage" too?
LaTeX has
\newpage,\clearpage, and\cleardoublepage. They are all different, and there are situations where each is appropriate. (\newpagebreaks a column in two-column mode, while\clearpageforces a new page.)I'm a bit concerned about the idea that pandoc should support all of these. Pandoc tries to support a common core of document features that can be rendered in most of the output formats. This was part of my hesitation about adding NewPage at all -- page breaks don't even make sense in some of the output formats. And certainly most formats don't provide the kind of fine-grained control that LaTeX does.
Funny that you mention that all formals "don't provide the kind of fine-grained control that LaTeX does". I was about to send a reply that LaTeX page-break control model does not provide enough control as ConTeXt. For example, ConTeXt provides:
- Control number of blank pages
- \page (page break)
\page[left](page break to the next "left" page, flush floats)\page[right](page break to the next "right" page, flush floats)\page[odd](page break to the next "odd" page, don't flush floats)\page[even](page break to the next "even" page, don't flush floats)\page[quadruple](page break to the next "multiple of 4" page)
- Control headers and footers on empty pages
\page[empty](disable headers and footers)\page[header](disable header but not footer)\page[footer](disable footer but not header)
- Control how likely is a page-break at a certain location
\page[disable](disable page break. TeX tries hard not to put a page-break atthis spot)\page[preference](break page if not more than 3 lines can fit in the remaining space)\page[bigpreference](break page if not more than 5 lines can fit in the remaining space)
and a few other esoteric options that I am not mentioning here.
Clearly, it does not make sense for pandoc to support all of these.
If we were to attempt to support these fine-grained options, they might make more sense as attributes or parameters of NewPage. e.g.
NewPage { oddPage :: Bool }
I'm not sure.
For the ConTeXt page-break model, a good approximation will be
Page { oddPage :: Bool
, flushFloat :: Bool
}
Another option, which I have suggested in the past for bold and emphasis, is for pandoc to generate a configurable command, (e.g., in ConTeXt)
\page[pandoc]
and let the user configure what it does. In ConTeXt, this means that the default template should include
\definepagebreak[pandoc][yes]
but the user can override it, if needed. The drawback of such a proposal
is that pandoc output (without the -s option) is not usable out of the
box.
Aditya
How are these pagebreakes specified in the markdown input?
No syntax has been decided on as yet.
+++ Bernhard Weichel [May 10 13 02:13 ]:
How are these pagebreakes specified in the markdown input?
— Reply to this email directly or [1]view it on GitHub. [xJAuenYDiIoVt3LF3y68422C0u2Jb4PmJi6GFB34_HZG2IipqGpOPxtfefF1W4N_.gif]
References
- https://github.com/jgm/pandoc/pull/805#issuecomment-17711134
Representing page breaks in Markdown: the simplest idea seems to be to use the ASCII character 0x0C (NP - new page; or FF - form feed). This is the standard tty directive for new page, and is understood and represented comprehensibly (if not intuitively) by the text editors I checked.
The biggest downside is that entering and displaying this character does not seem to be supported by most browser text input areas (neither Webkit nor Gecko do, except with Javascript support). But this does not seem crippling if it is not meant to be "frontline" markup and the alternatives will be intrusively nonconservative.
bump
See #3230