Add support for pagebreaks for LaTeX input and HTML output. #805

Open
wants to merge 3 commits into
from

Projects

None yet

6 participants

@DavidGriffith

This patch requires a new type in pandoc-types. I have submitted a pull request there too.
Depends on
DavidGriffith/pandoc-types@4aa6b78 in pandoc-types

@DavidGriffith DavidGriffith Add support for pagebreaks for LaTeX input and HTML output.
Depends on 4aa6b78bb83f85714055fafd72240dec79a95a03 in pandoc-types.
ac88070
@DavidGriffith

I suspect that build error is because of the above-mentioned dependency.

@jgm
Owner
jgm commented Apr 3, 2013

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?

@DavidGriffith

Ah, yes. I'll research what constitutes a page break for the other outputs, add that, and resubmit.

@adityam
adityam commented Apr 4, 2013

For ConTeXt, page breaks are introduced by \page.

@bwl21
bwl21 commented Apr 6, 2013

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.

@jgm
Owner
jgm commented Apr 6, 2013

+++ 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)?

@bwl21
bwl21 commented Apr 6, 2013

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.

@DavidGriffith

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
dave@661.org

@jgm
Owner
jgm commented Apr 8, 2013

+++ 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.

@adityam
adityam commented Apr 8, 2013

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. (\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.

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

@bwl21
bwl21 commented May 10, 2013

How are these pagebreakes specified in the markdown input?

@jgm
Owner
jgm commented May 11, 2013

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

  1. #805 (comment)
@chalst
chalst commented Jul 16, 2013

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.

@bb010g
bb010g commented Mar 16, 2015

bump

@jgm
Owner
jgm commented Jan 4, 2017

See #3230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment