Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In follow up to my previous question, I wanted to align two arrows and put curly braces around them. The following works fine

\documentclass{article}
\usepackage[margin=2cm,centering]{geometry}
\usepackage{amsmath}
\usepackage{mathtools}
\newcommand*{\myrightarrow}[1]{\xrightarrow{\mathmakebox[5cm]{#1}}}
\newcommand*{\myleftarrow}[1]{\xleftarrow{\mathmakebox[5cm]{#1}}}

\begin{document}

\noindent\fbox{\begin{minipage}{\dimexpr6.5in-2\fboxsep-2\fboxrule\relax}
{\bfseries Alice \hfill Bob}
\begin{align*}
&\myleftarrow{a}
\\
&\myrightarrow{}
\\
\{&\begin{array}{c}
\myleftarrow{q} \\
\myrightarrow{k}
\end{array} 
\}
\\
&\myleftarrow{c}
\\
\end{align*}
\end{minipage}}

\end{document}

The issue is that I need to make the curly braces fit around the array. From what I read, replacing \{ with \left\{ and \} with \right\} should work. But it gives me errors when I do this:

\documentclass{article}
\usepackage[margin=2cm,centering]{geometry}
\usepackage{amsmath}
\usepackage{mathtools}
\newcommand*{\myrightarrow}[1]{\xrightarrow{\mathmakebox[5cm]{#1}}}
\newcommand*{\myleftarrow}[1]{\xleftarrow{\mathmakebox[5cm]{#1}}}


\begin{document}

\noindent\fbox{\begin{minipage}{\dimexpr6.5in-2\fboxsep-2\fboxrule\relax}
{\bfseries Alice \hfill Bob}
\begin{align*}
&\myleftarrow{a}
\\
&\myrightarrow{}
\\
\left\{&\begin{array}{c}
\myleftarrow{q} \\
\myrightarrow{k}
\end{array} 
\right\}
\\
&\myleftarrow{c}
\\
\end{align*}
\end{minipage}}
\end{document}

Any suggestions? Thanks!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The problem is the & after \left\{. If you just want to center the arrows, you could try the other solution (without explicit alignment characters) or another approach with

\documentclass{article}
\usepackage[margin=2cm,centering]{geometry}
\usepackage{amsmath}
\usepackage{mathtools}
\newcommand*{\myrightarrow}[1]{\xrightarrow{\mathmakebox[5cm]{#1}}}
\newcommand*{\myleftarrow}[1]{\xleftarrow{\mathmakebox[5cm]{#1}}}


\begin{document}

\fbox{\begin{minipage}{\dimexpr6.5in-2\fboxsep-2\fboxrule\relax}
\centering
{\bfseries Alice \hfill Bob}

$\myleftarrow{a}$

$\myrightarrow{}$

$\left\{\begin{array}{@{}c@{}}
\myleftarrow{q} \\
\myrightarrow{k}
\end{array} 
\right\}$

$\myleftarrow{c}$

\end{minipage}}

\end{document}

enter image description here

share|improve this answer
    
Perfect. Thank you! –  AFS Apr 19 '13 at 4:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.