> For the complete documentation index, see [llms.txt](https://ayakaleaf-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://ayakaleaf-pro.ayaka.space/latex/zh-cn/yu-yan/09-greek.md).

# 希腊语

## 引言

本文介绍如何排版希腊文，并提供对语言特定功能的支持，例如断字。

### 使用 pdfLaTeX 的希腊文示例

我们先从下面这个 pdfLaTeX 示例开始，你可以通过代码下方的链接在 Overleaf 中打开它。

```latex
\documentclass{article}
% \usepackage[utf8]{inputenc} is no longer required (since 2018)

% Set the font (output) encoding
\usepackage[LGR]{fontenc}

% Greek-specific commands
\usepackage[greek]{babel}

\begin{document}
\tableofcontents

\begin{abstract}
这是一个关于该主题的简短描述
在本文档中有更清晰的解释
\end{abstract}

\section{εισαγωγή}
这是文档的第一部分。
这是一段引言段落。

\section{δεύτερο τμήμα}
文档的第二部分。该节
可以包含数学符号。
\end{document}
```

[在 Overleaf 中打开此 pdfLaTeX 示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Sample+Greek+document\&snip=%5Cdocumentclass%7Barticle%7D%0A%25+%5Cusepackage%5Butf8%5D%7Binputenc%7D+is+no+longer+required+%28since+2018%29%0A%0A%25+Set+the+font+%28output%29+encoding%0A%5Cusepackage%5BLGR%5D%7Bfontenc%7D%0A%0A%25+Greek-specific+commands%0A%5Cusepackage%5Bgreek%5D%7Bbabel%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Ctableofcontents%0A%0A%5Cbegin%7Babstract%7D%0A%CE%91%CF%85%CF%84%CE%AE+%CE%B5%CE%AF%CE%BD%CE%B1%CE%B9+%CE%BC%CE%B9%CE%B1+%CF%83%CF%8D%CE%BD%CF%84%CE%BF%CE%BC%CE%B7+%CF%80%CE%B5%CF%81%CE%B9%CE%B3%CF%81%CE%B1%CF%86%CE%AE+%CF%84%CE%BF%CF%85+%CE%B8%CE%AD%CE%BC%CE%B1%CF%84%CE%BF%CF%82+%0A%CF%83%CE%B1%CF%86%C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B1%CE%B8%CE%B7%CE%BC%CE%B1%CF%84%CE%B9%CE%BA%CE%AE+%CF%83%CE%B7%CE%BC%CE%B5%CE%B9%CE%BF%CE%B3%CF%81%CE%B1%CF%86%CE%AF%CE%B1.%0A%5Cend%7Bdocument%7D)

此示例生成如下输出：

![OL2greekV2.png](/files/1e0b438572e052124af87a49be7d3f09db0c6318)

### 文本文件：整数和字符

任何文本文件，例如 LaTeX 输入 `.tex` 文件，不过只是一个数值（整数）流，它们被用作一种机制来 *表示* 文本字符；因此，处理文本文件涉及扫描（读取/处理）一系列整数值。然而，一个重要问题随之出现： *哪一组字符* 实际上是由某个特定文本文件中包含的整数值表示的？换句话说，这些整数值是如何被 *编码*：从文本文件中的整数到它们应当对应的字符，正确（预期的）“映射”（编码）是什么？ *表示*?

文本文件可以在无数种计算环境中生成：跨越不同的国家/大洲，使用各种不同的设备、操作系统和编辑工具。文本文件的创建者在生成并存储用于表示文本文件中各个字符的一串整数值时，可能会根据本地要求，例如语言，使用或应用不同的文本编码。如果生成的文本文件始终处于使用相同编码的兼容技术生态系统中，这也许运作良好，但当这些文件被传输到完全不同的环境时会怎样呢——因为许多文本文件并不包含任何指示其生成所用编码的信息。

显然，文本数据的生产者（创建者）和消费者（用户）必须以某种方式就所使用的编码（映射）达成一致，否则 *编码错误* 很可能会由于文件中的整数数据与其所假定表示的字符集之间不匹配而出现。除了将文本文件中的整数值正确映射到字符之外，之后对这些字符的任何可视显示都需要某种字体，它能够提供数据（字形，甚至位图），以输出所需字符的视觉表示。

### 输入编码：inputenc、UTF-8 以及 2018 年 LaTeX 的变化

从历史上看，曾使用多种 8 位编码来生成/处理文本文件，包括 LaTeX 输入。长话短说，LaTeX 的开发者创建了 `inputenc` 宏包来解决编码问题——使使用各种编码创建的文本文件能够在不同的 LaTeX 安装之间传输。

然而，随着时间推移，用户/软件开发者逐渐从多种 8 位编码转向使用 Unicode 及其 UTF-8 编码方案，它已成为文本文件编码的事实标准。在 2018 年之前，为了处理 UTF-8 编码的文件，LaTeX 文档导言区会包含这一行

```latex
\usepackage[utf8]{inputenc}
```

读者可能会注意到，上面的示例并不包含这一行 `\usepackage[utf8]{inputenc}` 在文档导言区：为什么会这样？这是由于 2018 年 LaTeX 引入的一项重要变化：将 UTF-8 作为默认 *输入* 编码。使用 pdfLaTeX 排版并采用 UTF-8 编码文本的文档，包括在 Overleaf 上创建和排版的文档，不再 *需要* 需要包含 `\usepackage[utf8]{inputenc}` 但 [这样做也无妨](https://www.latex-project.org/news/2018/04/10/issue28-of-latex2e-news-released/)。更多信息请参见 [2018 年 4 月的 LaTeX News 期](https://www.latex-project.org/news/2018/04/10/issue28-of-latex2e-news-released/) 以及 Overleaf 博客文章 [*TeX Live 升级——2019 年 9 月*](https://www.overleaf.com/blog/tex-live-upgrade-september-2019)。在 Overleaf 上创建的所有文本文件都使用 UTF-8 编码。

### 输出编码：fontenc 宏包

为了正确排版输入文件中的字符，这些字符需要被映射到相应的 *输出字形* （glyphs）中，这些字形包含在用于排版文档的字体里。这种“输出编码”由另一个名为 `fontenc`.

对于希腊文，你需要选择 [LGR 编码](http://mirrors.ctan.org/macros/latex/base/encguide.pdf) 通过 `fontenc` 方法是在文档导言区加入以下一行：

```latex
\usepackage[LGR]{fontenc}
```

### 用于希腊文的 LaTeX LGR 字体编码

下面的图表列出了希腊文的 LGR 字体编码。它转载自文档第 36 页 *LaTeX 字体编码* ，该文档是 [可在 CTAN 上获取](http://mirrors.ctan.org/macros/latex/base/encguide.pdf).

![](/files/813ccd282314187c86e6938b48b2d98c17ad3de5)

## 特定语言的宏包和命令

为了扩展 LaTeX 的默认功能，提供正确的断字以及文档元素名称的翻译，请导入 `babel` 宏包，并使用 `希腊文` 语言选项。

```latex
\usepackage[greek]{babel}
```

如你所见，在 [pdfLaTeX 示例](#greek-example-using-pdflatex)，此时不使用“Abstract”和“Contents”，而是使用希腊语词“Περίληψη”和“Περιεχόμενα”。

### 包含希腊文和拉丁文的文档

这里有一个包含拉丁字符和希腊字符的示例。

```latex
\documentclass{article}

% Set the font (output) encodings
\usepackage[LGR, T1]{fontenc}

% \usepackage[utf8]{inputenc} is no longer required (since 2018)

% Greek-specific commands
\usepackage[greek]{babel}

% Use Greek characters directly in mathematical mode
% instead of using the commands \alpha etc
\usepackage{alphabeta}

\begin{document}
\tableofcontents

\begin{abstract}
这是一个关于该主题的简短描述
在本文档中有更清晰的解释
\end{abstract}

\section{εισαγωγή}
这是文档的第一部分。它是
一段引言段落。

\section{δεύτερο τμήμα}
文档的第二部分。该节
可以包含数学符号。

\[x^2 + y^2 - \alpha = 4τ + 5α \]

\textlatin{Latin text can also be added to
the document.}
\end{document}
```

[在 Overleaf 中打开此 pdfLaTeX 示例](<https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Sample+Greek+and+English+text+document\&snip=\documentclass{article}&#xA;&#xA;%+Set+the+font+(output)+encodings&#xA;\usepackage\[LGR,+T1]{fontenc}&#xA;&#xA;%+\usepackage\[utf8]{inputenc}+is+no+longer+required+(since+2018)&#xA;&#xA;%+Greek-specific+commands&#xA;\usepackage\[greek]{babel}&#xA;&#xA;%+Use+Greek+characters+directly+in+mathematical+mode+&#xA;%+instead+of+using+the+commands+\alpha+etc&#xA;\usepackage{alphabeta}&#xA;&#xA;\begin{document}&#xA;\tableofcontents&#xA;&#xA;\begin{abstract}&#xA;Αυτή+είναι+μια+σύντομη+περιγραφή+του+θέματος+&#xA;σαφέστερα+εξηγείται+στο+παρόν+έγγραφο&#xA;\end{abstract}&#xA;&#xA;\section{εισαγωγή}&#xA;Αυτό+είναι+το+πρώτο+τμήμα+του+εγγράφου.+Είναι+&#xA;μια+εισαγωγική+παράγραφο.&#xA;&#xA;\section{δεύτερο+τμήμα}&#xA;Το+δεύτερο+τμήμα+του+εγγράφου.+Αυτή+η+ενότητα+&#xA;μπορεί+να+περιέχει+μαθηματική+σημειογραφία.&#xA;&#xA;\\\[x^2+++y^2+-+\alpha+=+4τ+++5α+\\]&#xA;&#xA;\textlatin{Latin+text+can+also+be+added+to+&#xA;the+document.}&#xA;\end{document}>)

此示例生成如下输出：

![OL2greek2.png](/files/e7f587a50f6392bab7699a3c342d6112ff377ec9)

以下是上例中所用命令的简要说明。

* `\usepackage{alphabeta}`：通过加载此宏包，你可以在数学模式下直接使用键盘/小键盘输入的希腊字符，而无需使用诸如 `\alpha`, `\beta`, `\gamma` 等等。请参见 LaTeX 代码 `\[x^2 + y^2 - \alpha = 4τ + 5α \]` ，见上面的示例。
* `\usepackage[LGR, T1]{fontenc}`：此命令将在本文档中设置两种字体编码： `LGR` 用于希腊文，以及 `T1` 用于拉丁文。
* `\textlatin{*Latin text here*}`：你可以使用此命令排版用拉丁字符书写的文本，这对简短注释很有用。

## 进一步阅读

更多信息请参见

* [在 XƎLaTeX 中支持现代字体](/latex/zh-cn/zi-ti/03-xelatex.md)
* [引号和引号符号的排版](/latex/zh-cn/yu-yan/04-typesetting-quotations.md)
* [国际语言支持](/latex/zh-cn/yu-yan/03-international-language-support.md)
* [中文](/latex/zh-cn/yu-yan/06-chinese.md)
* [法语](/latex/zh-cn/yu-yan/07-french.md)
* [德语](/latex/zh-cn/yu-yan/08-german.md)
* [阿拉伯语](/latex/zh-cn/yu-yan/05-arabic.md)
* [意大利语](/latex/zh-cn/yu-yan/10-italian.md)
* [日语](/latex/zh-cn/yu-yan/11-japanese.md)
* [韩语](/latex/zh-cn/yu-yan/12-korean.md)
* [葡萄牙语](/latex/zh-cn/yu-yan/13-portuguese.md)
* [俄语](/latex/zh-cn/yu-yan/14-russian.md)
* [西班牙语](/latex/zh-cn/yu-yan/15-spanish.md)
* [LaTeX2ε 的不算太短的介绍](http://www.ctan.org/tex-archive/info/lshort/)
* [WikiBooks 上的 LaTeX/国际化](http://en.wikibooks.org/wiki/LaTeX/Internationalization)
* [WikiBooks 上的 LaTeX/特殊字符](http://en.wikibooks.org/wiki/LaTeX/Special_Characters)


---

# 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://ayakaleaf-pro.ayaka.space/latex/zh-cn/yu-yan/09-greek.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.
