Text FormattingChange interline Spacing only of the Text

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
mauro269
Posts: 9
Joined: Sun Feb 24, 2013 8:55 pm

Change interline Spacing only of the Text

Post by mauro269 »

Hi guys,

I've just completed my academic thesis and I'm working on the text formatting. I've a problem with the interline spacing. When I use \linespread{1.5}\selectfont it sets the interline on all the text included the tables (I've a lot of tables filled with a multitude of numbers). How can I set the interline on all the text excluding the tables?

Thanks for your help :)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Change interline Spacing only of the Text

Post by localghost »

No problem with setspace.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[tableposition=top]{caption}
\usepackage[onehalfspacing]{setspace}
\usepackage{lipsum}

\begin{document}
  \lipsum[1]

  \begin{table}[!ht]
    \caption{Table with normal interline spacing}
    \label{tab:normal-spacing}
    \centering
    \begin{tabular}{cc}\hline
      Table Header & Table Header \\ \hline
      Some Content & Some Content \\
      Some Content & Some Content \\
      Some Content & Some Content \\ \hline
    \end{tabular}
  \end{table}

  \lipsum[2]
\end{document}
Further reading:
Remarks:
  • The \selectfont is quite superfluous with your method. It does exactly nothing.

Best regards and welcome to the board
Thorsten
mauro269
Posts: 9
Joined: Sun Feb 24, 2013 8:55 pm

Change interline Spacing only of the Text

Post by mauro269 »

Hi, thanks for your reply and for your welcome :)

I've tried what you suggested but the

\usepackage[onehalfspacing]{setspace}

set 1.5 spacing also on tables. These are my packages

Code: Select all

\documentclass[12pt, a4paper, oneside, titlepage, openright]{book}
\usepackage[applemac]{inputenc}
\usepackage[english,italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[onehalfspacing]{setspace}
\usepackage{amsmath,amssymb,mathrsfs}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}
\usepackage{sectsty}
\sectionfont{\large}
\usepackage[center]{caption}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Change interline Spacing only of the Text

Post by localghost »

mauro269 wrote:[…] I've tried what you suggested but the

\usepackage[onehalfspacing]{setspace}

set 1.5 spacing also on tables. […]
Not in my code sample. Click on "Open in writeLaTeX" in the head of the code block in my last reply to see the result. So you have to show the opposite by a self-contained and minimal example.
mauro269
Posts: 9
Joined: Sun Feb 24, 2013 8:55 pm

Re: Change interline Spacing only of the Text

Post by mauro269 »

I really don't know what's the matter...To give out more details, I'm using MacTeX.
This is the code of one of my tables:

DELETED
Last edited by mauro269 on Tue Feb 26, 2013 10:41 pm, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Change interline Spacing only of the Text

Post by localghost »

I asked for a self-contained and minimal example, not for a loosely code snippet. Hence an adequate problem description is still missing.
mauro269
Posts: 9
Joined: Sun Feb 24, 2013 8:55 pm

Change interline Spacing only of the Text

Post by mauro269 »

Sorry, below there's a simplified version of my code:

Code: Select all

\documentclass[12pt, a4paper, oneside, titlepage, openright]{book}
\usepackage[applemac]{inputenc}
\usepackage[english,italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[onehalfspacing]{setspace}
\usepackage{amsmath,amssymb,mathrsfs}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}
\usepackage{sectsty}
\sectionfont{\large}
\usepackage[center]{caption}
\begin{document}
      \lipsum[1]

\begin{table}[H]
\centering
\begin{tabular}{l c c c}
\specialrule{2pt}{0pt}{0pt}
		 & \textbf{N.1} & \textbf{N.2} \\ [0.5ex]
\hline % inserts single horizontal line
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\ [1ex]
\specialrule{2pt}{0pt}{0pt}
\end{tabular}
\caption{{\footnotesize Numbers.}}
\label{table:numbers}
\end{table}
   
   \lipsum[2]
\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Change interline Spacing only of the Text

Post by Stefan Kottwitz »

Load the setspace package with options after the float package to fix it, not before.
Thanks for completing the example.

Stefan
LaTeX.org admin
mauro269
Posts: 9
Joined: Sun Feb 24, 2013 8:55 pm

Change interline Spacing only of the Text

Post by mauro269 »

Stefan_K wrote:Load the setspace package with options after the float package to fix it, not before.
Thanks for completing the example.

Stefan
Oh Thanks! That's the solution!
Thanks again to both of you :)
Post Reply