4

I've been using the systeme package to write systems of linear equations but I need to do something I don't know how to. I'm trying to put a vertical line to the right of the system and write text after that. system exemple

The end result would look like that (sorry about the bad drawing, I didn't really look for an already formatted image). So far I can easily get the system but have no idea how to add the vertical line and text. Thanks for the help.

3 Answers 3

9

Two variants, also with systeme:

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

\begin{document}

  \[ \systeme{t + x + y + z = 4, x + y = 2, z = 2}\sysdelim| . \systeme{\mbox{} @ \text{Some text}, \mbox{}@ \text{Some more text},\mbox{} @\text{A last text}} \]
    \bigskip
  \[ \sysdelim\{| \systeme{t + x + y + z = 4, x + y = 2, z = 2\enspace}
  \enspace \begin{aligned} & \text{Some text} \\ & \text{Some more text} \\ & \text{A last text} \end{aligned}\]


\end{document} 

enter image description here

5
  • Your code it is more beautiful instead of mine :-) Great!!!!
    – Sebastiano
    Commented Jan 20, 2020 at 22:12
  • I don't agree, your code is quite short and clean.
    – Bernard
    Commented Jan 20, 2020 at 22:14
  • I have not the left alignment for the text like your code. I'm not an envious person, and I appreciate true beauty...
    – Sebastiano
    Commented Jan 20, 2020 at 22:15
  • 1
    Just a suggestion: use matrix*[l].
    – Bernard
    Commented Jan 20, 2020 at 22:17
  • Thanks you very much. That helped a lot.
    – t_kln
    Commented Jan 25, 2020 at 20:43
9

It is possible to solve your question using systeme package adding a matrix to the right (for example).

enter image description here

 %% Compile and read me!
\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{systeme}
\begin{document}
$\sysdelim{\{}{|}\systeme{t+x+y+z=4,x+y=2,z=2} \quad \begin{matrix} \text{my text} \\[.3em] \text{another text} \\[.3em] \text{my favorite}\end{matrix}$
\end{document}

ADDENDUM: This addendum is of the great user @Bernard (see your comment into your answer). Without him, I wouldn't have had the left-aligned text.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{systeme}
\begin{document}
$\sysdelim{\{}{|}\systeme{t+x+y+z=4,x+y=2,z=2} \quad \begin{matrix*}[l] & \text{my text} \\[.3em] &\text{another text} \\[.3em] &\text{my favorite}\end{matrix*}$
\end{document}
4
  • Great minds think together! ;) (+1)
    – Bernard
    Commented Jan 20, 2020 at 22:11
  • @Bernard Ahahahahahhaahah LOL LOL :-)
    – Sebastiano
    Commented Jan 20, 2020 at 22:13
  • Thanks ! This looks great, exactly what was needed.
    – t_kln
    Commented Jan 25, 2020 at 20:44
  • @Tommy I am only a poor user and the other answers can be more better of mine. Check with the green mark that you like more :-) (no my answer :-)))))
    – Sebastiano
    Commented Jan 25, 2020 at 20:49
8

An improvement to Sebastiano's and Bernard's nice answers; it uses a single \systeme and the text is given at the end of each line.

This way, even vertically large texts are coped with, see the second (admittedly contrived) example.

The text is typeset in a zero width box, but the widths are measured and the maximum is computed. At the end I issue a suitable \hspace command to take care of the texts when centering the whole block.

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{systeme}

\usepackage{showframe} % to show the page frame, remove it

\newlength{\stextwidth}
\newcommand{\stext}[1]{%
  \settowidth{\dimen0}{\quad\,#1}%
  \ifdim\dimen0>\stextwidth \global\stextwidth=\dimen0\fi
  \quad\makebox[0pt][l]{\quad\,#1}%
}


\begin{document}

\begin{equation*}
\global\stextwidth=0pt
\sysdelim{\{}{|}
\systeme{
  t+x+y+z=4\stext{my text},
  x+y=2\stext{another text},
  z=2\stext{my favorite}
}\hspace{\stextwidth}
\end{equation*}

\end{document}

enter image description here

The second (contrived) example

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{systeme}

\usepackage{showframe} % for judging the centering

\newlength{\stextwidth}
\newcommand{\stext}[1]{%
  \settowidth{\dimen0}{\quad\,#1}%
  \ifdim\dimen0>\stextwidth \global\stextwidth=\dimen0\fi
  \quad\makebox[0pt][l]{\quad\,#1}%
}


\begin{document}

\begin{equation*}
\global\stextwidth=0pt
\sysdelim{\{}{|}
\systeme{
  t+x+y+z=4\stext{\parbox[t]{8em}{my text that is too long for one line\vspace{2ex}}},
  x+y=2\stext{another text},
  z=2\stext{my favorite}
}\hspace{\stextwidth}
\end{equation*}

\end{document}

enter image description here

If more than one of these systems are needed, it's better to define a macro:

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{systeme}

\usepackage{showframe} % for judging the centering

\newlength{\stextwidth}
\newcommand{\stext}[1]{%
  \settowidth{\dimen0}{\quad\,#1}%
  \ifdim\dimen0>\stextwidth \global\stextwidth=\dimen0\fi
  \quad\makebox[0pt][l]{\quad\,#1}%
}
\newcommand{\tsysteme}[1]{%
  \sysdelim{\{}{|}%
  \global\stextwidth=0pt
  \systeme{#1}%
  \hspace{\stextwidth}%
}

\begin{document}

\begin{equation*}
\tsysteme{
  t+x+y+z=4\stext{my text},
  x+y=2\stext{another text},
  z=2\stext{my favorite}
}
\end{equation*}

\end{document}
1
  • 1
    Thanks ! This is great.
    – t_kln
    Commented Jan 25, 2020 at 20:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .