2

I have a problem regarding changing values of parameters of linguex. In the documentation it says that you can change the value of \Extopsep, which is responsible for spacing before and after the enviroment. I tried this with \setlength{\Extopsep}{.3\baselineskip}. Could there maybe be a problem with the package setspace in combination with linguex which i am using too?

This is how my Programm looks

\documentclass[12pt, a4paper]{article}
\usepackage{setspace}

\usepackage{linguex}
\let\eachwordone=\it
\setlength{\Extopsep}{.3\baselineskip}

\begin{document}

\begin{spacing}{1.5}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. 
\exg.
At vero eos et accusam \\
et justo duo dolores et \\

ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
\end{spacing}
\end{document}

PDF that the Code creates

The spacing before the example seems to be much larger than after. I can't seem to find out the issue with my code. Could anyone maybe help me with this?

EDIT:

It seems to be the case that as soon as you try to modify baselinestretch in any way the spacing comes out incorrect. I also tried it without setspace and instead with \linespread{1.5} and it still didn't come out right - using setspace doesn't really seem to make a difference.

\documentclass[12pt, a4paper]{article}
\linespread{1.5}

\usepackage{linguex}
\let\eachwordone=\it
\AtBeginDocument{\setlength{\Extopsep}{.3\baselineskip}}

\begin{document}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. 
\exg.
At vero eos et accusam \\
et justo duo dolores et \\

ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\end{document} 

PDF line spacing issues

The spacing is still uneven, even in the absence of a setspace enviroment, the problem seems to occur because of linguex alone

2 Answers 2

1

linguex can not control the spacing after the display as well as the space before it as it constructs a two line vbox with the reference point on the baseline of the first line, that allows an automatic \baselineskip calculation at the top to control baseline to baseline space, however at the bottom Tex sees all of the second line as depth so gives up and just inserts \lineskip (1pt) space.

@wipet gave a nice simpler example of this and a fix for the problem the other day here

vertical spacing around tabular

The only problem here is to find the vbox where you want to save \prevdepth and where to restore it. Staring at \tracingall for a while leads to \twosent from the cgloss4e package. The following is one way (perhaps not the best) of saving \prevdepth at the right place to set it to (here) the depth of j on the second line.

\documentclass[12pt, a4paper]{article}
\usepackage{setspace}

\usepackage{linguex}
\makeatletter
\gdef\twosent#1\\ #2\\{% #1 = first line, #2 = second line
    \getwords(\lineone,\eachwordone)#1 \\%
    \getwords(\linetwo,\eachwordtwo)#2 \\%
%%%%
\xdef\zz{\prevdepth\the\dp\linetwo\relax}%
\aftergroup\aftergroup\aftergroup\zz
%%%%
    \loop\lastword{\eachwordone}{\lineone}{\wordone}%
         \lastword{\eachwordtwo}{\linetwo}{\wordtwo}%
         \global\setbox\gline=\hbox{\unhbox\gline
                                    \hskip\glossglue
                                    \vtop{\box\wordone   % vtop was vbox
                                          \nointerlineskip
                                          \box\wordtwo
                                         }%
                                   }%
         \testdone
         \ifnotdone
    \repeat
    \egroup % matches \bgroup in \gloss
   \gl@stop}





\begin{document}

\begin{spacing}{1.5}\setlength{\Extopsep}{0pt}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. 


\exg.
At vero eos et accusam \\
et justo duo doloregs et \\


ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
\end{spacing}
\end{document}

enter image description here

2
  • Thanks David. I'll contact the maintainer of cgloss4e and suggest this approach as a more general fix to the package.
    – Alan Munn
    Feb 12, 2021 at 21:20
  • Thanks for your answer! This solves my problem. It all works just fine now!
    – paulez
    Feb 13, 2021 at 10:16
1

There are two issues with your example. First, the linguex package resets all its default lengths using \AtBeginDocument, so any change you make to them in the preamble is overridden. So the change you've made is not actually being used in the document; it's still using the default, which is .66\baselineskip. To actually change the length globally for your document you need to use:

\AtBeginDocument{\setlength{\Extopsep}{.3\baselineskip}}

But this may not really be doing what you expect, since this will set the length to be .3*14.5pt, i.e., .3 of the baseline skip for 12pt normal text. This value will not change within the spacing environment, unless you set it locally within it.

To see this, consider the document below. In the first example with no spacing factor set, the example is correctly spaced, but as soon as we add the spacing environment, the extra space appears. This space has nothing to do with the setting of the \Extopsep length directly but instead it's the text line of the spacing environment that's adding the extra space that appears at the "top" of the example.

\documentclass[12pt, a4paper]{article}
\usepackage{setspace}

\usepackage{linguex}
\let\eachwordone=\it
\AtBeginDocument{\setlength{\Extopsep}{.3\baselineskip}}
\newcommand\showskips{Baseline skip: \the\baselineskip\ Extopsep: \the\Extopsep\par}
\begin{document}

\showskips
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. 
\exg.
At vero eos et accusam \\
et justo duo dolores et \\

ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 

\begin{spacing}{1.5}\showskips
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. 
\exg.
At vero eos et accusam \\
et justo duo dolores et \\

ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
\end{spacing}

\begin{spacing}{1.5}\setlength{\Extopsep}{.3\baselineskip}\showskips
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. 
\exg.
At vero eos et accusam \\
et justo duo dolores et \\

ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
\end{spacing}
\end{document}

output of code

We can see this effect more clearly if we make the \Extopsep length 0pt:

\begin{spacing}{1.5}\setlength{\Extopsep}{0pt}\showskips
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. 

\exg.
At vero eos et accusam \\
et justo duo dolores et \\

ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
\end{spacing}

output of code fragment

David Carlisle's answer gives a solution, but I'll leave this answer up as it might be helpful for others to understand how to set the spacing parameters in the first place.

2
  • Thanks for your answer! I now see what the problem ist. But it seems to be indepent of using the setspace package. I posted another example without it on this post.
    – paulez
    Feb 12, 2021 at 20:06
  • @paulez Thanks for the comment. You should add your other example to your question rather than as an answer since it's not an answer. :)
    – Alan Munn
    Feb 12, 2021 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.