从桌子到长桌

从桌子到长桌

我曾尝试将此表转换为 longtable,但没有成功,希望您能提供帮助。longtable 包已加载。

\documentclass[a4paper,oneside,abstracton]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{threeparttable}
\usepackage{longtable}
\usepackage[a4paper,bottom=3.1cm]{geometry}
\usepackage{booktabs}

\begin{document}

\begin{table}[!htb]
\centering
\caption{Accepted positions.}
\label{Table:accepted}
\tiny
    \begin{threeparttable}
         \begin{tabular}{llllllll}
             \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
             Date (UT) & Object & Type\tnote{a} & J2000 RA & J2000 Dec & Magn & Location\tnote{b} & Ref \\
             \midrule
             2015 02 11.83985 & (279038) & xyz & RA & Dec & 20.3 V & 026 – Obscode & abc \\

            \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
        \end{tabular}
     \begin{tablenotes}
        \item [a] Note number 1
        \item [b] Note number 2
     \end{tablenotes}
     \end{threeparttable}
\end{table}

\end{document}

我尝试了以下方法:

\documentclass[a4paper,oneside,abstracton]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{threeparttable}
\usepackage{longtable}
\usepackage[a4paper,bottom=3.1cm]{geometry}
\usepackage{booktabs}


\begin{document}

\begin{center}
\begin{longtable}{llllllll}
\caption{Accepted positions.}
\label{Table:accepted}
    \tiny
    \begin{threeparttable}
    \begin{tabular}
            \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
            Date (UT) & Object & Type\tnote{a} & J2000 RA & J2000 Dec & Magn & Location\tnote{b} & Ref \\
            \midrule
            \endfirsthead

            {{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
            \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
            Date (UT) & Object & Type\tnote{a} & J2000 RA & J2000 Dec & Magn & Location\tnote{b} & Ref \\
            \midrule
            \endhead

            \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
            \multicolumn{8}{r}{{Continued on next page}} \\
            \endfoot

            \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
            \endlastfoot
            2015 02 11.83985 & (279038) & xyz & RA & Dec & 20.3 V & 026 – Obscode & abc \\

    \end{tabular}
    \begin{tablenotes}
        \item [a] Note number 1
        \item [b] Note number 2
    \end{tablenotes}
    \end{threeparttable}
\end{longtable}
\end{center}


\end{document}

它不起作用。解决方案是什么。没有 longtable(第一个语法)也可以正常工作。

答案1

为此,将threeparttablex的功能引入。它定义了和 的环境。后者必须在 ThreePartTable 环境的 之前声明。它可以使用命令插入到您想要的任何位置。可以参考表注释。请参阅包文档中的详细信息。threeparttablelongtableThreePartTableTableNotesbeginninglongtable\insertTableNotes

\documentclass[a4paper,oneside,abstracton]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{threeparttablex}
\usepackage{longtable}
\usepackage[a4paper,bottom=3.1cm]{geometry}
\usepackage{booktabs, caption}

\begin{document}

\begin{ThreePartTable}
  \small
  \begin{TableNotes}
    \item [a] Note number 1
    \item [b] Note number 2
  \end{TableNotes}
  \begin{longtable}{@{}llllllll@{}}
    \caption{Accepted positions.\label{Table:accepted}}\\
    \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
    Date (UT) & Object & Type\tnote{a} & J2000 RA & J2000 Dec & Magn & Location\tnote{b} & Ref \\
    \midrule
    \endfirsthead
    Date (UT) & Object & Type\tnote{a} & J2000 RA & J2000 Dec & Magn & Location\tnote{b} & Ref \\
    \midrule
    \endhead
    \multicolumn{8}{r}{\textit{continued}}\\
    \endfoot
    \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
    \insertTableNotes
    \endlastfoot

    2015 02 11.83985 & (279038) & xyz & RA & Dec & 20.3 V & 026 – Obscode & abc \\

  \end{longtable}
\end{ThreePartTable}

\end{document}

在此处输入图片描述

答案2

\documentclass[a4paper,oneside,abstracton]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{threeparttable}
\usepackage{longtable}
\usepackage[a4paper,bottom=3.1cm]{geometry}
\usepackage{booktabs}

\begin{document}

%\begin{table}[!htb]
%\centering
%\tiny
\small
%    \begin{threeparttable}
         \begin{longtable}{@{}llllllll@{}}
\caption{Accepted positions.\label{Table:accepted}}\\
             \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
             Date (UT) & Object & Type\tnote{a} & J2000 RA & J2000 Dec & Magn & Location\tnote{b} & Ref \\
             \midrule
\endfirsthead
             Date (UT) & Object & Type\tnote{a} & J2000 RA & J2000 Dec & Magn & Location\tnote{b} & Ref \\
             \midrule
\endhead
             2015 02 11.83985 & (279038) & xyz & RA & Dec & 20.3 V & 026 – Obscode & abc \\

            \cmidrule{1-8} \morecmidrules \cmidrule{1-8}
        \end{longtable}
     \begin{enumerate}
        \item [a] Note number 1
        \item [b] Note number 2
     \end{enumerate}
%     \end{threeparttable}
%\end{table}

\end{document}

相关内容