如何制作在 tcolorbox 中生成第二个标题的密钥? - 我正在考虑使用命令制作标题title=Title in the first language
,并使用看起来像 - 的命令制作第二个标题,用作 tcolorbox 的可选参数。第二个标题应自动采用标题、类似或文本缩进additional title=Title in the second language
的设置。fonttitle=\bfseries
梅威瑟:
\documentclass{standalone}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbset{skin=bicolor,colframe=blue!70!black,fonttitle=\bfseries,
colback=blue!20!white,colbacklower=green!20!white,left=0ex,right=0ex}
\begin{document}
\begin{tcolorbox}[title=Title in the first language,
title code={\node at (title.center) [anchor=west,text=green,font=\bfseries] {Title in the second language};}]
Original text.
\tcblower
Translated text.
\end{tcolorbox}
\end{document}
答案1
您可以使用after title
。
\documentclass{standalone}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbset{skin=bicolor,colframe=blue!70!black,fonttitle=\bfseries,
colback=blue!20!white,colbacklower=green!20!white,left=0ex,right=0ex}
\begin{document}
\begin{tcolorbox}[
title={Title in the first language},
after title={\hfill Title in the second language},
]
Original text.
\tcblower
Translated text.
\end{tcolorbox}
\end{document}
或者,如果你坚持要钥匙additional title
\documentclass{standalone}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbset{skin=bicolor,colframe=blue!70!black,fonttitle=\bfseries,
colback=blue!20!white,colbacklower=green!20!white,left=0ex,right=0ex}
\tcbset{
additional title/.style={after title={\hfill #1}}
}
\begin{document}
\begin{tcolorbox}[
title={Title in the first language},
additional title={Title in the second language},
]
Original text.
\tcblower
Translated text.
\end{tcolorbox}
\end{document}