我有这样的身材
\begin{figure}[h]
\centering
\includegraphics[width=1\columnwidth]{figure1.jpeg}
\caption{text caption here}
\label{fig1}
\end{figure}
在此之前有一段文字,但有时它会截断段落的文字并保留图形,之后是其余的文字。如何才能在整个文本中使文本不被截断,如所述情况?
答案1
展示比解释更容易。 \@captype
被使用\caption
。 \intextsep
与图 [h] 使用的间隙相同。
\documentclass{article}
\usepackage{graphicx}
\makeatletter
\newenvironment{myfigure}{\begin{trivlist}\vskip\intextsep
\item\begin{minipage}{\columnwidth}\def\@captype{figure}}%
{\end{minipage}\vspace\intextsep\end{trivlist}}
\makeatother
\begin{document}
Here is a paragrpahh with a figure in the middle of it
\begin{myfigure}
\centering
\includegraphics{example-image}
\caption{Text caption here}
\label{fig1}
\end{myfigure}
which is treated like an equation in that the sentence is broken and continues normally.
\end{document}