## LaTeX article section types

el
elw2u16
Posts: 28
Joined: Tue Nov 28, 2017 9:29 am
Platform: Mac
Hi,

Me again. I'm creating a LaTeX document with document class article. I have my main folders under Draft set as section type 'Section', and sub-documents under these set as section-type 'Structure-Based'. When compiled to LaTeX, the main folders are converted to \part{}, and the sub-documents to \chapter{}.

Only problem is, article doesn't recognise a \chapter section type so any formatting I try to apply within LaTeX is ignored.

Is there a way around this? I find the section layout stuff in Scrivener fairly confusion tbh, but having searched around can't find a way of setting this. Ideally I'd like the sub-documents to become \section in the .tex document. Currently I'm changing manually but it's quite tedious.

Thanks in advance,
Emma

AmberV
Posts: 24314
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:
From previous posts, it looks like you are using MultiMarkdown to generate the .tex file, making this ultimately a question about how that system produces document structure. With MMD, one tends not to use Scrivener’s Section Type feature to determine specific types of headings, because those are handled naturally by MMD by their depth—and Scrivener creates heading depth by default based on the outline structure of the document. Rather in most cases Section Types, and how they are coupled with Layouts in the compile settings, will be more useful in defining broad statements about how a chunk of the binder should export. If you take a look at the Layout choices in the “Basic MultiMarkdown” format, you’ll see what I mean.

The idea being, the structure of a document as a Markdown file should be abstract—not specifically tuned to produce one document, but rather capable of producing a variety of documents. Let’s take a look at what Scrivener does first. Here is an example binder of a very simple draft folder:

When compiled under default settings, using the “Basic MultiMarkdown” compile format, and setting all folders to use the “Heading” Layout (which simply prints a heading and no text), we get this result:

Code: Select all

# A Level One Heading ### A Level Two Heading ##### A Level Three Heading ###

Scrivener is the one responsible for adding hashmarks based on the depth of the items in the binder. Now if we were to convert this to LaTeX using MMD, by default this is the result we would get:

Code: Select all

\part{A Level One Heading }\label{aleveloneheading}\chapter{A Level Two Heading }\label{aleveltwoheading}\section{A Level Three Heading }\label{alevelthreeheading}

So far it sounds like we are describing the results you are getting. The first code example is what I referred to as an abstract document. Nothing is really said about what these headings will be. They are just hierarchically arranged in a logical tree.

The fundamental issue is in the production of this specific document, in that you want level one headings (with one hash) to be treated as though they were sections, or what are by default level three headings (and presumably on down—a level two heading should be a subsection and so forth). Fortunately MultiMarkdown has a tool for handling this problem, and you can plug this setting into Scrivener’s compile settings, under the Metadata compile option tab on the right:

NOTE: I used “2” in the screenshot but this is mistaken, it should be “3”.

1. Click the + button in the lower right corner of the metadata area to add a new key.
2. Give the key name “Base Header Level”.
3. In the large text field below, type in “3”. This means “1 should equal 3”, or “Part should equal section”, to transpose from abstract to literal.

Now when you compile, you will get precisely the same document structure in abstract—the number of hashes importantly do not change—but at the top of the document there will be this “Base Header Level” key. When MMD is requested to process this document into a .tex file, the result becomes:

Code: Select all

\section{A Level One Heading }\label{aleveloneheading}\subsection{A Level Two Heading }\label{aleveltwoheading}\subsubsection{A Level Three Heading }\label{alevelthreeheading}
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

el
elw2u16
Posts: 28
Joined: Tue Nov 28, 2017 9:29 am
Platform: Mac
Great, thank you, that's very clear. I'm still getting to grips with how processing is variously handled by Scrivener and MMD.

Thanks again,
Emma

li
liz
Posts: 75
Joined: Sat Mar 25, 2017 6:40 pm
Platform: Win + iOS
Another comment: If you don't want a Scrivener doc to be included in the part-chapter-section etc. hierarchy as in the Binder, mark it "Compile As Is." I do this with each doc that is in a theorem environment (using escaped LaTeX) and have my preamble number each theoremstyle as a subsubsection.

AmberV
Posts: 24314
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:
That’s an approach that can be taken with Windows and Scrivener 2. There isn’t a “Compile As-Is” checkbox in Scrivener 3 (or the Windows beta) any more, just like there is no longer a “Page break before” checkbox. What replaced that approach of ad hoc checkboxes and such is a system of types. Basically the idea being that if a document should be “as-is”, then it is probably that way for a semantic reason. Perhaps it is a dedication page—maybe it should be designated as “Front Matter” in that case, and then in our compile settings we can say “Front matter should not have headings and should compile the text as-is”.

Or in your case you could create a type of document called “Theorem”, and that’s all you would do while writing—just flag it as such and move on (an incidental nice side effect of doing so would mean being able to search for “Theorem” in Project Search and get a concise list of all chunks of text so designated). Then in the compiler you could go in and in fact add the LaTeX commands yourself as part of what a theorem really looks like in the output.

It’s very much a form vs structure based system now—much more like LaTeX in that regard, where in the project we are saying the equivalent of “\chapter”, as a setting on each binder item, and in the compile settings, that is where we have the dozen lines of commands that go about actually setting up how a chapter break should function and what one looks like.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

li
liz
Posts: 75
Joined: Sat Mar 25, 2017 6:40 pm
Platform: Win + iOS
Thanks for the clarification--I didn't mean to spread ignorance.
I've only messed with the Windows beta a little bit because I'm just finishing something up and didn't want to take the plunge. A "type" implementation is certainly much better than "Compile As Is."

AmberV
Posts: 24314
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:
No worries at all, it's still useful information to a lot of people.

As for the beta, I think it is still in a stage where experimenting is the name of the game. I'm not sure if it is ready to commit a major project to yet. But it'll be a good introduction to where things are going at least.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

Close