How to generate an en-dash (–) other than "--"

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 Ligatures=TeX when executing \setmainfont, \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 Ligatures=TeX if babelfont is 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.

  • When executing \setmainfont, \setsansfont, etc., be sure to specify the option Ligatures=TeX. (For TeX, creating the en-dash from -- involves ligation.)

  • Write \textendash instead of --.

  • If you are a glutton for punishment :-), you could write either \char"2013 or \symbol{2013} instead of --. 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.

Tags:

Fonts

Symbols