> 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/40-step-4-how-to-configure-an-italic-variable-font-using-fontspec.md).

# ステップ 4: fontspec を使ってイタリックの可変フォントを設定する方法

[はじめに](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)

このステップでは、3つの「未定義の形」警告のうち1つを解消するために、斜体の可変フォントを設定します。

## プロジェクトの「未定義の形」警告の要約

LaTeX は現在、プロジェクトに3つのフォント形状が不足していると警告しています。

![LaTeX のフォント不足警告を示す画像。](/files/8ea43b0f8f8654f4c2fce27023fb982fe1cd016c)

これらは下の表に要約されていますが、m は系列識別子から削除されることに注意してください *を除いて* ここで *両方の* 幅とウェイトは m（ミディアム）です。この記事では、中程度のウェイト、中程度の幅、斜体の形状を持つフォントを追加して、2つ目の警告を修正する方法を示します。

| **警告番号** | **警告の説明**                                | **系列識別子** | **ウェイト** | **幅** | **形状** |
| -------- | ---------------------------------------- | --------- | -------- | ----- | ------ |
| 1        | **b**太字ウェイト、 **m**中幅のフォント、 **n**通常（立体）形状 | b         | b        | m     | n      |
| 2        | **m**中程度のウェイト、 **m**中幅のフォント、 **it**斜体形状  | m         | m        | m     | it     |
| 3        | **b**太字ウェイト、 **m**中幅のフォント、 **it**斜体形状    | b         | b        | m     | it     |

## Noto Serif 用の2つのフォントファイル

立体と斜体のフォントスタイル（書体）のデザインは、可変フォントのデザイン軸を通じて滑らかに移行できないほど異なることがよくあります。立体と斜体の各形状には、そのデザイン固有の特徴を保つために専用のフォントファイルが必要です。そのため、Overleaf のチュートリアルプロジェクトには Noto Serif 用として次のファイルが含まれています。

* 立体形状用： `NotoSerif-VariableFont-wdth-wght.ttf`
* 斜体形状用： `NotoSerif-Italic-VariableFont-wdth-wght.ttf`

## Noto Serif の斜体フォントを追加する方法

本文書のテキストフォントである Noto Serif は、fontspec の `\setmainfont` コマンドを定義しようとする次の例で示されます：

```
\setmainfont{NotoSerif-VariableFont-wdth-wght.ttf}
```

参考までに、 `\setmainfont` は一般に次の形式です

```
\setmainfont{⟨font⟩}[⟨font features⟩]
```

任意指定の `⟨font features⟩` を使って、fontspec の `ItalicFont` キー。

### 斜体の可変フォントの設定

次の手順で、Noto Serif の斜体可変フォントを有効化（設定）します。

1. ステップ 3 で設定したチュートリアルプロジェクトを開いていることを確認してください。
2. この行を置き換えます

```
\setmainfont{NotoSerif-VariableFont-wdth-wght.ttf}
```

次の内容で

```
\setmainfont{NotoSerif-VariableFont-wdth-wght.ttf}
[
ItalicFont=NotoSerif-Italic-VariableFont-wdth-wght.ttf
]
```

6. 再コンパイルして、次の点に注意してください。

* 未定義の形状に関する警告は2つあり、前より1つ減っています：

![LaTeX のフォント不足警告を示す画像。](/files/990bcda3c064dc51a348d57c24b68a1c49316a66)

これらの警告は、通常（n）と斜体（it）のフォント形状に対する太字フォントがないことが原因です。

* 次の警告は表示されなくなります：

``Font shape `TU/NotoSerif-VariableFont-wdth-wght.ttf(0)/m/it' undefined``

* LaTeX が現在、系列の中程度の幅、中程度のウェイトの斜体（形状）フォントを利用できるようになったため、組版済み文書に斜体テキストが再び現れました。 `NotoSerif-VariableFont-wdth-wght.ttf(0)` ファミリー。

## 次のステップで

ステップ 5 では可変フォントのウェイトについて学び、ステップ 6 で可変フォントの初期設定を完了する準備をします。


---

# 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/40-step-4-how-to-configure-an-italic-variable-font-using-fontspec.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.
