I have a heading problem in a long MMD doc that I’m compiling to latex. It suddenly started happening and I don’t know how I caused the issue (assuming it was something I did).
Document headings are output as:
HEADING
i.e. with a carriage return before the second set of hashes.
This is fine in MMD (I’ve checked it comes in the MMD stage by compiling to MMD), but when I compile to latex, it causes anything part of the heading that’s longer than a line to be outside of the \section{}, \chapter{} or whatever braces, followed by random hashes.
Since you can add characters around the titles of things in the Formatting compile option pane’s “Section Layout” feature, that’s where I’d check first. Otherwise you’d need to poke around a bit further, checking for stray carriage returns in the binder titles themselves, replacements perhaps—there aren’t any features in Scrivener that will intentionally break syntax like this at any rate.
OK, I tried going back to original in the compile options and the problem went away.
Looking at the mmd output when I go back to my compile settings, I’ve found out more about the behaviour, which is a bit odd.
What it’s doing is this…
Document titles under 50 characters in length, including any prefix (there are no suffixes, but some titles have a prefix) – no problem
Longer titles – hashes and title up to last end of word over 50 chrs, carriage return, remaining title, closing hashes
e.g.
This is a really really really really really really <— '## ’ + 51 chrs
really really really really long title ##
Which means that only the first line renders as a heading, the second line appears as body text with the final hashes showing up (depending on method of rendering).
Hmm, I am not seeing this problem here. I took these steps:
For testing, I created a new project from the “Blank” starter.
I pasted the following text (447 characters) into the title for the starter document in Draft:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
I typed in “This document has a really long title”, into the text document (just to have something other than the title in the output).
Opened the Compile pane.
Changed the output to MultiMarkdown.
Added Titles to all icon types in the Formatting pane.
The result:
[code]# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. #
Sorry for the delay in responding to this, have not had a chance to get back to the project until now. Anyway, I think I’ve found the problem.
Some sections of the text have come from somewhere else and were formatted with a tab to indent paragraphs. If I leave that in there, those sections get a {verbatim} tag when I compile to latex. (Surprisingly, compiling to MMD, those sections have no special formatting.)
In order to get rid of the {verbatim}s, I was using ‘convert to plain text: paragraph spacing and indents’. I didn’t have this on since our last exchange, I’d forgotten about it, but I’ve just turned it back on and I’ve started having the problem with the headings again (when compiling to MMD or Latex).
I’ve found a workaround for this - simply by doing a find/replace on tabs and getting rid of them, but thought I’d let you know that this appears to be the cause.
Okay that makes sense. Tabs will mess up other ways of working as well, they can even mess up some older e-book readers. It’s a common enough problem with source material that Scrivener has a macro for cleaning those out, the Format/Convert/Strip Leadings Tabs command.