# Define the system of "n" linear equations

I would like to write the system of "n" linear equations. Follow is my code:

 \documentclass{article}
\usepackage{amsmath}
\usepackage{systeme}

\begin{document}
$\syslineskipcoeff{2} \systeme*{w_1^S(\delta)=\alpha_1w_{11} + \alpha_2w_{21} + ...+ \alpha_nw_{n1}, w_2^S(\delta)=\alpha_1w_{12} + \alpha_2w_{22} + ...+ \alpha_nw_{n2}, x =...,w_3^S(\delta)=\alpha_1w_{1n} + \alpha_2w_{2n} + ...+ \alpha_nw_{nn}}$

\end{document}


However, the actual result is not as what i expect (see below image). I would like to display a "........" in the linear system to demonstrate that my index is keep increasing from i -> n. And at the end, the last equation should display index w_n^S(\delta)= instead of w_3^S(\delta)=. Unfortunately, when I write w_n^S(\delta)= LaTeX recognizes it is not number and it considers it as error Missing = inserted for \ifnum. Also, there is problem if I made "........" in my code. Would you have any ways to work around?

• Do you need \systeme for this? I'm not sure. Nov 21 '15 at 22:11
• Well, there's a three in your output, because there's a three in the input... Nov 21 '15 at 22:25
• @cfr: I inserted my entire code. Sorry! Nov 21 '15 at 22:29
• @jarauh: I know it is 3 in my input since if i write "w_n^S(\delta)=" Latex recognizes it is not number and considers it as "error" "Missing = inserted for \ifnum". Therefore, I currently kept "3" in my input to see the "draft" result. Nov 21 '15 at 22:32
• Thanks for completing your example! Fine to post the output that way, but maybe change it back to n in the code so that what you post reproduces the error. It tends to avoid confusion that way.
– cfr
Nov 21 '15 at 22:34

You can do it with systeme, but it's better with cases. A small trick ensures perfect alignment. Compare the two versions below.

\documentclass{article}
\usepackage{amsmath,mathtools,systeme}

\newcommand{\di}[2]{#1\rlap{$\scriptstyle#2$}\hphantom{n}}

\newcommand{\sysdots}{%
\hbox{\kern-0em$\cdotp\cdotp\cdotp\cdotp\cdotp\cdotp$}%
}

\begin{document}
$\begin{cases} w_1^S(\delta)=\alpha_1w_{\di 11} + \alpha_2w_{\di 21} + \dots + \alpha_nw_{\di n1}\\ w_2^S(\delta)=\alpha_1w_{\di 12} + \alpha_2w_{\di 22} + \dots + \alpha_nw_{\di n2}\\ \makebox[4em]{\dotfill}\\ w_n^S(\delta)=\alpha_1w_{\di 1n} + \alpha_2w_{\di 2n} + \dots + \alpha_nw_{\di nn} \end{cases}$
$\syssubstitute{{w_3}{\sysdots}{w_4}{w_n}} \systeme*{ w_1^S(\delta)=\alpha_1w_{11} + \alpha_2w_{21} + \dots + \alpha_nw_{n1}, w_2^S(\delta)=\alpha_1w_{12} + \alpha_2w_{22} + \dots + \alpha_nw_{n2}, w_3, w_4^S(\delta)=\alpha_1w_{1n} + \alpha_2w_{2n} + \dots + \alpha_nw_{nn} }$
\end{document}


• Thanks @egreg alot for your help. I see that \systeme somehows deal with index 3, and 4 and output to "n". As you said, cases is more perfect solution. Nov 21 '15 at 22:39