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

# Passo 1: Impostare un progetto Overleaf per usare font variabili

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

Per iniziare questo tutorial, apri il [progetto Overleaf allegato](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d) che contiene i seguenti font variabili:

* [Noto Serif](https://fonts.google.com/noto/specimen/Noto+Serif/tester) (testo principale del documento)
* [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 monospaziato)

Questi font non sono ancora configurati per l'uso. Inizialmente, quando compili il [progetto Overleaf allegato](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d), verranno applicati i font di testo standard (predefiniti) di LaTeX. Durante tutto questo tutorial, imparerai come sostituire questi font predefiniti con i font variabili forniti nella cartella del progetto chiamata `VariableFonts`.

Se preferisci usare font variabili diversi, segui semplicemente le istruzioni qui sotto. Altrimenti, passa a [Passo 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) questo tutorial.

## (Facoltativo) Come scegliere e caricare i tuoi font variabili

Segui questi passaggi per caricare i font variabili che preferisci.

### 1. Ottieni font variabili da Google Fonts

[Google Fonts](https://fonts.google.com/) è una risorsa eccellente. Offre [documentazione utile](https://fonts.google.com/knowledge/introducing_type/introducing_variable_fonts) e molti [font variabili gratuiti da utilizzare](https://fonts.google.com/?vfonly=true) che possono essere caricati su Overleaf e configurati per l'uso nei tuoi progetti.

* **SUGGERIMENTO**: Usa i filtri di Google Fonts per trovare font variabili. Imposta il *Technology* filtro su *Variable* per visualizzare solo i font variabili. Usa filtri aggiuntivi, come *Serif*, per restringere ulteriormente la ricerca.

![Immagine che mostra i filtri di ricerca di Google Fonts](/files/2f401ce48255b7380a3a1f7a8a00ce097037eada)

* **SUGGERIMENTO**: Puoi sfogliare i font variabili in base agli assi di progettazione che supportano: vedi <https://fonts.google.com/variablefonts>. Google fornisce anche le definizioni degli assi di progettazione dei font variabili: vedi <https://fonts.google.com/variablefonts#axis-definitions>.
* Dopo aver individuato i font variabili che desideri usare, scaricali sul tuo dispositivo locale e rinomina eventuali file contenenti caratteri problematici.
* Alcuni font variabili sono costituiti da due `.ttf` file: uno per la forma diritta (normale) e, se presente, uno per la forma corsiva. Assicurati di verificare questo per ogni font che scarichi.

### 2. Rinomina i nomi problematici dei file dei font Google

Lo schema di Google per la denominazione dei file dei font variabili include gli assi di progettazione del font, separati da virgole. Purtroppo, questo schema causa problemi a fontspec, un pacchetto essenziale per usare i font variabili con LuaLaTeX. Ad esempio, Noto Serif offre gli assi larghezza e peso ed è fornito in due file—uno per il font diritto e uno per il font corsivo:

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

Le virgole in questi nomi di file generano errori quando vengono usate nel comando di fontspec `\setmainfont` comando. Ad esempio, scrivere

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

produce errori che includono

```
! Errore del pacchetto fontspec: Il font "NotoSerif-Italic-VariableFont_wdth" non può
(fontspec)                essere trovato.

! Errore di LaTeX: La chiave 'fontspec-opentype/wght.ttf' è sconosciuta e viene
(LaTeX)        ignorata.
```

Per risolvere questo problema, devi rinominare i file dei font per rimuovere le virgole (e gli underscore '\_'), sostituendoli con un carattere “sicuro”, come i trattini ('-'), e assicurandoti di non aggiungere caratteri di spazio. Ad esempio, potresti rinominare:

* NotoSans-VariableFont\_wdth,wght.ttf

su

* NotoSans-VariableFont-wdth-wght.ttf

Questo semplice passaggio di rinomina aiuterà a evitare conflitti e garantirà un'integrazione fluida dei font variabili nei tuoi documenti LaTeX.

### 3. Crea un nuovo progetto Overleaf

* Crea un nuovo progetto Overleaf e [imposta il compilatore su LuaLaTeX](/latex/it/base-di-conoscenza/026-changing-compiler.md) perché è l'unico compilatore che supporta i font variabili.
* Aggiungi il `fontspec` pacchetto al preambolo del tuo documento scrivendo `\usepackage{fontspec}`.
* Seleziona l'icona di caricamento file (![Image displaying Overleaf file-upload icon](/files/77ca104eb52e13df79a8febf07f72b76bdfbe070)) per aggiungere al tuo nuovo progetto i file dei font variabili rinominati localmente:

![Immagine che mostra come caricare un file in un progetto Overleaf](/files/83cf72e0736b50ebce0c6419d60aaa9b4f700139)

### 4. (Facoltativo) organizza i file dei font del tuo progetto

Se desideri sperimentare con una gamma di font, ad esempio quando testi i design dei documenti, è utile organizzare i file dei font usando cartelle di progetto. Tuttavia, al momento della compilazione, LaTeX non cercherà automaticamente i font nelle cartelle del tuo progetto; dovrai aiutare LaTeX usando un file di configurazione locale chiamato [latexmkrc](/latex/it/articoli-approfonditi/28-how-to-use-latexmkrc-with-overleaf.md). Non entreremo nei dettagli qui, ma consigliamo di creare una cartella di progetto chiamata `VariableFonts` e copiare il `latexmkrc` file usato nel [progetto allegato](https://www.overleaf.com/8438931911svtqtnmfvsrp#28008d).

## Nel passaggio successivo

Il Passo 2 introduce il modello di LaTeX per la selezione dei font: il New Font Selection Scheme, fornendo importanti informazioni di contesto utilizzate per il resto di questo tutorial.

[Introduzione](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true) [Passo 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true) [Passo 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true) [Passo 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true) [Passo 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true) [Passo 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true) [Passo 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true) [Passo 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true) [Passo 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true) [Esempi e progetti](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/it/articoli-approfonditi/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.
