如何将 tikzpicture 放置在具有包装的定理环境中?我发现了许多有关cutwin
包的决定。但这些决定与自己的定理环境中的包装有关(此外,它们看起来很麻烦)。但如果需要将图片放置在两个具有包装的定理环境之间怎么办?
\documentclass[]{article}
\usepackage{ntheorem}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{wrapfig}
\theoremseparator{-----------}
\newtheorem{theorem}{}
\input{insbox.tex}
\begin{document}
%=========================================================
\begin{theorem}
\lipsum[1]
%--------------- cutwin? wrapfig? anything else ? ------------------
\begin{wrapfigure}{O}{0.5\linewidth}\centering
\begin{tikzpicture}
\draw (0,0) rectangle (5,5);
\end{tikzpicture}
\caption{}
\label{}
\end{wrapfigure}
%---------------------------------------------------------
\end{theorem}
\begin{theorem}
\lipsum[2]
\end{theorem}
\end{document}
答案1
这是一个使用 的解决方案insbox
,但需要进行一些手动调整:
\documentclass[english]{article}
\usepackage{babel}
\usepackage{ntheorem}
\usepackage{caption}
\usepackage{lipsum}
\usepackage{tikz}
\newtheorem{theorem}{}
\input{insbox.tex}
\begin{document}
%=========================================================
\begin{theorem}\leavevmode\vspace{-\baselineskip}\InsertBoxR{6}{\parbox{5.2cm}{\raggedleft\begin{tikzpicture}
\draw (0,0) rectangle (5,5);
\end{tikzpicture}
\captionof{figure}{}\label{mylabel}}}
\lipsum[1]
\end{theorem}
\begin{theorem}\leavevmode\vspace{-\baselineskip}\InsertBoxR{0}{\quad\makebox[5cm]{}}[3]
\lipsum[2]
\end{theorem}
\end{document}
如果这些定理按节编号,则必须更改\parindent
定理内部的值。这可以使用来完成\theoremprework
。另外,请注意,change
定理样式可以更好地定位标签:
\documentclass[english]{article}
\usepackage{babel}
\usepackage{ntheorem}
\usepackage{caption}
\usepackage{lipsum}
\usepackage{tikz}
\theoremstyle{change}
\theoremprework{\parindent=2em}
\newtheorem{theorem}{}[section]
\input{insbox.tex}
\begin{document}
\begin{theorem}\leavevmode\vspace{-\baselineskip}\InsertBoxR{6}{\parbox{5.2cm}{\raggedleft\begin{tikzpicture}
\draw (0,0) rectangle (5,5);
\end{tikzpicture}
\captionof{figure}{}\label{mylabel}}}\lipsum[1]
\end{theorem}
\begin{theorem}\leavevmode\vspace{-\baselineskip}\InsertBoxR{0}{\quad\makebox[5cm]{}}[3]
\lipsum[2]
\end{theorem}
\end{document}