> 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/de/ausfuhrliche-artikel/44-step-8-how-to-create-a-simple-latex-package-to-configure-your-variable-fonts.md).

# Schritt 8: Wie man ein einfaches LaTeX-Paket erstellt, um variable Schriftarten zu konfigurieren

&#x20;[Einführung](https://www.overleaf.com/learn/latex/Articles/How_to_use_OpenType_variable_fonts_with_LaTeX?preview=true)   [Schritt 1](https://www.overleaf.com/learn/latex/Articles/Step_1:_Setting_up_an_Overleaf_project_to_use_variable_fonts?preview=true)   [Schritt 2](https://www.overleaf.com/learn/latex/Articles/Step_2:_An_introduction_to_LaTeX_fonts?preview=true)   [Schritt 3](https://www.overleaf.com/learn/latex/Articles/Step_3:_Replacing_LaTeX’s_default_fonts_with_variable_fonts?preview=true)   [Schritt 4](https://www.overleaf.com/learn/latex/Articles/Step_4:_How_to_configure_an_italic_variable_font_using_fontspec?preview=true)   [Schritt 5](https://www.overleaf.com/learn/latex/Articles/Step_5:_LaTeX_font_weights_and_named_instances_of_variable_fonts?preview=true)   [Schritt 6](https://www.overleaf.com/learn/latex/Articles/Step_6:_Using_variable_fonts_to_add_bold_fonts_to_an_Overleaf_project?preview=true)   [Schritt 7](https://www.overleaf.com/learn/latex/Articles/Step_7:_Using_Noto_Sans_and_Roboto_Mono_variable_fonts_with_LaTeX?preview=true)   [Schritt 8](https://www.overleaf.com/learn/latex/Articles/Step_8:_How_to_create_a_simple_LaTeX_package_to_configure_your_variable_fonts?preview=true)   [Beispiele und Projekte](https://www.overleaf.com/learn/latex/Articles/Overleaf_projects_showing_how_to_use_variable_fonts_with_LaTeX?preview=true)&#x20;

Die Verwendung von fontspec zum Konfigurieren variabler Schriftarten kann die Präambel eines Dokuments mit viel Einrichtungscode überladen. In diesem Schritt zeigen wir, wie man ein einfaches Paket erstellt, das den Konfigurationscode von fontspec enthält – dadurch wird die Präambel des Dokuments vereinfacht und spätere Schriftänderungen werden erleichtert.

## Wie man ein einfaches LaTeX-Paket erstellt und verwendet

Befolgen Sie diese Schritte, um ein einfaches LaTeX-Paket für den fontspec-Konfigurationscode zu erstellen, den wir für dieses Tutorial erstellt haben.

1. Wählen Sie die **Neue Datei** Symbol (![Overleaf icon representing adding a file](/files/bb287bcc6935941d7e9917f0e7da07034b94286e)) um eine neue Projektdatei zu erstellen. Geben Sie ihr den Namen `myfontsettings.sty` und wählen Sie **Erstellen**.

![Bild des Overleaf-Modalfensters „Dateien hinzufügen“](/files/e8ddfed41a1c41b1f03252ffdb88090f93a8b321)

3. Fügen Sie den fontspec-Konfigurationscode in die Datei ein `myfontsettings.sty`. Hier verwenden wir den fontspec-Konfigurationscode für Noto Serif, Noto Sans und Roboto Mono, der während des Tutorials zu variablen Schriftarten hinzugefügt wurde. Sie müssen die fontspec-Einstellungen anpassen, wenn Sie andere variable Schriftarten verwenden.

```latex
% myfontsettings.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{myfontsettings}[2024/06/13 v1.0 Meine benutzerdefinierten Schriftarteinstellungen]

% Dieses einfache Paket enthält Ihre fontspec-Konfiguration
% Es hält die Präambel Ihres Dokuments sauber und ordentlich

% fontspec-Paket laden
\RequirePackage{fontspec}

% Die Haupttextschriftart für das Dokument festlegen
\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}
]

% Nichtproportionale Schriftart der Dokumentfamilie
\setsansfont{NotoSans-VariableFont-wdth-wght.ttf}[
Weight=400,
ItalicFont=NotoSans-Italic-VariableFont-wdth-wght.ttf,
FontFace = {b}{n}{Font = NotoSans-VariableFont-wdth-wght.ttf,Weight=600},
FontFace = {b}{it}{Font = NotoSans-Italic-VariableFont-wdth-wght.ttf,Weight=600}
]

% Schriftart mit fester Laufweite der Dokumentfamilie
\setmonofont{RobotoMono-VariableFont-wght.ttf}[
NFSSFamily=RobotoMono,
Weight=300,
ItalicFont=RobotoMono-Italic-VariableFont-wght.ttf,
FontFace = {b}{n}{Font =RobotoMono-VariableFont-wght.ttf,Weight=550},
FontFace = {b}{it}{Font = RobotoMono-Italic-VariableFont-wght.ttf, Weight=550}
]

\endinput
```

5. Um dieses Paket zu verwenden, fügen Sie die Zeile `\usepackage{myfontsetting}` in die Präambel Ihres Dokuments ein.


---

# 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/de/ausfuhrliche-artikel/44-step-8-how-to-create-a-simple-latex-package-to-configure-your-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.
