2

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?

\documentclass[a4paper]{article}
\usepackage{xstring}
\usepackage{tipa}

\newcommand{\glossstep}[2]{
\expandafter\StrSubstitute\expandafter{\x}{#1}{#2}[\x]}

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

\begin{document}

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

\end{document}

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

1 Answer 1

3

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

\newcommand{\glossstep}[2]{% <--- here
\expandafter\StrSubstitute\expandafter{\x}{#1}{#2}[\x]}

\newcommand{\totalgloss}[5][T P A Q]{% <--- here
\noexpandarg
\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
\x}

You must log in to answer this question.

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