4

I need this;

Need This

But after some tries with replies available on TeX.SE, I could manage only this;

Managed to get this

The code to get this is given below

\begin{equation}\label{eqn:designRule}
\begin{split}
&{\textrm{\rotatebox[origin=c]{90}{$M$ Rules}}
    \stackrel{\mbox{$N$ Vars}}{%
        \begin{bmatrix}
        a_{11} & a_{12} & \cdots & a_{1N} \\
        a_{21} & a_{22} & \cdots & a_{2N} \\
        \vdots & \vdots & \ddots & \vdots \\
        a_{M1} & a_{M2} & \cdots & a_{MN}
        \end{bmatrix}%
    }
    %  
    \stackrel{G}{%
        \begin{matrix}
        g_1 \\
        g_2 \\
        \vdots \\
        g_M
        \end{matrix}%
    }}\\
    &{C     
        \begin{matrix}
        \quad\;\;c_{1} &\quad c_{2} &\; \cdots &\;\; c_{N}
        \end{matrix}%
    }
    \end{split}
\end{equation}
1
  • Please, check the very last code in my answer (I made slight changes after you accepted it).
    – egreg
    Jul 15, 2016 at 23:06

3 Answers 3

1

Simpler, for some definition of simple.

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{blkarray}
\usepackage{lipsum} % just for the example

\begin{document}
\lipsum*[2]
\[
\begin{blockarray}{ccccc|c}
\smash{\makebox(0,0){\rotatebox{90}{$M$ Rules\hspace{6em}}}}
& \BAmulticolumn{4}{c|}{N \text{ Vars}} & G \\
\begin{block}{c[cccc]|[c]}
 & a_{11} & a_{12} & \dots & a_{1N} & g_1 \\
 & a_{21} & a_{22} & \dots & a_{2N} & g_2 \\
 & \vdots & \vdots & \ddots & \vdots & \vdots \\
 & a_{M1} & a_{M2} & \dots & a_{MN} & g_N \\
\BAhline
\end{block}
\begin{block}{c[cccc]|c}
C & c_1 & c_2 & \dots & c_N \\
\end{block}
\end{blockarray}
\]
\lipsum[3]

\end{document}

enter image description here

3

Here a solution with tikz matrix library

Code

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,calc}

\begin{document}

\begin{equation}
\begin{tikzpicture}[baseline=(current bounding box.center)]
\matrix(M) [matrix of math nodes,left delimiter={[},right delimiter={]},nodes={minimum width=1cm}]
{
a_{11} & a_{12} & \cdots  & a_{1N}      \\
a_{21} & a_{22} & \cdots  & a_{2N}      \\
\vdots & \vdots & \ddots  & \vdots      \\
a_{M1} & a_{M2} & \cdots  & a_{MN}      \\
};
\matrix(L)at (M.east) [anchor=west,xshift=1cm,matrix of math nodes,left delimiter={[},right delimiter={]}]
{
  g_1    \\
  g_2    \\
  \vdots \\
  g_M    \\
};
\matrix(K)at (M.south) [anchor=north,yshift=-5mm,matrix of math nodes,nodes={minimum width=1cm},left delimiter={[},right delimiter={]}]
{
  c_{1} &  c_{2} & \cdots &  c_{N} \\
};
\node [rotate=90,yshift=5mm]at (M.west) {M Rules};
\node [xshift=-5mm]at (K.west) {$C$};
\node [yshift=5mm]at  (M.north) {N Vars};
\node [yshift=5mm]at (L.north) {$G$};
\draw ($(M.north east)!0.5!(L.north west)+(0,8mm)$)--($(M.south east)!0.5!(L.south west)+(0,-8mm)$);
\draw ($(M.south west)!0.5!(K.north west)+(-8mm,0)$)--($(M.south east)!0.5!(K.north east)+(2.5cm,0)$);
\end{tikzpicture}
\end{equation}

\end{document}

Output

out

1
  • Can this also be done without Tikz?
    – Abhinav
    Jul 15, 2016 at 19:59
3

Here's a solution that use an array environment, no TikZ.

enter image description here

\documentclass{article}
\usepackage{amsmath,graphicx,array}
\begin{document}
\begin{equation}\label{eqn:designRule}
\renewcommand\arraystretch{1.33}
\begin{array}{@{}c@{\hspace{\arraycolsep}}c|c@{}}
 & \text{$N$ Vars} & G \\[0.5ex]
\rotatebox[origin=c]{90}{$M$ Rules} &
        \begin{bmatrix}
        a_{11} & a_{12} & \dots & a_{1N} \\
        a_{21} & a_{22} & \dots & a_{2N} \\
        \vdots & \vdots & \ddots& \vdots \\
        a_{M1} & a_{M2} & \dots & a_{MN}
        \end{bmatrix} 
    &
        \begin{matrix}
        g_1 \\
        g_2 \\
        \vdots \\
        g_M
        \end{matrix}\\
\hline     
C  & \begin{matrix}
        \quad c_{1} &\quad c_{2} & \,\cdots &\;\; c_{N}\\ 
     \end{matrix} &
\end{array}
\end{equation}
\end{document}
0

You must log in to answer this question.

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