1

I'm trying to generate pdfs from EPUB files using pandoc and a custom XeLaTeX template. These EPUB files are all made up of several chapters stored as separate xhtml pages, and any ereader would display each of these chapters starting on a new page. However, the pdfs I get from pandoc do not preserve these page breaks.

I can't manually insert page breaks here because the conversion needs to be done automatically (for lots of books). I also can't rely on \newcommand\sectionbreak{\newpage} in the template because many of the books aren't generated with a separate section for each chapter.

Looking at the tex that pandoc generates from these EPUBs, it looks like each chapter begins with a "hypertarget," like so: \protect\hypertarget{Chapter1.xhtml}{}{}. But otherwise there's really no way to know from just the tex file where the page breaks should be...

So, is there any workaround for this? Is there a way to force a \newpage before every new chapter from my EPUB - perhaps before every instance of \protect\hypertarget...?

1
  • Welcome! Probably easier to pre-process so each file gets a new \chapter or whatever. Not that we have much information to go on in the question, but pre-processing would, I think, be the obvious way to go here.
    – cfr
    Mar 8, 2017 at 0:14

0

You must log in to answer this question.

Browse other questions tagged .