答案1
答案2
另一个解决方案基于托马斯·F·斯特姆回答虚线框环境。我刚刚把他的解决方案改编成了tcbox
。
\documentclass{article}
\usepackage[most]{tcolorbox}
\newtcbox{\dbox}[1][]{
on line,
enhanced,
frame hidden,
interior hidden,
sharp corners,
size=small,
borderline={0.4pt}{0pt}{dashed},
#1
}
\begin{document}
This is a \dbox{test} with \dbox{tcolorbox}.
\end{document}