我有一个使用包的 XeLaTeX 文档multicol
,并且(在我的真实文档中)我想暂时将所有浮点放在一个特殊页面上。不幸的是,在某些情况下,更改默认浮点位置似乎不起作用,正如您从此 MWE 中看到的那样:
\documentclass{book}
\usepackage{mwe}
\usepackage{xcolor}
\usepackage{multicol}
\newcommand{\myfigure}[2]{%
\begin{figure*}%
\centering
\includegraphics[width=#2\textwidth]{#1}
\end{figure*}}
\begin{document}
\pagecolor{yellow!10}
\makeatletter
\def\fps@figure{p}% this sets the default floats position
%\renewcommand*{\fps@figure}{p}
\makeatother
\begin{multicols}{2}
\blindtext
\myfigure{example-image-10x16}{0.4}
\blindtext\blindtext\blindtext\blindtext\blindtext
\myfigure{example-image-16x10}{0.8}
\blindtext\blindtext\blindtext\blindtext\blindtext
\myfigure{example-image-10x16}{0.4}
\blindtext\blindtext\blindtext\blindtext\blindtext\blindtext
\myfigure{example-image-16x10}{0.8}
\blindtext
\end{multicols}
\end{document}
提前感谢任何线索。
答案1
重新定义\@dblflt
为使用 [p] 而不是 [tp]。注意:dblfloatfix 使用相同方法将默认值设置为 [tbp]。
\documentclass{book}
\usepackage{mwe}
\usepackage{xcolor}
\usepackage{multicol}
\newcommand{\myfigure}[2]{%
\begin{figure*}%
\centering
\includegraphics[width=#2\textwidth]{#1}
\end{figure*}}
\begin{document}
\pagecolor{yellow!10}
\makeatletter
\def\fps@figure{p}% this sets the default figure position
\def\@dbflt#1{\@ifnextchar[{\@xdblfloat{#1}}{\@xdblfloat{#1}[p]}}% set default for figure*
%\renewcommand*{\fps@figure}{p}
\makeatother
\begin{multicols}{2}
\blindtext
\myfigure{example-image-10x16}{0.4}
\blindtext\blindtext\blindtext\blindtext\blindtext
\myfigure{example-image-16x10}{0.8}
\blindtext\blindtext\blindtext\blindtext\blindtext
\myfigure{example-image-10x16}{0.4}
\blindtext\blindtext\blindtext\blindtext\blindtext\blindtext
\myfigure{example-image-16x10}{0.8}
\blindtext
\end{multicols}
\end{document}