Graphics, Figures & TablesWhy does LaTeX add that much space?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
rain
Posts: 12
Joined: Thu Jan 28, 2016 9:00 pm

Why does LaTeX add that much space?

Post by rain »

Hi

Why does this code render like shown on image below and how to fix it? Why does new section title go to next page? I have not told it to.

Code: Select all

\begin{table}[ht!]
\centering
\caption{Nonfunctional requirement 4}
\begin{tabular}{|l|p{10cm}|}
\hline
\textbf{Requirement\#}            & 15  \\ \hline
\textbf{Requirement Type}         & Nonfunctional \\ \hline
\textbf{Use case\#}               & \\ \hline
\textbf{Description}              & Information that is displayed should be meaningful. \\ \hline
\textbf{Rationale}                & \\ \hline
\textbf{Created By}               & Author \\ \hline
\textbf{Fit Criterion}            & \\ \hline
\textbf{Priority}                 & Medium  \\ \hline
\textbf{View id}                  & \\ \hline
\end{tabular}
\end{table}
\FloatBarrier

\subsection*{Appendix 6 Use cases}

\FloatBarrier
\begin{table}[ht!]
\centering
\caption{Use case 1}
\begin{tabular}{|l|p{10cm}|}
\hline
\textbf{Use Case Element}     &  \textbf{Description} \\ \hline
\textbf{Use Case Number}      &  1 \\ \hline
\textbf{Use case Name}        &  Table management - import table.\\ \hline
\textbf{Use Case Description} &  User imports CSV file into program. \\ \hline
\textbf{Primary Actor}        &  User \\ \hline
\textbf{Precondition}         &  Program must be running \\ \hline
\textbf{Postcondition}        &  CSV file is imported into program and user can select it from open table view.\\ \hline
\textbf{Trigger}              &  User's need for anonymizing custom table. \\ \hline
\textbf{Normal Flow}          &  \begin{itemize} \vspace{-1.5em}
\item[1)] User goes to main view.
\item[2)] User clicks on 'Import'.
\item[3)] User chooses file and clicks open.
\item[4)] Contents of CSV file is loaded into program.
\end{itemize}\\ \hline
\end{tabular}
\end{table}
render.png
render.png (30.82 KiB) Viewed 4514 times
Last edited by Stefan Kottwitz on Wed May 17, 2017 11:54 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Why does LaTeX add that much space?

Post by Johannes_B »

You use advanced automatic placemement instructions, retricting them to what you think works and hit the automatic placement with a hammer that destroys every advantage of it.

Do Not Use figure Environments if you don't want automatic placement.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

Why does LaTeX add that much space?

Post by Stefan Kottwitz »

Hi Rain,

I tested this code and LaTeX does not add so much space. With this code, tested both with the article class and the book class, both tables are on the same page with very few space in-between.

Perhaps post a Infominimal working example that shows the problem. The cause is somewhere else in your code.

Stefan
LaTeX.org admin
rain
Posts: 12
Joined: Thu Jan 28, 2016 9:00 pm

Why does LaTeX add that much space?

Post by rain »

I managed to fix it by adding 1 character of invisible text before next header and then it jumped back to its right place. I used ht! because otherwise the table weent to next chapter and it would look very strange if the nonfunctional requirement were in the middle of use case.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

Why does LaTeX add that much space?

Post by Stefan Kottwitz »

LaTeX tables and figures don't float into a next chapter. But perhaps you mean floating into the next section or subsection?

At least for sections it can easily prevented by

\usepackage[section]{placeins}

By the way, I commonly use the most flexible placement, as near as possible, by using the [htbp!] options.

Stefan
LaTeX.org admin
Post Reply