到处都是奇怪的端组错误和枚举错误

到处都是奇怪的端组错误和枚举错误

我正在写一份文件。

方程式问题

在我尝试将两个方程式放入文档后,LaTeX 开始给出一大堆错误,例如:

  • \begin{document}结束于\end{equation}
  • 额外的\endgroup

边距和枚举问题

除此之外,我的文档的第二页的边距比应有的要靠左(因为我应该仍在 内enumerate),当我尝试\item在 内创建新页时enumerate,它甚至不再显示文档中的数字(应该是 3)。有人有什么提示吗?

我知道这可能是一些非常简单的问题,例如缺少花括号,但我无法在最后一个\begin{enumerate}和之间找到错误\end{enumerate}。如果有人能帮助我,我将不胜感激。

下面是我的代码(我试图通过说文本而不是显示我的实际文本来使代码稍微短一些,因为实际文本要长得多):

\documentclass[a4paper,twoside]{IEEEtran}
\usepackage{graphicx}
\usepackage{amsmath}

\begin{document}

\title{title}

\author{my name}

\maketitle

\begin{abstract}
...
\end{abstract}

\section{Introduction}
...

\section{Telecommunications Infrastructure Planning}
text here
\begin{enumerate}
\item text
\item text
\item text
\item text
\end{enumerate}

My solutions to these tasks are given below:
\\*
\newline

\begin{enumerate}
\item text    
    \item text    
    \item Below is the graph I drew:

\begin{figure}[h!]
    \begin{center}
        \includegraphics[height=2.5in,width=3.5in,angle=0]{pic.eps}
    \end{center}
\end{figure}

\item text
    \end{enumerate}

\section{Compound Interest}
For this part of the mixed session, the following tasks were set:
\begin{enumerate}
\item text    
    \item text
\item text    
    \item text    
    \item text
\end{enumerate}

The following was what I did to complete the above tasks:
\begin{enumerate}
\item The following was the model I created in excel:

\begin{figure}[h!]
    \begin{center}
        \includegraphics[height=1.125in,width=2.125in,angle=0]{pic.eps}
    \end{center}
\end{figure}

\item I then modified the model as can be seen below:

\begin{figure}[h!]
    \begin{center}
        \includegraphics[height=2in,width=1.75in,angle=0]{pic.eps}
    \end{center}
\end{figure}

    The above two models were developed using the compound interest equation, which is given below:


    \begin{equation*}
        \begin{center}
            $A = P(1 + \frac{r}{n})^{nt}$
        \end{center}
    \end{equation*}


where
\newline
$A$ is the total amount in the account at any given time; \newline
$P$ is the principal (initial) amount in the account; \newline
$r$ is the annual interest rate; \newline
$n$ is the number of times the interest is compounded per year; \newline
$t$ is the number of years.
\\*
\newline

The difference in these results was that at the intervals 1, 2, 3 and 4 years, which both models had in common, the second model, which compounded quarterly, had accumulated slightly more interest. This was due to it compounding quarterly instead of annually. The 5\% interest annually was 1.25\% interest quarterly.


\item As $n \to \infty$, the compound interest formula becomes:

\begin{equation*}
    \begin{center}
        $A = Pe^{rt}$
    \end{center}
\end{equation*}

\end{enumerate}

\end{document}

答案1

有两个地方可以使用

\begin{equation*}
  \begin{center}
    $ ... $
  \end{center}
\end{equation*}

您不需要center在 中输入内容equation*;默认情况下已完成。此外,equation*已经处于数学模式,因此您只需使用

\begin{equation*}
  ...
\end{equation*}

您不同的边距可能源于您使用的twoside模式。


最后,即使你没有提到这一点:不要使用\\来换行或开始新段落。最好在代码中留空(空白)空间。

答案2

你的代码中充满了\newline和 ,\\*这些都是错误的。如果你不喜欢这个IEEEtran类的间距设置,不要使用它;如果你用它来提交,然后按照他们想做的做。

这是您的代码的编辑版本,其中包含一些技巧。但最重要的事实是修复了center内的错误公式equation*

  1. 图形文件应包含取决于尺寸\columnwidth而不是绝对尺寸的尺寸

  2. \\*\newline

  3. 变量的解释可以给出itemize为零分离和空标签的环境

这是代码。

\documentclass[a4paper,twoside]{IEEEtran}
\usepackage{newtxmath} % I can't stand CM math with Times text
\usepackage{graphicx}

% the following two packages are already loaded by IEEEtran
%\usepackage{amsmath}
%\usepackage{enumitem}

\begin{document}

\title{title}

\author{my name}

\maketitle

\begin{abstract}
...
\end{abstract}

\section{Telecommunications Infrastructure Planning}
text here
\begin{enumerate}
\item text
\item text
\item text
\item text
\end{enumerate}

My solutions to these tasks are given below:
\begin{enumerate}
\item text  

\item text  

\item Below is the graph I drew:
  \begin{center}
  \medskip
  \includegraphics[width=.8\columnwidth]{example-image}
  \medskip
  \end{center}

\item text
\end{enumerate}

The above two models were developed using the compound interest equation, which is given below:
\begin{equation*}
A = P\biggl(1 + \frac{r}{n}\biggr)^{nt}
\end{equation*}
where
\begin{itemize}[nosep,label={}]
\item $A$ is the total amount in the account at any given time;
\item $P$ is the principal (initial) amount in the account;
\item $r$ is the annual interest rate;
\item $n$ is the number of times the interest is compounded per year;
\item $t$ is the number of years.
\end{itemize}
The difference in these results was that at the intervals 1, 2, 3 and 4 years, which both models had 
in common, the second model, which compounded quarterly, had accumulated slightly more interest. This 
was due to it compounding quarterly instead of annually. The 5\% interest annually was 1.25\% interest 
quarterly.

\end{document}

在此处输入图片描述

相关内容