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.

It is pretty normal, I guess, to use \begin{array} ... \end{array} to model matrices, when more control is required than you get with pmatrix, bmatrix, etc., with the proper \left and \right, and the relevant symbol.

Now, I need smallmatrix, but I need more control. Basically, I'd like to model \begin{smallmatrix} ... \end{smallmatrix} with \begin{array} ... \end{array}.

It's not as easy as just putting a command left and right of \begin{array} ... \end{array}. Should I use \scalebox?

\begin{array}{c|c}
    a & b \\ \hline c & d
\end{array}

As you can see, I'm using verical and horizonal lines. Now I'd need that, but in this matrix:

\begin{smallmatrix}
    a & b \\ \hline c & d
\end{smallmatrix}

Is that even possible?

share|improve this question
    
smallmatrix is optimized for two line arrays so that the delimiters around them don't grow too much; as soon as you add a horizontal rule the size will grow. A partitioned matrix is best treated in a display. –  egreg Feb 18 '13 at 0:27
    
I understand, but even adding vertical lines is not possible. I'd like to control at least that. –  polemon Feb 18 '13 at 4:37

1 Answer 1

You can emulate smallmatrix with array in the following way:

\documentclass{article}
\usepackage{amsmath} % just for comparison

\newenvironment{smallarray}[1]
 {\null\,\vcenter\bgroup\scriptsize
  \renewcommand{\arraystretch}{0.7}%
  \arraycolsep=.13885em
  \hbox\bgroup$\array{@{}#1@{}}}
 {\endarray$\egroup\egroup\,\null}

\begin{document}
$\left[\begin{smallmatrix}a & b\\ g&d\end{smallmatrix}\right]
\left[\begin{smallarray}{cc}a & b\\g&d\end{smallarray}\right]
\left[\begin{smallarray}{c|c}a & b\\g&d\end{smallarray}\right]$
\end{document}

However, adding \hline between rows in a smallarray won't give a pleasant result.

Horizontal rules may be added in both environments with

\noalign{\vskip1pt\hrule\vskip1pt}

instead of \hline, but this will probably make delimiters grow by one step.

enter image description here

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.