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.

In the below equation I'm writing, 2 minus signs are not visible, why is that?

$\phi (s, \lambda) = C
\frac{
1 + \beta^2 − 2 \beta cos( \frac{2 \pi s}{\lambda} )
}{
\lambda^5 \exp(
\frac{
h c
}{
\lambda k B T
} − 1)
}
$
share|improve this question
    
Those are not really minus signs. Delete them and replace them with the real minus sign - and they will show. –  Gonzalo Medina May 16 at 0:04
    
Wait, I just tried retyping them and it worked. Why is there a difference? –  Ryan May 16 at 0:09
1  
Because the symbol you had is not recognized as the minus sign; in fact, it is not recognized at all. –  Gonzalo Medina May 16 at 0:14
2  
You haven't provided a usable fragment (or even said that you are using LaTeX the \fracimplies that you are) LaTeX does not silently drop characters, assuming your file is UTF-8 encoded then had you declared \usepackage[utf8]{inputenc} you would have an error message ! Package inputenc Error: Unicode char \u8:− not set up for use with LaTeX. If you had not declared utf8 the bytes of the utf8 encoding would be interpreted directly as input for the 7bit cm fonts resulting in warnings in the log Missing character: There is no � in font cmr7! Missing character: There is no � in font cmr7! –  David Carlisle May 16 at 0:30

2 Answers 2

up vote 6 down vote accepted

The problem is that the character you are using is the Unicode minus sign which is not recognized by LaTeX with your current settings; it is U+2212 MINUS (most probably a result from a copy-paste). Replace the symbols with the LaTeX minus signs and they will show.

I took the liberty of modifying a little your expression to produce a better result for an on-line expression (perhaps you could consider showing this as a displayed expression):

\documentclass{article}

\begin{document}

$\phi (s, \lambda) = C
\bigl( 1 + \beta^{2} - 2 \beta \cos(2 \pi s\lambda^{-1} ) \bigr) /
\bigl( \lambda^{5} \exp( \frac{ h c }{ \lambda k B T} - 1) \bigr)$

\end{document}

enter image description here

Notice that for the cosine function you should use \cos and not just cos.

share|improve this answer
    
actually the character was U+2212 MINUS :-) –  David Carlisle May 16 at 0:25
    
Thanks, big help! –  Ryan May 16 at 0:26
    
@DavidCarlisle Thanks for the identification. –  Gonzalo Medina May 16 at 0:29
    
@barbarabeeton You're right. I've changed the redaction (I hope it's OK now). Thanks. –  Gonzalo Medina May 16 at 1:53
    
@GonzaloMedina -- yup. –  barbara beeton May 16 at 1:55

You should get an error message like

! Package inputenc Error: Unicode char \u8:− not set up for use with LaTeX.

unless you aren't loading \usepackage[utf8]{inputenc} (which is recommended); in this case the .log file would report

Missing character: There is no <E2> in font cmr7!
Missing character: There is no <88> in font cmr7!
Missing character: There is no <92> in font cmr7!

twice, because you have two minus signs.

The Unicode character U+2212 is not defined in utf8enc.dfu, but it's easy to add a definition for it:

\documentclass{article}
\usepackage[utf8]{inputenc}

\DeclareUnicodeCharacter{2212}{-}

\begin{document}
$\phi (s, \lambda) = C
\frac{
1 + \beta^2 − 2 \beta \cos( \frac{2 \pi s}{\lambda} )
}{
\lambda^5 \exp(
\frac{
h c
}{
\lambda k B T
} − 1)
}
$
\end{document}

Alternatively, use

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{newunicodechar}

% The offending character in the first argument
% and a hyphen in the second argument!
\newunicodechar{−}{-}     

\begin{document}
$\phi (s, \lambda) = C
\frac{
1 + \beta^2 − 2 \beta \cos( \frac{2 \pi s}{\lambda} )
}{
\lambda^5 \exp(
\frac{
h c
}{
\lambda k B T
} − 1)
}
$
\end{document}

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.