# How to adjust the slant angle of a diacritic

I am trying to change the slant angle of an accent. I have used the fontdimen to adjust the quantity. The first portion of the code that follows adjusts fontdimen5 (the x-height). This works as you can see from the example. However, when I adjust fontdimen1 (slant) there is no change. I would appreciate it if someone can shed some light.

\documentclass[10pt]{article}

\usepackage{graphicx}

\begin{document}

\font \romanfont=cmr10
\font\specroman=cmr10
%% Next, the special registers
\newdimen\savedvalue
\savedvalue=\fontdimen5\romanfont
\newdimen\specialvalue
\specialvalue=4.75pt
%% Finally, definitions.

\def\specrm{%
\aftergroup\restoredimen
\fontdimen5\specroman=\specialvalue
\specroman  }
\def\restoredimen{%
\fontdimen5\romanfont=\savedvalue }

\scalebox{10}{\romanfont \'o}  {\scalebox{10}{\specrm \' o}}

\medskip
{\noindent\obeylines\specrm
the value of fontdimen1 (slant)  is \the\fontdimen1\font
the value of fontdimen2 (interword space) is \the\fontdimen2\font
the value of fontdimen3 (interword stretch) is \the\fontdimen3\font
the value of fontdimen4 (interword shrink) is \the\fontdimen4\font
the value of fontdimen5 (x-height) is \the\fontdimen5\font
the value of fontdimen6 (quad width) is \the\fontdimen6\font
the value of fontdimen7 (extra space)  is \the\fontdimen7\font
}
\medskip

\font \romanfont=cmr10
\font\specroman=cmr10
%% Next, the special registers
\newdimen\savedvalue
\savedvalue=\fontdimen1\romanfont
\newdimen\specialvalue
\specialvalue=0.15pt
%% Finally, definitions.

\def\specrm{%
\aftergroup\restoredimen
\fontdimen1\specroman=\specialvalue
\specroman  }
\def\restoredimen{%
\fontdimen1\romanfont=\savedvalue }

\scalebox{10}{\romanfont \'o}  {\scalebox{10}{\specrm \' o}}

\medskip
{\noindent\obeylines\specrm
the value of fontdimen1 (slant)  is \the\fontdimen1\font
the value of fontdimen2 (interword space) is \the\fontdimen2\font
the value of fontdimen3 (interword stretch) is \the\fontdimen3\font
the value of fontdimen4 (interword shrink) is \the\fontdimen4\font
the value of fontdimen5 (x-height) is \the\fontdimen5\font
the value of fontdimen6 (quad width) is \the\fontdimen6\font
the value of fontdimen7 (extra space)  is \the\fontdimen7\font
}

\end{document}


Edit: Lots of relevant information have been uploaded to github courtesy of zellyn. https://github.com/zellyn/accentbx

-
I can't explain why this happens, but if you remove the line \aftergroup\restoredimen in your first definition of \specrm, then the slant works. – Hendrik Vogt Oct 7 '10 at 21:52
@Vogt Thanks. The aftergroup was to restore the old metrics after a group. The slant now works but it just moves the accent left or right. – Yiannis Lazarides Oct 8 '10 at 5:14

To understand what happens you have to read the "double dangerous-bend" paragraph after Exercise 9.7 in the TeXbook, page 54. There it says: "The accent is assumed to be properly positioned for a character whose height equals the x-height of the current font; taller or shorter characters cause the accent to be raised or lowered, taking due account of the slantedness of the fonts of accenter and accentee."

Let me spell this out a bit: If you change \fontdimen1 to something different from 0, then this will affect the horizontal position of the accent only if the height of the character you put the accent on is different from the current x-height. In your example, you put the accent on an "o", which has the same height as "x", so you don't see any effect. Just try it with the letters "b" and "." instead. For "b" you see that the accent is moved to the right since "b" is higher than "x"; for "." the accent is moved to the left since "." is not as high as "x".

Thus, if you want to move the accent over an "o" to the left or to the right, you have to fiddle around a bit. Here's a quick and dirty solution:

\leavevmode\rlap{\hspace{0.3ex}\'}o


(The \leavevmode is needed if this "ó" is at the beginning of a paragraph.)

-
@vogt Thanks. The example above actually worked - I had a problem with the aftergroup (haven't corrected the code above though). I also tried combinations of \fontdimen1 and fontdimen5, by changing the x-height it gives better results. At the end though there is nothing in-build to also rotate the angle of the accent. – Yiannis Lazarides Oct 9 '10 at 14:18
@Yiannis: From what I wrote in my answer I can't understand how you fix the problem by changing something with \aftergroup. Consider posting an answer if you have a working solution. Also the accentbx package you recommended to me here might be a good solution for you. – Hendrik Vogt Oct 9 '10 at 15:34
@Vogt Will post the answer after a day or so (I am just busy generalizing it). Can't find the accentbx package anywhere only the paper, any idea? – Yiannis Lazarides Oct 9 '10 at 17:12
Instead of \hspace{0pt}, you should use \leavevmode. It \unhbox es a void box. \unhbox causes TeX to switch to horizontal mode. – TH. Oct 10 '10 at 5:18
@TH: Ah great, thanks. It was somehow clear to me that there should be something more professional. – Hendrik Vogt Oct 10 '10 at 7:39