5

Recently I asked a question on chat but I was told that I have to ask it on the main site, so here I am.

I am using cases environment to create multiple system of equations separated by a symbol e.g. \equiv. Here is an example:

\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}

\begin{document}

\[
\begin{cases}
x+y=2,\\x=2
\end{cases}
\equiv
\begin{cases}
2+y=2,\\x=2
\end{cases}
\]

\end{document}

What I have done

However, as you can see there is a huge space between the end of the first cases and the \equiv. This is due of the absence of & symbol in cases, but I do not want to add this symbol to fill the space. So a manual, inefficient and even incorrect solution that I found was to add negative space, let's say add 5/6 \!'s just before \equiv.

If I add 5 negative spaces then there is more space on one side than on the other:

What happens if we add five !

If I add 6 negative spaces then the same thing happens as before:

The same thing happens

More than 6 or less than 5 will cause a worse output.

I would like that, keeping the same format of system of equations, there would be a homogeneous space on both sides of each cases. Is it possible?

Thanks!!

P.S. I would also like to know if in a system of equations you would separate each equation by a , except in the last equation that appears, that is, in the one below (unless there is a text that continues with the reading or that ends the sentence). Does AMS Style Guide say something about this?

  • 1
    If we use \left\{\begin{array}{l}...\end{array}\right. instead of cases then the space between the left brace and the system of equations should also be corrected, in addition to solve the problem of space between the environment and any consequent symbol. – manooooh Feb 22 at 6:54
3

You could use aligned

\documentclass{article}
\usepackage{amsmath}

\newenvironment{system}
  {\[\left\lbrace\aligned}
  {\endaligned\right.\]\ignorespacesafterend}

\begin{document}
Example:
\begin{system}
&x+y=2\\&x=2
\end{system}


\end{document}
  • I end up with \[\begin{system}&x+y=2\\&x=2\end{system}\] since I have more than one system in one line, but this is great and simple, thank you! – manooooh Feb 23 at 22:44
  • I am getting "Missing control sequence inserted" when I use ' and write all in one line: try \[\begin{system}&a'=2\\&b'=2\end{system}\]. To solve this, I have to insert a blank space between \begin{system} and \end{system}, so suppose that \\ represents a new line i.e. an "Enter", so I have to do \[\begin{system}\\&a'=2\\&b'=2\\\end{system}\]. I am writing a lot of these systems in my document, so I want to write it inline in my source code. How can we fix that? – manooooh Feb 23 at 22:53
  • @manooooh as requested the \[ is inside the definition of system so of course you can not put \begin{system} in math, that would be \[\[\begin{ligned} with two \[ . – David Carlisle Feb 24 at 0:42
  • I need to write \begin{system}&a+b\\&-a-b\end{system}, but the minus sign is shifted to the right (because it is a binary operator, as expected). How could we fix this: using \!-a-b? – manooooh Mar 28 at 22:25
  • There is a problem when adding \usepackage{mathtools}. – manooooh Mar 28 at 23:22
2

Remove the intercolumn space and also the null delimiter space.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newenvironment{system}
 {%
  \let\@ifnextchar\new@ifnextchar
  \left\lbrace
  \def\arraystretch{1.2}%
  \array{@{}l@{}}%
 }
 {%
  \endarray
  \right.\kern-\nulldelimiterspace
 }
\makeatother

\begin{document}

\[
\begin{system}
x+y=2,\\x=2
\end{system}
\equiv
\begin{system}
2+y=2,\\x=2
\end{system}
\]

\end{document}

enter image description here

I have doubts your readers will understand what you mean here.

  • This is just what I wanted, thank you!! Could you help me in deciding if a comma is OK to separate different equations inside a system environment (unless there is a text that continues with the reading or that ends the sentence) like I said on the P.S., please? – manooooh Feb 22 at 20:17
  • 1
    @manooooh I wouldn't use it – egreg Feb 22 at 21:11
  • Ok. If the system of equations ends the sentence, would you write a dot in the end of the last equation (from your answer, x=2.\end{system})? – manooooh Feb 22 at 22:57
  • 1
    @manooooh I'd avoid ending the sentence with a system. It's easier. – egreg Feb 22 at 22:59
2
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[usestackEOL]{stackengine}
\stackMath
\setstackgap{L}{16pt}
\begin{document}
\[
\biggl\{\Centerstack[l]{x+y=2,\\x=2}
\equiv
\biggl\{\Centerstack[l]{2+y=2,\\x=2}
\]
\end{document}

enter image description here

  • This is good. However, I would not like to modify any format except the spacing. Thanks! – manooooh Feb 22 at 20:18
  • 1
    @manooooh I understand. I put it out there for others to consider as an alternative. – Steven B. Segletes Feb 22 at 20:27
1

Consider using the systeme package.

The grouped equations in your example are really systems of equations and not cases. And, as egreg says, someone trying to grasp the meaning from your code may be confused by the misattribution.

  • Yes... you are right, it can lead to confusion. I do not accept your answer as I value more saving to load a package than to load it, but thanks! – manooooh Feb 22 at 20:19

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.