Using the triple tic version for raw LaTeX results in problems

Before you get excited about my using raw LaTeX to include a figure, this is a test. :slight_smile:

I really want to use raw LaTeX for features in my PDF ( like wrapping text around figure) that don’t seem to be available in Scrivener + Markdown directly.

Here is the problem when compiling Multimarkdown -> Latex

[code]```{=Latex}
\begin{figure}[htbp]
\centering
\includegraphics[width=432pt,height=286pt]{PicnicOnDomeRock.jpg}
\label{picnicondomerock}
\end{figure}

[/code]

which results in the LaTex:
[code]
\begin{adjustwidth}{2.5em}{2.5em}
\begin{lstlisting}[language={=Latex}]
\begin{figure}[htbp]
\centering
\includegraphics[width=432pt,height=286pt]{PicnicOnDomeRock.jpg}
\label{picnicondomerock}
\end{figure}
\end{lstlisting}
\end{adjustwidth}[/code]

By the way, if I compile Multimarkdown -> PDF  the =Latex shows up in the PDF, which is not desirable.

Is there any way to get the raw latex into the latex output without the [code]\begin{lstlisting}[language={=Latex}]
... \end{lstlisting}
[/code]I 


Is there anyway to get rid of the lstlisting within the Scrivener -> markdown work flow?
I certainly don't want it. Without it, I get a proper pdf with pdflatex, or with TexShop. With it, both of these hang up on the lstlisting, even though my tlmgr says it is installed, and if I ignore the error I end up with the language = Latex in my PDF. 

It won't be a big deal for me to write a filter program to get rid of 'lstlisting'  in my LaTex output from Scrivener, but it would be nice if I didn't have to do that!

Thanks,

John Velman

Two questions/points I would have:

  1. Are you using MultiMarkdown 5 (as distributed with Scrivener)? If so the syntax you are using doesn’t work yet. You’ll need to use HTML comments to insert raw LaTeX.

However I would advise installing MMD6 on your system, which the direct-sale version of Scrivener will switch to using if it detects.

  1. Could be a typo in the sample you provided here, but try with {=latex} instead of {=Latex}. The keyword is case sensitive, and while I don’t get the result you do with MMD6, I do get nothing at all since MMD doesn’t consider “Latex” to be “latex” for the purposes of which format it is exporting to, and dutifullly strips it out thinking it is code for another format.

With those two items resolved, this should be working perfectly.

Now something you might want to look into is Scrivener’s styles feature. The ability to insert a prefix and suffix around the content you’ve marked in the editor makes it a great tool for inserting identical chunks of text around the variable part. I.e. if you change your mind about which figure flags to use, you need only fix it in one place. You could put this into the style prefix:

```{=latex} \begin{figure}[htbp] \centering

And this into the suffix:

[code]\end{figure}


That leaves you to type in the includegraphics and label commands yourself. Of course if you’re only doing here and there for a few special images, that might be more trouble than it is worth. :slight_smile:

Lastly, not sure if you’re aware, but if you select the image name in your code and use a Document Link to point the text to an image in the binder, Scrivener will update the hypertext to the image file name in the text and export it automatically into the compile folder for you.

AmberV –

Thank you for your kind and thorough response to my earlier question. However…

I finally came across your template a few hours after I posted my question. I’m really happy to have found your template. I’m an over the hill retired mathematician; 20 years and more ago I did my writing in Latex, when I could.

Unfortunately at that time most conferences and journals wanted submissions in word. That really cut into my writing! I wasn’t willing to go to that much trouble.

I’m not doing so much math now, but I’m still fairly comfortable with Latex and just bought new copies of Lamport and

. Although I do have one or two math things I’d like to write up.

Right now I’m writing what will be a long memoir for the family and I want to print it as nice PDF. It will have many figures, short sections and long sections, text flow around small figures; maybe marginal notes, maybe some text in color, almost certainly some special page breaks for the sake of the widows and orphans. I’m not sure exactly how to organize it yet, hence Scrivener.

I’m a novice at Scrivener, but I have a bunch of partly finished projects where I have used it for composition and organization.

I was greatly disappointed with the look of the compiled first few pages of my memoir. That is why I started looking for a way to put raw LaTex into my Scrivener text. Not getting the search words right, I’ve spent a lot of time looking.

I’ve installed your template, and will make a few additions to the preamble, and I’m confident I can get back to writing my memoirs soon.

I can’t thank you enough.

John Velman

Excellent! Glad to hear that the template will work out for you. It’s going to be included in the stock project templates in the next release as well, so hopefully more people will be able to come across it. That should be a lot easier for you, as Scrivener will be able to handle the image details, rather than having to type it all out by hand, specifying the size and all that. I’ve made a few changes to it since the version posted on the forum, but nothing I think that would require starting over with a fresh project.

I still have a copy of Leslie Lamport’s LaTeX user guide, second edition from 1994—it’s probably woefully out of date at this point! I get most of my information from the TeX StackExchange site these days. That’s a fantastic resource if you’re looking for how to do something. I don’t think I’ve ever had a question that wasn’t already asked and answered in depth, several times over.

Thanks for the link. I use stack exchange for programming and mac things already. I’ve now added the TeX site.