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 have a 2x2 matrix of arrows (\uparrow and \downarrow) to illustrate electronic spins. I've managed to get a fraction without the horizontal line using \genfrac, but I can't figure out how to reduce the vertical spacing between the pairs of arrows down.

What I have so far (working example):

\documentclass[a4paper,10pt]{article}  
\usepackage{amsmath}  
\newcommand{\stack}[2]{\genfrac{}{}{0pt}{0}{#1}{#2}}  
\begin{document}  
$\stack{\uparrow\uparrow}{\downarrow\downarrow}$  
\end{document}

EDIT: This is what I ended up doing, after combining some of the answers here:

\newcommand{\stack}[2]{\array{c}{\scriptstyle #1}\\[-1.1ex]{\scriptstyle #2}\endarray}

And the final result, which is going into my report:

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\newcommand{\up}{\uparrow}
\newcommand{\dw}{\downarrow}
\newcommand{\stack}[2]{\array{c}{\scriptstyle #1}\\[-1.1ex]{\scriptstyle #2}\endarray}
\begin{document}

\begin{table}
    \centering
    \begin{tabular}{|c|c|c|c|c|}
        \hline
        Spin arrangements &Spins up &Degeneracy &Energy &Magnetization \\ \hline
        $\stack{\up\up}{\up\up}$ &4 &1 &-8J &4 \\
        $\stack{\up\up}{\up\dw}$ $\stack{\up\up}{\dw\up}$ $\stack{\up\dw}{\up\up}$ $\stack{\dw\up}{\up\up}$ &3 &4 &0 &2 \\
        $\stack{\up\up}{\dw\dw}$ $\stack{\dw\dw}{\up\up}$ $\stack{\up\dw}{\up\dw}$ $\stack{\dw\up}{\dw\up}$ &2 &4 &0 &0 \\
        $\stack{\up\dw}{\dw\up}$ $\stack{\dw\up}{\up\dw}$ &2 &2 &8J &0 \\
        $\stack{\up\dw}{\dw\dw}$ $\stack{\dw\up}{\dw\dw}$ $\stack{\dw\dw}{\up\dw}$ $\stack{\dw\dw}{\dw\up}$ &1 &4 &0 &-2 \\
        $\stack{\dw\dw}{\dw\dw}$ &0 &1 &-8J &-4 \\
        \hline
    \end{tabular}
\end{table}

\end{document}
share|improve this question
2  
Welcome to TeX.sx!. For this you could just use a matrix: $\begin{matrix} \uparrow\uparrow\\ \downarrow\downarrow\end{matrix}$ in the text. There is also the smallmatrix envioronment, or you can replace ` \\ ` by \\[-0.5ex] to make the lines closer if you wish. –  Andrew Swann Nov 5 '12 at 11:43
1  
"If in doubt check what DEK put in plain TeX." How about $\uparrow\uparrow\atop\downarrow\downarrow$? –  Thruston Nov 5 '12 at 12:31
    
Thank you both. I think I'll go for a matrix or array as mentioned by @Herbert below here. Now, is there any way to make a shortcut like \stack{\uparrow\uparrow}{\downarrow\downarrow} from this? –  Filip Sund Nov 5 '12 at 13:36
    
\atop gives me some weird amsmath errors though, know how to fix those? Package amsmath Warning: Foreign command \atop, (amsmath) \frac or \genfrac should be used instead. –  Filip Sund Nov 5 '12 at 13:44

1 Answer 1

try

$\array{c}\uparrow\uparrow\\\downarrow\downarrow\endarray$  

You can use it in a macro as well.

share|improve this answer
2  
Wouldn't {@{}c@{}} be better, so as to avoid introducing padding on the left and the right? –  egreg Nov 5 '12 at 11:08
    
yes and no, it depends to the context in which it should be used –  Herbert Nov 5 '12 at 12:10
    
This result of this is pretty much what I already have, but if I replace \\ with \[-0.5ex], as mentioned by Andrew Swann, this does the trick. –  Filip Sund Nov 5 '12 at 13:32

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.