编译时双重下标导致错误

编译时双重下标导致错误

我的代码中:

  $\varphi(x) = \sum_{k=1}^ra_k\mathds{1}_{B_k}(x) $

但 pdflatex 命令经常生成:

  ? 
  ! Undefined control sequence.
  l.1354 ...rc \xi)(\omega) = \sum_{k=1}^ra_k\mathds
                                              {1}_{B_k}(\xi(\omega))

我不知道如何修复这个错误。它经常出现,因为我使用\mathds{1}指示器功能。如何修复它?

编辑:

\mathds{}来自\usepackage{dsfont}

编辑:下面是我的课程

\documentclass[12pt, a4paper]{article}

\usepackage[top=3.5cm, bottom=3.5cm, outer=1.5cm, inner=2cm, marginparwidth=2.5cm, marginparsep=2cm]{geometry}
\usepackage[polish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[pdftex, linkbordercolor={0 0.9 1}]{hyperref}
\usepackage{amsthm,amsmath,amsfonts,amssymb,mathtools}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{bbm}
\usepackage{fancyhdr}
\usepackage{marginnote}


\pagestyle{fancy}
 \fancyhf{}
\fancyfoot[R]{\textbf{\thepage}}
\fancyhead[L]{\small\sffamily \nouppercase{\leftmark}}


 % indicator function
 \usepackage{dsfont} 
 \DeclareMathOperator{\1}{\mathds{1}}

 \begin{document}
    $\varphi(x) = \sum_{k=1}^ra_k\mathds{1}_{B_k}(x) $
 \end{document}

答案1

dsfont.sty您可以使用 TeX 发行版来安装 LaTeX 包:

  • TeX Live 包名称:doublestroke
  • MiKTeX 包名称:dstroke

答案2

如果你按“h”来响应错误消息,

! Undefined control sequence.
l.1354 ...rc \xi)(\omega) = \sum_{k=1}^ra_k\mathds
                                                  {1}_{B_k}(\xi(\omega))

您将获得以下帮助文本:

? h
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

该行末尾的控制序列为\mathds,由包定义dsfont

\documentclass{article}
\usepackage{dsfont}

\begin{document}
$\varphi(x) = \sum_{k=1}^ra_k\mathds{1}_{B_k}(x) $
\end{document}

结果

相关内容