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

# Langkah 1: Menyiapkan proyek Overleaf untuk menggunakan font variabel

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

Untuk memulai tutorial ini, buka [proyek Overleaf pendamping](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d) yang berisi font variabel berikut:

* [Noto Serif](https://fonts.google.com/noto/specimen/Noto+Serif/tester) (teks dokumen utama)
* [Noto Sans](https://fonts.google.com/noto/specimen/Noto+Sans/tester) (font sans serif)
* [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono/tester) (font monospace)

Font-font ini belum dikonfigurasi untuk digunakan. Awalnya, saat Anda mengompilasi [proyek Overleaf pendamping](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d), font teks standar (default) LaTeX akan diterapkan. Sepanjang tutorial ini, Anda akan belajar cara mengganti font default ini dengan font variabel yang disediakan di folder proyek bernama `VariableFonts`.

Jika Anda lebih suka menggunakan font variabel yang berbeda, cukup ikuti petunjuk di bawah. Jika tidak, lanjutkan ke [Langkah 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) tutorial ini.

## (Opsional) Cara memilih dan mengunggah font variabel Anda sendiri

Ikuti langkah-langkah berikut untuk mengunggah font variabel pilihan Anda.

### 1. Dapatkan font variabel dari Google Fonts

[Google Fonts](https://fonts.google.com/) adalah sumber yang sangat baik. Ini menyediakan [dokumentasi yang membantu](https://fonts.google.com/knowledge/introducing_type/introducing_variable_fonts) dan banyak [font variabel gratis untuk digunakan](https://fonts.google.com/?vfonly=true) yang dapat diunggah ke Overleaf dan dikonfigurasi untuk digunakan dalam proyek Anda.

* **TIP**: Gunakan filter Google Fonts untuk menemukan font variabel. Atur filter *Technology* ke *Variable* untuk menampilkan hanya font variabel. Gunakan filter tambahan, seperti *Serif*, untuk mempersempit pencarian Anda lebih lanjut.

![Gambar yang menunjukkan filter pencarian Google Fonts](/files/1e3ee8395e9ab9997e3b5af9b3328eaa2a346bb7)

* **TIP**: Anda dapat menelusuri font variabel berdasarkan sumbu desain yang didukungnya: lihat <https://fonts.google.com/variablefonts>. Google juga menyediakan definisi sumbu desain font variabel: lihat <https://fonts.google.com/variablefonts#axis-definitions>.
* Setelah menemukan font variabel apa pun yang ingin Anda gunakan, unduh ke perangkat lokal Anda dan ganti nama file apa pun yang berisi karakter bermasalah.
* Beberapa font variabel terdiri dari dua `.ttf` file: satu untuk bentuk tegak (regular) dan, jika disediakan, satu untuk bentuk miring. Pastikan untuk memeriksa ini untuk setiap font yang Anda unduh.

### 2. Ganti nama file font Google yang bermasalah

Skema Google untuk penamaan file font variabel menyertakan sumbu desain font, dipisahkan dengan koma. Sayangnya, skema itu menimbulkan masalah bagi fontspec, sebuah paket yang penting untuk menggunakan font variabel dengan LuaLaTeX. Misalnya, Noto Serif menyediakan sumbu lebar dan bobot dan disediakan sebagai dua file—satu untuk font tegak dan satu untuk font miring:

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

Koma dalam nama file ini memicu kesalahan saat digunakan dalam `\setmainfont` perintah fontspec. Misalnya, menulis

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

menghasilkan kesalahan yang mencakup

```
! Kesalahan paket fontspec: Font "NotoSerif-Italic-VariableFont_wdth" tidak
(fontspec)                dapat ditemukan.

! Kesalahan LaTeX: Kunci 'fontspec-opentype/wght.ttf' tidak dikenal dan
(LaTeX)        diabaikan.
```

Untuk mengatasi masalah ini, Anda perlu mengganti nama file font untuk menghapus koma (dan garis bawah '\_'), menggantinya dengan karakter “aman”, seperti tanda hubung ('-'), dan memastikan tidak ada karakter spasi yang ditambahkan. Misalnya, Anda dapat mengganti nama:

* NotoSans-VariableFont\_wdth,wght.ttf

ke

* NotoSans-VariableFont-wdth-wght.ttf

Langkah penggantian nama sederhana ini akan membantu menghindari konflik dan memastikan integrasi font variabel yang lancar dalam dokumen LaTeX Anda.

### 3. Buat proyek Overleaf baru

* Buat proyek Overleaf baru dan [atur compiler ke LuaLaTeX](/latex/id/basis-pengetahuan/026-changing-compiler.md) karena itu adalah satu-satunya compiler yang mendukung font variabel.
* Tambahkan `fontspec` paket ke preambel dokumen Anda dengan menulis `\usepackage{fontspec}`.
* Pilih ikon unggah file (![Image displaying Overleaf file-upload icon](/files/706dcdda88d67c74f38bab58a86fd5a1b0ba8473)) untuk menambahkan file font variabel yang telah diganti nama secara lokal ke proyek baru Anda:

![Gambar yang menunjukkan cara mengunggah file ke proyek Overleaf](/files/d2e26d01e56a3730e2b133572dc1579b3dc8a1f8)

### 4. (Opsional) Atur file font proyek Anda

Jika Anda ingin bereksperimen dengan berbagai font, misalnya saat menguji desain dokumen, akan membantu untuk mengatur file font Anda menggunakan folder proyek. Namun, pada saat kompilasi, LaTeX tidak akan secara otomatis mencari font di folder proyek Anda; Anda perlu membantu LaTeX dengan menggunakan file konfigurasi lokal bernama [latexmkrc](/latex/id/artikel-mendalam/28-how-to-use-latexmkrc-with-overleaf.md). Kami tidak akan membahas detailnya di sini, tetapi menyarankan untuk membuat folder proyek bernama `VariableFonts` dan menyalin `latexmkrc` file yang digunakan dalam [proyek pendamping](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d).

## Pada Langkah berikutnya

Langkah 2 memperkenalkan model LaTeX untuk memilih font: New Font Selection Scheme, memberikan informasi latar belakang penting yang digunakan sepanjang sisa tutorial ini.

[Pendahuluan](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [Langkah 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [Langkah 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [Langkah 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [Langkah 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [Langkah 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [Langkah 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [Langkah 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [Langkah 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [Contoh dan proyek](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/id/artikel-mendalam/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.
