Skip to content
Snippets Groups Projects
Commit d98ac553 authored by Yu Xiong's avatar Yu Xiong :confounded:
Browse files

feature: 加入了来自kaobook项目的智能引用命令

parent 7be42f93
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@
\section{表格示例}
\begin{table}[htbp]
\caption{经过测试的环境}
% \label{tab:1}
\labtab{mytab}
\begin{tabular}{ccc}
\toprule
OS & Tex & 测试情况 \\
......@@ -46,7 +46,7 @@
\bottomrule
\end{tabular}
\end{table}
你可以使用\lstinline|table|环境插入标准三线表,代码如下:
你可以使用\lstinline|table|环境插入标准三线表,\reftab{mytab}所示,代码如下:
\begin{lstlisting}[language=TeX]
\begin{table}[htbp]
\caption{经过测试的环境}
......@@ -68,9 +68,9 @@
\begin{figure}[htbp]
\includegraphics[width=0.5\textwidth]{njuname}
\caption{南京大学名称}
\label{fig:1}
\labfig{njuname}
\end{figure}
你可以使用\lstinline|figure|环境插入图片,如\ref{fig:1},代码如下:
你可以使用\lstinline|figure|环境插入图片,如\reffig{njuname},代码如下:
\begin{lstlisting}[language=TeX]
\begin{figure}
\includegraphics[width=0.5\textwidth]{njuname}
......
% biblatex设置
\RequirePackage[
style=gb7714-2015,
%style=numeric-comp,
%citestyle=authortitle-icomp,
% citestyle=numeric-comp,
%bibstyle=authoryear,
% bibstyle=numeric,
sorting=none,
%sorting=nyt,
%sortcites=true,
%autocite=footnote,
backend=biber, % Compile the bibliography with biber
hyperref=true,
backref=true,
citecounter=true,
pagetracker=true,
citetracker=true,
ibidtracker=context,
autopunct=true,
autocite=plain,
% gbpub=false, % Uncomment if you do NOT want '[S.l. : s.n.]' in reference entries, GitHub Issue (#47)
% gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author names in reference entries, GitHub Issue (#23)
]{biblatex}
% Remove some unwanted entries from the bibliography
\AtEveryBibitem{
\clearfield{abstract}
\clearfield{issn}
\clearfield{isbn}
\clearfield{archivePrefix}
\clearfield{arxivId}
\clearfield{pmid}
\clearfield{eprint}
\ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}}
% \ifentrytype{book}{\clearfield{doi}}{}
}
\ No newline at end of file
......@@ -29,7 +29,7 @@
\RequirePackage[version=4]{mhchem} % 用于绘制分子式
\RequirePackage{hologo} % 用于生成可以被插入书签的LaTeX logo
\RequirePackage{needspace} % Required to prevent page break right after a sectioning command
% \RequirePackage{xspace} % Better print trailing whitespace
\RequirePackage{xspace} % Better print trailing whitespace
\RequirePackage{lipsum} % 生成用于测试的大段无意义英文文字
\RequirePackage{zhlipsum} % 生成用于测试的大段无意义中文文字
......
......@@ -4,7 +4,7 @@
\input{profile/packages.sty}
\input{profile/font.sty}
\input{profile/page.sty}
\input{profile/bibliography.sty}
\input{profile/reference.sty}
\input{profile/components.sty}
\input{profile/cover.sty}
\input{profile/abstract.sty}
......
% biblatex设置
\RequirePackage[
style=gb7714-2015,
%style=numeric-comp,
%citestyle=authortitle-icomp,
% citestyle=numeric-comp,
%bibstyle=authoryear,
% bibstyle=numeric,
sorting=none,
%sorting=nyt,
%sortcites=true,
%autocite=footnote,
backend=biber, % Compile the bibliography with biber
hyperref=true,
backref=true,
citecounter=true,
pagetracker=true,
citetracker=true,
ibidtracker=context,
autopunct=true,
autocite=plain,
% gbpub=false, % Uncomment if you do NOT want '[S.l. : s.n.]' in reference entries, GitHub Issue (#47)
% gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author names in reference entries, GitHub Issue (#23)
]{biblatex}
% Remove some unwanted entries from the bibliography
\AtEveryBibitem{
\clearfield{abstract}
\clearfield{issn}
\clearfield{isbn}
\clearfield{archivePrefix}
\clearfield{arxivId}
\clearfield{pmid}
\clearfield{eprint}
\ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}}
% \ifentrytype{book}{\clearfield{doi}}{}
}
% From https://github.com/fmarotta/kaobook/blob/master/kaorefs.sty
% Labelling commands
\newcommand{\labpage}[1]{\label{page:#1}}
\newcommand{\labpart}[1]{\label{part:#1}}
\newcommand{\labch}[1]{\label{ch:#1}}
\newcommand{\labsec}[1]{\label{sec:#1}}
\newcommand{\labsubsec}[1]{\label{subsec:#1}}
\newcommand{\labfig}[1]{\label{fig:#1}}
\newcommand{\labtab}[1]{\label{tab:#1}}
\newcommand{\labeq}[1]{\label{eq:#1}}
\newcommand{\labdef}[1]{\label{def:#1}}
\newcommand{\labthm}[1]{\label{thm:#1}}
\newcommand{\labassum}[1]{\label{assum:#1}}
\newcommand{\labprop}[1]{\label{prop:#1}}
\newcommand{\lablemma}[1]{\label{lemma:#1}}
\newcommand{\labremark}[1]{\label{remark:#1}}
\newcommand{\labexample}[1]{\label{example:#1}}
\newcommand{\labexercise}[1]{\label{exercise:#1}}
% Referencing commands
\newcommand{\refpage}[1]{\hyperref[#1]{\pagename}\xspace\pageref{page:#1}} % Page 84
\newcommand{\vrefpage}[1]{\vpageref*{page:#1}} % on the following page, on page 84
% For unnumbered parts
\newcommand{\arefpart}[1]{\hyperref[part:#1]{\partname}\xspace`\nameref{part:#1}'} % Part `Name of the Part'
\newcommand{\avrefpart}[1]{\hyperref[part:#1]{\partname}\xspace`\nameref{part:#1}' \vpageref{part:#1}} % Part `Name of the Part' on page 84
% For numbered parts
\newcommand{\refpart}[1]{\hyperref[part:#1]{\partname}\xspace\ref{part:#1}} % Part IV
\newcommand{\vrefpart}[1]{\hyperref[part:#1]{\partname}\xspace\vref{part:#1}} % Part IV, Part IV on the following page, Part IV on page 84
\newcommand{\nrefpart}[1]{\hyperref[part:#1]{\partname}\xspace\ref{part:#1} (\nameref{part:#1})}
\newcommand{\frefpart}[1]{\hyperref[part:#1]{\partname\xspace\ref{part:#1} (\nameref{part:#1}) \vpageref{part:#1}}} % Part IV (Name of the Part), Part IV (Name of the Part) on the following page, Part IV (Name of the Part) on page 84)
%\newcommand{\refch}[1]{\hyperref[#1]{\chaptername\xspace\usekomafont{chapter}\normalsize\nameref{ch:#1}}\xspace\vpageref{ch:#1}\,}
\newcommand{\refchshort}[1]{\hyperref[ch:#1]{\chapternameshort\xspace\ref{ch:#1}}}
\newcommand{\refch}[1]{\hyperref[ch:#1]{\chaptername\xspace\ref{ch:#1}}}
\newcommand{\vrefch}[1]{\hyperref[ch:#1]{\chaptername\xspace\ref{ch:#1} \vpageref{ch:#1}}}
\newcommand{\nrefch}[1]{\hyperref[ch:#1]{\chaptername\xspace\ref{ch:#1} (\nameref{ch:#1})}}
\newcommand{\frefch}[1]{\hyperref[ch:#1]{\chaptername\xspace\ref{ch:#1} (\nameref{ch:#1}) \vpageref{ch:#1}}}
%\newcommand{\refsec}[1]{Section~{\usekomafont{section}\normalsize\nameref{sec:#1}}\xspace\vpageref{sec:#1}\,}
\newcommand{\refsecshort}[1]{\hyperref[sec:#1]{\sectionnameshort\xspace\ref{sec:#1}}}
\newcommand{\refsec}[1]{\hyperref[sec:#1]{\sectionname\xspace\ref{sec:#1}}}
\newcommand{\vrefsec}[1]{\hyperref[sec:#1]{\sectionname\xspace\vref{sec:#1}}}
\newcommand{\nrefsec}[1]{\hyperref[sec:#1]{\sectionname\xspace\ref{sec:#1} (\nameref{sec:#1})}}
\newcommand{\frefsec}[1]{\hyperref[sec:#1]{\sectionname\xspace\ref{sec:#1} (\nameref{sec:#1}) \vpageref{sec:#1}}}
\newcommand{\refsubsecshort}[1]{\hyperref[subsec:#1]{\sectionnameshort\xspace\ref{subsec:#1}}}
\newcommand{\refsubsec}[1]{\hyperref[subsec:#1]{\subsectionname\xspace\ref{subsec:#1}}}
\newcommand{\vrefsubsec}[1]{\hyperref[subsec:#1]{\subsectionname\xspace\vref{subsec:#1}}}
\newcommand{\nrefsubsec}[1]{\hyperref[subsec:#1]{\subsectionname\xspace\ref{subsec:#1} (\nameref{subsec:#1})}}
\newcommand{\frefsubsec}[1]{\hyperref[subsec:#1]{\subsectionname\xspace\ref{subsec:#1} (\nameref{subsec:#1}) \vpageref{subsec:#1}}}
%\newcommand{\reffig}[1]{{\hypersetup{colorlinks=false}\usekomafont{captionlabel}\hyperref[fig:#1]{Figure}\xspace\ref{fig:#1}}}
\newcommand{\reffigshort}[1]{\hyperref[fig:#1]{\figurenameshort\xspace\ref{fig:#1}}}
\newcommand{\reffig}[1]{\hyperref[fig:#1]{\figurename}\xspace\ref{fig:#1}}
\newcommand{\vreffig}[1]{\hyperref[fig:#1]{\figurename\xspace\vref{fig:#1}}}
%\newcommand{\reftab}[1]{{\hypersetup{colorlinks=false}\usekomafont{captionlabel}\hyperref[tab:#1]{Table}\xspace\ref{tab:#1}}}
\newcommand{\reftab}[1]{\hyperref[tab:#1]{\tablename}\xspace\ref{tab:#1}}
\newcommand{\vreftab}[1]{\hyperref[tab:#1]{\tablename\xspace\vref{tab:#1}}}
\newcommand{\refeqshort}[1]{\hyperref[eq:#1]\eqnameshort\xspace(\ref{eq:#1})}
\newcommand{\refeq}[1]{\hyperref[eq:#1]\eqname\xspace\ref{eq:#1}}
\newcommand{\vrefeq}[1]{\hyperref[eq:#1]\eqname\xspace\vref{eq:#1}}
\newcommand{\refdef}[1]{\hyperref[def:#1]\defname\xspace\ref{def:#1}}
\newcommand{\vrefdef}[1]{\hyperref[def:#1]\defname\xspace\vref{def:#1}}
\newcommand{\refassum}[1]{\hyperref[assum:#1]\assumname\xspace\ref{assum:#1}}
\newcommand{\vrefassum}[1]{\hyperref[assum:#1]\assumname\xspace\vref{assum:#1}}
\newcommand{\refthm}[1]{\hyperref[thm:#1]\thmname\xspace\ref{thm:#1}}
\newcommand{\vrefthm}[1]{\hyperref[thm:#1]\thmname\xspace\vref{thm:#1}}
\newcommand{\refprop}[1]{\hyperref[prop:#1]\propname\xspace\ref{prop:#1}}
\newcommand{\vrefprop}[1]{\hyperref[prop:#1]\propname\xspace\vref{prop:#1}}
\newcommand{\reflemma}[1]{\hyperref[lemma:#1]\lemmaname\xspace\ref{lemma:#1}}
\newcommand{\vreflemma}[1]{\hyperref[lemma:#1]\lemmaname\xspace\vref{lemma:#1}}
\newcommand{\refremark}[1]{\hyperref[remark:#1]\remarkname\xspace\ref{remark:#1}}
\newcommand{\vrefremark}[1]{\hyperref[remark:#1]\remarkname\xspace\vref{remark:#1}}
\newcommand{\refexample}[1]{\hyperref[example:#1]\examplename\xspace\ref{example:#1}}
\newcommand{\vrefexample}[1]{\hyperref[example:#1]\examplename\xspace\vref{example:#1}}
\newcommand{\refexercise}[1]{\hyperref[exercise:#1]\exercisename\xspace\ref{exercise:#1}}
\newcommand{\vrefexercise}[1]{\hyperref[exercise:#1]\exercisename\xspace\vref{exercise:#1}}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment