
wrapfig
通常用於將其與應包裹它的特定文字並排排版。但是,當我在 close 附近使用大量浮動時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
浮點數,除非它是在figure
環境中編寫的。內部figure
或環境中存在的所有內容table
必須立即顯示在 LaTeX 選擇的任何頁面上。因此,一個好的解決方法是
\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}