使用 \texttt 时缺少插入 $

使用 \texttt 时缺少插入 $

我有这个简单的代码:

\documentclass[10pt]{article}

% amsmath package, useful for mathematical formulas
\usepackage{amsmath}
% amssymb package, useful for mathematical symbols
\usepackage{amssymb}
\usepackage{changepage}
% graphicx package, useful for including eps and pdf graphics
% include graphics with the command \includegraphics
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{listings}
\usepackage{caption}

% cite package, to clean up citations in the main text. Do not remove.
\usepackage{cite}

\usepackage{color}

% Use doublespacing - comment out for single spacing
%\usepackage{setspace}
%\doublespacing

% Text layout
\topmargin 0.0cm
\oddsidemargin 0.5cm
\evensidemargin 0.5cm
\textwidth 16cm
\textheight 21cm

% Bold the 'Figure #' in the caption and separate it with a period
% Captions will be left justified

\usepackage[labelfont=bf,labelsep=period,justification=raggedright]{caption}
\usepackage{amsfonts}
\usepackage{t1enc}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{pdflscape}
% Allow long tables to be split over multiple pages
\usepackage{longtable}

\title{TEST}

\begin{document}
\maketitle
\section*{Equations}

\noindent Example Equation
\begin{equation}
E_x= 1-e^{-k_{time}t}
\end{equation}

...

\texttt{E_x}

\end{document}

我在 上收到“缺少 $ 插入” \texttt{E_x},但我知道该\texttt{}函数用于生成 {} 内内容的文本模式。我错了吗?

答案1

尝试这个:

\texttt{E\textsubscript{\_n}}

相关内容