BITNP / BIThesis

📖 北京理工大学非官方 LaTeX 模板集合,包含本科、研究生毕业设计模板及更多。🎉 (更多文档请访问 wiki 和 release 中的手册)
https://bithesis.bitnp.net
LaTeX Project Public License v1.3c
689 stars 97 forks source link

feat: 适配`longtable`宏包 #513

Closed YDX-2147483647 closed 4 months ago

YDX-2147483647 commented 4 months ago

继续 #499 和 #504。

对比

旧(左)新(右)对比:

图片

新版

图片 图片

新版 + \BITSetup

\BITSetup{
  misc/floatSeparation = -1.5, % 仅测试,随意指定的
  misc/tabularRowSeparation = 1.25, % 本科表格行高
}

图片 图片

设置

测试用例

% !TeX program = xelatex
% !BIB program = biber

\documentclass[type=bachelor]{bithesis}
% \BITSetup{
%   misc/floatSeparation = -1.5,
%   misc/tabularRowSeparation = 1.25,
% }

\usepackage{tabularx}
\usepackage{longtable}

\usepackage{zhlipsum}

\begin{document}

\frontmatter
\mainmatter

\zhlipsum[1][name=zhufu]

\begin{table}[ht]
  \centering
  \caption{Tabular Lg} % 都含“Lg”两个伸长的字母,控制变量
  \begin{tabular}{*{5}{>{\centering\arraybackslash}p{5em}}}
    \toprule
    项目    & 产量    & 销量    & 产值   & 比重    \\ \midrule
    手机    & 1000  & 10000 & 500  & 50\%  \\
    计算机   & 5500  & 5000  & 220  & 22\%  \\
    笔记本电脑 & 1100  & 1000  & 280  & 28\%  \\ \midrule
    合计    & 17600 & 16000 & 1000 & 100\% \\ \bottomrule
  \end{tabular}
\end{table}

\zhlipsum[2-3][name=zhufu]

\begin{table}[ht]
  \centering
  \caption{Tabular* Lg}
  \begin{tabular*}{32em}{@{\extracolsep{\fill}}ccccc}
    \toprule
    项目    & 产量    & 销量    & 产值   & 比重    \\ \midrule
    手机    & 1000  & 10000 & 500  & 50\%  \\
    计算机   & 5500  & 5000  & 220  & 22\%  \\
    笔记本电脑 & 1100  & 1000  & 280  & 28\%  \\ \midrule
    合计    & 17600 & 16000 & 1000 & 100\% \\ \bottomrule
  \end{tabular*}
\end{table}

\zhlipsum[4-6][name=zhufu]

\begin{table}[ht]
  \centering
  \caption{Tabularx Lg}
  \begin{tabularx}{32em}{*{5}{>{\centering\arraybackslash}X}}
    \toprule
    项目    & 产量    & 销量    & 产值   & 比重    \\ \midrule
    手机    & 1000  & 10000 & 500  & 50\%  \\
    计算机   & 5500  & 5000  & 220  & 22\%  \\
    笔记本电脑 & 1100  & 1000  & 280  & 28\%  \\ \midrule
    合计    & 17600 & 16000 & 1000 & 100\% \\ \bottomrule
  \end{tabularx}
\end{table}

\zhlipsum[7-9][name=zhufu]

\begin{longtable}[ht]{ccccc}
  \caption{Long table Lg}                 \\
  \toprule
  项目    & 产量    & 销量    & 产值   & 比重    \\
  \midrule
  \endfirsthead
  \multicolumn{5}{l}{续表}               \\
  \toprule
  项目    & 产量    & 销量    & 产值   & 比重    \\
  \midrule
  \endhead
  \midrule
  \multicolumn{5}{r}{{续下页}}            \\
  \endfoot
  \bottomrule
  \endlastfoot
  手机    & 1000  & 10000 & 500  & 50\%  \\
  计算机   & 5500  & 5000  & 220  & 22\%  \\
  笔记本电脑 & 1100  & 1000  & 280  & 28\%  \\ \midrule
  合计    & 17600 & 16000 & 1000 & 100\% \\
\end{longtable}

\zhlipsum[10-13][name=zhufu]

\end{document}
fky2015 commented 4 months ago

牛!