Math & ScienceUgly Alignment for Matrices

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Ugly Alignment for Matrices

Post by Cham »

I'm having some troubles with this matrix equation :

Code: Select all

\documentclass[12pt,letterpaper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}
Ugly alignment :
	\begin{equation}
		X =
		\begin{bmatrix}
			x & y
		\end{bmatrix}\!\!
		\begin{bmatrix}
			a & b \\
			c & d
		\end{bmatrix}\!\!
		\begin{bmatrix}
			x \\
			y
		\end{bmatrix}
	\end{equation}
\end{document}
Here's a preview :
matrix.jpg
matrix.jpg (13.17 KiB) Viewed 3496 times
The problem is the first matrix on the left. It's currently vertically centered to the middle matrix. I don't like this (the usual matrix multiplication is less obvious, this way).

Is there a way to draw that left matrix properly vertically aligned with the top part of the middle matrix ? How can I add a proper vertical offset ?

Also, I don't like the items spacement inside the matrices. I can adjust the spacements by adding some \phantom commands, but it feels like an hack. What do you suggest ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Ugly Alignment for Matrices

Post by localghost »

Cham wrote:[…] The problem is the first matrix on the left. It's currently vertically centered to the middle matrix. I don't like this (the usual matrix multiplication is less obvious, this way). […]
This is the way such expressions are usually typeset. I've never seen something else in this regard (and if so, I would be confused).

But you can try an {array} (← Link!) environment instead with an optional alignment parameter.


Thorsten
Post Reply