Scrivomatic: how to include page breaks

This is basically a follow-up and intrinsically connected to this thread on paragraph breaks. Both are compile a manuscript using the Scrivomatic workflow of Ian (nontroppo) that transforms to .md first then to microsort word afterwords to include citations.

My compiled manuscript formatting suffers from missing page breaks (none at all). I looked at

  1. compile > format > section layouts
    The manual says that in the lower windows a page break-tab exists only for certain compile-outputs such as epub.

  2. compile > format > separators.
    I tried section break as it seems to be the strongest option. A page break option is not given.

Page break = section break.

The first is mentioned in Scrivener only for print formats (pdf, docx). The latter is mentioned only in non-print formats (where there’s no such thing as a page). Either way, you get page/section breaks by setting Separators for a section layout to page or section break. If you make the separator “page break” in a pdf or docx export format, it’s automatically set to “section break” if you switch to an ePub or mobi export … and vice versa.

Markdown, being plain text, is by default not a paged media, and as DrBob correctly summarises, section breaks are output that will not translate into page breaks by default. However, as long as the target format supports it (and DOCX does), there is a Pandoc filter which will convert LaTeX raw page break commands into the equivalent markup in several other formats.

github.com/pandoc/lua-filters/t … /pagebreak

So place the text “\newpage{}” between sections; Scrivener can add it for you in the Seperators section of the compile format editor:

[attachment=0]Screen Shot 2021-03-08 at 14.17.31.png[/attachment]

… and make sure your pandocomatic.yaml specifies the filter correctly, example shows my pandocomatic.yaml for DOCX:

github.com/iandol/dotpandoc/blo … c.yaml#L80

Output in Word, showing page breaks between sections as specified:

[attachment=1]Screen Shot 2021-03-08 at 14.15.47.png[/attachment]

When the filter finds \newpage{}, it will replace it with the correct equivalent (<w:p><w:r><w:br w:type=“page”/></w:r></w:p> in Word OpenXML). In theory it can be extended to any format that offers some sort of markup for page breaks.

Dear Ian,

thank very much. I have tried copying the lua-filter line of your pandocomatic.yaml - and I stumpled upon some problems since I was using an older version of your workflow - and I tried using your whole yaml-file. It did not work for me. Instead of multiple more or less empty pages with headlines I have this as text for only one page (and no break afterwords)

Any thoughts?

Make sure you enter newlines BEFORE and AFTER the \newpage{} text in the compiler — this is a little hard to do because Scrivener only shows you one line in the UI and doesn’t visualise line breaks, but you use ALT+RETURN to enter line breaks in these fields. If that works then your compile section will reflect the line breaks properly (although shows the text centered which is not what the markdown will be):

[attachment=1]Screen Shot 2021-03-12 at 08.09.21_SMALL.png[/attachment]

Then, you should check the markdown output, it should look something like this:

# Results #

Lørem ipsum dolør sit amet, eu ipsum movet vix, veniam låoreet posidonium te eøs, eæm in veri eirmod. Sed illum minimum at, est mægna alienum mentitum ne. Amet equidem sit ex. Ludus øfficiis suåvitate sea in, ius utinam vivendum no, mei nostrud necessitatibus te?  

Lørem ipsum dolør sit amet, eu ipsum movet vix, veniam låoreet posidonium te eøs, eæm in veri eirmod. Sed illum minimum at, est mægna alienum mentitum ne. Amet equidem sit ex. Ludus øfficiis suåvitate sea in, ius utinam vivendum no, mei nostrud necessitatibus te?  


\newpage{}


# Discussion #

Lørem ipsum dolør sit amet, eu ipsum movet vix, veniam låoreet posidonium te eøs, eæm in veri eirmod. Sed illum minimum at, est mægna alienum mentitum ne. Amet equidem sit ex. Ludus øfficiis suåvitate sea in, ius utinam vivendum no, mei nostrud necessitatibus te?  said this. 

Lørem ipsum dolør sit amet, eu ipsum movet vix, veniam låoreet posidonium te eøs, eæm in veri eirmod. Sed illum minimum at, est mægna alienum mentitum ne. Amet equidem sit ex. Ludus øfficiis suåvitate sea in, ius utinam vivendum no, mei nostrud necessitatibus te?  

Checking the markdown will tell you if Scrivener’s compiler output correctly. If it did, then the conversion to DOCX should generate a scrivomatic.log file that shows the pagebreak.lua filter is being called:


=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.30 Report @ 2021-03-12 08:09:44 +0800 ===
=== ------------------------------------------------------ ===
 Running shell: /bin/zsh
 Working directory: /Users/ian/Desktop/Compile-mmd
 Initiating with Ruby 2.6.3
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="Test.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/ian/bin:/Users/ian/.rbenv/shims:/Library/TeX/texbin:/usr/local/bin:/Users/ian/miniconda3/bin:/Users/ian/.local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/ian/bin:/Users/ian/.rbenv/shims:/Library/TeX/texbin:/usr/local/bin:/Users/ian/miniconda3/bin:/Users/ian/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
===------ TOOL PATHS: ------===
---pandoc: /usr/local/bin/pandoc | V: 2.12
---pandocomatic: /Users/ian/.rbenv/shims/pandocomatic | V: 0.2.7.5
---ruby: /Users/ian/.rbenv/shims/ruby | V: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
---rbenv versions:
  system
  2.7.2
* 3.0.0 (set by /Users/ian/.ruby-version)
---rbenv: /usr/local/bin/rbenv
---gem: /Users/ian/.rbenv/shims/gem
---python: /Users/ian/miniconda3/bin/python
---xelatex: /Library/TeX/texbin/xelatex
---latexmk: /Library/TeX/texbin/latexmk

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /Users/ian/.rbenv/shims/pandocomatic --debug Test.md 
::: pandoc  --from=markdown \
:::     --to=docx \
:::     --standalone \
:::     --lua-filter=/Users/ian/.local/share/pandoc/filters/pagebreak.lua \
:::     --filter=/Users/ian/.local/share/pandoc/filters/prependAll.rb \
:::     --filter=/Users/ian/.local/share/pandoc/filters/simplifyMetadata.rb \
:::     --reference-doc=/Users/ian/.local/share/pandoc/templates/custom.docx \
:::     --output=/Users/ian/Desktop/Compile-mmd/Test.docx
::: Pandocomatic needed 1.2 seconds to convert '/Users/ian/Desktop/Compile-mmd/Test.md' to 'Test.docx'.
:: exit status: pid 9251 exit 0

That will tell you that Pandoc was passed the correct settings. I attach a test scrivener project you can try to compile.

[attachment=0]Test.scriv.zip[/attachment]

Hej there,

the filter works in your project though not in mine. I still see /newpage{} written in my project, so I assume it must be something in the way I have my set compile details?

I made my separators just like in your project. Log says that filters are called successfully. (In the log there are only a couple of wrong references and three “no graphic rendering in raw in line” that are because some wrong text markers for myself)

[attachment=0]Screenshot 2021-03-12 at 14.17.00.png[/attachment]
[attachment=1]Screenshot 2021-03-12 at 14.16.28.png[/attachment]

I believe you need a backslash (\newpage{}) not a forward slash (/newpage{}). – Katherine

correct! It was a backslash. ( we shall never speak of this ;) )

Excellent information friend, it worked very well for me.

Topic moved to Markdown forum. – Katherine