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'm trying to find The Right Way to make a smaller matrix (but not a smallmatrix) along the following lines.

Example: Consider the following piece of LaTeX code:

% \usepackage{amsmath} in the pre-amble
\begin{gather*}
    A = \begin{footnotesize}
        \left[\,\begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix}\,\right]
    \end{footnotesize}
    \\
    A = \left[\,\begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix}\,\right]
\end{gather*}

Motivation: I want occasionally to be able to have small — but easily legible and æshetically pleasing — matrices in displayed environments. The æsthetic criteria rule out the use of smallmatrix, so I'm looking for alternatives. In the example above, the variable A is meant to be outside of the footnotesize environment: I want these matrices to be typeset smaller than the surrounding math. Sometimes, I want to display matrices for the sake of clarity, but matrices usually take up much more room than I want (both in the sense of leaving too little room for other things, and in the sense of attracting more focus than I would like).

Partial solution: If you inspect the two matrix environments in the example above, you'll see that the matrix is the same in both cases. The only difference you might expect is that the matrix in the footnotesize environment will be smaller. When I compile this, it tells me that footnotesize is invalid in math-mode, which is a perfectly reasonable complaint. Despite this, it produces the smaller output that I desire. (No doubt it is automatically inserting some cludge that makes everything work out.) So this seems to be a viable way of making "smaller" matrices, but not a correct way.

Question: Is there a nice way to achieve the above — shrinking a part of a displayed math environment — with a minimum of switching between text-mode and math-mode? (Preferably, with no switching at all?)

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted
\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{gather*}
 \mbox{\scriptsize%
    $A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}$}\\
    A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}
\end{gather*}

\end{document}
share|improve this answer
    
I'm afraid that I'm not going to accept an answer which ignores my request that it not involve switching between text mode and math mode, unless you also make a convincing argument that there is no particularly nice answer which avoids this. (And shouldn't I at least use \text rather than \mbox?) –  Niel de Beaudrap Dec 30 '10 at 8:39
1  
@Niel: I don't see a good reason to use \text here. I'd probably have used \hbox directly and the inner math might need a \m@th (which is just \mathsurround=0pt) if \mathsurround has been set (which seems fairly unlikely). I don't see any particular reason to avoid switching between math and text either. LaTeX does it all the time. Even \big does it: \def\big#1{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}} –  TH. Dec 30 '10 at 9:25
    
@Niel: You shouldn't use text fontsize commands inside math, the erason why I use \mbox for a correct font style setting. You can also use \text here but it makes no difference because we are already in the lowest level of math (displaystyle). There is nothing what \text will do in different to \mbox –  Herbert Dec 30 '10 at 18:19
add comment

You can try the scalefnt package and scale it to what you need.

\documentclass[11pt]{article} % use larger type; default would be 10pt
\usepackage{amsmath,scalefnt}

\begin{document}
\scalefont{0.9}{
\begin{gather*}
    A = \left[\,\begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix}\,\right]
     \\
    A = \left[\,\begin{matrix} a & b & c \\ d & e & f \\ g & h & i \end{matrix}\,\right]
\end{gather*}}

\end{document}

Edit:

You can adjust the spacing between the matrix elements by using the math kern \mkern, as per the following example:

\[
     A = \scalefont{0.75}{\left[\,\begin{matrix} a&\mkern-15mub&\mkern-15muc\\d&\mkern-15mue&\mkern-15muf\\\end{matrix}\,\right]}
\]
share|improve this answer
    
A couple of minor quibbles: the \scalefont would have to be inside the math environment in order to only affect the matrix (which is what I described); and the braces would have to contain the \scalefont command, as it is a switch like \rmfamily rather than a macro like \textrm. –  Niel de Beaudrap Dec 29 '10 at 23:38
    
this is not a bad solution, but when the "scaled" math is put alongside non-scaled math, I find that the spacing inside the matrix doesn't scale the same way. At a ratio of 0.8 or so (about the same as \footnotesize for 11pt Palatino), it takes up more horizontal space than the cludgy \footnotesize approach, and exactly the same vertical space as a non-scaled matrix. While theoretically sound, in practice this is marginally better than not scaling the matrices at all. Is there anything else that can be done to improve how the spacing is determined for the scaled matrix? –  Niel de Beaudrap Dec 29 '10 at 23:45
    
@Niel See my edit, you can use the scalefont anywhere and you can adjust the space between the elements with mkern. –  Yiannis Lazarides Dec 30 '10 at 5:55
    
@Yannis: I do know that you can use \scalefont anywhere; hence the remark in my first comment above. I'm afraid that your revised answer is substantially worse than switching between text and mathmode, because it requires much more work and fiddling. (Much more so because I would have to adjust the vertical spacing as well as the horizontal!) Are there no automatic techniques for modifying matrix spacing? –  Niel de Beaudrap Dec 30 '10 at 8:37
1  
this is the same: A = \scalefont{0.75}{\arraycolsep=2pt\begin{bmatrix} a&b&c\\d&e&f\\\end{bmatrix}} –  Herbert Dec 30 '10 at 18:22
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.