2 多个不同列数的panel合并成一个长表格

发布于 2024-10-23 19:35:25
\documentclass[11pt]{article}

\usepackage{lmodern}  % 使用现代Computer Modern字体
\usepackage{setspace}   % 设置文档的行距
\usepackage{amsmath, amsfonts, amssymb}   % 数学公式排版
\usepackage{bbm}        % 处理数学符号
\usepackage{multicol}   % 创建多栏布局
\usepackage{multirow}   % 跨行的单元格
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}   % 页面布局
\usepackage[normalem]{ulem} % either use this package to strikeout a text 删除或下划线
\usepackage{caption}    % 处理表格和图形的标题

% 表格相关
\usepackage{booktabs}   % 三线表
\usepackage{makecell}   % 表格内换行
\usepackage{float}
\usepackage{array}
\usepackage{tabularx}   % 设置表格的宽度
\usepackage{ragged2e}   % for \RaggedRight macro
\usepackage{longtable}   % 表格跨页
\usepackage{tabularray}
\usepackage{microtype}  % 改善对齐


\begin{document}  
%---------------------------------------------------------
% 生成Table1的Panel A
\newcommand*{\tapa}{
    {Panel A: Sample selection of site visits} &  \\
     & {No. of Total IR Activities} \\
    {1.Total IR activities} & 99,605 \\
    {2.The IR activities involving sell-side analysts} & 43,450 \\
    {3.The IR activities involving mutual fund managers} & 24,393 \\
    {4.The IR activities involving sell-side analysts and mutual fund managers} & 19,323 \\
    {Site visit} & 17,870 \\
    {Analyst meeting, Road show, and other meetings initiated by sell-side analysts} & 1,116 \\
    {Performance announcement meeting, Public news meeting, Media interview, and Others} & 597 \\
}



% Panel B
\newcommand*{\tapb}{
    Panel B: The number of site visits involving analysts and managers &  &  &  &  &  \\
    Year & involving analysts & involving managers & Co-visit & (3)/(1) & (3)/(2) \\
     & (1) & (2) & (3) & (4) & (5) \\
    2007 & 316 & 182 & 64 & 0.203 & 0.352 \\
    2008 & 290 & 156 & 82 & 0.283 & 0.526 \\
    2009 & 440 & 255 & 132 & 0.300 & 0.518 \\
    2010 & 575 & 297 & 155 & 0.270 & 0.522 \\
    2011 & 529 & 240 & 140 & 0.265 & 0.583 \\
    2012 & 2,148 & 1,246 & 910 & 0.424 & 0.730 \\
    2013 & 4,839 & 2,806 & 2,107 & 0.435 & 0.751 \\
    2014 & 5,150 & 3,057 & 2,363 & 0.459 & 0.773 \\
    2015 & 4,358 & 2,649 & 2,064 & 0.474 & 0.779 \\
    2016 & 4,842 & 2,582 & 2,127 & 0.439 & 0.824 \\
    2017 & 4,497 & 2,088 & 1,736 & 0.386 & 0.831 \\
    2018 & 3,657 & 1,730 & 1,443 & 0.395 & 0.834 \\
    2019 & 3,116 & 1,488 & 1,255 & 0.403 & 0.843 \\
    2020 & 3,649 & 2,297 & 1,954 & 0.535 & 0.851 \\
    2021 & 4,367 & 2,805 & 2,302 & 0.527 & 0.821 \\
    Total & 42,773 & 23,878 & 18,834 & NA & NA \\
    Avg. & 2,852 & 1,592 & 1,256 & 0.386 & 0.703 \\
}


% Panel C
\newcommand*{\tapc}{
    Panel C: The ratio of visiting analysts and managers  &  &  &  &  &  &  \\
    Year & Avg. Act Analyst & Avg. Visit Analyst & (2)/(1) & Avg. Act Manager & Avg. Visit Manager & (5)/(4) \\
     & (1) & (2) & (3) & (4) & (5) & (6) \\
    2007 & 19.073 & 2.640 & 0.138 & 7.035 & 1.433 & 0.204 \\
    2008 & 21.643 & 3.735 & 0.173 & 7.576 & 1.500 & 0.198 \\
    2009 & 22.092 & 4.023 & 0.182 & 8.950 & 1.458 & 0.163 \\
    2010 & 24.925 & 3.593 & 0.144 & 10.417 & 1.553 & 0.149 \\
    2011 & 18.965 & 3.538 & 0.187 & 11.078 & 1.697 & 0.153 \\
    2012 & 22.580 & 11.258 & 0.499 & 11.200 & 4.636 & 0.414 \\
    2013 & 26.067 & 17.620 & 0.676 & 12.028 & 6.940 & 0.577 \\
    2014 & 24.526 & 19.433 & 0.792 & 12.570 & 7.092 & 0.564 \\
    2015 & 23.844 & 18.833 & 0.790 & 13.230 & 7.000 & 0.529 \\
    2016 & 24.319 & 20.684 & 0.851 & 12.654 & 6.660 & 0.526 \\
    2017 & 28.151 & 22.400 & 0.796 & 13.675 & 6.732 & 0.492 \\
    2018 & 33.348 & 22.429 & 0.673 & 13.703 & 7.703 & 0.562 \\
    2019 & 30.305 & 21.470 & 0.708 & 14.014 & 7.041 & 0.502 \\
    2020 & 31.359 & 23.547 & 0.751 & 14.422 & 9.896 & 0.686 \\
    2021 & 30.000 & 24.106 & 0.804 & 15.521 & 10.445 & 0.673 \\
    Avg. & 25.413 & 14.621 & 0.544 & 11.872 & 5.452 & 0.426  \\
}


\newcommand*{\tapd}{
    Panel D: The number of analysts and managers in each joint site visit &  &  &  &  \\
    Year & Avg. of broker & Avg. of analyst & Avg. of fund company & Avg. of fund manager \\
     & (1) & (2) & (3) & (4) \\
    2007 & 1.266 & 1.422 & 1.844 & 1.953 \\
    2008 & 1.524 & 1.866 & 2.049 & 2.159 \\
    2009 & 1.568 & 1.773 & 1.886 & 1.955 \\
    2010 & 1.555 & 1.684 & 1.787 & 1.865 \\
    2011 & 1.550 & 1.814 & 1.664 & 1.750 \\
    2012 & 2.257 & 2.693 & 2.171 & 2.491 \\
    2013 & 2.345 & 2.782 & 2.243 & 2.601 \\
    2014 & 2.433 & 2.887 & 2.487 & 2.809 \\
    2015 & 2.391 & 2.897 & 2.598 & 2.976 \\
    2016 & 2.748 & 3.360 & 2.366 & 2.702 \\
    2017 & 3.314 & 4.055 & 2.344 & 2.695 \\
    2018 & 3.835 & 4.648 & 3.094 & 3.824 \\
    2019 & 3.430 & 4.221 & 3.008 & 3.865 \\
    2020 & 2.907 & 3.931 & 4.970 & 6.973 \\
    2021 & 3.330 & 4.314 & 5.540 & 7.143 \\
    Avg. & 2.430 & 2.957 & 2.670 & 3.184 \\
}




%------------------------------------------
% 表格开始
\begin{center}

\SetTblrOuter[tblr]{
    expand = \tapa
}

\begin{table}[H]
    \centering
    \caption{Site Visits of Sell-Side Analysts and Mutual Fund Managers}
    
    \SetTblrInner[tblr]{
        width = 1.0\linewidth,
        cells = {c,m,font=\tiny},     % 
        colspec = {X[l,7cm]X[l,2cm]},
        stretch = 0.6,      % 
        rowsep = 0.6pt,     % 
        cell{1}{1} = {c=2, r=1}{l},    % 
        hline{2,3,Z} = {0.05em},   % 
        hline{7} = {0.03em},  
        row{1} = {ht=0.5cm,font=\small},
        hspan = minimal,   % 
    }
    \begin{tblr}{}
        \tapa
    \end{tblr}
    
    % \vspace*{-0.6cm} 

%---------------------------------------------------------


    \SetTblrOuter[tblr]{
        expand = \tapb
    }
    \SetTblrInner[tblr]{
        width = 1.0\linewidth,
        cells = {c,m,font=\tiny},     % 
        colspec = {X[c,0.5cm]X[c,1.7cm]X[c,1.9cm]X[c,1.3cm]X[c,1.3cm]X[c,1.3cm]},
        % 行距
        stretch = 0.6,      % 
        rowsep = 0.6pt,     % 
        cell{1}{1} = {c=6, r=1}{l},    % 
        hline{2,3,Z} = {0.05em},   % 
        hline{4,Y,X} = {0.03em},   % 
        row{1} = {ht=0.5cm,font=\small},
        hspan = minimal,   % 
    }
    \begin{tblr}{}
        \tapb
    \end{tblr}


%---------------------------------------------------------




    \SetTblrOuter[tblr]{
        expand = \tapc
    }

    \SetTblrInner[tblr]{
        width = 1.0\linewidth,
        cells = {c,m,font=\tiny},     % 
        colspec = {X[c,0.5cm]X[c,1.3cm]X[c,1.3cm]X[c,1cm]X[c,1.3cm]X[c,1.3cm]X[c,1cm]},
        stretch = 0.6,      % 
        rowsep = 0.6pt,     % 
        cell{1}{1} = {c=7, r=1}{l},    % 
        hline{2,3,Z} = {0.05em},   % 
        hline{4,Y} = {0.03em},   % 
        row{1} = {ht=0.5cm,font=\small},
        hspan = minimal,   % 
    }
    \begin{tblr}{}
        \tapc
    \end{tblr}




    \SetTblrOuter[tblr]{
        expand = \tapd
    }
    
    \SetTblrInner[tblr]{
        width = 1.0\linewidth,
        cells = {c,m,font=\tiny},     % 
        colspec = {X[c,0.5cm]X[c,1.8cm]X[c,1.8cm]X[c,2.3cm]X[c,2.3cm]},
        stretch = 0.6,      % 
        rowsep = 0.6pt,     % 
        cell{1}{1} = {c=5, r=1}{l},    % 
        hline{2,3,Z} = {0.05em},   % 
        hline{4,Y} = {0.03em},   % 
        row{1} = {ht=0.5cm,font=\small},
        hspan = minimal,   % 
    }
    \begin{tblr}{}
        \tapd
    \end{tblr}

    
\end{table}   
\end{center}

\end{document}
%---------------------------------------------------------



该长表格由五个不同列数的panel构成。如何用latex输出该表格,且在下一页的开头重复所属panel的表头?尽量用tabularray或longtblr。

查看更多

关注者
0
被浏览
269
Sagittarius Rover
Sagittarius Rover 2024-10-23
我要成为TikZ糕手/(ㄒoㄒ)/~~

请提供你的LaTeX代码,而不只是一个word截图,论坛的作用是帮助你修改你的代码,而不是像接单一样替你实现你的排版效果。

请展示你使用tabularray宏包进行的尝试以及效果(体现你的付出和工作量),并提供规范的MWE

image.png

1 个回答

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览