1

I have a XeLaTeX document using package multicol, and (in my real world document) I want to temporarily put floats all together on a special page. Unfortunately under some conditions it seems that changing the default floats position does not work, as you can see from this 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}

enter image description here

Thanks in advance for any clue.

2
  • 2
    Figure* does not use \fps@figure. It always uses [tp] in twocolumn. Commented May 16, 2020 at 15:23
  • 2
    without any redefinition you could do \setcounter{dbltopnumber}{0} to disallow top floats Commented May 17, 2020 at 9:29

1 Answer 1

2

Redefines \@dblflt to use [p] instead of [tp]. Note: dblfloatfix uses the same approach to set the default to [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}
2
  • Your solution works fine for the MWE, but for some reason in my real world document I still get figure* floats at the top of a text page. Any clue?
    – mmj
    Commented May 16, 2020 at 23:31
  • @mmj make an example that shows the problem: start from a copy of your document, change the examples to example-image then delete everything you can delete while still showing the problem and post the result Commented May 17, 2020 at 9:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .