# Change line spacing for normal text, but not in tabular or verse

\usepackage{setspace}
\doublespacing


I used above two lines to change the spacing in my document. This changes the spacing of the entire document.

My requirement is to change the line spacing in paragraphs only. I want to leave the verse and table environments as they are. I just want to change the paragraphs. I did not put paragraphs in any environment. Do I need to do that as well?

-
Are you actually referring to the table environment (a float environment) or do you mean tabular (producing the actual table)? If the latter is the case, please edit your question accordingly. You can use backticks  to mark your inline code as I did in my edit. And perhaps you could change the title to something more specific, e.g. "Change line spacing for normal text, but not in tabular/table or verse". –  doncherry Aug 20 '11 at 12:43

\documentclass{article}

\usepackage{etoolbox}
\usepackage[doublespacing]{setspace}

\AtBeginEnvironment{verse}{\singlespacing}
\AtBeginEnvironment{tabular}{\singlespacing}

\usepackage{lipsum}% just for blindtext

\begin{document}

\lipsum[1]

\begin{verse}
\lipsum[1]
\end{verse}

\lipsum[1]

\begin{tabular}{p{10cm}}
\lipsum[1]
\end{tabular}

\lipsum[1]

\end{document}


This patches the verse and tabular environment to use a \singlespacing at their beginning. The table environment isn't affected by [doublespacing] and thus doesn't need any patching, but you probably want to use tabular.

-
If the tabular isn't wrapped in the table environment (which it probably isn't for Aku's document) this won't work, and you'll have to patch the tabular environment in the same way you did the verse environment. –  Alan Munn Aug 20 '11 at 12:30
@Alan: Ah, thanks, that answer the question I just asked on your answer :). I'll edit my answer. –  doncherry Aug 20 '11 at 12:31
I am very new to TeX, this is the error I am getting ! Undefined control sequence. l.6 \AtBeginEnvironment {verse}{\singlespacing} –  Aku Aug 20 '11 at 13:55
@Aku: Did you put \usepackage{etoolbox} in your preamble? etoolbox is the package that provides the environment-patching command. –  doncherry Aug 20 '11 at 14:09
@Aku: Actually, if you used exactly what you wrote in your comment here, then there's an unnecessary space in between \AtBeginEnvironment and {verse}{\singlespacing} that might cause the error. Remove this space and try again. –  doncherry Aug 20 '11 at 14:15

You can redefine the verse and tabular environments to make them single spaced:

\let\oldtabular\tabular
\let\endoldtabular\endtabular
\renewenvironment{tabular}
{\bgroup\singlespacing\oldtabular}%
{\endoldtabular\egroup}
\let\oldverse\verse
\let\endoldverse\endverse
\renewenvironment{verse}
{\bgroup\singlespacing\oldverse}%
{\endoldverse\egroup}

-
Does tabular actually need redefinition? In my quick test it wasn't affected by the changed line spacing. –  doncherry Aug 20 '11 at 12:30
Yes. The double spacing option of setspace makes table single spaced, but not tabular itself. –  Alan Munn Aug 20 '11 at 12:31

To locally change the line spacing in your document, use the environments singlespace, onehalfspace and doublespace provided by the setspace package. So, for instance:

\documentclass{article}

\usepackage{setspace}
\doublespacing

...

\begin{document}

...

\begin{singlespace}
...
\end{singlespace}

...

\end{document}

-
I have a book more than 1000 pages long. Paragraphs comes alternatively after a verse and table. Paragraphs is essentially explanation of verse. Is there any easier way to do this? –  Aku Aug 20 '11 at 12:06
Using the \preto or \appto macro provided by the etoolbox package, you can easily redefine \verse and \endverse to include \singlespace and \endsinglespace, respectively. Of course, you can also do this for other environments that shouldn't be typeset with \doublespacing. –  mhp Aug 20 '11 at 12:25
Or even better (as suggested in the answer of @doncherry): Use the \AtBeginEnvironment macro of the etoolbox` package. –  mhp Aug 20 '11 at 12:32