# Customize cases environment

I usually use the cases environment in the amsmath package - it is very good:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{cases} x+y=2 \\ 2x+3y=4 \end{cases}$
\end{document}


Pic 1

## Question 1

However, in my country, the symbol doesn't really look like this. It is like this one instead - a slight change in the bracket:

Is it possible to redefine the cases environment so that it is like this:

Pic 2

Pic 3

Now honestly I have no idea of how to do this.

## Question 2

Beside the { we also have the [. Now, I am using the [ like in cases environment using gathered, also in the amsmath package:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\left[\begin{gathered} x=3\hfill\\ x=4\hfill \end{gathered}\right.$
\end{document}


Pic 4

However, like Question 1 above, I want to get this kind of square bracket:

Pic 5

How to do so? I'm sorry I don't have the slightest idea :(

Question 2.1

Furthermore, in my country, people prefer this

Pic 6

Similarly to the above questions, I found many difficulties and failed.

Any help in any question will be highly appreciated!

## Important Note

Pictures 2, 3, 5 and 6 are made with Windows Paint. As the spacing between lines in Euclid font is large, the spacing between two lines in the pictures are larger than I want. However the spacing I want is just normal, not that large. The default spacing in normal cases is perfect in this case.

It's relatively simple using \tikzmatrix.

I created two new environments (mycurly and mybrack) with an optional argument to indicate how many are the equations, in case they are more than two.

The code

\usepackage{expl3}
\ExplSyntaxOn
\int_new:N \g__prg_map_int
\ExplSyntaxOff


is needed only if you have an error like this:

! Undefined control sequence.
<argument> \g__prg_map_int


(Thank you to Joseph Wright for solving the issue.)

\documentclass[12pt,fleqn]{article}
\usepackage{amsmath}
\usepackage{environ}
\usepackage{tikz}
\usetikzlibrary{matrix}
% the following code is needed if you got the error
% ! Undefined control sequence.
% <argument> \g__prg_map_int
% see here
%https://tex.stackexchange.com/questions/463282/undefined-control-sequence-g-prg-map-int
% otherwise, leave it out
\usepackage{expl3}
\ExplSyntaxOn
\int_new:N \g__prg_map_int
\ExplSyntaxOff
% end of temporary code
\usetikzlibrary{decorations.pathreplacing, calligraphy, calc}
\tikzset{
mymatr/.style={
matrix of math nodes,
column sep = 10pt,
nodes={
anchor=text,
inner xsep=3pt
},
inner xsep=7pt,
ampersand replacement={\&},
}
}
\NewEnviron{mybrack}[1][2]{%
\begin{tikzpicture}[baseline=(mybase)]
\matrix[mymatr](A){
\BODY\\
};
\coordinate (mybase) at ($(A-1-1.text)!.5!(A-#1-1.text)$);
\draw[thick]([xshift=-6.4pt]A-1-1.west) -- +(4.4pt,0);
\foreach[evaluate=\mystep as \prev using int(\mystep-1)] \mystep in
{2,...,#1}{
\draw[thick]([xshift=-6pt]A-\prev-1.west) --
([xshift=-6pt]A-\mystep-1.west) -- + (4pt,0);
}
\end{tikzpicture}
}

\NewEnviron{mycurly}[1][2]{%
\begin{tikzpicture}[baseline=(mybase)]
\matrix[mymatr](A){
\BODY\\
};
\coordinate (mybase) at ($(A-1-1.text)!.5! (A-#1-1.text)$);
\draw[line width=.9pt,decorate,decoration={calligraphic
brace,amplitude=4pt, mirror}](A-1-1.west) -- (A-#1-1.west);
\end{tikzpicture}
}

\begin{document}
Environment which puts curly braces:
$\begin{mycurly} \frac{3}{4}x+y=2 \\ e^{2x}+3y=4 \end{mycurly}$
if you have more than 2 equation, you have to indicate their number in the
optional argument:
$\begin{mycurly}[3] \frac{3}{4}x+y=2 \\ e^{2x}+3y=4\\ \sqrt{x+3}+5z=0 \end{mycurly}$
$\begin{mycurly}[4] x+y=2 \\ 2x+3y=4 \\ 3x+5z=0 \\ \dfrac{7x}{x+9}+y+z=2 \end{mycurly}$
Environment which puts square brackets:
$\begin{mybrack} \frac{3}{4}x+y=2 \\ e^{2x}+3y=4 \end{mybrack}$
if you have more than 2 equation, you have to indicate their number in the
optional argument:
$\begin{mybrack}[3] \frac{3}{4}x+y=2 \\ e^{2x}+3y=4\\ \sqrt{x+3}+5z=0 \end{mybrack}$
$\begin{mybrack}[4] x+y=2 \\ 2x+3y=4 \\ 3x+5z=0 \\ \dfrac{7x}{x+9}+y+z=2 \end{mybrack}$
$f(x) = \begin{mycurly}[4] \dfrac{1}{3}x+y=2 \& \text{if }x<0 \\ 2x+3y=4 \& \text{if }0\leq x<1\\ 3x+5z=0 \& \text{if }1\leq x<2\\ \dfrac{7x}{x+9}+y+z=2 \& \text{if } x>2 \end{mycurly}$
$f(x) = \begin{mycurly}[3] 2x+3y=4 \& \text{if } x<1\\ 3x+5z=0 \& \text{if }1\leq x<2\\ \dfrac{7x}{x+9}+y+z=2 \& \text{if } x>2 \end{mycurly}$
$f(x) = \begin{mybrack}[4] \dfrac{1}{3}x+y=2 \& \text{if }x<0 \\ 2x+3y=4 \& \text{if }0\leq x<1\\ 3x+5z=0 \& \text{if }1\leq x<2\\ \dfrac{7x}{x+9}+y+z=2 \& \text{if } x>2 \end{mybrack}$
$f(x) = \begin{mybrack}[3] 2x+3y=4 \& \text{if } x<1\\ 3x+5z=0 \& \text{if }1\leq x<2\\ \dfrac{7x}{x+9}+y+z=2 \& \text{if } x>2 \end{mybrack}$