# Getting small caps in linguistics glosses automatically using gb4e

I am searching for a way to automatically format appropriate parts of a gb4e morpheme-by-morpheme gloss in small caps.

I use small caps in the gloss line to mark out functional material; that is, everything apart from the lexical root is formatted in small caps, as in the picture.

Currently, I produce this by adding \textsc every time I want to have small caps. Thus, the example in the picture is generated by the following code:

%typeset in XeLaTeX for the Turkish characters to show correctly; but this is not what's at stake

\documentclass{article}
\usepackage{gb4e}
\begin{document}

\begin{exe}
\ex \gll  Hasan-Ø [uşağ-ın oda-yı temizle-me-sin]-i söyle-di-Ø. \\
Hasan-\textsc{Nom} servant-\textsc{Gen} room-\textsc{Acc} clean-\textsc{NFNom-3Sg-Acc} say-\textsc{Past-3Sg} \\
\glt Hasan said that the servant should clean the room.'
\end{exe}

\end{document}


Note the five occurrences of \textsc in the gloss line; it's this repetition that I'd like to avoid. I'm looking for a way to tell gb4e to format the appropriate chunks of the gloss line into small caps every time I need to generate a gloss. I assume this would involve fiddling with the package macros, but I'm not sure how to implement this.

In terms of defining the environment where I would need small-capitalisation to apply, I can define it as follows. It is the gloss line only, understood (in the simplest case) as the string between the two occurrences of \\ within the example environment defined by \begin{exe} and \end{exe}. Within this domain, small-capitalisation should affect whatever sits between a dot or dash (which are the symbols separating morphemes) and a whitespace.

Having to add \textsc multiple times is only a minor annoyance, so it wouldn't break my heart to find that what I'm asking for is misguided. But it would be nice to have this automation.

• gb4e will let you set the format of an entire glossed tier to whatever you want, e.g. with \let\eachwordtwo=\textsc. The catch is that you only want the gloss labels in small caps, not the translations... – alexis Mar 23 '18 at 15:33
• You may want to check out the leipzig. It is designed specifically for linguistic gloss abbreviations, and along with handling the small caps, it also lets you easily create abbreviations lists. – Jason Zentz Mar 23 '18 at 18:58

The leipzig package provides many macros for linguistics gloss abbreviations, which you can redefine as desired, along with adding your own. Small caps are taken care of as part of the general macro mechanism (though the formatting can be changed using \leipzigfont). Using macros for the abbreviations helps you stay consistent throughout a paper, and if you decide at some point that you want to change how you gloss some morpheme, then you can do so with a single line of code in the preamble (just redefine the macro you've been using). The package also can work with glossaries to automatically produce a list of abbreviations and their full forms, in table or paragraph (footnote) form.

Here's your MWE set using leipzig.

\documentclass{article}

\usepackage{libertine}
\usepackage{leipzig}
\newleipzig{nfnom}{nfnom}{non-factive nominalization} % defined a new macro for this because it doesn't come with the package; see section 3.1 of the leipzig documentation for an explanation
\usepackage{gb4e}

\begin{document}

\begin{exe}
\ex \gll  Hasan-Ø [uşağ-ın oda-yı temizle-me-sin]-i söyle-di-Ø. \\
Hasan-\Nom{} servant-\Gen{} room-\Acc{} clean-\Nfnom-\Tsg-\Acc{} say-\Pst-\Tsg{} \\
\glt Hasan said that the servant should clean the room.'
\end{exe}

\end{document}


You could try to define a shortcut command. One proposition:

\documentclass{article}
\usepackage{gb4e}
\usepackage{enumitem}
\def \-#1 {-\textsc{#1}}
\begin{document}
\begin{exe}
\ex Hasan\-nom
\end{exe}
\end{document}


• Thanks for replying. I'd already considered a similar solution, but since I already use the already extant (and somewhat primitive) commands \- and \. for tabbing and dotting letters, respectively, I'm a bit hesitant to overwrite them for use in glosses. I could of course use longer names for the shortcut commands (in fact this is what I will do if there isn't a straightforward way to implement my original idea), but given that textsc is already a fairly short command this solution wouldn't make a massive difference. – Lefteris_the_linguist Mar 23 '18 at 11:30