5

Here is some code that produces a display equation with nested parentheses indented to different depths.

\documentclass{amsart}
\begin{document}
\begin{align*}
(\exists d)
    &\biggl(
        l'(u,d)
        \wedge l'(v,d)
        \wedge
        \bigl(\forall z\bigr)
        \bigl(l'(z,d)\to(z=u\vee z=v)\bigr)\\
    &\hspace{34pt}\begin{array}{rl}
            \wedge~
            (\exists p)(\exists q)
                &\Bigl(
                    cod(p)=d\wedge cod(q)=d
                    \wedge l'\bigl(dom(p),d\bigr)
                    \wedge l'\bigl(dom(q),d\bigr)\\
                &\hspace{49pt}\begin{array}{rl}
                            \wedge~
                            (\forall t)
                                &\Bigl(
                                    \bigl( cod(t)=d\wedge
                                    l'(dom(t),d)\bigr)\\
                                &\hspace{33pt}\to\bigl(t=p\vee t=q\bigr)\\
                                &\hspace{7pt}\Bigr)
                            \end{array}\\
                        &\hspace{7pt}\Bigr)
                    \end{array}
\\&\hspace{7pt}\biggr)
\end{align*}
\end{document}

Is there an environment that can automatically handle parenthesis indentation like this? If not, is there a way to automate the indentation of parentheses so that the it does not need to be handled manually in this way? Thanks.

3
  • 1
    It appears that alignment is performed, alternatingly, on parentheses and \wedge symbols. Is this impression correct? Separately, the terms cod and dom May be "operators" and thus should be typeset using upright letters; is this the case?
    – Mico
    Dec 27, 2014 at 10:30
  • Remember, you can use other parentheses/brackets too, to get more visual variation without sizes running wild. Depending on context [...{...(...)...}...] may be usable. Dec 27, 2014 at 16:32
  • @Mico -- that is correct, this example involves alternating indentation of parentheses and \wedge symbols.
    – Jasha
    Dec 27, 2014 at 22:56

1 Answer 1

3

Not a fully automatic solution, but with code that's quite a bit simpler than in your posting. It uses only one type of alignment structure: aligned. The environment is used to perform alignment on both parentheses and on \wedge symbols.

The positioning of the closing large parentheses is fine-tuned using \mkern ("math-mode kern") directives. I also suggest setting "cod" and "dom" in an upright font if they're "operators".

enter image description here

\documentclass{amsart}
\DeclareMathOperator{\dom}{dom}
\DeclareMathOperator{\cod}{cod}
\begin{document}
\[
(\exists d)
\begin{aligned}[t]
   &\biggl(
      l'(u,d)
      \begin{aligned}[t]
         &\wedge l'(v,d)
            \wedge \bigl(\forall z\bigr)
            \bigl(l'(z,d)\to(z=u\vee z=v)\bigr)\\
         &\wedge (\exists p)(\exists q)
         \begin{aligned}[t]
            &\Bigl( \cod(p)=d
            \begin{aligned}[t]
               &\wedge \cod(q)=d
                    \wedge l'\bigl(\dom(p),d\bigr)
                    \wedge l'\bigl(\dom(q),d\bigr)\\
               &\wedge (\forall t)
               \begin{aligned}[t]
                  &\Bigl( \bigl( \cod(t)=d\wedge l'(\dom(t),d)\bigr)\\
                  &\qquad\qquad \to\bigl(t=p\vee t=q\bigr)\\
                  &\mkern2mu\Bigr)
               \end{aligned}\\
            \end{aligned}\\
            &\mkern2mu\Bigr)
         \end{aligned}\\
      \end{aligned}\\
   &\mkern2.5mu\biggr)
\end{aligned}
\]

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .