尽管我使用 [h] 命令指定图像必须放置在“文本之中”,但在运行时,图像却放置在部分的末尾,如何正确设置?
乳胶:
\subsection{item1 Vs item2}
in this comparison......
......
......
......
\begin{figure}[h]
\centering
\includegraphics[width=100mm,scale=0.7]{osm_vs_wikipedia_2}
\caption{caption}
\end{figure}
the rest of the text goes here..
...
答案1
上述链接中没有提到:一个普通的 TeX 宏包,,insbox.tex
它定义了一个\InsertBoxC
命令。此命令将在段落内使用,让当前行终止,然后插入其参数,然后继续段落的文本。
演示:
\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{xcolor}
\usepackage{cleveref, todonotes}
\input{insbox}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius dapibus metus eget ultrices. Nulla sagittis mauris rutrum, blandit augue eget, laoreet augue. Phasellus enim odio, sagittis in mi sed, fringilla mollis odio. Phasellus quis purus ultricies, tempor purus at, tempus quam. Donec ultricies, ligula ac pretium porttitor, nibh nunc \todo[color=white, linecolor=red]{\color{red}Insertion point}%
%%%
\InsertBoxC{\begin{minipage}{\linewidth}\centering\bigskip\includegraphics[scale=0.75]{AliceSteadman.png}\\ \captionof{figure}{Any description}\label{WhiteRabbit}\end{minipage}}%
%%%
Integer eros nibh, cursus at est sed, volutpat tristique justo. Donec ornare facilisis lorem, id feugiat elit pellentesque at. Nulla odio mauris, luctus sed faucibus id, dignissim dictum velit. Morbi vehicula velit at massa tristique rhoncus. Cf. \color{red}{\cref{WhiteRabbit}}.
\end{document}