在自訂浮動中實作本機“@fptop”

在自訂浮動中實作本機“@fptop”

我想要以下政策:

  • 頂部figuretable頁面浮動應位於頁面下方 15%(如果圖形超過文字高度的 85%,則理想情況下能夠移得更高)。
  • 自訂環境 ( smallbox) 應垂直居中

本質上,我想設定@fptop0.15\textheight minus 0.15\textheight例外情況mybox(應應用預設值@fptop)。

我最初的解決方案是設定:

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

然後使用以下環境:

\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}} 

增加一個大的空間(例如\vspace*{\fill}在環境的最後一個參數中。但是,這沒有任何作用(IE將頂部保持smallbox在文字高度的 15% 處)或將其移得太遠(即小框位於頁面頂部)。

微量元素:

\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}

答案1

我發現使用 aminipage似乎在發布後幾個小時內起作用。

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

相關內容