Scrivener not recognising user-defined meta-data?

I’m using Scrivener 2.3 and am defining the meta-data myself in a file called “Meta-Data” placed as the very first file in my Scrivener project. In it I define (among other things) “Latex input: my-version-of-mmd-memoir-header”, “Title: My Title”, “Author: Myself”. When I compile using MMD -> LaTeX, I used to get (Scrivener 2.0.1) a .tex file that contains:

\input{my-version-of-mmd-memoir-header} \def\mytitle{My Title} \def\myauthor{Myself}

Now, however, the .tex file seems to have a duplicate of everything I define in the Meta-Data, with the duplicate being the standard memoir, like so:

\input{mmd-memoir-header} \def\mytitle{} \def\myauthor{} \input{my-version-of-mmd-memoir-header} \def\mytitle{My Title} \def\myauthor{Myself}
Furthermore, it doesn’t include my pre-defined footer at all.

When I compile just for MMD, the resulting file includes the following three lines at the top

Base Header Level: 1 Title: Author:
Followed by those same lines containing the title and author that I defined myself.

In short: it seems that Scrivener doesn’t replace the template Meta-Data with my user-defined Meta-Data, but instead pastes the two together. Is this a new feature? If yes, can I switch back to the previous state? (I can’t seem to find any preferences linking to this). Thanks

You need to delete the meta-datay keys and values from the “Meta-Data” pane of Compile if you want to define them in a “Meta-Data” file instead. They do indeed get concatenated, but this isn’t a bug, it’s intentional - just delete the other meta-data and it should all work fine.

All the best,
Keith

Hi Keith

Thanks for your prompt response. I was just looking into that myself, and it indeed works on the MMD file, but the .tex file still does the same. Could something be going wrong in the conversion from MMD to .tex? Does this happen within Scrivener or somewhere else?

That’s strange - the .tex file is generated directly from the MMD file (which is stashed in a temporary directory while the .tex file is generated). I’ll notify Ioa of this, as he’s the resident MMD expert, so that he can go through the likely causes with and let me know if there is a bug here.

Thanks,
Keith

All right, I’ve been trying to reproduce a continuation of the problem after deleting the duplicate meta-data keys and I can’t see to get it to happen. I can get multiple keys if I have multiple keys defined (which, in itself I think might be a bug in MMD as this isn’t supposed to happen, not that it hurts anything to re-def a variable), that’s easy enough. But once I delete the multiple keys so that my MMD file only has one set of Title/Author, the .tex file follows suit.

It would help, I think, to see the full MMD header block as it is now (post-compile), and the .tex preamble.

P.S. I do notice you appear to be using two header includes. So long as they do not try to do the same thing, this is no problem, you can include as many .tex files as you want.

Oops, false alarm concerning it being a bug, it seems! Let me explain:

The example I gave included two headers because that was exactly the problem: I only specified 1 header in Scrivener (in my own ‘Meta-Data’ file; I removed all entries in the Meta Data options of Compile), but somehow the .tex file included two headers, ie. another header file was somehow somewhere added.

Starting over completely with a new Scrivener project in order to replicate it for you, I all of a sudden noticed the new “LaTeX Options” option under Compile (when selecting “Compile for: MMD -> LaTeX”). Here “LaTeX document class” was specified as “Memoir (Book)”. This apparently automatically introduces the “\input{mmd-memoir-header}” before my “\input{my-homemade-header}” (as well as {mmd-memoir-begin-doc} and {mmd-memoir-footer}), since switching “LaTeX document class” to “None / Use Meta-Data” stops Scrivener from introducing these; now my .tex file contains only my own pre-defined input.

Apologies for my ignorance, I hadn’t seen this new feature and went through all the steps as usual thinking nothing would have changed in the Compile function… Thanks for your help, I will be fully enjoying Scrivener again :slight_smile:

Phew, glad you got it sorted! There were a few changes to MMD in 2.3 to allow for MMD 3.0, and the new “LaTeX Options” was added to allow users to be able to export easily using some default classes still, or to choose to do everything with their own classes. We’re obviously still getting used to the changes ourselves seeing as this didn’t occur to us, either. :slight_smile:

Good to know!

On a similar note (not sure whether this warranted a new topic): <$wc> doesn’t work anymore when called in my pre-defined Meta-Data file at the top of my project. I include it there in order to define “wordcount” in my .tex file, so it outputs: \def\wordcount{1000} I then call this in LaTeX so as to include it on my title page: \textsc{This paper contains {\wordcount} words}
This used to work fine, but now the .tex shows \def\wordcount{$<$\$wc$>$}
<$wc> does work when placed in the main body of text. Would this also be due to MMD 2 vs. 3? The MMD file outputs “Wordcount: <$wc>” as usual…

This should be fixed in the next update - Ioa pointed this out to me a couple of weeks ago.
All the best,
Keith

Yeah, we had to choose between a small amount of confusion with people who have been using Scrivener 2.2 and MMD3 bootstrapped onto it, and people who have been using 2.2 with vanilla MMD2.4 all this time as well as new users to 2.3 onward. The issue being, in 2.2 without MMD3, you could just compile with default meta-data—no changes made at all to that panel—and get a .tex file that can be immediately typeset. MMD2 used the memoir XSLT by default if you did not specify anything else, so it was easy to give people a “one click” a file. That isn’t quite so the case with MMD3 as you know. You have to set up at least three meta-data fields to get a .tex file that will typeset out of the box. Complicate that requirement with the new straight-to-PDF feature, and this makes selecting the slight speed-bump to existing 2.2+MMD3 users, fairly necessary. Otherwise it would be an never ending support issue to explain to new users why their compiled .tex document’s cause the PDF option to fail, or why they can’t just open and typeset what they’ve got.

Hence, LaTeX Memoir is the default meta-data boilerplate to match 2.2.