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 want to write block matrices like the one shown below block matrix image

I tried underlining, fraction, and using __ as an entry by making three rows but they did not look nice.I want the horizontal lines inside the matrix to be gapped in between as shown. How can I do this?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

This is one way:

\documentclass[a4paper,journal]{IEEEtran}
\usepackage{amsmath}

\begin{document}
\[
\begin{bmatrix}
  \frac{I}{\mathrm{O}}\frac{\mathrm{O}}{\mathrm{O}}
\end{bmatrix}
\begin{bmatrix}
  \frac{x}{u}
\end{bmatrix} =
\begin{bmatrix}
  \frac{A}{C}\frac{B}{D}
\end{bmatrix}
\begin{bmatrix}
  \frac{x}{u}
\end{bmatrix} +
\begin{bmatrix}
  \frac{\mathrm{O}}{-y}
\end{bmatrix}
\]
%
\[
\left[
  \frac{I}{\mathrm{O}}\frac{\mathrm{O}}{\mathrm{O}}
\right]
\left[
  \frac{x}{u}
\right] =
\left[
  \frac{A}{C}\frac{B}{D}
\right]
\left[
  \frac{x}{u}
\right] +
\left[
  \frac{\mathrm{O}}{-y}
\right]
\]
\end{document}

enter image description here

Instead of dynamically varying brackets (\left[ and \right]), you may use fixed size brackets like \Bigg[ and \Bigg] provided by amsmath.

share|improve this answer
add comment

Here's a more "matrix-like" solution:

\documentclass{article}
\usepackage{amsmath,booktabs,xparse}

\ExplSyntaxOn
\DeclareExpandableDocumentCommand{\seps}{m}
 {
  \noalign{\seps_do_arg:n { #1 } }
  \tl_use:N \g_seps_list_tl
 }
\tl_new:N \g_seps_list_tl
\cs_new_protected:Npn \seps_do_arg:n #1
 {
  \tl_clear:N \g_seps_list_tl
  \clist_map_inline:nn { #1 }
   { \tl_gput_right:Nn \g_seps_list_tl { \cmidrule(lr){##1--##1} } }
 }
\ExplSyntaxOff


\begin{document}
\[
\begin{bmatrix}
I & \textrm{O} \\
\seps{1,2}
\textrm{O} & \textrm{O}
\end{bmatrix}
\begin{bmatrix}
x \\
\seps{1}
u
\end{bmatrix}
=
\begin{bmatrix}
A & B \\
\seps{1,2}
C & D
\end{bmatrix}
\begin{bmatrix}
x \\
\seps{1}
u
\end{bmatrix}
+
\begin{bmatrix}
\mathrm{O} \\
\seps{1}
-y
\end{bmatrix}
\]
\end{document}

You simply give the list of separators you need. It would unfortunately be quite difficult to know how many columns your matrix has.

enter image description here

share|improve this answer
add comment

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.