tcolorbox and text does not vertically align to the center with one another.
\documentclass{book}
\usepackage{tcolorbox}% for framed rounded boxes
\tcbset{colframe=black,colback=white,colupper=black,
fonttitle=\bfseries,nobeforeafter,center title,size=small}
\begin{document}
\tcbox{1}, \tcbox{2}, ... ,\tcbox{9} -- numbers\\
\tcbox{$+$}, \tcbox{$-$}, \tcbox{$\times$}, \tcbox{$\div$} -- operators\\
\tcbox{$(-)$} -- negative sign\\
\tcbox{$=$} or \tcbox{\sc{Enter}} -- equal sign\\
\end{document}
As can be seen, the text is aligned to the bottom.
How do I make both of them align next to one another?
Best Answer
You have to use the option
box align=base
(ortcbox raise base
, which is equivalent) in your\tcbset
.MWE
Output
P.S. Don't use
\\
to start a new paragraph, but either a blank line or\par
.EDIT
If you need this behavior only for some of the boxes, assign that property locally instead of globally. This means to remove the option from your
\tcbset
and set it for the boxes where it is needed, e.g.MWE
Output