# Typeset old Spanish abbreviation: center ending over period

For a modern edition of music from the seventeenth century Spanish empire, I need to typeset certain antiquated abbreviations in the manuscript sources. In this convention, the middle part of the word is abbreviated and the ending is centered over the period. For example:

For the curious, this expands to "Al Santissimo [Sacramento]. a 8", meaning the piece is dedicated to the Blessed Sacrament (and so used for Corpus Christi or Eucharistic devotion), and is scored for eight voices.

The command in the MWE does this using \rlap, but the ending is left-aligned with the period. When using italics (at least when using ebgaramond), the ending collides with the preceding letter.

How could I space this better so that the ending is centered over the period without collisions, in both roman and italic type?

\documentclass[12pt]{article}

\usepackage{ebgaramond}
\usepackage[T1]{fontenc}

\newcommand{\oldabbrev}[2]{#1\rlap{.}\textsuperscript{#2}}

\begin{document}

\oldabbrev{M}{o} Salazar, \oldabbrev{Villan}{co} al \oldabbrev{SS}{mo} a 8

\itshape
\oldabbrev{M}{o} Salazar, \oldabbrev{Villan}{co} al \oldabbrev{SS}{mo} a 8

\end{document}


• Non-centered looks good IMHO. I doubt the centered version will look better. – clemens Jun 7 '16 at 16:41
• FWIW, these abbreviations aren't generally considered to have the period centered. The way you have shown, un-centered, is the way I would expect (I work with 15-17th century Spanish literature). – user0721090601 Jun 8 '16 at 1:42
• It doesn't look like the period is centered in the text sample you posted. Also, it doesn't "make sense" (to me) to center the period for this type of abbreviation, because the period denotes an abbreviation, and always goes at the end of the word in that case. The superscript letters are just there to clarify, because there could be multiple words with the same abbreviation. – sig_seg_v Jun 8 '16 at 3:07
• @guifa Thank you for your expertise! After looking at the answers I no longer think the period should be centered, just that in italics I need to avoid a collision. – musarithmia Jun 9 '16 at 16:37

Credit to Joseph at Detect which text "mode" (normal, italic, bold, etc.) is currently in use? for helping to determine if in italic shape. If so, an extra kern is applied to the over-script (relative to the dot below) to make it aesthetically compatible with italic shape.

Note that I chose to center the dot under the first letter of the over-script, as shown in the OP's figure.

\documentclass[12pt]{article}
\usepackage{ebgaramond}
\usepackage[T1]{fontenc}
\usepackage{stackengine}
\makeatletter
\newcommand*{\IfItalicTF}{%
\ifx\f@shape\my@test@it
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
}
\newcommand*{\my@test@it}{it}
\makeatother
\newcommand\oldabbrev[2]{#1\nobreak%
\def\stacktype{L}\setstackgap{L}{.5\baselineskip}\oldabbhelp#2\relax\relax}
\def\oldabbhelp#1#2\relax{\bgroup\scriptsize%
\stackon{\normalsize.}{\IfItalicTF{\kern1.5pt}{}#1}\stackon{}{#2}\egroup}
\begin{document}
\oldabbrev{M}{o} Salazar, \oldabbrev{Villan}{co} al \oldabbrev{SS}{mo} a 8

\itshape
\oldabbrev{M}{o} Salazar, \oldabbrev{Villan}{co} al \oldabbrev{SS}{mo} a 8
\end{document}


If one truly wanted the dot under the center of the over-script, then this simple redefinition

\def\oldabbhelp#1\relax{\bgroup\scriptsize%
\stackon{\normalsize.}{\IfItalicTF{\kern1.5pt}{}#1}\egroup}


will have the effect:

• Above and beyond as usual! – musarithmia Jun 9 '16 at 16:38
• @AndrewCashner Thank you for the kind words. – Steven B. Segletes Jun 9 '16 at 16:43

Centering is easy; the collision is cured by \/.

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}

\usepackage{ebgaramond}

\newcommand{\oa}[1]{%
\/{\ooalign{\textsuperscript{#1}\cr\hidewidth.\hidewidth\cr}}%
}

\begin{document}

M\oa{o} Salazar, Villan\oa{co} al SS\oa{mo} a 8

{\itshape
M\oa{o} Salazar, Villan\oa{co} al SS\oa{mo} a 8}

\end{document}


Not sure it is good, though.

I couldn't resist to propose a small variant to Steven B. Segletes' solution using a font which has contextual historic S (EBGaramond doesn't, unfortunately), and a centred dot not on the base line. It compiles with xelatex or lualatex..

\documentclass[12pt]{article}

\usepackage{stackengine}
\usepackage{fontspec}
\setmainfont{Sabon Next LT Pro}

\newcommand{\myoldabbrev}[2]{#1\textsuperscript{\smash{\stackunder[0.5ex]{#2}{\normalsize.}}}}%

\begin{document}
\upshape \myoldabbrev{M}{o} Salazar, \myoldabbrev{Villan}{co} al \myoldabbrev{SS}{mo} a 8

\itshape
\myoldabbrev{M}{o} Salazar, \myoldabbrev{Villan}{co} al  \myoldabbrev{SS}{mo} 8

\myoldabbrev{M}{o} Salazar, \myoldabbrev{Villan}{co} al  \myoldabbrev{\char"017F\char"017F\kern0.25em}{mo} 8

\end{document}


• I'm not sure ſs is correct to use here. – Joey Jun 7 '16 at 19:59
• I have no control on it, because, for LaTeX, the last letter of the word, is the second s. It's the StylisticSet=4 which decided. You may ask the font designer to change that… Anyway, it was just for fun. – Bernard Jun 7 '16 at 20:14
• @Joey: Finally, I've done it manually. – Bernard Jun 7 '16 at 20:26

Yes, this can certainly be done. Try the following:

\documentclass{article}
\thispagestyle{empty}
\newlength{\dotcenterwd}
\def\dotcenter#1{%
\settowidth{\dotcenterwd}{\textsuperscript{#1}}%
\hbox to\dotcenterwd{\textsuperscript{#1}}%
\kern-\dotcenterwd%
\hbox to\dotcenterwd{\hfil.\hfil}%
}%
\begin{document}
\Huge
M\dotcenter{o}
\textit{M\dotcenter{o}}
M\dotcenter{co}
\textit{M\dotcenter{co}}
SS\dotcenter{mo}
\textit{SS\dotcenter{mo}}
\end{document}


This should give you what I believe you want:

There are some problems with this solution: namely, there's no character-specific kerning involved. Really, the "m" in the superscript is too close to the characters to the left, but if we correct for that, then the "o" is too far from them. I'm not sure how to solve that problem.

Note that this should be font-independent, too. Does that achieve your goal?

• \makeatletter and \makeatother are not really needed in your code. (Also personally I'd prefer \newcommand*[1] over \def#1) – clemens Jun 7 '16 at 16:55
• doesn't look bad with the "o" superscript, but please try it with SS\dotcenter{mo}. not nearly as nice, and the superscripted "m" is still awfully close to the "M" when it's italic. – barbara beeton Jun 7 '16 at 17:01
• That's true about the superscripted "m" being too close to the "M", but I'm not sure how to fix that without ruining the kerning on the "o", short of using some crazy branching conditional to adjust spacing depending on the following character. Any ideas on that? – dgoodmaniii Jun 7 '16 at 17:35