> 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/overleaf-learn-latex-pt/erros-do-latex/22-misplaced-noalign.md).

# \noalign colocado no sítio errado

Este erro aparece quando você usou **`\hline`** incorretamente.

## Causas comuns

**Usando \hline fora de uma tabela:**

O **`\hline`** o comando só pode ser usado dentro de um **`tabular`** ambiente. Você não pode usá-lo para incluir linhas horizontais em outros lugares nos documentos, como em páginas de título ou cabeçalhos de página. Um exemplo desse erro é:

```latex
%No seu preâmbulo
\title{Sobre a Teoria Molecular Geral do Calor}
\author{A. Einstein}

% No corpo do seu documento
\maketitle

\hline
```

Isto irá gerar o erro mostrado abaixo

main.tex, linha 5

Noalign fora de lugar.

\hline ->\noalign {\ifnum 0=\`}\fi \hrule \\@height \arrayrulewidth \futurelet... l.10 \hline Espero ver \noalign apenas após o \cr de um alinhamento. Prossiga, e ignorarei este caso.

Quando quiser incluir linhas horizontais fora de um ambiente tabular, você deve usar **`\hrule`**.

**Usando \hline incorretamente em uma tabela:**

Ao usar **`\hline`** em uma tabela, cada ocorrência, exceto a primeira, deve ser precedida por **`\\`**. Um exemplo desse erro é mostrado abaixo

```latex
\begin{tabular}{|l|l|} \hline
    Primeiro Nome: & Albert \\ \hline
    Segundo Nome: & Einstein \hline
\end{tabular}
```

O primeiro **`\hline`** o comando aqui está correto, pois o primeiro **`\hline`** em uma tabela não precisa ser precedido por **`\\`**. O problema é o nosso último **`\hline`** que realmente precisa ser precedido por **`\\`**. A forma correta de escrever esta tabela é:

```latex
\begin{tabular}{|l|l|} \hline
    Primeiro Nome: & Albert \\ \hline
    Segundo Nome: & Einstein \\ \hline
\end{tabular}
```

![Table.PNG](/files/2b365cb3739da807e12f66261858babda8bb6f33)


---

# 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/overleaf-learn-latex-pt/erros-do-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.
