Cannot understand figures and captions

I put the following in Scrivener:

<$img:pic1.png> Figure <$n:figure:ref>: First label.
and I get a boxed, centered image with a caption inside the box. I could do without the box, but oh well.

I put the following in Scrivener:

<$img:pic1.png> Figure <$n:figure:GroundBreakingEquation>: A groundbreaking equation.
(this is from and I get a boxed, centered image with the caption outside the box and left-justified.

If I put something like <$n:figure:ref>, this uses different numbering than <$n:figure>, Unlike the code I copied from the link above, every attempt to reference a figure gives me figure 1, never any other number. The copied code works, except for the captions not being in the right place.

This is on a Mac, Scrivener 3.1.3, and mostly I look at the epub results with Calibre, but other epub viewers give the same results.

If I have to use MultiMarkdown or some other complicated tool, can someone suggest an easy way to get started?

It’s really conventional for images to be centered, unboxed, with a caption directly below. I think it’s incredible that Scrivener can’t do this–it does everything else I need, and then some.

I’m not sure how you are getting boxes around your image—that isn’t something any of our default settings do at any rate. It’s certainly something that you could do with your own CSS, or if your viewer is doing that somehow, that may also be where it is coming from.

I find it a lot easier to track down this kind of stuff using Calibre’s editor, where you can see the actual HTML, and the CSS that is used to style things. A step up from that is enabling the Save source files in a folder with exported Kindle or ePub file setting, in the compile’s General Options tab on the right side. That will put all of the source files into a folder, where you can use Firefox (or similar) to better track down where styling is coming from, using its development tools.

As for the alignment of the caption, that’s really up to you. It’s typically going to be best to use a style for your captions, so that kind of decision can be made globally. The default “Caption” style is by default centre-aligned. It also has the added benefit of being handled intelligently by the compiler, when using with ePub and Kindle files, in that it will create a semantically correct figure environment with the image and caption declared within it, rather than just using styled paragraphs (a big advantage here is that we can apply CSS that attempts to keep the image and caption on the same screen). Here is the difference between applying direct formatting and using the Caption style:


Figure 1: An image with a test caption.


And here is the CSS that is automatically generated (with default settings) for the .ps1 class:

.ps1 { margin-left: 0rem; text-indent: 0rem; text-align: center; }

Versus semantic captions:

Figure 1: An image with a test caption.

Figure 1: An image with a test caption. [/code]

So in short, you either have to format this yourself, or you have to let Scrivener somehow know that “Figure 12: Blah blah blah” is a caption. It has no idea just because you typed it in one line after the image, that this is what you mean.

That is correct, they are technically different numbering streams. I’m not sure why precisely, but it has always been that way. You have to give each number a reference point, even if you don’t intend to ever use it.

And as for referencing, you should be using the “<$n#figure:reference>” format for those. These specifically will not increment the counter, even if they occur in the text before the counter is created.

I haven’t looked at MMD’s ePub generator in a good while, but I think it will still be better to consider Pandoc first (and we offer direct integration of that, once a Pandoc installation is detected).

It’s going to leave a lot more up to you however, with regards to designing the book with CSS. It’s default output is quite vanilla on purpose, to make it easier to apply your own designs—but by that token it is aimed more at those that have a good background in HTML/CSS design. Scrivener greatly benefits from that as well, but its defaults are tuned more toward “inflexible but easy to use” output (like the aforementioned serial-number generated .ps1 class, which is next to useless if you’re working with your own stylesheet—you’d want to turn off the feature that generates that).