我希望* .tex文件中的以下行“按原样”打印:
while (tmp[0] == '\r' || tmp[0] == '\n') {tmp++;}
当我将它包装在像这样的\ verb命令中时:
\verb"while (tmp[0] == '\r' || tmp[0] == '\n') {tmp++;}"
它不起作用,我得到:
! Undefined control sequence.
所有其他谷歌答案如此复杂。
当然,必须有一个简单的方法来做到这一点,对吧? 谢谢!
编辑:
以下是评论中要求的最小计数器示例:
%%%%%%%%%%%%%%%%%%%%%%%%%%
% document class: beamer %
%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{beamer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% no navigation bars please %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{footline}[frame number]{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% no navigation symbols please %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{navigation symbols}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% no footers at all please %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{footline}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% center the title please %
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{frametitle}[default][center]
%%%%%%%%%%%%%%%%%%
% begin document %
%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%
% title %
%%%%%%%%%
\title{Some Title}
%%%%%%%%%%
% author %
%%%%%%%%%%
\author{Some Author}
%%%%%%%%%%%%
% date ... %
%%%%%%%%%%%%
\date{\today}
%%%%%%%%%%%%%
% frame ... %
%%%%%%%%%%%%%
\frame{\titlepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SECTION :: Introduction %
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Section Introduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Frame Title :: Introduction %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\frame{\frametitle{Status}
%%%%%%%%%%%%%%%%%%
% Items :: Begin %
%%%%%%%%%%%%%%%%%%
\begin{itemize}
\item
while (tmp[0] == 'A' $||$ tmp[1] == 'B') $\{$tmp++;$\}$
\end{itemize}
}
\end{document}