我想使用wrapfigure
with enumerate
。但是它不起作用。使用以下代码:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{wrapfig}
\usepackage{blindtext}
\begin{document}
And now let's do a little test
\begin{wrapfigure}{r}{4cm}
\centering
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=0em]
{M &N\\
M/N&\\};
\path[-stealth,>=stealth]
(m-1-1)edge node[left]{$p$} (m-2-1)
edge node[above]{$f$}(m-1-2)
(m-2-1)edge[dashed,->]node[below]{$\bar{f}$}(m-1-2);
\end{tikzpicture}
\end{wrapfigure}
\blindtext[1]
\begin{enumerate}
\item\begin{wrapfigure}{r}{4cm}
\centering
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=0em]
{M &N\\
M/N&\\};
\path[-stealth,>=stealth]
(m-1-1)edge node[left]{$p$} (m-2-1)
edge node[above]{$f$}(m-1-2)
(m-2-1)edge[dashed,->]node[below]{$\bar{f}$}(m-1-2);
\end{tikzpicture}
\end{wrapfigure}
\blindtext[1]
\item\blindtext[1]
\end{enumerate}
\end{document}
我明白了:
现在,使用cutwin
包和以下代码:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{cutwin}
\usepackage{caption}
\usepackage{lipsum}
\begin{document}
\renewcommand\windowpagestuff{%
\hspace*{25pt}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=0em]
{ M &N\\
M/N&\\};
\path[-stealth,>=stealth]
(m-1-1)edge node[left]{$p$} (m-2-1)
edge node[above]{$f$}(m-1-2)
(m-2-1)edge[dashed,->]node[below]{$\bar{f}$}(m-1-2);
\end{tikzpicture}
}
\opencutleft
\begin{cutout}{2}{10pt}{0.5\linewidth}{12}
\begin{enumerate}
{%
\parshape 15 26pt \linewidth 26pt \linewidth 0.5\linewidth 0.5\linewidth
0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth
0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth
0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth
0.5\linewidth 0.5\linewidth 0.5\linewidth 0.5\linewidth 26 pt \linewidth
\item \lipsum[1]
}%
\item \lipsum[2]
\item \lipsum[2]
\end{enumerate}
\end{cutout}
\end{document}
它不起作用。
答案1
cutwin
使用我\parshape
建议的解决方法是否有可能将 wrapfig 与 enumerate 或 itemize 环境一起使用?。您需要使用ampersand replacement
矩阵并对\parshape
设置进行一些调整:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{cutwin}
\usepackage{caption}
\usepackage{lipsum}
\begin{document}
\renewcommand\windowpagestuff{%
\hspace*{25pt}%
\begin{tikzpicture}[ampersand replacement=\&]
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=0em]
{ M \&N \\
M/N \& \\};
\path[-stealth,>=stealth]
(m-1-1)edge node[left]{$p$} (m-2-1)
edge node[above]{$f$}(m-1-2)
(m-2-1)edge[dashed,->]node[below]{$\bar{f}$}(m-1-2);
\end{tikzpicture}%
}
\opencutleft
\begin{cutout}{2}{0pt}{0.6\linewidth}{8}
\begin{enumerate}
{%
\parshape 11 26pt \linewidth 26pt \linewidth 0.4\linewidth 0.6\linewidth
0.4\linewidth 0.6\linewidth 0.4\linewidth 0.6\linewidth
0.4\linewidth 0.6\linewidth 0.4\linewidth 0.6\linewidth 0.4\linewidth 0.6\linewidth
0.4\linewidth 0.6\linewidth 0.4\linewidth 0.6\linewidth 26 pt \linewidth
\item \lipsum[1]
}%
\item \lipsum[2]
\item \lipsum[2]
\end{enumerate}
\end{cutout}
\end{document}