前言
创作开始时间:2022年5月30日20:12:48
如题,讲述tcolorbox的多种设置:添加阴影,支持跨页,设置颜色,设置缩进,设置边距,设置线框类型,隐藏线框。
添加阴影,支持跨页,设置颜色,设置缩进,设置边距,设置线框类型,隐藏线框
\usepackage[skins]{tcolorbox} %必须标注skin,才能使用shadow命令显示阴影。
\tcbuselibrary{breakable} %breakable:支持跨页
\newtcolorbox[auto counter, number within=section, list type=subsubsection, list inside=toc]{sectionbox}[1]{
colback=white, colframe=black, %背景和线条颜色
colbacktitle=white!80!gray, coltitle=black, %标题框的背景和线条颜色
fonttitle=\bfseries, title={Comment \thetcbcounter}, list entry={Comment \thetcbcounter\quad}, %标题
breakable, %支持跨页
before upper={\parindent10pt\noindent}, % 支持缩进。\noindent:首行不缩进
left = 1mm, %文字离线框左边的边距
right = 1mm,%同上
top = 1mm,%同上
bottom = 1mm,%同上
% arc is angular = 1mm, % 棱角线框
% sharp corners, % 直角线框
% enhanced,frame hidden, % 隐藏线框
% enhanced, drop fuzzy shadow, % 显示阴影
}
% 一个简单的应用
\newcommand{\rcomment}[1]{%
\vspace{10pt}
\begin{sectionbox}
s #1
\end{sectionbox}
}
大概效果如下:
小结
参考文献如下:
shadow相关 (其实还挺麻烦的,一开始不知道需要skins,enhanced这两个指令,一直报错;而且guidebook也误导我说要usepackage shadow啥的,其实根本不用) :
- https://tex.stackexchange.com/questions/467490/how-to-increase-box-shadow-size-using-tcolorbox (主要参考)
- https://tex.stackexchange.com/questions/356933/tcolorbox-how-to-put-shadow-to-whole-box-with-boxed-title
- https://tex.stackexchange.com/questions/328089/tcolorbox-shadow-shape
跨页支持(貌似只需要breakable。不知道是否需要enhanced):
- https://tex.stackexchange.com/questions/629302/tcolorbox-extruded-and-broken-through-pages
- https://tex.stackexchange.com/questions/441800/how-to-make-overlay-of-tcolorbox-span-over-multiple-pages
缩进:
- https://tex.stackexchange.com/questions/200632/indentation-in-tcolorbox-package (这个网页很给力,
before upper={\parindent15pt\noindent}
to disable indentation of the first paragraph in the box.) - https://tex.stackexchange.com/questions/44810/not-indent-the-first-paragraph-of-a-latex-document
隐藏线框:
- https://tex.stackexchange.com/questions/616575/how-to-draw-tcolorbox-without-a-frame
- https://tex.stackexchange.com/questions/247506/how-to-draw-a-bicolor-tcolorbox-without-frame
创作结束时间:2022年5月30日20:39:47