目录:

选项说明

选项名 作用
biblatex ={#1} 作为相关包的参数
hyperref ={#1} 作为相关包的参数
cleveref ={#1} 作为相关包的参数
url ={#1} 作为相关包的参数
printbibliography 文档末输出参考文献
AutoTheorem 定义默认的定理等格式
DraftSecBreak 若处于草稿模式,则每节后分页

注意={之间不得有空格。

提供的命令

命令 意义
\ifDraftMode 草稿模式下为True
\ifAutoTheorem 存在AutoTheorem选项时为True
\email #1 电子邮件地址
\keywords 包含格式的keywords
\numberthis 在无编号环境中,给指定行编号
\eqgap 一个等号的间距,用于对齐环境
\setto 赋值等于

整合包

\NeedsTeXFormat{LaTeX2e}[2015/01/01]
\ProvidesPackage{QCYPreamable}[2021/10/17 QianCY preamable v0.0]

\RequirePackage{expl3}
\RequirePackage{l3keys2e}

\newif\ifDraftMode
\newif\ifAutoTheorem
\DraftModefalse
\AutoTheoremfalse

\ExplSyntaxOn
\keys_define:nn { QCYPreamable } {
	biblatex          .code:n = {\PassOptionsToPackage{#1}{biblatex}},
	hyperref          .code:n = {\PassOptionsToPackage{#1}{hyperref}},
	cleveref          .code:n = {\PassOptionsToPackage{#1}{cleveref}},
	url               .code:n = {\PassOptionsToPackage{#1}{url     }},
    printbibliography .code:n = {\AtEndDocument{\printbibliography}},
    draft             .code:n = {\DraftModetrue},
    AutoTheorem       .code:n = {\AutoTheoremtrue},
    DraftSecBreak     .code:n = { % 如果在草稿模式下,那么每节前分页,以节省打印纸张。
									\ifDraftMode
										\AtEndOfPackage{
											\pretocmd{\section}{\clearpage}{}{\GenericWarning{Error when prepending to command \backslash section}}
										}
									\fi
								},
}
\ProcessKeysOptions { QCYPreamable }
\ExplSyntaxOff

\RequirePackage{amsmath,amsthm,amssymb,mathtools} % Basic Packages
\RequirePackage{regexpatch} % 替代etoolbox提供各种钩子。

% Fonts
\RequirePackage{mathrsfs} % 花体 \mathscr
\RequirePackage{bbm}      % 空心体 \mathbbm
\RequirePackage{dsfont}   % 空心体 \mathds

% Graph
% 支持子图,引用为Figure 1(a)
\RequirePackage[labelformat=simple]{subcaption}
\renewcommand*\thesubfigure{(\alph{subfigure})}
\renewcommand*\thesubtable{(\alph{subtable})}

% Label, Link
\RequirePackage[isbn=false]{biblatex} % style=alphabetic, numeric, authoryear.
\ExecuteBibliographyOptions
{
	maxcitenames=3, maxbibnames=100, minnames=3,
}
\AtEveryBibitem{
	\clearfield{issn}
}
\RequirePackage{hyperref}
\RequirePackage{cleveref}
\ifDraftMode
	\RequirePackage[notref,notcite]{showkeys}
\fi

\DeclareRobustCommand{\ProofStyle}[2][\square]{
	\cspreto{#2}{\pushQED{\qed}\renewcommand*{\qedsymbol}{\ensuremath{#1}}}
	\cspreto{end#2}{\popQED}
}

% Environments
\newtheoremstyle{ModifiedRemark}
	{0.5\topsep}             % ABOVE SPACE
	{0.5\topsep}             % BELOW SPACE
	{\normalfont}            % BODY FONT
	{0pt}                    % INDENT (empty value is the same as 0pt)
	{\scshape}               % HEAD FONT % Different from Environment{remark}
	{.}                      % HEAD PUNCT
	{5pt plus 1pt minus 1pt} % HEAD SPACE
	{}                       % CUSTOM-HEAD-SPEC

\ifAutoTheorem
	\theoremstyle{plain}
	\newtheorem{theorem}{Theorem}[section]
	\newtheorem{proposition}[theorem]{Proposition}
	\newtheorem{corollary}[theorem]{Corollary}
	\newtheorem{lemma}[theorem]{Lemma}
	\newtheorem{conjecture}[theorem]{Conjecture}
	\newtheorem{question}[theorem]{Question}
	\theoremstyle{definition}
	\newtheorem{definition}[theorem]{Definition}
	\theoremstyle{remark}
	\newtheorem{example}[theorem]{Example}
	\newtheorem{remark}[theorem]{Remark}
	\ProofStyle[\Diamond]{example}
	\ProofStyle[\Diamond]{remark}
	\theoremstyle{ModifiedRemark}
	\newtheorem{case}{Case}[theorem]
	\newtheorem{claim}[case]{Claim}
	% 告诉cleveref如何引用环境
	\renewcommand*{\thecase}{\arabic{case}}
	\crefname{conjecture}{Conjecture}{Conjectures}
	\crefname{example}{Example}{Examples}
	\crefname{case}{Case}{Cases}
	\crefname{claim}{Claim}{Claims}
\fi

% New commands
\newcommand*{\email}[1]{\href{mailto:#1}{\nolinkurl{#1}}}
\newcommand*{\keywords}{\par\bigskip\noindent\textbf{Keywords: }} % 用来在摘要里加上keywords
\newcommand*{\numberthis}{\refstepcounter{equation}\tag{\theequation}} % 用来在align*加入tag
\newcommand*{\eqgap}{\mathrel{\phantom{=}}} % 空白的等号
\newcommand*{\setto}{\coloneqq}

\endinput

现在的导言区

\documentclass[a4paper,10pt]{article}
\usepackage[
	biblatex={style=alphabetic,sorting=none}, % numeric, authoryear.
	hyperref=colorlinks,
	cleveref=capitalize,
	AutoTheorem,
	printbibliography
]{QCYPreamable}

% \addbibresource{./put/bib/file/here.bib}

% Change margin
\usepackage{geometry}
\geometry{a4paper,scale=0.8}

% Graph
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
% \usepackage{graphicx}   % 支持插入图片

% Other packages
% \usepackage{ifthen} % 支持条件判断
% \usepackage[toc,page]{appendix} % 支持附录
% \usepackage[scheme=plain]{ctex} % 支持中文

\begin{document}
\end{document}