1

I would like the following policy:

  • The top of figure and table page-floats should be 15% down the page (and ideally able to move higher if the figure is more than 85% of text height).
  • A custom environment (smallbox) should be vertically centred

Essentially, I want to set @fptop to 0.15\textheight minus 0.15\textheight except for the mybox case (where the default @fptop should apply).

My initial solution was to set:

\setlength{\@fptop}{0.15\textheight minus 0.15\textheight}
\setlength{\@fpbot}{0pt plus 1fil}

and then with the following environment:

\usepackage{newfloat}  %% 
\DeclareFloatingEnvironment[listname={List of boxes}, name = {Box}]{boxe}
% The smallbox is a box intended for onecolumn.
\newenvironment{smallbox}[3][p]{%
  \begin{boxe}[#1]
  }{\end{boxe}} 

adding a large space (such as \vspace*{\fill} in the last argument of the environment. However, this does nothing (i.e. keeps the top of the smallbox at 15% of textheight) or moves it too far (i.e. the smallbox is at the top of the page).

MWE:

\documentclass[12pt,twocolumn]{article}  %% twocolumn makes fptop more obvious
\makeatletter
\setlength{\@fptop}{0.15\textheight minus 0.15\textheight}
\setlength{\@fpbot}{0pt plus 1fil}
\makeatother
\usepackage{newfloat}
\DeclareFloatingEnvironment[listname={List of boxes}, name = {Box}]{boxe}
\newenvironment{smallbox}[1][p]{%
\begin{boxe}[#1]
}{\end{boxe}} 

\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\begin{document}
.

\begin{figure}[p]
\caption{foo}
\includegraphics{}
\end{figure}
\clearpage
.

\begin{smallbox}
\lipsum[1]
\end{smallbox}


\end{document}
  • In other words, you would like to set \@fptop an a per-float-type basis, wouldn’t you? I’m afraid this is impossible, unless you change LaTeX’s output routine. Also note that floats are not unboxed when thet are delivered to their destination. – GuM Jun 11 '16 at 2:39
  • But, on the other hand, the very concept of a “local \@fptop” is meaningless: indeed, floats of more than one type can quite well end up on the same page; what would you want to do in that case? – GuM Jun 11 '16 at 2:48
  • I agree the concept is meaningless -- I was just expressing it like that as a (poor) description. I am happy for a solution which makes a page with a smallbox unable to hold any other floats on the page. – Hugh Jun 11 '16 at 3:08
  • Then, you have already posted the solution (which I’m going to upvote! :-) – GuM Jun 11 '16 at 6:30
1

I discovered that using a minipage appears to work a few hours after posting.

\newenvironment{smallbox}[1][p]{%
\begin{boxe}[#1]
\begin{minipage}[c][\textheight]{\linewidth}
}{\end{minipage}\end{boxe}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.