![对齐方程式会破坏所有章节‘0’部分和附录的方程式编号](https://linux22.com/image/478040/%E5%AF%B9%E9%BD%90%E6%96%B9%E7%A8%8B%E5%BC%8F%E4%BC%9A%E7%A0%B4%E5%9D%8F%E6%89%80%E6%9C%89%E7%AB%A0%E8%8A%82%E2%80%980%E2%80%99%E9%83%A8%E5%88%86%E5%92%8C%E9%99%84%E5%BD%95%E7%9A%84%E6%96%B9%E7%A8%8B%E5%BC%8F%E7%BC%96%E5%8F%B7.png)
我正在使用书籍文档包撰写论文,附录和其他章节的公式编号存在问题,因为章节的第一节之前有公式。我一直在论坛上阅读,并尝试了各种可能的解决方案,但没有成功,例如:
\numberwithin{equation}{chapter}
和
\renewcommand*{\theequation}{%
\ifnum\value{subsection}=0 %
\thesection
\else
\thesubsection
\fi
.\arabic{equation}%
}
等等。您可以在下面看到该问题的图片。
经过大量调试后,我发现下面代码中可以看到的对齐方程(将其复制粘贴到空白的乳胶文档中自己查看)是问题所在。但是,我一直无法理解它有什么问题。你知道我应该在方程中做哪些改变,以免破坏论文其余部分的方程编号吗?
以下代码可以概述该情况:
\documentclass[12pt,oneside]{book}
\usepackage[width=0.8\paperwidth, height = 0.85\paperheight]{geometry}
\usepackage[utf8]{inputenc} % Norwegian letters
\thispagestyle{empty} % Remove page numbers from first page
\usepackage{tocloft} % Make dots in the toc
\usepackage{amsmath, bm, array} % Extra math functionality
\usepackage{hyperref}
\usepackage{mhchem} % Write chemical equations
\usepackage{siunitx} % Typing of SI units
\usepackage{float} % Enables use of H-specific in images
\usepackage[nottoc,numbib]{tocbibind} % References in toc
\usepackage{caption}
\usepackage[toc,page]{appendix}
\usepackage{listings}
\usepackage{gensymb}
\usepackage{afterpage}
\usepackage[pdftex]{graphicx}
\usepackage{booktabs,fixltx2e}
\usepackage{subcaption,ragged2e}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage{svg}
\usepackage{titlesec}
\usepackage{chngcntr}
\begin{document}
\chapter{This is the first chapter}
\section{First section in first chapter}
\begin{equation}
\label{reflection-coefficient-as}
A = a \cdot x
\end{equation}
\begin{align}
\chi_{S}^{e,1} &= \frac{1}{\sqrt{2}} \begin{bmatrix}
u_{\bm{k}}, v_{\bm{k}}
\end{bmatrix} \otimes \begin{bmatrix}
-1 \\ \\ 1
\end{bmatrix} =
\frac{1}{\sqrt{2}} \begin{bmatrix}
-u_{\bm{k}} \\ \\ u_{\bm{k}} \\ \\ -v_{\bm{k}} \\ \\ v_{\bm{k}}
\end{bmatrix} \text{, } & \chi_{S}^{e,-1} &=
\frac{1}{\sqrt{2}} \begin{bmatrix}
u_{\bm{k}}, v_{\bm{k}}
\end{bmatrix}
\otimes
\begin{bmatrix}
1 \\ \\ 1
\end{bmatrix} =
\frac{1}{\sqrt{2}} \begin{bmatrix}
u_{\bm{k}} \\ \\ u_{\bm{k}} \\ \\ v_{\bm{k}} \\ \\ v_{\bm{k}}
\end{bmatrix} \text{, } \nonumber \\ \nonumber \\
\chi_{S}^{h,1} &=
\frac{1}{\sqrt{2}} \begin{bmatrix}
v_{\bm{k}}, u_{\bm{k}}
\end{bmatrix}
\otimes
\begin{bmatrix}
-1 \\ \\ 1
\end{bmatrix} =
\frac{1}{\sqrt{2}} \begin{bmatrix}
-v_{\bm{k}} \\ \\ v_{\bm{k}} \\ \\ -u_{\bm{k}} \\ \\ u_{\bm{k}}
\end{bmatrix} \text{, and } & \chi_{S}^{h,-1} &=
\frac{1}{\sqrt{2}} \begin{bmatrix}
v_{\bm{k}}, u_{\bm{k}}
\end{bmatrix}
\otimes
\begin{bmatrix}
1 \\ \\ 1
\end{bmatrix} =
\frac{1}{\sqrt{2}} \begin{bmatrix}
v_{\bm{k}} \\ \\ v_{\bm{k}} \\ \\ u_{\bm{k}} \\ \\ u_{\bm{k}}
\end{bmatrix} \text{.}
\end{align} \nonumber
\chapter{This is the second chapter}
\begin{equation}
\label{reflection-coefficient-as}
A = a \cdot x
\end{equation}
\begin{equation}
\label{reflection-coefficient-as}
A = a \cdot x
\end{equation}
\section{Section Chap 2}
\begin{equation}
\label{reflection-coefficient-as}
A = a \cdot x
\end{equation}
\begin{appendices}
\chapter{Chapter 1}
\begin{equation}
A = x c
\end{equation}
\begin{equation}
A = x c
\end{equation}
\section{Section 1}
\begin{equation}
A = x c
\end{equation}
\begin{equation}
A = x c
\end{equation}
\end{appendices}
\end{document}