LaTeX でwrapfig環境がうまくいかない原因と解決方法の一例

自分用の備忘録です。
↓ ↓ ↓ Wrapfig環境に関しては以前書いたので気になる方はこちら
https://note.com/asuka_3114/n/n03728fb8ad87

起きている問題


wrapfig 環境で写真の周りに文章を回りこませることはできた。しかし、list環境やenumerate環境中の文字を回りこませると不具合が起きる。具体的にいうと、文章は回りこまずwrapfig 環境内に挿入した写真の下に空白ができてしまう不具合が生じた。

原因

そもそもWrapfigure環境とlist (or enumerate, itemize) 環境は同時に使用できない。

wrapfig/floatflt + enumerate, itemize = not working. the packages are incompatible with one another. For a "wrapfigure" effect with an environment, i.e., enumerate, itemize, etc etc.,

引用先
https://stackoverflow.com/questions/1280672/latex-floating-and-text-wrapped-image

解決方法

結論は以下の通り、以下引用

You should put the environment in a minipage and the graphic in in a minipage, then set the two minipages next to each other. something to the effect of (i put them in a tabular environment as well):

この記述及び引用サイトをもとにプログラムを書くと以下のようになった。

\begin{tabular}{l l}
   \begin{minipage}{0.5\textwidth}
       \begin{enumerate}
           \item hoge
           \item hogehoge
       \end{enumerate}
   \end{minipage}
  & 
   \begin{minipage}{0.6\textwidth}
       \centering
       \includegraphics[height=50mm]{image/(画像.jpg)}
   \end{minipage}
\end{tabular}

引用先
https://stackoverflow.com/questions/1280672/latex-floating-and-text-wrapped-image

1. minipage 環境を用いてenumerate 環境と写真をグループ化させる
2. tabular 環境を用いてグループ化したenumerate 環境と写真を横に並べる

他にも解決方法はあったが今回自分の力で理解して使いこなせるものはこれだけだった。今後色々試していきたい。


この記事が気に入ったらサポートをしてみませんか?