> 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/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`本文中基于该宏包的示例将无法与 `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}
```

此示例生成以下输出：

![在 Overleaf 中使用 LaTeX 排版的属性值矩阵](/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}
```

此示例生成如下输出：

![在 Overleaf 中使用 LaTeX 排版的属性值矩阵](/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}
```

此示例生成如下输出：

![在 Overleaf 中使用 LaTeX 排版的属性值矩阵](/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}
```

这段代码生成以下输出：

![在 Overleaf 中使用 LaTeX 排版的属性值矩阵](/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}
```

此示例生成如下输出：

![在 Overleaf 中使用 LaTeX 排版的属性值矩阵](/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-xing-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://ayakaleaf-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.
