How to suppress Part in MMD > LaTeX Book (Memoir)


I’m using Scrivener 3 for Windows beta and compiling for MMD > LaTeX using Book (Memoir) format. I’ve configured Project Setting’s Default Types by Structure such that Chapter is associated with Level 1 folders, Section associated with Level 2 folders, etc. Folder groups and Files are configured accordingly. Part does not appear anywhere in the configuration. The generated .tex is converting Level 1 folders to LaTeX \Part and Level 2 folders to \Chapter. My expectation was that Level 1 folders should map to LaTeX \Chapter Level 2 should map to \Section.

I am using the Book format because I want a separate title page and TOC. Also, I’ve verified the document compiles correctly if I compile to plain text and use the LaTeX (Memoir Book) format–generated output is as expected. Can you please provide guidance for what I am doing wrong, or is this the expected behavior.

Thanks so much for assistance.

One thing to be aware of with Scrivener’s Markdown output of your outline structure is that it pretty much completely ignores section types and has no idea what you mean when you change the name of things from “part” to “chapter”. In a more traditional use of the software, you would indeed create a whole pack of hierarchically named section types like that and then assign them to each individual level, and then go into compile and pair up each level of your outline to a different layout to make it act like a certain thing… it’s what most of the tutorials will describe as being necessary.

But, with Markdown it is a great deal more straightforward because that system already has a concept of actual hierarchy built into it, we don’t need to fabricate the notion from scratch with dozens of settings. Scrivener+Markdown users can often get away with having only one or two section layouts total: one with a heading and one without. In Markdown, hierarchical heading structure looks like this:

# One

## Two

### Three

## Two

## Two

# One

By default, MultiMarkdown turns that into:


Scrivener, by default, is going to map your outline hierarchy in the draft directly to hash-based depth. Barring cases where you wouldn’t want all draft structure to come out as hierarchy, this result is generally always correct. I.e. if you don’t need parts, one does not do something like this:

## One

### Two

I mean, you can, but it’s not best practice. It’s better for the outline structure to be abstract. A single hash doesn’t mean “part”, it simply means the highest organisational unit in the output.1

So to satisfy the problem of cases where the highest unit is what might be effectively created at h2 or h3 by default, MultiMarkdown (and Pandoc) have mechanisms for essentially shifting the value of hashes downward. You still have Scrivener generating one hash for the highest unit, but you tell MMD that the highest unit is actually 2.

To fix it:

  1. Go into File ▸ Compile....
  2. For MultiMarkdown:
    1. In the Metadata tab on the right hand side, note the table of metadata keys (you’ll probably see “Author” and “Title” already here at the least). Click the + button below this to add a new one.
    2. Call it “Base Header Level”,2 and supply it with a value of “2” (which for LaTeX will mean \chapter level is highest.)
  3. For Pandoc:
    1. At the bottom of the Metadata pane, adjust the Base header level settings itself to “2”.

So that’s how to fix it, if you intend to always work this way, you may want to consider making this metadata adjustment to the compile format instead of the project settings. In fact, if you examine the Article (Memoir) stock example, you’ll find I’ve already boosted the base header level to “2”, since that setup doesn’t even use parts.

1) For the sake of completion though, refer to §24.2.4, Title Options, in the user manual PDF, scrolling down to pg. 621, where the Number of hashes option is addressed. With this, you actually could fabricate a manually controlled type/layout hierarchy like an RTF-based Scrivener user would. But it would generally be a waste of time to do that since we get this for free. This is better used for odd cases where your draft outline structure doesn’t match “reality”; it could also be used to adopt a much more detailed outlining style than there is necessary structure to express on output.

2) Here is the MMD documentation on the setting.

Hello Amber. Thanks so much for your very detailed explanation which resolves most of my confusion. The current document I am creating relied on using folder names as headings. Am I correct that to use the solution you have provided I should add the headings directly to the content area using the # to mark the hierarchy and mostly use section layouts without heading?

Adjusting the base header level is a MultiMarkdown setting, to reiterate. It changes how MMD interprets the quantity of hashes per heading, which is how you skip having parts by making 1 = 2. This trick can work on a plain .md file that you execute multimarkdown.exe against in shell, it really has nothing to do with Scrivener or how you use it to generate (or not) headings.

So the only part where Scrivener comes into the picture is where you plug in the metadata so that it is printed into the .md file correctly. It might not be a bad idea to compile with the plain MultiMarkdown setting to an .md file, set that aside, then follow the steps above and compile to another .md file. Open both of them up and examine the difference.

Thanks a lot @AmberV , your reply has been very helpful for me too! On a related note how can I tell MMD via the Scrivener compile settings/metadata to treat a lower level as a chapter/section /subsection? I’ve noticed that when i use base level 1 / parts , it will of course include a level further down , since what with base level 2 used to be a chapter is now a part. So I may have, when compiling via MMD to LaTeX

I. Name of first chapter (now as a part)

  1. Name of Section (now as a chapter)
    1.1 Name of Subsection (now as a chapter)
    if the base level is 1, or
  2. First chapter
    1.1 Section
    if the base level is 2

I’m not expressing myself well, but i hope you get the idea. Now I want to get 3 levels (numbered subsections that are listed in the TOC) without having to use parts, i.e.

  1. Name of first chapter
    1.1 Section
    1.1.1 Subsection

What’s the best way to achieve that?

Are you asking how to change the table of contents layout itself, rather than anything about the structure of the book? In that case you are asking how to modify a setting in your LaTeX document.

It sounds like you want chapters to be the top level, but are thinking that the table of contents in a LaTeX document is based on the level of depth in a fluid way, rather than being set to a fixed point (like “subsection”). What I mean by that is: you tell the table of contents macro the deepest level you want shown in the ToC, and that is it. It doesn’t matter if you use parts or not.

As for the Scrivener side of things, it would be a start to read about how MMD puts together LaTeX documents, and how Scrivener lets you customise that, in §21.5.3 of the user manual, pg. 540.

Ah right, of course ! It’s been a while since I’ve written in LaTeX. thanks so much for clarifying !