# An error in aligning several systems of linear equations using systeme

I have code to typeset four systems of linear equations. I have all the equations aligned at the equals sign. In the first equation of the second system, I have

+ 0 = (q-m)x + b_{1},

but I want

0 = (q-m)x + b_{1},

and in the second equation of the second system, I have a gap between y and the equals sign. In the first equation of the third and fourth systems, there is a gap between x and the equals signs.

Also, I would like to add a comma after the first three systems of equations and a period after the last system of equations. I understand that , indicates a new equation within a \systeme command. So, I couldn't use , to have LaTeX typeset a comma within this environment. Anyway, I would want these punctuation marks centered between the two lines in each system of equations.

\documentclass{amsart}
\usepackage{mathtools,systeme,array}

\begin{document}

\begin{align*}
\systeme{y = \mathrlap{qx + b_{1}}, y = \mathrlap{mx}} \\
\systeme{0 = \mathrlap{(q - m)x + b_{1}}, y = \mathrlap{mx}} \\
\systeme{x = \mathrlap{\dfrac{b_{1}}{m - q}}, y = \mathrlap{mx}} \\
\systeme{x = \mathrlap{\dfrac{b_{1}}{m - q}}, y = \mathrlap{\dfrac{mb_{1}}{m - q}}}
\end{align*}

\end{document}


Instead of using four systeme environments, you could use four array environments embedded in an align* environment.

\documentclass{amsart}
\begin{document}

\begin{align*}
&\bigg\{ \begin{array}{r @{{}={}} l}
y & qx + b_{1}\\y & mx
\end{array},\\
&\bigg\{ \begin{array}{r @{{}={}} l}
0 & (q - m)x + b_{1}\\y & mx
\end{array},\\
&\bigg\{ \begin{array}{r @{{}={}} l}
x & b_{1}/(m - q)\\y & mx
\end{array},\\
&\bigg\{ \begin{array}{r @{{}={}} l}
x & b_{1}/(m - q)\\y & mb_{1}/(m - q)
\end{array} .
\end{align*}

\end{document}


Addendum: Per your requst, here's a version of the system of equations that uses \dfrac macros instead of inline fractions for the final two systems. Because the curly braces in systems 3 and 4 are larger than those in systems 1 and 2, further horizontal spacing adjustments are also required to align the = symbols. (The need to perform horizontal spacing adjustments arises irrespective of whether array or systeme* environments are used.)

\documentclass{amsart}
\usepackage{mleftright} % "\mleft\{" avoids some spacing issues caused by "\left\{"
\begin{document}

\begin{align*}
&\bigg\{ \begin{array}{r @{{}={}} l}
y & qx + b_{1}\\y & mx
\end{array},\\
&\bigg\{ \begin{array}{r @{{}={}} l}
0 & (q - m)x + b_{1}\\y & mx
\end{array},\\
&\Bigg\{ \mkern-1.7mu \begin{array}{r @{{}={}} l}
x & \dfrac{b_{1}}{m - q}\1.5ex]y & mx \end{array},\\ &\mleft\{ \mkern-3.2mu\begin{array}{r @{{}={}} l} x & \dfrac{b_{1}}{m - q}\\[2.5ex] y & \dfrac{mb_{1}}{m - q} \end{array} \mright. \,. \end{align*} \end{document}  Second Addendum: If you really don't want to eyeball-adjust the horizontal alignment of the large curly braces relative to their associated two-line systems of equations (each of which is placed in an array environment), I can only suggest you place the four arrays in the right-hand column of an "outer" two-column array: The left-hand column then contains the associated curly braces, sized via \vphantom directives. \documentclass{amsart} \usepackage{mleftright,array} \begin{document} %% First, define the four systems as arrays \def\sysa{\begin{array}{r @{{}={}} l} y & qx + b_{1}\\y & mx \end{array}} \def\sysb{\begin{array}{r @{{}={}} l} 0 & (q - m)x + b_{1}\\y & mx \end{array}} \def\sysc{\begin{array}{r @{{}={}} l} x & \dfrac{b_{1}}{m - q}\\[1.5ex] y & mx \end{array}} \def\sysd{\begin{array}{r @{{}={}} l} x & \dfrac{b_{1}}{m - q}\\[2.5ex] y & \dfrac{mb_{1}}{m - q} \end{array}} %% Second, place the systems in the right-hand column of an "outer" array %% Each system array is featured twice: Inside a \vphantom statement in %% the left-hand column, to determine the size of the curly brace, and %% again in the right-hand column as itself. \[ \begin{array}{l@{}l} \mleft\{ \vphantom{\sysa} \mright. & \sysa \\[2.5ex] \mleft\{ \vphantom{\sysb} \mright. & \sysb \\[2.5ex] \mleft\{ \vphantom{\sysc} \mright. & \sysc \\[3.8ex] \mleft\{ \vphantom{\sysd} \mright. & \sysd \end{array}

\end{document}

• I prefer your code. May you give it to me with the the quotients typeset using the \dfrac commands? – Adelyn May 26 '15 at 18:44
• @Adelyn - Done. Note that the use of \dfrac instead of inline fractions requires both vertical as well as horizontal spacing adjustments -- that's why I had posted the inline fraction version first... :-) – Mico May 26 '15 at 19:08
• @Adelyn - On the horizontal spacing adjustments: The first three systems involve \bigg and \Bigg left curly braces, which do not insert whitespace on their left; that's why I suggest using \mleft\{ rather than \left\{ for the curly brace for system 4. Because the curly braces in systems 3 and 4 are taller than those in systems 1 and 2, they are also a bit wider, requiring some adjustment on their right. The adjustment directives \mkern-1.7mu and \mkern-3.2mu -- \mkern-3mu is equivalent to \!, by the way -- were chosen by eyeballing the results. – Mico May 27 '15 at 3:38
• @Adelyn - For what it's worth, if you look closely at both of egreg's solutions, you'll notice that the = symbols in systems 3 and 4 are not perfectly aligned with those in systems 1 and 2; this is a consequence of the fact that the curly braces in systems 3 and 4 are (slightly) wider than those in systems 1 and 2. An spacing adjustment somewhere between \mkern-1.5mu and \mkern-2mu would seem necessary to bring about alignment of all four = symbols. – Mico May 27 '15 at 3:44
• @Adelyn - I don't think your idea (of avoiding eyeball-based horizontal adjustments) can be accomplished along the lines you suggest. I've edited my answer to provided a second addendum, in which I show how the idea may be implemented using nested array environments. – Mico May 28 '15 at 4:13

You want to use \systeme*, which doesn't do alignment. For the second, you also have to declare 0 as a variable. In the ones with the fraction I added a supplementary vertical spacing.

\documentclass{amsart}
\usepackage{systeme}

\begin{document}

\begin{align*}
&\systeme*{y = qx + b_{1}, y = mx} \\
&\systeme*[var=x,y,0]{0 = (q - m)x + b_{1}, y = mx} \\
&\syslineskipcoeff{1.75}\systeme*{x = \dfrac{b_{1}}{m - q}, y = mx} \\
&\syslineskipcoeff{1.75}\systeme*{x = \dfrac{b_{1}}{m - q}, y = \dfrac{mb_{1}}{m - q}}
\end{align*}

\end{document}


You can improve the spacing and add punctuation (but I'd avoid commas and periods); for a comma, place it in braces, so it will be invisible to the equation scanner.

\documentclass{amsart}
\usepackage{systeme}

\begin{document}

\begin{align*}
&\systeme*{y = qx + b_{1}, y = mx{\;,}} \\
&\systeme*[var=x,y,0]{0 = (q - m)x + b_{1}, y = mx{\;,}} \\
&\syslineskipcoeff{1.75}\systeme*{x = \dfrac{b_{1}}{m - q}, y = mx{\;,}} \\
&\syslineskipcoeff{2.25}\systeme*{x = \dfrac{b_{1}}{m - q}, y = \dfrac{mb_{1}}{m - q}{\;.}}
\end{align*}

\end{document}


• The two \dfracs in the final systeme* seem awfully close to each other. – Mico May 26 '15 at 18:22
• @egreg That is (almost) the display that I wanted. How do I add the punctuation marks? – Adelyn May 26 '15 at 18:26
• @egreg Are you saying that systeme aligns at the left brace? I think that I tried using it and there was no alignment with the left brace. – Adelyn May 26 '15 at 18:28
• @egreg You use \syslineskipcoeff{1.75} in both the third and fourth systems of linear equations. The line separations appear differently, though. – Adelyn May 26 '15 at 18:31
• @Adelyn I don't know where the commas should be placed, so I didn't add them. The systems are left aligned because of the & that precedes each one. The separation is the same in the last two systems, but the fourth has a taller second equation; increase the value. – egreg May 26 '15 at 19:41