使用时sidebyside
,的右侧部分tcolorbox
似乎不符合边距。
考虑:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
%\tcbuselibrary{skins}
\newtcolorbox{EmR}{%
sidebyside,sidebyside align=top,lower separated=true,lefthand width=0.4em,
arc=8pt,
boxsep=0pt,
left=8pt,right=2pt,top=2pt,bottom=2pt,
fontupper=\Large\bfseries\rm,
fontlower=\small,
after=\smallskip,
skin=bicolor,
colback=black!60, colframe=black!60,
colupper=white,
colbacklower=white,boxrule=0.5pt,
}
\begin{document}
\begin{EmR}
R
\tcblower
\lipsum[1]
\end{EmR}
\end{document}
(我想减少蓝色空间以反映我的边距。)
加分点:大家对如何在“R”和框架之间留出更多边距有什么建议吗(不增加右侧部分的边距?)
答案1
您可以调整lefthand width=1.5em,
并使用sidebyside gap=2pt,
以获得
我觉得我没有正确理解奖励问题。它的意思可能是这样的:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
%\tcbuselibrary{skins}
\newtcolorbox{EmR}{%
sidebyside,sidebyside align=top,lower separated=true,lefthand width=1.8em,
arc=8pt,
boxsep=0pt,
left=8pt,right=2pt,top=2pt,bottom=2pt,
fontupper=\Large\bfseries\rmfamily,
fontlower=\small,
after=\smallskip,
skin=bicolor,
colback=black!60, colframe=black!60,
colupper=white,
colbacklower=white,boxrule=0.5pt,
sidebyside gap=2pt,
}
\begin{document}
\begin{EmR}
\raisebox{-1ex}{R}
\tcblower
\lipsum[1]
\end{EmR}
\end{document}
如果上部只有一个字母,如R
,则以下情况也是可能的:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
%\tcbuselibrary{skins}
\newtcolorbox{EmR}[1][]{%
arc=8pt,
boxsep=0pt,
left=3em,,right=2pt,top=2pt,bottom=2pt,
fontupper=\small,
after=\smallskip,
skin=bicolor,
colback=white,colframe=black!60,
boxrule=0.5pt,
overlay={\begin{tcbclipinterior}
\draw[black!60,line width=6em-4pt] (interior.north west)--(interior.south west);
\node[font=\Large\bfseries\rmfamily, text=white, anchor=north west, inner ysep=5pt, minimum width=3em]
at (frame.north west) {#1};
\end{tcbclipinterior}
}
}
\begin{document}
\begin{EmR}[R]
\lipsum[1]
\end{EmR}
\end{document}
调整left=3em,
,line width=6em-4pt
(6em=2 倍左边距,4pt=2 倍右边距),inner ysep=5pt, minimum width=3em
(minimum width
= left
)。