tcbox raise base 非常有助于对齐我的文本和 tcbox。但是,如果我想对某些文本使用 tcbox raise base,而对其他文本不使用,该怎么办?这意味着我试图在同一文档中获取 0.0.1 和 0.0.3。
\documentclass{book}
\usepackage{tcolorbox}% for framed rounded boxes
\tcbset{colframe=black,colback=white,colupper=black,
fonttitle=\bfseries,nobeforeafter,center title,size=small,tcbox raise base}
\begin{document}
\subsection{tcbox raise base works here}
\tcbox{0}, \tcbox{1}, \tcbox{2}, ... ,\tcbox{8}, \tcbox{9} -- numbers
\tcbox{.} -- decimal point
\tcbox{$+$}, \tcbox{$-$}, \tcbox{$\times$}, \tcbox{$\div$} -- operators
\tcbox{$(-)$} -- negative sign
\subsection{tcbox raise base does not work here}
\tcbox{$($} \tcbox{$(-)$} \tcbox{$3$} \tcbox{$.$} \tcbox{$6$} \tcbox{$+$} \tcbox{$5$} \tcbox{$x^2$} \tcbox{$)$} \tcbox{$\div$} \tcbox{$2$}
\end{document}
答案1
\tcbset
我建议您每次需要更改设置时都发布一个新的设置。
因此tcbox raise base
从第一个\tcbset
问题中删除
\tcbset{tcbox raise base}
当你需要的时候,
\tcbset{tcbox raise=0mm}
当你不这样做的时候。
平均能量损失
\documentclass{book}
\usepackage{tcolorbox}% for framed rounded boxes
\tcbset{colframe=black,colback=white,colupper=black,
fonttitle=\bfseries,nobeforeafter,center title,size=small}
\begin{document}
\subsection{tcbox raise base is used here}
\tcbset{tcbox raise base}
\tcbox{0}, \tcbox{1}, \tcbox{2}, ... ,\tcbox{8}, \tcbox{9} -- numbers
\smallskip
\noindent\tcbox[tcbox raise=-0.5mm]{.} -- decimal point
\smallskip
\noindent\tcbox{$+$}, \tcbox{$-$}, \tcbox{$\times$}, \tcbox{$\div$} -- operators
\smallskip
\noindent\tcbox{$(-)$} -- negative sign
\subsection{tcbox raise base is not used here}
\tcbset{tcbox raise=0mm}
\tcbox{$($} \tcbox{$(-)$} \tcbox{$3$} \tcbox{$.$} \tcbox{$6$} \tcbox{$+$} \tcbox{$5$} \tcbox{$x^2$} \tcbox{$)$} \tcbox{$\div$} \tcbox{$2$}
\end{document}
输出