5

The closest solution to what I'm looking for that I've been able to come up with so far is this

\[
\begin{align*}
A & = & B & C\\
& = & B & (D\\
& & + & E)
\end{align*}
\]

which produces this

output of the previous code

Now that's fairly close to what I'm intending. D and E are fairly large expressions, so I have to put them on separate lines and having them aligned like this is aesthetically quite pleasing. But there's this mysterious gap between the equal signs and the B's. Is there a way to get rid of that? Or perhaps a wholly different approach to typesetting this?

2 Answers2

5

I’m not sure I’ve understood what you want to do, but I’d go for something like this:

% 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. \usepackage[utf8]{inputenc} % Not always necessary, but recommended. % End of standard header. What follows pertains to the problem at hand.

\usepackage{amsmath}

\begin{document}

An example: \begin{equation} \begin{split} A &= \text{1st fairly large expr.}\cdot C \ &=\text{1st fairly large expr.} \cdot \begin{aligned}[t] & (\text{2nd fairly large expr.} \ & \quad + \text{3rd fairly large expr.}) \end{aligned} \end{split} \end{equation} This assumes that you want to label the whole block with a single equation number.

\end{document}

This is the output:

Output of the code sample


Another option

If you want each line to be numbered, use alignat:

% 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. \usepackage[utf8]{inputenc} % Not always necessary, but recommended. % End of standard header. What follows pertains to the problem at hand.

\usepackage{amsmath}

\newcommand*{\myexpr}[1]{% \langle\text{#1 fairly large expr.}\rangle }

\begin{document}

An example: \begin{equation} \begin{split} A &= \myexpr{1st} \cdot C \ &= \myexpr{1st} \cdot \begin{aligned}[t] & (\myexpr{2nd} \ & \quad + \myexpr{3rd}) \end{aligned} \end{split} \end{equation} This assumes you want to label the whole block with a single equation number. Individual lines can be numbered with the help of the \texttt{alignat} environment:

\begin{alignat}{2} A &= \myexpr{1st} && \cdot C \ &= \myexpr{1st} && \cdot (\myexpr{2nd} \notag \ % no number on this line & && \mathbin{\hphantom{\cdot}} \quad {} + \myexpr{3rd}) \end{alignat} We've also shown how to suppress the equation number on a particular line.

\end{document}

Note how the nature of binary operator of the phantom \cdot is preserved, so that it is properly spaced.

The output is:

Output of the second code sample

GuM
  • 21,558
1

Here are two options:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

Option 1:
\begin{align*}
  A = {} & B C \\
    = {} & B (D \\
         & \phantom{B} + E)
\end{align*}

Option 2:
\begin{align*}
  A &= B C \\
    &= B (D \\
    &\phantom{{}= B} + E)
\end{align*}

\end{document}

Since you're splitting the parentheses across multiple lines, you can't use \left-\right. For more on this, see How to make \left, \right pairs of delimiter work over multiple lines?

Werner
  • 603,163