我正在为杂志写一篇文章。我正在尝试在 3 列文档的右上角插入一个(浮动)2 列框,文本很好地环绕它并且列对齐。我正在使用 tikz 包制作盒子,这样我就可以拥有一个带有圆边和背景颜色的盒子。我试图使用 wrapfig 进行包装(我也尝试了一些 minipage 的东西),但我无法让它工作。
这是一些代码,解释了我正在尝试做的事情,以及我一直在尝试做的事情:
\documentclass{article}
\usepackage{wrapfig}
\usepackage{tikz}
\usepackage{multicol}
\definecolor{col}{rgb}{0.6,0.6,0.9}
\setlength{\columnsep}{0.5cm}
\newcommand{\floatingBox}[3]
{
\noindent
\begin{wrapfigure}{#1}{#2}
\begin{tikzpicture}
\node[rounded corners=5pt, fill=col, text width=\linewidth]{#3};
\end{tikzpicture}
\end{wrapfigure}
}
\begin{document}
\begin{multicols}{3}
\large
Some random rambling to fill a page.
Aardvark AB aback abacus abaft abalone abandon abandoned abandonment abase
abasement abash abashed abate abatement abattoir abbess abbey abbot
abbreviate abbreviation ABC abdicate abdication abdomen abdominal abduct
abduction abeam abed aberrant aberration abet abeyance abhor abhorrence
abhorrent abide abiding ability abject abjure ablaze able able-bodied ABM
abnegation abnormal abnormality aboard abode abolish abolition abolitionist
A-bomb abominable abominate abomination aboriginal aborigine abort abortion
abortionist abortive abound about about-face above aboveboard abracadabra
abrade Abraham abrasion abrasive abreast abridge abridgment abroad abrogate
abrogation abrupt abscess abscond absence absent absentee absenteeism
absent-minded absinthe absolute absolute zero absolution absolutism absolve
absorb absorbency absorbent absorbing absorption abstain abstemious
abstention abstinence abstinent abstract abstracted abstraction abstruse
absurd absurdity abundance abundant abuse abusive abut abutment abysmal
abyss AC acacia academia academic academician academy a cappella accede
accelerate acceleration accelerator accent accentuate accentuation accept
acceptability acceptable acceptance access accessibility accessible
accession.
\floatingBox{tr}{2\columnwidth + 1\columnsep}{
\begin{multicols}{2}
A box that spans 2 columns and should be floating on top of the page with
the text wrapping around it. It's aligned to the right, so it would be
exactly above 2 entire columns, with one column to its left.
\end{multicols}
}
Accessory accident accidental accident-prone acclaim acclamation acclimate
acclimation acclimatization acclimatize accolade accommodate accommodating
accommodation accompaniment accompanist accompany accomplice accomplish
accomplished accomplishment accord accordance accordingly according to
accordion accost account accountability accountable accountant accounting
accouterments accredit accreditation accrue accumulate accumulation
accumulative accuracy accurate accursed accusation accusative accusatory
accuse accused accusingly accustom accustomed ace acerbic acerbity
acetaminophen acetate acetic acid acetone acetylene ache achievable achieve
achievement.
\end{multicols}
\end{document}