Forzar subsección en la misma página que la tabla

Forzar subsección en la misma página que la tabla

Quiero forzar que mi subsección esté en la misma página que la tabla.

La tabla parece demasiado grande para hacerlo automáticamente. Me vendría bien \resizeboxencoger la mesa, pero solía \landscapeevitarlo.

¿Hay alguna forma de hacer esto? ¿Quizás ampliar los bordes de texto invisibles de la página? ¿Alguna sugerencia?

\documentclass[a4paper, 11pt, parskip]{scrreprt}
\KOMAoption{listof}{totoc}%adds \listoffigures and \listoftables to the toc
\KOMAoption{appendixprefix}{true}%i think its for colon at appendix toc
\RedeclareSectionCommand[beforeskip=0pt,%to have smaller spacing before chapter texts
afterskip=2cm]{chapter}
\renewcommand{\autodot}{}% Remove all end-of-counter dots


\usepackage{scrhack}%\float@addtolists detected! Behebt die Warnung.
\usepackage{ucs}% Für den erweiterten utf8 Zeichensatz
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}% Für \lipsum
\usepackage{tikz-timing}[2009/05/15]% Für Zeitablaufdiagramme http://www.texample.net/tikz/examples/tikz-timing/
\usepackage{tikz}%drawing stuff
\usetikzlibrary{positioning}
\usepackage{cite}
\usepackage[]{acronym}%Abkürzungsverzeichnis
\usepackage[bwr]{callouts}%for simple drawings in pictures
\usepackage{url}% for pathnames
\usepackage{dirtree}%for directory trees
\usepackage{makecell}%To keep spacing of text in tables
\usepackage{colortbl}%coloring tables
\usepackage{xcolor}
\usepackage{pdflscape}
%------------------------------------------------------------------------------------------------
% fonts, fonts fonts. see https://tex.stackexchange.com/questions/43881/how-to-correctly-use-the-palatino-font-in-memoir
% Pagella (Palatino clone) font for text, pazo for math
\usepackage[sc]{mathpazo} % use mathpazo for math fonts.
\usepackage{tgpagella} % but use tgpagella as main font
\usepackage[scaled=0.75]{luximono}
\usepackage{inconsolata}

\normalfont % we want to avoid annoying warnings
\DeclareFontShape{T1}{qpl}{m}{sl} { <-> ssub * qpl/m/it }{}
\DeclareFontShape{T1}{qpl}{b}{sl} { <-> ssub * qpl/b/it }{}

% heros (Helvetica clone) for sans serif
\usepackage{tgheros}%   Serifenlose Schrift für Überschriften. 
%------------------------------------------------------------------------------------------------
\usepackage[ngerman]{babel}          
\usepackage{graphicx}%bilder einfügen
\usepackage{caption, booktabs}
\usepackage{multirow}
\usepackage{color}  %farben für listings
\definecolor{mygreen}{rgb}{0,0.5,0}
\definecolor{Gray}{gray}{0.85}



\begin{document}
\begin{landscape}
    \subsection{X400/PortA/Relaisplatine 1}
    Portextension 1: X400/PortA\\
    Labeled with Number 1.
    \begin{table}[h]
        %\makegapedcells
        \centering
        %\resizebox{\textwidth}{!}{%resizing the whole table
    \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
        %\multicolumn{9}{c}{text}\\
        \hline
        \multicolumn{9}{|c|}{\gape{\Huge Relaisplatine}} \\ 
        \hline
        Relay Nr. & Part & Test-Id & \makecell[c]{Signal-Name \\for Testcases} & Conn. & Pin & \makecell[c]{Pin-\\Func.} & R Value & \makecell[c]{Influenced \\ Signal/Voltage } \\ 
        \hline 
        \cline{6-9} 
        %\hline 
        0 & RIO & RIO\_VOLT\_SDAR & RIO\_GPP\_VCORE & P2 & 3 & COM &  0 $\Omega$ & SIGN08116 \\
        \cline{6-9}  
        %\hline 
        &  &  &  &  & 5 & N.O. &  0 $\Omega$ & GND \\
        %\cline{6-9}  
        \hline 
        &  &  &  &  & 7 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        1 & RIO & RIO\_VOLT\_SDAR & RIO\_ETH\_+1V2 & P2 & 9 & COM &  0 $\Omega$ & SIGN0818 \\ 
        \cline{6-9}
        &  &  &  &  & 11 & N.O. &  0 $\Omega$ & GND \\ 
        \hline 
        &  &  &  &  & 13 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        2 & RIO & RIO\_VOLT\_SDAR & RIO\_CLOCK\_+3V3 & P2 & 15 & COM &  0 $\Omega$ & SIGN0817 \\ 
        \cline{6-9} 
        &  &  &  &  & 17 & N.O. &  0 $\Omega$ & GND \\ 
        \hline 
        &  &  &  &  &  & N.C. &  Open & Open \\ 
        \cline{6-9} 
        3 & RIO & RIO\_VOLT\_SDAR & RIO\_HICURR1 & P3 & PCB-Cable & COM &  0 $\Omega$ & RIO\_+3V3 \\ 
        \cline{6-9} 
        &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\ 
        \hline 
        &  &  &  &  &  & N.C. &  Open & Open \\ 
        \cline{6-9} 
        4 & RIO & RIO\_VOLT\_SDAR & RIO\_HICURR2 & P3 & PCB-Cable & COM &  0 $\Omega$ & RIO\_+3V3 \\ 
        \cline{6-9} 
        &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\ 
        \hline 
        &  &  &  &  & 14 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        5 & RIO & RIO\_VOLT\_SDAR & BAT\_LOW TBD & P2 & 16 & COM &  0 $\Omega$ & TBD \\ 
        \cline{6-9} 
        &  &  &  &  & 18 & N.O. &  0 $\Omega$ &  \\ 
        \hline 
        &  &  &  &  & 8 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        6 & RIO & RIO\_VOLT\_SDAR & BAT\_EMPTY TBD & P2 & 10 & COM &  0 $\Omega$ & TBD \\ 
        \cline{6-9} 
        &  &  &  &  & 12 & N.O. &  0 $\Omega$ &  \\ 
        \hline 
        &  &  &  &  & 2 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        7 & RIO & RIO\_VOLT\_SDAR & RIO\_DSP\_+3V3 & P2 & 4 & COM &  0 $\Omega$ & SIGN08150 \\ 
        \cline{6-9} 
        &  &  &  &  & 6 & N.O. &  0 $\Omega$ & Open \\ 
        \hline 
    \end{tabular}%
        %}%
    \caption{Verkabelung der ersten Relaisplatine an X400/PortA}
    \label{tab:x400}
    \end{table}
\end{landscape}
\end{document}

ingrese la descripción de la imagen aquí

Respuesta1

Aquí hay una posible solución utilizando el adjustwidthentorno delchangepage paquete, que le permite reducir transitoriamente los márgenes de la página. Junto con una reducción en el tamaño de fuente, puede eliminar el formato horizontal. Si desea conservar el paisaje, le sugiero quenoColoque el título de la sección allí, ya que puede confundir al lector.

Comenté un par de paquetes que no se encontraron en mi sistema, pero supongo que no hace ninguna diferencia.

\documentclass[a4paper, 11pt, parskip]{scrreprt}
\KOMAoption{listof}{totoc}%adds \listoffigures and \listoftables to the toc
\KOMAoption{appendixprefix}{true}%i think its for colon at appendix toc
\RedeclareSectionCommand[beforeskip=0pt,%to have smaller spacing before chapter texts
afterskip=2cm]{chapter}
\renewcommand{\autodot}{}% Remove all end-of-counter dots


\usepackage{scrhack}%\float@addtolists detected! Behebt die Warnung.
\usepackage{ucs}% Für den erweiterten utf8 Zeichensatz
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}% Für \lipsum
\usepackage{tikz-timing}[2009/05/15]% Für Zeitablaufdiagramme http://www.texample.net/tikz/examples/tikz-timing/
\usepackage{tikz}%drawing stuff
\usetikzlibrary{positioning}
\usepackage{cite}
\usepackage[]{acronym}%Abkürzungsverzeichnis
%\usepackage[bwr]{callouts}%for simple drawings in pictures
\usepackage{url}% for pathnames
\usepackage{dirtree}%for directory trees
\usepackage{makecell}%To keep spacing of text in tables
\usepackage{colortbl}%coloring tables
\usepackage{xcolor}
\usepackage{pdflscape}
%------------------------------------------------------------------------------------------------
% fonts, fonts fonts. see https://tex.stackexchange.com/questions/43881/how-to-correctly-use-the-palatino-font-in-memoir
% Pagella (Palatino clone) font for text, pazo for math
\usepackage[sc]{mathpazo} % use mathpazo for math fonts.
\usepackage{tgpagella} % but use tgpagella as main font
%\usepackage[scaled=0.75]{luximono}
%\usepackage{inconsolata}

\normalfont % we want to avoid annoying warnings
\DeclareFontShape{T1}{qpl}{m}{sl} { <-> ssub * qpl/m/it }{}
\DeclareFontShape{T1}{qpl}{b}{sl} { <-> ssub * qpl/b/it }{}

% heros (Helvetica clone) for sans serif
\usepackage{tgheros}%   Serifenlose Schrift für Überschriften. 
%------------------------------------------------------------------------------------------------
\usepackage[ngerman]{babel}          
\usepackage{graphicx}%bilder einfügen
\usepackage{caption, booktabs}
\usepackage{multirow}
\usepackage{color}  %farben für listings
\definecolor{mygreen}{rgb}{0,0.5,0}
\definecolor{Gray}{gray}{0.85}

\usepackage{changepage, lipsum}

\begin{document}

    \chapter{Stuff}

    \lipsum[1-2]

    \section{More stuff}

    \lipsum[3-4]

    \subsection{X400/PortA/Relaisplatine 1}
    Portextension 1: X400/PortA\\
    Labeled with Number 1.

    \begin{table}[h]
        %\makegapedcells
    \begin{adjustwidth}{-8em}{-8em}
    \centering\small % or try \footnotesize
    \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
        %\multicolumn{9}{c}{text}\\
        \hline
        \multicolumn{9}{|c|}{\gape{\Huge Relaisplatine}} \\ 
        \hline
        Relay Nr. & Part & Test-Id & \makecell[c]{Signal-Name \\for Testcases} & Conn. & Pin & \makecell[c]{Pin-\\Func.} & R Value & \makecell[c]{Influenced \\ Signal/Voltage } \\ 
        \hline 
        \cline{6-9} 
        %\hline 
        0 & RIO & RIO\_VOLT\_SDAR & RIO\_GPP\_VCORE & P2 & 3 & COM &  0 $\Omega$ & SIGN08116 \\
        \cline{6-9}  
        %\hline 
        &  &  &  &  & 5 & N.O. &  0 $\Omega$ & GND \\
        %\cline{6-9}  
        \hline 
        &  &  &  &  & 7 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        1 & RIO & RIO\_VOLT\_SDAR & RIO\_ETH\_+1V2 & P2 & 9 & COM &  0 $\Omega$ & SIGN0818 \\ 
        \cline{6-9}
        &  &  &  &  & 11 & N.O. &  0 $\Omega$ & GND \\ 
        \hline 
        &  &  &  &  & 13 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        2 & RIO & RIO\_VOLT\_SDAR & RIO\_CLOCK\_+3V3 & P2 & 15 & COM &  0 $\Omega$ & SIGN0817 \\ 
        \cline{6-9} 
        &  &  &  &  & 17 & N.O. &  0 $\Omega$ & GND \\ 
        \hline 
        &  &  &  &  &  & N.C. &  Open & Open \\ 
        \cline{6-9} 
        3 & RIO & RIO\_VOLT\_SDAR & RIO\_HICURR1 & P3 & PCB-Cable & COM &  0 $\Omega$ & RIO\_+3V3 \\ 
        \cline{6-9} 
        &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\ 
        \hline 
        &  &  &  &  &  & N.C. &  Open & Open \\ 
        \cline{6-9} 
        4 & RIO & RIO\_VOLT\_SDAR & RIO\_HICURR2 & P3 & PCB-Cable & COM &  0 $\Omega$ & RIO\_+3V3 \\ 
        \cline{6-9} 
        &  &  &  &  & PCB-Cable & N.O. &  0 $\Omega$ & GND \\ 
        \hline 
        &  &  &  &  & 14 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        5 & RIO & RIO\_VOLT\_SDAR & BAT\_LOW TBD & P2 & 16 & COM &  0 $\Omega$ & TBD \\ 
        \cline{6-9} 
        &  &  &  &  & 18 & N.O. &  0 $\Omega$ &  \\ 
        \hline 
        &  &  &  &  & 8 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        6 & RIO & RIO\_VOLT\_SDAR & BAT\_EMPTY TBD & P2 & 10 & COM &  0 $\Omega$ & TBD \\ 
        \cline{6-9} 
        &  &  &  &  & 12 & N.O. &  0 $\Omega$ &  \\ 
        \hline 
        &  &  &  &  & 2 & N.C. &  Open & Open \\ 
        \cline{6-9} 
        7 & RIO & RIO\_VOLT\_SDAR & RIO\_DSP\_+3V3 & P2 & 4 & COM &  0 $\Omega$ & SIGN08150 \\ 
        \cline{6-9} 
        &  &  &  &  & 6 & N.O. &  0 $\Omega$ & Open \\ 
        \hline 
    \end{tabular}%
    \end{adjustwidth}
        %}%
    \caption{Verkabelung der ersten Relaisplatine an X400/PortA}
    \label{tab:x400}
    \end{table}

    \subsection{Even more stuff}

    Just to illustrate that the margins are now their old selves again. \lipsum[5]

\end{document}

Producción:

ingrese la descripción de la imagen aquí

Por cierto, tu mesa lucirá mejor con un poco más de espacio vertical. Prueba por ejemplo \renewcommand{\arraystretch}{1.25}.

Respuesta2

Jugando con el valor de tabcolsep, el tamaño de fuente y configurando el encabezado de la primera columna en dos líneas, no necesita el landscapeentorno.

Comentario no relacionado: sería mejor cargar newpxmath, newpxtexten lugar de mathpazoy tgpagella: ambos se basan en tgpagella. También es innecesario cargar colorsi carga xcolor, del mismo modo que no tiene que cargar colortblsi carga xcolorcon la opción [table].

\documentclass[a4paper, 11pt, parskip, table]{scrreprt}
\KOMAoption{listof}{totoc}%adds \listoffigures and \listoftables to the toc
\KOMAoption{appendixprefix}{true}%i think its for colon at appendix toc
\RedeclareSectionCommand[beforeskip=0pt,%to have smaller spacing before chapter texts
afterskip=2cm]{chapter}
\renewcommand{\autodot}{}% Remove all end-of-counter dots


\usepackage{scrhack}%\float@addtolists detected! Behebt die Warnung.
\usepackage{ucs}% Für den erweiterten utf8 Zeichensatz
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}% Für \lipsum
\usepackage{tikz-timing}[2009/05/15]% Für Zeitablaufdiagramme http://www.texample.net/tikz/examples/tikz-timing/
\usepackage{tikz}%drawing stuff
\usetikzlibrary{positioning}
\usepackage{cite}
\usepackage[]{acronym}%Abkürzungsverzeichnis
\usepackage[bwr]{callouts}%for simple drawings in pictures
\usepackage{url}% for pathnames
\usepackage{dirtree}%for directory trees
\usepackage{makecell}%To keep spacing of text in tables
\usepackage{xcolor}%farben für listings
\usepackage{pdflscape}
%------------------------------------------------------------------------------------------------
% fonts, fonts fonts. see https://tex.stackexchange.com/questions/43881/how-to-correctly-use-the-palatino-font-in-memoir
% Pagella (Palatino clone) font for text, pazo for math
\usepackage[sc]{mathpazo} % use mathpazo for math fonts.
\usepackage{tgpagella} % but use tgpagella as main font
%\usepackage[scaled=0.75]{luximono}
\usepackage{inconsolata}

\normalfont % we want to avoid annoying warnings
\DeclareFontShape{T1}{qpl}{m}{sl} { <-> ssub * qpl/m/it }{}
\DeclareFontShape{T1}{qpl}{b}{sl} { <-> ssub * qpl/b/it }{}

% heros (Helvetica clone) for sans serif
\usepackage{tgheros}% Serifenlose Schrift für Überschriften.
%------------------------------------------------------------------------------------------------
\usepackage[ngerman]{babel}
\usepackage{graphicx}%bilder einfügen
\usepackage{caption, booktabs}
\usepackage{multirow}
\definecolor{mygreen}{rgb}{0,0.5,0}
\definecolor{Gray}{gray}{0.85}

\usepackage[showframe]{geometry}

\begin{document}

    \subsection{X400/PortA/Relaisplatine 1}
    Portextension 1: X400/PortA\\
    Labeled with Number 1.
    \begin{table}[h]
\footnotesize\setlength\tabcolsep{2.6pt}\setlength\extrarowheight{2pt}
        \centering
    \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
        \hline
        \multicolumn{9}{|c|}{\gape{\Huge Relaisplatine}} \\
        \hline
        \makecell{Relay\\ Nr.} & Part & Test-Id & \makecell[c]{Signal-Name \\for Testcases} & Conn. & Pin & \makecell[c]{Pin-\\Func.} & R Value & \makecell[c]{Influenced \\ Signal/Voltage } \\
        \hline
        \cline{6-9}
        %\hline
        \multirowcell{2}{0} & \multirowcell{2}{RIO} & \multirowcell{2}{RIO\_VOLT\_SDAR} & \multirowcell{2}{RIO\_GPP\_VCORE} & \multirowcell{2}{P2} & 3 & COM & 0 $\Omega$ & SIGN08116 \\
        \cline{6-9}
        %\hline
        & & & & & 5 & N.O. & 0 $\Omega$ & GND \\
        %\cline{6-9}
        \hline
        & & & & & 7 & N.C. & Open & Open \\
        \cline{6-9}
        1 & RIO & RIO\_VOLT\_SDAR & RIO\_ETH\_+1V2 & P2 & 9 & COM & 0 $\Omega$ & SIGN0818 \\
        \cline{6-9}
        & & & & & 11 & N.O. & 0 $\Omega$ & GND \\
        \hline
        & & & & & 13 & N.C. & Open & Open \\
        \cline{6-9}
        2 & RIO & RIO\_VOLT\_SDAR & RIO\_CLOCK\_+3V3 & P2 & 15 & COM & 0 $\Omega$ & SIGN0817 \\
        \cline{6-9}
        & & & & & 17 & N.O. & 0 $\Omega$ & GND \\
        \hline
        & & & & & & N.C. & Open & Open \\
        \cline{6-9}
        3 & RIO & RIO\_VOLT\_SDAR & RIO\_HICURR1 & P3 & PCB-Cable & COM & 0 $\Omega$ & RIO\_+3V3 \\
        \cline{6-9}
        & & & & & PCB-Cable & N.O. & 0 $\Omega$ & GND \\
        \hline
        & & & & & & N.C. & Open & Open \\
        \cline{6-9}
        4 & RIO & RIO\_VOLT\_SDAR & RIO\_HICURR2 & P3 & PCB-Cable & COM & 0 $\Omega$ & RIO\_+3V3 \\
        \cline{6-9}
        & & & & & PCB-Cable & N.O. & 0 $\Omega$ & GND \\
        \hline
        & & & & & 14 & N.C. & Open & Open \\
        \cline{6-9}
        5 & RIO & RIO\_VOLT\_SDAR & BAT\_LOW TBD & P2 & 16 & COM & 0 $\Omega$ & TBD \\
        \cline{6-9}
        & & & & & 18 & N.O. & 0 $\Omega$ & \\
        \hline
        & & & & & 8 & N.C. & Open & Open \\
        \cline{6-9}
        6 & RIO & RIO\_VOLT\_SDAR & BAT\_EMPTY TBD & P2 & 10 & COM & 0 $\Omega$ & TBD \\
        \cline{6-9}
        & & & & & 12 & N.O. & 0 $\Omega$ & \\
        \hline
        & & & & & 2 & N.C. & Open & Open \\
        \cline{6-9}
        7 & RIO & RIO\_VOLT\_SDAR & RIO\_DSP\_+3V3 & P2 & 4 & COM & 0 $\Omega$ & SIGN08150 \\
        \cline{6-9}
        & & & & & 6 & N.O. & 0 $\Omega$ & Open \\
        \hline
    \end{tabular}%
        %}%
    \caption{Verkabelung der ersten Relaisplatine an X400/PortA}
    \label{tab:x400}
    \end{table}

\end{document} 

ingrese la descripción de la imagen aquí

información relacionada