> 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/sononotopikku/50-wrapping-text-around-figures.md).

# 図の周囲にテキストを回り込ませる

時には、テキストの流れを途切れさせないように、フロート（今回の場合は図）の周りにテキストを回り込ませると望ましいことがあります。LaTeX にはこの作業を行うためのパッケージがいくつかありますが、ほとんどの場合、ある程度の手動調整が必要です。

### wrapfig の使用

を使うには *wrapfig*、プリアンブルに次の行を含める必要があります:

```latex
\usepackage{wrapfig}
```

これにより *wrapfigure* 利用できる環境があり、そこに *\includegraphics* コマンドをその中に置いて、テキストが回り込む図を作成できます。次のように指定できます: *wrapfigure* 環境：

```latex
\begin{wrapfigure}[lineheight]{position}{width}
  ...
\end{wrapfigure}
```

その *位置* パラメータには8つの可能な値があります:

|   |   |                            |
| - | - | -------------------------- |
| r | R | テキストの右側                    |
| l | L | テキストの左側                    |
| i | I | 内側の端—製本部に近い（ *twoside* 文書） |
| o | O | 外側の端—製本部から遠い               |

大文字版では図をフロートさせることができます。小文字版は *まさにここ*.

例を示します:

```latex
\begin{wrapfigure}{r}{0.5\textwidth}
  \begin{center}
    \includegraphics[width=0.48\textwidth]{birds}
  \end{center}
  \caption{Birds}
\end{wrapfigure}
```

画像の幅がテキストの幅（*\textwidth*）に対して指定されていたことに注意してください。長さ（高さ、幅など）を定義するには相対サイズを使うのが良い考えです。特に *wrapfigure*.

上の例では、図はテキスト幅のちょうど半分を占め、実際の画像はそれよりわずかに小さい幅になっているため、画像とテキストの間に見栄えのよい小さな白い枠ができます。画像は常に wrap より小さく（幅が狭く）する必要があります。そうしないとテキストにはみ出してしまいます。

追加する際は注意してください *wrapfigures* をページの上端や下端のすぐ近くに置くと、しばしば望ましくない影響を引き起こし、解決が難しい、あるいはほぼ不可能になることがあります。そのため、 *wrapfigures* 数式や節の見出しと併用しようとするのは勧められません。また、以下のようなリスト内でも使用できません。 `itemize` と `enumerate` 環境によって生成される異なる間隔を示します。

&#x20;[Overleafで例を開く](https://www.overleaf.com/project/new/template/19663?id=66518064\&templateName=Example+of+positioning+tables+and+figures\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

### 余白のある画像の扱い

画像に望ましくない余白がある場合、以下のいずれかの方法で余分な空白を取り除くことができます:

* *トリミング* \includegraphics 使用時の余白
* その *picins* パッケージは、 *wrapfigure*の代わりに使用でき、追加の手動調整なしで余分な空白をそのまま取り除いてくれます。
* パッケージ *floatflt* は別の代替手段です。
* を使うのは避けてください *\begin{center}* 画像を中央揃えにするために使うのは避けてください。余分な空白が追加されます。代わりに *\centering* 代わりに
* プログラム *pdfcrop* （ほとんどの TeX インストールに含まれています）は、空白を恒久的に取り除くために使用できます。


---

# 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/sononotopikku/50-wrapping-text-around-figures.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.
