Alignat 环境在一个文档中改变其行为

Alignat 环境在一个文档中改变其行为

我遇到了以下问题:我正在撰写博士论文,alignat 环境在文档过程中改变了行为。以下是一个例子:

\documentclass[12pt, a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[english]{varioref}
\usepackage[fleqn]{amsmath}

\begin{document}
    \frontmatter
    \chapter*{A}
        This is a string which tests the text width. This is a string which tests the text width. This is a string which tests the text width.

        \begin{alignat}{3}
            & \big\{\phi_{B^\prime}(v) | \mbox{$v \in V$ is a leaf of $G$}\big\}
                && = \big\{b \in B | \iota(b) \not\equiv d \mod d\big\}\\
            \intertext{and}
            & \big\{\phi_{B^\prime}(v) | \mbox{$v \in V$ is not a leaf of $G$}\big\}
                && = \big\{b \in B | \iota(b) \equiv d \mod d\big\}.
        \end{alignat}

    \mainmatter
    \chapter{B}
        This is a string which tests the text width. This is a string which tests the text width. This is a string which tests the text width.

        \begin{alignat}{3}
            & \big\{\phi_{B^\prime}(v) | \mbox{$v \in V$ is a leaf of $G$}\big\}
                && = \big\{b \in B | \iota(b) \not\equiv d \mod d\big\}\\
            \intertext{and}
            & \big\{\phi_{B^\prime}(v) | \mbox{$v \in V$ is not a leaf of $G$}\big\}
                && = \big\{b \in B | \iota(b) \equiv d \mod d\big\}.
        \end{alignat}
\end{document}

使用\mainmatteralignat 环境后其行为会发生变化。我尝试使用\pagenumbering{arabic},但没有帮助。

这是 bug 吗?还是我哪里做错了?

非常感谢您的回答。

谨致问候,T

答案1

这不是主要内容/前言问题。但由于数字较大,方程式对于行来说有点太长,然后 alignat 将数字推到边距中。我不知道这是故意的还是错误,或者根本无法避免。您可能必须缩短方程式。

\documentclass[12pt, a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[english]{varioref}
\usepackage[fleqn]{amsmath}

\begin{document}
    \mainmatter
    \chapter{A}
        This is a string which tests the text width. This is a string which tests the text width. This is a string which tests the text width.

        \begin{alignat}{3}
            &a
                && = b\\            
        \end{alignat}

        \begin{alignat}{3}                         
            &a
                && = btests the text width. This is a string which tests the text width\\                
        \end{alignat}
\end{document}

在此处输入图片描述

答案2

这似乎是当激活alignat时的一个错误fleqn,并且方程太宽了。

我可以为您提供一个解决方法(请参阅https://tex.stackexchange.com/a/209732/4427

\documentclass[12pt, a4paper,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[english]{varioref}
\usepackage[fleqn]{amsmath}

\makeatletter
\newcommand{\Lft}[2]{%
  \ifmeasuring@
    #2%
  \else
    \makebox[\ifcase\expandafter #1\maxcolumn@widths\fi][l]{$\displaystyle#2$}%
  \fi
}
\makeatother


\begin{document}

\frontmatter

\chapter{A}

This is a string which tests the text width. This is a string which tests the text width. This is a 
string which tests the text width.
\begin{align}
  \Lft{1}{\bigl\{\phi_{B'}(v) \mid \text{$v \in V$ is a leaf of $G$}\bigr\}}
  & = \bigl\{b \in B \mid \iota(b) \not\equiv d \mod d\bigr\}
\intertext{and}
  \Lft{1}{\bigl\{\phi_{B'}(v) \mid \text{$v \in V$ is not a leaf of $G$}\bigr\}}
  & = \bigl\{b \in B \mid \iota(b) \equiv d \mod d\bigr\}.
\end{align}

\mainmatter

\chapter{B}

This is a string which tests the text width. This is a string which tests the text width. This is a 
string which tests the text width.
\begin{align}
  \Lft{1}{\bigl\{\phi_{B'}(v) \mid \text{$v \in V$ is a leaf of $G$}\bigr\}}
  & = \bigl\{b \in B \mid \iota(b) \not\equiv d \mod d\bigr\}
\intertext{and}
  \Lft{1}{\bigl\{\phi_{B'}(v) \mid \text{$v \in V$ is not a leaf of $G$}\bigr\}}
  & = \bigl\{b \in B \mid \iota(b) \equiv d \mod d\bigr\}.
\end{align}

\end{document}

oneside只是为了并排显示页面而使用的。

在此处输入图片描述

另一方面,我只会gather在这种情况下使用,但当然两个equation环境也可以做到同样的事情(甚至更好)。

This is a string which tests the text width. This is a string which tests the text width. This is a
string which tests the text width.
\begin{equation}
\bigl\{\phi_{B'}(v) \mid \text{$v \in V$ is a leaf of $G$}\bigr\}
= \bigl\{b \in B \mid \iota(b) \not\equiv d \mod d\bigr\}
\end{equation}
and
\begin{equation}
\bigl\{\phi_{B'}(v) \mid \text{$v \in V$ is not a leaf of $G$}\bigr\}
= \bigl\{b \in B \mid \iota(b) \equiv d \mod d\bigr\}.
\end{equation}

在此处输入图片描述

相关内容