# Consistent formatting for \glft in expex

In the ExPeX documentation, all of the examples with \glft wrap the glos with single quotes; the examples in my document look the same:

\pex
\begingl
\gla bu nɛmə //
\glb this what //
\glft What's this?' //
\endgl
\xe


In the interest of separating semantics from formatting, I would prefer to have those single quotes inserted automatically. The everyglft parameter will insert a single macro at the beginning of a line. Is there a way to have this done automatically.

I have this as a workaround, but it's a bit awkward as I have to make sure that the // delimiter comes immediately at the end of the gloss sentence so that I avoid extra spaces.

\def\myglft#1//{\glft #1' //}

• If you use a space as part of your delimited argument (\def\myglft#1 //), you get a little more flexibility. You must have some whitespace before //, but it doesn't matter how much, and if you forget to include it, you'll get an error, which means it won't go undetected like the extra space would with your version. – Jason Zentz Jun 24 '15 at 19:15
• I would recommend adding the macros and spacing tags so that experts in those areas can weigh in on whether it's possible to write a macro that does what you want (allow there to be no space before // but ignore any whitespace that is there). Your readership with just the expex tag is probably pretty limited. – Jason Zentz Jun 24 '15 at 19:18
• I had shied away from obligatory space delimiters, since it's just a different requirement, but I guess you're right that generating an error is preferable to having extra spaces in my document. – adam.baker Jun 25 '15 at 6:27

Solution 1: I personnally use ExPex together with textglos. Although textglos is meant for in-text examples, it doesn't seem to cause any problem within ExPex examples. Just put your free translation in textglos' \gl{} macro. See textglos' documentation to adapt/redefine \gl{} and to understand its syntax (there's a bit of tricky stuff there). Here you are:

In the preamble:

\usepackage{expex}
\usepackage{textglos}


Custom \gl{} as you wish (default are single quotes), in the preamble or in the body of the document:

\lingexample{gl}{<<~X~>>}


Then format the translation with \gl{}:

\pex
\begingl
\gla bu nɛmə //
\glb this what //
\glft \gl{What's this?} //
\endgl
\xe


Solution 1': textglos allows to define any further formatting commands, so you can leave \gl{} untouched and just use lingexample{}{} to make your own macro:

\lingexample{ft}{<<~X~>>}


Solution 1'': Now that I think of it, I'm not sure if textpos does anything better than any user-defined macro, like:

\newcommand{\ft}[1]{<<~#1~>>}
...
\glft \ft{What's this?} //


And then, basically my answers are an option only if you're happy with adding a macro in your code instead of hacking \glft.

Solution 2: This seems to do the trick: (But see Edit at the end!)

In the preamble, after loading expex, hack the definition of \glft around its #1, for example like this (code just copied from expex.tex before hacking it):

\makeatletter
\long\def\glw@glft@a #1//{%
\glw@printilgsetup
\glw@printilg@a
\vskip\lingaboveglftskip
\nointerlineskip
\egroup
\@glfttrue
\ifx\glstrut\strut
\ifdim\gl@maxdplast>\dp\strutbox \prevdepth=\gl@maxdplast \fi
\fi
\ling@usearg
\ling@everyglft
\strut <<~#1~>>\par
}
\makeatother


Solution 2': For easier customization, define two hooks, and add them to the redefinition of \glft:

\newcommand{\fthooka}{<<~}% put here what should appear at the beginning of the free translation
\newcommand{\fthookb}{~>>}% put here what should appear at the end of the free translation

\makeatletter
\long\def\glw@glft@a #1//{%
\glw@printilgsetup
\glw@printilg@a
\vskip\lingaboveglftskip
\nointerlineskip
\egroup
\@glfttrue
\ifx\glstrut\strut
\ifdim\gl@maxdplast>\dp\strutbox \prevdepth=\gl@maxdplast \fi
\fi
\ling@usearg
\ling@everyglft
\strut \fthooka{}#1\fthookb{}\par
}
\makeatother


If needed, redefine the hooks anywhere anytimes in the document with \renewcommand.

I'll send this answer to ExPex's author, because I think this could well be implemented in the package.

Edit: This solution as well as the OP's workaround interact bad with \trailingcitation. Indeed the trailing citation gets inside the quotation marks. Something like this:

\glft Free Translation. \trailingcitation{(Citation)}//


or

\myglft Free Translation. \trailingcitation{(Citation)}//


will look like that:

`Free Translation. (Citation)'

So the hack has to get deaper into ExPex's code, but it's over my competences.