6

I wonder how I could make LaTeX align to the right some specific descriptions I wrote about the operations I apply to matrices. For example, here is a screenshot of what I have right now but I want it done better:

enter image description here

The code I used was:

\documentclass[11pt,a4paper,openany]{report}
\usepackage[utf8]{inputenc}
\usepackage{amssymb, mathrsfs}
\usepackage[dutch]{babel}
\usepackage{systeme, mathtools}
\usepackage[amsmath, thref, hyperref, thmmarks]{ntheorem}
\begin{document}

\begin{align*} 
\det \begin{pmatrix} 4 & 3 & 2 \\ 3 & -2 & 5 \\ 2 & 4 & 6 \end{pmatrix} 
&= 2 \det \begin{pmatrix} 4 & 3 & 2 \\ 3 & -2 & 5 \\ 1 & 2 & 3 \end{pmatrix} 
  \tag*{propositie 4.3.7 (toegepast op onderste rij)} \\ 
&= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 3 & -2 & 5 \\ 4 & 3 & 2 \end{pmatrix} 
  \tag*{propositie 4.3.5 ($R_1 \leftrightarrow R_3$)} \\ 
&= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 0 & -8 & -4 \\ 4 & 3 & 2 \end{pmatrix} 
  \tag*{propositie 4.3.8 ($R_2 \rightarrow R_2 - R_1$)} \\ 
&= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 0 & -8 & -4 \\ 0 & -5 & -10 \end{pmatrix} 
  \tag*{($R_3 \rightarrow R_3 - 4R_1$)}
\end{align*}

\end{document}

I want the descriptions right aligned, prefered with first the statement 'proposition', and underneath in brackets the operation which I applied, and all of this next to the corresponding matrix (to the right). How can this be done?

1
  • I'm not sure what you are actually looking for in the output. By your description it seems that the last row is what you are looking to replicate for all the rows? Can you be more precise on how you want the output look? Jun 16, 2015 at 14:01

3 Answers 3

4

Don't abuse \tag; there's no need for the explanation to be flush with the right margin; also, the explanations should be left aligned with each other.

Since it's impossible to accommodate those explanations in one line, I use a tabular for splitting them across two lines.

Don't forget loading fontenc with the T1 option.

\documentclass[11pt,a4paper,openany]{report}
\usepackage[T1]{fontenc} % <---- don't forget
\usepackage[utf8]{inputenc}
\usepackage{amssymb, mathrsfs}
\usepackage[dutch]{babel}
\usepackage{systeme, mathtools}
\usepackage[amsmath, thref, hyperref, thmmarks]{ntheorem}

\newcommand{\explain}[1]{&&\begin{tabular}{@{}l@{}}#1\end{tabular}}

\begin{document}

\begin{align*}
\det \begin{pmatrix} 4 & 3 & 2 \\ 3 & -2 & 5 \\ 2 & 4 & 6 \end{pmatrix}
&= 2 \det \begin{pmatrix} 4 & 3 & 2 \\ 3 & -2 & 5 \\ 1 & 2 & 3 \end{pmatrix}
  \explain{propositie 4.3.7 \\ (toegepast op onderste rij)} \\
&= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 3 & -2 & 5 \\ 4 & 3 & 2 \end{pmatrix}
  \explain{propositie 4.3.5 \\ ($R_1 \leftrightarrow R_3$)} \\
&= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 0 & -8 & -4 \\ 4 & 3 & 2 \end{pmatrix}
  \explain{propositie 4.3.8 \\ ($R_2 \rightarrow R_2 - R_1$)} \\
&= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 0 & -8 & -4 \\ 0 & -5 & -10 \end{pmatrix}
  \explain{($R_3 \rightarrow R_3 - 4R_1$)}
\end{align*}

\end{document}

enter image description here

Should you insist to abuse \tag*, just change the definition of \explain into

\newcommand{\explain}[1]{\tag*{\begin{tabular}{@{}l@{}}#1\end{tabular}}}
0
2

You could use tabular environments in the argument of \tag* to split the explanations into two parts.

enter image description here

\documentclass[11pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[dutch]{babel}
\usepackage{mathtools}
\begin{document}

\begin{align*} 
\det \begin{pmatrix} 4 & 3 & 2 \\ 3 & -2 & 5 \\ 2 & 4 & 6 \end{pmatrix} 
&= \phantom{-}2 \det \begin{pmatrix} 4 & 3 & 2 \\ 3 & -2 & 5 \\ 1 & 2 & 3 \end{pmatrix} 
  \tag*{\begin{tabular}{@{}r@{}}propositie 4.3.7 \\
          (toegepast op onderste rij)\end{tabular}} \\ 
&= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 3 & -2 & 5 \\ 4 & 3 & 2 \end{pmatrix} 
  \tag*{\begin{tabular}{@{}r@{}}propositie 4.3.5\\
          ($R_1 \leftrightarrow R_3$)\end{tabular}} \\ 
&= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 0 & -8 & -4 \\ 4 & 3 & 2 \end{pmatrix} 
  \tag*{\begin{tabular}{@{}r@{}}propositie 4.3.8 \\
          ($R_2 \rightarrow R_2 - 3R_1$)\end{tabular}} \\ 
&= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 0 & -8 & -4 \\ 0 & -5 & -10 \end{pmatrix} 
  \tag*{($R_3 \rightarrow R_3 - 4R_1$)}
\end{align*}

\end{document}
2

Something like this:

enter image description here

Code:

\documentclass[11pt,a4paper,openany]{report}
\usepackage[utf8]{inputenc}
\usepackage{amssymb, mathrsfs}
%\usepackage[dutch]{babel}
\usepackage{mathtools}%systeme, 
%\usepackage[amsmath, thref, hyperref, thmmarks]{ntheorem}
    \begin{document}
\begin{align*} 
\det\begin{pmatrix} 
4 & 3 & 2 \\ 3 & -2 & 5 \\ 2 & 4 & 6 
    \end{pmatrix} 
    & = 2 \det\begin{pmatrix} 4 & 3 & 2 \\ 3 & -2 & 5 \\ 1 & 2 & 3 \end{pmatrix}
        &&  \begin{tabular}{@{}l}
        propositie 4.3.7\\ 
        (toegepast op onderste rij)
        \end{tabular}                       \\
    & = -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 3 & -2 & 5 \\ 4 & 3 & 2 \end{pmatrix}
        &&  \text{propositie 4.3.5 ($R_1 \leftrightarrow R_3$)}     \\ 
    &= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 0 & -8 & -4 \\ 4 & 3 & 2 \end{pmatrix}
        && \text{propositie 4.3.8 ($R_2 \rightarrow R_2 - R_1$)}   \\ 
    &= -2 \det \begin{pmatrix} 1 & 2 & 3 \\ 0 & -8 & -4 \\ 0 & -5 & -10 \end{pmatrix}
        && \text{($R_3 \rightarrow R_3 - 4R_1$)}
 \end{align*}
    \end{document}

Normally macro \tag is used for tagging equation, not for their description. Instead them I use \text and tabular environment.

2
  • would be nicer if the 2-line description were left-aligned with the 1-liners. (i'm not sure why the tabular is being indented.) Jun 16, 2015 at 14:19
  • @Barbara Beenton, now I see that I forgot to eliminate tabcolsep ... It should be \begin{tabular}{@{}l}. I will correct my answer. Thank you for tip.
    – Zarko
    Jun 16, 2015 at 17:34

You must log in to answer this question.

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