Skip to main content

Figures and Figure Spacing in Leanpub Books

Keywords: figure, figures, spacing, figure spacing, settings

Leanpub Support avatar
Written by Leanpub Support
Updated over 3 weeks ago

Books can have "figures". Figures in a Leanpub book are:

- Images

- Code Blocks

- Math

- Videos

Most authors are happy with the default settings for how figures are handled: that's why we made them the default settings!

But some authors (or editors, book designers, or publishers) have specific preferences or requirements around figures that differ from our default settings.

In this article, we're going to show you how figures work, what they look like, where you can adjust the settings, and how you can create a list of figures in your book.

Figures for Images, Code Blocks, and Math

If you add a "title" to an image, a code block, or some math, we will automatically add the title as a figure title.

For an image, this:

{alt: "a picture of palm trees against a blue sky", title: "Palm Trees"}
![](palm-trees.jpg)

...will produce this, with the figure title under the image:

For a code block, this:

{title: "Hello World in Ruby"}
```ruby
require 'time'

# This is just some pointless code so you can see the syntax highlighting...
def display_info
pi = Math::PI.round(10)
time_last_year = (Time.now - 365 * 24 * 60 * 60).getlocal("-08:00")
formatted_time = time_last_year.strftime("%Y-%m-%d %H:%M:%S")
puts "Pi to 10 decimal places: #{pi}"
puts "The time 1 year ago in Pacific Time: #{formatted_time}"
end
```

...will produce this, with the figure title above the image:

For a math, this:

{title: "Something Involving Sums"}
```latexmath
\left|\sum_{i=1}^n a_ib_i\right|
\le
\left(\sum_{i=1}^n a_i^2\right)^{1/2}
\left(\sum_{i=1}^n b_i^2\right)^{1/2}

...will produce this, with the figure title under the image:

Changing the Figure Settings

You can change the figure settings on the Theme page for your book, by choosing the Custom theme.

You can learn where to find the Theme page for your book here:

Here's a screenshot of the Figures section from the Theme page:

Figure Spacing

Here, you can change the vertical spacing above and below figures.

Here is the default spacing for a figure with a paragraph above and below it:

Let's increase the spacing setting above and below figures from 2 to 3:

After you make the change, make sure to scroll to the bottom of the page and click the "Update Theme" button:

The next time you create a preview, the figure spacing will reflect your change:

Figure Numbering

You can also change the figure numbering. Let's change it to "Number figures sequentially within each chapter, e.g. 1.1, 1.2, 2.1, 3.1, 3.2, etc.":

Here's what that looks like:

Figure Caption Font Size

Further up the Theme page, you can also change the Figure Caption Font Size:

Let's make it bigger:

Here's what that looks like:

Creating a List of Figures at the Beginning of the Book

You can easily add a list of figures to your book by typing {figures} (with a blank line below it) above the first chapter heading, like this:

{figures}

# Chapter One

You can learn how to create a list of figures here:

Questions or Feedback

If you have any questions or feedback for this article, please email the Leanpub Team at hello@leanpub.com.


Subscribe to our YouTube channel! Growing our audience there really helps Leanpub authors like you get discovered! Plus you'll learn about other authors, and their experiences writing and publishing.

If you have any feedback or questions about this article, please email the Leanpub team about it at hello@leanpub.com!

If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!

Are you interested in self-publishing, and creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes: http://help.leanpub.com/en/articles/3088382-quick-walkthroughs-for-getting-started-on-a-leanpub-book

Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!

You can also follow Leanpub in lots of other places!

Did this answer your question?