Programs that are required for this tutorial:
The problem:
You have finished converting a PDF to EPUB. The entire book is crisp, clear, digital font. BEAUTIFUL. And then you stumble upon a formula taken right from the original scan!
Usually the images of formulas are:
- JPG
- If you see this, RUN FOR THE HILLS!
- The Resolution is Miniscule
- Even ants cannot read this
- Have horrible scanning artifacts.
Compare these two images:
Before:

After:
Side Note: The "Before" picture is NOWHERE NEAR the horror that you will typically see.
Ultimately, you would want something that scales beautifully and according to user preferences, like MathML. Sadly, you cannot use MathML because this EPUB must be read on a multitude of different readers.
Something like SVG would be great, but it is quite complex, and can only be used in EPUB (and KF8).
You want this to be read on early Kindles (and older devices) as well, so you must settle on an image. This is where the high resolution PNG comes to save the day!
At the end of the tutorial:
- You will have a high resolution, beautiful formula in PNG.
- Since it is an image, this should work on all devices (EPUB, Kindle), and look quite clean big/small (PC/smartphone).
- You will have a digital version of the formula in PDF form.
- If your company ever does create a completely new Edition of the book. This digital formula will easily be able to fit right in.
- You can generate ANY size/format image you need from this.
- When MathML becomes more ubiquitous, it should be much easier to go from Libre Math to MathML than from a low resolution image to MathML.
- No more hideous ant-sized formulas!!!
Step -1: The Source
This tutorial will be using pages 160, 174, and page 180 from "An Outline of International Price Theory" by Chi-Yuen Wu:
PDF:
http://library.mises.org/books/Chi-Y...e%20Theory.pdf
I have attached an EPUB at the end of the tutorial which includes the final text + formulas for these three pages.
Step 0: Very basics of LibreOffice Math
I have marked three sections in the image, showing the Math UI:
Section 1: This is where you use buttons to create the formula. The dropdown menu allows you to change categories to many many different types.
Side Note: Press a button and see what it does! Try to see if you can go through the menus and make a "square root".
Section 2: This is where the formula is displayed.
Section 3: This is where the "code" goes to create a formula. Pressing a button in Section 1 will generate some "code" in Section 3. You will then have to replace the placeholder text with your actual numbers/letters. See:
Now replace the first <?> with 2, and the second <?> with 2. (Or you could just type "2 + 2" directly into Section 3).
Side Note: I tend to wrap each side in squiggly brackets {}. This is EXTREMELY helpful when dealing with more complex equations. Best to start with following good practice right in the beginning!
Equivalent to 2 + 2:
Sample that is one step up in complexity:
OR:
Code:
{2} + {{a} over {b}}
Step 0.5 (Optional): Change Zoom level in LibreOffice Math:
In the Menu, select View - Zoom.
From here, select whatever preset Zoom level you want (for example 200%). I personally press View - Zoom - Zoom... And then set the level to something large (like 300%, 400%). This will make it easier to see the displayed equation in Section 2.
Note: Zoom level DOES NOT effect the output, only the way that it looks while you are editing in LibreOffice Math.
(Optional) Official LibreOffice Math Help Documentation
Help Documents for LibreOffice Math:
https://help.libreoffice.org/Math/We..._the_Math_Help
Complex Formula Examples:
https://help.libreoffice.org/Math/Math_Examples
Step 1: Recreate the Formula Using LibreOffice Math:
Every formula you run across will be different. The buttons in Section 1 (see Step 0) will help guide you in creating the actual "code" to place in Section 3 (see Step 0).
Each of the images in this Step show an actual formula from a PDF scan, and the LibreOffice Math code to recreate it:
Formula #1:
Code:
{m_a} over {m_b} < {n_a} over {n_b} < {o_a} over {o_b} < {p_a} over {p_b} < ... < {q_a} over {q_b}
Formula #2:
Code:
{Q_m over m_b} over {Q_n over n_a} " or " {Q_m over Q_n} times {n_a over m_b}
Formula #3:
Code:
p = {pD_{am}} over {D_{am}} = {MP} over {OM} = {ON} over {OM},
Formula #4:
Code:
{alignc "Price"} over {alignc "Price-Marginal Revenue"} = {{ON} over {OM}} over {{ON} over {OM} - {tN}over{OM}} = {ON} over {ON - tN} = {ON} over {Ot}
Step 2: LibreOffice Math: Export as PDF
After inserting the code for Formula #1. You want to press File - Export...:
Name your file and press Save.
Side Note: My preferable naming convention is "pg###-Formula#.pdf". Where pg### is the page number of the formula, and Formula# is used if there are multiple formulas per page. This allows for easy organization, and allows it to be easily found/fixed at a later date if needed.
After naming your PDF and pressing Save, you will reach this screen. Make sure "Lossless Compression" and "Tagged PDF" are chosen and then press Export.