LaTeX header and begin document components missing in compile

na
napaxton
Posts: 43
Joined: Wed Jan 19, 2011 5:42 pm
Platform: Mac

Wed Nov 22, 2017 1:19 pm Post

I've been having this problem for a little while, but I am only now getting around to solving it.

When I try to compile my document—written in MMD— to LaTeX, Scrivener will output a folder of files, including a master file with the text, and a header, begin document, and footer file. The master file, however, does not have

Code: Select all

\include{mmd-scrivcustom-header}

or

Code: Select all

\include{mmd-scrivcustom-begin-doc}

lines in the resulting LaTeX file. Curiously, the master file DOES contain an

Code: Select all

\include{}

for the footer file.

I use a "custom" LaTeX format when I compile docs written in MMD that invokes standard packages I use, my bibliography file, and so forth. But I have tried this with the bog standard L&L LaTeX compile settings, and I'm getting a similar result (no

Code: Select all

\include{}
at the top of the file).

What could be causing this? Ideas on what I must have toggled on at some point that's causing this?

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

Wed Nov 22, 2017 1:49 pm Post

Are you using Scrivener 3 at this point? If so, in the compile overview screen, click on the Metadata tab on the right and then click the Preview button. Does that all look like it should?

Image

If you haven’t upgraded yet, I can’t think of any combination of settings that would cause that result—there isn’t anything that would do that on purpose for sure. Myself I’d first check for MMD version on the disk, I’d try the basic “Memoir” option and see if that works. I’d try pasting in my preamble and footer content one tab tested at a time to ensure there are no problems with my content, etc.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

na
napaxton
Posts: 43
Joined: Wed Jan 19, 2011 5:42 pm
Platform: Mac

Wed Nov 22, 2017 2:45 pm Post

So I'm hesitant to upgrade entirely to S3, for the reason that I've got these pre-sets and such to output fairly complicated markdown (figures, tables, headings, etc.) for academic papers. My settings were working at one point, and I'm a little hesitant to change until these things are off my plate.

That said, I like Styles, and drop-in figures automagically generating approopriate MD, and some of the other new features, and if the changeover were possible without TOO much frustration, I'd probably do it.

mmd --version gives 6.2.2

na
napaxton
Posts: 43
Joined: Wed Jan 19, 2011 5:42 pm
Platform: Mac

Wed Nov 22, 2017 3:01 pm Post

So I tried just a plain memoir document with the default L&L settings, and no header or begin-doc \include commands show up.

Is this an MMD 6 issue?

Not quite sure what you meant by:
I’d try pasting in my preamble and footer content one tab tested at a time to ensure there are no problems with my content, etc.

Could you elaborate?

Thanks.

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

Wed Nov 22, 2017 3:10 pm Post

Yeah to digress a bit: I am very much an advocate for clearing one’s plate before making any dramatic software, tool or OS version changes, if at all possible—unless of course the deadline is so far off that the expense of learning new tools and patching around things that broke can be absorbed.

In practical terms, I recently updated the Scapple user manual project from v2 to v3 in about an hour—if that. Of course the grain of salt is that I already know version 3 inside out. So I wasn’t learning the new compile system on top of converting it. That said, we did strive to make the transition as easy as possible. Here is roughly what I did:

  1. Loaded the project in v3, let it upgrade.
  2. Opened the Compile window.
  3. Clicked the gear button below the Formats sidebar and opted to import my Scrivener 2 settings as a new format.
  4. All of my replacements, formatting pane settings, custom LaTeX setup—all of that imported without a single hitch.
  5. For the sake of aesthetics, I went into the Section Layout pane (what roughly serves as the Formatting pane did) and gave those “level 1+” entries some nicer names, like “Heading and Text”, or “Verbatim”.
  6. Saved my format.
  7. Assigned the section types Scrivener had generated for me during the upgrade to the new Layouts I just modified. (That might all be gibberish at the moment, but it’s a pretty straight-forward thing once you go through the 5-min tutorial section on the concept).
  8. Compiled.
The Scapple manual project uses quite a lot of Scrivener in fact, at least in terms of what v2 provided. It had a pretty involved compile setup, and wasn’t too basic in terms of LaTeX and MMD either. Most of what I had to do was simply telling v3 that I wanted to bring all of those settings in.

Of course we who use Markdown in the editor don’t have to worry as much about upgrades changing how the content appears or anything like that. A table in MMD, no matter how complex, is just a bunch of punctuation. Scrivener isn’t going to be touching any of that, and the only thing that does is the MMD engine itself—which isn’t changing.

At the least I’d say maybe give the demo a shot. Nothing will be harmed save an hour or two of playing around with it. The benefits could be substantial though depending on what you need. I’d like to think most of your transitional time would be spent on “ah-ha!” moments than frustration. :)
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

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

Wed Nov 22, 2017 3:17 pm Post

Is this an MMD 6 issue?

Ah, that’s the problem. MMD6 changed the metadata keys used to refer to includes. Scrivener will be generating “latex input” keys, not the new ‘latex leader’ and ‘latex begin’ keys.

That’s an easy workaround: type in the metadata you need into the Meta-Data compile option pane, referring to these files where they will be. For example:

Code: Select all

latex leader: mmd-scrivcustom-header


Scrivener will go on inserting the wrong keys, but MMD ignores them now so they shouldn’t hurt anything. In my testing it works fine.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

na
napaxton
Posts: 43
Joined: Wed Jan 19, 2011 5:42 pm
Platform: Mac

Wed Nov 22, 2017 3:25 pm Post

I agree with you about not wanting to change software in the middle of something big, but I have no idea when these project will really be done (long story), and I have almost every confidence in you at L&L. Your experience with the Scapple manual seems indicative of the fact you've put lots of effort into making this pretty seamless. :D

And I'd really like styles and drop-in graphics.

Hmm. So I did a quick import of the old project, and the same LaTeX problem keeps occurring—no header or begin-doc \include commands. I haven't looked around much on MMD, but I have heard that there's some large change with the way it handles LaTeX commands?

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

Wed Nov 22, 2017 5:00 pm Post

Yes, you would need to use the same metadata trick I posted above to get things working in v3. We’ll be getting it upgraded to MMD6 shortly, as soon as the flurry dies down a bit.

I haven’t looked around much on MMD, but I have heard that there’s some large change with the way it handles LaTeX commands?

Do you mean the approach of putting LaTeX into HTML comments? If so, yes, that did change. Nontroppo posted some tips over here.

Oh to clear up one thing though, v2 has always supported drop-in graphics being converted to MMD. The main new thing we’ve added there is a general new thing to Scrivener, and that’s the ability to link to graphics from the binder, rather than ending up with two copies. That way you can keep your figures organised as files on a corkboard that are all tied back into the manuscript. I still use the file system for that though, I like having graphics readily available to Photoshop and GraphicConverter.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
nontroppo
Posts: 735
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Thu Nov 23, 2017 1:18 am Post

napaxton wrote:... there's some large change with the way it handles LaTeX commands?


Apart from LaTeX raw input, also see: https://github.com/fletcher/MultiMarkdo ... t.txt#L296 — discusses the changes to the LaTeX templates and metadata

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

Fri Dec 01, 2017 3:52 pm Post

AmberV wrote:
Is this an MMD 6 issue?

Ah, that’s the problem. MMD6 changed the metadata keys used to refer to includes. Scrivener will be generating “latex input” keys, not the new ‘latex leader’ and ‘latex begin’ keys.

That’s an easy workaround: type in the metadata you need into the Meta-Data compile option pane, referring to these files where they will be. For example:

Code: Select all

latex leader: mmd-scrivcustom-header


Scrivener will go on inserting the wrong keys, but MMD ignores them now so they shouldn’t hurt anything. In my testing it works fine.


Hi,
I tried this exactly as described, but in my master .tex file get

Code: Select all

\input{mmd-scrivcustom-header:}


and an error "File 'mmd-scrivcustom-header:' not found". Appending .tex to the header file doesn't help, I still get the colon at the end and a file not found error.

Any ideas?
Thanks,
Emma

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

Fri Dec 01, 2017 4:08 pm Post

Hmm, that looks like a bug that crept into one of the more recent builds. Thanks for the report!

For now: compile to MultiMarkdown and then process to .tex on the command-line. We'll be putting out a general bug fix patch for 3.0 pretty soon.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

na
napaxton
Posts: 43
Joined: Wed Jan 19, 2011 5:42 pm
Platform: Mac

Fri Dec 01, 2017 4:33 pm Post

elw2u16 wrote:
AmberV wrote:
Is this an MMD 6 issue?

Ah, that’s the problem. MMD6 changed the metadata keys used to refer to includes. Scrivener will be generating “latex input” keys, not the new ‘latex leader’ and ‘latex begin’ keys.

That’s an easy workaround: type in the metadata you need into the Meta-Data compile option pane, referring to these files where they will be. For example:

Code: Select all

latex leader: mmd-scrivcustom-header


Scrivener will go on inserting the wrong keys, but MMD ignores them now so they shouldn’t hurt anything. In my testing it works fine.


Hi,
I tried this exactly as described, but in my master .tex file get

Code: Select all

\input{mmd-scrivcustom-header:}


and an error "File 'mmd-scrivcustom-header:' not found". Appending .tex to the header file doesn't help, I still get the colon at the end and a file not found error.

Any ideas?
Thanks,
Emma


Hmm. I know I did something that got around this, but I'm not at home right now and on a work computer, so I can't check what I did to my metadata to make compilation work with no prob. WIll try to check in later.

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

Fri Dec 01, 2017 4:34 pm Post

Well, I reproduced this one the first time I tried, and now no matter I do I can't get it show up again. I'll keep trying, but if anyone else spots a pattern let me know.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

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

Fri Dec 01, 2017 4:42 pm Post

napaxton wrote:
Hmm. I know I did something that got around this, but I'm not at home right now and on a work computer, so I can't check what I did to my metadata to make compilation work with no prob. WIll try to check in later.


I'd appreciate it, as it's the same every time for me! Even deleting the whole tex directory and re-compiling still appends the colon onto it.

thanks,
Emma

na
napaxton
Posts: 43
Joined: Wed Jan 19, 2011 5:42 pm
Platform: Mac

Sat Dec 02, 2017 3:02 pm Post

So in the compile settings (because I have some particular stuff I want to do in my LaTeX output), I have created a compile format with a custom LaTeX template (my own header, begin, and footer, that puts in the packages that I want and use). In the Metadata panel (second pic), you can see the data I've entered. In the first pic, you can see what I mean by rolling my own LaTeX template.

I'm using Scriv 3.0 (75).
Attachments
Screen Shot 2017-12-02 at 10.01.18 AM.png
Screen Shot 2017-12-02 at 10.01.18 AM.png (265.95 KiB) Viewed 126 times
Screen Shot 2017-12-02 at 9.58.38 AM.png
Screen Shot 2017-12-02 at 9.58.38 AM.png (149.83 KiB) Viewed 126 times