> 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-tw/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}
```

本範例產生以下輸出：

![使用 LaTeX 在 Overleaf 上排版的屬性值矩陣](/files/cf97b262b725a847c28e02cf166903ff47e25a19)

\* 若要探索 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-tw/zi-xing/01-font-sizes-families-and-styles.md) 都可以。字型大小與 [字型樣式](/latex/zh-tw/zi-xing/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/07d3f8e71f6b60c77106ce99fcc3a97289171e98)

\* 若要探索 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/eda2d9d148f321e851e52f35049a7a6b0a5e6e87)

命令 `\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/7ddd851ce7f5e5983642f106de99cc03260fba05)

\* 若要探索 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-tw/zi-xing/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/41b528cd21b9bf5d7b9b98c9db13ea423f78b520)

\* 若要探索 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/71e419179d79cfa105c84ae35703ba9872b0b57a)   |
| `\[ \]`  | ![AVMbrackets.png](/files/d36737187e95ec2f2660c2b94ca070b53fef005d) |
| `\< \>`  | ![AVMchevrons.png](/files/209be9f82ef6e7f06101092e910c91d69f560faf) |

## 延伸閱讀

更多資訊請參見

* [該 **avm** 套件說明文件](http://nlp.stanford.edu/manning/tex/avm-doc.pdf)
* [該 **avm.sty** 原始碼](http://nlp.stanford.edu/manning/tex/avm.sty)
* [字型大小、字族與樣式](/latex/zh-tw/zi-xing/01-font-sizes-families-and-styles.md)
* [字型字體](/latex/zh-tw/zi-xing/02-font-typefaces.md)
* [表格](/latex/zh-tw/tu-biao-yu-biao-ge/01-tables.md)
* [中括號與小括號](/latex/zh-tw/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-tw/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.
