如何使用 Linguex(排除正文)在文档中的所有示例(\ex. 或 \exg. 内的任何内容)中获得单行间距?

如何使用 Linguex(排除正文)在文档中的所有示例(\ex. 或 \exg. 内的任何内容)中获得单行间距?

有没有一种方法可以在整个文档中为使用 Linguex 编写的示例定义单倍行距(我不使用其他软件包作为示例),而不必\singlespace在每个示例之前使用超过 100 次?换句话说,我需要我的文件看起来像这样: 在此处输入图片描述

当应用原始解决方案时,树木中的图形会变得疯狂,如下所示:

\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}
\linespread{1.0}

\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}

输出如下所示:

在此处输入图片描述

然而,当

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

添加了,并且更改了正文的行距,例如

\linespread{1.75}

输出将括号改为 1.75,现在整个内容如下所示:

在此处输入图片描述

PS. 请注意,由于各种原因(例如内容适合某些页面等),我需要使用 \lineaspread 规范,而不是简单地使用 \doublespace。

答案1

这需要linguex直接修改示例代码。由于linguex实际上没有将示例定义为环境,因此它比它应该的更棘手。此外,为了获得示例上方和下方的间距,我添加了一些有点棘手的\vspace命令。如果您需要示例后有更多空间,请设置..5中的\vspace{.5\Exredux} 0(默认\Exredux设置为)。-\baslineskip

\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%
    \end{list}\addtocounter{ExDepth}{-1}\ExEnd\fi}

\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}

代码输出

相关内容