Aligning numbering in a system of equation so it's centered
Not too beautifull, but gives the desired effect:
\documentclass{amsart}
\begin{document}
\newlength\Ilength
\settowidth{\Ilength}{I}
\[
\begin{cases}
2y+4x=9 & \text{\hspace{0.5\Ilength}(I)} \\ 3x-2x=10 & \text{(II)}
\end{cases}
\]
\end{document}
You can be bold and redefine cases
to take an optional argument for specifying the alignment in the second column:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewcommand\env@cases[1][l]{%
\let\@ifnextchar\new@ifnextchar
\left\lbrace
\def\arraystretch{1.2}%
\array{@{}l@{\quad}#1@{}}%
}
\makeatother
\begin{document}
Here is a system
\[
\begin{cases}[c]
2y+4x=9 & \text{(I)} \\
3x-2x=10 & \text{(II)}
\end{cases}
\]
and here a famous function
\[
f(x)=\begin{cases}
0 & \text{if $x$ is rational} \\
1 & \text{if $x$ is irrational}
\end{cases}
\]
\end{document}
Explanation: in the original definition of \env@cases
there is
\array{@{}l@{\quad}l@{}}%
so we can easily change the second l
to be what we like more.
If you prefer to use systeme
, as suggested in another answer, here's the way:
\documentclass{article}
\usepackage{systeme}
\begin{document}
\[
\syscodeextracol{\quad\hfil}{\hfil\hfil}
\systeme{
2y+4x=9@(I),
3x-2y=10@(II)
}
\]
\end{document}
For automatically numbered equations, here's the trick:
\[
\syscodeextracol{\quad\hfil}{\hfil\hfil}
\systeme{
2y+4x=9@(\uppercase\expandafter{\romannumeral*}),
3x-2y=10@(\uppercase\expandafter{\romannumeral*})
}
\]
Don't try to reinvent the wheel.
\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{systeme,mathtools}
\syscodeextracol{\quad\hfill}{\hfill}
\sysautonum*{(\uppercase\expandafter{\romannumeral*})}
\begin{document}
\abovedisplayskip=0pt\relax% don't use this line in your production.
\[
\systeme{
2y+4x=91,
3x-2y=10}
\]
\end{document}
With systeme
package, you will get 2 advantages:
The coefficients of the system of equations will be automatically arranged. We typed
2y+4x=9 3x-2y=10
but they will be rendered as
4x+2y=9 3x-2y=10
The equation numbers will be automatically generated without our awareness.