I am preparing a poster based on a specific template I have to use. The template uses Arial as font. Strangely, typing "--" (for example for page ranges in references) does not result in an en-dash (–), but rather two visible hyphen characters "-"'s. Is there an alternative way to generate an en-dash directly?
Here's a compilation of solutions, roughly ranked in descending order by importance. This answer incorporates information gleaned from comments below the original query -- e.g., that XeLaTeX and thus the
fontspec package are in use.
TeXLive2013 is seriously out of date as of February 2019. Do yourself a big favor and update your TeX distribution to TeXLive2018. An immediate benefit of performing this update is that you won't have to specify the option
\setsansfont, etc. I.e., this option is now among the defaults.
As @Davislor has pointed out in a comment, it is actually still necessary, even under the latest TeXLive distribution, to specify
babelfontis in use. Nevertheless, you'll come to appreciate the many small and large improvements that have occurred in TeXLive and its packages (including
fontspec) over the past 5 years.
\setsansfont, etc., be sure to specify the option
Ligatures=TeX. (For TeX, creating the en-dash from
If you are a glutton for punishment :-), you could write either
--. See @Davislor's answer for more information. :-)
If you don't mind twisting your fingers into pretzel-like shapes, by all means enter the Unicode en-dash symbol directly from your keyboard. See some of the other answers for possibilities... The precise key and finger-twist combination needed to output an en-dash will depend both on the operating system (MacOS? Windows? something else?) and the national keyboard that's active.
For those using Debian Linux with a German keyboard (I know you're out there), the “Alt Gr” key in conjunction with the hyphen key produces the en dash, and the “Alt Gr” in conjunction with the underbar (Shift-hyphen) produces the em dash.
I believe that if you use UTF8 encoding (either through LuaLaTeX, XeLaTeX, or through the inputenc package) you can just type it directly into the editor.
The shortcut for the en-dash is:
"Alt+0150" for Windows
"OPT+-" for Mac
And I don't know what the shortcut is in Linux, but I'm sure you can google it and find out. Alternatively you can just copy and paste it from somewhere.
If you are an Emacs user, the following sequence of keystrokes will input the Unicode en-dash character (hex: 2013)
C-x 8 Return 2013 Return
fontspec loaded and the TU encoding selected, you can enter either
^^^^2013. There’s no real reason to type any of those instead of
\textendash, but I mention them for completeness.