0

I have the following code for a MWE:

\[
D = \left[
\begin{array}{c|c|c}
D_{1} & 0 & D_{2} \\ \hhline{-|-|-}
D_{3} & & 0 \\ \hhline{~|~}
\end{array}
\right]
\]

This results in the first row as desired, but in the second row, it leaves the second spot blank but maintains the vertical line on either side. This is not the desired result. Instead, I am seeking to have the first D3 entry take up the first two spaces with no vertical line in between, then a vertical line, then 0. I am unsure of how to do this and am seeking help.

5

Like this?

enter image description here

\documentclass[12pt,oneside]{book}

\begin{document}
    \[
D = \left[
\begin{array}{c|c|c}
D_{1}                   & 0 & D_{2} \\ 
    \hline
\multicolumn{2}{c|}{D_{3}}   & 0     \\ 
\end{array}
\right]
    \]
\end{document}

Addendum: If you like to have more vertical spaces around matrix cells, than you can change \arraystreatch. Foe example as is done inthe following MWE:

\documentclass[12pt,oneside]{book}

\begin{document}
    \[\renewcommand\arraystretch{1.5}% <---
D = \left[
\begin{array}{c|c|c}
D_{1}                   & 0 & D_{2} \\ 
    \hline
\multicolumn{2}{c|}{D_{3}}   & 0     \\ 
\end{array}
\right]
    \]
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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