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

优化代码 #82

Merged
merged 4 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions data/chap02.tex
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,24 @@ \section{表格}
\end{tabularx}
\end{table}

如果表格横向宽度不够,可以使用 \pkg{sidewaystable} 将表格旋转90度,如表~\ref{tab:three-line-rotate}。

\begin{sidewaystable}
\centering
\caption{旋转90度的三线表示例}
\begin{tabular}{ll}
\toprule
文件名 & 描述 \\
\midrule
thuthesis.dtx & 模板的源文件,包括文档和注释 \\
thuthesis.cls & 模板文件 \\
thuthesis-*.bst & BibTeX 参考文献表样式文件 \\
thuthesis-*.bbx & BibLaTeX 参考文献表样式文件 \\
thuthesis-*.cbx & BibLaTeX 引用样式文件 \\
\bottomrule
\end{tabular}
\label{tab:three-line-rotate}
\end{sidewaystable}


如果您要排版的表格长度超过一页,那么推荐使用 \pkg{longtable} 或者 \pkg{supertabular}
Expand Down
37 changes: 22 additions & 15 deletions data/chap04.tex
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ \section{顺序编码制}

在顺序编码制下,默认的 \cs{cite} 命令同 \cs{citep} 一样,即序号置于方括号中,引文页码会放在括号外。统一处引用的连续序号会自动用短横线连接。如多次引用同一文献,可能需要标注页码,例如:引用第二页\cite[2]{zhangkun1994},引用第五页\cite[5]{zhangkun1994}。

\begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
\verb|\cite{zhangkun1994}| & \cite{zhangkun1994} {\kaishu 不带页码的上标引用} \\
\verb|\citet{zhangkun1994}| & \citet{zhangkun1994} \\
\verb|\citep{zhangkun1994}| & \citep{zhangkun1994} \\
\verb|\cite[42]{zhangkun1994}| & \cite[42]{zhangkun1994} {\kaishu 手动带页码的上标引用} \\
\verb|\cite{zhangkun1994,zhukezhen1973}| & \cite{zhangkun1994,zhukezhen1973} {\kaishu 一次多篇文献的上标引用} \\
\end{tabular}
{
\small
\noindent
\begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
\verb|\cite{zhangkun1994}| & \cite{zhangkun1994} {\kaishu 不带页码的上标引用} \\
\verb|\citet{zhangkun1994}| & \citet{zhangkun1994} \\
\verb|\citep{zhangkun1994}| & \citep{zhangkun1994} \\
\verb|\cite[42]{zhangkun1994}| & \cite[42]{zhangkun1994} {\kaishu 手动带页码的上标引用} \\
\verb|\cite{zhangkun1994,zhukezhen1973}| & \cite{zhangkun1994,zhukezhen1973} {\kaishu 一次多篇文献的上标引用} \\
\end{tabular}
}

\section{著者-出版年制}

Expand All @@ -31,14 +35,17 @@ \section{著者-出版年制}
\thusetup{
cite-style = author-year,
}
\begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
\verb|\cite{zhangkun1994}| & \cite{zhangkun1994} \\
\verb|\citet{zhangkun1994}| & \citet{zhangkun1994} \\
\verb|\citep{zhangkun1994}| & \citep{zhangkun1994} \\
\verb|\cite[42]{zhangkun1994}| & \cite[42]{zhangkun1994} \\
\verb|\citep{zhangkun1994,zhukezhen1973}| & \citep{zhangkun1994,zhukezhen1973} \\
\end{tabular}

{
\small
\noindent
\begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
\verb|\cite{zhangkun1994}| & \cite{zhangkun1994} \\
\verb|\citet{zhangkun1994}| & \citet{zhangkun1994} \\
\verb|\citep{zhangkun1994}| & \citep{zhangkun1994} \\
\verb|\cite[42]{zhangkun1994}| & \cite[42]{zhangkun1994} \\
\verb|\citep{zhangkun1994,zhukezhen1973}| & \citep{zhangkun1994,zhukezhen1973} \\
\end{tabular}
}
\subsection{其他引用注意事项}

\thusetup{
Expand Down
45 changes: 2 additions & 43 deletions sustech-setup.tex
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@
% 定义所有的图片文件在 figures 子目录下
\graphicspath{{figures/}}

% \enabledraftmode % 启用图片草稿模式,会以文字占位符替代图片,加快大量插入大尺寸图片时的编译速度,用于学位论文的调试,默认不启用

% 数学命令
\newcommand\dif{\mathop{}\!\mathrm{d}} % 微分符号

Expand Down Expand Up @@ -199,46 +201,3 @@
\newcolumntype{Z}{>{\raggedleft\arraybackslash}X}
% A 居中对齐
\newcolumntype{A}{>{\centering\arraybackslash}X}

% 表格旋转
\usepackage{rotating}


\newcommand\undefcolumntype[1]{\expandafter\let\csname NC@find@#1\endcsname\relax}
\newcommand\forcenewcolumntype[1]{\undefcolumntype{#1}\newcolumntype{#1}}



% 定义draft模式的条件
\newif\ifdraftmode
\draftmodefalse % 默认关闭draft模式

% 定义一个命令来开启draft模式
\newcommand{\enabledraftmode}{%
\draftmodetrue
\PassOptionsToPackage{draft}{graphicx}
\PassOptionsToPackage{draft}{hyperref}
\ifdefined\oldincludegraphics\else
\let\oldincludegraphics\includegraphics
\fi
\renewcommand{\includegraphics}[2][]{%
\begingroup
\def\draftimagearg{##2}%
\def\draftimageopts{##1}%
\sbox0{\oldincludegraphics[##1]{##2}}%
\fbox{\parbox[c][\ht0]{\wd0}{\centering Draft Image:\\\texttt{\draftimagearg}}}%
\endgroup
}
\overfullrule=5pt % 显示溢出的箱子
}

% 定义一个命令来关闭draft模式(如果需要的话)
\newcommand{\disabledraftmode}{%
\draftmodefalse
\PassOptionsToPackage{final}{graphicx}
\PassOptionsToPackage{final}{hyperref}
\ifdefined\oldincludegraphics
\let\includegraphics\oldincludegraphics
\fi
\overfullrule=0pt
}
2 changes: 0 additions & 2 deletions sustechthesis-example-report.tex
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
% 5. 作者姓名、指导教师等
\input{sustech-setup}

% \enabledraftmode % 启用草稿模式,会以文字占位符替代图片,加快大量插入大尺寸图片时的编译速度,用于学位论文的调试,默认不启用

\begin{document}

% 封面
Expand Down
2 changes: 0 additions & 2 deletions sustechthesis-example.tex
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
% 5. 修改degree-type的值, 默认academic代表生成学术型研究生毕业设计模板, 改为professional则将生成专业型研究生毕业设计模板。
\input{sustech-setup}

% \enabledraftmode % 启用草稿模式,会以文字占位符替代图片,加快大量插入大尺寸图片时的编译速度,用于学位论文的调试,默认不启用

\begin{document}

% 封面
Expand Down
41 changes: 41 additions & 0 deletions sustechthesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -2825,6 +2825,8 @@
% 这会导致含有多行文字的单元格中行距有误。
% todo: sustech(修订注释)
% \begin{macrocode}
% 表格旋转
\RequirePackage{rotating}
\newcommand\thu@set@table@font{
\ifthu@language@chinese
\def\thu@table@font{%
Expand Down Expand Up @@ -2899,6 +2901,43 @@
\fi
% \end{macrocode}
%
% 图片设置草稿模式
% \begin{macrocode}
% 定义draft模式的条件
\newif\ifdraftmode
\draftmodefalse % 默认关闭draft模式
% 定义一个命令来开启draft模式
\newcommand{\enabledraftmode}{%
\draftmodetrue
\PassOptionsToPackage{draft}{graphicx}
\PassOptionsToPackage{draft}{hyperref}
\ifdefined\oldincludegraphics\else
\let\oldincludegraphics\includegraphics
\fi
\renewcommand{\includegraphics}[2][]{%
\begingroup
\def\draftimagearg{##2}%
\def\draftimageopts{##1}%
\sbox0{\oldincludegraphics[##1]{##2}}%
\fbox{\parbox[c][\ht0]{\wd0}{\centering Draft Image:\\\texttt{\draftimagearg}}}%
\endgroup
}
% 显示溢出的箱子
\overfullrule=5pt
}
% 定义一个命令来关闭draft模式
\newcommand{\disabledraftmode}{%
\draftmodefalse
\PassOptionsToPackage{final}{graphicx}
\PassOptionsToPackage{final}{hyperref}
\ifdefined\oldincludegraphics
\let\includegraphics\oldincludegraphics
\fi
% 显示溢出的箱子
\overfullrule=0pt
}
% \end{macrocode}
%
% 各级标题格式设置。
% \begin{macrocode}
\ctexset{%
Expand Down Expand Up @@ -4507,6 +4546,8 @@ Thesis for the Degree of \degree@level@en@noun \ of \thu@degree@domain@en%
}%
}{%
}
\newcommand\undefcolumntype[1]{\expandafter\let\csname NC@find@#1\endcsname\relax}
\newcommand\forcenewcolumntype[1]{\undefcolumntype{#1}\newcolumntype{#1}}
% \end{macrocode}
% \end{environment}
%
Expand Down