4

When I construct the product of some matrices representing bilinear form, the result I get seems a bit odd to me since the first matrix (One row) has a vertical alignment which is not the same as the last rows of the other two matrices. I would like it to be the same.

mwe:

\documentclass[11pt]{report}
\usepackage{amsmath}
\begin{document}
\[
\varphi_2((x_1,y_1),(x_2,y_2))=
\begin{pmatrix}x_1 & y_1\end{pmatrix}
\begin{pmatrix}-2&0\\0&4\end{pmatrix}
\begin{pmatrix} x_2\\y_2\end{pmatrix}
\]
\end{document}

I would like that everything seems to rest on the same "floor".

enter image description here

2
  • 2
    Do you want the first matrix lowered or the last two matrices raised? Jan 30, 2017 at 17:44
  • I would actually like the two others higher so everything is aligned with the "=" symbols.
    – user42070
    Jan 30, 2017 at 18:05

3 Answers 3

9

I'd consider odd any other way of setting this formula.

Anyway, here's how you can get the last two matrices hanging from the top:

\documentclass[11pt]{report}
\usepackage{amsmath}
\usepackage{delarray}

\newenvironment{badpmatrix}[1]
 {\begin{array}[t]({@{}#1@{}})}
 {\end{array}}

\begin{document}

\[
\varphi_2((x_1,y_1),(x_2,y_2))=
  \begin{pmatrix} x_1 & y_1 \end{pmatrix}
  \begin{badpmatrix}{cc} -2 & 0 \\ 0 & 4 \end{badpmatrix}
  \begin{badpmatrix}{c} x_2 \\ y_2 \end{badpmatrix}
\]

\end{document}

enter image description here

If you want them to be the other way around, change [t] into [b] in the definition of the badpmatrix environment.

enter image description here

Then decide the standard way is the best. ;-)

There are two “grounds” in math mode. One is the baseline, where letters sit on; the other is the “math axis”, an imaginary line a bit above the baseline, where a fraction line is drawn, for instance.

Usually, big objects are vertically centered on the math axis and not placed on the baseline, to avoid a “skyline effect”. I don't think you could stand something like

enter image description here

which is the analog of

enter image description here

Compare with the standard:

enter image description here

2
  • 3
    +1 for "I'd consider odd any other way of setting this formula"!
    – CarLaTeX
    Jan 30, 2017 at 18:43
  • ok so the second one is what I had in mind. But indeed this is not looking so good now that I see it :), maybe it is my mind which is odd ... at the end I might stick to the standard way :)
    – user42070
    Jan 31, 2017 at 10:34
5

Here's one way with \abovebaseline[<height>]{}. In this case, I set the final two matrices above the baseline by -\dp\strutbox.

\documentclass[11pt]{report}
\usepackage{amsmath,stackengine}
\stackMath
\begin{document}
\[
  \varphi_2((x_1,y_1),(x_2,y_2))=\begin{pmatrix}x_1 & y_1\end{pmatrix}
  \abovebaseline[-\dp\strutbox]{%
    \begin{pmatrix}-2&0\\0&4\end{pmatrix}\begin{pmatrix}x_2\\y_2\end{pmatrix}%
  }
\]
\end{document}

enter image description here

If one chose the alternative configuration, that can be accomplished by setting the matrices below the baseline by a value of -\ht\strutbox:

\documentclass[11pt]{report}
\usepackage{amsmath,stackengine}
\stackMath
\begin{document}
\[
  \varphi_2((x_1,y_1),(x_2,y_2))=\begin{pmatrix}x_1 & y_1\end{pmatrix}
  \belowbaseline[-\ht\strutbox]{%
    \begin{pmatrix}-2&0\\0&4\end{pmatrix}\begin{pmatrix}x_2\\y_2\end{pmatrix}%
  }
\]
\end{document}

enter image description here

2

Maybe you want this weird layout?

\documentclass[11pt]{report}
\usepackage{amsmath}

\begin{document}

\[
\varphi_2((x_1,y_1),(x_2,y_2))=
\begin{array}{@{}c@{}}\\\begin{pmatrix}x_1 & y_1\end{pmatrix}\end{array}\begin{pmatrix}-2&0\\0&4\end{pmatrix}
\begin{pmatrix} x_2\\y_2\end{pmatrix}
\]

\end{document} 

enter image description here

0

You must log in to answer this question.

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