> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/in-depth-articles/43-step-7-using-noto-sans-and-roboto-mono-variable-fonts-with-latex.md).

# Step 7: Using Noto Sans and Roboto Mono variable fonts with LaTeX

[Introduction](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [Step 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [Step 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [Step 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [Step 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [Step 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [Step 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [Step 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [Step 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [Examples and projects](https://www.overleaf.com/learn/latex/Articles/Overleaf_projects_showing_how_to_use_variable_fonts_with_LaTeX?preview=true)

In this step we configure bold, italic and bold-italic font styles for Noto Sans and Roboto Mono and demonstrate using them to typeset small caps in bold, italic and bold-italic.

Open the current Overleaf project configured in Step 6.

## Configuring Noto Sans and Roboto Mono

We want to enable bold, italic and bold-italic font styles for Noto Sans and Roberto Mono. These requirements are summarized in the following table using LaTeX’s standard font series and shape identifiers. Remember that m is dropped from the series identifier *except* where *both* width and weight are m (medium).

| **Font description**                                         | **Series identifier** | **Weight** | **Width** | **Shape** |
| ------------------------------------------------------------ | --------------------- | ---------- | --------- | --------- |
| bold-weight, medium-width font in the normal (upright) shape | b                     | b          | m         | n         |
| medium-weight, medium-width font in the italic shape         | m                     | m          | m         | it        |
| bold-weight, medium-width font in the italic shape           | b                     | b          | m         | it        |

The following sections show how to configure Noto Sans and Roberto Mono to use these font series and shapes. The section [Putting it all together](#putting-it-all-together) shows how to activate these font shapes using the `\setsansfont` and `\setmonofont` commands.

### Choosing a weight-axis value for medium and bold weights

We’ll start by selecting weight-axis values to define medium- and bold-weight instances (LINK TO TUTORIAL SECTION) of Noto Sans and Roberto Mono. The [weight axis of Noto Sans](https://fonts.google.com/specimen/Noto+Sans/tester) ranges from 100 to 900, for [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono/tester) the range is 100 to 700, suggesting the following weight values:

| **Font name** | **Medium weight** | **Bold weight** |
| ------------- | ----------------- | --------------- |
| Noto Sans     | 400               | 600             |
| Roboto Mono   | 300               | 550             |

### Configuring a medium-weight italic font for Noto Sans and Roboto Mono

To add italic fonts we use fontspec’s `ItalicFont` key which takes the form

```
ItalicFont=⟨font name⟩
```

where ⟨font name⟩ is the name of a font, or the name of a font file.

The Overleaf project's `VariableFonts` folder contains the italic font files we need to use:

* NotoSans-Italic-VariableFont-wdth-wght.ttf
* RobotoMono-VariableFont-wght.ttf

Using these file names and weight-axis values listed above, medium-weight italics can be added using commands shown in the following sections.

#### Settings for Noto Sans medium-weight upright and italic fonts

For Noto Sans the following code will be added the document preamble (see the section [Putting it all together](#putting-it-all-together)).

```latex
\setsansfont{NotoSans-VariableFont-wdth-wght.ttf}[
Weight=400,
ItalicFont=NotoSans-Italic-VariableFont-wdth-wght.ttf
]
```

#### Settings for Roboto Mono medium-weight upright and italic fonts

For Roboto Mono the following code will be added the document preamble (see the section [Putting it all together](#putting-it-all-together)).

```latex
\setmonofont{RobotoMono-VariableFont-wght.ttf}[
Weight=300,
ItalicFont=RobotoMono-Italic-VariableFont-wght.ttf
]
```

### Configuring bold and bold-italic for Noto Sans and Roboto Mono

As shown in Step XXX (Link) we'll add bold fonts using fontspec's `FontFace` key, which has the following form

```
FontFace = {⟨series⟩}{⟨shape⟩}{ Font = ⟨font name⟩ , ⟨features⟩ }
```

where

* `⟨series⟩` is the LaTeX series identifier (link to section)
* `⟨shape⟩` is the LaTeX shape identifier (link to section)
* `⟨font name⟩` is the name of a font file or the name of a font
* `⟨features⟩` contains settings we'll use to configure our variable fonts, such as setting values for the width or weight axis

#### Settings for Noto Sans bold and bold-italic fonts

For the bold-weight, normal (upright) shape we have:

* `⟨series⟩` = b
* `⟨shape⟩` = n
* `⟨font name⟩` = NotoSans-VariableFont-wdth-wght.ttf
* `⟨features⟩` = Weight=600

resulting in

```
FontFace = {b}{n}{Font = NotoSans-VariableFont-wdth-wght.ttf, Weight=600}
```

For the bold-weight, italic shape:

* `⟨series⟩` = b
* `⟨shape⟩` = it
* `⟨font name⟩` = NotoSans-VariableFont-wdth-wght.ttf
* `⟨features⟩` = Weight=600

resulting in

```
FontFace = {b}{it}{Font = NotoSans-VariableFont-wdth-wght.ttf, Weight=600}
```

#### Settings for Roboto Mono bold and bold-italic fonts

For the bold-weight, normal (upright) shape we have:

* `⟨series⟩` = b
* `⟨shape⟩` = n
* `⟨font name⟩` = RobotoMono-VariableFont-wght.ttf
* `⟨features⟩` = Weight=550

resulting in

```
FontFace = {b}{n}{Font = RobotoMono-VariableFont-wght.ttf, Weight=550}
```

For the bold-weight, italic shape we have:

* `⟨series⟩` = b
* `⟨shape⟩` = it
* `⟨font name⟩` = RobotoMono-VariableFont-wght.ttf
* `⟨features⟩` = Weight=550

resulting in

```
FontFace = {b}{it}{Font = RobotoMono-VariableFont-wght.ttf, Weight=550}
```

## Putting it all together

To apply the configurations discussed above, open the current Overleaf project and replace the existing `\setsansfont` and `\setmonofont` commands with the following versions.

```latex
% Document family sans serif font
\setsansfont{NotoSans-VariableFont-wdth-wght.ttf}[
Weight=400,
ItalicFont=NotoSans-Italic-VariableFont-wdth-wght.ttf,
FontFace = {b}{n}{Font = NotoSans-VariableFont-wdth-wght.ttf, Weight=600},
FontFace = {b}{it}{Font =NotoSans-Italic-VariableFont-wdth-wght.ttf,Weight=600}
]
```

```latex
% Document family monospaced font
\setmonofont{RobotoMono-VariableFont-wght.ttf}[
Weight=400,
ItalicFont=RobotoMono-Italic-VariableFont-wght.ttf,
FontFace = {b}{n}{Font =RobotoMono-VariableFont-wght.ttf, Weight=550},
FontFace = {b}{it}{Font = RobotoMono-Italic-VariableFont-wght.ttf, Weight=550}
]
```

## How to use our new fonts

Using fontspec we have configured bold, italic and bold-italic fonts for all three of the document font families. In addition to the fonts we have configured, fontspec has also enabled small caps versions as can be seen by pasting the following code into your document (after \begin{document}):

```latex
\begin{itemize}
\item Main text family (Noto Serif):
\begin{itemize}
    \item \textsc{regular small caps}
    \item \textit{\scshape italic small caps}  
    \item \textbf{\scshape bold small caps}
    \item \textbf{\itshape\scshape bold italic small caps}
\end{itemize}
\item Sans serif family (Noto Sans):
\begin{itemize}
    \item \textsc{\sffamily regular small caps}
    \item \textit{\sffamily\scshape italic small caps}  
    \item \textbf{\sffamily\scshape bold small caps}
    \item \textbf{\sffamily\itshape\scshape bold italic small caps}
\end{itemize}
\item Monospaced family (Roboto Mono):
\begin{itemize}
    \item \textsc{\ttfamily regular small caps}
    \item \textit{\ttfamily\scshape italic small caps}  
    \item \textbf{\ttfamily\scshape bold small caps}
    \item \textbf{\ttfamily\itshape\scshape bold italic small caps}
\end{itemize}
```

This code produces the following output

![Image showing small caps typeset in normal, bold and bold-italic using all three document font families.](/files/FGDAvnPOK6KjMAh8s8U9)

## In the next Step

Our project document’s preamble is now quite cluttered with a lot of fontspec configuration code. In Step 8, we move the fontspec setup code to a simple project, simplifying the document preamble and making it easier to update our fonts.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/in-depth-articles/43-step-7-using-noto-sans-and-roboto-mono-variable-fonts-with-latex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
