Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am building a big matrix within the which I have block matrices, which I want to indicate by boxes. My current state looks like this:

 $$\begin{matrix} \framebox[3.\width]{J}& \begin{matrix} 0&0&\\0&0&\end{matrix}&\\
    \begin{matrix} 0&0&\\0&0&\end{matrix}& \framebox[3.\width]{J}&\end{matrix}$$

but this makes the frameboxes aligned to the right. I want them centered in their matrix-cell.

How can I solve this?

share|improve this question
    
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. It would be very helpful if you could provide a complete minimum working example beginning with \documentclass and ending with \end{document} –  darthbith May 10 at 12:50
    
Why don't you just write J&0\\0&J? –  percusse May 10 at 12:50
    
I want to insert the full 0-matrices to make clear, that J is 2x2 –  Hagadol May 10 at 12:52
    
You can say so via J_{2\times 2} –  percusse May 10 at 13:07

1 Answer 1

up vote 5 down vote accepted

The columns are centred, but each of your 'inner' matrices has an empty column, generated by a spurious & at the end of the row. Delete these, and the problem goes away.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
\begin{matrix}
\framebox[3.\width]{J} &
\begin{matrix}
0 & 0  \\
0 & 0
\end{matrix}
& \\
\begin{matrix}
0 & 0 \\
0 & 0
\end{matrix}
& \framebox[3.\width]{J} &
\end{matrix}
\]
\end{document}

matrix

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.