heading problem

ba
baisui
Posts: 32
Joined: Sat Apr 24, 2010 9:18 pm

Mon May 16, 2016 5:45 pm Post

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.

I'd be very grateful for any suggestions!

Jon

User avatar
AmberV
Posts: 20612
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Santiago de Compostela, Galiza
Contact:

Mon May 16, 2016 9:23 pm Post

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.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

ba
baisui
Posts: 32
Joined: Sat Apr 24, 2010 9:18 pm

Mon May 16, 2016 10:58 pm Post

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).

User avatar
AmberV
Posts: 20612
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Santiago de Compostela, Galiza
Contact:

Mon May 16, 2016 11:15 pm Post

Hmm, I am not seeing this problem here. I took these steps:

  1. For testing, I created a new project from the “Blank” starter.
  2. 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.
  3. 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).
  4. Opened the Compile pane.
  5. Changed the output to MultiMarkdown.
  6. Added Titles to all icon types in the Formatting pane.
The result:

Code: Select all

# 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. #

This document has a really long title.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

ba
baisui
Posts: 32
Joined: Sat Apr 24, 2010 9:18 pm

Mon May 30, 2016 5:44 pm Post

Hi Amber

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.

Best,

Jon

User avatar
AmberV
Posts: 20612
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Santiago de Compostela, Galiza
Contact:

Wed Jun 01, 2016 8:50 am Post

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.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles