hi all…relative amateur when it comes to latex, and mixing mmd into it with Scrivener. So far, everything has gone pretty smoothly, but I’m running into some problems with images. I would like to have images this large report I’m writing that I can reference inline. I have been entering into Scrivener the basic markdown language, and using a Scrivener Link on the image name in the parenthetical.
This formats very nicely in Latex, with the caption underneath the image. The difficulty emerges when I try to add labels. First off, I can’t figure out how to do this using the basic MMD language (the Scrivener manual says it can’t be done, which is fine). But when I try to adopt the other method of inputting images to generate an ID, it doesn’t show up in latex…all it does is replace [MiddenStone] with the actual name of the document [middenstone.jpg]. I have tried the following attempts at inputting, as suggested by the scrivener manual:
![MiddenStone][The Stone Rubble Site, viewed from the west. Large stones and expansive artifact debris defined the site.]
![MiddenStone “The Stone Rubble Site, viewed from the west. Large stones and expansive artifact debris defined the site.”]
![MiddenStone]
[The Stone Rubble Site, viewed from the west. Large stones and expansive artifact debris defined the site.]
Anyway, I’m at a loss. Please, any suggestions about how to have an image that has a caption and can be cross referenced that is written in MMD, in Scrivener, and compiled to Latex would be awesome!
The standard MMD references don’t work cleanly with Latex to let you refer to the image elsewhere. Try the following pattern:
[code]![The Stone Rubble Site, viewed from the west. Large stones and expansive artifact debris defined the site.][MiddenStone]
[MiddenStone]: MiddenStone width=150px[/code]
(Put the Scrivener link on the MiddenStone in the second line to make sure the image gets exported at compile. And the blank line between the two parts is important.)
It should be noted that Scrivener will do all of the image syntax setup for you, if you do not need anything more fancy than the image itself and a caption. To caption an image in Scrivener, hit return after the image and then add the caption in [brackets].
That statement might just be to the effect that by using the basic interface for adding images you don’t have direct control over the label text itself, but Scrivener will generate the MMD code in a fashion that produces a predictable and useful label: the image name itself (including the extension).
So for example if I drop a picture named “my_illustration.png” into the editor, when I compile, Scrivener will turn that into:
[code]
…
[/code]
That isn’t exactly the sort of thing you would do if you were writing the MMD document yourself, but this technique makes it so that you can use the string “my_illustration.png” as your reference, as described above by MrGruff.
Yes, if you resize an image visually in the editor, then the compiler will export the size information into the image source line. In my above example, I obviously shrunk the original image, which was a screenshot of that same window, to 304 x 252 points. If I compiled to TeX->PDF, the end result be what I see in the editor:
\begin{figure}[htbp]
\centering
\includegraphics[width=304pt,height=252pt]{example.png}
\caption{Here is what I typed for the caption.}
\label{example.png}
\end{figure}