-
Notifications
You must be signed in to change notification settings - Fork 86
/
biblatex-gb7714-2015-preamble.tex
433 lines (399 loc) · 16.8 KB
/
biblatex-gb7714-2015-preamble.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
\usepackage{expl3,etoolbox,ifthen,xstring}
\usepackage{xltxtra,mflogo,texnames,fontawesome}
%\usepackage{amstext}
\usepackage[zihao=-4]{ctex}
\ctexset{today=old}
\let\kaiti=\kaishu
\usepackage{xeCJKfntef}
%\setmainfont{CMU Serif}
\usepackage{fontspec}
%\usepackage{tgpagella}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
\setsansfont[Ligatures=TeX]{TeX Gyre Pagella}
\setmonofont[Ligatures=TeX]{TeX Gyre Pagella}
%\usepackage{unicode-math}
%\setmathfont[math-style=ISO,bold-style=ISO]{TeX Gyre Pagella Math}
%\setmainfont{CMU Serif}
\IfFileExists{SourceHanSerifSC-Regular.otf}
{\setCJKmainfont[BoldFont=SourceHanSansSC-Regular.otf, ItalicFont=simkai.ttf]{SourceHanSerifSC-Regular.otf}}{}
\usepackage[dvipsnames]{xcolor}
\colorlet{examplefill}{yellow!80!black}
\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8}
\definecolor{codebackground}{rgb}{0.9,0.9,1}
\definecolor{gbsteelblue}{RGB}{70,130,180}
\definecolor{gborange}{RGB}{255,138,88}
\definecolor{gbblue}{RGB}{23,74,117}
\definecolor{gbforestgreen}{RGB}{21,122,81}
\definecolor{gbyellow}{RGB}{255,185,88}
\definecolor{gbgrey}{RGB}{200,200,200}
\colorlet{gblabelcolor}{violet}
\colorlet{gbemphcolor}{blue!60!black}
%\colorlet{gbemphcolor}{violet}
%定义版面,showframe,
\usepackage[paperwidth=210mm,paperheight=290mm,left=40mm,right=15mm,top=25mm, bottom=20mm,showcrop]{geometry}%,showframe
\renewcommand{\baselinestretch}{1.35}
%页面布局的标尺
\usepackage[type=none]{fgruler}
%[unit=cm,type=lowerleft,showframe=true,hshift=3cm,vshift=2cm]
\rulerparams{}{}{gray!10}{}{0.2pt}
\fgrulerdefnum{}\fgrulercaptioncm{}%fgruler加数字后,导致基线对齐出现问题,所以这里去掉
\newlength{\skipheadrule}
\deflength{\skipheadrule}{3.5pt}
\newlength{\skipfootrule}
\deflength{\skipfootrule}{5.5pt}
\newlength{\ruletotalen}
\deflength{\ruletotalen}{\textheight}
\newlength{\ruleraised}
\deflength{\ruleraised}{\headsep+\textheight}
\usepackage{fancyhdr}
\fancyhf{}
%\fancyhead[LO]{%
%\raisebox{-\skipheadrule}{%
%\raisebox{-\headsep}[0pt][0pt]{\makebox[0pt][l]{\ruler{rightup}{\linewidth}}}%
%\raisebox{-\ruleraised}[0pt][0pt]{\makebox[0pt][r]{\ruler{upleft}{\ruletotalen}}}%
%}%HEAD LEFT%
%}
%\fancyhead[LE]{%
%\raisebox{-\skipheadrule}{%
%\raisebox{-\headsep}[0pt][0pt]{\makebox[0pt][l]{\ruler{rightup}{\linewidth}}}%
%\raisebox{-\ruleraised}[0pt][0pt]{\makebox[0pt][r]{\ruler{upleft}{\ruletotalen}}}%
%}\leftmark%HEAD LEFT%
%}
%\fancyhead[RO]{%
%%HEAD RIGHT%
%\raisebox{-\skipheadrule}{%
%\hfill\makebox[0pt][l]{\raisebox{-\ruleraised}[0pt][0pt]{\ruler{downright}{\ruletotalen}}\hss}%
%}}
%\fancyhead[RE]{%
%\rightmark%HEAD RIGHT%
%\raisebox{-\skipheadrule}{%
%\hfill\makebox[0pt][l]{\raisebox{-\ruleraised}[0pt][0pt]{\ruler{downright}{\ruletotalen}}\hss}%
%}}
\fancyhead[CO]{%
符合GB/T 7714-2015标准的biblatex参考文献样式%HEAD CENTER
}
%\fancyfoot[L]{%
%\raisebox{-\skipfootrule}{%
%\raisebox{\footskip}[0pt][0pt]{\makebox[0pt][l]{\ruler{rightdown}{\linewidth}}}
%}%FOOT LEFT
%}
\fancyfoot[C]{%
\thepage%FOOT CENTER
}
\fancyfoot[R]{%
%FOOT RIGHT
}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}
%超链接书签功能,选项去掉链接红色方框
\usepackage[colorlinks=true,%
pdfstartview=FitH,allcolors=gbemphcolor,
bookmarksopenlevel=4,%
bookmarksnumbered=true,
bookmarksopen=true,
bookmarksdepth=4,]{hyperref}
%linkcolor=gbblue,anchorcolor=gbblue,citecolor=gbblue
%linkcolor=black,linkcolor=green,blue,red,cyan, magenta,
%yellow, black, gray,white, darkgray, lightgray, brown,
%lime, olive, orange, red,purple, teal, violet.
%CJKbookmarks,bookmarksnumbered=true,
\usepackage{titleref} %标题引用
%标题格式设置
\usepackage{titlesec}
%\titlespacing*{hcommandi}{hlefti}{hbefore-sepi}{hafter-sepi}[hright-sepi]
\titlespacing*{\section}{0pt}{\baselineskip}{0.5\baselineskip}
\titlespacing*{\subsection}{0pt}{0.5\baselineskip}{0.5\baselineskip}
\titlespacing*{\subsubsection}{0pt}{0.5\baselineskip}{0pt}
\titlespacing{\paragraph}{2em}{0.5\baselineskip}{1em}
%这里利用titleformat*简单做设置,也可以利用titleformat做详细设置
\titleformat*{\section}{\zihao{-3}\bfseries\heiti}
\titleformat*{\subsection}{\zihao{4}\bfseries\heiti}
\titleformat*{\subsubsection}{\zihao{-4}\bfseries\kaiti}
%参考文献
\usepackage[backend=biber,style=gb7714-2015,gbalign=center,gbfootbib=true%,gbtype=true%
]{biblatex}%,backref=true%
\addbibresource[location=local]{example.bib}
\setlength{\bibitemsep}{1pt}
%\defbibheading{bibliography}[\bibname]{%
%%\phantomsection%解决链接指引出错的问题,相当于加入了一个引导点
%%\addcontentsline{toc}{subsection}{#1}
% \centering\subsubsection*{#1}}%
%目录,图/表/例目录,图表题注
\usepackage[bf]{subfigure}
\usepackage[subfigure]{tocloft} %注意其与titletoc共用时分页会有问题
\usepackage{ccaption}
\captiondelim{. } %图序图题中间的间隔符号
\captionnamefont{\zihao{-5}\heiti} %图序样式
\captiontitlefont{\zihao{-5}\heiti} %图题样式
\captionwidth{0.8\linewidth} %标题宽度
\changecaptionwidth
\captionstyle{\centering} %\captionstyle{<style>} style are: \centering, \raggedleft or \raggedright
%\precaption{\rule{\linewidth}{0.4pt}\par}
%\postcaption{\vspace{-1cm}}
\setlength{\belowcaptionskip}{2pt}%设置caption上下间距
\setlength{\abovecaptionskip}{0pt}
%\setlength{\abovelegendskip}{0pt} %设置legend上下间距
%\setlength{\belowlegendskip}{0pt}
%新的浮动体设置,\centerline{}
\newcommand{\listegcodename}{\zihao{4}示~~例\thispagestyle{plain}}%listegcodename,新环境目录的标题
\newcommand{\egcodename}{例}%egcodename,新环境标题的图序
\newfloatlist{egcode}{loc}{\listegcodename}{\egcodename}%loc,写入条目的文件的扩展名
\newfixedcaption{\codecaption}{egcode}%egcode,环境名
\newfixedcaption{\fixtabcaption}{table}%egcode,环境名
%目录命令
\setlength{\cftbeforetoctitleskip}{\baselineskip}
\setlength{\cftaftertoctitleskip}{0.5\baselineskip}
\setlength{\cftbeforeloftitleskip}{\baselineskip}
\setlength{\cftafterloftitleskip}{0.5\baselineskip}
\setlength{\cftbeforelottitleskip}{\baselineskip}
\setlength{\cftafterlottitleskip}{0.5\baselineskip}
\setlength{\cftbeforeloctitleskip}{\baselineskip}
\setlength{\cftafterloctitleskip}{0.5\baselineskip}
%\renewcommand\contentsname{\hfill 目~~ 录 \hfill \hspace{1cm}} %用这一句也是一样的。
\renewcommand{\cfttoctitlefont}{\heiti}
\renewcommand{\cftaftertoctitle}{}
\renewcommand{\cftloftitlefont}{\heiti}
\renewcommand{\cftafterloftitle}{}
\renewcommand{\cftlottitlefont}{\heiti}
\renewcommand{\cftafterlottitle}{}
\renewcommand{\cftloctitlefont}{\heiti}
\renewcommand{\cftafterloctitle}{}
\renewcommand{\contentsname}{\zihao{4}目~~录}
\renewcommand{\listfigurename}{\zihao{4}图~~片}
\renewcommand{\listtablename}{\zihao{4}表~~格}
\renewcommand{\cftsecfont}{\zihao{5}\heiti} %条目样式
\renewcommand{\cftsubsecfont}{\zihao{-5}\songti} %条目样式\fangsong
\renewcommand{\cftsubsubsecfont}{\zihao{-5}\kaiti} %条目样式
\renewcommand{\cftsecpagefont}{\bfseries\zihao{5}} %页码的样式
\renewcommand{\cftsubsecpagefont}{\bfseries\zihao{-5}} %页码的样式
\renewcommand{\cftsubsubsecpagefont}{\bfseries\zihao{-5}} %页码的样式
%−−−−−−−−−−设置egcode条目样式−−−−−−−−−−−−−−−−−−−−−−
%\renewcommand{\cftegcodeleader}{\leaders\hbox to 1em{\hss.\hss}\hfill}
\setlength{\cftbeforeegcodeskip}{0.1ex} %条目前的间距
\setlength{\cftegcodeindent}{0em} %条目缩进
\setlength{\cftegcodenumwidth}{2.5em} %条目标签宽度
\renewcommand{\cftegcodefont}{\color{gbemphcolor}\zihao{-5}}%条目样式\fangsong
\renewcommand{\cftegcodepresnum}{例}
\renewcommand{\cftegcodeaftersnum}{ }
\renewcommand{\cftegcodeaftersnumb}{~}
%\cftsetindents{egcode}{0em}{3em}
\renewcommand{\cftegcodepagefont}{\bfseries\zihao{-5}}
%−−−−−−−−−−设置figure条目样式−−−−−−−−−−−−−−−−−−−−−−
%\newcommand{\cftfigfill}{\renewcommand{\cftdot}{$\diamond$}\cftdotfill{\cftdotsep}}
\setlength{\cftbeforefigskip}{0.1ex} %条目前的间距
\setlength{\cftfigindent}{0em} %条目缩进
\setlength{\cftfignumwidth}{2.5em} %条目标签宽度
\renewcommand{\cftfigfont}{\color{gbemphcolor}\zihao{-5}} %条目样式\heiti
\renewcommand{\cftfigpresnum}{图} %条目数字前的内容
\renewcommand{\cftfigaftersnum}{ } %条目数字后的内容
\renewcommand{\cftfigaftersnumb}{~} %条目数字后的第二个内容
%\renewcommand{\cftfigdotsep}{\cftdotsep} %连接符之间的宽度
%\renewcommand{\cftfigleader}{\bfseries\cftfigfill} %连接符粘连团
%\renewcommand{\cftfigpagefont}{\color{red}\zihao{-5}$\diamond$\itshape} %页码的样式
%\renewcommand{\cftfigafterpnum}{\color{red}$\diamond$} %页码后内容
\renewcommand{\cftfigpagefont}{\bfseries\zihao{-5}} %页码的样式
%−−−−−−−−−−设置table条目样式−−−−−−−−−−−−−−−−−−−−−−
%\newcommand{\cfttabfill}{\renewcommand{\cftdot}{$\infty$}\cftdotfill{\cftdotsep}}
\setlength{\cftbeforetabskip}{0.1ex} %条目前的间距
\setlength{\cfttabindent}{0em} %条目缩进
\setlength{\cfttabnumwidth}{2.5em} %条目标签宽度
\renewcommand{\cfttabfont}{\color{gbemphcolor}\zihao{-5}} %条目样式
\renewcommand{\cfttabpresnum}{表} %条目数字前的内容
\renewcommand{\cfttabaftersnum}{ } %条目数字后的内容
\renewcommand{\cfttabaftersnumb}{~} %条目数字后的第二个内容
%\renewcommand{\cfttabdotsep}{\cftdotsep} %连接符之间的宽度
%\renewcommand{\cfttableader}{\bfseries\cfttabfill} %连接符粘连团
%\renewcommand{\cfttabpagefont}{\color{red}\zihao{-5}$\infty$\itshape} %页码的样式
%\renewcommand{\cfttabafterpnum}{\color{red}$\infty$} %页码后内容
\renewcommand{\cfttabpagefont}{\bfseries\zihao{-5}} %页码的样式
\usepackage{pdfpages}%直接插入pdf文件页
\graphicspath{{egfigure/}{example/}}
%代码环境设置
\usepackage{listings}
\usepackage{tikz,pgf}
\usetikzlibrary{calc}
\newenvironment{example}[3][{\footnotesize\faFileCodeO}]%
{\list{}{\begingroup\codecaption{#2}\label{#3}\endgroup
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
\setlength{\itemsep}{0pt}
\setlength{\parsep}{0pt}
\setlength{\leftmargin}{0pt}%
\setlength{\itemindent}{0pt}%
%\renewcommand*{\makelabel}[1]{\hss\llap{\footnotesize\color{orange}\bfseries##1}}
}\item[\footnotesize\color{gblabelcolor}\bfseries#1]\relax}
{\endlist}
\lstnewenvironment{texlist}%
{\lstset{% general command to set parameter(s)
%name=#1,
%label=#2,
%caption=\lstname,
linewidth=\linewidth,
breaklines=true,
%showspaces=true,
extendedchars=false,
columns=fullflexible,%flexible,
%aboveskip=2pt,
boxpos=t,
rulesep=0pt,
frame=t,
framesep=0pt,
rulecolor=\color{gblabelcolor},
fontadjust=true,
language=[LaTeX]TeX,
backgroundcolor=\color{gbyellow!3},%\color{yellow}, %背景颜色
%numbers=left,
numberstyle=\tiny\color{gblabelcolor},
basicstyle=\footnotesize\ttfamily, % print whole listing small
keywordstyle=\bfseries\color{gbemphcolor},%\underbar,
% underlined bold black keywords
identifierstyle=, % nothing happens
commentstyle=\color{OliveGreen}, % white comments
stringstyle=\ttfamily\color{purple!50}, % typewriter type for strings
showstringspaces=false}% no special string spaces
}
{}
%定理环境设置
\usepackage[listings,theorems,most]{tcolorbox}
\tcbuselibrary{breakable}
\newcounter{myprop}\def\themyprop{\arabic{myprop}}
%一个强调显示
\newcommand{\bibliofmt}[1]{\medskip\textcolor{gbforestgreen}{\heiti#1}}
%序号如果带章节的话可以改为比如:\thesection.\arabic{myprop}
\newtcbtheorem{property}{方法}
{enhanced jigsaw,breakable,pad at break*=1mm,left=2em,boxsep=0pt,
%colback=gray!5,colframe=gbforestgreen,
colback=gray!5,boxrule=0pt,frame hidden,coltitle=gborange,
borderline west={1.5mm}{-2mm}{gbforestgreen},
theorem style=plain,fonttitle=\bfseries\heiti,arc=0mm,
%separator sign={\ $\blacktriangleright$},breakable,
%theorem style=plain,fonttitle=\bfseries\upshape, fontupper=\slshape,boxrule=0mm,arc=0mm,
%coltitle=black,colback=green!50!yellow!15!white,colframe=blue!50,%
%description delimiters={}{},
%terminator sign={\ }
}{pp}
%最后一个必须参数是prefix用来做label比如这里是pp:加上给出的标签名
\newtcbtheorem[]{refentry}{条目类型}
{breakable,pad at break*=1mm,enhanced jigsaw,left=2em,boxsep=0pt,
colback=yellow!10!white,boxrule=0pt,frame hidden,
borderline west={1.5mm}{-2mm}{gbforestgreen},
separator sign={\ $\blacktriangleright$},terminator sign={\ },
theorem style=plain,fonttitle=\bfseries\heiti,coltitle=gbforestgreen
%fontupper=\normalsize,boxrule=0mm,arc=0mm,breakable,
%coltitle=green!35!black,colbacktitle=green!15!white,
%colback=green!50!yellow!15!white,terminator sign={\ }
}{rfeg}
%最后一个必须参数是prefix用来做label比如这里是rfeg:加上给出的标签名
%标题区命令设置
\newcommand{\titleformanual}[1]{\def\biaotiudf{#1}}
\newcommand{\authorformanual}[1]{\def\zuozheudf{#1}}
\newcommand{\dateformanual}[1]{\def\riqiudf{#1}}
%\ifthenelse{\equal{\youwuudf}{\temp}}{true}{false}
\def\temp{}
\makeatletter
\newcommand{\titleandauthor}{
\begin{center}
\def\@makefnmark{\hbox{\@textsuperscript{\small\@thefnmark}}}
{\setlength{\baselineskip}{40pt}\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\heiti{\zihao{-2}{\biaotiudf}}\par}%
%注意这里\par要放在花括号内才有效
\setlength{\baselineskip}{0.1cm}
\rule{0pt}{0.5cm}\par
{\renewcommand{\thefootnote}{\arabic{footnote}}
\kaishu{\zihao{4}{\zuozheudf}}\par}
\rule{0pt}{0.3cm}\par
{\songti{\zihao{-4}{\riqiudf}}\par}
\end{center}
}
\makeatother
%脚注的数字带圈使用gb7714-2015中的重定义实现
%\renewcommand{\thefootnote}{\textcircled{\tiny\arabic{footnote}}}
%--------------列表环境---------------------------------------------
\usepackage[inline]{enumitem} %重设list环境
\setlist[enumerate]{label=\textbf{(\arabic*)},topsep=2pt,partopsep=0pt,parsep=0pt,%
align=left,leftmargin=0em,itemsep=0.5em,labelwidth=0.1em,itemindent=2.6em,listparindent=2em}%label=$\triangleright$,itemindent=1em
\setlist[itemize]{topsep=2pt,partopsep=0pt,parsep=0pt,%
leftmargin=3em,itemindent=0em}
\setlist[description]{font=\bfseries\textcolor{gblabelcolor},align=right,topsep=5pt,partopsep=0pt,parsep=0pt,%
itemsep=0pt,leftmargin=0em,itemindent=0em}%注意,font或format中的最后一个命令自动提取标签为其参数
\usepackage{longtable}
%自定义下划红线和背景颜色
\usepackage{ulem}
\newcommand\yellowback{\bgroup\markoverwith
{\textcolor{yellow}{\rule[-0.5ex]{2pt}{2.5ex}}}\ULon}
\newcommand\reduline{\bgroup\markoverwith
{\textcolor{red}{\rule[-0.5ex]{2pt}{0.4pt}}}\ULon}
%一些字符串格式化命令
\newcommand*{\verbatimfont}{\ttfamily}
\newrobustcmd*{\cnt}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\bibfield}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\opt}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\prm}[1]{%
\ifblank{#1}
{}
{\mbox{%
\ensuremath\langle
\normalfont\textit{#1}%
\ensuremath\rangle}}}
\usepackage{amssymb}
\newcommand{\HandRight}{$\bigstar$}
\newcommand{\zhongdian}[1]{\textcolor{gbemphcolor}{\HandRight\small\heiti#1}}
\newcommand{\pz}[1]{%定义pz为旁注命令
\marginpar[\flushright\small\youyuan\color{gbemphcolor}\footnotesize #1]{\kaiti\color{gbemphcolor}\small #1}}
\newcommand{\PZ}[1]{%定义pz为旁注命令
\marginpar[\flushright\small\youyuan\color{gbemphcolor}\footnotesize #1]{\kaiti\color{gbemphcolor}\small #1}}
\newcommand{\qd}[1]{%定义qd为强调命令
\begin{quote}
\fangsong\color{gbemphcolor}#1%blue!50!black\fangsong
\end{quote}}
\newcommand{\QD}[1]{%定义qd为强调命令
\begin{quote}
\fangsong\color{gbemphcolor}#1
\end{quote}}
\long\def\bc#1{%定义补充信息
{\kaiti\color{gbemphcolor}#1}} %orange,brown,purple,teal,gbblue,olive,cyan
\long\def\BC#1{%定义补充信息
{\youyuan\color{gbemphcolor}#1}}
\newcommand{\zd}[1]{%定义补充信息
{\kaiti\color{gbemphcolor}#1}} %orange,brown,purple,teal,gbblue,olive,cyan
\newcommand{\ZD}[1]{%定义补充信息
{\kaiti\color{gbemphcolor}#1}}
\newenvironment*{marglist}
{\list{}{\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
\setlength{\itemsep}{0pt}
\setlength{\parsep}{0pt}
\setlength{\leftmargin}{0pt}%
\setlength{\itemindent}{0pt}%
\renewcommand*{\makelabel}[1]{\hss\llap{\footnotesize\color{gblabelcolor}\bfseries##1}}}}
{\endlist}
\makeatletter
\newcommand{\updateinfo}[2][\@empty]{%
\par\small\addvspace{2ex plus 1ex}%
\noindent{\color{gblabelcolor}\rule{\linewidth}{2pt}}
\vskip -\parskip
\ifx\@empty#1 \begin{marglist} \item #2\end{marglist}
\else \begin{marglist} \item[#1] #2\end{marglist} \fi}
\makeatother
%\usepackage{filecontents}
%% 问答环境参考文献
%\NewDocumentEnvironment { reference } { }
% {
% \skip_vertical:n { 2 ex }
% \small
% \noindent \textsf{ 参考文献 } \marginpar { \raggedleft \faBook }
% \enumerate [ topsep = 0pt ]
% % \ignorespaces
% }
% { \endenumerate }
%
%\NewDocumentEnvironment { note } { }
% {
% \skip_vertical:n { 2 ex }
% \small
% \noindent \textsf{ 注意 } \marginpar { \raggedleft \faWarning }
% \par
% % \ignorespaces
% }
% { }