meta-data variables in Latex Header

Hi Folks,
I there a way to pass meta-data variables (like <$projecttitle>, etc.) to the custom LaTeX header? My intent is to set variables like font and package option in the metadata (either the copile meta-data, or the project meta-data). It seems to me that the custom header undergoes no processing, and just passes whatever is in it as pure text, so writing <$projecttitle> in the custom header field just results in "<$projecttitle> in the latex file.

Is there a special format to enforce variable to be decoded? or a way to force processing?

Thanks,
Zvi

There is actually a built-in system in MultiMarkdown for creating your own variables automatically, just use MMD’s meta-data. Try typing in a key:value pair in the meta-data pane, compiling to .tex and examining the results in a text editor. This is how MMD already inserts information like title, author name and date into the title page. This is the purpose of providing two tabs for the header, one where you can put in the document class data, and then a second tab which will be used after any custom meta-data has been set up. You’ll find a working example of dynamic Scrivener data being used for MMD meta-data in the default settings. The “Title” key’s content is generated with <$projecttitle>.

Thanks, Amber. So I take it that the answer is no: metadata is only available after the custom header has been loaded, and there is no way to get around that.

Perhaps I can hijack this thread with a related question? Some compile options allow for loading metadata through a meta-data file, which can be specified in the “Contents” section of the compile menu. Is this possible with MMD->Latex option? I can see how to load a metadata file thought the use of the an input line on the meta-data option of the compile menu, but can I add a metadata file in any other way?

Many thanks.

Well, custom meta-data is loaded while the header files are being used by LaTeX, that is how I would put it. You can use custom meta-data in that second tab, that is what I’m referring to. You would address it as the custom \def variables that are created in between the first and second tabs. So if you want a Scrivener value available in the preamble, simply attach it to an MMD meta-data key (you can create your own keys at will), and then address it in the preamble using the second tab as \name_of_custom_key. That will return the Scrivener value you assigned to it.

I’m not sure what options you are referring to, but it sounds like you are talking about the ability to create a document called “Meta-Data” and put that into the Binder so that it is the first document compiled (top of the list in Contents)? That’s just an alternate way of assigning MMD meta-data. You can either use the Meta-Data compile option pane, the “Meta-Data” file or a combination of the two. Some practical examples of where each would be useful, respectively: a simple one-purpose document such as a thesis that will only ever have one set of meta-data; a document that has multiple outputs, then using Meta-Data files you can swap in and out would be easier; a periodical where some meta-data will always be the same (such as your name) but other pieces (publication date and title) will be different for each article, then use of Compile groups and multiple Meta-Data files arranged into those compile group folders for each article would be handy.

Or just plain old preference. I prefer to just type in MMD meta-data like I would if I were composing MMD in a text document, rather than using a UI for doing so. It’s easier to type “Something-colon-something” than to click the + button, type in ‘something’ then click the text field and type in something.

I’m not sure what you mean here either. MultiMarkdown meta-data is used by all of its output formats, and especially so with LaTeX. If you compile to MultiMarkdown plain and examine what Scrivener adds to the file at the top, you’ll find it uses the “LaTeX Input” meta-data key to define .tex file \inputs in the order they appear, which can be cross-examined with the final .tex file. Compare the plain MMD meta-data block with the top of the .tex file and you should see stark similarities. Using these observations you should be able to divine how to manipulate and use the system to your advantage.

Thanks.