> 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/ja/latexer/18-latex-error-there-s-no-line-here-to-end.md).

# LaTeXエラー: ここには終了すべき行がありません

次のような改行コマンドを使用すると **`\\`** または **`\newline`** LaTeX がそれを想定していないときに使うと、以下のエラーが発生します:

main.tex, line 12

LaTeX エラー: ここには終了する行がありません..

説明は LaTeX マニュアルまたは LaTeX Companion を参照してください。すぐにヘルプが必要な場合は H と入力してください。... l.8 \\\ あなたのコマンドは無視されました。I と入力すると、別のコマンドに置き換えるか、そのまま続行できます。

## よくある原因

**適切でないときに改行 \\\ を使う場合:**

このエラーの一般的な原因の一つは、次のような改行コマンドを **`\\`** または **`\newline`** 不適切に使用している場合です。LaTeX が段落を組み立てていないときに改行コマンドに遭遇すると、エラーが発生します。この間違いの例を以下に示します:

```latex
\\ 行を誤った場所に入れてしまいました
```

上の例では、改行の前に文字がないまま改行が挿入されています。LaTeX は、存在しない行を改行することはできないため、どう処理すればよいか分からず、エラーを返します。

**リスト環境の後に改行を入れる場合:**

下に示すように、リスト環境の後に改行を置こうとすると、このエラーが表示されることもあります

```latex
\begin{itemize}
    \item これはリスト項目です
    \item これは別のリスト項目です
\end{itemize}\newline
```

LaTeX はこのリストを段落ではなく、個別のオブジェクトのまとまりとして認識するため、改行する行を見つけられません。すべてのリストの下にもっと余白を入れたい場合は、次を再定義するのが最善です: **`itemize`** プリアンブルまたはクラスファイルで、ただし一回限りの場合は、このエラーは次のように書くことで回避できます: **`\leavevmode`** を改行コマンドの前に付けます。以下を参照してください:

```latex
\begin{itemize}
    \item これはリスト項目です
    \item これは別のリスト項目です
\end{itemize}\leavevmode\newline
```

**リスト項目のラベルを単独の行に書こうとする場合:**

このエラーが発生する別のよくある理由は、ラベル付きのリストを次のものを使って書こうとしている場合です。 **`説明`** 環境を使っていて、ラベルを単独の行にしたい場合です。ここでどのように間違えるかの例を以下に示します:

```latex
\begin{description}
\item[これはラベルです] \\
     このテキストを単独の行にしたいです。
\end{description}
```

LaTeX はラベルの項目を次の引数として認識するため、これによりエラーが発生します: **`\item`** コマンドの引数であって、テキストの段落の一部ではないからです。リスト内のラベルを項目とは別の行にしたい場合は、次を再定義する必要があります: **`説明`** 環境。このための最も簡単な方法は、次のものを使うことです。 **`enumitem`** パッケージを使用し、次を含めます: **`\setlist[description]{style=nextline}`** を、以下のようにプリアンブルに記述します:

```latex
% プリアンブル内で

\usepackage{enumitem}
\setlist[description]{style=nextline}

% ドキュメント本文で

\begin{description}
\item[これはラベルです]
     このテキストを単独の行にしたいです。
\end{description}
```

![Enumitem.PNG](/files/0dd0f644c8617af29adc1e2e163104914c3ee9fb)

これにより、すべてのラベルがリスト項目とは別の行に表示され、望みどおりの結果になります。

もし、別の行にするラベルを 1 つだけにしたいのであれば、次のものを使って行えます。 **`\leavevmode`** コマンド。以下を参照してください:

```latex
\begin{description}
\item[これはラベルです] \leavevmode \\
     このテキストは単独の行に表示されます
\item[これは別のラベルです] このテキストはラベルと同じ行に表示されます。
\end{description}
```

![Leavevmode.PNG](/files/adbcc46154977f350e4e1fcfb4904848a97fd9f0)

これは、LaTeX が縦モードで行を飛ばそうとしているときにこのようなエラーに遭遇するためです。 **`\leavevmode`** コマンドによりコンパイラは一時的に縦モードを抜けるため、このエラーは回避されます。

**center、flushleft、または flushright 環境を使用するときに空白を作る場合:**

このエラーが表示される別の原因は、次のように書いて複数の改行を入れようとした場合です。

* **`\\\\`**
* **`\\\\newline`**
* **`\newline\newline`**
* など。

while in the **`center`**, **`flushleft`** または **`flushright`** 環境で次のようにした場合

```latex
\begin{center}
  この行 \\\\ の間に 1 行分の空白を入れたい
  そしてこの行の間に
\end{center}
```

これは LaTeX では許可されておらず、エラーが発生します。ここで複数の改行を含める正しい方法は、次のように書くことです: **`\\[length]`** ここで **`length`** は、行の間に入れたい距離です。例を以下に示します:

```latex
\begin{center}
  この行 \\[2\baselineskip] の間に 1 行分の空白を入れたい
  そしてこの行の間に
\end{center}
```

![Centerskip.PNG](/files/dbfaaf10d6e2c6ec982521121be7ce177ac14296)

ここで、 **`\\[2\baselineskip]`** コマンドは、その位置で LaTeX に 2 行分飛ばすよう指示します。距離として入力できるさまざまな測定オプションは、 **`length`** オプションの一覧に示されています [こちら](/latex/ja/shu-shi-she-ding/01-lengths-in-latex.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/ja/latexer/18-latex-error-there-s-no-line-here-to-end.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.
