GeneralHow to eliminate white space when inserting table

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
NiN
Posts: 3
Joined: Thu Sep 25, 2008 2:03 am

How to eliminate white space when inserting table

Post by NiN »

Hey there,

I have a brief *presumably trivial* question regarding the \tabular and/or \sidewaystable function. Whenever I insert a table (that captures an entire page) in my text, Latex adds an unnecessary blank line between my paragraphs. So my question is, how do I get rid of this line? Since I don't want to have a blank line in-between the paragraphs, given that the first word of the upcoming paragraph is indented anyway.

For instance, if my code looks like...

bla, bla, bla, bla.
\input{table_XYC}
blo, blo, blo.

whereby bla, bla, bla refers to paragraph 1, blo, blo, blo refers to paragraph 2, and the table is written in another tex-document, how do I make sure that it will eventually look like:

bla, bla, bla.
blo, blo, blo...

with the table on the page to follow.

A quick response is highly appreciated. Thanks in advance.

Recommended reading 2024:

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

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

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

How to eliminate white space when inserting table

Post by localghost »

Your descriptions are almost useless since nobody knows how you create that table and insert it. So, please provide a minimal working example (MWE) that is compilable without any changes and that shows the described effect.


Best regards and welcome to the board
Thorsten¹
NiN
Posts: 3
Joined: Thu Sep 25, 2008 2:03 am

How to eliminate white space when inserting table

Post by NiN »

Sorry for my ignorance... obvious nobody can make sense of this. Anyhow, I simplified the code and copied it below. Bascially, I want to avoid that there is any blank space/line between the text, i.e., between "bla, bla, bla" and "blo, blo, blo...", given that the table appears on the next page anyway. Thanks so much in advance. I appreciate it...

LATEX code:

\documentclass[a4paper, twoside,12pt]{article}

\usepackage{rotating}
\usepackage{lscape}
\usepackage{float}
\usepackage{booktabs}

\begin{document}
Bla bla bla
%BEGIN TABLE ENVIRONMENT
\begin{center}
\begin{sidewaystable}[h b t p]
\leavevmode
\caption{XYZ}
\label{XYZ}
\renewcommand{\baselinestretch}{1.1}
\renewcommand{\arraystretch}{1.1}
\resizebox{21.7cm}{!} {
\begin{tabular}{ l p{1.1cm} p{1.1cm} p{1.1cm} p{1.1cm} p{1.3cm} l p{1.1cm} p{1.1cm} p{1.1cm} p{1.1cm} p{1.3cm} l p{1.1cm} p{1.1cm} p{1.1cm} p{1.1cm} p{1.3cm}}
\toprule
& & & & & & & & & & & & & & & & & \\

\bottomrule
\end{tabular}
}
\end{sidewaystable}
\end{center}
\renewcommand{\baselinestretch}{1.5}
%END TABLE ENVIRONMENT
Blo blo blo
\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How to eliminate white space when inserting table

Post by localghost »

I see that my assumption was right. The center environment creates additional vertical space. Moreover it is superfluous in this case, because the sidewaystable environment starts a new page and occupies it completely. I suggest to modify your code.

Code: Select all

\documentclass[a4paper, twoside,12pt]{article}

\usepackage{rotating}
\usepackage{lscape}
\usepackage{float}
\usepackage{booktabs}

\begin{document}
  Bla bla bla
% BEGIN TABLE ENVIRONMENT
  \begin{sidewaystable}
    \centering
    \leavevmode
    \caption{Dummy table}\label{tab:dummy}
    \renewcommand{\baselinestretch}{1.1}
    \renewcommand{\arraystretch}{1.1}
    \resizebox{21.7cm}{!}{%
       \begin{tabular}{ l p{1.1cm} p{1.1cm} p{1.1cm} p{1.1cm} p{1.3cm} l p{1.1cm} p{1.1cm} p{1.1cm} p{1.1cm} p{1.3cm} l p{1.1cm} p{1.1cm} p{1.1cm} p{1.1cm} p{1.3cm}} \toprule
          & & & & & & & & & & & & & & & & &  \\ \bottomrule
       \end{tabular}
     }
  \end{sidewaystable}
  \renewcommand{\baselinestretch}{1.5}
% END TABLE ENVIRONMENT
  Blo blo blo
\end{document}
If you want tables to fit the current line width with columns allowing line breaks, you can use tabularx, which provides an environment of the same name.
NiN
Posts: 3
Joined: Thu Sep 25, 2008 2:03 am

Re: How to eliminate white space when inserting table

Post by NiN »

Now it works just fine... Thanks so much! Made my day! Hope one day I will have a chance to pay back... but I reckon than I need to polish further my Latex skills. Thanks again.
Post Reply