我正在尝试向数学表达式添加标签(在 Lyx 下),但它与表达式的对齐不正确(略低于表达式的线),如附图所示。这是我正在使用的代码:
\begin{equation} \centerline{ $ \sum\limits_{s=0}^n \sum\limits_{n=-\infty}^{+\infty} \lVert \psi_{i_x,i_y;x,y}(t) \rVert ^2 =1 $ } \label{eq:eq12} \end{equation}
序言代码是:
% increases link area for cross-references and autoname them
\AtBeginDocument{\renewcommand{\ref}[1]{\mbox{\autoref{#1}}}}
\addto\extrasenglish{%
\renewcommand*{\equationautorefname}[1]{}
\renewcommand{\sectionautorefname}{sec.\negthinspace}
\renewcommand{\subsectionautorefname}{sec.\negthinspace}
\renewcommand{\subsubsectionautorefname}{sec.\negthinspace}
\renewcommand{\figureautorefname}{Fig.\negthinspace}
\renewcommand{\tableautorefname}{Tab.\negthinspace}
}
% in case somebody want to have the label "Equation"
%\renewcommand{\eqref}[1]{Equation~(\negthinspace\autoref{#1})}
% that links to image floats jumps to the beginning
% of the float and not to its caption
\usepackage[figure]{hypcap}
\usepackage{amsmath}
% the pages of the TOC is numbered roman
% and a pdf-bookmark for the TOC is added
\let\myTOC\tableofcontents
\renewcommand\tableofcontents{%
\frontmatter
\pdfbookmark[1]{\contentsname}{}
\myTOC
\mainmatter }
% makes caption labels bold
\setkomafont{captionlabel}{\bfseries}
\setcapindent{1em}
% enables calculations
\usepackage{calc}
\usepackage[]{qcircuit}
\usepackage{cleveref} %for cref
\usepackage{mathtools}
% fancy page header/footer settings
\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
% increases the bottom float placement fraction
\renewcommand{\bottomfraction}{0.5}
% avoids that floats are placed above its sections
\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}
你能帮我吗?此致,
答案1
equation
s 都已居中并处于数学模式。如果删除\centerline
(无论如何都不应再使用)和附加数学模式,它就可以正常工作:
\documentclass{scrbook}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\sum\limits_{s=0}^n \sum\limits_{n=-\infty}^{+\infty} \lVert \psi_{i_x,i_y;x,y}(t) \rVert ^2 = 1
\label{eq:eq12}
\end{equation}
\end{document}
(使用诸如方程编号之类的东西\label{eq:eq12}
并不是一个好主意,因为它可能会改变。最好选择描述方程的标签)
在您的序言中,缺少包hyperref
和babel
,并且中不能有空行\addto\extrasenglish{...}
。 如果更正了这些错误,则以下内容将进行编译并给出中心方程。
\documentclass{scrbook}
\usepackage[english]{babel}
% increases link area for cross-references and autoname them
\AtBeginDocument{\renewcommand{\ref}[1]{\mbox{\autoref{#1}}}}
\addto\extrasenglish{%
\renewcommand*{\equationautorefname}[1]{}
\renewcommand{\sectionautorefname}{sec.\negthinspace}
\renewcommand{\subsectionautorefname}{sec.\negthinspace}
\renewcommand{\subsubsectionautorefname}{sec.\negthinspace}
\renewcommand{\figureautorefname}{Fig.\negthinspace}
\renewcommand{\tableautorefname}{Tab.\negthinspace}
}
% in case somebody want to have the label "Equation"
%\renewcommand{\eqref}[1]{Equation~(\negthinspace\autoref{#1})}
% that links to image floats jumps to the beginning
% of the float and not to its caption
\usepackage{hyperref}
\usepackage[figure]{hypcap}
\usepackage[braket,qm]{qcircuit}
\usepackage{amsmath}
% the pages of the TOC is numbered roman
% and a pdf-bookmark for the TOC is added
\let\myTOC\tableofcontents
\renewcommand\tableofcontents{%
\frontmatter
\pdfbookmark[1]{\contentsname}{}
\myTOC
\mainmatter }
% makes caption labels bold
\setkomafont{captionlabel}{\bfseries}
\setcapindent{1em}
% enables calculations
\usepackage{calc}
\usepackage[]{qcircuit}
\usepackage{cleveref} %for cref
\usepackage{mathtools}
% fancy page header/footer settings
\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
% increases the bottom float placement fraction
\renewcommand{\bottomfraction}{0.5}
% avoids that floats are placed above its sections
\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}
\begin{document}
\begin{equation}
\sum\limits_{s=0}^n \sum\limits_{n=-\infty}^{+\infty} \lVert \psi_{i_x,i_y;x,y}(t) \rVert ^2 = 1
\label{eq:eq12}
\end{equation}
\end{document}