4

First I want to give a minimal working sample:

\documentclass[oneside]{ctexbook}
\usepackage{lipsum}
%%%实现表格中数字按小数点对齐%%%%%%%%%%%%%%
\usepackage[mode=text]{siunitx}
%mode:math(正文数字old),text(正文数字非old),主要针对表格
%%%解决表格标题与下方表格过近%%%%%%%%%%%%%%
\usepackage{caption}
%%%跨页表格%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{longtable}
%%%表格标题与前后文字间距%%%%%%%%%%%%%%%%%
\setlength{\abovecaptionskip}{2pt} 
\setlength{\belowcaptionskip}{2pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\chapter{表格}
\section{One Example of Table}
\lipsum[1]

%%%表格与页面左右边缘之间的矩离均为0%%%%%%%%
\setlength{\LTleft}{0pt} \setlength{\LTright}{0pt} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{longtable}{l|c S[table-format=2.1]|c S[table-format=2.1]|@{\extracolsep{\fill}} S[table-format=2.0]|S[table-format=2.0]|S[table-format=2.0]}%@{\extracolsep{\fill}}设置使得后面所有列间距可以伸展到预定义的表格宽度。
    \hline\hline
    \caption{标准字体命令与字号的对应值} %\label{}加在\caption{}的括号中
    \\\hline\hline
    x&\multicolumn{2}{c}{\texttt{zihao=5}}\vline&\multicolumn{2}{c}{\texttt{zihao=-4}}\vline &\texttt{10pt}&\texttt{11pt}&\texttt{12pt}\\\cline{2-8}     
    字体命令&字号&bp值&字号&bp值&pt值&pt值&pt值\\\hline
    \endfirsthead%第一页表头
    \\\hline
    字体命令&字号&bp值&字号&bp值&pt值&pt值&pt值\\\hline
    \endhead%续页表头
    \verb|\tiny|&七号&5.5&小六&6.5&5&6&6  \\\hline
    \verb|\scriptsize|&小六&6.5&六号&7.5&7&8&8  \\\hline
    \verb|\footnotesize|&六号&7.5&小五&9&8&9&10  \\\hline
    \verb|\small|&小五&9&五号&10.5&9&10&11  \\\hline
    \verb|\normalsize|&五号&10.5&小四&12&10&11&12  \\\hline
    \verb|\large|&小四&12&小三&15&12&12&14  \\\hline
    \verb|\Large|&小三&15&小二&18&14&14&17  \\\hline
    \verb|\LARGE|&小二&18&二号&22&17&17&20  \\\hline
    \verb|\huge|&二号&22&小一&24&20&20&25  \\\hline
    \verb|\Huge|&一号&26&一号&26&25&25&25  \\\hline
\end{longtable}
\end{document}

I compiled it with XeLaTeX and got the following PDF for page 2

enter image description here

My QUESTION is how to get rid off the extra empty row at the head?

Any help is welcome!

0

1 Answer 1

7

Between \endfirsthead and \endhead, you start with a line break \\. This means: Whenever a longtable breaks to a new page, the first line on this new page will be empty. So just remove this first \\.

\documentclass[oneside]{ctexbook}
\usepackage{lipsum}
%%%实现表格中数字按小数点对齐%%%%%%%%%%%%%%
\usepackage[mode=text]{siunitx}
%mode:math(正文数字old),text(正文数字非old),主要针对表格
%%%解决表格标题与下方表格过近%%%%%%%%%%%%%%
\usepackage{caption}
%%%跨页表格%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{longtable}
%%%表格标题与前后文字间距%%%%%%%%%%%%%%%%%
\setlength{\abovecaptionskip}{2pt} 
\setlength{\belowcaptionskip}{2pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\chapter{表格}
\section{One Example of Table}
\lipsum[1]

%%%表格与页面左右边缘之间的矩离均为0%%%%%%%%
\setlength{\LTleft}{0pt} \setlength{\LTright}{0pt} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{longtable}{l|c S[table-format=2.1]|c S[table-format=2.1]|@{\extracolsep{\fill}} S[table-format=2.0]|S[table-format=2.0]|S[table-format=2.0]}%@{\extracolsep{\fill}}设置使得后面所有列间距可以伸展到预定义的表格宽度。
    \hline\hline
    \caption{标准字体命令与字号的对应值} %\label{}加在\caption{}的括号中
    \\\hline\hline
    x&\multicolumn{2}{c}{\texttt{zihao=5}}\vline&\multicolumn{2}{c}{\texttt{zihao=-4}}\vline &\texttt{10pt}&\texttt{11pt}&\texttt{12pt}\\\cline{2-8}     
    字体命令&字号&bp值&字号&bp值&pt值&pt值&pt值\\\hline
    \endfirsthead%第一页表头
    \hline
    字体命令&字号&bp值&字号&bp值&pt值&pt值&pt值\\\hline
    \endhead%续页表头
    \verb|\tiny|&七号&5.5&小六&6.5&5&6&6  \\\hline
    \verb|\scriptsize|&小六&6.5&六号&7.5&7&8&8  \\\hline
    \verb|\footnotesize|&六号&7.5&小五&9&8&9&10  \\\hline
    \verb|\small|&小五&9&五号&10.5&9&10&11  \\\hline
    \verb|\normalsize|&五号&10.5&小四&12&10&11&12  \\\hline
    \verb|\large|&小四&12&小三&15&12&12&14  \\\hline
    \verb|\Large|&小三&15&小二&18&14&14&17  \\\hline
    \verb|\LARGE|&小二&18&二号&22&17&17&20  \\\hline
    \verb|\huge|&二号&22&小一&24&20&20&25  \\\hline
    \verb|\Huge|&一号&26&一号&26&25&25&25  \\\hline
\end{longtable}
\end{document}

enter image description here

1
  • What a joke! -^-!
    – M. Logic
    Commented Jan 18, 2018 at 16:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .