我想将tcolorbox
置于宽度小于 的页面(或列等)的中心\linewidth
。
tcolorbox
有没有比将 嵌套在 中更好的方法\begin-\end{center}
?
\documentclass{article}
\usepackage{multicol}
\usepackage{tcolorbox}
\usepackage{lipsum}
\begin{document}
\begin{multicols}{2}
I would like the following box to be centered in the column. Here is a direct way to do it, instead of using \verb+\begin-\end{center}+?
\begin{tcolorbox}[width=0.75\linewidth]
This is a test.
\end{tcolorbox}
\lipsum[2]
\end{multicols}
\end{document}
答案1
添加选项center
:
\documentclass{article}
\usepackage{multicol}
\usepackage{tcolorbox}
\usepackage{lipsum}
\begin{document}
\begin{multicols}{2}
I would like the following box to be centered in the column. Here is a direct way to do it, instead of using \verb+\begin-\end{center}+?
\begin{tcolorbox}[width=0.75\linewidth, center]
This is a test.
\end{tcolorbox}
\lipsum[2]
\end{multicols}
\end{document}