Americanist Phonetic Alphabet (APA) Glottalized Plosive

Could someone please help me to write an apostrophe directly above a character? This symbol is used in the APA for glottalized, and I've scoured the tipa manual and can't find anything there (probably because IPA writes the apostrophe after the character).

Here's an example:

You can use a smaller apostrophe, that can be stacked on the letter with tabular.

\documentclass{article}

\makeatletter
\DeclareRobustCommand\glottal[1]{%
\check@mathfonts
\begingroup
\renewcommand{\arraystretch}{0}%
\begin{tabular}[b]{@{}c@{}}
\fontsize{\ssf@size}{0}\selectfont
\raisebox{-0.7ex}[\dimexpr\height-0.7ex][0pt]{'}\\
#1
\end{tabular}%
\endgroup
}
\makeatother

\begin{document}

Some\glottal{t}hi\glottal{n}g

{\Large Some\glottal{t}hi\glottal{n}g\par}

{\footnotesize Some\glottal{t}hi\glottal{n}g\par}

\end{document}


The same code with just \usepackage{newtxtext} (for Times) produces

This is encoded in Unicode as "Combining Comma Above" (U+0313} and with a suitable font and XeLaTeX or LuaLaTeX can be entered directly. In the example below I've made a \glottal macro to make input simpler. I've used Doulos SIL as the font, which places the character correctly; other fonts may place it differently, unfortunately (for example, Linux Libertine O and CMU Serif both seem to place it to the right, but Doulos and Charis SIL place it correctly.)

Note your browser may not display the actual character on the site, but if you cut and paste this code into your editor it will 'magically' appear. (I've attached a screenshot of the code for the skeptical.)

As noted in the comments if your editor has trouble displaying the character, you can define the command with its unicode value.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Doulos SIL}
\newcommand{\glottal}[1]{#1̓}
%\newcommand{\glottal}[1]{#1^^^^0313} (Alternative)
\begin{document}
\glottal{t}
\end{document}


• Reading your answer I understood how much I am ignorant both in LaTeX and in linguistics! – CarLaTeX Sep 21 '17 at 5:37
• Actually, I do see the combining comma in the posted code. Perhaps it is browser and/or OS dependent (or dependent on available fonts)? I see this both in Vivaldi and Safari on the Mac. – Harald Hanche-Olsen Sep 21 '17 at 15:03
• @HaraldHanche-Olsen Yes, that's true. It shows up properly on my phone, badly with Safari for me and not at all in Firefox or Opera on the Mac. – Alan Munn Sep 21 '17 at 15:17
• \newcommand{\glottal}[1]{#1^^^^0313} would do the same and doesn't depend on editor features. – egreg Sep 21 '17 at 15:22

You could use stackinset from stackengine package:

\documentclass{article}
\usepackage{stackengine}

\newcommand{\glottal}[1]{\stackinset{c}{}{t}{-3.2pt}{,}{#1}}

\begin{document}
Some\glottal{t}hing

Something \glottal{t} something
\end{document}


Here's a solution that uses the \ooalign "primitive" to place a script-sized apostrophe above the macro's argument (here: t).

The code assumes that the \glottal macro will never be used in first-level, let alone second-level subscript and superscript material. I trust this isn't much of a constraint.

\documentclass{article}
\newcommand\glottal[1]{%
{\ooalign{#1\cr\hidewidth\raisebox{0.7ex}{\scriptsize'}\hidewidth\cr}}}
\usepackage{newtxtext} % for a Times Roman clone
\begin{document}
tt\glottal{t}tt
\end{document}

• I added a couple of braces in order to keep local the changes done by \ooalign. If you embed the (original) construction in a paragraph, you'll know why. – egreg Sep 21 '17 at 11:18