summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/njustthesis/njustthesis.dtx
blob: 1a7180ec0fc61ce1834a88fffaca46da1d07cb04 (plain)
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
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
% \iffalse
%<*driver>
\ProvidesFile{njustthesis.dtx}[2022-03-04 0.0.1]
\documentclass{ltxdoc}
\usepackage{hypdoc}
\usepackage[scheme=plain]{ctex}
\usepackage[citations, definitionLists, fencedCode, footnotes, hashEnumerators,
html, inlineFootnotes, pipeTables, tableCaptions]{markdown}
\EnableCrossrefs%
\CodelineIndex%
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
% \title{njustthesis 0.0.1}
% \author{wzy}
% \maketitle
% \tableofcontents
% \IfFileExists{./README.md}{\markdownInput{README.md}}{}
% \IndexPrologue{\section{\indexname}}
% \StopEventually{\PrintIndex}
% \appendix
% \section{Implement}%
% \label{sec:Implement}
%    \begin{macrocode}
%<*cls|sty>
% Fakechapter information
\@ifundefined{NeedsTeXFormat}{% 2.09 version
%<cls>  \def\filename{njustthesis.cls}
%<sty>  \def\filename{njustthesis.sty}
  \def\filedate{2022-03-04}
  \def\fileversion{0.0.1}
  \typeout{Package: `\filename' \fileversion<\filedate>}
}{% 2e version
  \NeedsTeXFormat{LaTeX2e}[1994/12/01]
  \ProvidesClass{njustthesis}[2022-03-04 0.0.1]
}

% Fakechapter kvset
\RequirePackage{kvdefinekeys}
\RequirePackage{kvsetkeys}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{%
  family = njust,
  prefix = njust@,
  setkeys = \kvsetkeys,
}
\newcommand\njustsetup{%
  \kvsetkeys{njust}
}
\newcommand\njust@define@key[1]{%
  \kvsetkeys{njust@key}{#1}
}
\newcommand\njust@error[1]{%
%<cls> \ClassError{njustthesis}{#1}{}
}
\kv@set@family@handler{njust@key}{%
  \@namedef{njust@#1@@name}{#1}
  \def\njust@@default{}
  \def\njust@@choices{}
  \kv@define@key{njust@value}{name}{%
    \@namedef{njust@#1@@name}{##1}
  }
  \kv@define@key{njust@value}{code}{%
  \@namedef{njust@#1@@code}{##1}
  }
  \@namedef{njust@#1@@check}{}
  \@namedef{njust@#1@@code}{}
  \@namedef{njust@#1@@hook}{%
    \expandafter
    \ifx\csname\@currname.\@currext-h@@k\endcsname\relax
      \@nameuse{njust@#1@@code}
    \else
      \AtEndOfClass{%
        \@nameuse{njust@#1@@code}
      }
    \fi
  }
  \kv@define@key{njust@value}{choices}{%
    \def\njust@@choices{##1}
    \@namedef{njust@#1@@reset}{}
    \@namedef{njust@#1@@check}{%
      \@ifundefined{%
        ifnjust@\@nameuse{njust@#1@@name}@\@nameuse{njust@\@nameuse{njust@#1@@name}}
      }{%
        \njust@error{Invalid value ``#1 = \@nameuse{njust@\@nameuse{njust@#1@@name}}''}
      }
      \@nameuse{njust@#1@@reset}
      \@nameuse{njust@\@nameuse{njust@#1@@name}@\@nameuse{njust@\@nameuse{njust@#1@@name}}true}
    }
  }
  \kv@define@key{njust@value}{default}{%
    \def\njust@@default{##1}
  }
  \kvsetkeys{njust@value}{#2}
  \@namedef{njust@\@nameuse{njust@#1@@name}}{}
  \kv@set@family@handler{njust@choice}{%
    \ifx\njust@@default\@empty
      \def\njust@@default{##1}
    \fi
    \expandafter\newif\csname ifnjust@\@nameuse{njust@#1@@name}@##1\endcsname
    \expandafter\g@addto@macro\csname njust@#1@@reset\endcsname{%
      \@nameuse{njust@\@nameuse{njust@#1@@name}@##1false}
    }
  }
  \kvsetkeys@expandafter{njust@choice}{\njust@@choices}
  \expandafter\let\csname njust@\@nameuse{njust@#1@@name}\endcsname\njust@@default
  \expandafter
  \ifx\csname njust@\@nameuse{njust@#1@@name}\endcsname\@empty
  \else
    \@nameuse{njust@#1@@check}
    \@nameuse{njust@#1@@hook}
  \fi
  \kv@define@key{njust}{#1}{%
    \@namedef{njust@\@nameuse{njust@#1@@name}}{##1}
    \@nameuse{njust@#1@@check}
    \@nameuse{njust@#1@@hook}
  }
}
\newcommand\njust@addto[2]{%
  \expandafter\g@addto@macro\csname njust@#1@@code\endcsname{#2}
}

% Fakechapter default
\njust@define@key{%
  logo = {%
    default = \njustwhole[njust][0.5],
  },
  cover-title = {%
    name = cover@title,
    default = {毕业设计说明书},
  },
  author = {%
    default = {佚名},
  },
  id = {%
    default = {916101630000},
  },
  department = {%
    default = {电子工程与光电技术学院},
  },
  discipline = {%
    default = {电子工程与光电技术},
  },
  title = {%
  },
  subtitle = {%
  },
  supervisor = {%
    default = {张三},
  },
  associate-supervisor = {%
    name = associate@supervisor,
  },
  judge = {%
    default = {王五},
  },
  supervisor-title = {%
    name = supervisor@title,
    default = {教授},
  },
  associate-supervisor-title = {%
    name = associate@supervisor@title,
  },
  judge-title = {%
    name = judge@title,
    default = {教授},
  },
  year = {%
    default = \the\year,
  },
  month = {%
    default = \the\month,
  },
  day = {%
    default = \the\day,
  },
  signature = {%
    default = \makebox[4em]{},
  },
  signature* = {%
    name = signature@teacher,
    default = \makebox[4em]{},
  },
  abstract-prefix = {%
    name = abstract@prefix,
    default = {毕业论文},
  },
  title* = {%
    name = title@en,
  },
  subtitle* = {%
    name = subtitle@en,
  },
  header-title = {%
    name = header@title,
    default = {本科毕业设计说明书},
  },
}
%</cls|sty>

%<*cls>
% Fakechapter class
\ProcessKeyvalOptions*
\LoadClass[
  twoside,
  openright,
  UTF8,
  heading = true,
  scheme = plain,
  zihao = -4,
  sub4section,
]{ctexbook}
\ctexset{%
  today = small,
  chapter = {%
    name = {},
    number = \arabic{chapter},
    aftername = \hspace{1\ccwd},
    format = \ifthenelse{\value{chapter}=0}{\centering}{}
    \zihao{3}\heiti\bfseries,
    beforeskip = 0.5\ccwd,
    afterskip = 0.5\ccwd,
  },
  section = {%
    aftername = \hspace{1\ccwd},
    format = \ifthenelse{\value{chapter}=0}{\centering}{}
    \zihao{-3}\heiti\bfseries,
    beforeskip = 0.5\ccwd,
    afterskip = 0.5\ccwd,
  },
  subsection = {%
    format = \zihao{4}\heiti\bfseries,
  },
  appendixname = 附录,
  contentsname = {目\hspace{\ccwd}次},
  listfigurename = 插图索引,
  listtablename = 表格索引,
  figurename = 图,
  tablename = 表,
  bibname = 参考文献,
  indexname = 索引,
}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\counterwithout{equation}{chapter}

% Fakechapter package
% Fakesection text
% Fakesubsection punctuation
\RequirePackage{csquotes}
% Fakesubsubsection 中文引号
\DeclareQuoteStyle{zh}
{\symbol{"201C}}%“
{\symbol{"201D}}%”
{\symbol{"2018}}%‘
{\symbol{"2019}}%’
\setquotestyle{zh}
% Fakesubsubsection 日文引号
\DeclareQuoteStyle{ja}
{\symbol{"300E}}%『
{\symbol{"300F}}%』
{\symbol{"300C}}%「
{\symbol{"300D}}%」
% Fakesubsubsection 书名号
\DeclareQuoteStyle{book}
{\symbol{"300A}}%《
{\symbol{"300B}}%》
{\symbol{"3008}}%〈
{\symbol{"3009}}%〉
% Fakesubsection indent
\RequirePackage{indentfirst}
% Fakesubsection space
\RequirePackage{setspace}

% Fakesection style
% Fakesubsection toc
\RequirePackage{titletoc}
\titlecontents{chapter}[0pt]{\filright}{\contentspush{\thecontentslabel}}{}
{\titlerule*{.}\contentspage}
\RequirePackage[nottoc]{tocbibind}
% Fakesubsection header
\RequirePackage{fancyhdr}
\fancypagestyle{njust@fancy}{%
  \renewcommand{\headrulewidth}{0.4pt}
  \fancyhead[OC, EC]{\zihao{-2}\njust@header@title}
  \fancyhead[EL, OR]{\zihao{5}第\thepage~页}
  \fancyhead[ER, OL]{}
  \fancyfoot[EC, OC]{}
}
\fancypagestyle{plain}{%
  \pagestyle{njust@fancy}
}
\pagestyle{njust@fancy}

% Fakesubsection footnote
\RequirePackage{pifont}
\RequirePackage[
  perpage,
  symbol*
]{footmisc}
\DefineFNsymbols{circled}{%
  {\ding{192}}
  {\ding{193}}
  {\ding{194}}
  {\ding{195}}
  {\ding{196}}
  {\ding{197}}
  {\ding{198}}
  {\ding{199}}
  {\ding{200}}
  {\ding{201}}
}
\setfnsymbol{circled}
% Fakesubsection reference
\RequirePackage[
  square, comma, numbers, super, sort&compress, longnamesfirst, sectionbib,
  nonamebreak
]{natbib}
\bibliographystyle{gbt7714-plain}

% Fakesection figure
\RequirePackage{graphicx}
\graphicspath{%
  {fig/}
  {fig/\arabic{chapter}/}
  {figures/}
  {figures/\arabic{chapter}/}
  {images/}
}
\RequirePackage[njust]{cnlogo}

% Fakesection formula

% Fakesection table
\RequirePackage{tabu}
\RequirePackage{multicol}

% Fakesubsection math
\RequirePackage{newtxmath}
\setlength{\abovedisplayskip}{0.5em}
\setlength{\belowdisplayskip}{0.5em}
% Fakesubsection exercise
\RequirePackage{exercise}
\renewcommand{\ExerciseName}{问题}
\renewcommand{\AnswerName}{回答}
\renewcommand{\listexercisename}{问题}

% Fakesection item
\RequirePackage{enumitem}
\setlist[enumerate, 1]{%
  fullwidth,
  label = (\arabic*),
  font = \textup,
  itemindent = 2em,
}
\setlist[enumerate, 2]{%
  fullwidth,
  label = (\alph*),
  font = \textup,
  itemindent = 4em,
}

% Fakesection other
\RequirePackage{boxedminipage}

\title{\njust@title}
\author{\njust@author}

% Fakechapter command
\renewcommand\maketitle{%
  \thispagestyle{empty}
  \begin{titlepage}
    \centering
    \begin{spacing}{1}
      \zihao{4}
      \vspace{0.5\ccwd}

      \vspace{1\ccwd}

      \fontsize{30pt}{30pt}\selectfont\kaishu%
      \njust@logo

      \vspace{0.2\ccwd}

      \fontsize{45pt}{45pt}\selectfont\heiti%
      \njust@cover@title

      \zihao{-1}
      \vspace{1\ccwd}
    \end{spacing}

    \begin{spacing}{1.5}
      \zihao{3}
      \begin{tabu}
        {@{}X[r, 5cm]@{}X[l, 3cm]
        X[r, 4cm]@{}X[l, 4cm]@{}}
        \textbf{作   者:} &
        \underline{\makebox[3cm][c]{\kaishu\njust@author}} &
        \textbf{学  号:} &
        \underline{\makebox[4cm][c]{\kaishu\njust@id}} \\
        \textbf{学   院:} &
        \multicolumn{3}{c}{\underline{\makebox[11cm][c]
        {\kaishu\njust@department}}} \\
        \textbf{专业(方向):} &
        \multicolumn{3}{c}{
          \underline{\makebox[11cm][c]{\kaishu\njust@discipline}}} \\
        \textbf{题   目:} &
        \multicolumn{3}{c}{
          \underline{\makebox[11cm][c]{\kaishu\njust@title}}} \\
        \textbf{} &
        \multicolumn{3}{c}{
          \underline{\makebox[11cm][c]{\kaishu\njust@subtitle}}}
      \end{tabu}
      \vspace{0em}
    \end{spacing}

    \begin{spacing}{1}
      \zihao{3}
      \vspace{1\ccwd}

      \zihao{-3}
      \textbf{指导者:}\underline{\makebox[15.5\ccwd][c]{\njust@supervisor\hspace{1em}\njust@supervisor@title}}

      \hspace{5em}

      \phantom{指导者:}\underline{\makebox[15.5\ccwd][c]{\njust@associate@supervisor\hspace{1em}\njust@associate@supervisor@title}}

      \hspace{5em}

      \textbf{评阅者:}\underline{\makebox[15.5\ccwd][c]{\njust@judge\hspace{1em}\njust@judge@title}}

      \hspace{5em}

      \zihao{-2}
      \njust@year 年\njust@month 月
    \end{spacing}
    \vspace{0em}
  \end{titlepage}
}

\newcommand\copyrightpage{%
  \newpage
  \thispagestyle{empty}
  \begin{center}
    \heiti\zihao{3}声\hspace{2\ccwd}明
  \end{center}

  \begin{spacing}{1.5}
    \zihao{4}

    我声明,本\njust@abstract@prefix 及其研究工作和所取得的成果是本人在导师的指导
    下独立完成的。研究过程中利用的所有资料均已在参考文献中列出,其他人员或机
    构对本\njust@abstract@prefix 工作做出的贡献也已在致谢部分说明。

    本\njust@abstract@prefix 不涉及任何秘密,南京理工大学有权保存其电子和纸质文档
    ,可以借阅或网上公布其部分或全部内容,可以向有关部门或机构送交并授权保存
    、借阅或网上公布其部分或全部内容。

    \vspace{2\ccwd}

    \begin{flushright}
      学生签名:\njust@signature

      \vspace{1\ccwd}

      \njust@year 年\njust@month 月\njust@day 日

      \vspace{2\ccwd}

      指导教师签名:\njust@signature@teacher

      \vspace{1\ccwd}

      \njust@year 年\njust@month 月\njust@day 日
    \end{flushright}
  \end{spacing}
  \clearpage
}

\newcommand\reviewpage{%
  \begin{tabu}to.75\linewidth{@{}|X[l]|X[l]|@{}}
    \hline
    论文选题符合课程考核要求,具有一定的理论意义和实用价值,作者阅读较广泛,参考文献较充足。
&
\begin{tabu}{@{}X[l]@{}}
  很好$ \square $ 较好$ \square $

  一般$ \square $ 尚可$ \square $

  差$ \square $
\end{tabu}

\hline
论文观点正确,结构较合理,层次较清晰,逻辑性强,论述较全面,工作量较充实,结论具有一定的现实指导意义。
&
\begin{tabu}{@{}X[l]@{}}
  很好$ \square $ 较好$ \square $

  一般$ \square $ 尚可$ \square $

  差$ \square $
\end{tabu}

\hline
该生平时学习较认真,善于思考,到课率高,不迟到早退。文章语言表达较好,格
式符合规范要求,体现了较好的学风。
&
\begin{tabu}{@{}X[l]@{}}
  很好$ \square $ 较好$ \square $

  一般$ \square $ 尚可$ \square $

  差$ \square $
\end{tabu}

\hline
\begin{tabu}{@{}X[l]@{}}
  教师签名:

  年~月~日
\end{tabu}
&

\hline
  \end{tabu}

  \begin{flushleft}
    \makebox[5\ccwd][c]{}注:请将该封面与论文装订成册(论文双面打印)。
  \end{flushleft}$0

  \begin{boxedminipage}{\linewidth}
    \zihao{4}

    任课老师评语:

    \vspace{40mm}

    \begin{flushright}
      签名: \underline{\makebox[6\ccwd][c]{}}

      年\makebox[2\ccwd][c]{}月\makebox[2\ccwd][c]{}日
    \end{flushright}

    \vspace{20mm}

  \end{boxedminipage}
  \clearpage
}

% Fakechapter environment
\newenvironment{abstract}{%
  \newpage
  \thispagestyle{empty}
  \centering
  \zihao{3}{\ziju{0.5}\heiti\njust@abstract@prefix
  中文摘要}

  \vspace{0.3em}

  \begin{boxedminipage}[][18cm]{\linewidth}
    \begin{spacing}{1.5}
      \zihao{-4}

      \vspace{1\ccwd}

}{%
    \end{spacing}
  \end{boxedminipage}
}

\newenvironment{abstract*}{%
  \newpage
  \thispagestyle{empty}
  \centering
  \zihao{3}\ziju{0.5}\heiti\njust@abstract@prefix
  英文摘要

  \vspace{0.3em}

  \begin{boxedminipage}[][18cm]{\linewidth}
    \begin{spacing}{1}
      \zihao{4}

      \vspace{1em}

      \begin{tabu} to \linewidth{@{}X[l]@{}X[l, 8]@{}}
        \textbf{Title} &
        \hspace{2em}\underline{
          \makebox[15em][c]{\zihao{4}\njust@title@en}} \\
        \phantom{Title} &
        \hspace{2em}\underline{
          \makebox[15em][c]{\zihao{4}\njust@subtitle@en}} \\
      \end{tabu}

      \textbf{Abstract}

      \zihao{-4}

      \vspace{2em}

}{%
    \end{spacing}
  \end{boxedminipage}
}

\newenvironment{keyword}{%
  \vspace{1em}
  \noindent\textbf{关键词}\hspace{1\ccwd}
}{%
}

\newenvironment{keyword*}{%
  \vspace{1em}
  \noindent\textbf{Keywords}\hspace{1em}
}{%
}

\newenvironment{acknowledgement}{%
  \newpage
  \begin{center}
    \zihao{3}致谢
  \end{center}

}{%
}
%</cls>

%<*cls|sty>
\endinput
%</cls|sty>
%    \end{macrocode}
% \IfFileExists{./CHANGELOG.md}{\markdownInput{CHANGELOG.md}}{}
% \Finale