In LaTeX
, the way \begin{center}....\end{center}
spaces the tcolorbox
is different from how \centering
does it. The center
environment, provides enough space but the vertical spacing done with \centering
isn't the same as with center
environment. Now my question is, when using \centering
, how do I achieve the same spacing of tcolorbox
as done with center
environment.
Here is the MWE:
\documentclass[12pt]{article}
\usepackage[many]{tcolorbox}
\usepackage{kantlipsum}
\newcommand{\unittcbox}[1]{%
\medskip \centering \tcbox{#1} \medskip
}%
\begin{document}
\kant[1]
\unittcbox{SI unit : Ampere. square metre ($A.m²$)}
\kant[2]
\begin{center}
\tcbox{SI unit : Ampere. square metre ($A.m²$)}
\end{center}
\kant[3]
\end{document}
I tried with \medskip
but it didn't workout.
Using centering:
Using center environment:
\centering
\par
, tried it but no use :(center
adds a\trivlist
. See the definition of\center
:\def\center{\trivlist \centering\item\relax}
and\def\endcenter{\endtrivlist}
\centering
doesn't do any vertical spacing it just sets the paragraph alignment to center, the center environment does\centering
but also adds vertical space. Your question isn't at all clear, but if you want the spacing of the center environment why not use that?