请考虑以下 MWE
\documentclass[xcolor=pdftex,t,11pt]{beamer}
\begin{document}
\begin{frame}
\frametitle{An example}
\begin{itemize}
\item Testing the hypothesis that $\widehat{\beta}_{i}$ is equal to all values between $1$ and $3$ could be boring. \medskip
\item Augmenting the null hypothesis by $0.2$ points each time implies that we need to repeat our command 11 times.\medskip
\item To shorten the procedure, we can use the command {\tt{forvalues}}.\medskip
\item {\tt{forvalues}} (and also {\tt{foreach}}) lets us to create loops.\medskip
\item Let us write the following in the command window:\medskip
\begin{center}
{\tt{forvalues i=1(0.2)3.2\,\ \{}}\\
{\tt{test ertsp=`i'}}\\
{\tt{\}}}
\end{center}
\end{itemize}
\end{frame}
\end{document}
排版后得到:
相反,我应该获得我在乳胶中写的确切内容,即“i”。
我怎样才能得到它?提前致谢。
答案1
像这样?
我已经在环境中添加了用于刻度的upquote
包。\verb
[fragile]
\verb
frame
\documentclass[xcolor=pdftex,t,11pt]{beamer}
\usepackage{upquote}
\begin{document}
\begin{frame}[fragile]
\frametitle{An example}
\begin{itemize}
\item Testing the hypothesis that $\widehat{\beta}_{i}$ is equal to all values between $1$ and $3$ could be boring. \medskip
\item Augmenting the null hypothesis by $0.2$ points each time implies that we need to repeat our command 11 times.\medskip
\item To shorten the procedure, we can use the command {\tt{forvalues}}.\medskip
\item {\tt{forvalues}} (and also {\tt{foreach}}) lets us to create loops.\medskip
\item Let us write the following in the command window:\medskip
\begin{center}\ttfamily
forvalues i=1(0.2)3.2\,\ \{\\
test ertsp=\verb|`|i\verb|'|\\
\}
\end{center}
\end{itemize}
\end{frame}
\end{document}