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.

8

Two variants, also with system:

\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

  • Your code it is more beautiful instead of mine :-) Great!!!! – Sebastiano Jan 20 at 22:12
  • I don't agree, your code is quite short and clean. – Bernard Jan 20 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 Jan 20 at 22:15
  • 1
    Just a suggestion: use matrix*[l]. – Bernard Jan 20 at 22:17
  • Thanks you very much. That helped a lot. – Tommy Jan 25 at 20:43
8

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}
  • Great minds think together! ;) (+1) – Bernard Jan 20 at 22:11
  • @Bernard Ahahahahahhaahah LOL LOL :-) – Sebastiano Jan 20 at 22:13
  • Thanks ! This looks great, exactly what was needed. – Tommy Jan 25 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 Jan 25 at 20:49
7

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}
  • Thanks ! This is great. – Tommy Jan 25 at 20:45

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.