# How to get single line spacing in ALL examples (anything within \ex. or \exg.) in a document using Linguex (to the exclusion of the main text)?

Is there a way of defining single spacing for the examples written using Linguex (I do not use other packages for examples) throughout the whole document, without having to use \singlespace over 100 times before each example? In other words, I need my file to look like this:

Here's the update with the graphics in the trees going crazy when the original solution is applied:

\documentclass{article}
\usepackage[left=3cm, right=3cm, top=3cm, bottom=3cm]{geometry}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{epstopdf}
\usepackage[nocenter]{qtree}
\usepackage{linguex}
\usepackage{tree-dvips}
\usepackage{tikz}
\usepackage{setspace}
\usepackage{linguex}

\begin{document}

I've removed lipsum in order to make the running text shorter so that both
examples fit on the same page.  Also, I probably will have to try
\textsf{tikz-qtree-compat}, but I'm not sure if it's compatible with
\textsf{qtree} (most of my recent files already include \textsf{qtree}...).

\ex.\ag. Das ist kein Beispiel. \\
that is   no example \\
\glt{   That is not an example.}
\bg. Das ist kein Beispiel. \\
that is   no example \\
\glt{That is not an example.}

As a side note: I had to include the page dimentions specification in this
document. Otherwise the following example got printed on a page placed
horizontally (maybe it's due to the inclusion of the\textsf{ rotating}
package, which is needed for the positioning of the braces, maybe not, I
haven't seen this problem ever before). Nevermind.

\ex. spans looking fine\bigskip\\
\Tree
[.F$_4$P [.F$_4$ ]
[.F$_{3}$P [.F$_{3}$ ]
[.  \qroof{{\color{white}\dots}}.XP
[.F$_{2}$P [.F$_{2}$ ]
[.F$_{1}$P [.F$_{1}$ ] [.{...}  ] ]]]]]

\begin{picture}(0,0)
\put(165,55){A}
\begin{rotate}{230}
\put(-150,90){
$\left\{\begin{array} {cl} \\ \\ \\ \\ \\ \end{array}\right.$
}
\end{rotate}
\end{picture}

\begin{picture}(0,0)
\put(140,105){B}
\begin{rotate}{230}
\put(-170,35){
$\left\{\begin{array} {cl} \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \end{array}\right.$
}
\end{rotate}
\end{picture}

\end{document}


The output looks like this:

However, when

\usepackage{etoolbox}
\pretocmd{\ex}{\vspace{\Exredux}\begin{singlespace}}{}{}
\renewcommand{\ExEnd}{%
\ifnum\theExDepth=0\global\unembeddedfalse\end{singlespace}\vspace{.5\Exredux}\else%


is added and the line spread of the main text is changed, as for instance

\linespread{1.75}


the output produces the braces as 1.75 instead, and the whole thing looks like this now:

PS. Note that I need to be using \lineaspread specification rather than simply using \doublespace for various reasons (like stuff fitting into certain pages, etc.)

• Sorry Alan Munn -- having edited my question so that it includes the preamble, your answer got deleted. Nevertheless, applying your code didn't work (error). – oliver Nov 4 '15 at 12:20
• Yes, I deleted it because it was some code for memoir which doesn't seem to work. But please make your example totally minimal. You just need to load linguex and setspace and give some dummy text and a sample example. All the other stuff is irrelevant to your problem and shouldn't be included. – Alan Munn Nov 4 '15 at 12:29
• Oliver, compare what you posted to what my answer looks like. When you ask questions on the site you'll have much better luck if you post complete minimal documents (like my code) than code fragments (like your code). – Alan Munn Nov 4 '15 at 13:53

This requires modifying the linguex example code directly. Since linguex doesn't actually define examples as environments, it's trickier than it should be. Also to get the spacing above and below examples I've added some somewhat hacky \vspace commands. If you need more space after the examples, set the .5 in \vspace{.5\Exredux} 0. (\Exredux is set to -\baslineskip by default.)

\documentclass{article}
\usepackage{lipsum} % for dummy text
\usepackage{setspace}
\usepackage{linguex}
\usepackage{etoolbox}
\pretocmd{\ex}{\vspace{\Exredux}\begin{singlespace}}{}{}
\renewcommand{\ExEnd}{%
\ifnum\theExDepth=0\global\unembeddedfalse\end{singlespace}\vspace{.5\Exredux}\else%

\doublespacing
\begin{document}
\lipsum[1]

\ex.\ag. Das ist kein Beispiel. \\
that is   no example \\
\glt{   That is not an example.}
\bg. Das ist kein Beispiel. \\
that is   no example \\
\glt{That is not an example.}

\lipsum[2]

\end{document}


• Please note there was a missing backslash in the earlier version of this answer that has now been corrected. – Alan Munn Nov 4 '15 at 13:55
• Thanks, this does work indeed. Sadly, I'm not going to be able to use it. The graphic examples (syntactic trees) include pictures (errays) that behave according to the spacing set for the document, not for the examples within the \ex. This, interestingly, doesn't take place when \singlespace is used before the example. – oliver Nov 4 '15 at 21:36
• @oliver So make a new document that shows exactly that problem, and maybe it can be fixed too. Build the example off of mine and edit it into your question to show what the problem is. Also unless you have a lot invested in qtree trees, I would recommend using tikz-qtree plus tikz-qtree-compat as a replacement. – Alan Munn Nov 4 '15 at 23:27
• Done. As you can see, the graphics (braces) within the \ex. don't want to give up... – oliver Nov 6 '15 at 18:24
• @oliver Sorry but I'm traveling right now and can't reply fully but the simple answer will be that you should switch to a better way of doing trees. I'll post a complete answer in a few days. – Alan Munn Nov 6 '15 at 19:38