# Restricting linespread outside some environments

I need to fix a precise linespread in a document I'm writing, but only in the plain sections of the document. In other words, I'm writing math and in the text there are a lot of environments (theorem, proposition, definition, etc): is there a way to make linespread work only OUTSIDE these environments, without inserting a command every time I use an environment?

I guess I could redefine all the environments at the beginning of my document, is there an easier way to do this?

• Perhaps use `etoolbox` and `setspace` and write in your preamble things like: `\AtBeginEnvironment{mytheorem}{\singlespacing}`, or `\BeforeBeginEnvironment{mytheorem}{\singlespacing}`, and `\AtEndEnvironment{mytheorem}{\linespread{…}}`, or `\AfterEndEnvironment{mytheorem}{\linespread{…}}`. – Bernard Feb 26 '15 at 18:27
• Perfect! May I suggest you should use `\setspace{…}` rather than `\linespread{…}` as this kind of modifications have side effects that `setspace`takes into account (cf. `l2tabu`). – Bernard Feb 26 '15 at 18:51
• @Bernard: I think you should make an answer out of your comment ;-) – user31729 Feb 28 '15 at 19:16

Use `etoolbox` and `setspace` and write in your preamble things like:

``````\AtBeginEnvironment{mytheorem}{\singlespacing}
``````

or `\BeforeBeginEnvironment{mytheorem}{\singlespacing}` (not tested which one works — see the documentation of etoolbox).

and restore the document global spacing with:

``````\AtEndEnvironment{mytheorem}{\linespread{…}}
``````

or `\AfterEndEnvironment{mytheorem}{\linespread{…}}`

Comment aside, you should probably use the `\setspace{…}` command (from the homonymous package) rather than `\linespread`, as there are a number of side effects the package takes care of. See the details in `l2tabu`, §1.4.