多列表格格式

多列表格格式

我正在努力解决多列问题。我想要的是三列之间的间距相等。如果没有多列,由于面板行,空间就不够。如果使用多列,看起来就很糟糕。有人知道我该如何处理这个问题吗?我猜第一列只需要向右移动一点,表格看起来至少还不错……

    \documentclass[a4paper, 12pt]{article}
\DeclareUnicodeCharacter{FB01}{fi}
\DeclareUnicodeCharacter{FB02}{fl}
%\usepackage[space]{grffile}
\usepackage{apacite}
\usepackage{makecell}
\usepackage{afterpage}
\usepackage{dblfloatfix}
\usepackage[referable]{threeparttablex}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage{mleftright}
\usepackage{lscape}
\usepackage{a4wide}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[onehalfspacing]{setspace}
\usepackage{float, afterpage, rotating, graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz, epstopdf,pgfplots}
\usepackage{longtable, booktabs, tabularx}
\usepackage{fancyvrb, moreverb, relsize}
\usepackage{eurosym, calc, chngcntr}
\usepackage{amsmath, amssymb, amsfonts, amsthm, bm}
\usepackage{mathtools}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\usepackage[labelfont={bf}, skip=5pt]{caption}
\usepackage{mdwlist}
\usepackage{tabularx, booktabs}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{xfrac}
\usepackage{setspace,geometry}
\usepackage{xcolor}
\usepackage{lmodern}
\usepackage{upgreek}
\usepackage{afterpage}
\usepackage{wrapfig}
\usepackage{pdflscape}
\usepackage{multirow, booktabs, makecell, caption}
\usepackage{fancyhdr}
\usepackage[toc]{glossaries}
\usepackage{subcaption}
\usepackage{lipsum}  
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{eurosym}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{abstract}
\usepackage{dcolumn}
\usepackage{graphicx}
\usepackage[hyphens]{url}
\usepackage{acronym}
\usepackage[english]{babel}
\usepackage[round, sort&compress]{natbib} %sort&compress orders in text citation automatically
\usepackage{pgfplots}
\usepackage{threeparttable}
\usepackage{siunitx} %setze S in Tabelle, um nach dem Punkt auszurichten
\usepackage[export]{adjustbox}
\usepackage{etoolbox}
\usepackage[hyperfootnotes=false]{hyperref}
\usepackage{footnotebackref}
\usepackage{appendix}
\usepackage[bottom,hang,flushmargin]{footmisc} %footnotes always appear on bottom and not end of text on single page
\geometry{a4paper, top=30mm, left=30mm, right=30mm, bottom=30mm,headsep=10mm, footskip=12mm}

%try to prevent widows and orphans (single lines on top/bottom of page)
\widowpenalty10000 
\clubpenalty10000

\begin{document}

\begin{table}[t!]
  \centering
  \caption{Summary of strategy performances}
  \label{tab2:summary}
  \begin{threeparttable}
  \begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}*{3}{c}}

\toprule
          & \makecell{\textbf{Individual} \\ \textbf{Cryptocurrencies}} & \makecell{\textbf{Equally-weighted} \\ \textbf{benchmark}} & \makecell{\textbf{Risk-based} \\ \textbf{Strategies}} \\

 \midrule
    \multicolumn{2}{l}{\textit{Panel A: Risk and Return}}        &       &       \\
    Mean  & \textbf{--} & \textbf{+}  & \textbf{--} \\
    SD    & \textbf{--} & \textbf{--} & \textbf{+} \\
    SR    & \textbf{--} & \textbf{--}   & \textbf{+} \\
    Min   & \textbf{--} & \textbf{--} & \textbf{+}   \\
    Max   & \textbf{--} & \textbf{--} & \textbf{+} \\
    Skew  & \textbf{--} & \textbf{--} & \textbf{+} \\
    Kurt  & \textbf{--} & \textbf{--} & \textbf{+} \\
    \midrule
    \multicolumn{2}{l}{\textit{Panel B: Tail and Extreme Risk}}       &       &  \\
    VaR (5\%) & \textbf{--} & \textbf{--} & \textbf{+} \\
    VaR (1\%) & \textbf{--} & \textbf{--} & \textbf{+} \\
    CVaR(5\%) & \textbf{--} & \textbf{--} & \textbf{+} \\
    CVaR (1\%)& \textbf{--} & \textbf{--} & \textbf{+} \\
    DD        & \textbf{--} & \textbf{--} & \textbf{+} \\
    MD        & \textbf{--} & \textbf{--} & \textbf{+} \\
    LPM       & \textbf{--} & \textbf{--} & \textbf{+} \\
    \midrule
    \multicolumn{2}{l}{\textit{Panel C: Conditional Performance}}        &       &  \\
    Bull market & \textbf{--} & \textbf{--} & \textbf{+} \\
    Bear market & \textbf{--} & \textbf{--} & \textbf{+} \\
    \bottomrule

  \end{tabular*}
  \begin{tablenotes}[para,flushleft]
  \footnotesize
  \item\hspace{-2.5pt}\noindent\textit{Note:} The table
  provides xx
  \end{tablenotes}
  \end{threeparttable}
\end{table}


\end{document}

答案1

您的问题主要基于观点...因此,下面 MWE 的主要贡献是清理代码中所有不必要的重复,在列标题和介绍包中textbf使用thead而不是来编写表格注释:makecellthreepartablex

\documentclass[a4paper, 12pt]{article}
\DeclareUnicodeCharacter{FB01}{fi}
\DeclareUnicodeCharacter{FB02}{fl}
\usepackage{booktabs, makecell, multirow, tabularx}
\renewcommand\theadfont{\small\bfseries}
\usepackage[referable]{threeparttablex}
\usepackage{caption}

\usepackage{siunitx} %setze S in Tabelle, um nach dem Punkt auszurichten
\usepackage[a4paper, 
           margin=30mm,headsep=10mm, footskip=12mm]{geometry}

\begin{document}
    \begin{table}[ht]
  \centering
  \caption{Summary of strategy performances}
  \label{tab2:summary}
  \begin{threeparttable}
  \begin{tabularx}{\linewidth}{l*{3}{>{\bfseries\centering\arraybackslash}X}}
    \toprule
    &   \thead{Individual\\ Cryptocurrencies}
        &   \thead{Equally-weighted\\ benchmark}
            &   \thead{Risk-based\\ Strategies}             \\
    \midrule
\multicolumn{4}{c}{\textit{Panel A: Risk and Return}}       \\
    \midrule
    Mean  & --  & +     & --    \\
    SD    & --  & --    & +     \\
    SR    & --  & --    & +     \\
    Min   & --  & --    & +     \\
    Max   & --  & --    & +     \\
    Skew  & --  & --    & +     \\
    Kurt  & --  & --    & +     \\
    \addlinespace
\multicolumn{4}{c}{\textit{Panel B: Tail and Extreme Risk}} \\
    \midrule
    VaR (5\%) & --  & --    & +     \\
    VaR (1\%) & --  & --    & +     \\
    CVaR(5\%) & --  & --    & +     \\
    CVaR (1\%)& --  & --    & +     \\
    DD        & --  & --    & +     \\
    MD        & --  & --    & +     \\
    LPM       & --  & --    & +     \\
    \addlinespace
\multicolumn{4}{c}{\textit{Panel C: Conditional Performance}}\\
    \midrule
    Bull market & --    & --    & + \\
    Bear market & --    & --    & + \\
    \bottomrule
  \end{tabularx}
  \begin{tablenotes}[para,flushleft]
  \footnotesize
  \note The table
  provides xx
  \end{tablenotes}
  \end{threeparttable}
    \end{table}
\end{document}

上述 MWE 给出:

在此处输入图片描述

答案2

您可能对以下内容更满意。我习惯于@{\quad\quad}缩进第一列,而多列条目则不缩进。我还用 替换\item\hspace{-2.5pt}\noindent\textit{Note:}\note

在此处输入图片描述

\documentclass[a4paper, 12pt]{article}
\usepackage{makecell}
\usepackage[referable]{threeparttablex}
\usepackage{booktabs}


\begin{document}

\begin{table}[t!]
  \centering
  \caption{Summary of strategy performances}
  \label{tab2:summary}
  \begin{threeparttable}
  \begin{tabular*}{\linewidth}{@{\quad\quad}l@{\extracolsep{\fill}}*{3}{c}}

\toprule
          & \makecell{\textbf{Individual} \\ \textbf{Cryptocurrencies}} & \makecell{\textbf{Equally-weighted} \\ \textbf{benchmark}} & \makecell{\textbf{Risk-based} \\ \textbf{Strategies}} \\

 \midrule
    \multicolumn{2}{l}{\textit{Panel A: Risk and Return}}        &       &       \\
    Mean  & \textbf{--} & \textbf{+}  & \textbf{--} \\
    SD    & \textbf{--} & \textbf{--} & \textbf{+} \\
    SR    & \textbf{--} & \textbf{--}   & \textbf{+} \\
    Min   & \textbf{--} & \textbf{--} & \textbf{+}   \\
    Max   & \textbf{--} & \textbf{--} & \textbf{+} \\
    Skew  & \textbf{--} & \textbf{--} & \textbf{+} \\
    Kurt  & \textbf{--} & \textbf{--} & \textbf{+} \\
    \midrule
    \multicolumn{2}{l}{\textit{Panel B: Tail and Extreme Risk}}       &       &  \\
    VaR (5\%) & \textbf{--} & \textbf{--} & \textbf{+} \\
    VaR (1\%) & \textbf{--} & \textbf{--} & \textbf{+} \\
    CVaR(5\%) & \textbf{--} & \textbf{--} & \textbf{+} \\
    CVaR (1\%)& \textbf{--} & \textbf{--} & \textbf{+} \\
    DD        & \textbf{--} & \textbf{--} & \textbf{+} \\
    MD        & \textbf{--} & \textbf{--} & \textbf{+} \\
    LPM       & \textbf{--} & \textbf{--} & \textbf{+} \\
    \midrule
    \multicolumn{2}{l}{\textit{Panel C: Conditional Performance}}        &       &  \\
    Bull market & \textbf{--} & \textbf{--} & \textbf{+} \\
    Bear market & \textbf{--} & \textbf{--} & \textbf{+} \\
    \bottomrule

  \end{tabular*}
  \begin{tablenotes}[para,flushleft]
  \footnotesize
  \note The table provides xx
  \end{tablenotes}
  \end{threeparttable}
\end{table}


\end{document}

答案3

我建议你首先改变所有三个实例

\multicolumn{2}{l}{\textit{Panel ...}}       &       &  \\

\multicolumn{4}{l}{\textit{Panel ...}}  \\

为了美化表格的“外观”,我还将用 替换内部实例,\midrule并将和\addlinespace的所有实例分别替换为\textbf{+}和。此外,我看不出在 中渲染标题单元格的任何(印刷)理由\textbf{--}$\bm{+}$$\bm{-}$大胆的,并且threeparttable由于没有任何\tnote指令,使用机器似乎毫无意义。

在此处输入图片描述

\documentclass[a4paper, 12pt]{article}
%%% I tried to simplify the preamble considerably...
%\DeclareUnicodeCharacter{FB01}{fi}
%\DeclareUnicodeCharacter{FB02}{fl}
%\usepackage[space]{grffile}
%\usepackage{apacite}
\usepackage{makecell}
%\usepackage{afterpage}
%\usepackage{dblfloatfix}
%\usepackage[referable]{threeparttablex}
%\usepackage[paper=portrait,pagesize]{typearea}
%\usepackage{mleftright}
%\usepackage{lscape}
%\usepackage{a4wide}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[onehalfspacing]{setspace}
\usepackage{%float, afterpage, rotating, 
           graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz, %epstopdf,
            pgfplots}
\usepackage{%longtable, 
            booktabs, tabularx}
%\usepackage{fancyvrb, moreverb, relsize}
%\usepackage{eurosym, calc, chngcntr}
\usepackage{amsmath, amssymb, %amsfonts, 
            amsthm, bm}
%\usepackage{mathtools}
%\DeclareMathOperator*{\argmin}{arg\,min}
%\DeclareMathOperator*{\argmax}{arg\,max}
\usepackage[%labelfont=bf, 
            skip=5pt]{caption}
%\usepackage{mdwlist}
%\usepackage{tabularx, booktabs}
%\newcolumntype{C}{>{\centering\arraybackslash}X}
%\usepackage{xfrac}
\usepackage{%setspace,
     geometry}
%\usepackage{xcolor}
\usepackage{lmodern}
\usepackage{upgreek}
%\usepackage{afterpage}
%\usepackage{wrapfig}
%\usepackage{pdflscape}
%\usepackage{multirow, booktabs, makecell, caption}
%\usepackage{fancyhdr}
%\usepackage[toc]{glossaries}
%\usepackage{subcaption}
%\usepackage{lipsum}  
%\usepackage{amsmath}
%\usepackage{amssymb}
%\usepackage{eurosym}
%\usepackage{amsfonts}
%\usepackage{booktabs}
%\usepackage{abstract}
%\usepackage{dcolumn}
%\usepackage{graphicx}
\usepackage[hyphens]{url}
%\usepackage{acronym}
\usepackage[english]{babel}
\usepackage[round, sort&compress]{natbib} 
    %sort&compress orders in-text citations automatically
%\usepackage{pgfplots}
%\usepackage{threeparttable}
\usepackage{siunitx} %setze S in Tabelle, um nach dem Punkt auszurichten
%\usepackage[export]{adjustbox}
%\usepackage{etoolbox}
%\usepackage{appendix}
\usepackage[bottom,hang,flushmargin]{footmisc} 
   % make footnotes appear on bottom and not end of text on single page
\geometry{a4paper, margin =30mm, headsep = 10mm, footskip = 12mm}

% prevent typographic widows and orphans:
\widowpenalty10000 
\clubpenalty10000

\usepackage[hyperfootnotes=false]{hyperref}
\usepackage{footnotebackref}

\begin{document}

\begin{table}[t!]
  %\centering % redundant
  \setlength\tabcolsep{0pt} % <-- new
  \caption{Summary of strategy performances}
  \label{tab2:summary}
  %\begin{threeparttable}
\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}*{3}{c}}
\toprule
& \makecell{Individual \\ Cryptocurrencies} 
& \makecell{Equally-weighted \\ benchmark} 
& \makecell{Risk-based \\ Strategies} \\
\midrule
\multicolumn{4}{l}{\textit{Panel A: Risk and Return}}  \\
    Mean  & $\bm{-}$ & $\bm{+}$ & $\bm{-}$ \\
    SD    & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    SR    & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Min   & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Max   & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Skew  & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Kurt  & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
%\midrule
\addlinespace
\multicolumn{4}{l}{\textit{Panel B: Tail and Extreme Risk}} \\
    VaR (5\%) & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    VaR (1\%) & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    CVaR(5\%) & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    CVaR (1\%)& $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    DD        & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    MD        & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    LPM       & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
%\midrule
\addlinespace
\multicolumn{4}{l}{\textit{Panel C: Conditional Performance}}  \\
    Bull market & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Bear market & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
\bottomrule
\end{tabular*}

%\begin{tablenotes}[para,flushleft]
\smallskip
\footnotesize
\textit{Note:} The table provides \dots
%\end{tablenotes}
%\end{threeparttable}
\end{table}
\end{document}

附录:如果您确实不想让第一列的标题突出到数据列中,我建议您从环境切换tabular*tabularx环境,并对X所有四列的列类型进行修改:

在此处输入图片描述

\documentclass[12pt]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern, booktabs}
\usepackage{tabularx}
%% new: define 2 new column types: L and C
\newcolumntype{L}[1]{%
   >{\raggedright\arraybackslash%
     \hsize=#1\hsize\linewidth=\hsize%
     \hangafter=1\hangindent=1.5em}X} % automatic hanging indentation
\newcolumntype{C}[1]{%
   >{\centering\arraybackslash%
     \hsize=#1\hsize\linewidth=\hsize}X}

\usepackage{amsmath, amssymb, amsthm, bm}
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{geometry}
\geometry{a4paper,margin=30mm,headsep=10mm,footskip=12mm}

\begin{document}

\begin{table}[t!]
\caption{Summary of strategy performances}
\label{tab:summary}
\begin{tabularx}{\linewidth}{@{} L{1.45} *{2}{C{0.95}} C{0.65} @{}} 
  % 1.45+2*0.95+0.65 = 4 = # of columns of type "X"
\toprule
& Individual Cryptocurrencies & Equally-weighted benchmark & Risk-based Strategies \\
\midrule
\textit{Panel A: Risk and Return}  \\
    Mean  & $\bm{-}$ & $\bm{+}$ & $\bm{-}$ \\
    SD    & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    SR    & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Min   & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Max   & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Skew  & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Kurt  & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
\addlinespace
\textit{Panel B: Tail and Extreme Risk} \\
    VaR (5\%) & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    VaR (1\%) & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    CVaR(5\%) & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    CVaR (1\%)& $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    DD        & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    MD        & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    LPM       & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
\addlinespace
\textit{Panel C: Conditional Performance} \\
    Bull market & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
    Bear market & $\bm{-}$ & $\bm{-}$ & $\bm{+}$ \\
\bottomrule
\end{tabularx}

\smallskip
\footnotesize
\textit{Note:} The table provides \dots
\end{table}
\end{document}

相关内容