Skip to content

Commit

Permalink
docs: Use \autoref
Browse files Browse the repository at this point in the history
  • Loading branch information
YDX-2147483647 authored and fky2015 committed Apr 23, 2024
1 parent ddd3c91 commit 9e76447
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
6 changes: 3 additions & 3 deletions the-graduates-handbook/chapters/ch0-quick-start.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ \chapter{快速使用指南}
\textbf{本章将通过多个小节,介绍如何快速
成功编译出一份符合学校要求的毕业论文。}

其中,\ref{sec:local-compile}节介绍在本地电脑上编译生成 PDF;
\ref{sec:overleaf-compile}节介绍在 Overleaf(浏览器)上编译生成 PDF。这两种方法相互独立,你可以根据喜好自行选择其中一种。
其中,\autoref{sec:local-compile}介绍在本地电脑上编译生成 PDF;
\autoref{sec:overleaf-compile}介绍在 Overleaf(浏览器)上编译生成 PDF。这两种方法相互独立,你可以根据喜好自行选择其中一种。

\section{方法一:在本地电脑上编译生成 PDF}
\label{sec:local-compile}
Expand Down Expand Up @@ -75,7 +75,7 @@ \section{方法二:在 Overleaf(浏览器)上编译生成 PDF}

\subsection{注册 Overleaf 账号}

访问 \url{https://overleaf.com}(如图\ref{fig:overleaf-register}所示),点击右上角的 ``Register'' 按钮,注册账号并登录。
访问 \url{https://overleaf.com}(\autoref{fig:overleaf-register}所示),点击右上角的 ``Register'' 按钮,注册账号并登录。

\begin{figure}[H]
\begin{center}
Expand Down
12 changes: 6 additions & 6 deletions the-graduates-handbook/chapters/ch1-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ \section{为何需要这么多步骤,我该如何开始?}
\section{在自己的电脑上编写论文}

\textit{
\ref{sec:local-compile} 节介绍了如何安装 TeX Live(一些工具)和 TeXstudio(文本文件编辑器)。
若您已正常得到PDF,可直接跳到~\ref{sec:using-bithesis} 节编写论文
\autoref{sec:local-compile}介绍了如何安装 TeX Live(一些工具)和 TeXstudio(文本文件编辑器)。
若您已正常得到PDF,可直接跳到\autoref{sec:using-bithesis}编写论文
}

在这里,我们将在自己的电脑上配置安装撰写 \LaTeX{} 的相关工具。首先,我们搞定
Expand Down Expand Up @@ -75,8 +75,8 @@ \section{在自己的电脑上编写论文}

\textit{
到此,我们其实就可以直接使用本模板,在自己的电脑上进行论文的编写了。如果想再了解
有关在线编辑平台 Overleaf 的相关内容,请继续阅读~\ref{sec:online-overleaf}
否则,大家可以直接跳转到~\ref{sec:using-bithesis},了解模板的使用方法。
有关在线编辑平台 Overleaf 的相关内容,请继续阅读\autoref{sec:online-overleaf};
否则,大家可以直接跳转到\autoref{sec:using-bithesis},了解模板的使用方法。
}

\section{本地编辑或是 Overleaf 在线平台,我改使用哪一个?}
Expand Down Expand Up @@ -109,15 +109,15 @@ \section{本地编辑或是 Overleaf 在线平台,我改使用哪一个?}
\section{如何将自己电脑上的论文转到 Overleaf}

\textit{
\ref{sec:overleaf-compile} 节介绍了如何从 \url{https://bithesis.bitnp.net} 新建项目,那样通常更简单;不过若您已在本地用了模板,想转到 Overleaf(例如为了调试),请参考此节。
\autoref{sec:overleaf-compile}介绍了如何从 \url{https://bithesis.bitnp.net} 新建项目,那样通常更简单;不过若您已在本地用了模板,想转到 Overleaf(例如为了调试),请参考此节。
}

\begin{enumerate}
\item 按网页提示上传文件到 Overleaf,注意\textbf{避免嵌套文件夹}。

(原因:嵌套文件夹可能导致无法统计字数;不过不影响编译。)

参考图\ref{fig:overleaf-recompile},文件 \texttt{main.tex}、文件夹 \texttt{chapters/} 等在根目录,而没有嵌套在 \isGraduateTF{\texttt{graduate-thesis/}}{\texttt{undergraduate-thesis/}} 文件夹中。若您已嵌套,可到左侧文件列表单击再拖动来移动文件。
参考\autoref{fig:overleaf-recompile},文件 \texttt{main.tex}、文件夹 \texttt{chapters/} 等在根目录,而没有嵌套在 \isGraduateTF{\texttt{graduate-thesis/}}{\texttt{undergraduate-thesis/}} 文件夹中。若您已嵌套,可到左侧文件列表单击再拖动来移动文件。

详细操作如下。访问 \url{https://www.overleaf.com/project},单击左上角\texttt{New Project},然后有下面两种方法。

Expand Down
2 changes: 1 addition & 1 deletion the-graduates-handbook/chapters/ch2-template-usage.tex
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ \subsubsection{公式和图标引用}

交叉引用的前提是需要在定义章节、公式和图表的时候都对其进行命名标签
(即\label{sec:labelName} 命令),在实际使用过程中通过标签进行引用。根据引用
的特点可以将应用分成表 \ref{tab:setSection} 中所示三类。
的特点可以将应用分成\autoref{tab:setSection}中所示三类。

\begin{table}[htb]
\centering
Expand Down
20 changes: 10 additions & 10 deletions the-graduates-handbook/chapters/ch3-latex-syntax.tex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ \subsection{公式及术语表}

为方便,可用 \href{https://www.latexlive.com/}{latexlive.com} 等网站\textbf{在线编辑}公式,或用 \href{https://mathpix.com/snipping-tool}{Mathpix Snipping Tool} 等\textbf{从图片转换}。一般的\LaTeX{}编辑器如 TeXstudio 也都会提供语法补全。

{\bf{实例1:}} 以下是L-B非稳态流动升力模型,公式引用为公式\ref{eqn:LBmodel}。该公式的术语列表见\ref{tab:LB-parameters}。
{\bf{实例1:}} 以下是L-B非稳态流动升力模型,公式引用为\autoref{eqn:LBmodel}。该公式的术语列表见\autoref{tab:LB-parameters}。
\begin{equation}
\label{eqn:LBmodel}
C_{L} = C_{L0} + C_{L \alpha} \left( \frac{1+\sqrt{X}}{2} \right) \alpha
Expand Down Expand Up @@ -80,7 +80,7 @@ \subsection{定理环境}
卷绕数是一个整数,它描述了曲线$\gamma$绕过点$a_k$的次数。如果$\gamma$依逆时针方向绕着$a_k$移动,卷绕数就是一个正数,
如果$\gamma$根本不绕过$a_k$,卷绕数就是零。

定理\ref{thm:res}的证明。
\autoref{thm:res}的证明。

\begin{proof}
首先,由……
Expand Down Expand Up @@ -123,7 +123,7 @@ \subsection{支持的图片格式}

在学位论文中,插图地使用简单地分为两类:单列图片和多列图片。图片的格式包含*.jpg、*.eps、*.pdf,既可以是位图也可以是矢量图,在插入图片时可以定义其高度和宽度。

最基本的图片插入示例可见图\ref{fig:diagram},其代码如\ref{demo-figure1}所示。
最基本的图片插入示例可见\autoref{fig:diagram},其代码如\autoref{demo-figure1}所示。

其中\verb+\centering+表示图片居中,\verb+\includegraphics[…]{…}+导入图片并指定图片大小,\verb+\caption{}+指定图片标题,而\verb+\label{…}+为图片加上引用标签。

Expand All @@ -141,7 +141,7 @@ \subsection{支持的图片格式}
\end{figure}
\end{lstlisting}

插入两幅图片的例子如\ref{fig:png-jpg}所示。
插入两幅图片的例子如\autoref{fig:png-jpg}所示。
这两个水平并列放置的图共享一个``图标题''(table caption),没有各自的小标题。

\begin{figure}
Expand Down Expand Up @@ -169,7 +169,7 @@ \subsection{支持的图片格式}
\subsection{长标题的换行}
\label{sec:longcaption}

\ref{fig:longcaptionbad}和图\ref{fig:longcaptiongood}的标题都比较长。对比可发现图\ref{fig:longcaptiongood}的标题换行效果更好一些,
\autoref{fig:longcaptionbad}\autoref{fig:longcaptiongood}的标题都比较长。对比可发现\autoref{fig:longcaptiongood}的标题换行效果更好一些,
它使用了minipage环境来限制整个浮动体的宽度。

不过在实际使用中,你可以根据排版的整体效果来自行决定。
Expand Down Expand Up @@ -217,7 +217,7 @@ \section{表格的例子}

\textbf{\href{https://www.tablesgenerator.com/}{Tables Generator}可以用于在线生成表格}

先以模板示例中第一章的表\ref{tab:category}为例,插入代码为\ref{demo-table1}所示。
先以模板示例中第一章的\autoref{tab:category}为例,插入代码为\autoref{demo-table1}所示。

\begin{lstlisting}[language={[LaTeX]TeX}, caption={示例插表代码}, label=demo-table1]
\begin{table}
Expand Down Expand Up @@ -251,7 +251,7 @@ \section{表格的例子}
\end{tabular*}
\end{table}

另举一个两列的表格例子(\ref{tab:LB-parameters}以及代码\ref{demo-table2})。
另举一个两列的表格例子(\autoref{tab:LB-parameters}以及\autoref{demo-table2})。

\begin{table} % no placement specified: defaults to here, top, bottom, page
\centering
Expand All @@ -272,7 +272,7 @@ \section{表格的例子}
\end{center}
\end{table}

\begin{lstlisting}[language={[LaTeX]TeX}, caption={插入表格\ref{tab:LB-parameters}}, label=demo-table2]
\begin{lstlisting}[language={[LaTeX]TeX}, caption={插入\autoref{tab:LB-parameters}}, label=demo-table2]
\begin{table}
\centering
\begin{center}
Expand All @@ -292,7 +292,7 @@ \section{表格的例子}
\end{table}
\end{lstlisting}

再给出一些表格的例子,如表\ref{tab:firstone}、代码\ref{demo-table3}所示。
再给出一些表格的例子,\autoref{tab:firstone}、\autoref{demo-table3}所示。

\begin{table}
\centering
Expand Down Expand Up @@ -344,7 +344,7 @@ \subsection{将参考文献的内容与表现分离}
.bib数据库中的参考文献条目可以手动编写,也可以在Google的学术搜索中找到。
各大数据库也支持将参考文献信息导出为.bib,省时省力。
以Google学术搜索为例:在搜索结果中,选择``引用''``BibTeX''的连接,
点击后浏览器会打开新的标签页,出现类似代码\ref{googlescholar}所示的内容。
点击后浏览器会打开新的标签页,出现类似\autoref{googlescholar}所示的内容。

\begin{lstlisting}[caption={从Google Scholar找到的,但并不规范的.bib条目}, label=googlescholar, float, escapeinside="", numbers=none]
@article{张玲2000信用风险评估方法发展趋势,
Expand Down
8 changes: 8 additions & 0 deletions the-graduates-handbook/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@

\addbibresource{reference/main.bib}

\usepackage{hyperref}
% https://github.com/BITNP/BIThesis/discussions/400
% https://static.latexstudio.net/wp-content/uploads/2018/03/swjtuthesis.pdf
\def\figureautorefname~#1\null{图~#1~\null}
\def\chapterautorefname~#1\null{第~#1~章\null}
\def\sectionautorefname~#1\null{第~#1~节\null}
\def\equationautorefname~#1\null{式~(#1)~\null}

\ExplSyntaxOn

\NewDocumentCommand{\getenv}{om}
Expand Down

0 comments on commit 9e76447

Please sign in to comment.