Package Systeme: Alignment Problems – How to Fix Equations Alignment

equationssysteme

I use systeme package with variables like $F_1$, $F_2$, and so on. As a MWE:

\documentclass[12pt]{exam}
\usepackage{amsmath}
\usepackage{systeme}

\begin{document}
\systeme{
F_1\cos 60^ \circ+F_3=2\cos 30^\circ\rm{~kN},
F_1 \sin 60^ \circ=2\rm{~kN},
-F_1\cos 60^\circ+F_2\cos 60^ \circ+F_4=0,
-F_1\sin 60^ \circ-F_2\sin 60^ \circ=0,
-F_4-F_5\cos 60^ \circ=-2\cos 30^\circ\rm{~kN}
}

\end{document}

The equations are not aligned properly. What am I doing wrong? Thanks in advance.
enter image description here

Best Answer

The \systeme command cannot cope with this kind of object: it wants coefficients to be in front of the variable, as far as I know.

If you accept this, you can do

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

\begin{document}
\[
\protected\def\c{\cos60^\circ}
\protected\def\s{\sin60^\circ}
\sisetup{parse-numbers=false}
\syssubstitute{{x_1}{F_1}{x_2}{F_2}{x_3}{F_3}{x_4}{F_4}{x_5}{F_5}}
\systeme{
\c x_1+x_3=\qty{2\cos60^\circ}{kN},
\s x_2=\qty{2}{kN},
-\c x_1+\c x_2+x_4=0,
-\s x_1-\s x_2=0,
-x_4-\c x_5=\qty{-\cos60^\circ}{kN}
}
\]

\end{document}

enter image description here

Alternatively, do it the hard way.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\usepackage{siunitx}

\begin{document}
\[
\sisetup{parse-numbers=false}
\renewcommand{\arraystretch}{1.5}
\setlength{\arraycolsep}{0pt}
\protected\def\c{\cos60^\circ}
\protected\def\s{\sin60^\circ}
\left\lbrace
\begin{array}{
  *{5}{
    r % unknown
    >{{}}l % coefficient
    >{{}}c<{{}} % operation or relation
  }
  l % constant term
}
% F_1 & c  & + & F_2 & c  & + & F_3 & c & + & F_4 & c & + & F_5 & c  & = & c
  F_1 & \c &   &     &    & + & F_3 &   &   &     &   &   &     &    & = & \qty{2\cos60^\circ}{kN} \\
      &    &   & F_2 & \s &   &     &   &   &     &   &   &     &    & = & \qty{2}{kN} \\
 -F_1 & \c & + & F_2 & \c &   &     &   & + & F_4 &   &   &     &    & = & 0 \\
 -F_1 & \s & - & F_2 & \s &   &     &   &   &     &   &   &     &    & = & 0 \\
      &    &   &     &    &   &     &   & - & F_4 &   & - & F_5 & \c & = & \qty{-\cos60^\circ}{kN}
\end{array}
\right.
\]

\end{document}

enter image description here

Related Question