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

# Lệnh \noalign đặt sai chỗ

Lỗi này xuất hiện khi bạn đã dùng **`\hline`** không đúng cách.

## Nguyên nhân thường gặp

**Sử dụng \hline bên ngoài một bảng:**

Tính năng **`\hline`** lệnh này chỉ có thể được dùng bên trong một **`tabular`** môi trường. Bạn không thể dùng nó để chèn các đường kẻ ngang ở nơi khác trong tài liệu, chẳng hạn như ở trang bìa hoặc đầu trang. Một ví dụ về lỗi này là:

```latex
%Trong phần tiền đề của bạn
\title{Về thuyết phân tử tổng quát của nhiệt}
\author{A. Einstein}

% Trong phần thân tài liệu của bạn
\maketitle

\hline
```

Điều này sẽ tạo ra lỗi được hiển thị bên dưới

main.tex, dòng 5

Sử dụng \noalign sai vị trí.

\hline ->\noalign {\ifnum 0=\`}\fi \hrule \\@height \arrayrulewidth \futurelet... l.10 \hline Tôi chỉ mong thấy \noalign chỉ sau \cr của một phép căn chỉnh. Tiếp tục đi, và tôi sẽ bỏ qua trường hợp này.

Khi bạn muốn chèn các đường kẻ ngang bên ngoài môi trường tabular, bạn phải dùng **`\hrule`**.

**Sử dụng \hline không đúng trong một bảng:**

Khi sử dụng **`\hline`** trong một bảng, mọi lần xuất hiện trừ lần đầu tiên phải được đặt trước bởi **`\\`**. Một ví dụ về lỗi này được hiển thị bên dưới

```latex
\begin{tabular}{|l|l|} \hline
    Tên: & Albert \\ \hline
    Tên thứ hai: & Einstein \hline
\end{tabular}
```

Dấu **`\hline`** lệnh ở đây thì ổn, vì lần đầu tiên **`\hline`** trong một bảng không cần phải được đặt trước bởi **`\\`**. Vấn đề là lần cuối cùng của chúng ta **`\hline`** mà lại cần được đặt trước bởi **`\\`**. Cách viết đúng cho bảng này là:

```latex
\begin{tabular}{|l|l|} \hline
    Tên: & Albert \\ \hline
    Tên thứ hai: & Einstein \\ \hline
\end{tabular}
```

![Table.PNG](/files/3fba3de1f0fc38525095a2ffbf6a9b328068c8eb)


---

# 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/vi/loi-latex/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.
