2

I'd like to float one matrix left among the others, and make the text grey. Currently, I can only simulate this by adding the correct \hspace*{} after my first matrix that I would like to align left.
My current code looks like such,

 \documentclass{article}
 \usepackage[utf8]{inputenc}
 \usepackage{mathtools}
 \usepackage{amsmath}
 \usepackage{amssymb}
 \DeclarePairedDelimiter\ket{\lvert}{\rangle}
 \begin{document}    
 \begin{equation}
 \begin{matrix}
  \ket{11}\\
  \ket{01}\\
  \ket{10}\\
  \ket{00}
\end{matrix} \hspace*{50pt}
 \begin{pmatrix}
  0\\
  0\\
  1\\
  0
\end{pmatrix} 
 \begin{pmatrix}
  0 & 0 & 1 & 0\\
  0 & 1 & 0 & 0\\
  1 & 0 & 0 & 0\\
  0 & 0 & 0 & 1
 \end{pmatrix}
 =
  \begin{pmatrix}
  1\\
  0\\
  0\\
  0
\end{pmatrix} 
\end{equation}
\end{document} 

and yields the following example image

Concluding; how do I left align/float the first matrix and make the text grey?

7
  • 1
    I suggest you to add those three or four lines to make the Minimal Example also Working, i.e. a MWE. If you make so, you'll help us to help you!
    – Enlico
    Commented Nov 13, 2016 at 11:33
  • @EnricoMariaDeAngelis Sorry, I don't understand what you mean. What exactly should I add?
    – Isaiah
    Commented Nov 13, 2016 at 11:36
  • I mean \documentclass, \begin{document}, needed packages... I could do it for you, but doing it by yourself will make you a better user! ;)
    – Enlico
    Commented Nov 13, 2016 at 11:37
  • and used packages for this equations as well \begin{document} and end{document} ...
    – Zarko
    Commented Nov 13, 2016 at 11:38
  • 1
    @EnricoMariaDeAngelis Updated!
    – Isaiah
    Commented Nov 13, 2016 at 11:40

2 Answers 2

3

Use the flalign environment and {\color{gray} ket matrix } (requires color or xcolor. Note you don't have to load amsmath since mathtools does it:

 \documentclass{article}
 \usepackage[utf8]{inputenc}
 \usepackage{xcolor} %
 \usepackage{mathtools}%
 \usepackage{amssymb}
 \DeclarePairedDelimiter\ket{\lvert}{\rangle}
 \begin{document}

 \begin{flalign}
  &{\color{gray} \begin{matrix}
  \ket{11}\\
  \ket{01}\\
  \ket{10}\\
  \ket{00}
\end{matrix}} %
& \begin{pmatrix}
  0\\
  0\\
  1\\
  0
\end{pmatrix}
 \begin{pmatrix}
  0 & 0 & 1 & 0\\
  0 & 1 & 0 & 0\\
  1 & 0 & 0 & 0\\
  0 & 0 & 0 & 1
 \end{pmatrix}
  & =
  \begin{pmatrix}
  1\\
  0\\
  0\\
  0
\end{pmatrix}
 & & %
 \end{flalign}

\end{document} 

enter image description here

3
  • 1
    Thank you! However, maybe you could mention this requires the xcolor package?
    – Isaiah
    Commented Nov 13, 2016 at 11:54
  • I'll add it. But isn't it obvious any colour specification require requires a dedicated package – color or xcolor?
    – Bernard
    Commented Nov 13, 2016 at 11:56
  • Well, one (new user) could think that one of these commands is in some automatically loaded package of the class or something similar...
    – Enlico
    Commented Nov 13, 2016 at 11:59
2

The xcolor package's \textcolor{<color>}{<text>} command could simply help you with the color. The {\color{<color>} text}, is another option, but I like the former more.

0

You must log in to answer this question.

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