obster-y / XJTU-thesis

西安交通大学学位论文模板(LaTeX)(适用硕士、博士学位)An official LaTeX template for Xi'an Jiaotong University degree thesis (Chinese and English)
LaTeX Project Public License v1.3c
220 stars 48 forks source link

[BUG] [TeX] 允许表格浮动后,表内行高改变 #60

Closed LouisYZK closed 2 years ago

LouisYZK commented 2 years ago

必要任务 (请在 [ ] 内填入 "x" 表明完成此项任务

想要使表格同图片一样允许浮动,修改位置参数H为其他组合,如h,'htp'。浮动效果生效,但表内字体行高发生变化,与正文设置不一致。

示例对比

\begin{table}[H]
  \caption{左对齐-阻止浮动}
  \begin{tabularx}{\textwidth}{XX}
  \toprule
      \textbf{Symptom} & \textbf{Metric} \\
  \midrule
      Class that has many accessor methods and accesses a lot of external data & ATFD is more than a few\\
      Class that is large and complex & WMC is high \\
      Class that has a lot of methods that only operate on a proper & \\
  \bottomrule
  \end{tabularx}
\end{table}

\begin{table}[h]
  \caption{左对齐-允许浮动}
  \begin{tabularx}{\textwidth}{XX}
  \toprule
      \textbf{Symptom} & \textbf{Metric} \\
  \midrule
      Class that has many accessor methods and accesses a lot of external data & ATFD is more than a few\\
      Class that is large and complex & WMC is high \\
      Class that has a lot of methods that only operate on a proper & \\
  \bottomrule
  \end{tabularx}
\end{table}

效果 image

其他说明 我尝试初步的解决方案是给每个允许浮动的表格单独添加了\setstretch{1.5}

sikouhjw commented 2 years ago
  1. 这不是 bug,[H] 选项让表格跟正文一样,用 [H] 就是一种“bug”;
  2. https://github.com/x-magus/ThesisUESTC/issues/147#issuecomment-798896837 中给出了解决方案;
  3. 请根据学校的规范给出表格行距的依据,再通过 patch 来实现表格的行距变换,而不是通过 [H] 来达到跟正文一致,规范不一定要求一致。