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 am new to TEX and am using scribtex as an online latex editor. My problem is that when I put hyphen in my text it sometimes appears and sometimes doesn't appear. What can be the reason for this and how do I fix this?

The code for example I am putting in is:

  \documentclass[12pt,oneside]{amsart}
  \usepackage{amssymb}
  \theoremstyle{plain}
  \newtheorem{theorem}{Theorem}[section]
  \newtheorem{lemma}[theorem]{Lemma}
  \newtheorem{corollary}[theorem]{Corollary}
  \theoremstyle{definition}
  \newtheorem{definition}[theorem]{Definition}
  \theoremstyle{remark}
  \newtheorem{remark}[theorem]{Remark}
  \newcommand{\R}{{\mathbb R}}
  \newcommand{\nil}{\varnothing}
  \begin{document}
  Reissener–Nordstrom 
  Reissener – Nordstrom 
  \end{document}

​ The output I get is "ReissenerNordstrom Reissener Nordstrom" whereas I expect "Reissener-Nordstrom Reissener-Nordstrom".

Thanks

share|improve this question
2  
What kind of hyphenation are you talking about: manual discretionary hyphenation like this\-is\-a\-long\-word or even \hyphenation{this-is-a-long-word}? If so, these only appear when necessary. If you want them to appear always, you can just write them as-is in your text: blah blah this-is-a-long-word blah blah –  Werner Oct 20 '11 at 15:23
1  
Welcome to TeX.SE. Keep in mind that it is always best to compose a MWE that illustrates the problem including the \documentclass. Personally, I have often solved my own problems in the process of reducing the amount of code actually required to reproduce the problem. So, if what is below does not answer the question for you, please create a MWE. –  Peter Grill Oct 20 '11 at 16:37
    
Thank you. I have implemented your suggestion. Can you now suggest what is going wrong? –  Shahab Oct 21 '11 at 11:31
    
@Shahab: see my answer –  Herbert Oct 21 '11 at 11:42
add comment

2 Answers

up vote 4 down vote accepted

what you call a hyphen is the unicode character for a n-dash. You can see it with

\documentclass[12pt,oneside]{amsart}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
[...]

I changed the first one to a hyphen to make the difference visible:

enter image description here

share|improve this answer
    
Thank you. Can you explain why earlier in well known english words (such as momentum-tensor) the dash was appearing while it wasnt appearing for Reissener-Nordstrom. –  Shahab Oct 21 '11 at 12:08
    
that depends to your keyboard or to the online LaTeX compiler. It is possible that your double -- hyphens are converted into the unicode caracter by default. However, using an online compiler does't really make sense –  Herbert Oct 21 '11 at 12:13
add comment

Hyphens are used for compound words like: son-in-law. For number ranges use two dashes: 15--24. Punctuation in sentences uses three dashes --- such as this. However, if you are in math mode then things are different as a dash is a minus sign. So, you need to use either \hbox, or \mbox, or \text (if you have amsmath pacakge loaded).

I just tied pasting the code below at http://scribtex.com, and the output PDF that I got seems to work fine.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

Compound words like: daughter-in-law.\par
Number ranges: 15--24.\par
Punctuation in sentences---such as this.

\bigskip
However, in math mode, a dash gets treated as a minus sign:
$15-25$, $15--24$ 

So use \textbackslash mbox (or \textbackslash hbox) to get back to text mode:
$a \mbox{-} b$  $15 \mbox{--} 24$

\bigskip
or with `amsmath` you can also use `\textbackslash text`:
$a \text{-} b$  

$14 \text{--} 24$
\end{document}
share|improve this answer
    
I added the Reissener–Nordstrom and was unable to get the hyphen in your code as well. –  Shahab Oct 21 '11 at 11:34
    
Looks like you have to use a -- in this case, but I don't know why. –  Peter Grill Oct 21 '11 at 17:51
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.