> 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/zh-cn/te-ding-ling-yu/10-attribute-value-matrices.md).

# 属性值矩阵

本文演示属性值矩阵（AVM）的排版，这是一种展示 [特征结构](https://en.wikipedia.org/wiki/Feature_structure) 作为一组属性及其对应值的实用方式。

## LaTeX 的 AVM 宏包使用说明

本文使用了 `avm` 宏包，这是本材料最初编写时用于排版 AVM 的首选方案。不幸的是， `avm` 宏包并未由 TeX Live 分发，这意味着 Overleaf 用户需要上传一份（`avm.sty`）到他们的项目中。为了解决这一点， [随本文附带的 Overleaf Gallery 项目](https://www.overleaf.com/latex/templates/examples-of-attribute-value-matrices/fnrbcjztvjjv) 包含了一份 `avm` 宏包。

一种替代方案 `avm`， [`langsci-avm` 宏包](https://ctan.org/pkg/langsci-avm?lang=en)，现已可在 TeX Live 中使用，因此可通过 Overleaf 直接访问。然而，由于语法和功能差异， `avm`基于 avm 的示例无法用 `langsci-avm` 编译，并且需要进行一些编辑。请参见 [`langsci-avm` 文档](http://mirrors.ctan.org/macros/latex/contrib/langsci-avm/langsci-avm.pdf) 的第 4.6 节，了解从 `avm` 更改为 `langsci-avm`.

## 开始使用

使用 `avm` 环境来创建属性值矩阵，如下面的示例所示：

```latex
\documentclass{article}
\usepackage{avm}

\begin{document}

\begin{avm}
    \[ cat\|subcat & \<NP$_{it}$, NP$_{\@2}$, S[comp]:\@3\> \\
       content & \[ relation & \bf bother\\
                    bothered & \@2 \\
                    soa-arg  & \@3 \] \]
\end{avm}

\end{document}
```

本示例生成以下输出：

![使用 LaTeX 在 Overleaf 上排版的属性值矩阵](/files/8f31c0d07c13aa66b81633488a28d2e64977108e)

\* 要探索 AVM，请打开此 [Overleaf 项目。](https://www.overleaf.com/project/new/template/26428?id=113292459\&templateName=Example+project+demonstrating+attribute+value+matrices\&latexEngine=pdflatex\&texImage=texlive-full%3A2022.1\&mainFile=)

## 基本用法

要在 `avm` 环境中排版属性值矩阵，你需要了解若干命令：

* `\avmfont{\sc}`：更改矩阵中使用的字体，这里是小型大写。任何其他 [字体族](/latex/zh-cn/zi-ti/01-font-sizes-families-and-styles.md) 都可以。字体大小和 [字体字形](/latex/zh-cn/zi-ti/02-font-typefaces.md) 也可以在这里声明。
* `\begin{avm}` 和 `\end{avm}`：这些命令用于打开和关闭将创建属性值矩阵的环境。
* `\[` 和 `\]`：打印用于分隔矩阵各部分的方括号。其他括号也可与命令 `\<`, `\>`, `\{` 和 `\}`.
* `\\`：插入新行。
* `&`：在同一行中创建列分隔。

下面的示例演示了这些：

```latex
\documentclass{article}

\usepackage{avm}
\avmfont{\sc}

\begin{document}
\begin{avm}
    \[ subj & \[ pers & 3 \\
                 num & sg \\
                 gend & masc\\
                 pred & \rm ‘pro’ \]\\

        pred & \rm ‘eat\q<SUBJ, OBJ\q>’\\

                 obj & \[ pers & 3 \\
                 num & pl \\
                 gend & fem \\
                 pred & \rm ‘pro’ \]
        \]
\end{avm}

\end{document}
```

此示例生成以下输出：

![使用 LaTeX 在 Overleaf 上排版的属性值矩阵](/files/919b20761b02819b5f6c570b6cb36d7b046fdddd)

\* 要探索 AVM，请打开此 [Overleaf 项目。](https://www.overleaf.com/project/new/template/26428?id=113292459\&templateName=Example+project+demonstrating+attribute+value+matrices\&latexEngine=pdflatex\&texImage=texlive-full%3A2022.1\&mainFile=)

## 未对齐列

有时，当一行太长时，使用未对齐列来改善输出会更方便：

```latex
\begin{avm}
    \[ \avmspan{system\|local\|content\; \@2} \\
        qstore & \[det & \textnormal{forall} \\
                   restpar & \@2 \[para & \@1 \\
                                   restr & \[reln & \textnormal{book} \\
                                             inst & \@1 \] \] \] \]
\end{avm}
```

此示例生成以下输出：

![使用 LaTeX 在 Overleaf 上排版的属性值矩阵](/files/998ae7c988afaba852392e8447b23ee30415a600)

命令 `\avmspan{}` 会阻止其参数的列对齐，而命令 `\;` 会插入一个略长于普通空白的水平空格，从而形成一个漂亮的分隔符。

\* 要探索 AVM，请打开此 [Overleaf 项目。](https://www.overleaf.com/project/new/template/26428?id=113292459\&templateName=Example+project+demonstrating+attribute+value+matrices\&latexEngine=pdflatex\&texImage=texlive-full%3A2022.1\&mainFile=)

## 排序标签

可以在 AVM 的角上添加排序标签。有两种可能的样式。第一种是在矩阵内部打印标签：

```latex
\avmsortfont{\it}
\avmvalfont{\it}
\begin{avm}
    \[ \asort{indexed-obj}
       index & \[\asort{index}
                  variable & \@1 \[\asort{variable}
                                    per & 3rd \\
                                    num & sing \\
                                    gend & neut \] \\
                  restriction & \[\asort{psoa}
                                  relation & book \\
                                  instance & \@1 \] \] \]
\end{avm}
```

本代码生成以下输出：

![使用 LaTeX 在 Overleaf 上排版的属性值矩阵](/files/877f4031db425eeadc2e9043ff8ac95ca8533b3b)

\* 要探索 AVM，请打开此 [Overleaf 项目。](https://www.overleaf.com/project/new/template/26428?id=113292459\&templateName=Example+project+demonstrating+attribute+value+matrices\&latexEngine=pdflatex\&texImage=texlive-full%3A2022.1\&mainFile=)

本示例中有三个新命令：

* `\avmsortfont{\it}`：为排序键设置字体类型，这里为斜体，但其他 [字体样式和大小也可以使用](/latex/zh-cn/zi-ti/01-font-sizes-families-and-styles.md)
* `\avmvalfont{\it}`：为 AVM 中的值设置字体类型，这里为斜体。
* `\asort{*key*}`：打印排序 `*key*`.

也可以将排序标签叠放到前一列上，如下一个示例所示：

```latex
\avmvalfont{\it}
\avmsortfont{\it}
\begin{avm}
    \sort{indexed-obj}{\[ index & \osort{index}{\[
          variable & \@1 \osort{variable}{\[  per & 3rd \\
                                              num & sing \\
                                              gend & neut \]} \\
          restriction & \osort{psoa}{\[relation & book \\
                                       instance & \@1 \]} \]} \]}
\end{avm}
```

此示例生成以下输出：

![使用 LaTeX 在 Overleaf 上排版的属性值矩阵](/files/187b47819335cf28a65afe8d575457d53876d98e)

\* 要探索 AVM，请打开此 [Overleaf 项目。](https://www.overleaf.com/project/new/template/26428?id=113292459\&templateName=Example+project+demonstrating+attribute+value+matrices\&latexEngine=pdflatex\&texImage=texlive-full%3A2022.1\&mainFile=)

有两个新命令：

* `\sort{*label*}`：打印 `*label*`，并在其出现的列中占用空间。
* `\osort{*label*}`：将 *label* 叠加到前一列上，而不检查碰撞或可用空间。

## 参考指南

可用括号 **avm** 宏包。

| 命令      | 输出                                                                  |
| ------- | ------------------------------------------------------------------- |
| `\{ \}` | ![AVMbraces.png](/files/501ada1e08412924c096d6363bc14ff6ff7b06cf)   |
| `\[ \]` | ![AVMbrackets.png](/files/2a97ae6f5de05ac03abe0179e611cee92bab4773) |
| `\< \>` | ![AVMchevrons.png](/files/d3adc381b713e13cabea7cd7fe27a305d7128215) |

## 进一步阅读

更多信息请参见

* [该 **avm** 包文档](http://nlp.stanford.edu/manning/tex/avm-doc.pdf)
* [该 **avm.sty** 源代码](http://nlp.stanford.edu/manning/tex/avm.sty)
* [字体大小、字体族和样式](/latex/zh-cn/zi-ti/01-font-sizes-families-and-styles.md)
* [字体字形](/latex/zh-cn/zi-ti/02-font-typefaces.md)
* [表格](/latex/zh-cn/tu-biao-he-biao-ge/01-tables.md)
* [括号](/latex/zh-cn/shu-xue/03-brackets-and-parentheses.md)


---

# 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/zh-cn/te-ding-ling-yu/10-attribute-value-matrices.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.
