小页面智能管理

小页面智能管理

是否可以让 LaTeXminipage以类似于 LaTeX 管理要放置的图形和表格的方式管理位置?这个问题来自我的上一个问题

我可以移动minipages手册以充分利用空间,但随着数量的minipages增加,这会变得很麻烦。如果可能的话,使用 LaTeX 来处理这项任务会很方便。

这能做到吗?


笔记:

我希望管理像float环境一样,而不是浮动。正如我在链接的帖子中所说,我想将minipages那个屁股放在三列上。我不想浪费空白(就像浮动会造成的一样)。我确实希望minipages能够重新排列自己最好的无需我进入并将它们放置在文档的更高或更低位置即可使用页面。

答案1

这会将每个框放在其适合的第一列的末尾:

在此处输入图片描述

\documentclass{article}
\usepackage[margin = 0.1in]{geometry}
\usepackage{multicol}
\setlength\columnsep{0pt}
\setlength\parskip{0pt}
\setlength\parindent{0pt}
\setlength\lineskip{0pt}
\raggedcolumns
\newcount\myboxes

\newenvironment{mbxs}{\par}{%
\myboxes=10000
\noindent
\loop
\box\myboxes\penalty0\hskip0pt plus .7\textwidth
\advance\myboxes 1
\ifvoid\myboxes
\else
\repeat
\par}

%\tracingall

\newcommand\mbx[1]{%
\setbox0\hbox{\fbox{%
  \parbox{\dimexpr.3333333\linewidth-2\fboxsep-2\fboxrule\relax}{#1}}}%
\myboxes=10000
\loop
\ifdim\dimexpr\ht\myboxes+\dp\myboxes+\ht0+\dp0\relax>.95\textheight
\advance\myboxes1
\repeat
\ifvoid\myboxes
\setbox\myboxes\vtop{\kern0pt}%
\fi
\setbox\myboxes\vtop{\unvbox\myboxes\nointerlineskip\box0}%
}

\begin{document}

\begin{mbxs}
\mbx{www\\one\\two}
\mbx{\begin{itemize}\item aaaa \item bbbb \item ccc\end{itemize}}
\mbx{\def\a{One two three four. }\a xx \a\a yy yy yy \a\a\a\a}
\mbx{zzzzz\[\frac{1}{2}^{3}\]}
\mbx{zzz\\one $1=1$ and two $x^2=2$ and three $y_3=3^3$.}
\mbx{one\\two\\three $x_{x_x}$}
\mbx{\begin{itemize}\item aaaa \item bbbb \item ccc\item ddd\end{itemize}}
\mbx{\def\a{One two three four five six. }\a xx \a\a yy yy yy \a\a\a\a}
\mbx{cc\\zzzzz\[\frac{1}{2}^{3}\]zzzzz\[\frac{1111}{22222}^{3}\]}
\mbx{ONE $1=1$ AND TWO $X^2=2$ AND THREE $Y_3=3^3$.}
\mbx{one one\\four eight  $1=1$ and two $x^2=2$ and three $y_3=3^3$.}
\mbx{one\\two}
\mbx{\begin{itemize}\item aaaa \item bbbb \item ccc\end{itemize}}
\mbx{aa \def\a{One two three four. }\a xx \a\a yy yy yy \a\a\a\a}
\mbx{bb\\zzzzz\[\frac{1}{2}^{3}\]}
\mbx{one one four eight  $1=1$ and two $x^2=2$ and three $y_3=3^3$.}
\mbx{\begin{itemize}\item aaaa \item bbbb \item ccc\item ddd\end{itemize}}
\mbx{\def\a{One two three four five six. }\a xx \a\a yy yy yy \a\a\a\a}
\mbx{one\\two\\three $x_{x_x}$}
\mbx{\begin{itemize}\item aaaa \item bbbb \item ccc\item ddd\end{itemize}}
\mbx{\def\a{One two three four five six. }\a xx \a\a yy yy yy \a\a\a\a}
\mbx{\begin{itemize}\item aa\\aa \item bbbb \item ccc\item ddd\end{itemize}}
\mbx{zzzzz\[\frac{1}{2}^{3}\]zzzzz\[\frac{1111}{22222}^{3}\]}
\mbx{ONE TWO THREE  $1=1$ AND TWO $X^2=2$ AND THREE $Y_3=3^3$.}
\mbx{www\\one\\two}
\mbx{\begin{itemize}\item aaaa \item bbbb \item ccc\end{itemize}}
\mbx{\def\a{One two three four. }\a xx \a\a yy yy yy \a\a\a\a}
\mbx{zzzzz\[\frac{1}{2}^{3}\]}
\mbx{zzz\\one $1=1$ and two $x^2=2$ and three $y_3=3^3$.}
\mbx{one\\two\\three $x_{x_x}$}
\mbx{\begin{itemize}\item aaaa \item bbbb \item ccc\item ddd\end{itemize}}
\mbx{\def\a{One two three four five six. }\a xx \a\a yy yy yy \a\a\a\a}
\mbx{\begin{itemize}\item aaaa \item bbbb \item ccc\end{itemize}}
\mbx{cc\\zzzzz\[\frac{1}{2}^{3}\]zzzzz\[\frac{1111}{22222}^{3}\]}
\mbx{\begin{itemize}\item aaaa \item bbbb \item ccc\item ddd\end{itemize}}
\mbx{\def\a{One two three four five six. }\a xx \a\a yy yy yy \a\a\a\a}
\mbx{ONE $1=1$ AND TWO $X^2=2$ AND THREE $Y_3=3^3$.}
\mbx{one\\two}
\mbx{one\\two\\three $x_{x_x}$}
\mbx{aa \def\a{One two three four. }\a xx \a\a yy yy yy \a\a\a\a}
\mbx{bb\\zzzzz\[\frac{1}{2}^{3}\]}
\mbx{one one four eight  $1=1$ and two $x^2=2$ and three $y_3=3^3$.}
\mbx{zzzzz\[\frac{1}{2}^{3}\]zzzzz\[\frac{1111}{22222}^{3}\]}
\mbx{ONE TWO THREE  $1=1$ AND TWO $X^2=2$ AND THREE $Y_3=3^3$.}
\mbx{ONE TWO THREE  $1=1$ AND TWO $X^2=2$ AND THREE $Y_3=3^3$.}
\mbx{ONE TWO THREE  $1=1$ AND TWO $X^2=2$ AND THREE $Y_3=3^3$.}
\mbx{ONE TWO THREE  $1=1$ AND TWO $X^2=2$ AND THREE $Y_3=3^3$.}

\end{mbxs}
\end{document}

相关内容