我尝试了beamer
幻灯片语法中的\texttt
、\textsc
和\textmd
命令,但不起作用。它对其他命令有效。我发现在第二张幻灯片上显示打字机文本的唯一方法是\only<2>{\ttfamily}
。
\documentclass{beamer}
\begin{document}
\begin{frame}
%These work
\textbf<2>{Bold in the second slide}\\
\textit<2>{Italic in the second slide}\\
\textsf<2>{Sans-serif in the second slide}\\
\textsl<2>{Slanted in the second slide}\\
\emph<2>{Emphasized in the second slide}\\
%These don't
\textrm<2>{Roman in the second slide}\\
\textsc<2>{Small caps in the second slide}\\
\texttt<2>{Typewriter in the second slide}\\
\textmd<2>{Medium-weight in the second slide}
\end{frame}
\end{document}
为什么这三个命令对幻灯片不起作用?
答案1
、\textmd
和均未定义覆盖规范(不要问为什么,很可能\textsc
是因为至少和在演示中看起来不太好看,但这仅是猜测!)\texttt
beamer
\texttt
\textsc
\textsc
根本无法与给定的字体一起使用,因此我lmodern
另外使用了。
系统提供了使用覆盖规范beamer
的复杂版本(参见示例)。请注意,最后一个参数数字实际上是用于覆盖的。\newcommand
\renewcommand
\documentclass{beamer}
\let\textmdorig\textmd
\let\textscorig\textsc
\let\textttorig\texttt
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\begin{document}
\renewcommand<>{\textmd}[1]{%
\only#2{\textmdorig{#1}}%
}
\renewcommand<>{\textsc}[1]{%
\only#2{\textscorig{#1}}%
}
\renewcommand<>{\texttt}[1]{%
\only#2{\textttorig{#1}}%
}
\begin{frame}
%These work
\textbf<2>{Bold in the second slide}
\textit<2>{Italic in the second slide}
\textsf<2>{Sans-serif in the second slide}
\textsl<2>{Slanted in the second slide}
\emph<2>{Emphasized in the second slide}
\textrm<2>{Roman in the second slide}
\textsc<2>{Small Caps In The Second Slide}
\texttt<2>{Typewriter in the second slide}
\textmd<2>{Medium-weight in the second slide}
\end{frame}
\end{document}