> 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/37-step-1-setting-up-an-overleaf-project-to-use-variable-fonts.md).

# ステップ 1: 可変フォントを使うための 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)

このチュートリアルを始めるには、 [付属の Overleaf プロジェクト](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d) を開いてください。そこには次の可変フォントが含まれています:

* [Noto Serif](https://fonts.google.com/noto/specimen/Noto+Serif/tester) （本文テキスト）
* [Noto Sans](https://fonts.google.com/noto/specimen/Noto+Sans/tester) （サンセリフ体フォント）
* [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono/tester) （等幅フォント）

これらのフォントはまだ使用するように設定されていません。最初に、 [付属の Overleaf プロジェクト](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d)をコンパイルすると、LaTeX の標準（デフォルト）のテキストフォントが適用されます。このチュートリアル全体を通して、これらのデフォルトフォントを、という名前のプロジェクトフォルダに用意されている可変フォントに置き換える方法を学びます `VariableFonts`.

別の可変フォントを使いたい場合は、以下の手順に従ってください。そうでない場合は、 [ステップ 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) このチュートリアルへ進んでください。

## （オプション）独自の可変フォントを選択してアップロードする方法

次の手順に従って、お好みの可変フォントをアップロードします。

### 1. Google Fonts から可変フォントを入手する

[Google Fonts](https://fonts.google.com/) は優れたリソースです。そこには [役立つドキュメント](https://fonts.google.com/knowledge/introducing_type/introducing_variable_fonts) や、多くの [無料で使用できる可変フォント](https://fonts.google.com/?vfonly=true) があり、Overleaf にアップロードしてプロジェクトで使えるように設定できます。

* **ヒント**: Google Fonts のフィルタを使って可変フォントを見つけます。 *Technology* フィルタを *Variable* に設定して、可変フォントのみを表示します。さらに、 *Serif*などの追加フィルタを使って、検索をさらに絞り込めます。

![Google Fonts の検索フィルタを示す画像](/files/1cfb88db1ae580a9cfa9060a0be8358fa9975aa6)

* **ヒント**: サポートするデザイン軸に基づいて可変フォントを閲覧できます。参照: <https://fonts.google.com/variablefonts>. Google では可変フォントのデザイン軸の定義も提供しています。参照: <https://fonts.google.com/variablefonts#axis-definitions>.
* 使用したい可変フォントが見つかったら、それをローカルデバイスにダウンロードし、問題のある文字を含むファイル名を変更してください。
* 可変フォントの中には、2 つの `.ttf` ファイルで構成されるものがあります。1 つは直立（通常）形、もう 1 つは、提供されていれば斜体形です。ダウンロードした各フォントについてこれを確認してください。

### 2. 問題のある Google フォントのファイル名を変更する

Google の可変フォントファイルの命名規則には、フォントのデザイン軸がカンマ区切りで含まれます。残念ながら、この方式は、LuaLaTeX で可変フォントを使うために必須のパッケージである fontspec では問題を引き起こします。たとえば、Noto Serif は幅と太さの軸を持ち、2 つのファイルとして提供されます。1 つは直立フォント用、もう 1 つは斜体フォント用です:

* NotoSerif-VariableFont\_wdth,wght.ttf
* NotoSerif-Italic-VariableFont\_wdth,wght.ttf

これらのファイル名に含まれるカンマは、fontspec の `\setmainfont` コマンドで使うとエラーを引き起こします。たとえば、

```
\setmainfont{NotoSerif-VariableFont_wdth,wght.ttf}
[ItalicFont = NotoSerif-Italic-VariableFont_wdth,wght.ttf]
```

と書くと、次のようなエラーが出ます:

```
! Package fontspec Error: フォント "NotoSerif-Italic-VariableFont_wdth" を
（fontspec）                見つけられません。

! LaTeX Error: キー 'fontspec-opentype/wght.ttf' は不明で、
（LaTeX）        無視されます。
```

この問題を解決するには、ファイル名からカンマ（およびアンダースコア '\_'）を削除し、代わりにハイフン（'-'）のような「安全な」文字に置き換え、空白文字を追加しないようにして、フォントファイルの名前を変更する必要があります。たとえば、次のように変更できます:

* NotoSans-VariableFont\_wdth,wght.ttf

から

* NotoSans-VariableFont-wdth-wght.ttf

この簡単な名前変更の手順により、衝突を避け、LaTeX 文書で可変フォントをスムーズに統合できるようになります。

### 3. 新しい Overleaf プロジェクトを作成する

* 新しい Overleaf プロジェクトを作成し、 [コンパイラを LuaLaTeX に設定してください](/latex/ja/narejjibsu/026-changing-compiler.md) 。可変フォントをサポートしているのはこのコンパイラだけだからです。
* 次の `fontspec` パッケージを文書のプリアンブルに、次のように記述して追加します `\usepackage{fontspec}`.
* ファイルアップロードアイコン（![Image displaying Overleaf file-upload icon](/files/6722a66482b0bf7b5f83ad3d28f8b4f91e2a5504)）を選択して、ローカルでリネームした可変フォントファイルを新しいプロジェクトに追加します:

![Overleaf プロジェクトにファイルをアップロードする方法を示す画像](/files/13cb6b99a6569db270096350b197b4f2d6d1f7bb)

### 4. （オプション）プロジェクトのフォントファイルを整理する

たとえば文書デザインをテストするときのように、さまざまなフォントを試したい場合は、プロジェクトフォルダを使ってフォントファイルを整理すると便利です。ただし、コンパイル時に LaTeX はプロジェクトフォルダ内のフォントを自動では検索しません。 [latexmkrc](/latex/ja/xiang-xi-ji-shi/28-how-to-use-latexmkrc-with-overleaf.md)というローカル設定ファイルを使って LaTeX を補助する必要があります。 `VariableFonts` ここでは詳しく説明しませんが、 `latexmkrc` というプロジェクトフォルダを作成することをおすすめします。 [そして、](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d).

## 次のステップでは

ステップ 2 では、LaTeX のフォント選択モデルである New Font Selection Scheme を紹介し、このチュートリアルの残りの部分で使う重要な背景情報を提供します。

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


---

# 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/37-step-1-setting-up-an-overleaf-project-to-use-variable-fonts.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.
