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:
- 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.
- 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:
- Open LibreOffice Math (or double-click an existing formula in LibreOffice Writer).
- Click Format in the top menu bar and select Fonts….
- In the Fonts dialog box, click the Modify button located in the bottom-left corner.
- 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.
- Choose your desired font family from the list of installed system fonts, along with the desired attributes (Bold or Italic), and click OK.
- Repeat the process for any other categories you wish to change.
- (Optional) Click the Default button in the Fonts dialog to make these font mappings the default for all future mathematical formulas.
- 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:
- Serif syntax:
font serif { expression } - Sans-serif syntax:
font sans { expression } - Fixed-width syntax:
font fixed { expression }
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.