Styles and Latex? (Windows Beta)

Hi all,

I am new to Scrivener and just learning the ropes.

I was trying to produce in .tex file in the Windows Beta, and ran into the following issue: something is escaping my style prefixes.

Specifically: I started by creating a new format with type “MMD (LATEX)”, with a custom Latex document class. In Styles for the custom format, I attempted to add a style for “Heading 1”, Let’s say that in the prefix/suffix fields, I added: \begin{chapter}.

In the generated .tex file, the “” ends up as “\textbackslash{}”. Even when I supposedly escape it by using “\”, nothing really changes.

What am I doing wrong?

Thanks!
Abhijit

The recent forum thread might be of interest to you in general, and specifically the post I linked to. The same question was being asked here of how to keep MMD from “escaping” punctuation marks that LaTeX uses.

If you’re using the stable version of Scrivener, it uses an old version of MMD, and HTML comments are what you want to use to pass-thru LaTeX code. If you’re using the beta you should use the modern techniques demonstrated in that post, or as shown in this thread, where I describe how I create call-out boxes with Scrivener+MMD+LaTeX.

If you’re going to be using MultiMarkdown to generate LaTeX code, it might be a good idea to read up on it.

Thanks for the detailed explanation!

I tried to follow along with these steps, but still no luck. I did:

(A) Install MMD6 and restarted Scrivener (but I don’t know how to check if it is picked up).
(B) To test, I put this in the first of the prefix/suffix box: \begin{callouttip}{=latex}

However, what shows up in the .tex is still this:

\texttt{\textbackslash{}begin{callouttip}}{=latex}

I suspect this means that I still get MMD5 or whatever is integrated with Beta 12. Any suggestions?

Thanks!
Abhijit

Yeah, could be they haven’t updated MMD in the beta yet (and perhaps still haven’t added the ability to install a stand-alone copy). So for now you might need to use the HTML method. Thankfully with a style-based approach you can swap out the technical stuff, once you need to, from the prefix/suffix fields. That’s a lot better than having to fix up the source text.

A good test to see if you’re on the right track for the future would be to compile to plain MultiMarkdown, rather than using all of the automation. Then process the .md file using your installed MMD. If that comes out looking okay, then you should be fine in the end. That manual process is essentially what Scrivener does during compile: 1) create an .md file (2) pass it along to MMD (3) redirect output into the file you specified for saving to.

Yup, that was the problem. Compiling to MMD and then passing that through MMD6 did the trick.

There is one pesky issue left — the basic MMD compilation includes two pieces of metadata that I haven’t figured out how to turn off — title and author.

But I have the basic flow in place, so I am happy :slight_smile:

A meta thank you: on these forums, perhaps because many authors are here, people answer and explain things carefully and in depth. This is a very welcoming place!

Best,
Abhijit

Glad to hear you’re finding the forums helpful!

The metadata issue is caused by a known bug. In the main compile overview screen, metadata tab on the right, you can delete these fields. It won’t save into your compile settings if that is all you do though. Add another field, something that won’t trigger full document mode, if that is what you’re looking to avoid. Since MMD allows for custom fields, safest thing is just to put something in a field name like “Placeholder”, with some arbitrary text for data. That will keep the removal of Title and Author saved in settings, and meanwhile it will be largely ignored as a field (you will still get a variable declaration at the top of the .tex file, but it will be invisible and do nothing unless you type in “\placeholder” somewhere. :slight_smile:

There are some “pardon our dust” areas of the compiler, mind. I wouldn’t be coming at it expecting everything to work yet.