5

How to type a system of equations of the following form aligning the same variables when they do have zero coefficients. enter image description here

I looked at few posts including this but wasn't successful. Appreciate any help in getting this done. Thank you.

8

Like this answer.

\documentclass{article}
\usepackage{systeme}

\begin{document}
\sysdelim..\systeme{x_2      +2x_3          +2x_4         -2x_5    =1,
x_1                +3x_3                   +4x_5    =5, 
-x_1         +3x_2       +3x_3                   -10x_5    =4}
\end{document}

enter image description here

  • Thank you @marmot. Can you tell me how to get rid of the curly braces to the left. – Eureka Jun 1 at 2:43
  • @Hagridd Brackets removed. – marmot Jun 1 at 2:45
5

For the sake of variety, here's an implementation that uses Mico's answer from the post you originally linked only using array. Admittedly, it's not quite as elegant as the solution marmot provided. However, its output is exactly the same as what's produced by \systeme. Observe that both answers produce output that's more tightly spaced than what's shown in the screenshot you posted. The array-based solution is also somewhat more general than what's produced by \systeme, in the sense that it can handle fairly arbitrary variable names.

enter image description here

\documentclass{article}
\usepackage{array} % for "\newcolumntype" macro
\newcolumntype{C}{ >{{}}c<{{}} }

\usepackage{systeme}
\sysdelim..

\begin{document}
\[
\setlength\arraycolsep{0pt}
\renewcommand{\arraystretch}{1.21} % optional
\begin{array}{r *{5}{Cr}}
         & &  x_2 &+& 2x_3 &+& 2x_4 &-&  2x_5 &=& 1 \\
     x_1 & &      &+& 3x_3 & &      &+&  4x_5 &=& 5 \\
    -x_1 &+& 3x_2 &+& 3x_3 & &      &-& 10x_5 &=& 4
\end{array}
\]

%% for comparison, @marmot's answer which uses "\systeme"
\[
\systeme{      x_2 +2x_3 +2x_4 -2x_5 =1,
         x_1       +3x_3       +4x_5 =5, 
        -x_1 +3x_2 +3x_3      -10x_5 =4}
\]
\end{document}
  • 1
    +1 for the variety. – marmot Jun 1 at 4:12
  • +1 for the variety. ;-) – Mico Jun 1 at 4:36

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.