Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Perhaps I'm missing something, but is there a way to either

(a) ensure that pandoc places pagebreaks before level 1 and level 2 headers in markdown (#,##), or

(b) hide \newpage from other markdown tools?

Is it possible to edit the template that pandoc uses for the conversion in order to do (a)?

Any ideas gratefully received.

:-)

share|improve this question
1  
You can easily tweak the style to get get pagebreaks before section. In ConTeXt, one can simply add \setuphead[section,subsection][page=yes]. The titlesec package in LaTeX should provide similar functionality. –  Aditya Sep 4 '13 at 15:35
    
Ok, pretend for a moment that I don't have a clue what ConTeXt is ;-) –  Dycey Sep 4 '13 at 15:37
    
So, what you're saying is pandoc -s -w context doc.md -o doc.tex then edit the .tex file to include your \setuphead line, and context doc.tex ? –  Dycey Sep 4 '13 at 16:00
    
Nope, that did something weird :-) Dropped me into a text editor (vim? emacs?) and complained bitterly. –  Dycey Sep 4 '13 at 16:07
    
ConTeXt is a TeX macro package (just like LaTeX is a TeX macro package). The method you described should work (I don't know what calling context will drop you into an editor). Ideally, you should modify the default ConTeXt template to create a custom template (see pandoc documentation) that has the above line included, so that you do not have to edit the file to add that line every time. –  Aditya Sep 4 '13 at 17:38

2 Answers 2

pandoc --chapters, or pandoc -V documentclass=memoir or pandoc -V documentclass=book will tell pandoc to treat level 1 headers as chapters rather than sections. In both the book and memoir document classes, chapters are preceded by page breaks.

I'm not sure exactly what you need to set in your header to get page breaks before sections. Have you read the documentation for the memoir class? It includes a \setbeforesectionskip{} command that might a place to start.

share|improve this answer

The problem is that LaTeX is not really intended for unattended typesetting.

I concur with Aditya in that ConTeXt is better equipped in dealing with automated page breaks using a setup along the lines of:

\setuphead[section,subsection][page=yes, before={\placefloats\testpage[11]}]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.