> 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/ja/xiang-xi-ji-shi/43-step-7-using-noto-sans-and-roboto-mono-variable-fonts-with-latex.md).

# ステップ 7: LaTeX で Noto Sans と Roboto Mono の可変フォントを使う

[はじめに](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [ステップ 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [ステップ 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [ステップ 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [ステップ 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [ステップ 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [ステップ 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [ステップ 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [ステップ 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [例とプロジェクト](https://www.overleaf.com/learn/latex/Articles/Overleaf_projects_showing_how_to_use_variable_fonts_with_LaTeX?preview=true)

このステップでは、Noto Sans と Roboto Mono に対して太字、斜体、太字斜体のフォントスタイルを設定し、それらを使ってスモールキャップスを太字、斜体、太字斜体で組版する方法を示します。

ステップ 6 で設定した現在の Overleaf プロジェクトを開きます。

## Noto Sans と Roboto Mono の設定

Noto Sans と Roberto Mono に対して太字、斜体、太字斜体のフォントスタイルを有効にしたいとします。これらの要件は、LaTeX の標準フォントシリーズ識別子と形状識別子を用いた次の表にまとめられています。シリーズ識別子では m が省略されることを覚えておいてください *を除いて* ここで *両方の* 幅とウェイトは m（medium）です。

| **フォントの説明**                     | **系列識別子** | **ウェイト** | **幅** | **形状** |
| ------------------------------- | --------- | -------- | ----- | ------ |
| 通常（upright）形状の太字ウェイト、ミディアム幅フォント | b         | b        | m     | n      |
| イタリック形状のミディアムウェイト、ミディアム幅フォント    | m         | m        | m     | it     |
| イタリック形状の太字ウェイト、ミディアム幅フォント       | b         | b        | m     | it     |

以下の節では、Noto Sans と Roberto Mono がこれらのフォントシリーズと形状を使うように設定する方法を示します。節 [まとめて設定する](#putting-it-all-together) では、次を使ってこれらのフォント形状を有効にする方法を示します。 `\setsansfont` と `\setmonofont` はすべて保存され、

### ミディアムウェイトと太字ウェイトの weight 軸の値を選択する

まず、Noto Sans と Roberto Mono のミディアムウェイト版および太字ウェイト版（チュートリアルの該当節へのリンク）を定義するために weight 軸の値を選びます。 [Noto Sans の weight 軸](https://fonts.google.com/specimen/Noto+Sans/tester) は 100 から 900 までの範囲です。 [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono/tester) 範囲は 100 から 700 で、次のウェイト値が考えられます。

| **フォント名**   | **ミディアムウェイト** | **太字ウェイト** |
| ----------- | ------------- | ---------- |
| Noto Sans   | 400           | 600        |
| Roboto Mono | 300           | 550        |

### Noto Sans と Roboto Mono のミディアムウェイト斜体フォントを設定する

斜体フォントを追加するには、fontspec の `ItalicFont` キーを使います。形式は次のとおりです。

```
ItalicFont=⟨フォント名⟩
```

ここで ⟨フォント名⟩ は、フォントの名前、またはフォントファイルの名前です。

Overleaf プロジェクトの `VariableFonts` フォルダには、使用する必要のある斜体フォントファイルが含まれています。

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

上記のファイル名と weight 軸の値を使うことで、次の節に示すコマンドを使ってミディアムウェイトの斜体を追加できます。

#### Noto Sans のミディアムウェイトの upright フォントと斜体フォントの設定

Noto Sans では、次のコードを文書のプリアンブルに追加します（節を参照 [まとめて設定する](#putting-it-all-together)).

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

#### Roboto Mono のミディアムウェイトの upright フォントと斜体フォントの設定

Roboto Mono では、次のコードを文書のプリアンブルに追加します（節を参照 [まとめて設定する](#putting-it-all-together)).

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

### Noto Sans と Roboto Mono の太字と太字斜体を設定する

ステップ XXX（リンク）で示したように、fontspec の `FontFace` キーを使って太字フォントを追加します。形式は次のとおりです。

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

ここで

* `⟨series⟩` は LaTeX のシリーズ識別子です（節へのリンク）
* `⟨shape⟩` は LaTeX の形状識別子です（節へのリンク）
* `⟨font name⟩` は、フォントファイルの名前、またはフォントの名前です
* `⟨features⟩` には、幅軸やウェイト軸の値を設定するなど、可変フォントを設定するために使う設定が含まれています

#### Noto Sans の太字フォントと太字斜体フォントの設定

太字ウェイトの通常（upright）形状では、次のようになります。

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

その結果、次のようになります。

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

太字ウェイトの斜体形状では、次のようになります。

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

その結果、次のようになります。

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

#### Roboto Mono の太字フォントと太字斜体フォントの設定

太字ウェイトの通常（upright）形状では、次のようになります。

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

その結果、次のようになります。

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

太字ウェイトの斜体形状では、次のようになります。

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

その結果、次のようになります。

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

## まとめて設定する

上で説明した設定を適用するには、現在の Overleaf プロジェクトを開き、既存の `\setsansfont` と `\setmonofont` コマンドを次の版本に置き換えます。

```latex
% 文書のサンセリフ体ファミリーのフォント
\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
% 文書の等幅フォントファミリー
\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}
]
```

## 新しいフォントの使い方

fontspec を使って、文書の 3 つのフォントファミリーすべてに対して太字、斜体、太字斜体フォントを設定しました。設定したフォントに加えて、fontspec はスモールキャップス版も有効にしています。次のコードを文書に貼り付けると確認できます（\begin{document} の後）：

```latex
\begin{itemize}
\item 本文ファミリー（Noto Serif）：
\begin{itemize}
    \item \textsc{通常のスモールキャップス}
    \item \textit{\scshape 斜体のスモールキャップス}  
    \item \textbf{\scshape 太字のスモールキャップス}
    \item \textbf{\itshape\scshape 太字斜体のスモールキャップス}
\end{itemize}
\item サンセリフ体ファミリー（Noto Sans）：
\begin{itemize}
    \item \textsc{\sffamily 通常のスモールキャップス}
    \item \textit{\sffamily\scshape 斜体のスモールキャップス}  
    \item \textbf{\sffamily\scshape 太字のスモールキャップス}
    \item \textbf{\sffamily\itshape\scshape 太字斜体のスモールキャップス}
\end{itemize}
\item 等幅ファミリー（Roboto Mono）：
\begin{itemize}
    \item \textsc{\ttfamily 通常のスモールキャップス}
    \item \textit{\ttfamily\scshape 斜体のスモールキャップス}  
    \item \textbf{\ttfamily\scshape 太字のスモールキャップス}
    \item \textbf{\ttfamily\itshape\scshape 太字斜体のスモールキャップス}
\end{itemize}
```

このコードにより、次の出力が生成されます

![3 つの文書フォントファミリーすべてを使って、通常、太字、太字斜体で組版したスモールキャップスを示す画像。](/files/9b5bcafb980109f8a57f297ec790e9904137725a)

## 次のステップで

現在、プロジェクト文書のプリアンブルは fontspec の設定コードでかなり煩雑になっています。ステップ 8 では、fontspec の設定コードをシンプルなプロジェクトに移し、文書のプリアンブルを簡潔にして、フォントの更新を容易にします。


---

# 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/ja/xiang-xi-ji-shi/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.
