如果未使用 AMS 定理模块,积分符号会产生错误

如果未使用 AMS 定理模块,积分符号会产生错误

我在 LyX Tufte-book 课程中有一个文档,其序言如下:

\usepackage{xcolor} % for colour
\usepackage{physics}
\usepackage{caption}

% add numbers to chapters, sections, subsections
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{1}
\definecolor{oucrimsonred}{rgb}{0.6, 0.0, 0.0}
\definecolor{persianred}{rgb}{0.8, 0.2, 0.2}
\definecolor{persimmon}{rgb}{0.93, 0.35, 0.0}
\titleformat{\chapter}%
  {\huge\rmfamily\itshape\color{oucrimsonred}}% format applied to label+text
  {\llap{\colorbox{oucrimsonred}{\parbox{1.5cm}{\hfill\itshape\huge\color{white}\thechapter}}}}% label
  {2pt}% horizontal separation between label and title body
  {\leavevmode\newline}% before the title body
  [{\titlerule[0.8pt]}]% after the title body

% section format
\titleformat{\section}%
  {\normalfont\LARGE\itshape\color{persianred}}% format applied to label+text
  {\vspace{2em}\llap{\colorbox{persianred}{\parbox{1.5cm}{\hfill\color{white}\thesection}}}}% label
  {1em}% horizontal separation between label and title body
  {}% before the title body
  []% after the title body

% subsection format
\titleformat{\subsection}%
  {\normalfont\large\itshape\color{persimmon}}% format applied to label+text
  {\llap{\colorbox{persimmon}{\parbox{1cm}{\hfill\color{white}\thesubsection}}}}% label
  {1em}% horizontal separation between label and title body
  {}% before the title body
  []% after the title body

\def\mathnote#1{%
  \tag*{\rlap{\hspace\marginparsep\smash{\parbox[t]{\marginparwidth}{%
  \footnotesize#1}}}}
}
\numberwithin{equation}{chapter}
\setlength{\JustifyingParindent}{0pt}
\setlength{\parskip}{1em}
\newcommand{\me}{\mathrm{e}}
\newcommand{\nth}{n^\text{th}}
\addtolength{\jot}{1em}

\usepackage{titlesec}
\titlespacing*{\section}
{0pt}{2.2em plus 1ex minus .2ex}{4.3ex plus .2ex}
\titlespacing*{\subsection}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}

\makeatletter
\g@addto@macro \normalsize {%
 \setlength\abovedisplayskip{10pt plus 2pt minus 2pt}%
 \setlength\belowdisplayskip{10pt plus 2pt minus 2pt}%
}
\makeatother

现在,如果我在文档中有一个积分符号,就会产生错误,如果我使用其中一个 AMS 定理模块,错误就会消失。我现在不想使用这些模块。是什么导致了冲突?

在此处输入图片描述

答案1

问题出在physics包上。如果您在文档中使用积分符号,LyX 会esint在用户前言之前加载包,amsmath如果两者都加载,则应该在之后加载此包。由于物理包加载,amsmath您会收到错误。出于某种原因,LyX 的 AMS 定理模块加载了amsmath,但我认为这是错误的,因为amsmathamsthm 不需要它。

为了解决这个问题,确保amsmath在 LyX 中首先加载的最佳方法是将其设置amsmath为始终加载Document->settings->Math Options

相关内容