Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
5  
\include issues a \clearpage. Use \input instead. See (possible duplicate): When should I use \input vs. \include? –  Qrrbrbirlbel Feb 28 '13 at 21:35
    
Welcome to TeX.sx! –  hpesoj626 Feb 28 '13 at 21:39
    
@Qrrbrbirlbel You have saved me from pulling my hair out. That fixed it. If you answer the question officially I'll accept it. –  Jim Feb 28 '13 at 21:39

1 Answer 1

up vote 12 down vote accepted

\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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.