> 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/26-missing-number-treated-as-zero.md).

# 数値がありません。0として扱われます

このエラーは、count、dimension、または skip の項目内に数値ではないものを書いたときに表示されます。これを行うと、下のエラーメッセージが生成されます:

main.tex, 5行目

数値がありません。0として扱われます。

l t l.8 \vspace{this should be a number} ここには数値が必要でした。\`0' を挿入しました。（なぜ数値が必要だったのか分からない場合は、『The TeXbook』の索引で \`weird error' を参照してください。）

## 一般的な原因

**数値が必要な場所に数値を入れ忘れること:**

このエラーが発生する最も基本的な原因は、数値が必要なコマンドに数値を入れ忘れることです。例を下に示します。

```latex
ここからここまでの間に縦方向の空白を挿入したい

\vspace{this should be a number}

そしてここです。
```

ここでの **`\vspace{...}`** コマンドは引数として数値を受け取り、テキストの間にどれだけの縦方向の空白を残すかを指定します。数値がないため、エラーが表示されます。これを正しく書くには

```latex
ここからここまでの間に縦方向の空白を挿入したい

\vspace{6em}

そしてここです。
```

![Missingnumbervspace.PNG](/files/ea2603b7c23735437f6017c6c5efb9900a557196)

のようなコマンドはたくさんあります **`\vspace{...}`** これらは引数に数値を必要とします。最も一般的なものは次のとおりです:

* 次のような空白調整コマンド:
  * **`\vspace{...}`**
  * **`\vspace*{...}`**
  * **`\hspace{...}`**
  * **`\hspace*{...}`**
* 次のような拡大縮小コマンド: **`\includegraphics[scale = 0.7]{image}`**。これにより、画像は実際のサイズの **`0.7`** 倍に拡大されます。ここで数値を必要とする他のオプションは次のとおりです:
  * **`幅`**
  * **`高さ`**
  * **`ページ`**
  * **`解像度`**
  * **`トリミング`**
  * **`angle`**.
* その **`\linebreak[number]`** コマンド。引数には、何行読み飛ばすかを指定します。
* 次のようなカウンタ操作コマンド:
  * **`\addtocounter{mycounter}{number}`**
  * **`\setcounter{mycounter}{number}`**
* 次のような長さ設定コマンド: **`\setlenght{\lengthname}{number}`**。これにより、次のような特定の長さの値が変更されます **`\textwidth`** の値に **`number`** （たとえば **`\setlength{\textwidth}{1in}`**).
* 次のような表のオプションコマンド: **`\multicolumn{number}{c}{Table entry}`**.

**改行 \\\ の後に角括弧が続く場合:**

改行コマンド **`\\`** の後に角括弧が続くと **`[...]`**、それは任意引数として解釈され、そのため角括弧内には数値が期待されます。これは、次の間に空白や改行があっても同様です **`\\`** と **`[...]`** コマンドです。この問題は表でよく起こり、下に示すようになります:

```latex
\begin{tabular}{c|c}
    [x] &  2\\
    [x]^2 & 4
\end{tabular}
```

これによりエラーが発生します。というのも、3行目では改行の後に角括弧が続いているからです。LaTeX は角括弧内に数値を期待しますが、実際には **`x`**。上の表を正しく書くには、角括弧を中括弧の中に入れます **`{...}`** 。下に示すとおりです:

```latex
\begin{tabular}{c|c}
    [x] &  2\\
    {[x]}^2 & 4
\end{tabular}
```

**subfigure パッケージを使う場合:**

その **`subfigure`** パッケージはかなり前に廃止されており、エラーがない場合でも「Missing number」エラーを生成します。例を下に示します:

```latex
% プリアンブル内で
\usepackage{subfigure}

% 文書本文内で
\begin{figure}
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[scale=0.2]{image}
        \caption{A gull}
        \label{fig:gull}
    \end{subfigure}%
\end{figure}
```

これはエラーを生成します。というのも、subfigure パッケージは **`\textwidth`** を数値として認識しないからです。実際には数値であり、ページ上の本文全体の固定幅に相当します。これを解決するには、より新しい **`subcaption`** パッケージを使います。これは **`subfigure`**。上と同じコードを **`\usepackage{subcaption}`** をプリアンブルに **`\usepackage{subfigure}`** の代わりに記述すると、エラーなく意図した結果が得られます。


---

# 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/26-missing-number-treated-as-zero.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.
