9

This is my LaTeX code:

\documentclass{amsart}

\usepackage{amsmath}

\begin{document}

\begin{align*}
\bigwedge_{i=1}^{2} &\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2}~p(i,j,n)=\\
=\left(\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2}\ p(1,j,n)\right) &\wedge \left(\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2}\ p(2,j,n)\right)=\\
=\left(\bigvee_{j=1}^{2}\ p(1,j,1)\wedge \bigvee_{j=1}^{2}\ p(1,j,2)\right) &\wedge \left( \bigvee_{j=1}^{2}\ p(2,j,1)\wedge \bigvee_{j=1}^{2}\ p(2,j,2)\right)=\\
=(p(1,1,1)\vee p(1,2,1))\wedge (p(1,1,2)\vee  p(1,2,2)) &\wedge (p(2,1,1)\vee p(2,2,1))\wedge (p(2,1,2)\vee p(2,2,2))
\end{align*}

\end{document}

Now it looks like:


I want to make it look like:


To show what exactly I mean, I made a red line below to show exact alignment that is needed:


How to do that?

vasili111
  • 377
  • You could use the \centerwithin comand from https://tex.stackexchange.com/questions/431853/fold-unfold-system-of-equations-in-long-derivation/431879?s=1|14.6221#431879 – John Kormylo Sep 15 '18 at 13:01
  • 1
    Also, the last line is too wide. – John Kormylo Sep 15 '18 at 13:12
  • @JohnKormylo \bigwedge_{i=1}^{2} &\centerwithin\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2}~p(i,j,n)=\\ complite code here: https://pastebin.com/Vsdbb5b9 deformates the formula like this: https://i.imgur.com/POVE5Lo.png – vasili111 Sep 15 '18 at 13:13

3 Answers3

5

Perhaps with an array? (I’m not convinced myself, anyway.)

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath}
\usepackage{array}



\begin{document}

Text before the equations.
\[
    \renewcommand*{\arraystretch}{2}
    \setlength{\arraycolsep}{0pt}
    \begin{array}{>{\displaystyle}r>{\displaystyle}c>{\displaystyle}l}
        \bigwedge_{i=1}^{2}\,\null &
            \bigwedge_{n=1}^{2} &
            \null\,\bigvee_{j=1}^{2}~p(i,j,n) = \\
        = \biggl(\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2}\ p(1,j,n)\biggr) &
            \wedge &
            \biggl(\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2}\ p(2,j,n)\biggr) = \\
        = \biggl(\bigvee_{j=1}^{2}\ p(1,j,1)\wedge \bigvee_{j=1}^{2}\ p(1,j,2)\biggr) &
            \wedge &
            \biggl( \bigvee_{j=1}^{2}\ p(2,j,1)\wedge \bigvee_{j=1}^{2}p(2,j,2)\biggr) = \\
        = \bigl(p(1,1,1)\vee p(1,2,1)\bigr)\wedge\bigl(p(1,1,2)\vee  p(1,2,2)\bigr) &
            \wedge &
            \bigl(p(2,1,1)\vee p(2,2,1)\bigr)\wedge\bigl(p(2,1,2)\vee p(2,2,2)\bigr)
    \end{array}
\]
Text after the equations.

\end{document}

Note that I changed the sizes of many of the parentheses, and that I wouldn’t recommend repeating the “=” sign at the beginning of the lines. Moreover, the resulting equation doesn’t fit in the allowed text width.

Here’s the output:

Output of the code

GuM
  • 21,558
4

This measures the big wedge once and uses \mathmakebox subsequently.

\documentclass{amsart}
\usepackage{mathtools}
\usepackage{showframe}% debugging tool

\newsavebox{\tempbox}% can probably use box 0-9

\begin{document}

\scriptsize
\savebox{\tempbox}{$\displaystyle \bigwedge_{n=1}^{2}$}% must be outside environment
\begin{align*}
\bigwedge_{i=1}^{2} &\usebox{\tempbox} \bigvee_{j=1}^{2}~p(i,j,n)\\
=\left(\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2}\ p(1,j,n)\right) &\mathmakebox[\wd\tempbox]{\wedge} \left(\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2}\ p(2,j,n)\right)\\
=\left(\bigvee_{j=1}^{2}\ p(1,j,1)\wedge \bigvee_{j=1}^{2}\ p(1,j,2)\right) &\mathmakebox[\wd\tempbox]{\wedge} \left( \bigvee_{j=1}^{2}\ p(2,j,1)\wedge \bigvee_{j=1}^{2}\ p(2,j,2)\right)\\
=(p(1,1,1)\vee p(1,2,1))\wedge (p(1,1,2)\vee  p(1,2,2)) &\mathmakebox[\wd\tempbox]{\wedge} (p(2,1,1)\vee p(2,2,1))\wedge (p(2,1,2)\vee p(2,2,2))
\end{align*}

\end{document}

demo

John Kormylo
  • 79,712
  • 3
  • 50
  • 120
4

The final row is much too long to fit inside the text block defined by the amsart document class; you'll have to break that expression across lines. Once the need for that line break is established, aligning the other rows in the way you've laid out in your query has little appeal. The upshot: Just use a simple align* environment and be done with it.

Note also that the parentheses produced by \left and \right are too large, typographically speaking. Use \bigg-sized parentheses instead.

enter image description here

\documentclass{amsart} % automatically loads 'amsmath' package
\begin{document} 
\begin{align*}
&\bigwedge_{i=1}^{2} \bigwedge_{n=1}^{2} \bigvee_{j=1}^{2} p(i,j,n) \\
&\quad= \biggl(\,\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2} p(1,j,n)\biggr) 
 \wedge\biggl(\,\bigwedge_{n=1}^{2} \bigvee_{j=1}^{2} p(2,j,n)\biggr) \\
&\quad= \biggl(\,\bigvee_{j=1}^{2} p(1,j,1)\wedge \bigvee_{j=1}^{2} p(1,j,2)\biggr) 
  \wedge\biggl(\,\bigvee_{j=1}^{2} p(2,j,1)\wedge \bigvee_{j=1}^{2} p(2,j,2)\biggr)\\
&\quad= (p(1,1,1)\vee p(1,2,1))\wedge (p(1,1,2)\vee p(1,2,2)) \\
&\qquad\qquad \wedge (p(2,1,1)\vee p(2,2,1))\wedge (p(2,1,2)\vee p(2,2,2))
\end{align*}
\end{document}
Mico
  • 506,678