[Tex/LaTex] Changing “-” to \textendash

punctuationsymbols

I have a large LaTeX document, where hyphens are typeset with a single dash ("-") throughout. In my font, this shows up as a bold and vertically slightly off-center blob, but I'd like it to look like \textendash.

I tried to define - as a command that would translate to \textendash (by inserting \newcommand{-}{\textendash} in the preamble) but of course it didn't work. However I'd like it to work with the current "-" left in, since I 1) don't want to have to go through the entire document to replace the correct ones, and 2) don't want to rely on the next person editing the document avoiding "-" in favor of something else.

Is there any way to make "-" render in a nicer way?

Clarification:

  • It is not necessary for me to use the \textendash specifically – my main concern is that the dashes that are produced, both by my - in the source, and by LaTeX's hyphenation at line-breaks, are ugly. I want a nicer rendering, but I have no specific requirement on which character should be used.
  • The document can contain math minuses, and will definitely contain hyphens in references to file names. I only want to change the actual hyphens – basically, change the character TeX uses when it sees - in the source, and in every place that character would be used in a document.

Best Answer

Well you can make the - active and then define it. But it will affect all hyphens: real hyphens, math minus, hyphens in file names. On the whole I would say: don't do it. The trouble you get will cost you more time than changing you document.

\documentclass{article}
\begin{document}
\catcode`\-=\active
\newcommand-{hallo}

a - b

so-called

$1-1=0$

%\input{test-hyphen} %error
\end{document}