LaTeX forum ⇒ Graphics, Figures & TablesWhy does LaTeX add that much space? Topic is solved

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

Why does LaTeX add that much space?

Postby rain » Tue May 16, 2017 10:27 pm

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.
  1. \begin{table}[ht!]
  2. \centering
  3. \caption{Nonfunctional requirement 4}
  4. \begin{tabular}{|l|p{10cm}|}
  5. \hline
  6. \textbf{Requirement\#} & 15 \\ \hline
  7. \textbf{Requirement Type} & Nonfunctional \\ \hline
  8. \textbf{Use case\#} & \\ \hline
  9. \textbf{Description} & Information that is displayed should be meaningful. \\ \hline
  10. \textbf{Rationale} & \\ \hline
  11. \textbf{Created By} & Author \\ \hline
  12. \textbf{Fit Criterion} & \\ \hline
  13. \textbf{Priority} & Medium \\ \hline
  14. \textbf{View id} & \\ \hline
  15. \end{tabular}
  16. \end{table}
  17. \FloatBarrier
  18.  
  19. \subsection*{Appendix 6 Use cases}
  20.  
  21. \FloatBarrier
  22. \begin{table}[ht!]
  23. \centering
  24. \caption{Use case 1}
  25. \begin{tabular}{|l|p{10cm}|}
  26. \hline
  27. \textbf{Use Case Element} & \textbf{Description} \\ \hline
  28. \textbf{Use Case Number} & 1 \\ \hline
  29. \textbf{Use case Name} & Table management - import table.\\ \hline
  30. \textbf{Use Case Description} & User imports CSV file into program. \\ \hline
  31. \textbf{Primary Actor} & User \\ \hline
  32. \textbf{Precondition} & Program must be running \\ \hline
  33. \textbf{Postcondition} & CSV file is imported into program and user can select it from open table view.\\ \hline
  34. \textbf{Trigger} & User's need for anonymizing custom table. \\ \hline
  35. \textbf{Normal Flow} & \begin{itemize} \vspace{-1.5em}
  36. \item[1)] User goes to main view.
  37. \item[2)] User clicks on 'Import'.
  38. \item[3)] User chooses file and clicks open.
  39. \item[4)] Contents of CSV file is loaded into program.
  40. \end{itemize}\\ \hline
  41. \end{tabular}
  42. \end{table}


render.png
render.png (30.82 KiB) Viewed 332 times
Last edited by Stefan Kottwitz on Wed May 17, 2017 11:54 am, edited 1 time in total.

User avatar
Johannes_B
Site Moderator
Posts: 3427
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed May 17, 2017 6:07 am

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: 8262
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Wed May 17, 2017 2:23 pm

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
Site admin

rain
Posts: 12
Joined: Thu Jan 28, 2016 9:00 pm

Postby rain » Thu May 18, 2017 8:02 pm

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: 8262
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri May 19, 2017 12:02 pm

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
Site admin


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests