[Tex/LaTex] Environment onehalfspacing error messages on compiling

line-spacing

In my document I've added the code onehalfspacing but everytime I compile I get the following error message:

Missing } inserted. }.

Please see below an MWE:

\documentclass[a4paper,12pt]{article}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\usepackage{gensymb}
\usepackage{times}
\usepackage{adjustbox}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{booktabs,caption, makecell}
\usepackage{pdflscape,afterpage,caption}
\usepackage[british]{babel}
\usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
\usepackage[section]{placeins}%Allows you to permanently fix figures. 
\addbibresource{library}
\usepackage{titleps}%fancy page borders? 
\usepackage[left=2.8cm, right=2.8cm, top=3.5cm, bottom=3.5cm]{geometry}
\usepackage{caption}
\captionsetup[figure]{font=scriptsize,labelfont=scriptsize}
\captionsetup[table]{font=scriptsize,labelfont=scriptsize}
\usepackage{microtype}
\usepackage{setspace}

\begin{document}
\begin{onehalfspacing}
Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document.
To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme.
Save time in Word with new buttons that show up where you need them. To change the way a picture fits in your document, click it and a button for layout options appears next to it. When you work on a table, click where you want to add a row or a column, and then click the plus sign.
Reading is easier, too, in the new Reading view. You can collapse parts of the document and focus on the text you want. If you need to stop reading before you reach the end, Word remembers where you left off - even on another device.

    \end{onehalfspacing}
\end{document}

Grateful for any advice to fix this without making large scale changes to my document (it's a lage document and I'm paranoid there will be conflicting codes).

Thanks in advance!

Best Answer

The setspace package defines

  1. \onehalfspacing, a declaration, and

  2. onehalfspace, an environment.

It's wrong using the former as if it were the latter. So use

\begin{onehalfspace}
...
\end{onehalfspace}

If you want that the whole document is typeset in “one and a half spacing”, put

\onehalfspacing

before \begin{document}.