Syntax 如何在代码中使用圆括号

Syntax 如何在代码中使用圆括号,syntax,latex,Syntax,Latex,我在latex中有以下伪代码 \begin{algorithm} \begin{algorithmic} ..... \State i = (i + 1) \% CAPACITY ..... \end{algorithmic} \end{algorithm} 但是,当我编译这个时,圆括号没有显示,而是得到I=(I+1)%QCAPACITY,我得到I=I+1%QCAPACITY。如何解决此问题?您确定您的代码正确吗?我已将此代码粘贴到中,并且正确无误 \documentclass[12pt]{a

我在latex中有以下伪代码

\begin{algorithm}
\begin{algorithmic}
.....
\State i = (i + 1) \% CAPACITY
.....
\end{algorithmic}
\end{algorithm}

但是,当我编译这个时,圆括号没有显示,而是得到
I=(I+1)%QCAPACITY
,我得到
I=I+1%QCAPACITY
。如何解决此问题?

您确定您的代码正确吗?我已将此代码粘贴到中,并且正确无误

\documentclass[12pt]{article}
\usepackage{amsmath}

\begin{document}

\begin{algorithm}
\begin{algorithmic}

\State i = (i + 1) \% CAPACITY

\end{algorithmic}
\end{algorithm}

\end{document}​
应该将其迁移到您尝试的
\left(i+1\right)\%容量