在对齐环境中用方框包围方程式且无缩进

在对齐环境中用方框包围方程式且无缩进

我有以下代码,我想对它做两件事。首先,我想让输出最大程度地位于左侧,也就是说,我不希望对齐环境中的内容有任何缩进,我希望它们与我的文本对齐。第二件事是将一个框放在对齐环境的整个内容周围。如果有人有任何建议,我将不胜感激!

I want this to be left-aligned in the same position as the following equations.

\documentclass{article}
\usepackage[margin= 1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tree-dvips}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage[affil-it]{authblk}
\usepackage{tipa}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{parcolumns}
\usepackage{natbib}
\usepackage{gb4e}
\usepackage{stmaryrd}
\usepackage{amssymb, amsmath}
\usepackage{qtree}
    \tikzset{small/.style={level distance=25pt,sibling distance=0pt}}

\usepackage{hyperref}
\begin{document}
\begin{flalign*}
&\llbracket \text{before} (\mathscr{B} \vee \mathscr{C}) \rrbracket                         \\
&\equiv \lambda t. \Big(\neg \exists t' \big[t' \le t \wedge \llbracket (\mathscr{B} \vee \mathscr{C}) \rrbracket(t') \big] \Big)                        \tag{definition}\\
&\equiv \lambda t. \Big(\forall t' \neg \big[t' \le t \wedge \llbracket (\mathscr{B} \vee \mathscr{C}) \rrbracket(t') \big] \Big)                    \tag{$\neg (\exists x)[\mathscr{P}(x)] \equiv  (\forall x)\neg[\mathscr{P}(x)]$}\\
&\equiv \lambda t. \Big(\forall t' \neg \big[t' \le t \wedge (\llbracket \mathscr{B}) \rrbracket(t') \vee \llbracket \mathscr{C}) \rrbracket(t') ) \big] \Big)                   \tag{point-wise disjunction}\\
&\equiv \lambda t. \Big(\forall t'  \neg \Big[ \Big(t' \le t \wedge \llbracket \mathscr{B}) \rrbracket(t') \Big) \vee \Big(t' \le t \wedge \llbracket \mathscr{C}) \rrbracket(t') \Big) \Big] \Big)                           \tag{$\mathscr{A}\wedge(\mathscr{B} \vee \mathscr{C}) \equiv (\mathscr{A} \wedge \mathscr{B}) \vee (\mathscr{A} \wedge \mathscr{C}))$}\\
&\equiv \lambda t. \Big(\forall t'  \Big[ \neg\Big(t' \le t \wedge \llbracket \mathscr{B}) \rrbracket(t') \Big) \wedge \neg\Big(t' \le t \wedge \llbracket \mathscr{C}) \rrbracket(t') \Big) \Big] \Big)   \tag{De Morgan}\\
&\equiv \lambda t.  \Big[ \forall t'\neg\Big(t' \le t \wedge \llbracket \mathscr{B}) \rrbracket(t') \Big) \wedge \forall t'\neg\Big(t' \le t \wedge \llbracket \mathscr{C}) \rrbracket(t') \Big) \Big]          \tag{$\forall x[\mathscr{P}(x) \vee \mathscr{R}(x)] \equiv \forall x[\mathscr{P}(x)] \vee \forall x[\mathscr{R}(x)]$}\\
&\equiv \lambda t.  \Big[ \forall t'\neg\Big(t' \le t \wedge \llbracket \mathscr{B}) \rrbracket(t') \Big) \Big] \wedge \lambda t. \Big[ \forall t'\neg\Big(t' \le t \wedge \llbracket \mathscr{C}) \rrbracket(t') \Big) \Big] \tag{point-wise conjunction}\\
&\equiv \lambda t.  \Big[ \neg\exists t'\Big(t' \le t \wedge \llbracket \mathscr{B}) \rrbracket(t') \Big) \Big] \wedge \lambda t. \Big[ \neg\exists t'\Big(t' \le t \wedge\llbracket \mathscr{C}) \rrbracket(t') \Big) \Big] \tag{$\neg (\exists x)[\mathscr{P}(x)] \equiv  (\forall x)\neg[\mathscr{P}(x)]$}\\
& \equiv \llbracket \text{before} (\mathscr{B}) \wedge \text{before} (\mathscr{C})\rrbracket \tag{definition}
\end{flalign*}
\end{document}

答案1

falling下面是使用和tikzmark将整个方程组围起来的例子:

在此处输入图片描述

笔记:

  • 这确实需要两次运行。第一次确定位置,第二次进行绘图。
  • 还要注意 的尾部&F = ma这是使方程式一直到左边所必需的。

代码:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{showframe}
\usetikzlibrary{calc}
\usepackage{tikzpagenodes}

\newcommand{\mytikzmark}[1]{\tikz[overlay,remember picture] \node[baseline] (#1) {\strut};}
\newcommand*{\xSep}{2.0pt}
\newcommand*{\DrawBox}[3][]{%
    \begin{tikzpicture}[remember picture, overlay] 
        \coordinate (Right Side) at (#3.south -| current page text area.north east);
        \draw [#1] 
            (#2.north) rectangle %(current page text area.east);
            (Right Side);
    \end{tikzpicture}%
}%

\begin{document}
I want this to be left-aligned in the same position as the following equations, 
with no indentation from the left margin
\begin{flalign*}
\mytikzmark{start}
F & = ma &&\text{Newtons famous equation.} &\\
E &= mc^2 && \text{Einstein's discovery!}\mytikzmark{end}
\end{flalign*}
\DrawBox[draw=red, thick]{start}{end}%
\end{document}

答案2

在此处输入图片描述

\documentclass{article}
\usepackage{empheq}

\begin{document}
I want this to be left-aligned in the same position as the following equations,
with no indentation from the left margin
\begin{empheq}[box=\fbox]{flalign*}
F & = ma    &&  \text{Newtons famous equation.} &   \\
E &= mc^2   &&  \text{Einstein's discovery!}    
\end{empheq}
\end{document}

这比@Peter Grill 答案中提出的稍微简单一些,也不那么花哨。

我使用了empheq软件包。如软件包文档中所述:

empheq包可以最好地描述为 的视觉标记扩展amsmath。简而言之,它提供了 a) 相当于\boxedfrom的多行amsmath和 b) 一种生成跨越整个数学显示的任意分隔符的方法。

相关内容