Ornamental Breaks

(I’ve been on forum since 2011 as Merovech)

I just finished my 3rd novel using Scrivener and plotting the fourth. For paperback publishing, I’ve resorted to scrivomatic to transpile through Pandoc. This allows me to include ornamental breaks (aka fancy page break or \pfbreak{} in Memoir LaTeX) when there is a section break at the top/bottom of a page, but three-line spacing when in the middle of a page. (It also lets me set up my short-title, title and copyright pages spot-on.)

My question is whether there is a way to do this with Vanilla Scrivener with MMD…or with straight PDF compile. I’m looking to see whether I can shrink my current toolchain. I prefer the toolchain to identify when to introduce the ornamental break rather than manually.

Thanks.

Yes, and in fact there are two applied examples of this with the Tufte compile-format and the “Modern (Custom LaTeX)” format, both of which you’ll find when you switch to MMD→LaTeX / PDF.

The latter is probably going to be of more interest to you, as the Tufte class comes with its own baked-in stuff for separators, which I’m simply tapping into via the Separators compile format pane. Some of this may be stuff you are already doing, and may find you don’t need to adjust much to get things working. To check it out:

  1. Double-click the “Modern (Custom LaTeX)” format to duplicate and edit it.

  2. First go into the Separators pane and select the “Text Section” layout. You might need to copy and paste the custom separator text field out to a text editor to fully see it, as it has carriage returns. You’ll note this isn’t really LaTeX syntax, just some placeholder syntax.

  3. You’ll need to view the Replacements pane to see where that gets converted to LaTeX code. The reason for doing things this way is that it allows for an easier approach for those that prefer to put breaks in the main editor rather than split up the binder outline. It’s easier to read and type in “@ Section Break @” on its own line, than what it gets converted to. It also keeps the implementation more portable as the “front end” is rather agnostic to what class setup you are using, and indeed even file type, as we could convert @ Section Break @ to HTML or whatever else we needed.

    If that’s not an approach that interests you, the Separator setting could be simplified to just insert the LaTeX code directly.

  4. You’ll see it is using a \sectionbreak macro. To see where that command is declared, click on the LaTeX Options tab, and scroll to the bottom of the Header tab.

  5. I throw two different methods in, depending on whether one is using pdflatex (which you’ll get if you use the straight-to-PDF setting) or xelatex. With the later we can include a Unicode glyph using a system font (declared above). We’re using the \fancybreak command for this, via Memoir as well.

If you’re like me though, you may not want Scrivener exporting all of these .tex files when you compile, and rather have a repository of preamble and footer files in your texmf folder. That’s more of an MMD-specific question, as to how to set that up, but it’s relatively straight-forward if you follow MMD’s naming conventions for your .tex files:

  • mmd6-name_of_template-leader.tex
  • mmd6-name_of_template-begin.tex
  • mmd6-name_of_template-footer.tex

And now all you need to do is set the LaTeX Options pane to “None (use Metadata)”, and then add a metadata field called “LaTeX Config”, with the value being “name_of_template”. MMD will handle inserting the \input commands for these three files for you.

That’s the basic idea, let me know if there are any more specifics you need to get things working.

You had me at “Yes.”

Tinkering with the LaTeX header, etc. now. Easy peasy.

With Scrivnomatic, I am using xelatex for all the joy I don’t get with pdflatex (specifically fonts). After MMD->LaTeX I can run xelatex on the command line. I would rather not do that. Scrivnomatic works against just MMD and provides a “Processing” option after “Annotations.”

How do I pass the output of MMD->LaTeX to xelatex without resorting to the command line?

(I figured out the texmf MMD part.)

Separate point:

So far, I have used * * * to denote a section break. When I do it now,
it results in: \begin{center}\rule{3in}{0.4pt}\end{center}. With Scrivnomatic I used a Lua filter to change the outcome to \pfbreak.

For @ Section Break @ to work, I have to “preserve formatting.” Otherwise it creates \textbackslash{}sectionbreak{=latex\} This makes it a tad difficult to globally replace.

That’s what the Processing compile format pane is all about. :slight_smile: I’m pretty sure that is what Scrivomatic uses as well, so you might want to check how it is set up, and copy what makes sense of its script settings. Basically you’ll need to run multimarkdown first, to get a .tex file, and then use latexmk to handle the typesetting to PDF.

Since you have your stuff in texmf now and don’t need the LaTeX Setup pane, switch over to plain “MultiMarkdown”, which is where you will gain access to the Processing pane (if you don’t see it in the list above the format options sidebar, click the gear button and add it). Things do get a little weird here since when you compile you’ll be saving an “.md” file in the dialogue box, but by the time the process is done you’ll get a .pdf (though you can choose to keep the source files as well—I like to, as that makes quick fixes faster than going back and doing a full compile).

If you don’t find a good example elsewhere, check out the “General Non-Fiction (LaTeX)” project template’s default compile settings. It’s using plain-text for the file type instead of Markdown processing (being designed for pure LaTeX writing), but the idea is the same, and while turned off by default, the Processing pane is all set up to produce a PDF.

Are you using RTF to Markdown conversion by chance? That kind of looks like the result you get with Scrivener trying to treat the original source as being somewhat oblivious to all forms of markup. And if so, then yes, Preserve Formatting is one of the recommend ways around that.

I’m using the stock text editing behavior, which would be RTF. I’ll see if I can globally replace with preserved formatting. :slight_smile:

Now on to your earlier reply.

You should be able to. Replacement ordering can sometimes be bit a little trial and error, since they run more than once during compile (to catch different use cases), and in some cases some hard-coded processing happens before they run, or after, and you can’t do much about what the software is doing. If Preserve Formatting doesn’t work, trying creating a style for marking these instead, and set up that style in the compile format as well, using the Treat as raw markup setting. That is there specifically for passing Markdown (and by extension other syntax) through the RTF conversion engine.

Alas, this is not fitting my use case. Scrivomatic for all its kludginess seems to be my best option today.

My use case involves writing in RTF and exporting to PDF and ePUB. I can use three asterisks to create a section break without adding any formatting in both formats. Having to add a style to keep it from being converted to a rule breaks flow. Using @ Section Break @ is visually distinctive, but affects word count tracking. Scrivomatic feeding Pandoc lets me use Lua to fix the problem in Pandoc. So, my solution would likely require Pandoc.

I’m not giving up on the idea just yet. I’m not fond of Scrivomatic’s use of YAML to pass metadata. But, I have a deadline. As much as I would love to shave this yak, I need to focus on writing. :slight_smile:

for someone with less expertise - if I created a png file seperator and used custom seperator can I point to that image file in the research folder and use that as a unique separator such as this.
Decorative-Line-Black-PNG-HD

I think that if this were tried, and the results examined, you would see why that would not be an optimal way of working. Here is what some sample .tex looks like, using a best-practices approach. First, in the preamble somewhere we set up the break macro so that it prints an image, horizontally centred within the text block.

\newcommand{\sectionbreak}{
	{\centering \includegraphics[width=232pt]{scene_separator.png}}
}

You’d have this somewhere at the very top of the document in your preamble. Then each section break throughout the book would look like this:

\part{Red Book}
\label{redbook}

Dri srung gronk ozlint; zeuhl la, ti dri. Relnag xi nalista dri lydran wynlarce, prinquis zorl nalista, zeuhl re obrikt relnag erk wynlarce wex pank gronk? Menardis clum, morvit xu ma yem twock irpsa ma cree tolaspa. Erk teng flim obrikt; menardis nix frimba tharn nalista kurnap rhull.

\sectionbreak

Relnag sernag arul; zorl ma ux flim ma wex yiphras prinquis, ti obrikt twock. Irpsa groum xu frimba re irpsa harle quolt velar ewayf teng, korsa tharn srung re lamax. Srung nalista; groum ma erc, erk la gra prinquis vusp fli vusp frimba lydran vo urfa teng berot ju quolt. Athran xi, gen velar srung; lydran su zeuhl fli jince su xu fli. Ma vo whik arka teng nix ozlint vusp pank.

It’s clear what is meant, it is easy to work with directly, and even write with, and nobody is going to question why you did things this way.

If instead you were to use Scrivener to insert an image between every single break, using its Separators pane to inject an image code with some additional formatting around it to present it properly, every single section break in the book would look like this:

\part{Red Book}
\label{redbook}

Dri srung gronk ozlint; zeuhl la, ti dri. Relnag xi nalista dri lydran wynlarce, prinquis zorl nalista, zeuhl re obrikt relnag erk wynlarce wex pank gronk? Menardis clum, morvit xu ma yem twock irpsa ma cree tolaspa. Erk teng flim obrikt; menardis nix frimba tharn nalista kurnap rhull.

{\centering \includegraphics[width=232pt]{scene_separator.png}}

Relnag sernag arul; zorl ma ux flim ma wex yiphras prinquis, ti obrikt twock. Irpsa groum xu frimba re irpsa harle quolt velar ewayf teng, korsa tharn srung re lamax. Srung nalista; groum ma erc, erk la gra prinquis vusp fli vusp frimba lydran vo urfa teng berot ju quolt. Athran xi, gen velar srung; lydran su zeuhl fli jince su xu fli. Ma vo whik arka teng nix ozlint vusp pank.

It’s messy, and bad practice to “repeat yourself” over and over like that. We have the ability to make commands to avoid that pitfall, and to be able to make central changes to how those commands work, if need be.

Beyond that, I would say there is a philosophical point to be made, at least as a matter of personal preference. That is not the type of detailing I would use Scrivener for, personally, and rather see it entirely a design decision to be solved with the .tex setup. The image itself would probably not be in Scrivener at all, save maybe as an aliased binder link to the texmf folder copy. For example the L&L logo on the copyright page of the user manual is found nowhere in my Scrivener project (nor indeed is anything on that copyright page, except a few pieces of metadata driving revision text and such).

Don’t get me wrong, you could do things the way you describe, using Scrivener’s <$img:...> code in the separators pane—it just wouldn’t produce a clean .tex file that conforms to best practices, and as I say, more ideologically speaking, dips into depending too heavily upon the wrong tool (Scrivener) to design the document. At least that’s how I feel about it. If you’re going to use LaTeX, you might as well use LaTeX, and not some chunky hybrid. :slight_smile:

On the matter of which separator marker to use, that of course could be changed in the compile settings, and * * * is distinctive enough that it would be safe to use in a Replacement.

But otherwise, I entirely agree with the assessment to stick with what works best for you in the moment! Pandoc is a fantastic system, and quite a bit more flexible than MultiMarkdown in most regards. It is how stuff like Scrivomatic is possible—I think to pull that off with MMD you would probably need to fork its source code to change how core elements of it work—something you can do with Pandoc’s built-in template and custom filter setup with minimal familiarity with programming.

So outside of the ideal of not having an external dependencies, there wouldn’t be too much to be gained by switching Markdown processors. And even then, I tend to keep my MultiMarkdown distribution installed separately and kept up to date (which Scrivener checks for and uses over its internal copy), since Scrivener updates are rather slow.