无法确定我的代码存在什么问题,请帮帮我!

无法确定我的代码存在什么问题,请帮帮我!
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}

\renewcommand{\qedsymbol}{$\blacksquare$}
\newcommand*{\QEDA}{\hfill\ensuremath{\blacksquare}}%

\begin{document}

\begin{proof}
  Since $x_k$ is only conditionally summable, this means that the
  sequence $s_n = \sum\limits_{k=1}^{n}|x_k|$ is not convergent. Note
  that $s_n$ is a monotone increasing sequence that is not convergent,
  hence it must be unbounded. But
  $\sigma_n^+ = \sum\limits_{k=1}^{n}x_k^+$ and
  $\sigma_n^- = \sum\limits_{k=1}^{n}x_^-$ are all subsequences of
  $s_n$, and they are monotone increasing as well. Thus, they must me
  also unbounded and
  $\sum\limits_{k=1}^{\infty}x_k^+ = \infty =
  \sum\limits_{k=1}^{\infty}x_k^-$.
\end{proof}

\end{document}

当我尝试运行我的代码时出现以下错误,但我真的找不到我的代码有什么错误。

! Missing { inserted.
<to be read again> 
                   ^
l.19   $\sigma_n^- = \sum\limits_{k=1}^{n}x_^
                                             -$ are all subsequences of
?

答案1

值得注意的是,在这种情况下,错误消息会告诉您代码中的问题所在

! Missing { inserted.
<to be read again> 
                   ^
l.19   $\sigma_n^- = \sum\limits_{k=1}^{n}x_^
                                             -$ are all subsequences of
?

在 LaTeX 遇到问题的地方,这条线断了。

x_^-是你的问题,尽管我认为没有在下标和上标周围加上括号可能无助于解决问题。这是这里时常出现的问题,我经常建议你始终使用括号,即使是单字符的下标/上标,即:x_{k}。这确实有点难以输入,并且可以说括号是不必要的混乱。另一方面,它确实使我更容易进行视觉解析,并且当你意识到应该是时,你永远不会遇到忘记在上标周围加上括号的问题x^nx^{n + 1}这是一个很好的习惯,我认为x_{k}^{+}比更有意义x_k^+。每个人都有自己的想法,但只是需要考虑的事情。

无论如何,如果我们应用 Christian Hupfer 建议的修正在评论中

$\sigma_n^- = \sum\limits_{k=1}^{n}x_k^-$ are all subsequences of

例如:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}

\renewcommand{\qedsymbol}{$\blacksquare$}
\newcommand*{\QEDA}{\hfill\ensuremath{\blacksquare}}%

\begin{document}

\begin{proof}
  Since $x_k$ is only conditionally summable, this means that the
  sequence $s_n = \sum\limits_{k=1}^{n}|x_k|$ is not convergent. Note
  that $s_n$ is a monotone increasing sequence that is not convergent,
  hence it must be unbounded. But
  $\sigma_n^+ = \sum\limits_{k=1}^{n}x_k^+$ and
  %% problem line below %%
  $\sigma_n^- = \sum\limits_{k=1}^{n}x_k^-$ are all subsequences of
  %% problem line above %%
  $s_n$, and they are monotone increasing as well. Thus, they must me
  also unbounded and
  $\sum\limits_{k=1}^{\infty}x_k^+ = \infty =
  \sum\limits_{k=1}^{\infty}x_k^-$.
\end{proof}

\end{document}

在此处输入图片描述

一切都很好。不过,我还是建议您不要再普遍使用\limits。内联数学模式将下标和上标放在一边,这是有充分理由的,那就是保持一致的行距,并在行间留出适当的空白。

相关内容