Graphics, Figures & Tablesinclude table makes whole new page

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
maike
Posts: 2
Joined: Wed Jun 25, 2025 2:53 pm

include table makes whole new page

Post by maike »

Hi everybody,

I am including a table like this in my main document:

Code: Select all

\include{my_table.tex}
I do this, because the table is created in R and sometimes updated.

The my_table looks like this:

Code: Select all

\begin{table}[htbp]
\centering

  \renewcommand{\arraystretch}{1.5}\centering
\begin{tabular}{llrrr}
\toprule
dummy & dummy & dummy  & dummy  & dummy \\ 
  \midrule
dummy  & dummy & dummy & dummy  &    dummy  \\ 
dummy  & dummy & dummy & dummy  &    dummy  \\ 
   \midrule
dummy  & dummy & dummy & dummy  &    dummy  \\ 
   \bottomrule
\end{tabular}
\caption{dummy} 
\label{tab:dummy}

\end{table}
I have similar tables, which are directly in the main document. Those are surrounded by text, if there is space left. However, the tables which are included by \include, take up a whole page with no text before or after the table, which I would like to change.

Looking foreward to your ideas - has this ever happened to anyone else?

P.S.: This is the packages I'm using - if this is of any interest:

Code: Select all

% Sprach- und Zeichencodierung
\usepackage[utf8]{inputenc} % Encoding
\usepackage[T1]{fontenc} % Font encoding
\usepackage[ngerman,english]{babel} % Languages

% Layout und Seitenränder
\usepackage[singlespacing]{setspace}
\usepackage[left=2cm, right=2cm, bottom=4cm]{geometry} % Seitenräder

% Tabellen und Schrift
\usepackage{booktabs}
\usepackage{multirow} % Erlaubt das Zusammenfassen von Zellen über mehrere Zeilen in Tabellen.
\usepackage[table]{xcolor} % Farben für Tabellen (ohne xcdraw, das Fehler wirft)
\usepackage{caption} % Darstellung von Bildunterschriften
\usepackage[normalem]{ulem}  %durchstreichen
\usepackage{tabularx}

% Mathematik
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{siunitx}
\usepackage{upgreek}


% Grafiken
\usepackage{graphicx}
\graphicspath{{../../data/graphs/}} % Standardpfad für Graphiken 
\usepackage{float} % Ermöglicht eine bessere Platzierung von Objekten wie Tabellen und Grafiken.
\usepackage{wrapfig} % Erlaubt das Einfügen von Bildern, die vom Text umflossen werden.
\usepackage{subcaption}
\usepackage[section]{placeins} % Verhindert, dass Floats über Abschnittsgrenzen hinauswandern -> \FloatBarrier nach Abschnitten

% PDF-Seiten einbinden
\usepackage{pdfpages}

% Kopf- und Fußzeilen
\usepackage[headsepline,footsepline]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles
\ihead{\headmark}
\automark{section}
\cfoot{\pagemark}

% Umdefinieren von \paragraph
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
	{-3.25ex\@plus -1ex \@minus -.2ex}%
	{1.5ex \@plus .2ex}%
	{\normalfont\normalsize\bfseries}}
\makeatother

% Absätze nicht einrücken
\setlength{\parindent}{0pt}

% Literaturverzeichnis
\usepackage[round,sort]{natbib} % Zitieren mit natbib und runden Klammern, sortierte Einträge
\bibliographystyle{apalike}

% URLs und klickbare Links
\usepackage{url}
\usepackage[hidelinks]{hyperref} % farbige anklickboxen um Zitate – MUSS am Ende stehen
\usepackage{nameref} % Für \nameref bei Referenzen
Last edited by maike on Wed Jun 25, 2025 3:54 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: include table makes whole new page

Post by Stefan Kottwitz »

Hi Maike,

welcome to the forum!

Use \input instead of \include:

Code: Select all

\input{my_table.tex}
\include is for chapter files and makes a page break, \input is for any TeX code.

Stefan
LaTeX.org admin
maike
Posts: 2
Joined: Wed Jun 25, 2025 2:53 pm

Re: include table makes whole new page

Post by maike »

Hi Stefan,

thank you for the easy fix and your fast response!

Best,
Maike
Post Reply