I've created this code which hopefully will make glossing a lot easier, the first input decides the order of a Transcription, Phonemic reading, Phonetic reading, and Gloss, and uses the input to generate the in text gloss in the order and format I want. When compiling, the resulting pdf has a large space inserted between the text before the gloss and the gloss generated by the command. I've made this code based off of a code which does mass replacement a la egreg's beautiful code answer in: How to do multiple string replacements?. Anything I'm missing that would cause this large gap?



\newcommand{\totalgloss}[5][T P A Q]{


. . . the plural form is \totalgloss[T A Q]{sargata}{sar\;Gan+ta}{sar\;Gata}{wives} which as you can see is . . . 


  • 6
    You have lots of spurious spaces in your definition. Add % at the end of the lines. Jul 4, 2019 at 17:10

1 Answer 1


Look for here! Every endline in the body of the definition contributes a space. There is none after \noexpandarg.

\newcommand{\glossstep}[2]{% <--- here

\newcommand{\totalgloss}[5][T P A Q]{% <--- here
\StrSubstitute{#1}{T}{\textit{#2}}[\x]% <--- here
\glossstep{P}{/\textipa{#3}/}% <--- here
\glossstep{A}{[\textipa{#4}]}% <--- here
\glossstep{G}{#5}% <--- here
\glossstep{Q}{`#5'}% <--- here
\glossstep{S}{\textsc{#5}}% <--- here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .