7

My document is being generated with many pages with a short paragraph of text on one page, a short table on the next page, another short paragraph of text on the following page, etc. There is plenty of space to include more text and tables on most pages, but for some reason LaTeX is treating them like oil and water and separating them completely. How can I change the options so that my document isn't 95% white space? Here basically what my file looks like.

\documentclass[letterpaper,twoside,10pt]{article}
\usepackage[USenglish]{babel} %francais, polish, spanish, ...
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage{lmodern} %Type1-font for non-english texts and characters

\usepackage{tabularx} %For setting table widths
\usepackage{float}

\usepackage{graphicx} %%For loading graphic files

%% Math Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}

\usepackage[margin=1in]{geometry}

\begin{document}

\pagestyle{empty} %No headings for the first pages.
\title{Awesome Report}
\author{LaTex Noob}
\maketitle

\pagestyle{plain} %Now display headings: headings / fancy / ...

\section{Intro}\label{intro}
asdfa asdf asdfa asdf asdfa asdf asdfa asdf asdfa asdf asdfa asdf asdfa asdf 

\include{treeTrainAccuracy}

asdfa asdf asdfa asdf asdfa asdf asdfa asdf asdfa asdf asdfa asdf 

\include{treeTestAccuracy}

asdfa asdf asdfa asdf asdfa asdf asdfa asdf asdfa asdf asdfa asdf 

\include{svmTrainAccuracy}

asdfa asdf asdfa asdf asdfa asdf asdfa asdf asdfa asdf 

\include{svmTestAccuracy}

asdfa asdf asdfa asdf asdfa asdf asdfa asdf asdfa asdf 

All of the includes refer to a table with the following structure (values differ of course):

\begin{table}[ht]
\centering
\begin{tabularx}{\textwidth}{|l|X|X|l|X|X|X|}
  \hline
 & laying & sitting & standing & walk & walkdown & walkup \\ 
  \hline
laying & 221 &   0 &   0 &   0 &   0 &   0 \\ 
  sitting &   0 & 190 &   0 &   0 &   0 &   0 \\ 
  standing &   0 &   8 & 227 &   0 &   0 &   0 \\ 
  walk &   0 &   0 &   0 & 266 &   0 &   0 \\ 
  walkdown &   0 &   0 &   0 &   0 & 193 &   0 \\ 
  walkup &   0 &   0 &   0 &   0 &   0 & 210 \\ 
   \hline
\end{tabularx}
\caption{SVM training set accuracy. Rows represent actual values. Columns are predicted values.\label{tab:svmTrainAccuracy}} 
\end{table}
lockstep
  • 250,273
Jim
  • 213

1 Answers1

15

\include by definition starts a new page both at its beginning and when the included file ends. The reason is that documents with "included" files should be properly compilable with only some of the files included. And to preserve page breaking and numbering even if a document is only partially compiled, the files are running \clearpage before and after to ensure that all floats are confined within the included section (as well as recording the current information about various counters and cross-references).

A more elaborate mechanism would be possible in theory, but the above solution is what LaTeX offers. So \include is basically only useful on large documents, where each such file holds a whole chapter or several chapters.

So the answer to your problem is to use \input instead.