Wrapfig 似乎无法使文本环绕在我的图形周围

Wrapfig 似乎无法使文本环绕在我的图形周围

wrapfig 不会换行。我已经花了大约 3 小时寻找答案,尝试了各种方法,包括更改空格量、复制粘贴应该有效的代码等,但都不起作用。我得到的只是文本中某处的一个图形,有时甚至不是按照应有的顺序出现的。

以下是重要的代码:

\documentclass[11pt,a4paper]{article}  
% all packages:
\usepackage{blindtext}
\usepackage{wrapfig}
\usepackage{graphicx}
\graphicspath{ {images} }
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{ragged2e}
\usepackage[dvipsnames]{xcolor}

\begin{document}

% bunch of stuf that works as it should

\newpage

\section*{Data Analysis}

\subsection*{Raw data}

\begin{wrapfigure}{l}{0.4\textwidth} % my original wrapfig (it's not where it should be, I put it here because I read that maybe \blindtext and \lipsum messed with wrapfg so I put it above some of my own text.)

    \center

    \includegraphics[width=0.4\textwidth]{1Ttr}

\end{wrapfigure}

\indent

Due to the high amount of data collected, I will not be presenting each data point as a set of numbers, but only their graphs versus time. To see the .odt with all raw data, follow the link in the footnote.\footnote{[Insert link]}    

\subsubsection*{Run 1}

\begin{wrapfigure}{r}{0.5\linewidth} %some random code I copied from a different thread
\centering
\rule{0.9\linewidth}{0.75\linewidth}
\caption{Dummy figure.}
\label{fig:myfig}
\end{wrapfigure}
\blindtext

\end{document}

这是我得到的:(出现了数字,但一个不在它应该出现的位置,而且两个数字都没有换行) 图形出现了,但其中一个不在应在的位置,而且两个图形都没有换行

有什么办法可以让它工作吗?任何帮助都将不胜感激,我真的不想明天再熬到凌晨 2 点。

编辑:这是用占位符替换文本的文档。@john-kormylo 的解决方案本身有效,但不适用于整个文档。

\documentclass[11pt,a4paper]{article}
\usepackage{gobble}
\usepackage{blindtext}
\usepackage{wrapfig}
\usepackage{graphicx}
\graphicspath{ {images} }
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{ragged2e}
\usepackage[dvipsnames]{xcolor}

\author{personal info}
\title{\Huge\textbf {Topic of research}}
\date{}           
    
\begin{document}  
    
\maketitle         
\newpage
                                     
    
\section*{Introduction}
    
\indent           
\blindtext
                  
\section*{Research Question}
                  
\center
                  
\large\textit{\textbf{Topic of research}}
                 
\justify
                                 
    
\section*{Experiment}                   

\subsection*{Variables}
                                                                                                                                                                                             
\begin{itemize}

    \item item

    \item item

    \item item

\end{itemize}
                                                                                                                                                                                             
\subsection*{Apparatus}

\textcolor{red}{PUT BLENDER RENDER HERE}% this works when I tried with a filler image

\newpage
    
\subsection*{Method}
    
\begin{enumerate}

    \item item

    \item item

    \item item

    \begin{itemize}
        \item \small{change procedure if...}
    \end{itemize}

    \item item

    \item item

    \item item

\end{enumerate}

\subsection*{Personal Protection}

\begin{itemize}

    \item item

    \item item

    \item item

    \item item
        
\end{itemize}

\subsection*{Data collection}

\indent % repeated to match original
How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used 

\newpage

\section*{Data Analysis}

\subsection*{Raw data}\leavevmode\par% gobble \@afterheading

\indent
Due to the high amount of data collected, I will not be presenting each data point as a set of numbers, but only their graphs versus time. To see the .odt with all raw data, follow the link in the footnote.\footnote{[Insert link]}    

\subsubsection*{Run 1}

\begin{wrapfigure}[8]{l}{0.4\textwidth}
    
    \vspace{-30pt}

    \center

    \includegraphics[width=0.4\textwidth]{1Ttr}

\end{wrapfigure}

\blindtext

\end{document}

最后一点的图像:仍然没有 wrapfig

答案1

假设你想要重叠两个换行图。请注意,\subsection占用的空间比 1 行文本要多,因此您需要指定要换行的行数(可选参数)。

\documentclass[11pt,a4paper]{article}  
% all packages:
\usepackage{blindtext}
\usepackage{wrapfig}
\usepackage{graphicx}
\graphicspath{ {images} }
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{ragged2e}
\usepackage[dvipsnames]{xcolor}

\begin{document}

% bunch of stuf that works as it should

\newpage

\section*{Data Analysis}

\subsection*{Raw data}\leavevmode\par% gobble \@afterheading

\begin{wrapfigure}[11]{l}{0.4\textwidth} % my original wrapfig (it's not where it should be, I put it here because I read that maybe \blindtext and \lipsum messed with wrapfg so I put it above some of my own text.)
    \centering
    \includegraphics[width=0.4\textwidth]{example-image-a}
\end{wrapfigure}

\indent
Due to the high amount of data collected, I will not be presenting each data point as a set of numbers, but only their graphs versus time. To see the .odt with all raw data, follow the link in the footnote.\footnote{[Insert link]}    

\subsubsection*{Run 1}

\blindtext

\begin{wrapfigure}{r}{0.5\linewidth} %some random code I copied from a different thread
\centering
\rule{0.9\linewidth}{0.75\linewidth}
\caption{Dummy figure.}
\label{fig:myfig}
\end{wrapfigure}

\blindtext
\end{document}

完整页面


此版本使用 paracol。请注意使用\nopar来手动分段落。

\documentclass[11pt,a4paper]{article}
\usepackage{gobble}
\usepackage{blindtext}
\usepackage{paracol}
\usepackage{graphicx}
\graphicspath{ {images} }
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{ragged2e}
\usepackage[dvipsnames]{xcolor}

\newcommand{\nopar}{{\parfillskip=0pt\parskip=0pt\par}}% manual break

\author{personal info}
\title{\Huge\textbf {Topic of research}}
\date{}           
    
\begin{document}  

\section*{Data Analysis}

\subsection*{Raw data}

\indent
Due to the high amount of data collected, I will not be presenting each data point as a set of numbers, but only their graphs versus time. To see the .odt with all raw data, follow the link in the footnote.\footnote{[Insert link]}    

\subsubsection*{Run 1}

\setcolumnwidth{0.4\textwidth}
\footnotelayout{m}
\begin{paracol}{2}
\intextsep=0pt% spacing for wrapfigure and figure[h]
\begin{figure}[ht]
    \centering
    \includegraphics[width=\linewidth]{example-image}
\end{figure}
\switchcolumn
%\sloppy% SOP for narrow columns
%\vskip-4pt
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Etiam lobortis facilisis sem. Nullam nec mi et neque phare-
tra sollicitudin. Praesent imperdiet mi nec ante. Donec
ullamcorper, felis non sodales commodo, lectus velit ultri-
ces augue, a dignissim nibh lectus placerat pede. Vivamus
nunc nunc, molestie ut, ultricies vel, semper in, velit. Ut
porttitor. Praesent in sapien. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Duis fringilla tristique neque.
Sed interdum libero ut metus. Pellentesque placerat. Nam
rutrum augue a leo. Morbi sed elit sit amet ante lobor-
tis sollicitudin. Praesent blandit blandit mauris. Praesent\nopar
\end{paracol}
\noindent
lectus tellus, aliquet aliquam, luctus a, egestas a, turpis.
Mauris lacinia lorem sit amet ipsum. Nunc quis urna dictum turpis accumsan semper.

\end{document}

相关内容