NJUThesis
NJUThesis copied to clipboard
[Feature]: 请问如何给单个表格设置字号
先决条件
现有模板的不便之处
在def文件中可以给所有表格设置统一的字号,但是由于某个表格内容过多,需要有针对性的设置字号大小,请问是否支持这样的功能呢?我在手册中没有看到相关的内容,期待回复
提出可能的解决方案
可以支持某个表格的字号
提出考虑过的方案
No response
额外信息
No response
表格的字号设置,实际上是用一个钩子(hook)挂在 tabular 环境前面
https://github.com/nju-lug/NJUThesis/blob/695ceb567b6f92664d48fbfda53a06c03bb729c9/source/njuthesis.dtx#L6143-L6145
在目前的情况下,一种简单的改法是在这个钩子加上更多的样式设置:
\documentclass[]{njuthesis}
\begin{document}
\BeforeBeginEnvironment{tabular}{\Huge}
\begin{table}[ht]
\begin{tabular}{c|c}
a & b \\
c & d
\end{tabular}
\end{table}
\BeforeBeginEnvironment{tabular}{\small}
\begin{table}[ht]
\begin{tabular}{c|c}
a & b \\
c & d
\end{tabular}
\end{table}
\end{document}
另一种办法就是用 tabularray 提供的键值对接口,可定制性更高一点
\documentclass[]{njuthesis}
\usepackage{tabularray}
\begin{document}
\begin{table}[ht]
\centering
\begin{tblr}{cells = {font=\Huge},cc}
a & b \\
c & d
\end{tblr}
\end{table}
\end{document}
当然了,如果真的内容过多,可以考虑给这个表格单独分配一页,使用 lscape 包和 [p] 浮动参数。
表格的字号设置,实际上是用一个钩子(hook)挂在
tabular环境前面NJUThesis/source/njuthesis.dtx
Lines 6143 to 6145 in 695ceb5
% 表格默认居中,字号设置为五号。^^A https://www.zhihu.com/question/366803177/answer/977853129 % \begin{macrocode} \BeforeBeginEnvironment { tabular } { \centering \l_@@_fmt_tabular_tl } 在目前的情况下,一种简单的改法是在这个钩子加上更多的样式设置:
\documentclass[]{njuthesis}
\begin{document}
\BeforeBeginEnvironment{tabular}{\Huge} \begin{table}[ht] \begin{tabular}{c|c} a & b \ c & d \end{tabular} \end{table} \BeforeBeginEnvironment{tabular}{\small}
\begin{table}[ht] \begin{tabular}{c|c} a & b \ c & d \end{tabular} \end{table}
\end{document} 另一种办法就是用
tabularray提供的键值对接口,可定制性更高一点\documentclass[]{njuthesis} \usepackage{tabularray}
\begin{document}
\begin{table}[ht] \centering \begin{tblr}{cells = {font=\Huge},cc} a & b \ c & d \end{tblr} \end{table}
\end{document} 当然了,如果真的内容过多,可以考虑给这个表格单独分配一页,使用
lscape包和[p]浮动参数。
收到,感谢回复!