# Labelling equations with eqnarray

I would like to produce the following output:

To be precise, I would like the two equations to be aligned as produced by \eqnarray*, and the two labels L_1 and L_2 to also be aligned. I could use \begin{array}{crcl} L_1& left side & = & right side \end{array}, but then there is too much space before and after the = sign. I think I could adjust that space with some parameters, but I would like this to work also on a web page with MathJax, and in any case I feel there should be a better way to do it. The way I produced that output works but I don't feel is the right way to do it, here is what I did:

\begin{eqnarray*}
L_1: \hspace{3.1ex} x+y&=&1\\
L_2: \hspace{1ex} 2x+2y&=&2
\end{eqnarray*}

• You shouldn't use eqnarray – the spacing around the = signs is not good. – Bernard Jun 25 '19 at 16:46

The alignat environment from amsmath gives you full control on the spacing between columns of equations:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{2}
& L_1: & x+y &=1 \\
& L_2: & \enspace 2x+2y&=2
\end{alignat*}

\end{document}


• This is just what I was looking for - and it works with MathJax too. – Valerio De Angelis Jun 25 '19 at 23:01

Adapting the @Salim Bou's macro Place numbering in systeme package to the left, using systeme package, you can obtain, this little MWE with another similar result:

\documentclass[a4paper,12pt]{article}
\usepackage{systeme,mathtools}
\newcommand{\rightnum}[1]{\syscodeextracol{\kern-#1\hfill$}{$\kern#1}}
\newcommand{\leftnum}{\syscodeextracol{\kern1.5em$}{$}}% return to default
\begin{document}
\sysdelim..
\rightnum{7.5em}
$\systeme{x+y=1 @{L_1:}, 2x+2y=2 @{L_2:}}$
\end{document}