0

I create a table, but it goes off the bottom margin of the page.

This is the code:

\documentclass[a4paper, 12pt]{report} %report è utilizzato per la tesi
\usepackage[left=1.5in, top=0.5in, bottom=1.0in, right=1.0in]{geometry}
\usepackage[italian]{babel} %pacchetto italiano
\usepackage[utf8]{inputenc}
\usepackage[hidelinks]{hyperref} %crea i link sulle parole od indice
\usepackage{amsmath,amssymb} %pacchetto matematica
\usepackage{graphicx} %pacchetto per immagini. File supportati PNG, JPEG e PDF
\usepackage{grffile}
\usepackage{makeidx} %crea l'indice
\usepackage{wrapfig}
\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage[table]{xcolor}
\setlength{\arrayrulewidth}{0.5mm}
\setlength{\tabcolsep}{18pt}
\renewcommand{\arraystretch}{1.5}
\newcolumntype{s}{>{\columncolor[HTML]{AAACED}} p{3cm}}
\arrayrulecolor[HTML]{0d0d0c}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{afterpage} %crea pagina bianca
\usepackage{lipsum} %testo lipsum
\pagenumbering{roman} %numeri romani
\usepackage[Sonny]{fncychap}
%\usepackage[autostyle, italian=guillemets]{csquotes}
%\usepackage[backend=bibtex, style=numeric]{biblatex}
%\usepackage{guit}
%\addbibresource{Bibliografia.bib}
%\usepackage{filecontents}

\usepackage{afterpage}

\newcommand\blankpage{% \null \thispagestyle{empty}% \addtocounter{page}{-1}% \newpage} \title{} \begin{document}

\begin{table}[htbp] \centering

\begin{tabularx}{\linewidth}{XXXX} \rowcolor{cyan} \multicolumn{1}{c}{\textit{\textbf{USE CASE #1}}} & \multicolumn{3}{c}{\textit{\textbf{Improvements of a subject}}} \tabularnewline \midrule \textbf{Goal context} & \multicolumn{3}{p{4cm}}{Conoscere gli sviluppi di una materia} \tabularnewline \midrule \textbf{Preconditions} & \multicolumn{3}{p{4cm}}{Lo studente deve aver svolto almeno due esercizi di una stessa materia} \tabularnewline \midrule \textbf{Success end condition} & \multicolumn{3}{p{4cm}}{Lo studente viene a conoscenza degli sviluppi di una materia} \tabularnewline \midrule \textbf{Failed end condition} & \multicolumn{3}{p{4cm}}{ la macchina non trova i valori richiesti o lo studente ha svolto meno die due esercizi }\tabularnewline \midrule \textbf{Primary Actor} & \multicolumn{3}{p{4cm}}{Lo studente} \tabularnewline \midrule \textbf{Trigger} & \multicolumn{3}{p{4cm}}{Preme il tasto "Learning" dal menù in home} \tabularnewline \midrule \rowcolor{cyan} \multicolumn{1}{p{4cm}}{ \textbf{Description}}& \textbf{Step} & \textbf{Studente} & \textbf{Sistema} \tabularnewline \midrule & \textbf{1} & Preme il tasto "Learning" dal menù in home & Mostra la Learning Room \tabularnewline \midrule & \textbf{2} & & Mostra la Learning Room \tabularnewline \midrule & \textbf{3} & Preme il tasto "Start" & Attiva la comunicazione vocale \tabularnewline \midrule & \textbf{4} & & Attiva la comunicazione vocale \tabularnewline \midrule & \textbf{5} & Seleziona verbalmente l'opzione 3 & \tabularnewline \midrule \pagebreak & \textbf{6} & & Comunica verbalmente i progressi \tabularnewline \midrule \rowcolor{cyan} \multicolumn{1}{p{4cm}}{ \textbf{Extension}}& \textbf{Step} & \textbf{Studente} & \textbf{Sistema} \tabularnewline \midrule Caso in cui lo studente non preme il tasto "Learning" ma preme "Exit" & \textbf{1.1} & Preme il tasto "Exit" presente nell'home & \tabularnewline \midrule

\end{tabularx} \caption{tabularx-version with booktabs: Brief overview of all economic schools and their understanding of cyclical drivers.\cite{BormotovMichael2009}} \label{table:economicSchools3}

\end{table}

\end{document}

Ingmar
  • 6,690
  • 5
  • 26
  • 47
  • Since you didn't provide a complete code it's hard to tell, but there's a \end{table} at the end, so your tabular should be a float. What floating parameters did you use? They could be interfering with LaTeX trying to float the table to the next page. – Miyase Jun 07 '22 at 22:47
  • 3
    again you post a fragment with no test document, you have not even shown the \begin{table} line that would control the table placement. the table does not seem very big, why does it not fit on the page? You have not shown any code that would allow anyone to answer the question. – David Carlisle Jun 07 '22 at 22:47
  • sorry I 've forgot only this \begin{table}[htbp]. Now can you help me? – Valerio Panzera Jun 07 '22 at 22:54
  • 1
    No, you forgot the rest of the code. A Minimal Working Example has to be Working, i.e. it has to be compilable. The table environment should make your table float, so something is probably interfering with it somewhere else in your code. – Miyase Jun 07 '22 at 23:01
  • I edited the question – Valerio Panzera Jun 07 '22 at 23:03
  • 1
    Your code is still incomplete (no \documentclass?) Adding the missing line show that your table simply has too narrow columns and a lot of wasted space. If you really want to keep that design, you need to make it a longtable that can be split over several pages. What do you prefer? – Miyase Jun 07 '22 at 23:10

1 Answers1

1
  • Your table, as is presented in your code fragment in question, can be fit in one page.
  • MWE with your table as extension of the answer:
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document} \begin{table} \centering \begin{tblr}{colspec = {X[1.2, l, font=\bfseries] Q[l] *{2}{X[0.9,l]}}, row{1,Y} = {font=\itshape\bfseries, bg=cyan}, hspan = minimal } \toprule USE CASE #1 &\SetCell[c=3]{c} Improvements of a subject
& & \ \midrule Goal context &\SetCell[c=3]{j} Conoscere gli sviluppi di una materia & & \ Preconditions &\SetCell[c=3]{j} Lo studente deve aver svolto almeno due esercizi di una stessa materia & & \ Success end condition
&\SetCell[c=3]{j} Lo studente viene a conoscenza degli sviluppi di una materia & & \ Failed end condition &\SetCell[c=2]{j} la macchina non trova i valori richiesti o \newline lo studente ha svolto meno die due esercizi & & \ Primary Actor &\SetCell[c=3]{j} Lo studente & & \ Trigger &\SetCell[c=3]{j} Lo studente tramite comando vocale seleziona l'opzione dal menù & & \ \midrule \SetRow{font=\bfseries, bg=cyan} Description & Step & Studente & Sistema \
\midrule & \textbf{1} & Preme il tasto "Learning" dal menù in home & Mostra la Learning Room \ & \textbf{2} & & Mostra la Learning Room \ & \textbf{3} & Preme il tasto "Start"
& Attiva la comunicazione vocale \ & \textbf{4} & & Attiva la comunicazione vocale \ & \textbf{5} & Seleziona verbalmente l'opzione 3 & \ & \textbf{6} & & Comunica verbalmente i progressi \ \midrule \SetRow{bg=cyan, font=\bfseries}
Extension & Step & Studente & Sistema \ \midrule Caso in cui lo studente non preme il tasto "Learning" ma preme "Exit" & \textbf{1.1}
& Preme il tasto "Exit" presente nell'home & \ \bottomrule \end{tblr}

\caption{tabularx-version with booktabs: Brief overview of all economic schools and their understanding of cyclical drivers.\cite{BormotovMichael2009}} \label{table:economicSchools3}

\end{table} \end{document}

enter image description here

Addendum:

  • If real table is longer and protrude bottom of page you should use longtblr, which -- of course -- shouldn't be enclosed in table float.
  • Using longtblr you can select how many first rows in table should (be beside caption) repeated on each new page where table is continued.
  • In your case is not seems that your table has common column headers, so in example below are not used function for repeating first table row(s):
\documentclass{article}
\usepackage{geometry}%[vmargin=20mm]
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document

\usepackage{xcolor} \usepackage{tabularray} \UseTblrLibrary{booktabs}

\begin{document} \begin{longtblr}[ caption = {longtblr-version with booktabs: Brief overview of all economic schools and their understanding of cyclical drivers.\cite{BormotovMichael2009}}, label = {table:economicSchools3} ]{colspec = {X[1.2, l, font=\bfseries] Q[l] *{2}{X[0.9,l]}}, row{1} = {font=\itshape\bfseries, bg=cyan}, hspan = minimal } \toprule USE CASE #1 &\SetCell[c=3]{c} Improvements of a subject & & \ \midrule Goal context &\SetCell[c=3]{j} Conoscere gli sviluppi di una materia & & \ Preconditions &\SetCell[c=3]{j} Lo studente deve aver svolto almeno due esercizi di una stessa materia & & \ Success end condition &\SetCell[c=3]{j} Lo studente viene a conoscenza degli sviluppi di una materia & & \ Failed end condition &\SetCell[c=2]{j} la macchina non trova i valori richiesti o \newline lo studente ha svolto meno die due esercizi & & \ Primary Actor &\SetCell[c=3]{j} Lo studente & & \ Trigger &\SetCell[c=3]{j} Lo studente tramite comando vocale seleziona l'opzione dal menù & & \ \midrule \SetRow{font=\bfseries, bg=cyan} Description & Step & Studente & Sistema \ \midrule & \textbf{1} & Preme il tasto "Learning" dal menù in home & Mostra la Learning Room \ & \textbf{2} & & Mostra la Learning Room \ & \textbf{3} & Preme il tasto "Start" & Attiva la comunicazione vocale \ & \textbf{4} & & Attiva la comunicazione vocale \ & \textbf{5} & Seleziona verbalmente l'opzione 3 & \ & \textbf{6} & & Comunica verbalmente i progressi \ \midrule \SetRow{bg=cyan, font=\bfseries} Extension & Step & Studente & Sistema \ \midrule Caso in cui lo studente non preme il tasto "Learning" ma preme "Exit" & \textbf{1.1} & Preme il tasto "Exit" presente nell'home & \ Caso in cui lo studente non preme il tasto "Learning" ma preme "Exit" & \textbf{1.2} & & Preme il tasto "Exit" presente nell'home \ Caso in cui lo studente non preme il tasto "Learning" ma preme "Exit" & \textbf{1.3} & & Preme il tasto "Exit" presente nell'home \ Caso in cui lo studente non preme il tasto "Learning" ma preme "Exit" & \textbf{1.4} & Preme il tasto "Exit" presente nell'home & \ Caso in cui lo studente non preme il tasto "Learning" ma preme "Exit" & \textbf{1.5} & & Preme il tasto "Exit" presente nell'home \ \bottomrule \end{longtblr} \end{document}

enter image description here

(red lines shows page layout)

Zarko
  • 296,517