\documentclass[a4paper]{article}
\usepackage[most]{tcolorbox}
\usepackage{xeCJK}
\setCJKmainfont{SimSun}
\begin{document}
% Code Block I %
MM%
\begin{tcolorbox}[blankest, nobeforeafter,bottom=0pt,boxsep=0pt, opacitytext=0.2]
\color{red}MM
\end{tcolorbox}%
MM\\
%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code Block II %
MM%
\begin{tcolorbox}[blankest, nobeforeafter,bottom=0pt,boxsep=0pt, opacitytext=0.2]
\color{red}地方
\end{tcolorbox}%
\end{document}
From the "code block I", I want to get six continuous characters "M". However, the typeset gives unwanted whitespace. I think this is because the width of tcolorbox is default of \textwidth
. How can I get a tcolorbox which width changes with its content?
From the typeset of "code block II" which contains non-ascii characters(here is CJK,for example), we can see that there is unalignment in height between characters. How to align ascii characters with CJK characters?
PS: I know \tcbox
may be a soluntion. But I want line-break sometimes. So tcolorbox must be choosed.
tcbox
adjust their width to thier contents, buttcolorbox
useslinewidth
as their defult width, unless you usewidth
option.[most]
option to packagetcolorbox
is missing. And my system complains about CJK characters.baseline
orbox align
options (page 79)