2

I would like to produce the following output:

eqnarray*

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*}
  • 1
    You shouldn't use eqnarray – the spacing around the = signs is not good. – Bernard Jun 25 at 16:46
5

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} 

enter image description here

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

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:

enter image description here

\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}

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.