无法将 multicol 中的 amsmath 方程式左对齐

无法将 multicol 中的 amsmath 方程式左对齐

我正在尝试使用 Latex 创建一个简单的备忘单。我使用 multicol 来分割页面和每列上的方程式。

但是,尽管使用了公式,公式却没有左对齐flalign,而且由于字体大小的原因,公式被多列分隔符截断了。

在此处输入图片描述

\documentclass{article}

  \usepackage{multicol, amsmath, geometry}
    \geometry{
      a4paper,
      margin = 0.4in
    }
    \pagenumbering{gobble}
    \setlength{\columnsep}{0.5in}
    \setlength{\columnseprule}{1pt}

  \begin{document}
  \begin{multicols*}{3}
    \begin{center}
      \textbf{Logical Equivalences}
    \end{center}
    \small
    \begin{flalign*}
      P \wedge T \equiv P\\
      P \vee F \equiv P\\\\
      P \vee T \equiv T\\
      P \wedge F \equiv F\\\\    
      P \wedge P \equiv P\\
      P \vee P \equiv P\\\\ 
      \neg (\neg P) \equiv P\\\\
      P \vee Q \equiv Q \vee P\\
      P \wedge Q \equiv Q \wedge P\\\\
      (P \vee Q) \vee R \equiv P \vee (Q \vee R)\\
      (P \wedge Q) \wedge R \equiv P \wedge (Q \wedge R)\\\\
      P \vee (Q \wedge R) \equiv (P \vee Q) \wedge (P \vee R)\\
      P \wedge (Q \vee R) \equiv (P \wedge Q) \vee (P \wedge R)\\\\
      \neg (P \wedge Q) \equiv \neg P \vee \neg Q\\
      \neg (P \vee Q) \equiv \neg P \wedge \neg Q\\\\  
      P \vee (P \wedge Q) \equiv P\\
      P \wedge (P \vee Q) \equiv P\\\\
      P \vee \neg P \equiv T\\
      P \wedge \neg P \equiv F\\\\ 
      P \implies Q \equiv \neg P \vee Q\\
      P \implies Q \equiv \neg Q \implies \neg Q\\
      P \vee Q \equiv \neg P \implies Q\\
      P \wedge Q \equiv \neg (P \implies \neg Q)\\
      \neg (P \implies Q) \equiv P \wedge \neg Q\\
      (P \implies Q) \wedge (P \implies R) \equiv P \implies (Q \wedge R)\\
      (P \implies Q) \vee (P \implies R) \equiv P \implies (Q \vee R)\\
      (P \implies R) \wedge (P \implies R) \equiv (P \vee Q)\implies R\\
      (P \implies R) \vee (P \implies R) \equiv (P \wedge Q)\implies R\\\\
      P \iff Q \equiv (P \implies Q) \wedge (Q \implies P)\\
      P \iff Q \equiv \neg P \iff \neg \neg Q\\
      P \iff Q \equiv (P \wedge Q) \vee (\neg Q \wedge \neg P)\\
      \neg (P \iff Q) \equiv P \iff \neg Q         
    \end{flalign*}
  \end{multicols*}

  \end{document}

我尝试使用\small来减小方程的大小,但它们仍然不适合。有没有办法让它们左对齐并动态调整大小以适应多列的边距?

答案1

flalign并非设计为左对齐:使用[fleqn]包(或文档类)的选项来获取左对齐方程。此外,对齐结构中的第一个单元格是右对齐的,因此要么使用未对齐的环境,例如,gather要么使用&\equiv来对齐等价项。

就像这样,只是线条仍然太宽

\documentclass[fleqn]{article}

  \usepackage{multicol, amsmath, geometry}
    \geometry{
      a4paper,
      margin = 0.4in
    }
    \pagestyle{empty}
    \setlength{\columnsep}{0.5in}
    \setlength{\columnseprule}{1pt}

  \begin{document}
  \begin{multicols*}{3}
    \begin{center}
      \textbf{Logical Equivalences}
    \end{center}
    \small
    \begin{gather*}
      P \wedge T \equiv P\\
      P \vee F \equiv P\\\\
      P \vee T \equiv T\\
      P \wedge F \equiv F\\\\    
      P \wedge P \equiv P\\
      P \vee P \equiv P\\\\ 
      \neg (\neg P) \equiv P\\\\
      P \vee Q \equiv Q \vee P\\
      P \wedge Q \equiv Q \wedge P\\\\
      (P \vee Q) \vee R \equiv P \vee (Q \vee R)\\
      (P \wedge Q) \wedge R \equiv P \wedge (Q \wedge R)\\\\
      P \vee (Q \wedge R) \equiv (P \vee Q) \wedge (P \vee R)\\
      P \wedge (Q \vee R) \equiv (P \wedge Q) \vee (P \wedge R)\\\\
      \neg (P \wedge Q) \equiv \neg P \vee \neg Q\\
      \neg (P \vee Q) \equiv \neg P \wedge \neg Q\\\\  
      P \vee (P \wedge Q) \equiv P\\
      P \wedge (P \vee Q) \equiv P\\\\
      P \vee \neg P \equiv T\\
      P \wedge \neg P \equiv F\\\\ 
      P \implies Q \equiv \neg P \vee Q\\
      P \implies Q \equiv \neg Q \implies \neg Q\\
      P \vee Q \equiv \neg P \implies Q\\
      P \wedge Q \equiv \neg (P \implies \neg Q)\\
      \neg (P \implies Q) \equiv P \wedge \neg Q\\
      (P \implies Q) \wedge (P \implies R) \equiv P \implies (Q \wedge R)\\
      (P \implies Q) \vee (P \implies R) \equiv P \implies (Q \vee R)\\
      (P \implies R) \wedge (P \implies R) \equiv (P \vee Q)\implies R\\
      (P \implies R) \vee (P \implies R) \equiv (P \wedge Q)\implies R\\\\
      P \iff Q \equiv (P \implies Q) \wedge (Q \implies P)\\
      P \iff Q \equiv \neg P \iff \neg \neg Q\\
      P \iff Q \equiv (P \wedge Q) \vee (\neg Q \wedge \neg P)\\
      \neg (P \iff Q) \equiv P \iff \neg Q         
    \end{gather*}
  \end{multicols*}

  \end{document}

如果您的视力好,则此版本适合您……

在此处输入图片描述

\documentclass[fleqn]{article}

  \usepackage{multicol, amsmath, geometry}
    \geometry{
      a4paper,
      margin = 0.4in
    }
    \pagestyle{empty}
    \setlength{\columnsep}{0.4in}
    \setlength{\columnseprule}{1pt}

  \begin{document}
  \begin{multicols*}{3}
    \begin{center}
      \textbf{Logical Equivalences}
    \end{center}
    \tiny
    \begin{gather*}
      P \wedge T \equiv P\\
      P \vee F \equiv P\\\\
      P \vee T \equiv T\\
      P \wedge F \equiv F\\\\    
      P \wedge P \equiv P\\
      P \vee P \equiv P\\\\ 
      \neg (\neg P) \equiv P\\\\
      P \vee Q \equiv Q \vee P\\
      P \wedge Q \equiv Q \wedge P\\\\
      (P \vee Q) \vee R \equiv P \vee (Q \vee R)\\
      (P \wedge Q) \wedge R \equiv P \wedge (Q \wedge R)\\\\
      P \vee (Q \wedge R) \equiv (P \vee Q) \wedge (P \vee R)\\
      P \wedge (Q \vee R) \equiv (P \wedge Q) \vee (P \wedge R)\\\\
      \neg (P \wedge Q) \equiv \neg P \vee \neg Q\\
      \neg (P \vee Q) \equiv \neg P \wedge \neg Q\\\\  
      P \vee (P \wedge Q) \equiv P\\
      P \wedge (P \vee Q) \equiv P\\\\
      P \vee \neg P \equiv T\\
      P \wedge \neg P \equiv F\\\\ 
      P \implies Q \equiv \neg P \vee Q\\
      P \implies Q \equiv \neg Q \implies \neg Q\\
      P \vee Q \equiv \neg P \implies Q\\
      P \wedge Q \equiv \neg (P \implies \neg Q)\\
      \neg (P \implies Q) \equiv P \wedge \neg Q\\
      (P \implies Q) \wedge (P \implies R) \equiv P \implies (Q \wedge R)\\
      (P \implies Q) \vee (P \implies R) \equiv P \implies (Q \vee R)\\
      (P \implies R) \wedge (P \implies R) \equiv (P \vee Q)\implies R\\
      (P \implies R) \vee (P \implies R) \equiv (P \wedge Q)\implies R\\\\
      P \iff Q \equiv (P \implies Q) \wedge (Q \implies P)\\
      P \iff Q \equiv \neg P \iff \neg \neg Q\\
      P \iff Q \equiv (P \wedge Q) \vee (\neg Q \wedge \neg P)\\
      \neg (P \iff Q) \equiv P \iff \neg Q       
    \end{gather*}
  \end{multicols*}

  \end{document}

答案2

另一个解决方案是使用一个gather*环境,其中包含两个嵌入式aligned环境。(在两个aligned组中,对符号进行对齐\equiv。)

为了使所有方程式都适合该列,同时使用\small——不是\footnotesize\scriptsize或者,颤抖,\tiny——我们所需要做的就是为\implies倒数第二组四个方程式中的符号分配 mathord 状态。

在此处输入图片描述

\documentclass{article}
\usepackage{multicol, amsmath, geometry}
\geometry{a4paper,margin = 0.4in}
\pagenumbering{gobble}
\setlength{\columnsep}{0.5in}
\setlength{\columnseprule}{0.4pt} % 1pt looks rather heavy...

\begin{document}

\begin{multicols*}{3}

\begin{center}
\textbf{Logical Equivalences}
\end{center}
\small
\begin{gather*}
    P \wedge T \equiv P\\
    P \vee F \equiv P\\[3ex]
    P \vee T \equiv T\\
    P \wedge F \equiv F\\[3ex]    
    P \wedge P \equiv P\\
    P \vee P \equiv P\\[3ex] 
    \neg (\neg P) \equiv P\\[3ex]
    P \vee Q \equiv Q \vee P\\
    P \wedge Q \equiv Q \wedge P\\[3ex]
    (P \vee Q) \vee R \equiv P \vee (Q \vee R)\\
    (P \wedge Q) \wedge R \equiv P \wedge (Q \wedge R)\\[3ex]
    P \vee (Q \wedge R) \equiv (P \vee Q) \wedge (P \vee R)\\
    P \wedge (Q \vee R) \equiv (P \wedge Q) \vee (P \wedge R)\\[3ex]
    \neg (P \wedge Q) \equiv \neg P \vee \neg Q\\
    \neg (P \vee Q) \equiv \neg P \wedge \neg Q\\[3ex]  
    P \vee (P \wedge Q) \equiv P\\
    P \wedge (P \vee Q) \equiv P\\[3ex]
    P \vee \neg P \equiv T\\
    P \wedge \neg P \equiv F\\[3ex]
    \begin{aligned} 
    P \implies Q &\equiv \neg P \vee Q\\
    P \implies Q &\equiv \neg Q \implies \neg Q\\
    P \vee     Q &\equiv \neg P \implies Q\\
    P \wedge   Q &\equiv \neg (P \implies \neg Q)\\
    \neg (P \implies Q) &\equiv P \wedge \neg Q 
    \end{aligned} \\[3ex]
    (P {\implies} Q) \wedge (P {\implies} R) \equiv P {\implies} (Q \wedge R)\\
    (P {\implies} Q) \vee   (P {\implies} R) \equiv P {\implies} (Q \vee   R)\\
    (P {\implies} R) \wedge (P {\implies} R) \equiv (P \vee   Q){\implies} R\\
    (P {\implies} R) \vee   (P {\implies} R) \equiv (P \wedge Q){\implies} R\\[3ex]
    \begin{aligned}
    P \iff Q\phantom{)} &\equiv (P \implies Q) \wedge (Q \implies P)\\
    P \iff Q\phantom{)} &\equiv \neg P \iff \neg Q\\
    P \iff Q\phantom{)} &\equiv (P \wedge Q) \vee (\neg Q \wedge \neg P)\\
    \neg (P \iff Q) &\equiv P \iff \neg Q   
   \end{aligned}
\end{gather*}

\end{multicols*}

\end{document}

相关内容