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.

What is the correct way of doing a minus sign in a LaTeX Table? The minus sign I'm doing seems much longer than the minus sign in math mode.

share|improve this question
    
Surround the entire number with $$. Example $-5$ that puts it in math mode. If that does not work, please provide a MWE that shows the problem. –  Peter Grill Feb 10 '12 at 21:24
1  
no, it is the other way round: the minus in math mode is longer than the hyphen character –  Herbert Feb 10 '12 at 21:26
    
@Herbert: I suspect the OP is using --- and it is too long. –  Peter Grill Feb 10 '12 at 21:29
1  
@PeterGrill: Maybe, but without an example we can only guess ... –  Herbert Feb 10 '12 at 21:33

1 Answer 1

A minus sign in a table should be typeset in math mode to get the proper size and spacing:

enter image description here

The amsmath package is only required for the line where \text is used.

\documentclass{article}
\usepackage{amsmath}% only needed for last case where \text{} is used
\begin{document}
\begin{tabular} { l c }
    minus sign outside math mode (incorrect) & -5 \\
    minus sign inside math mode  & $-5$\\
    minus sign but not for a number  & $-$foo\\
    minus sign but not for a number  & $-\text{foo}$
\end{tabular}
\end{document}
share|improve this answer
    
What about \noindent\llap{-}5? –  J G Feb 10 '12 at 21:35
    
@JG: This would still have incorrect spacing between the operator and the operand. Moreover, if used with other surrounding text, the spacing would be wrong. –  Werner Feb 10 '12 at 21:38
    
Then what does that do? And, what is all of this foo stuff? I see lots of foo talk out there in latex land. –  J G Feb 10 '12 at 21:42
1  
@JG: I just used foo to indicate random text. It not a specific command. –  Peter Grill Feb 10 '12 at 21:43
1  
@JG: I think that you misunderstood what you read. You should post a separate question as the purpose of \llap is not to produce a minus sign. –  Peter Grill Feb 10 '12 at 21:52

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.