\tcbsubtitle
我尝试在环境中使用tcblisting
。它工作正常,产生了字幕栏;但是,字幕具有列表格式。演示:
\documentclass{beamer}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\begin{document}
\begin{frame}[fragile]
\begin{tcblisting}%
{title=Title,listing only,listing options={escapechar=@,basicstyle=\tiny\ttfamily}}
int main() {
return 0;
@\tcbsubtitle{Subtitle}@
return 1;
}
\end{tcblisting}
\end{frame}
\end{document}
如何使字幕的格式tcblisting
与标题的格式一致?
答案1
您可以更改subtitle style
:
\documentclass{beamer}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\tcbset{
subtitle style={
fontupper=\normalfont\large
}
}
\begin{document}
\begin{frame}[fragile]
\begin{tcblisting}%
{title=Title,listing only,listing options={escapechar=@,basicstyle=\tiny\ttfamily}}
int main() {
return 0;
@\tcbsubtitle{Subtitle}@
return 1;
}
\end{tcblisting}
\end{frame}
\end{document}