如何將長桌做成圓角?

如何將長桌做成圓角?

我嘗試這個,但它不起作用

\begin{table}
\caption{A table with rounded corners}
\centering
\begin{tikzpicture}
\node (table) [inner sep=0pt] {
  \begin{longtable}{l|l}
    \multicolumn{2}{c}{Team sheet} \\
    \hline
    GK & Paul Robinson \\
    LB & Lucus Radebe \\
    DC & Michael Duberry \\
    DC & Dominic Matteo \\
    RB & Didier Domi \\
    MC & David Batty \\
    MC & Eirik Bakke \\
    MC & Jody Morris \\
    FW & Jamie McMaster \\
    ST & Alan Smith \\
    ST & Mark Viduka \\
  \end{longtable}
};
\draw [rounded corners=.5em] (table.north west) rectangle (table.south east);
\end{tikzpicture}
\label{tab1}
\end{table}

答案1

這是您想要獲得的嗎:

在此輸入影像描述

\documentclass[11pt, border=1mm,
               preview]{standalone}
\usepackage[many]{tcolorbox}

    \begin{document}
\begin{table}
\caption{A table with rounded corners}
    \centering
\tcbox[left=0mm,right=0mm,top=0mm,bottom=0mm,boxsep=0mm,
       boxrule=0.4pt, colback=white]% set to your wish
    {\begin{tabular}{l|l}
\multicolumn{2}{c}{Team sheet} \\
    \hline% if you liked
GK & Paul Robinson \\
LB & Lucus Radebe \\
DC & Michael Duberry \\
DC & Dominic Matteo \\
RB & Didier Domi \\
MC & David Batty \\
MC & Eirik Bakke \\
MC & Jody Morris \\
FW & Jamie McMaster \\
ST & Alan Smith \\
ST & Mark Viduka 
    \end{tabular}}
    \label{tab1}
\end{table}        
    \end{document}

編輯/升級: 為了使用 longtable ...您需要tcolorbox寬度選項breakable和一些手動調整來調整框寬度或使用其他一些表格環境,例如xtab,它模仿tabularx給定框寬度的調節。

\documentclass{article}
\usepackage[many]{tcolorbox}
    \usepackage{longtable}
    \usepackage{lipsum}

    \begin{document}
\lipsum[1-4]

    \centering
\tcbset{enhanced jigsaw,% if you like to have rounded corners 
                        % on each end/beginning of table, 
                        % than remove this option
        breakable,
        left=0mm,right=0mm,top=0mm,bottom=0mm,boxsep=0mm,
        boxrule=0.4pt, colback=white}% set to your wish

\begin{tcolorbox}[width=4.05cm]% width determined "experimentally"
    \begin{longtable}{l|l}
\multicolumn{2}{c}{Team sheet} \\
    \hline% if you liked
GK & Paul Robinson \\
LB & Lucus Radebe \\
DC & Michael Duberry \\
DC & Dominic Matteo \\
RB & Didier Domi \\
MC & David Batty \\
MC & Eirik Bakke \\
MC & Jody Morris \\
FW & Jamie McMaster \\
ST & Alan Smith \\
ST & Mark Viduka
    \end{longtable}
\end{tcolorbox}
    \end{document}

這段程式碼給出:

在此輸入影像描述

我沒有考慮字幕問題。它可以在longtable或 之內完成tcolorbox。對於後者,請參閱tcolorbox 手冊,“庫”一章“breakable!”,第304 頁。環境,這可以輕鬆解決

相關內容