> 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/latex-cuo-wu/22-misplaced-noalign.md).

# 位置错误的 \noalign

当你使用了 **`\hline`** 错误地。

## 常见原因

**在表格外使用 \hline：**

该 **`\hline`** 该命令只能在一个 **`tabular`** 环境中使用。你不能将它用于在文档其他地方插入横线，例如在标题页或页眉中。这个错误的一个例子是：

```latex
%In your preamble
\title{On the General Molecular Theory of Heat}
\author{A. Einstein}

% In the body of your document
\maketitle

\hline
```

这将产生下面所示的错误

main.tex，第 5 行

位置不当的 \noalign。

\hline ->\noalign {\ifnum 0=\`}\fi \hrule \\@height \arrayrulewidth \futurelet... l.10 \hline 我只希望在对齐环境的 \cr 之后看到 \noalign。继续吧，我会忽略这种情况。

当你想在 tabular 环境之外添加横线时，你必须使用 **`\hrule`**.

**在表格中错误地使用 \hline：**

使用时 **`\hline`** 在表格中，除第一处外，每一处前都必须加上 **`\\`**。下面展示了此错误的一个例子

```latex
\begin{tabular}{|l|l|} \hline
    First Name: & Albert \\ \hline
    Second Name: & Einstein \hline
\end{tabular}
```

第一个 **`\hline`** 这里的命令是可以的，因为第一处 **`\hline`** 在表格中不需要在前面加上 **`\\`**。问题出在我们最后一个 **`\hline`** 它确实需要在前面加上 **`\\`**。正确的表格写法是：

```latex
\begin{tabular}{|l|l|} \hline
    First Name: & Albert \\ \hline
    Second Name: & Einstein \\ \hline
\end{tabular}
```

![Table.PNG](/files/604163afdf037bf25c73df722dc9333f0c581c8c)


---

# 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/latex-cuo-wu/22-misplaced-noalign.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.
