> 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/geng-duo-zhu-ti/09-commands-and-environments.md).

# 命令和环境

## 命令

LaTeX 文档的行为可以通过使用特定命令来控制。典型的命令结构如下：

```
\commandname[可选参数]{主参数}
```

注意，所有命令 **必须** 前面都应加反斜杠，并且主参数必须包含在 {..} 对中。

有些命令有不止一个参数，例如：

```
\multicolumn{合并的列数}{对齐方式}{内容}
```

有些命令不需要 {} 对也能正常工作，例如：

```
\item 文本作为条目内容
```

有些命令带有可选参数，例如：

```
\item[--] 文本作为条目内容
\\[2ex]
```

## 环境

一种特殊的命令类型是环境。典型的环境结构如下：

```
\begin{environmentname}
 内容
\end{environmentname}
```

例如：

```latex
\begin{center}
示例文本
\end{center}
```

或

```latex
\begin{enumerate}
\item 第一项
\item 第二项
\end{enumerate}
```

注意，所有环境 **必须** 都以 \begin{environmentname} 开始，并以 \end{environmentname} 结束。

有些环境像命令一样也带有参数和可选参数。例如

```latex
\begin{tabular}[表格位置]{列格式}
 表格内容
\end{tabular}
```


---

# 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/geng-duo-zhu-ti/09-commands-and-environments.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.
