將小節強制放到與表格相同的頁面上

將小節強制放到與表格相同的頁面上

我想將我的小節強制放在與表格相同的頁面上。

該表似乎太大,無法自動執行。我可以\resizebox縮小桌子,但我過去常常\landscape避免這樣做。

有沒有辦法做到這一點?也許放大頁面的不可見文字邊框?有什麼建議麼?

\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}

在此輸入影像描述

答案1

這是使用套件adjustwidth中的環境的一種可能的解決方案changepage,它允許您暫時減少頁邊距。隨著字體大小的減小,您可以取消橫向格式。如果你想保留風景,我建議不是將章節標題放在那裡,因為它可能會讓讀者感到困惑。

我註解掉了一些在我的系統上找不到的軟體包,但我認為這不會產生任何影響。

\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}

輸出:

在此輸入影像描述

順便說一句,如果你的桌子有更多的垂直空間,看起來會更好。嘗試舉例\renewcommand{\arraystretch}{1.25}

答案2

使用 的值tabcolsep、字體大小並將第一個列標題設為兩行,您不需要環境landscape

不相關的評論:最好加載newpxmath,newpxtext代替mathpazotgpagella:兩者都基於 tgpagella。color如果您加載,也無需加載,就像您使用選項加載時xcolor不必加載一樣。colortblxcolor[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} 

在此輸入影像描述

相關內容