7

I am using the gb4e package. When I have a list of examples, there is a large skip after the prose and before the first enumerated item. I do not want that skip there; instead, I want there to be double-spacing, as there is throughout the document. After the list has ended, I also want double-spacing between the last example and the rest of the prose below it.

\documentclass[12pt]{article}
\usepackage[margin=1in, left=1.25in, right=1.25in]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\rhead{Name \thepage}
\cfoot{}
\usepackage{setspace}
\doublespacing
\usepackage{geometry}
\usepackage{url}
\usepackage{gb4e}


\begin{document}

Some prose goes here and goes on for a while.  The spacing, as you can see, is double, but the space between the prose and the items below is more than double.  It should not be.
\begingroup
\singlespace{
\begin{exe}[nosep]
\ex xyz
\ex xyz
\end{exe} 
}
\endgroup

The prose resumes here and goes on for a while.  Again, the spacing is double, as it should be.

\end{document}
5
  • I would just use It should not be. \begin{exe} \ex xyz \ex xyz \end{exe} The prose
    – user11232
    May 10, 2015 at 2:36
  • If I take that suggestion, then there is not single-spacing between the items of the list. I want the items to be single-spaced.
    – 5823574
    May 10, 2015 at 2:43
  • 2
    Oh!, that was not clear to me. Use It should not be. \begin{exe}\singlespacing \ex xyz \ex xyz \end{exe} The prose then.
    – user11232
    May 10, 2015 at 2:46
  • 1
    @HarishKumar is right that putting \singlespacing within the exe environment and removing your \begingroup/\endgroup should work. If this still doesn't do exactly what you want, you can get finer control of spacing and other kinds of formatting with the expex package. That package even has a separate command \ex~ for examples that follow other examples so that there's less vertical space between them. May 10, 2015 at 3:06
  • @JasonZentz -- Good suggestion on expex, especially since it is especially designed for linguistics. And yes -- Harish Kumar's example works well.
    – 5823574
    May 10, 2015 at 14:24

2 Answers 2

4

Append \singlespacing to the start code of every exe environment:

\documentclass[12pt]{article}
\usepackage[margin=1in, left=1.25in, right=1.25in,headheight=14.5pt]{geometry}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{url}
\usepackage{gb4e}
\usepackage{etoolbox}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\fancyhead[R]{Name \thepage}

\doublespacing

\makeatletter
\apptocmd{\@exe}{\singlespacing}{}{}
\makeatother

\begin{document}

Some prose goes here and goes on for a while.  The spacing, as you can see, is double, but 
the space between the prose and the items below is more than double.  It should not be.
\begin{exe}
\ex xyz
\ex xyz
\end{exe} 
The prose resumes here and goes on for a while.  Again, the spacing is double, as it should be.

\end{document}

I've also made some fixes to your code: you were missing a correct setting of the head height and also had a confusing mixture of package loading and setup commands. Note \fancyhf{} to clear all fields in headers and footers.

enter image description here

4
  • I didn't know about etoolbox -- great suggestion! And the changes for packages and setup commands are good too. What exactly does headheight set? I can't seem to find an answer at texdoc.net/texmf-dist/doc/latex/geometry/geometry.pdf. sharelatex.com/learn/Page_size_and_margins says it's the "height of the header". Is it the distance from the top of the page to the header?
    – 5823574
    May 10, 2015 at 14:17
  • 1
    @5823574 You get a warning by fancyhdr that you should set the head height to 14.49998pt, the best thing to do is to comply. It is the size reserved for the material in the header. The distance you are referring to is the \headsep, that can be set in geometry with headsep=<length>
    – egreg
    May 10, 2015 at 14:24
  • The explanation of \headsep makes sense. What does "the size reserved in for the material in the header mean"? Does it set the size of the font in the header? Or does it just set a ceiling for the maximum height allowed in the header (while not changing the font -- i.e., the font is still 12pt in the header, as set by \documentclass[12pt]{article})?
    – 5823574
    May 11, 2015 at 14:07
  • 1
    @5823574 It's something that fancyhdr needs; probably it could be dealt with in different ways, but the important thing is that the head height must be the same across the document; so if in some header the required height is bigger than the allotted one, fancyhdr issues the message and it's better to comply, or headers will appear shifted in different pages.
    – egreg
    May 11, 2015 at 14:10
4

You can put \singlespacing inside \begin{exe} so that the effect is local

\documentclass[12pt]{article}
\usepackage[margin=1in, left=1.25in, right=1.25in,headheight=16pt]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\rhead{Name \thepage}
\cfoot{}
\usepackage{setspace}
\doublespacing
\usepackage{geometry}
\usepackage{url}
\usepackage{gb4e}

\begin{document}

Some prose goes here and goes on for a while.  The spacing, as you can see, is double, but the space between the prose and the items below is more than double.  It should not be.
%
\begin{exe}
\singlespacing
\ex xyz
\ex xyz
\end{exe}
%
The prose resumes here and goes on for a while.  Again, the spacing is double, as it should be.

\end{document}

enter image description here

I have also modified the head height just to get rid of the warning.

You must log in to answer this question.

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