Assign Serif and Sans Fonts in LibreOffice Math

LibreOffice Math allows users to customize formula typography by mapping default font categories to specific serif, sans-serif, and monospaced typefaces installed on the system. This guide explains how LibreOffice Math manages font categories, how to assign specific system fonts to the Serif and Sans-Serif family mappings, and how to apply these font styles directly inside your formula markup.

Font Family Categories in LibreOffice Math

LibreOffice Math divides equation elements into two main groups of font categories:

  1. Standard Formula Elements:
    • Variables: Used for variable names (typically italicized serif).
    • Functions: Used for standard named functions like \(\sin\), \(\cos\), and \(\ln\).
    • Numbers: Applied to all numeric values.
    • Text: Applied to standard text strings inserted within a formula.
  2. Custom Font Family Mappings:
    • Serif: The generic serif typeface mapped across the formula editor (e.g., Times New Roman, Liberation Serif, DejaVu Serif).
    • Sans: The generic sans-serif typeface (e.g., Arial, Liberation Sans, Helvetica, DejaVu Sans).
    • Fixed: The generic monospaced typeface (e.g., Courier New, Liberation Mono).

How to Configure Serif and Sans-Serif Mappings

To assign specific installed fonts to the generic Serif or Sans mappings:

  1. Open LibreOffice Math (or double-click an existing formula in LibreOffice Writer).
  2. Click Format in the top menu bar and select Fonts….
  3. In the Fonts dialog box, click the Modify button located in the bottom-left corner.
  4. From the dropdown menu that appears, select the font family category you want to configure:
    • Select Serif to assign your preferred serif font.
    • Select Sans to assign your preferred sans-serif font.
    • Select Fixed to assign your preferred monospaced font.
  5. Choose your desired font family from the list of installed system fonts, along with the desired attributes (Bold or Italic), and click OK.
  6. Repeat the process for any other categories you wish to change.
  7. (Optional) Click the Default button in the Fonts dialog to make these font mappings the default for all future mathematical formulas.
  8. Click OK to apply the changes to the current formula.

Using Font Mappings in Formula Markup

Once mapped, you can invoke these font definitions inline within the formula editor using the font command followed by the family keyword:

Example Markup

font sans { A + B } = font serif { C + D }

In this expression, A + B renders using the assigned Sans font family, while C + D renders using the assigned Serif font family.