6

I have the following code of maths equation in a box :

\begin{framed}
\begin{align*}
&C_\star \rightarrow E_\star :  &x=3\dfrac{5\phi^2+24\phi+12v+24}{\phi^2}, &y=108\dfrac{-\phi^3+5\phi^2+2\phi v+12\phi+4v+8}{\phi^3}\\
&E_\star \rightarrow C_\star :  &\phi=12\dfrac{6-x}{6x-y-198}, &v=2\dfrac{x^3-18x^2+3267x-324y-71658}{x^3+36x^2-12xy-5643x+396y+84834}
\end{align*}
\end{framed}

Everything is fine except that x and \phi is not aligned. Is there anything wrong with the code as I want to make sure x aligns with \phi and y aligns with v.enter image description here

6

Doubling ampersands gives the desired result:

\documentclass{article}
\usepackage{amsmath}
\usepackage{framed}
\begin{document}    


\begin{framed}
\begin{align*}
&C_\star \rightarrow E_\star :  &&x=3\dfrac{5\phi^2+24\phi+12v+24}{\phi^2}, &&y=108\dfrac{-\phi^3+5\phi^2+2\phi v+12\phi+4v+8}{\phi^3}\\
&E_\star \rightarrow C_\star :  &&\phi=12\dfrac{6-x}{6x-y-198}, &&v=2\dfrac{x^3-18x^2+3267x-324y-71658}{x^3+36x^2-12xy-5643x+396y+84834}
\end{align*}
\end{framed}

\end{document}

enter image description here

| improve this answer | |
  • Could you perhaps give any insight why and how a double ampersand behaves differently from a single one? – Daniel Nov 3 '15 at 8:53
3

You possibly want to have a look at empheq:

\documentclass{article}
\usepackage[a4paper,margin=2cm]{geometry} % or whatever options
\usepackage{amsmath}
\usepackage{empheq}

\begin{document}

\begin{empheq}[box=\fbox]{alignat*=3}
&C_\star \rightarrow E_\star
  &{}: x&=3\dfrac{5\phi^2+24\phi+12v+24}{\phi^2},\quad
  &    y&=108\dfrac{-\phi^3+5\phi^2+2\phi v+12\phi+4v+8}{\phi^3}\\
&E_\star \rightarrow C_\star
  &{}: \phi&=12\dfrac{6-x}{6x-y-198},\quad
  &    v&=2\dfrac{x^3-18x^2+3267x-324y-71658}{x^3+36x^2-12xy-5643x+396y+84834}
\end{empheq}

\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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