4

Ok, so here's some code that shows off the problem i'm having:

\documentclass[10pt,letterpaper]{article}
\usepackage{expex}

\newcommand{\gloss}[3]{\ex[numoffset=2em,aboveglftskip=0pt]
\begingl
\gla #1//
\glb #2//
\glft #3//
\endgl
\xe}

\begin{document}
\gloss123

blahblahblahblahblahblahblahblahblahblahblahblahblah

\ex[numoffset=2em,aboveglftskip=0pt]
\begingl
\gla 1//
\glb 2//
\glft 3//
\endgl
\xe

blahblahblahblahblahblahblahblahblahblahblahblahblah

\end{document}

This is the output it makes:enter image description here

As you can see, there's extra vertical space between the first gloss and the blahs. How can I get rid of this while still using \newcommand?

2 Answers 2

4

It stems from the fact that \gloss{.}{.}{.} leaves a spurious space in the input stream. You can avoid this by placing a % at the end, or by adding \ignorespaces at the end of your \newcommand definition:

enter image description here

\documentclass{article}
\usepackage{expex}

\newcommand{\gloss}[3]{\ex[numoffset=2em,aboveglftskip=0pt]
\begingl
\gla #1//
\glb #2//
\glft #3//
\endgl
\xe
\ignorespaces}

\begin{document}
\gloss{1}{2}{3}%

blahblahblahblahblahblahblahblahblahblahblahblahblah

\ex[numoffset=2em,aboveglftskip=0pt]
\begingl
\gla 1//
\glb 2//
\glft 3//
\endgl
\xe

blahblahblahblahblahblahblahblahblahblahblahblahblah

\end{document}
1
  • Thank you so much, this is exactly what I was looking for!
    – jakehuryn
    Jan 2, 2019 at 7:10
0

I don't know why this is happening but we can work around the issue by adding an negative vertical space \vspace{-\baselineskip}} at the end of the command.

\documentclass[10pt,letterpaper]{article}
\usepackage{expex}

\newcommand{\gloss}[3]{\ex[numoffset=2em,aboveglftskip=0pt]
\begingl
\gla #1//
\glb #2//
\glft #3//
\endgl
\xe
\vspace{-\baselineskip}
}
\begin{document}
\gloss123

blahblahblahblahblahblahblahblahblahblahblahblahblah

\ex[numoffset=2em,aboveglftskip=0pt]
\begingl
\gla 1//
\glb 2//
\glft 3//
\endgl
\xe

blahblahblahblahblahblahblahblahblahblahblahblahblah

\end{document}

enter image description here

2
  • Thanks for the answer! I like Werner's solution better but this is good to know as well.
    – jakehuryn
    Jan 2, 2019 at 7:11
  • @jakeh I agree with you that Werner's solution is by far better Jan 2, 2019 at 7:23

You must log in to answer this question.

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