我只是想弄清楚如何将多行引用到同一个脚注中。我曾经\usepackage{threeparttable}
这样做过。但是,我制作的表格相当大(超过 70 行),这似乎弄乱了命令\centering
。表格已向右移动。
现在,我正在使用 resizebox 将整个内容放入一页,并且我不太愿意随机选择,\renewcommand
因为我并不总是确定这会对我的具体情况产生什么影响。
表格仍然在页面内,但我真的很想让它居中。
这是最小可行代码和表格的一部分。
\documentclass[a4paper,12pt,twoside,BCOR=10mm]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[icelandic]{babel}
% \usepackage{t1enc}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames]{xcolor}
\usepackage{graphicx,booktabs}
\usepackage[intoc]{nomencl}
\usepackage{enumerate,color}
\usepackage{url}
\usepackage{appendix}
\usepackage{float}
\usepackage{eso-pic}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{longtable}
\usepackage{acronym}
\usepackage{nicematrix}
\usepackage{makecell}
% \usepackage{tablefootnote}
\usepackage{threeparttable}
%\usepackage[sf,normalsize]{subfigure}
\usepackage[format=plain,labelformat=simple,labelsep=colon]{caption}
\usepackage{placeins}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{adjustbox}
\usepackage{subcaption}
%\usepackage{subfig}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{external}
% Packages used for title page layout
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[pdfborder={0 0 0}]{hyperref}
% \usepackage{scrextend}
\begin{document
\begin{table}
\centering
{\small\renewcommand{\arraystretch}{.8}
\caption{Spá um raforkunotkun, forgangsorka og skerðanleg orka. Almenn notkun að meðtöldum dreifitöpum og núverandi og samþykktir nýir stórnotendur. \label{table:Orkuspá}}
\resizebox{!}{.31\paperheight}{
\begin{threeparttable}
\begin{NiceTabular}{lcccccccccc}
\hline
\Block{2-1}{Ár} & \Block{1-2}{Úttekt frá dreifikerfinu\\ forgangs- og skerðanleg\\ orka með dreifitöpum} & & \Block{1-2}{Úttekt frá\\ flutningskerfinu} & & \Block{1-2}{Flutningstöp} & & \Block{1-2}{Úttekt frá \\ vinnslufyrirtækjum} & & \Block{1-2}{Samtals} \\
& Orka GWh & Afl MW & Orka GWh & Afl MW & Orka GWh & Afl MW & Orka GWh & Afl MW & Orka GWh & Afl MW \\
\hline
2015 \tnote{1} & 3.604,74 & 618,46 & 14.356,34 & 1.685,89 & 369,56 & 57,11 & 468,32 & 75,40 & 18.798,96 & 2.383,25 \\
2016 \tnote{1} & 3.383,99 & 590,10 & 14.334,19 & 1.695,96 & 360,42 & 57,05 & 470,86 & 71,46 & 18.549,46 & 2.378,51 \\
2017 \tnote{1} & 3.519,13 & 608,86 & 14.869,95 & 1.750,87 & 373,07 & 61,49 & 476,38 & 84,74 & 19.238,53 & 2.443,61 \\
2018 \tnote{1} & 3.682,07 & 623,26 & 15.259,88 & 1.838,28 & 398,09 & 70,47 & 489,75 & 70,71 & 19.829,79 & 2.519,53 \\
2019 \tnote{1} & 3.506,86 & 596,63 & 15.145,31 & 1.829,48 & 365,82 & 63,40 & 476,84 & 85,11 & 19.494,83 & 2.495,07 \\
2020 \tnote{1} & 3.473,77 & 596,83 & 14.830,70 & 1.790,95 & 353,09 & 60,54 & 469,74 & 72,27 & 19.127,30 & 2.408,28 \\
2021 & 3.688,10 & 630,47 & 15.539,59 & 1.865,64 & 397,70 & 67,72 & 479,82 & 73,82 & 20.105,21 & 2.584,89 \\
2022 & 3.785,98 & 647,81 & 16.099,28 & 1.875,76 & 416,40 & 69,68 & 490,14 & 75,41 & 20.791,80 & 2.615,29 \\
\hline
\end{NiceTabular}
\begin{tablenotes}
\item[1] Rauntölur
\end{tablenotes}
\end{threeparttable}}}
\end{table}
\end{document}
很抱歉我说得这么枯燥,只是漫长的一天过后我感到很累,而那一行又一行的相同脚注却花了我太多时间才弄清楚。
答案1
您所描述的“表格向右移动”现象几乎肯定是一种视觉错觉,是由于表格有 11 列而导致非常宽造成的。
我强烈建议不要使用任何一种\resizebox
机器adjustbox
将表格塞进一页,因为这种技巧几乎肯定会导致材料变得太小,以至于完全难以辨认和理解。
相反,我建议你使用一个或多个横向模式页面来呈现表格。具体需要多少个页面取决于实际表格有多少行。
以下屏幕截图显示了在环境中渲染代码中提供的表格的结果sidewaystable
。请注意,我使用了包中的一些机制siunitx
来帮助自动格式化数字数据。如果您的表格需要在多个环境中显示sidewaystable
,请务必使用包\ContinuedFloat
中的宏\caption
来帮助调整表格标题的编号。
恐怕我不懂冰岛语,但我忍不住要说,如果你能把数据列 1 和 2 上方的子标题写得不那么冗长,可能会很有用。:-)
\documentclass[a4paper,12pt,twoside,BCOR=10mm]{scrbook}
% \usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage[icelandic]{babel}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames]{xcolor}
\usepackage{graphicx}
\usepackage{booktabs} % for well-spaced horizontal rules
\usepackage[intoc]{nomencl}
\usepackage{enumerate} %,color
\usepackage{xurl} % allow linebreaks at arbitrary points in a long URL string
\usepackage{appendix}
\usepackage{eso-pic}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{longtable}
\usepackage{acronym}
\usepackage{nicematrix}
\usepackage{makecell}
\usepackage[flushleft]{threeparttable} % <-- use 'flushleft' option
\usepackage[format=plain,labelformat=simple,labelsep=colon]{caption}
\usepackage{subcaption}
\usepackage{placeins}
\usepackage{tabularx}
\usepackage{multirow}
%%%%\usepackage{adjustbox}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{external}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[pdfborder={0 0 0}]{hyperref}
% new code:
\usepackage[figuresright]{rotating} % for 'sidewaystable' env.
\usepackage{siunitx}
\newcolumntype{T}[1]{S[table-format=#1]}
\newcommand\mybox[1]{\multicolumn{2}{c}{%
\begin{tabular}[t]{@{} c @{}} #1 \end{tabular}}}
% \usepackage{scrextend}
\begin{document}
\begin{sidewaystable}
\sisetup{group-minimum-digits =4,
group-separator ={.},
output-decimal-marker={,}}
\setlength\tabcolsep{0pt} % let LaTeX figure out intercol. separation
\begin{threeparttable}
\caption{Spá um raforkunotkun, forgangsorka og skerðanleg
orka. Almenn notkun að meðtöldum dreifitöpum og
núverandi og samþykktir nýir stórnotendur.\strut}
\label{table:Orkuspá}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l
T{4.2}T{3.2}
T{5.2}T{4.2}
*{2}{T{3.2}T{2.2}}
T{5.2}T{4.2} }
\toprule
Ár &
\mybox{Úttekt frá dreifikerfinu\\
forgangs- og skerðanleg\\
orka með dreifitöpum} &
\mybox{Úttekt frá\\ flutningskerfinu} &
\mybox{Flutningstöp} &
\mybox{Úttekt frá \\ vinnslufyrirtækjum} &
\mybox{Samtals}
\\
\cmidrule{2-3} \cmidrule{4-5} \cmidrule{6-7} \cmidrule{8-9} \cmidrule{10-11}
& {Orka GWh} & {Afl MW}
& {Orka GWh} & {Afl MW}
& {Orka GWh} & {Afl MW}
& {Orka GWh} & {Afl MW}
& {Orka GWh} & {Afl MW} \\
\midrule
2015\tnote{1} & 3604,74 & 618,46 & 14356,34 & 1685,89 & 369,56 & 57,11 & 468,32 & 75,40 & 18798,96 & 2383,25 \\
2016\tnote{1} & 3383,99 & 590,10 & 14334,19 & 1695,96 & 360,42 & 57,05 & 470,86 & 71,46 & 18549,46 & 2378,51 \\
2017\tnote{1} & 3519,13 & 608,86 & 14869,95 & 1750,87 & 373,07 & 61,49 & 476,38 & 84,74 & 19238,53 & 2443,61 \\
2018\tnote{1} & 3682,07 & 623,26 & 15259,88 & 1838,28 & 398,09 & 70,47 & 489,75 & 70,71 & 19829,79 & 2519,53 \\
2019\tnote{1} & 3506,86 & 596,63 & 15145,31 & 1829,48 & 365,82 & 63,40 & 476,84 & 85,11 & 19494,83 & 2495,07 \\
2020\tnote{1} & 3473,77 & 596,83 & 14830,70 & 1790,95 & 353,09 & 60,54 & 469,74 & 72,27 & 19127,30 & 2408,28 \\
2021 & 3688,10 & 630,47 & 15539,59 & 1865,64 & 397,70 & 67,72 & 479,82 & 73,82 & 20105,21 & 2584,89 \\
2022 & 3785,98 & 647,81 & 16099,28 & 1875,76 & 416,40 & 69,68 & 490,14 & 75,41 & 20791,80 & 2615,29 \\
\bottomrule
\end{tabular*}
\smallskip\footnotesize
\begin{tablenotes}
\item[1] Rauntölur
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}
\end{document}
答案2
尝试将表格放在纵向页面上。通过使用talltblr
包tabularray
,该包提供了经典的功能threeparttable
,并带有库booktabs
和siunitx
。
\documentclass[a4paper,12pt,twoside,BCOR=10mm]{scrbook}
\usepackage[icelandic]{babel}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames]{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\sisetup{group-minimum-digits =4,
group-separator ={.},
output-decimal-marker={,}}
\newcommand\TN[1]{\TblrNote{#1}}
\usepackage[format=plain,
labelformat=simple,labelsep=colon]{caption}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{table}
\footnotesize
\centering
\SetTblrStyle{note}{font=\scriptsize}
\begin{talltblr}[
caption = {Spá um raforkunotkun, forgangsorka og skerðanleg orka. Almenn notkun að meðtöldum dreifitöpum og núverandi og samþykktir nýir stórnotendur.},
label = {table:Orkuspá},
note{1} = {Rauntölur}
]{colsep = 2.9pt,
colspec = {@{} l Q[c, si={table-format=4.2}]
Q[c, si={table-format=3.2}]
Q[c, si={table-format=5.2}]
Q[c, si={table-format=4.2}]
*{2}{Q[c, si={table-format=3.2}]
Q[c, si={table-format=2.2}]}
Q[c, si={table-format=5.2}]
Q[c, si={table-format=4.2}]
@{}},
row{1,2} = {guard, b},
hspan=even
}
\toprule
\SetCell[r=2]{c} Ár
& \SetCell[c=2]{c} {Úttekt frá dreifikerfinu\\ forgangsog skerðanleg\\ orka með dreifitöpum}
& & \SetCell[c=2]{c} {Úttekt frá\\ flutningskerfinu}
& & \SetCell[c=2]{c} Flutningstöp
& &\SetCell[c=2]{c} {Úttekt frá \\ vinnslufyrir-\\tækjum}
& & \SetCell[c=2]{c} Samtals
& \\
\cmidrule[lr=-0.4]{2-3} \cmidrule[lr=-0.4]{4-5} \cmidrule[lr=-0.4]{6-7}
\cmidrule[lr=-0.4]{8-9} \cmidrule[lr=-0.4]{10-11}
& {Orka\\ GWh} & {Afl\\ MW} & {Orka\\ GWh} & {Afl\\ MW}
& {Orka\\ GWh} & {Afl\\ MW} & {Orka\\ GWh} & {Afl\\ MW}
& {Orka\\ GWh} & {Afl\\ MW} \\
\midrule
2015\TN{1} & 3 604,74 & 618,46 & 14 356,34 & 1 685,89 & 369,56 & 57,11 & 468,32 & 75,40 & 18 798,96 & 2 383,25 \\
2016\TN{1} & 3 383,99 & 590,10 & 14 334,19 & 1 695,96 & 360,42 & 57,05 & 470,86 & 71,46 & 18 549,46 & 2 378,51 \\
2017\TN{1} & 3 519,13 & 608,86 & 14 869,95 & 1 750,87 & 373,07 & 61,49 & 476,38 & 84,74 & 19 238,53 & 2 443,61 \\
2018\TN{1} & 3 682,07 & 623,26 & 15 259,88 & 1 838,28 & 398,09 & 70,47 & 489,75 & 70,71 & 19 829,79 & 2 519,53 \\
2019\TN{1} & 3 506,86 & 596,63 & 15 145,31 & 1 829,48 & 365,82 & 63,40 & 476,84 & 85,11 & 19 494,83 & 2 495,07 \\
2020\TN{1} & 3 473,77 & 596,83 & 14 830,70 & 1 790,95 & 353,09 & 60,54 & 469,74 & 72,27 & 19 127,30 & 2 408,28 \\
2021 & 3 688,10 & 630,47 & 15 539,59 & 1 865,64 & 397,70 & 67,72 & 479,82 & 73,82 & 20 105,21 & 2 584,89 \\
2022 & 3 785,98 & 647,81 & 16 099,28 & 1 875,76 & 416,40 & 69,68 & 490,14 & 75,41 & 20 791,80 & 2 615,29 \\
\bottomrule
\end{talltblr}
\end{table}
\end{document}