我正在尝试将多列中的文本框更改为单列。但是当我添加时,\begin{multicols}{1}
它box
不会更改为单列。例如,对于数字,可以使用\begin{figure*}
。
以下是示例
\documentclass[10pt]{book}
\usepackage[margin=0.5in]{geometry} % for PAPER & MARGIN
\usepackage[many]{tcolorbox} % for COLORED BOXES (tikz and xcolor included)
\usepackage{mathspec} % for FONTS
\usepackage{setspace} % for LINE SPACING
\usepackage{multicol} % for MULTICOLUMNS
\setmainfont{Noto Sans}[
Kerning = On,
Mapping = tex-text,
Numbers = Uppercase,
BoldFont = Noto Sans SemiBold
] % setting the font as Noto Sans
\setlength\parindent{0pt} % killing indentation for all the text
\setstretch{1.3} % setting line spacing to 1.3
\setlength\columnsep{0.25in} % setting length of column separator
\pagestyle{empty} % setting pagestyle to be empty
\definecolor{main}{HTML}{5989cf} % setting main color to be used
\definecolor{sub}{HTML}{cde4ff} % setting sub color to be used
\tcbset{
sharp corners,
colback = white,
before skip = 0.2cm, % add extra space before the box
after skip = 0.5cm % add extra space after the box
} % setting global options for tcolorbox
% You can copy any following box you like to your code.
\newtcolorbox{boxA}{
fontupper = \bf,
boxrule = 1.5pt,
colframe = black % frame color
}
\begin{document}
{\LARGE Simple Box} % inspired by https://saruwakakun.com/html-css/reference/box
\begin{multicols}{2}
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\begin{boxA}
\begin{multicols}{1}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{multicols}
\end{boxA}
\end{multicols}
\end{document}
这些建议确实会很有帮助。
答案1
我在两栏手稿中使用它
我有几个解决方案,但它们都不是“理想的”,而且每个都有缺点。首先,让我给出一个我将运行解决方案的示例(复制解决方案,然后将其粘贴到 后面的行中% Put solution in here !
):
\documentclass[twocolumn,10pt]{book}
\usepackage[margin=0.5in]{geometry}
\usepackage[many]{tcolorbox}
%\usepackage{multicol} % for MULTICOLUMNS
\usepackage{lipsum}
\tcbset{
sharp corners,
colback = white,
before skip = 0.2cm,
after skip = 0.5cm
} % setting global options for tcolorbox
\newtcolorbox{boxA}{
fontupper = \bf,
boxrule = 1.5pt,
colframe = black % frame color
}
\begin{document}
{\LARGE Simple Box}
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\lipsum[1-1]
% Put solution in here !
\lipsum
\end{document}
解决方案 1:
取消注释\usepackage{multicol}
(仅适用于此解决方案)。然后在所需页面的开头使用命令\onecolumn
。然后使用multicols
环境使页面有两列。要使框成为一列,只需在框之前和之后结束和开始环境。这样做的好处是可以将框准确地放在您想要的位置。
\begin{document}
仅针对此解决方案,我将提供从到的示例\end{document}
。
\begin{document}
\onecolumn
{\LARGE Simple Box}
\begin{multicols}{2}
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\lipsum[1-1]
% Put solution in here
\end{multicols}
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\begin{multicols}{2}
\lipsum
\lipsum
\end{multicols}
\twocolumn
\end{document}
缺点:您收到一条错误消息:
Package multicol Warning: May not work with the twocolumn option on input line 141.
此外,可能很难知道页面应该从哪里开始和结束。命令\onecolumn
和\twocolumn
开始新的一页。如果你把它们放在错误的位置,可能会看起来很尴尬(最糟糕的情况是:一页上只有一个词)。
尽管如此,我个人认为这可能是最好的解决方案。
解决方案 2:
使用minipage
环境创建一个跨越页面宽度的迷你页面(\textwidth
):
\vspace{\parskip}
\begin{minipage}{\textwidth}
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\end{minipage}
\vspace{\parskip}
缺点:第二列中的文本将覆盖该框。如果第一列中只有文本,则效果最佳。为确保这一点,您可以在框后使用命令\clearpage
或。\newpage
elsarticle
旁注:我使用此解决方案在摘要后的双栏版本中制作了目录。
解决方案 3:
将其包裹在里面\twocolumn[]
并使用\begin{@twocolumnfalse}
。
\twocolumn[
\begin{@twocolumnfalse}
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\end{@twocolumnfalse}
]
缺点:这将开始一个新页面(\twocolumn
命令会执行此操作)。但是,新页面的其余部分将为两列并填充文本。
解决方案 4:
将其放入table*
或figure*
环境中。
\begin{table*}[!ht]
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\end{table*}
缺点:无法控制框的最终位置。在此示例中,框最终位于第 2 页的中心。如果我们\lipsum
在框后添加另一个框,框最终位于第 2 页的顶部(与解决方案 2 相同)。如果框的位置不是那么重要,我建议使用此方法。
解决方案 5:
使用\onecolumn
命令和\twocolumn
框的前后部分。然而,这有一个巨大的缺点。
\onecolumn
\begin{boxA}
It is just a frame surrounded by a slightly thick line. A simple monochrome design might be fine, but when you want a gorgeous look, it's a bit unsatisfactory.
\end{boxA}
\twocolumn
退税:和\onecolumn
命令\twocolumn
开始新页面(与使用命令\clearpage
和相同\newpage
)。结果是框将位于其自己的页面上。在许多情况下并不理想。
其他的建议:
确实如此不是帮助改善multicol
环境里面就像在 MWE 中所做的那样。这只会更改文本之内框而不是框本身所在的环境。最好交换\begin{box}
和的位置\begin{multicol}{1}
。这会起作用吗?不,不幸的是没有。这是因为它已经在 MWE 中的双列环境 (multicol 2) 内了。
我简化了你的例子并删除了一些不必要的代码来解释解决方案。