Math & Scienceputting brackets across multiple alligned lines

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
kardo
Posts: 3
Joined: Wed Jan 06, 2010 5:36 pm

putting brackets across multiple alligned lines

Post by kardo »

Hey I'm trying to put a bracket around 2 lines which need to be alligned with a 3rd line. After trying several tricks, I haven't found the solution yet. This is as far as I came.

Code: Select all

\begin{equation}
\begin{split}
  2\times\left[ \begin{split}
    ^1H + ^1H &\longrightarrow ^2H + e^+ + \nu_e  \\
    {}^2H + {}^1H &\longrightarrow {}^2He + \gamma 
  \end{split} \right] \\
  {}^3He + {}^3He &\longrightarrow {}^4He + {}^1H + {}^1H
\end{split}
\end{equation}
Does anyone know how to do this properly?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

putting brackets across multiple alligned lines

Post by php1ic »

This seems like an ugly way of doing it, but I can't think of another way

Code: Select all

\begin{equation}
\begin{matrix}
  2\times
  \begin{bmatrix}
    ^{1}H &+& ^{1}H &\longrightarrow& ^{2}H &+& e^{+} &+& \nu_{e}  \\
    ^{1}H &+& ^{1}H &\longrightarrow& ^{2}He &+& \gamma 
  \end{bmatrix}\\[1em]
  \phantom{2\times\,}
  \begin{matrix}
    ^{3}He &+& ^{3}He &\longrightarrow& ^{4}He &+& ^{1}H &+& ^{1}H
  \end{matrix}
\end{matrix}
\end{equation}
The \phantom{} bit keeps the arrows aligned.
kardo
Posts: 3
Joined: Wed Jan 06, 2010 5:36 pm

Re: putting brackets across multiple alligned lines

Post by kardo »

Hey thanks for the answer, there's just one problem with it, and that is that you aligned the +'s which doesn't conform with the rest of the equations I made. I tried removing the alignment on the +'s but now the bottom line is misaligned again :(
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

putting brackets across multiple alligned lines

Post by localghost »

You can try the following example that works with an array environment.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage[version=3]{mhchem}
\usepackage{lmodern}

\begin{document}
  \begin{equation}
    \begin{array}{@{}r@{}r@{\,\longrightarrow\,}l@{}l@{}}
      \multirow{2}{*}{$2\times\Bigl[$} & \ce{^1H + ^1H} & \ce{^2H + e^+ + \nu_e} & \multirow{2}{*}{$\Bigr]$} \\
      & \ce{^2H + ^1H} & \ce{^2He + \gamma} & \\
      & \ce{^3He + ^3He} & \ce{^4He + ^1H + ^1H} &
    \end{array}
  \end{equation}
\end{document}
However, I consider this a dirty trick. As you will notice, the alignment of the brackets depends on the length of the last line.


Best regards
Thorsten
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

putting brackets across multiple alligned lines

Post by php1ic »

Modifying my suggestion to align only the arrows

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{tensor}

\begin{document}

\begin{equation}
\begin{matrix}
  2\times
  \begin{bmatrix}
    ^{1}H + ^{1}H &\longrightarrow& ^{2}H + e^{+} + \nu_{e}  \\
    ^{1}H + ^{1}H &\longrightarrow& \hspace{-2.25em}^{2}He + \gamma
  \end{bmatrix}\\[1em]
  \phantom{2\times\hspace{0.6em}}
  \begin{matrix}
    \nuclide[3][]{He} + \nuclide[3][]{He} &\longrightarrow& \nuclide[4][]{He} + \nuclide[1][]{H} + \nuclide[1][]{H}
  \end{matrix}
\end{matrix}
\end{equation}

\end{document}
but it seems there is no getting round manual adding spacing.

If you often write nuclei, the tensor package provides the \nuclide[A][Z]{X} command which I have used for the final line. It is very useful once A>100.

http://www.ctan.org/tex-archive/macros/ ... ib/tensor/
kardo
Posts: 3
Joined: Wed Jan 06, 2010 5:36 pm

putting brackets across multiple alligned lines

Post by kardo »

ah thanks a lot.

I don't have to use nuclei a lot, I just had to use them for solar fusion. I wrote a command

Code: Select all

\newcommand{\elem}[3]{\ensuremath{{}^{#1}_{#2}\mathrm{#3}}}
but removed that command from my sample code, but I only just realised now, I could have simply added in the newcommand line...
Post Reply