我在文件开头有以下代码:
\documentclass[a4paper, 12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[finnish]{babel} % Kieli: Suomi
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{imakeidx}
\usepackage{enumitem}
\makeindex
\newtheoremstyle{special}
{\topsep}
{\topsep}
{\itshape}
{}
{\bfseries}
{$^{\bm\ast}$\kern-1.5pt.}% Punctuation after theorem head % <-- new
{.5em}
{}
\newtheorem{thm}{Theorem}
\newtheorem{lause}[thm]{Lause}
\newtheorem{huom}[thm]{Huomautus}
\theoremstyle{special}
\newtheorem{spthm}[thm]{Teoreema}
\newtheorem{thm*}[thm]{Theorem}
\newtheorem*{dem*}{De Morganin lait}
之后,在一份文件中,我
\begin{spthm}
This is a special theorem.
\end{spthm}
现在 Texmaker 5.0.3 和 pdflatex 抱怨:
! Undefined control sequence.
<inserted text> $^{\bm
\ast }$\kern -1.5pt.
l.483 T
his is a special theorem.
我的错误是什么?
答案1
欢迎来到 TeX.SE。我通过删除一些代码来清理您的代码\usepackage{amsfonts}
,并且改进了一个奇怪的\bm
命令,而您没有使用该bm
包。我已经使用过这个{$\boldsymbol{^\ast}$\kern-1.5pt.}
,您的所有代码都正常工作。
\documentclass[a4paper, 12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[finnish]{babel} % Kieli: Suomi
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{imakeidx}
\usepackage{enumitem}
\makeindex
\newtheoremstyle{special}
{\topsep}
{\topsep}
{\itshape}
{}
{\bfseries}
{$\boldsymbol{^\ast}$\kern-1.5pt.}% Punctuation after theorem head % <-- new
{.5em}
{}
\newtheorem{thm}{Theorem}
\newtheorem{lause}[thm]{Lause}
\newtheorem{huom}[thm]{Huomautus}
\theoremstyle{special}
\newtheorem{spthm}[thm]{Teoreema}
\newtheorem{thm*}[thm]{Theorem}
\newtheorem*{dem*}{De Morganin lait}
\begin{document}
\begin{spthm}
This is a special theorem.
\end{spthm}
\end{document}