tcbox 仅为选定的文本提升基础

tcbox 仅为选定的文本提升基础

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} 

tcbox 提升基座

无 tcbox 提升基础

答案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} 

输出

在此处输入图片描述

相关内容