Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: misc/tabularRowSeparation不应影响矩阵 #499

Merged
merged 1 commit into from
May 15, 2024

Conversation

YDX-2147483647
Copy link
Collaborator

@YDX-2147483647 YDX-2147483647 commented May 11, 2024

Fixes #498
Relates to #501

TODO:longtable表格上框线和caption有多余间距。

过时测试结果

下图左边将tabularRowSeparation设为1.25,右边设为1,可见表格受影响,而矩阵不变。

图片

下图设为1.25,可见三种表格都能改。

图片

测试

  • 字号影响tabulartabular*tabularxlongtable的内容,不影响caption。
  • 各行间距影响tabulartabular*tabularx,不影响longtable(它自己已改)、矩阵。
% !TeX program = xelatex
% !BIB program = biber

\documentclass[type=bachelor]{bithesis}

\BITSetup{
  misc = {
    tabularRowSeparation = 1.25,
    % tabularFontSize = 8,
  },
}

\usepackage{tabularx}
\usepackage{longtable}

\begin{document}

\frontmatter
\mainmatter

啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊

\begin{equation}
  \begin{bmatrix}
    1 & 0 \\
    1 & 0 \\
    1 & 0 \\
    1 & 0 \\
  \end{bmatrix}
\end{equation}

\begin{table}[ht]
  \centering
  \caption{Tabular}
  \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}

\begin{table}[ht]
  \centering
  \caption{Tabular*}
  \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}

\begin{table}[ht]
  \centering
  \caption{Tabularx}
  \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}

\begin{longtable}[ht]{ccccc}
  \caption{Long table}                 \\
  \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}

\end{document}

不设置tabularRowSeparation

图片

tabularRowSeparation = 1.25

图片
图片
图片

tabularRowSeparation = 5, tabularFontSize = 8

图片

@YDX-2147483647 YDX-2147483647 marked this pull request as ready for review May 11, 2024 08:39
@fky2015
Copy link
Contributor

fky2015 commented May 12, 2024

有通过 pdf-diff 比较其他地方的影响么?应该除了表格以外没有其他影响了叭。

@YDX-2147483647
Copy link
Collaborator Author

YDX-2147483647 commented May 12, 2024

我只试了上面的小例子,没试完整模板。此外,还要支持 #501 提出的 longtable。所以我先改回草稿状态吧。


更新:已支持 longtable,只需再测试完整模板。


更新:完整模板完全没变化,似乎没有相关示例。

@YDX-2147483647 YDX-2147483647 marked this pull request as draft May 12, 2024 06:24
@fky2015
Copy link
Contributor

fky2015 commented May 14, 2024

我有点没看懂此 MR 和 #504 的关系,是否存在依赖或者重复? @YDX-2147483647

@YDX-2147483647
Copy link
Collaborator Author

我有点没看懂此 MR 和 #504 的关系,是否存在依赖或者重复? @YDX-2147483647

重复,没有依赖。这里是用\arraystrecth改,#504是用\linespread改,二者各有优缺点(前者多改矩阵,后者多改caption),但最终都能解决tabulartabular*tabularx,且无法解决longtable

@SinCerely023
Copy link
Contributor

重复,没有依赖。这里是用\arraystrecth改,#504是用\linespread改,二者各有优缺点(前者多改矩阵,后者多改caption),但最终都能解决tabulartabular*tabularx,且无法解决longtable

试了一下这里的方法不会对矩阵产生影响。都解决不了longtable的情况下,感觉比 #504 更合适一些

@fky2015 fky2015 added this pull request to the merge queue May 15, 2024
Merged via the queue into BITNP:main with commit 2f6cf63 May 15, 2024
3 checks passed
@YDX-2147483647 YDX-2147483647 deleted the YDX-2147483647/issue498 branch May 15, 2024 03:26
@YDX-2147483647 YDX-2147483647 mentioned this pull request May 25, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: misc/tabularRowSeparation错误地影响了矩阵
3 participants