> 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/42-step-6-using-variable-fonts-to-add-bold-fonts-to-an-overleaf-project.md).

# ステップ 6: 可変フォントを使って Overleaf プロジェクトに太字フォントを追加する

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

ステップ5では、文書の本文フォントである Noto Serif の中程度のウェイトを、直立スタイルとイタリックスタイルの両方でウェイト軸の値 400 を使って設定しました。このステップでは、通常（直立）スタイルとイタリックスタイルの両方に太字フォントを提供するように Noto Serif を設定する方法を示します。

ステップ5で設定したチュートリアルプロジェクトを開いていることを確認してください。

## 未定義の太字フォントに関する警告

現在のプロジェクトを再コンパイルすると、LaTeX は次の警告を出します：

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

これらの警告は下の表にまとめられています。シリーズ識別子から m が省略されることを覚えておいてください *を除いて* ここで *両方の* 幅とウェイトは m（medium）です。

| **警告番号** | **警告の説明**               | **系列識別子** | **ウェイト** | **幅** | **形状** |
| -------- | ----------------------- | --------- | -------- | ----- | ------ |
| 1        | 通常（直立）形状の太字ウェイト、標準幅フォント | b         | b        | m     | n      |
| 2        | イタリック形状の太字ウェイト、標準幅フォント  | b         | b        | m     | it     |

直立（通常）とイタリックのフォント形状に太字フォントを設定して、これらを修正する方法を示します。

## 可変フォントのウェイト軸を使って太字フォントを追加する

太字の直立テキストと太字のイタリックテキスト用のフォントは、fontspec の `FontFace` キーを使って設定できます。形式は次のとおりです

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

ここで

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

Noto Serif の名前付きインスタンス（LINK）で推奨されている値を用いて、ウェイト軸の値 600 を使い、通常（直立）とイタリックの形状用の太字フォントを設定します。

### 太字・標準幅・直立フォントの設定方法

次の `FontFace` キーを以下の設定で使用します

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

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

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

### 太字・標準幅・イタリックフォントの設定方法

次の `FontFace` キーを以下の設定で使用します

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

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

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

## まとめて設定する

現在のプロジェクトの `\setmainfont` コマンドを次の設定に更新します：

```latex
\setmainfont{NotoSerif-VariableFont-wdth-wght.ttf}[
Weight=400,
ItalicFont = NotoSerif-Italic-VariableFont-wdth-wght.ttf,
FontFace = {b}{n}{Font = NotoSerif-VariableFont-wdth-wght.ttf,Weight=600},
FontFace = {b}{it}{Font = NotoSerif-Italic-VariableFont-wdth-wght.ttf,Weight=600}
]
```

現在のプロジェクトを再コンパイルして、未定義の形状に関する警告がもう出ないことを確認します。

## ボーナス機能：スモールキャップが無料で使えます！

このセクションでは、うれしいボーナスとして、fontspec がスモールキャップをサポートするフォントでは自動的に有効にすることを紹介します。

### スモールキャップとは？

スモールキャップは、小文字と同じ高さの大文字を使う文字スタイルです。略語や技術文書のキーワードなど、大文字の単語が多く含まれるテキスト内で、装飾的な目的で使われます。

次の LaTeX テキストを現在の Overleaf プロジェクトに貼り付けて、スモールキャップあり／なしのテキストを比較する例を組版してください。必ず貼り付けてください *の後に* `\begin{document}`。LaTeX の `\textsc` コマンドはスモールキャップでテキストを組版するために使われます。

```latex
大文字の連続が多いと、組版したテキストが
「タイポグラフィ的に見苦しい」と見えることがあります。その外観は
スモールキャップを使うことで改善され、より洗練された、上品な見た目になります。

\vskip10pt
多くの \textsc{uppercase} 文字の連続は、あなたの
\textsc{typeset} されたテキストを「タイポグラフィ的に \textsc{unsightly}」に見せることがあります。
その \textsc{appearance} は、スモールキャップを使うことで改善でき、
テキストに洗練された、より \textsc{elegant} な印象を与えます。
```

この例では、次の出力が生成されます:

![スモールキャップあり／なしで組版したテキストを比較する画像](/files/95b07f8d3174356f49d4620d99574e970a3dee3c)

### どの可変フォントでスモールキャップが有効になっていますか？

fontspec は、スモールキャップをサポートするフォントでは自動的に有効にします。3つの可変フォントはいずれもスモールキャップを提供します。次の LaTeX テキストを文書に貼り付けて、3つすべてのフォントファミリーを使ってスモールキャップを組版してください：

```latex
\begin{itemize}
\item 本文ファミリー（Noto Serif）：\textsc{small caps}
\item サンセリフファミリー（Noto Sans）：{\sffamily \textsc{small caps}}
\item 等幅ファミリー（Roboto Mono）：{\ttfamily \textsc{small caps}}
\end{itemize}
```

この例では、次の出力が生成されます:

![LaTeX で3種類の可変フォントを使って組版したスモールキャップを示す画像](/files/40ce040744fc7e030e5523486334678cd00e63fb)

### 太字やイタリックのスモールキャップはどうでしょうか？

Noto Serif の太字とイタリックのフォントを設定したので、これらのスタイルでもスモールキャップを組版できます。Noto Serif を使ってスモールキャップの一部を組版するには、次のコードを最新の Overleaf プロジェクトに貼り付けてください：

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

すると、次の出力になります：

![可変フォントを使って LaTeX で組版した太字およびイタリックのスモールキャップを示す画像](/files/482bcbcf62001ef5b1020baa16bf972e840b7b1c)

## 次のステップで

次のステップでは、サンセリフフォントファミリー（Noto Sans）と等幅フォントファミリー（Roboto Mono）の太字およびイタリックのフォントスタイルを設定します。


---

# 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/42-step-6-using-variable-fonts-to-add-bold-fonts-to-an-overleaf-project.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.
