# Raise/lower a single character of a font (hyphen)

The font I'm using (Merriweather Sans) places the hyphen a little too high:

Is there any way I can fix this for the entire document,
in a way that doesn't affect the other fonts?

Test document:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{merriweather}
\begin{document}

\sf
h-y-p-h-e-n

% I want the code above to look like:
h\raisebox{-.15ex}{-}y\raisebox{-.15ex}{-}p\raisebox{-.15ex}{-}h\raisebox{-.15ex}{-}e\raisebox{-.15ex}{-}n

\end{document}


UPDATE 31 Mar 2014: The Merriweather font has been updated with a lower hyphen.

• You mean changing also the automatically inserted hyphens? – egreg Jan 17 '14 at 18:59
• @egreg Yes. Any occurrence of the hyphen character, no matter whether it was put there manually or inserted automatically. – Ruben Verborgh Jan 17 '14 at 19:55
• With pdflatex the only possibility is to modify the font, I'm afraid. – egreg Jan 17 '14 at 20:18
• @egreg Really? I thought that virtual fonts could perhaps do something (but I have no idea on how to use them). Now, I've been in touch with the font author and it's possible that I can obtain an updated version that fixes this and other issues. – Ruben Verborgh Jan 17 '14 at 20:29
• @RubenVerborgh It could be done with virtual fonts. You can edit the relevant files directly but it would probably be easier to use fontinst which provides commands enabling you to control this. Note that it already depends on virtual fonts. There's no reason not to create a distinct set for your own purposes but I'm not clear whether the existing virtual fonts include any tweaks which you might lose out on. (There doesn't seem to be a script or Makefile provided as source, at least in TeX Live. This might mean the commands were run directly without any tweaks - or they were added manually.) – cfr Jan 17 '14 at 22:08

As egreg says, it can't be done in a generalized way. And in this answer, I don't have merriweather font, so I just demonstrate the technique (and exaggerate the effect) on the standard CM font.

One can locally achieve what you ask by making - active; however, that breaks many, many things, because it means the negative sign has been redefined. So the compromise I propose here is a macro pair \newhyphenON and \newhyphenOFF. In this way, you can turn \newhyphenON when you are just typing text with your shifted hyphens, and turn it off for just about everything else.

In this MWE, I show how, when \nehyphenOFF has been invoked, the minus sign is restored for use in a \raisebox. But when \nehyphenON is invoked, the shifted hyphen is in place.

\documentclass{article}
\usepackage[T1]{fontenc}
%\usepackage{merriweather}
\sffamily
\begin{document}
\let\svhyphen-
\def\newhyphen{\raisebox{-.5ex}{\svhyphen}}
\catcode-\active
\def\newhyphenON{\catcode-\active\def-{\newhyphen}}
\def\newhyphenOFF{\catcode-=12\let-\svhyphen}
\catcode-=12

\newhyphenON
h-y-p-h-e-n

\newhyphenOFF
h-y-p-h-e-n X\raisebox{-1ex}{X}

\newhyphenON
h-y-p-h-e-n

\newhyphenOFF
h-y-p-h-e-n

\end{document}