![强制子部分与表格放在同一页上](https://linux22.com/image/358173/%E5%BC%BA%E5%88%B6%E5%AD%90%E9%83%A8%E5%88%86%E4%B8%8E%E8%A1%A8%E6%A0%BC%E6%94%BE%E5%9C%A8%E5%90%8C%E4%B8%80%E9%A1%B5%E4%B8%8A.png)
我想强制将我的小节放在与表格相同的页面上。
表格似乎太大了,无法自动执行此操作。我可以使用\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
加载,两者都基于 tgpagella。同样,如果您加载,则无需加载,就像如果您使用选项加载,则无需加载一样。newpxtext
mathpazo
tgpagella
color
xcolor
colortbl
xcolor
[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}