我希望有一个布局,比如说,有一个“信息框”(因为没有更好的措辞)。我的文档的主要布局使用三列布局。我打算放置一个colorbox
(两列宽),这样三列会自动环绕colorbox
。colorbox
不应该遵循三列布局。我会考虑一个例子,但我怀疑这个解决方案将适用于人们能想到的任何颜色框的放置。我在这里考虑的例子是对齐colorbox
到右上方。
为了尝试得出这个结果,我将问题分成了两部分。
第一个问题是重现第二列和第三列的预期垂直对齐。我做到了这一点(请记住,此示例仅从视觉上解释了我的想法 - 不包括colorbox
):
\documentclass[demo]{article}
\usepackage[a4paper,margin=20mm]{geometry}
\usepackage[demo]{graphicx}
\usepackage{xcolor}
\usepackage{multicol}
\usepackage{wrapfig}
\usepackage{kantlipsum}
\begin{document}
\begin{multicols*}{3}
\kant[5]
More text, to show that the entire column is filled from top to bottom. More text, to show that the entire column is filled from top to bottom. More text, to show that the entire column is filled from top to bottom. More text, to show that the entire column is filled from top to bottom. More text, to show that the entire column is filled from top to bottom. More text, to show that the entire column is filled from top to bottom. More text, to show that the entire column is filled from top to bottom. More text, to show that the entire column is filled from top to bottom.
\columnbreak
{
\hangindent=\columnwidth
\begin{wrapfigure}{r}{2\columnwidth}
\colorbox{gray}{%
\begin{minipage}{\dimexpr2\columnwidth}
\kant[1]
\end{minipage}%
}
\end{wrapfigure}
}
\phantom{.}
\vskip .8\textheight
As any dedicated reader can clearly see, the Ideal of practical reason is a representation of, as far as I know, the things in themselves; as I have shown elsewhere, the phenomena should only be used as a canon for our understanding. The paralogisms of practical reason are what first give rise to the architectonic of practical reason. As will
\columnbreak
aasfsafaaaaaaaaaaaaaa aaaaaaaaaaaaa afwafawfaw
\vskip .8\textheight
\noindent easily be shown in the next section, reason would thereby be made to contradict, in view of these considerations, the Ideal of practical reason, yet the manifold depends on the phenomena. Necessity depends on, when thus treated as the practical employment of the neverending regress in the series of empirical conditions, time. Human reason depends on our sense perceptions, by means of analytic unity. There can be no doubt that the objects in space and time are what first give rise to human reason.
\end{multicols*}
\end{document}
在第二步中,将 放置colorbox
在现在生成的空白内时,我遇到了问题。除了这些问题之外,如果想要保持布局一致,在这种情况下手动调整框并不是很理想。当然,存在一个优雅的解决方案来产生类似这样的效果:
这colorbox
是通过以下代码生成的:
\documentclass[demo]{article}
\usepackage[a4paper,margin=20mm]{geometry}
\usepackage[demo]{graphicx}
\usepackage{xcolor}
\usepackage{multicol}
\usepackage{wrapfig}
\usepackage{kantlipsum}
\begin{document}
\begin{multicols*}{3}
\columnbreak
{
\hangindent=\columnwidth
\begin{wrapfigure}{r}{2\columnwidth}
\colorbox{gray}{%
\begin{minipage}{\dimexpr2\columnwidth}
\kant[2-4]
This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer.
\end{minipage}%
}
\end{wrapfigure}
}
\end{multicols*}
\end{document}
编辑:感谢@Bernard,我已经非常接近预期的效果
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{xcolor}
\usepackage{flowfram}
\usepackage{kantlipsum}
\usepackage{microtype}
\newflowframe[1]{0.30\textwidth}{\textheight}
{0pt}{0pt}[leftcolumn]
\newflowframe[1]{0.30\textwidth}{.2\textheight}
{0.35\textwidth}{0pt}[shortcentercolumn]
\newflowframe[1]{0.30\textwidth}{.2\textheight}
{0.7\textwidth}{0pt}[shortrightcolum]
\newstaticframe[1]{0.65\textwidth}{.8\textheight}
{0.35\textwidth}{.2\textheight}[minipage]
\begin{document}
\noindent \kant[1]
\begin{staticcontents*}{minipage}
\colorbox{gray}{%
\begin{minipage}{\linewidth}
\kant[2-4]
This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer. This paragraph has the sole intention of making the entire colorbox longer.
\end{minipage}}
\end{staticcontents*}
\kant[2-5]
\end{document}
这仍然是非-自动化,并且在第二页上有一个错误,其中三列布局没有正确恢复:第二列和第三列在新页面上有大量的空白。
此外:
- 脚注在静态框架内不起作用。
- 流框架段落的第二列和第三列中的脚注出现在后面的页面上。
所以剩下的问题是:如何flowfram
在不破坏后续页面的情况下使用,最好具有multicol
兼容性?
答案1
这是使用 的初步答案flowfram
。感谢@Bernard 的建议和@NicolaTalbot 对我的代码中一些不一致之处的评论。
当我开始做这件事时,我可以使用 LaTeX 页面尺寸更好地平衡列。
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[margin=2cm]{geometry}
\usepackage{xcolor}
\usepackage{flowfram}
\usepackage{lipsum}
\usepackage{kantlipsum}
\usepackage{microtype}
\usepackage{multicol}
\definecolor{infocolor}{RGB}{216,237,237}
\newflowframe{\dimexpr\textwidth/3-2\columnsep/3}{\textheight}{0pt}{0pt}[leftcolumn]
\newflowframe[>1]{\dimexpr\textwidth/3-2\columnsep/3}{\textheight}{\dimexpr\textwidth/3+\columnsep/2}{0pt}[centercolumn]
\newflowframe[1]{\dimexpr\textwidth/3-2\columnsep/3}{.2\textheight}{\dimexpr\textwidth/3+\columnsep/2}{0pt}[shortcentercolumn]
\newflowframe[>1]{\dimexpr\textwidth/3-2\columnsep/3}{\textheight}{\dimexpr2\textwidth/3+\columnsep}{0pt}[rightcolumn]
\newflowframe[1]{\dimexpr\textwidth/3-2\columnsep/3}{.2\textheight}{\dimexpr2\textwidth/3+\columnsep}{0pt}[shortrightcolumn]
\newstaticframe[1]{\dimexpr2\textwidth/3-2\columnsep/3}{\dimexpr2\textheight/3-9\columnsep}{\dimexpr\textwidth/3+\columnsep/2}{\dimexpr\textheight/3}[minipage]
\begin{document}
\tolerance=10000
\lipsum[1]
\begin{staticcontents*}{minipage}
\colorbox{infocolor}{%
\parbox[b][\dimexpr.8\textheight-4.8\fboxsep][t]{\textwidth}{%
\vfil
\hfil
\begin{minipage}{\dimexpr\linewidth-6\fboxsep}
\setlength\parindent{16pt}
\kant[2] More text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text, more text.
\begin{center}
\includegraphics{figure.png}
\end{center}
\kant[4]
\end{minipage}}}
\hfil
\vfil
\end{staticcontents*}
\lipsum[2-15]
\end{document}