Using Images with MMD to Latex

Hi,

I started using Scrivener with Multimarkdown to finally output a LaTeX document. I watched some tutorials online and found the workflow to be very convenient.
But when I try to put an image into my document I can’t reproduce the results of any tutorials.

When I write alttext my tex-file only includes this:

\includegraphics[keepaspectratio,width=\textwidth,height=0.75\textheight]{image.eps}

But I thought I would get something like that, at least that’s what the guys in the tutorials get:

\begin{figure}[htbp]
\centering
\includegraphics[keepaspectratio,width=
\textwidth,height=0.75\textheight]{image.eps}
\caption{bla bla}
\label{}
\end{figure}

Does someone know what I can do?

That looks like the old syntax for setting captions. It got moved around when MMD3 came out. It is now:

![Caption text](name_of_graphic.jpg)

But while we’re at it, I should mention that this can all be done rather seamlessly with Scrivener. You can drop a graphic right into the editor and it will generate all of the syntax for you, and automatically export the graphic file to the compile folder. To caption the figure, either add it to the same line as the graphic, enclosed in straight double-quotes or matching square brackets, or on the line directly following the graphic, in matching square brackets.

Hence, something like this in Scrivener:

Results in this MMD code:

![The results of using horizontal distribution on four notes.][DistributeHorizontal.png]

... Rest of Document ...

[DistributeHorizontal.png]: DistributeHorizontal.png width=337px height=144px

Will produce code like this in LaTeX:

\begin{figure}[htbp]
\centering
\includegraphics[width=337pt,height=144pt]{DistributeHorizontal.png}
\caption{The results of using horizontal distribution on four notes.}
\label{distributehorizontal.png}
\end{figure}

Note that a handy side-effect of using this method is that Scrivener uses the image name as its internal ID. That means you can cross-reference the figure like so.

You might note the purple highlight in my example. I stash the name of the graphic in an Inspector comment so if I forget it and need to cross-ref it, I can just look it up. A nice side-effect of that is that I get a list of figures in the sidebar. :slight_smile:

But, if you do prefer typing out the code, or need to for advanced syntax reasons, do note you can also use a Scrivener link from the filename part of the syntax, to that graphic in the research folder of the binder. That will enable automatic export of the graphic for you.

EDIT:
I managed to solve the problem. There has to be one line free before the image command. This:

[code]Belastungsfläche (ein Fünftel bis Ende) in Beziehung gesetzt.

Längsgewölbe[/code]
results into that:

\begin{figure}[htbp] \centering \includegraphics[keepaspectratio,width=\textwidth,height=0.75\textheight]{hoehle.eps} \caption{Längsgewölbe} \label{} \end{figure}
And this:

Belastungsfläche (ein Fünftel bis Ende) in Beziehung gesetzt. ![Längsgewölbe](hoehle.eps)
results into that:

Fünftel bis Ende) in Beziehung gesetzt. \includegraphics[keepaspectratio,width=\textwidth,height=0.75\textheight]{hoehle.eps}
Probably that is an issue with the default formats setting but I am not sure. I hope if someone has the same problem, this will help. Thanks to AmberV for the quick and helpful response! I am so happy right now you can’t imagine!
END OF EDIT
Thank you very much for this detailed answer.
Unfortunately I still haven’t solved my problem. I tried both, dragging an image into my document and putting the caption behind it (either with [] or ()). The caption never shows in my LaTeX document. Same thing when I use the syntax you posted me. It always results in:

\includegraphics[width=282pt,height=663pt]{10-247-L.jpg}
[mycaption bla bla]

When I use the multimarkdown -t latex in the terminal I do get the correct ouput:

\begin{figure}[htbp]
\centering
\includegraphics[keepaspectratio,width=\textwidth,height=0.75\textheight]{10-247-L.jpg}
\caption{myCaption}
\label{}
\end{figure}

A few more information:
I am using OSX 10.8.3 Mountain Lion, the newest Scrivener Version, Multimarkdown is at version 3.7. I installed the Mac Support Files and the LaTeX Support Files. For viewing and compiling the tex document I use Sublime Text 2, but this is probably not related to my problem.