答案1
摘自手册第 110 页——http://ctan.imsc.res.in/macros/latex/contrib/tcolorbox/tcolorbox.pdf
平均能量损失
\documentclass[a4paper]{report}
\usepackage[most]{tcolorbox}
\tcbset{colframe=blue!50!black,colback=white,}
\begin{document}
\begin{tcolorbox}
\tcbox[on line, size=fbox]{Hello} \hfill World
\end{tcolorbox}
\begin{tcolorbox}
\tcbox[on line, size=fbox]{Hello} \hspace{4cm} World
\end{tcolorbox}
\begin{tcolorbox}
\tcbox[on line, size=fbox]{Hello} World
\end{tcolorbox}
\end{document}
如果您想更改内盒,只需输入以下选项
\begin{tcolorbox}
\tcbox[on line, colframe=red!50!black, colback=yellow!50!green, ]
{Hello}\hspace{4cm} World
\end{tcolorbox}
另一种方法是使用 tcolorbox 中的 sidebyside 选项——结果相同
\documentclass[a4paper]{report}
\usepackage[most]{tcolorbox}
\begin{document}
%outer box options
\tcbset{colback=red!5!white,colframe=red!75!black,righthand
width=4cm,sidebyside,sidebyside gap=6mm,lower separated=false}
\begin{tcolorbox}[sidebyside align=center seam]
%inner box options
\tcbox[on line, colframe=red!50!black,colback=yellow!50!, ]{Hello}
\tcblower World
\end{tcolorbox}
\end{document}
把所有东西都放到 beamer 环境中
\documentclass[]{beamer}
\usepackage[most]{tcolorbox}
\tcbset{colframe=blue!50!black,colback=white,}
\begin{document}
\begin{tcolorbox}
\tcbox[on line, colframe=red!50!black,colback=yellow!50!green, ]
{Hello} \hspace{4cm} World
\end{tcolorbox}
\begin{tcolorbox}
\tcbox[on line, size=fbox]{Hello} \hspace{4cm} World
\end{tcolorbox}
\begin{tcolorbox}
\tcbox[on line, size=fbox]{Hello} World
\end{tcolorbox}
\tcbset{colback=red!5!white,colframe=red!75!black,}
\begin{tcolorbox}[]
\tcbox[on line]{Hello} \tcbox[ on line, enhanced,
skin=enhancedmiddle jigsaw, colframe=red]{World}
\end{tcolorbox}
\end{document}