如何删除使用 \longtable 的表格标题中的冒号并在标题之间添加一些空格?

如何删除使用 \longtable 的表格标题中的冒号并在标题之间添加一些空格?

我正在使用 UTM 的论文模板撰写论文。我该如何:

  1. 删除冒号
  2. 添加一些间距

在表格的标题中?我的工作代码如下:

\makeatletter
\let\my@xfloat\@xfloat
\makeatother

\documentclass[oneside,12pt,a4paper]{book}
%\documentclass[12pt,a4paper]{book}
\usepackage{UTMThesis,enumerate,amsfonts,longtable,qtree,etoolbox,array,rotating,pgf,tikz,tikz-cd,algorithm,csquotes,hyperref}

%\usepackage{hyperref}

\makeatletter
\def\@xfloat#1[#2]{
    \my@xfloat#1[#2]%
    \def\baselinestretch{1}%
    \@normalsize \normalsize
}
\makeatother

\makeatletter
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname\qquad}
\makeatother

\allowdisplaybreaks
\usetikzlibrary{arrows, matrix, positioning, shapes, shapes.geometric, calc, intersections, decorations.pathreplacing}
\newcommand{\tikznode}[2]{\relax
    \ifmmode%
    \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
    \else
    \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
    \fi}
\let\openbox\relax
\let\iint\relax
\let\iiint\relax
\let\iiiint\relax
\let\idotsint\relax

\newcommand*{\qed}{\hfill\ensuremath{\square}}

%-------------------------------------------------------------
\usepackage{cite}                       % change  cite from [1,2,3] to [1-3] etc for number system
\makeatletter                           % change from
\renewcommand{\@biblabel}[1]{#1.}     % [1] to 1. etc 
\makeatother                            % in list of references
%-----------------------------------------------------------
\setlength{\voffset}{-2.1cm}
\setlength{\hoffset}{-.4cm}  
%--------------------------------------------------------
\font\fiverm=cmr5 
%\input{Pictex.tex} % using pictex
%---------------------------------------------------------
%\pagestyle{plain}
%-------------------------------------------------------
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{}
\lfoot{}  
\cfoot{\vspace{-.35cm}\thepage}  % 
\rfoot{} 
\renewcommand{\headrulewidth}{0pt}
%-------------------------------------------------------
\begin{document}
%   \frontmatter
%   \input{frontmatters/FrontTitle}
%   \input{frontmatters/Validation.tex}
%   \input{frontmatters/SupervisorDeclaration.tex}
%   \input{frontmatters/Title.tex}
%   \input{frontmatters/Declaration.tex}
%   \input{frontmatters/Dedication.tex}
%   \input{frontmatters/Acknowledgement.tex}
%   \input{frontmatters/Abstract.tex}
%   \input{frontmatters/Abstrak.tex}
%   \input{frontmatters/TableofContents(Final).tex}  
%   \input{frontmatters/ListofTables(Final).tex} 
%   \input{frontmatters/ListofFigures(Final).tex}  
%   \input{frontmatters/ListofAbbreviations.tex}
%   \input{frontmatters/ListofSymbols.tex}
%   \input{frontmatters/ListofAppendix.tex}
    \mainmatter
    \chapter{Introduction}          %Chapter 1
    \setlength{\arrayrulewidth}{0.3mm}
    \setlength{\tabcolsep}{18pt}
    \renewcommand{\arraystretch}{1.3}
    \begin{longtable}{cccc}
        \caption{APD at the sensor on $MC_{t=1}$}
        \label{table:APD-at-t=1}\\
        \hline
        \textbf{Sensor }    &   \textbf{X}  &   \textbf{Y}  &   \textbf{APD} \\
        \hline
        \endfirsthead
        \multicolumn{4}{c}%
        {\tablename\ \thetable\ -- \textit{Continued from the previous page}} \\
        \hline
        \textbf{Sensor }    &   \textbf{X}  &   \textbf{Y}  &   \textbf{APD} \\
        \hline
        \endhead
        \hline \multicolumn{4}{r}{\textit{Continued on next page}} \\
        \endfoot
        \hline
        \endlastfoot
        $F_{pz}$    & $7.68$    & $0$       & $0$           \\ 
        $F_{p1}$    & $7.3041$  & $2.3733$  & $52.02898438$ \\ 
        $F_{p2}$    & $7.3041$  & $-2.3733$ & $6.779648438$ \\
        $F_{3}$     & $3.3691$  & $3.3691$  & $19.26382813$ \\ 
        $F_{4}$     & $3.3691$  & $-3.3691$ & $9.716523438$ \\ 
        $C_{3}$     & $0$       & $3.1812$  & $49.30257813$ \\
        $C_{4}$     & $0$       & $-3.1812$ & $16.01148438$ \\ 
        $P_3$       & $-3.3691$ & $3.3691$  & $37.73242188$ \\ 
        $P_4$       & $-3.3691$ & $-3.3691$ & $6.303164063$ \\
        $O_1$       & $-7.3041$ & $2.3733$  & $3.56859375$  \\ 
        $O_2$       & $-7.3041$ & $-2.3733$ & $12.700625$   \\ 
        $F_7$       & $4.5142$  & $6.2133$  & $15.66375$    \\
        $F_8$       & $4.5142$  & $-6.2133$ & $2.464921875$ \\ 
        $T_3$       & $0$       & $7.68$    & $15.07421875$ \\ 
        $T_4$       & $0$       & $-7.68$   & $15.63382813$ \\
        $T_5$       & $-4.5142$ & $6.2133$  & $4.565429687$ \\ 
        $T_6$       & $-4.5142$ & $-6.2133$ & $5.765625$    \\ 
        $F_z$       & $3.1812$  & $0$       & $12.84117188$ \\
        $C_z$       & $0$       & $0$       & $8.29734375$  \\
        $P_z$       & $-3.1812$ & $0$       & $4.4128125$   \\
        $O_z$       & $-7.68$   & $0$       & $0$   
    \end{longtable}
%   \input{chapters/chap2.tex}          %Chapter 2
%   \input{DummyChapter.tex}
%   \input{chapters/chap3.tex}          %Chapter 3
%   \input{DummyChapter.tex}
%   \input{chapters/chap4.tex}          %Chapter 4
%   \input{DummyChapter.tex}
%   \input{chapters/chap5.tex}          %Chapter 5
%   \input{DummyChapter.tex}
%   \input{chapters/chap6.tex}      %Chapter 6
%   \input{ThesisRefUTMn(Final).tex}%
%   \input{DummyChapter.tex}
%   \input{backmatter/ListofPublications}
%   \input{DummyChapter.tex}
%   \input{appendices/AppendixA.tex}
%   \input{DummyChapter.tex}
%   \pagebreak
%   \input{appendices/AppendixB.tex}
%   \input{DummyChapter.tex}
%   \input{appendices/AppendixC.tex}
%   \backmatter

\end{document}

产生:

在此处输入图片描述

我想要的标题是这样的:

在此处输入图片描述

我该如何解决这个问题?

UTM.sty如下:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The package UTMthesis.sty will produce the output    %
% of a thesis according to UTM Thesis Manual,          %     
% School of Graduate Studies, 2007.                    %
% Yusof Yaacob, Department of Mathematical Sciences,             %
% Faculty of Science,  Universiti Teknologi Malaysia   %
% 81310 Johor Bahru, Malaysia                          %
% e-mail: [email protected]                               %
% 24 December 2009                                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LaTeX cod for chapter header
\makeatletter
\def\@makechapterhead#1{
  %\vspace*{20\p@}   %  \vspace*{15\p@}
  {\parindent \z@ 
      \centering  
    \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
      \normalsize 
           \bfseries \@chapapp\space \thechapter 
       \par\nobreak
              \vskip 1.4\baselineskip 
      \fi
    \fi
    \interlinepenalty\@M
    \normalsize     
         \bfseries #1\par\nobreak 
       \vskip 1.4\baselineskip %
  }}
\def\@schapter#1{\if@twocolumn
                   \@topnewpage[\@makeschapterhead{#1}]%
                 \else
                   \@makeschapterhead{#1}
                   \@afterheading
                 \fi}
\def\@makeschapterhead#1{
  %\vspace*{20\p@} % \vspace*{20\p@} %
  {\parindent \z@  
    \centering  
    \normalfont 
    \interlinepenalty\@M
    \normalsize 
    \bfseries  #1\par\nobreak
         \vskip 1.4\baselineskip  
  }}
\makeatother
\renewcommand{\chaptername}{CHAPTER}
%------------------------------------------------------------
% Commands for layout
   %\setlength{\topmargin}{-1.2cm}
   %\setlength{\oddsidemargin}{1.7cm}   %\setlength{\oddsidemargin}{1.46cm} 
\setlength{\textwidth}{14.5cm}
   \setlength{\textheight}{24.5cm} %  \setlength{\textheight}{24.5cm}
   %\setlength{\headheight}{2mm}
    %\setlength{\headsep}{10.175mm}
%-------------------------------------------------------------
% Command for 1.5 spacing
   %\renewcommand{\baselinestretch}{1.5}
\usepackage{doublespace}
\setstretch{1.5}
%-------------------------------------------------------------
% Command for  indentation
   \setlength\parindent{.5in}
   \usepackage{indentfirst} %1st line indented after section...
%-------------------------------------------------------------
% Command for space between paragraph
  \makeatletter
    %\setlength{\parskip}{1.5\baselineskip \@plus 3ex
                %  \@minus 2.0ex}
    \setlength{\parskip}{2\baselineskip \@plus .01ex
                  \@minus .01ex}
   \makeatother
%-------------------------------------------------------------
% Commands for no hyphenation and right justified
    \hyphenpenalty=10000 \sloppy
    \raggedbottom
%-------------------------------------------------------------
% Command to get rid of default running head
   \pagestyle{myheadings}
%-------------------------------------------------------------
% Command for  page number 
%  \makeatletter
%    \renewcommand{\ps@plain}{%
%    \renewcommand{\@oddhead}{\hfill\textrm{\thepage}}
%    \renewcommand{\@evenhead}{\@oddhead}
%    \renewcommand{\@evenfoot}{}
%    \renewcommand{\@oddfoot}{}  }
%   \makeatother
%-----------------------------------------------------------------

 %For section font
 % \usepackage{sectsty} 
  %  \chapterfont{\centering\normalsize\uppercase}
  %  \sectionfont{\normalsize\uppercase}
   % \subsectionfont{\normalsize}
   % \subsubsectionfont{\itshape\normalsize}
%---------------------------------------------------------
%--------------------------------------------------------------
% Commands for REFERENCES name
\renewcommand{\bibname}{REFERENCES}
%--------------------------------------------------------------
% Commands to change vertical space in section and subsection
\makeatletter
\renewcommand{\section}{\@startsection
  {section}%      % the name
  {1}             % the level
  {0cm}           % the indent
  {1.0cm}         % the beforeskip
  {0.01cm}    %{0.5cm}    % the afterskip
  {\normalfont\normalsize\bfseries} } % the style
\renewcommand{\subsection}{\@startsection
  {subsection}%   % the name
  {2}             % the leve2
  {0cm}           % the indent
  {1.0cm}         % the beforeskip
  {0.01cm} %{0.5cm}        % the afterskip
  {\normalfont\normalsize\bfseries} } % the style
\makeatother
%--------------------------------------------------------------
% Commands to change horizontal space in section and subsection
% for times romans
%   \renewcommand{\thesection} % space between sect. etc.
%     {\thechapter.\arabic{section}\hspace{.12in}}
%    \renewcommand{\thesubsection} 
%       {\thesection\hspace{-.3cm}.\arabic{subsection} \hspace{-.135cm}} 

    \renewcommand{\thesection}{\thechapter.\arabic{section}}
    \renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
%--------------------------------------------------------------
% Commands for  TocLoFT
  \usepackage{tocloft}
    %\cftsetrmarg{2.75cm} %    
     \cftsetrmarg{1.5cm} %  
       \cftsetpnumwidth{1.25cm} 
       %\cftsetpnumwidth{1.25cm}
    \renewcommand{\cftdot}{} % get rid of dots
%Table of Contents
\renewcommand{\contentsname}{}        % off tocname
\setlength{\cftchapindent}{.8cm}      % chapter indent
\setlength{\cftsecindent}{2.3cm}      % section indent
\setlength{\cftsubsecindent}{3.25cm}  % subsection indent
\setlength{\cftchapnumwidth}{1.45cm}  % chp number width
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  \renewcommand{\cftchapafterpnum}{\rule{1.75ex}{0ex}}
%   \renewcommand{\cftsecafterpnum}{\rule{1.75ex}{0ex}}
%   \renewcommand{\cftsubsecafterpnum}{\rule{1.75ex}{0ex}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \renewcommand{\cftchapafterpnum}{\rule{0.75ex}{0ex}}
   \renewcommand{\cftsecafterpnum}{\rule{0.75ex}{0ex}}
   \renewcommand{\cftsubsecafterpnum}{\rule{0.75ex}{0ex}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   \renewcommand{\cftchappagefont}{\normalfont}
%-------------------------------------------------------------  
%List of Table
\setlength{\cfttabnumwidth}{2.5cm}  %\setlength{\cfttabnumwidth}{2.5cm}  
\renewcommand{\listtablename}{} % off lotname
%\setlength{\cfttabindent}{-.015cm}      % table indent %%%%%%%%%%%%%%%%%%
\setlength{\cfttabindent}{-.1cm}      % table indent %%%%%%%%%%%%%%%%%%
             \renewcommand{\cfttabafterpnum}{\rule{2ex}{0ex}}
\cftsetrmarg{3cm}
%------------------------------------------------------------
 %List of Figure
\setlength{\cftfignumwidth}{2.5cm}
\renewcommand{\listfigurename}{} % off lofname
\setlength{\cftfigindent}{-.1cm}      % figure indent %%%%%%%%%%%%%%%%%%
   \renewcommand{\cftfigafterpnum}{\rule{2ex}{0ex}}
%-------------------------------------------------------------
%-------------------------------------------------------------
% Command for bold caption
\makeatletter
  \long\def\@makecaption#1#2{\vskip 10\p@   % caption parameter
       \setbox\@tempboxa\hbox{{#1\,\,\,\,\,} #2} %%%%%
       \ifdim \wd\@tempboxa >\hsize         % caption parameter
           {#1\,\,\,\,\,}  #2\par  % caption parameter
       \else                                   % caption parameter
           \hbox to\hsize{\hfil\box\@tempboxa\hfil}  % caption parameter
   \fi}                                            % caption parameter
\makeatother   
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}
%--------------------------------------------------------------
\usepackage{paralist} %refine list item
%--------------------------------------------------------------
\usepackage{latexsym,amsmath,amssymb} % math symbols
%--------------------------------------------------------------
\usepackage{graphicx} % .eps graphic
%--------------------------------------------------------------
\usepackage{lscape} % for landscape
%-------------------------------------------------------------- 
\usepackage{times}
%--------------------------------------------------------------
% Theorem-Like-Environment
\usepackage{theorem}
{\theorembodyfont{\upshape}
\newtheorem{lemma}{Lemma}[chapter]
\newtheorem{theorem}{\rule{0ex}{5ex}Theorem}[chapter]
\newtheorem{corollary}{Corollary}[chapter]
\newtheorem{proposition}{Proposition}[chapter]
\newtheorem{definition}{\rule{0ex}{5ex}Definition}[chapter]
\newtheorem{example}{Example}[chapter]
\newtheorem{remark}{Remark} }
%--------------------------------------------------------
\newenvironment{proof}{\begin{paragraph}
          {Proof}\vspace{-1cm}}{\end{paragraph}}
\newenvironment{solution}{\begin{paragraph}
          {Solution}\vspace{-1cm}}{\end{paragraph}}
%-----------------------------------------------------------

答案1

像这样?

在此处输入图片描述

使用以下软件包caption

\documentclass[oneside,12pt,a4paper]{book}
\usepackage{array, longtable}

\usepackage{siunitx}            % new
\usepackage[skip=1ex,           % new
            labelsep=quad,      % new
            ]{caption}          % new
\usepackage{lipsum}         % for dummy text filler

\begin{document}
    \chapter{Introduction}      % Chapter 1
\lipsum[1][1-4]                 % dummy text  
\setlength{\arrayrulewidth}{0.3mm}
\setlength{\tabcolsep}{18pt}
\renewcommand{\arraystretch}{1.3}
    \begin{longtable}{>{$}c<{$} 
                     *{2}{S[table-format=-1.4]}
                          S[table-format= 2.9]}
    \caption{APD at the sensor on $MC_{t=1}$}
        \label{table:APD-at-t=1}\\
        \hline
        \textbf{Sensor} & {\textbf{X}} & {\textbf{Y}} & {\textbf{APD}} \\
        \hline
    \endfirsthead
    \caption[]{ -- \textit{Continued from the previous page}} \\
        \hline
        \textbf{Sensor} & {\textbf{X}} & {\textbf{Y}} & {\textbf{APD}} \\
        \hline
    \endhead
        \hline 
        \multicolumn{4}{r}{\textit{Continued on the next page}} \\
    \endfoot
        \hline
    \endlastfoot
        F_{pz}    & 7.68    & 0       & 0           \\
        F_{p1}    & 7.3041  & 2.3733  & 52.02898438 \\
        F_{p2}    & 7.3041  & -2.3733 & 6.779648438 \\
        F_{3}     & 3.3691  & 3.3691  & 19.26382813 \\
        F_{4}     & 3.3691  & -3.3691 & 9.716523438 \\
        C_{3}     & 0       & 3.1812  & 49.30257813 \\
        C_{4}     & 0       & -3.1812 & 16.01148438 \\
        P_3       & -3.3691 & 3.3691  & 37.73242188 \\
        P_4       & -3.3691 & -3.3691 & 6.303164063 \\
        O_1       & -7.3041 & 2.3733  & 3.56859375  \\
        O_2       & -7.3041 & -2.3733 & 12.700625   \\
        F_7       & 4.5142  & 6.2133  & 15.66375    \\
        F_8       & 4.5142  & -6.2133 & 2.464921875 \\
        T_3       & 0       & 7.68    & 15.07421875 \\
        T_4       & 0       & -7.68   & 15.63382813 \\
        T_5       & -4.5142 & 6.2133  & 4.565429687 \\
        T_6       & -4.5142 & -6.2133 & 5.765625    \\
        F_z       & 3.1812  & 0       & 12.84117188 \\
        C_z       & 0       & 0       & 8.29734375  \\
        P_z       & -3.1812 & 0       & 4.4128125   \\
        O_z       & -7.68   & 0       & 0
    \end{longtable}
\end{document}

题外话:对于数字列,我建议使用包S中定义的列类型。使用它,您可以考虑使用列选项siunitx将最后一列中的数字四舍五入为例如只有 6 位小数:S

    \begin{longtable}{>{$}c<{$} 
                     *{2}{S[table-format=-1.4]}
                          S[table-format= 2.9,
                            round-mode=places,
                            round-precision=6]}

如果您不喜欢这种数字格式(按小数点对齐),您可以将表格恢复为您的c列。

相关内容