我怎样才能使 \longtable 的行为与 \table 类似?

我怎样才能使 \longtable 的行为与 \table 类似?

我想为 Springer 期刊准备这个,表格的结构是预先确定的。由于我的表格很大,我不得不使用longtable。但是字体大小、文本方向和标题的结构(消除“:”和粗体“表格 X”)不同。我怎样才能使longtable插入像定义的简单table结构一样?

这是我使用的代码(压缩文件):

%%%%%%%%%%%%%%%%%%%%%%% file template.tex %%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is a general template file for the LaTeX package SVJour3
% for Springer journals.          Springer Heidelberg 2010/09/16
%
% Copy it to a new file with a new name and use it as the basis
% for your article. Delete % signs as needed.
%
% This template includes a few options for different layouts and
% content for various journals. Please consult a previous issue of
% your journal as needed.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% First comes an example EPS file -- just ignore it and
% proceed on the \documentclass line
% your LaTeX will extract the file if required
\begin{filecontents*}{example.eps}
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 19 19 221 221
%%CreationDate: Mon Sep 29 1997
%%Creator: programmed by hand (JK)
%%EndComments
gsave
newpath
  20 20 moveto
  20 220 lineto
  220 220 lineto
  220 20 lineto
closepath
2 setlinewidth
gsave
  .4 setgray fill
grestore
stroke
grestore
\end{filecontents*}
%
\RequirePackage{fix-cm}
%
%\documentclass{svjour3}                     % onecolumn (standard format)
%\documentclass[smallcondensed]{svjour3}     % onecolumn (ditto)
\documentclass[smallextended]{svjour3}       % onecolumn (second format)
%\documentclass[twocolumn]{svjour3}          % twocolumn
%
\smartqed  % flush right qed marks, e.g. at end of proof
%
\usepackage{graphicx}
%
% \usepackage{mathptmx}      % use Times fonts if available on your TeX system
%
% insert here the call for the packages your document requires
%\usepackage{latexsym}
% etc.
%
% please place your own definitions here and don't use \def but
% \newcommand{}{}
%
% Insert the name of "your journal" with
% \journalname{myjournal}
%
\usepackage{amsmath}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{multirow}
\usepackage{longtable}


\begin{document}

\title{Insert your title here%\thanks{Grants or other notes
%about the article that should go on the front page should be
%placed here. General acknowledgments should be placed at the end of the article.}
}
\subtitle{Do you have a subtitle?\\ If so, write it here}

%\titlerunning{Short form of title}        % if too long for running head

\author{First Author         \and
        Second Author %etc.
}

%\authorrunning{Short form of author list} % if too long for running head

\institute{F. Author \at
              first address \\
              Tel.: +123-45-678910\\
              Fax: +123-45-678910\\
              \email{[email protected]}           %  \\
%             \emph{Present address:} of F. Author  %  if needed
           \and
           S. Author \at
              second address
}

\date{Received: date / Accepted: date}
% The correct dates will be entered by the editor


\maketitle

\begin{abstract}
Insert your abstract here. Include keywords, PACS and mathematical
subject classification numbers as needed.
\keywords{First keyword \and Second keyword \and More}
% \PACS{PACS code1 \and PACS code2 \and more}
% \subclass{MSC code1 \and MSC code2 \and more}
\end{abstract}

\section{Introduction}
\label{intro}
Your text comes here. Separate text sections with
\section{Section title}
\label{sec:1}
Text with citations \cite{RefB} and \cite{RefJ}.
\subsection{Subsection title}
\label{sec:2}
as required. Don't forget to give each section
and subsection a unique label (see Sect.~\ref{sec:1}).
\paragraph{Paragraph headings} Use paragraph headings as needed.
\begin{equation}
a^2+b^2=c^2
\end{equation}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Here

\begin{table}
    \caption{With table}
    \label{tab:1}
    \begin{tabular}{llllllll}
        \hline\noalign{\smallskip}
        C1 & C2 & C3 & C4 & C5 & C6 & C7 & C8 \\
        \noalign{\smallskip}\hline\noalign{\smallskip}
        \multirow{5}{*}{First} & \multirow{5}{*}{1} & A & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        & & B & 0.00 & 0.00 & 0.00 & 0.0 & 0.00 \\
        & & C & 0.0 & 0.00 & 0.00 & 0.00 & 0.00 \\
        & & D & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        & & E & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        %...
        \noalign{\smallskip}\hline
    \end{tabular}
\end{table}

\begin{longtable}{llllllll}
    \caption{With longtable}
    \label{tab:1}\\
    \hline\noalign{\smallskip}
    C1 & C2 & C3 & C4 & C5 & C6 & C7 & C8 \\
    \noalign{\smallskip}\hline\noalign{\smallskip}
    \multirow{5}{*}{First} & \multirow{5}{*}{1} & A & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
    & & B & 0.00 & 0.00 & 0.00 & 0.0 & 0.00 \\
    & & C & 0.0 & 0.00 & 0.00 & 0.00 & 0.00 \\
    & & D & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
    & & E & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
    %...
    \noalign{\smallskip}\hline
\end{longtable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\begin{acknowledgements}
%If you'd like to thank anyone, place your comments here
%and remove the percent signs.
%\end{acknowledgements}


% Authors must disclose all relationships or interests that 
% could have direct or potential influence or impart bias on 
% the work: 
%
% \section*{Conflict of interest}
%
% The authors declare that they have no conflict of interest.


% BibTeX users please use one of
%\bibliographystyle{spbasic}      % basic style, author-year citations
%\bibliographystyle{spmpsci}      % mathematics and physical sciences
%\bibliographystyle{spphys}       % APS-like style for physics
%\bibliography{}   % name your BibTeX data base

% Non-BibTeX users please use
\begin{thebibliography}{}
%
% and use \bibitem to create references. Consult the Instructions
% for authors for reference list style.
%
\bibitem{RefJ}
% Format for Journal Reference
Author, Article title, Journal, Volume, page numbers (year)
% Format for books
\bibitem{RefB}
Author, Book title, page numbers. Publisher, place (year)
% etc
\end{thebibliography}

\end{document}
% end of file template.tex

新结果

答案1

longtable您可以根据具体情况重新定义用于标题的内部命令svjour3

我还定义了一个新的环境以适应longtableSpringer 的风格。

%%%%%%%%%%%%%%%%%%%%%%% file template.tex %%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is a general template file for the LaTeX package SVJour3
% for Springer journals.          Springer Heidelberg 2010/09/16
%
% Copy it to a new file with a new name and use it as the basis
% for your article. Delete % signs as needed.
%
% This template includes a few options for different layouts and
% content for various journals. Please consult a previous issue of
% your journal as needed.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\RequirePackage{fix-cm}
%
%\documentclass{svjour3}                     % onecolumn (standard format)
%\documentclass[smallcondensed]{svjour3}     % onecolumn (ditto)
\documentclass[smallextended]{svjour3}       % onecolumn (second format)
%\documentclass[twocolumn]{svjour3}          % twocolumn
%
\smartqed  % flush right qed marks, e.g. at end of proof
%
\usepackage{graphicx}
%
% \usepackage{mathptmx}      % use Times fonts if available on your TeX system
%
% insert here the call for the packages your document requires
%\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{booktabs}
% etc.
%
% please place your own definitions here and don't use \def but
% \newcommand{}{}
%
% Insert the name of "your journal" with
% \journalname{myjournal}
%

\newenvironment{svlongtable}[1]
 {\small\begin{longtable}[l]{#1}}
 {\end{longtable}}
\makeatletter
\renewcommand{\LT@makecaption}[3]{%
  \LT@mcol \LT@cols {@{}l@{}}{%
    \hbox to\z@ {%
      \parbox [t]\LTcapwidth {%
        \sbox \@tempboxa {#1{\textbf{#2}}\quad#3}%
        \ifdim \wd \@tempboxa >\hsize
          #1{\textbf{#2}}\quad#3
        \else
          \hbox to\hsize {%
            \box \@tempboxa \hfil
          }%
        \fi
        \endgraf
        \vskip\tabcapgap
      }%
      \hss
    }%
  }%
}
\makeatother

\begin{document}

\title{Insert your title here%\thanks{Grants or other notes
%about the article that should go on the front page should be
%placed here. General acknowledgments should be placed at the end of the article.}
}
\subtitle{Do you have a subtitle?\\ If so, write it here}

%\titlerunning{Short form of title}        % if too long for running head

\author{First Author         \and
        Second Author %etc.
}

%\authorrunning{Short form of author list} % if too long for running head

\institute{F. Author \at
              first address \\
              Tel.: +123-45-678910\\
              Fax: +123-45-678910\\
              \email{[email protected]}           %  \\
%             \emph{Present address:} of F. Author  %  if needed
           \and
           S. Author \at
              second address
}

\date{Received: date / Accepted: date}
% The correct dates will be entered by the editor


\maketitle

\begin{abstract}
Insert your abstract here. Include keywords, PACS and mathematical
subject classification numbers as needed.
\keywords{First keyword \and Second keyword \and More}
% \PACS{PACS code1 \and PACS code2 \and more}
% \subclass{MSC code1 \and MSC code2 \and more}
\end{abstract}

\section{Introduction}
\label{intro}
Your text comes here. Separate text sections with
\section{Section title}
\label{sec:1}
Text with citations \cite{RefB} and \cite{RefJ}.
\subsection{Subsection title}
\label{sec:2}
as required. Don't forget to give each section
and subsection a unique label (see Sect.~\ref{sec:1}).
\paragraph{Paragraph headings} Use paragraph headings as needed.
\begin{equation}
a^2+b^2=c^2
\end{equation}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Here

\begin{table}[htp]
    \caption{With table}
    \label{tab:1}
    \begin{tabular}{llllllll}
        \toprule
        C1 & C2 & C3 & C4 & C5 & C6 & C7 & C8 \\
        \midrule
        \multirow{5}{*}{First} & \multirow{5}{*}{1} & A & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        & & B & 0.00 & 0.00 & 0.00 & 0.0 & 0.00 \\
        & & C & 0.0 & 0.00 & 0.00 & 0.00 & 0.00 \\
        & & D & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        & & E & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        %...
        \bottomrule
    \end{tabular}
\end{table}

\begin{svlongtable}{llllllll}
    \caption{With longtable}
    \label{tab:2}\\
    \toprule
    C1 & C2 & C3 & C4 & C5 & C6 & C7 & C8 \\
    \midrule
    \endfirsthead
    \multirow{5}{*}{First} & \multirow{5}{*}{1} & A & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\*
    & & B & 0.00 & 0.00 & 0.00 & 0.0 & 0.00 \\*
    & & C & 0.0 & 0.00 & 0.00 & 0.00 & 0.00 \\*
    & & D & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\*
    & & E & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
    %...
    \bottomrule
\end{svlongtable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\begin{acknowledgements}
%If you'd like to thank anyone, place your comments here
%and remove the percent signs.
%\end{acknowledgements}


% Authors must disclose all relationships or interests that 
% could have direct or potential influence or impart bias on 
% the work: 
%
% \section*{Conflict of interest}
%
% The authors declare that they have no conflict of interest.


% BibTeX users please use one of
%\bibliographystyle{spbasic}      % basic style, author-year citations
%\bibliographystyle{spmpsci}      % mathematics and physical sciences
%\bibliographystyle{spphys}       % APS-like style for physics
%\bibliography{}   % name your BibTeX data base

% Non-BibTeX users please use
\begin{thebibliography}{}
%
% and use \bibitem to create references. Consult the Instructions
% for authors for reference list style.
%
\bibitem{RefJ}
% Format for Journal Reference
Author, Article title, Journal, Volume, page numbers (year)
% Format for books
\bibitem{RefB}
Author, Book title, page numbers. Publisher, place (year)
% etc
\end{thebibliography}

\end{document}
% end of file template.tex

请注意我是如何禁用出现不必要的分页符的可能性的。

在此处输入图片描述

答案2

像这样?

在此处输入图片描述

文档类svjour3默认设置\small仅定义table浮动内容的字体大小,没有定义标题标签的粗体字体,因此如果您(无论如何)想要使用它,则需要添加caption包并用它覆盖其默认设置。要使longtable标题左对齐,您需要添加singlelinecheck=falsecaption包选项。对于中较小的字体longtable,您需要将其包含在具有\small字体大小的组中。

除了上述 MWE 中的更改之外,下面还在包中定义了水平线booktabs

\RequirePackage{fix-cm}
\documentclass[smallextended]{svjour3}       % onecolumn (second format)
\usepackage{booktabs, longtable, multirow}
\usepackage[singlelinecheck=false,labelfont=bf]{caption}
\usepackage{lipsum}

\begin{document}
\lipsum[1]
\begin{table}[ht]
    \caption{With table}
    \label{tab:1}
    \begin{tabular}{llllllll}
    \toprule
C1 & C2 & C3 & C4 & C5 & C6 & C7 & C8 \\
    \midrule
\multirow{5}{*}{First}
    & \multirow{5}{*}{1}
        & A & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        &   & B & 0.00 & 0.00 & 0.00 & 0.0 & 0.00 \\
        &   & C & 0.0 & 0.00 & 0.00 & 0.00 & 0.00 \\
        &   & D & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        &   & E & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
    %...
    \bottomrule
    \end{tabular}
\end{table}

\begingroup
\small
\begin{longtable}[l]{llllllll}
    \caption{With longtable}
    \label{tab:1}\\
    \toprule
C1 & C2 & C3 & C4 & C5 & C6 & C7 & C8 \\
    \midrule
\multirow{5}{*}{First} 
    & \multirow{5}{*}{1} 
        & A & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        &   & B & 0.00 & 0.00 & 0.00 & 0.0 & 0.00 \\
        &   & C & 0.0 & 0.00 & 0.00 & 0.00 & 0.00 \\
        &   & D & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
        &   & E & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
    %...
    \bottomrule
\end{longtable}
\endgroup
\end{document}

相关内容