插入图像

插入图像

在此处输入图片描述

我想将文档格式化为图像位于文本右侧,文本应换行到图像右侧。你能帮我做到这一点吗?顺便说一下,我正在使用enumitem包。

答案1

\documentclass{article}
\usepackage{graphicx}
\usepackage{enumitem}

\begin{document}


\begin{enumerate}
\item text text text text text text text text text text text text text text text text text text text text text 

\parbox[b]{.7\textwidth}{%
    \item text text text text text text text text text text text text text text text text text text text text text 

    \item text text text text text text text text text text text text text text text text text text text text text 
}\hfill\includegraphics[width=.2\textwidth]{example-image}

\item text text text text text text text text text text text text text text text text text text text text text 
\end{enumerate}

\end{document}

在此处输入图片描述

答案2

使用 enumtiem 的seriesresume便捷的方式minipages您就可以解决问题。

\documentclass{article}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\begin{enumerate}[series=myproblems]
\item \lipsum[2]
\item \lipsum[3]
\end{enumerate}
\begin{minipage}{.6\textwidth}
\begin{enumerate}[resume=myproblems]
\item This is a nice problem that you can solve with \texttt{resume} option of \texttt{enumitem} package. Include your text into a \texttt{minipage} 
\item And the figure into another \texttt{minipage}
\item \dots
\item \dots
\end{enumerate}
\end{minipage}\hfill
\begin{minipage}{.3\textwidth}\centering
\includegraphics[width=\textwidth]{example-image}
\end{minipage}
\begin{enumerate}[resume=myproblems]
\item Some more problems
\item \lipsum[2]
\end{enumerate}
\end{document}

在此处输入图片描述

相关内容