Putting Figures "here" (not floating) when compiling to into LaTeX

I’m using Scrivener to produce a ~300 page non-fiction “manual”. I have embedded PNG files throughout the document. I used the “General Non-Fiction (LaTeX)” project template along with “texmaker” to compile. Works great with a terrific product with both a table of contents and extensive index. A lot of work? Yes, but that’s the life of an author. Working well for me, especially Scrivener.

This was my first project with LaTeX. After some teething issues (self inflicted, but fixed by learning!) I had one issue that remained unsolved for a long time. Figures were being placed by LaTeX in not where I put them in the text. I learned this was the setting in Scrivener to float the figures where the compiler felt “best”. I wanted figures to be put “here!”.

Eventually from tex.stackexchange.com/questions … nt-in-text
i learned to use the “float” package.

I added to Front Matter/Preamble Modules/Figure Packages the two lines:

% See tex.stackexchange.com/questions … nt-in-text
\usepackage{float}

In the “Edit Format” part of the compile process I changed the prefix for a “Figure”
style to be:

\begin{figure}[H]

The “H” is the pertinent instruction.

Works for me.

–rms

1 Like

Thanks for posting the tip, and glad to hear the template has worked out well for you! Just to be clear, this is default LaTeX behaviour you are seeing, not anything Scrivener is setting. I change very few defaults with the template, as I wanted that to provide a simple baseline experience that people could work off of, rather than having to figure out how undo my personal preferences.

To reiterate one of the cautions given in that StackExchange post: generally speaking it is best to let LaTeX design the page flow, and that means letting it find the optimum placement for figures and tables, where they won’t disturb reading speed or create gaps, widows and orphans. This approach is part of what makes a LaTeX page look so good, in comparison to a simpler real-time formatting engine such as word processors.

It is quite rare that any publication workflow will take the author’s placement of a figure in Word as absolute gospel, because the author can’t really know what the final design is going to look like (unless they have stipulated full design control for some reason—like House of Leaves), or whether a figure will look a bit goofy where they thought it was best.

That said, LaTeX is an algorithm, and it isn’t always going to make the right choice. So there are times where we would want to step in and say, “no, that figure really shouldn’t be in the following subsection, even if it makes this page look a little sloppy”. And that is where an approach like this can come in handy.

So given all of the above, the way I would implement it is as a separate Section Type, linked to a Layout that produces a forced placement. Then, in proofing, if I discover a figure that is out of place I could simply switch its Type from “Figure” to “Figure (Forced Layout)” in inspector and move on.

Thanks for your insights. I’ll consider all … but for my purposes I want to be able to write “as shown in the figure below…” with the expectation that indeed the figure is “below”. Simple as that. It’s not a public publication—just for my company. So looking perfect as a design is not what I am looking for, although I can understand that wanted by many and that’s what LaTeX can do!

Still on the learning curve!

—rms