# Replace hyphen character from other font

I use the EB Garamond font. The only thing that has been bothering me for a long time is the hyphen character, which is slightly sloping. Is it possible to replace the hyphen character of EB Garamond with the character from another font such as Latin Modern or Times? I've already experimented with "\hyphenchar", but haven't found a suitable solution.

\documentclass[12pt]{report}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}

\begin{document}

How can I use the hyphen character from another font? It should be used in justified type even if the words are automatically hyphenated at the end of the line.

\end{document}

• Hi Raffael, welcome to TeX.SE! Can you maybe post a screenshot of the hyphen you want to use and the hyphen you want to replace? In general this does not sound like a Good idea typographically, because the font designer probably put a lot of thought into the design of the hyphen. Aug 13 '20 at 9:46
• A flatter hyphen can be obtained with \rotatebox[origin=c]{-7}{-}. However, how to make that the default is a more difficult proposition. Aug 13 '20 at 10:03
• with lualatex you could replace the char, with pdflatex imho a sane solution would require to create a new font, that means at least some virtual font + suitable tfm. Aug 13 '20 at 13:34

While I don't think it is advisable to exchange single characters between fonts, there is one possibility – use another character for hyphens from the same font.

Replace the hyphen character with an en-dash:

\documentclass[12pt]{report}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ebgaramond}

\begin{document}
\hyphenchar\font=\textendash
How can I use the hyphen character from another font? It should be used in justified type even if the words are automatically hyphenated at the end of the line.

\end{document}


# With regular hyphens

• I have now tried to combine your proposal with the idea of @steven-b-segletes as follows: \newcommand{\newhyphen}{\rotatebox[origin=c]{-7}{-}} \hyphenchar\font=\newhyphen Unfortunately, it doesn't work with the command I created. Aug 13 '20 at 11:39
• @Raffael, I don't think that's possible. If I remember correctly, there was a way to change the font of hyphenchar with XeTeX. Since I don't closely follow the XeTeX development, I don't know whether that's still the case. Aug 13 '20 at 14:04