
wrapfig
は通常、それを囲む特定のテキストと並べてタイプセットする目的で使用されます。ただし、 の近くに多くのフロートを使用するとwrapfig
、テキスト全体または一部が囲まれた図の近くに留まりません。また、図は他の図と整列しません。どうすれば解決できますか?
私のMWE
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{blindtext}
\usepackage[showframe]{geometry}
\usepackage{ragged2e}
\begin{document}
\newcommand{\commonfigwidth}{0.35\linewidth}
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-a}
\caption{My Fig}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-b}
\caption{My Fig}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-c}
\caption{My Fig}
\end{figure}
\begin{wrapfigure}{O}{\commonfigwidth}
\includegraphics[width=\linewidth]{example-image-a}
\centering This is a circuit
\end{wrapfigure}
\blindtext
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-b}
\caption{My Fig}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-c}
\caption{My Fig}
\end{figure}
\end{document}
答え1
答え2
LaTeXは、環境wrapfigure
内に書かれていない限り、フロートとして認識しません。環境内に存在するものはすべて、LaTeXが選択したどのページにも一度に表示される必要があります。したがって、良い回避策はfigure
figure
table
\begin{figure}
\begin{wrapfigure}{<other wrapfig arguments>}
\includegraphics[width=\linewidth]{<image file name>}
\end{wrapfigure}
<the text that should wrap the figure>
\end{figure}
こうすることで、囲まれた図の近くにあるはずの段落は、その周囲の素材にフロートが多数あっても、そこにとどまるように強制されます。また、LaTeX はすべてのフロートをソース コードに出現した順序に配置するため、前述の順序の問題も解決されます。
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{blindtext}
\usepackage[showframe]{geometry}
\usepackage{ragged2e}
\begin{document}
\newcommand{\commonfigwidth}{0.35\linewidth}
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-a}
\caption{My Fig}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-b}
\caption{My Fig}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-c}
\caption{My Fig}
\end{figure}
\begin{figure}
\begin{wrapfigure}{O}{\commonfigwidth}
\includegraphics[width=\linewidth]{example-image-a}
\centering This is a circuit
\end{wrapfigure}
\blindtext
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-b}
\caption{My Fig}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\commonfigwidth]{example-image-c}
\caption{My Fig}
\end{figure}
\end{document}