diff --git a/.gitignore b/.gitignore
index 7c70e991..ec1a0a6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -110,6 +110,9 @@ acs-*.bib
*.gaux
*.gtex
+# hypdoc
+*.hd
+
# hyperref
*.brf
@@ -247,6 +250,5 @@ ehthumbs_vista.db
[Dd]esktop.ini
# Project specific
-sjtuthesis.pdf
thesis.pdf
thesis-bot.yml
diff --git a/.latexmkrc b/.latexmkrc
index 6b90496f..f8dd8eca 100644
--- a/.latexmkrc
+++ b/.latexmkrc
@@ -7,5 +7,15 @@ $pdf_mode = 5;
# $biber = 'biber -l zh__pinyin %O %S';
# $biber = 'biber -l zh__stroke %O %S';
+# Process index.
+$makeindex = 'makeindex -s gind.ist %O -o %D %S';
+
+# Process glossary (change history).
+add_cus_dep('glo', 'gls', 0, 'makeglo2gls');
+sub makeglo2gls {
+ system("makeindex -s gglo.ist -o \"$_[0].gls\" \"$_[0].glo\"");
+}
+push @generated_exts, "glo", "gls";
+
# Files to clean.
-$clean_ext = 'bbl loa run.xml xdv';
+$clean_ext = 'bbl hd loa run.xml thm xdv';
diff --git a/LICENSE b/LICENSE
index 27e78b55..22443139 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,201 +1,416 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {2015} {Jianwen Wei}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+The LaTeX Project Public License
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+LPPL Version 1.3c 2008-05-04
+
+Copyright 1999 2002-2008 LaTeX3 Project
+ Everyone is allowed to distribute verbatim copies of this
+ license document, but modification of it is not allowed.
+
+
+PREAMBLE
+========
+
+The LaTeX Project Public License (LPPL) is the primary license under
+which the LaTeX kernel and the base LaTeX packages are distributed.
+
+You may use this license for any work of which you hold the copyright
+and which you wish to distribute. This license may be particularly
+suitable if your work is TeX-related (such as a LaTeX package), but
+it is written in such a way that you can use it even if your work is
+unrelated to TeX.
+
+The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE',
+below, gives instructions, examples, and recommendations for authors
+who are considering distributing their works under this license.
+
+This license gives conditions under which a work may be distributed
+and modified, as well as conditions under which modified versions of
+that work may be distributed.
+
+We, the LaTeX3 Project, believe that the conditions below give you
+the freedom to make and distribute modified versions of your work
+that conform with whatever technical specifications you wish while
+maintaining the availability, integrity, and reliability of
+that work. If you do not see how to achieve your goal while
+meeting these conditions, then read the document `cfgguide.tex'
+and `modguide.tex' in the base LaTeX distribution for suggestions.
+
+
+DEFINITIONS
+===========
+
+In this license document the following terms are used:
+
+ `Work'
+ Any work being distributed under this License.
+
+ `Derived Work'
+ Any work that under any applicable law is derived from the Work.
+
+ `Modification'
+ Any procedure that produces a Derived Work under any applicable
+ law -- for example, the production of a file containing an
+ original file associated with the Work or a significant portion of
+ such a file, either verbatim or with modifications and/or
+ translated into another language.
+
+ `Modify'
+ To apply any procedure that produces a Derived Work under any
+ applicable law.
+
+ `Distribution'
+ Making copies of the Work available from one person to another, in
+ whole or in part. Distribution includes (but is not limited to)
+ making any electronic components of the Work accessible by
+ file transfer protocols such as FTP or HTTP or by shared file
+ systems such as Sun's Network File System (NFS).
+
+ `Compiled Work'
+ A version of the Work that has been processed into a form where it
+ is directly usable on a computer system. This processing may
+ include using installation facilities provided by the Work,
+ transformations of the Work, copying of components of the Work, or
+ other activities. Note that modification of any installation
+ facilities provided by the Work constitutes modification of the Work.
+
+ `Current Maintainer'
+ A person or persons nominated as such within the Work. If there is
+ no such explicit nomination then it is the `Copyright Holder' under
+ any applicable law.
+
+ `Base Interpreter'
+ A program or process that is normally needed for running or
+ interpreting a part or the whole of the Work.
+
+ A Base Interpreter may depend on external components but these
+ are not considered part of the Base Interpreter provided that each
+ external component clearly identifies itself whenever it is used
+ interactively. Unless explicitly specified when applying the
+ license to the Work, the only applicable Base Interpreter is a
+ `LaTeX-Format' or in the case of files belonging to the
+ `LaTeX-format' a program implementing the `TeX language'.
+
+
+
+CONDITIONS ON DISTRIBUTION AND MODIFICATION
+===========================================
+
+1. Activities other than distribution and/or modification of the Work
+are not covered by this license; they are outside its scope. In
+particular, the act of running the Work is not restricted and no
+requirements are made concerning any offers of support for the Work.
+
+2. You may distribute a complete, unmodified copy of the Work as you
+received it. Distribution of only part of the Work is considered
+modification of the Work, and no right to distribute such a Derived
+Work may be assumed under the terms of this clause.
+
+3. You may distribute a Compiled Work that has been generated from a
+complete, unmodified copy of the Work as distributed under Clause 2
+above, as long as that Compiled Work is distributed in such a way that
+the recipients may install the Compiled Work on their system exactly
+as it would have been installed if they generated a Compiled Work
+directly from the Work.
+
+4. If you are the Current Maintainer of the Work, you may, without
+restriction, modify the Work, thus creating a Derived Work. You may
+also distribute the Derived Work without restriction, including
+Compiled Works generated from the Derived Work. Derived Works
+distributed in this manner by the Current Maintainer are considered to
+be updated versions of the Work.
+
+5. If you are not the Current Maintainer of the Work, you may modify
+your copy of the Work, thus creating a Derived Work based on the Work,
+and compile this Derived Work, thus creating a Compiled Work based on
+the Derived Work.
+
+6. If you are not the Current Maintainer of the Work, you may
+distribute a Derived Work provided the following conditions are met
+for every component of the Work unless that component clearly states
+in the copyright notice that it is exempt from that condition. Only
+the Current Maintainer is allowed to add such statements of exemption
+to a component of the Work.
+
+ a. If a component of this Derived Work can be a direct replacement
+ for a component of the Work when that component is used with the
+ Base Interpreter, then, wherever this component of the Work
+ identifies itself to the user when used interactively with that
+ Base Interpreter, the replacement component of this Derived Work
+ clearly and unambiguously identifies itself as a modified version
+ of this component to the user when used interactively with that
+ Base Interpreter.
+
+ b. Every component of the Derived Work contains prominent notices
+ detailing the nature of the changes to that component, or a
+ prominent reference to another file that is distributed as part
+ of the Derived Work and that contains a complete and accurate log
+ of the changes.
+
+ c. No information in the Derived Work implies that any persons,
+ including (but not limited to) the authors of the original version
+ of the Work, provide any support, including (but not limited to)
+ the reporting and handling of errors, to recipients of the
+ Derived Work unless those persons have stated explicitly that
+ they do provide such support for the Derived Work.
+
+ d. You distribute at least one of the following with the Derived Work:
+
+ 1. A complete, unmodified copy of the Work;
+ if your distribution of a modified component is made by
+ offering access to copy the modified component from a
+ designated place, then offering equivalent access to copy
+ the Work from the same or some similar place meets this
+ condition, even though third parties are not compelled to
+ copy the Work along with the modified component;
+
+ 2. Information that is sufficient to obtain a complete,
+ unmodified copy of the Work.
+
+7. If you are not the Current Maintainer of the Work, you may
+distribute a Compiled Work generated from a Derived Work, as long as
+the Derived Work is distributed to all recipients of the Compiled
+Work, and as long as the conditions of Clause 6, above, are met with
+regard to the Derived Work.
+
+8. The conditions above are not intended to prohibit, and hence do not
+apply to, the modification, by any method, of any component so that it
+becomes identical to an updated version of that component of the Work as
+it is distributed by the Current Maintainer under Clause 4, above.
+
+9. Distribution of the Work or any Derived Work in an alternative
+format, where the Work or that Derived Work (in whole or in part) is
+then produced by applying some process to that format, does not relax or
+nullify any sections of this license as they pertain to the results of
+applying that process.
+
+10. a. A Derived Work may be distributed under a different license
+ provided that license itself honors the conditions listed in
+ Clause 6 above, in regard to the Work, though it does not have
+ to honor the rest of the conditions in this license.
+
+ b. If a Derived Work is distributed under a different license, that
+ Derived Work must provide sufficient documentation as part of
+ itself to allow each recipient of that Derived Work to honor the
+ restrictions in Clause 6 above, concerning changes from the Work.
+
+11. This license places no restrictions on works that are unrelated to
+the Work, nor does this license place any restrictions on aggregating
+such works with the Work by any means.
+
+12. Nothing in this license is intended to, or may be used to, prevent
+complete compliance by all parties with all applicable laws.
+
+
+NO WARRANTY
+===========
+
+There is no warranty for the Work. Except when otherwise stated in
+writing, the Copyright Holder provides the Work `as is', without
+warranty of any kind, either expressed or implied, including, but not
+limited to, the implied warranties of merchantability and fitness for a
+particular purpose. The entire risk as to the quality and performance
+of the Work is with you. Should the Work prove defective, you assume
+the cost of all necessary servicing, repair, or correction.
+
+In no event unless required by applicable law or agreed to in writing
+will The Copyright Holder, or any author named in the components of the
+Work, or any other party who may distribute and/or modify the Work as
+permitted above, be liable to you for damages, including any general,
+special, incidental or consequential damages arising out of any use of
+the Work or out of inability to use the Work (including, but not limited
+to, loss of data, data being rendered inaccurate, or losses sustained by
+anyone as a result of any failure of the Work to operate with any other
+programs), even if the Copyright Holder or said author or said other
+party has been advised of the possibility of such damages.
+
+
+MAINTENANCE OF THE WORK
+=======================
+
+The Work has the status `author-maintained' if the Copyright Holder
+explicitly and prominently states near the primary copyright notice in
+the Work that the Work can only be maintained by the Copyright Holder
+or simply that it is `author-maintained'.
+
+The Work has the status `maintained' if there is a Current Maintainer
+who has indicated in the Work that they are willing to receive error
+reports for the Work (for example, by supplying a valid e-mail
+address). It is not required for the Current Maintainer to acknowledge
+or act upon these error reports.
+
+The Work changes from status `maintained' to `unmaintained' if there
+is no Current Maintainer, or the person stated to be Current
+Maintainer of the work cannot be reached through the indicated means
+of communication for a period of six months, and there are no other
+significant signs of active maintenance.
+
+You can become the Current Maintainer of the Work by agreement with
+any existing Current Maintainer to take over this role.
+
+If the Work is unmaintained, you can become the Current Maintainer of
+the Work through the following steps:
+
+ 1. Make a reasonable attempt to trace the Current Maintainer (and
+ the Copyright Holder, if the two differ) through the means of
+ an Internet or similar search.
+
+ 2. If this search is successful, then enquire whether the Work
+ is still maintained.
+
+ a. If it is being maintained, then ask the Current Maintainer
+ to update their communication data within one month.
+
+ b. If the search is unsuccessful or no action to resume active
+ maintenance is taken by the Current Maintainer, then announce
+ within the pertinent community your intention to take over
+ maintenance. (If the Work is a LaTeX work, this could be
+ done, for example, by posting to comp.text.tex.)
+
+ 3a. If the Current Maintainer is reachable and agrees to pass
+ maintenance of the Work to you, then this takes effect
+ immediately upon announcement.
+
+ b. If the Current Maintainer is not reachable and the Copyright
+ Holder agrees that maintenance of the Work be passed to you,
+ then this takes effect immediately upon announcement.
+
+ 4. If you make an `intention announcement' as described in 2b. above
+ and after three months your intention is challenged neither by
+ the Current Maintainer nor by the Copyright Holder nor by other
+ people, then you may arrange for the Work to be changed so as
+ to name you as the (new) Current Maintainer.
+
+ 5. If the previously unreachable Current Maintainer becomes
+ reachable once more within three months of a change completed
+ under the terms of 3b) or 4), then that Current Maintainer must
+ become or remain the Current Maintainer upon request provided
+ they then update their communication data within one month.
+
+A change in the Current Maintainer does not, of itself, alter the fact
+that the Work is distributed under the LPPL license.
+
+If you become the Current Maintainer of the Work, you should
+immediately provide, within the Work, a prominent and unambiguous
+statement of your status as Current Maintainer. You should also
+announce your new status to the same pertinent community as
+in 2b) above.
+
+
+WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE
+======================================================
+
+This section contains important instructions, examples, and
+recommendations for authors who are considering distributing their
+works under this license. These authors are addressed as `you' in
+this section.
+
+Choosing This License or Another License
+----------------------------------------
+
+If for any part of your work you want or need to use *distribution*
+conditions that differ significantly from those in this license, then
+do not refer to this license anywhere in your work but, instead,
+distribute your work under a different license. You may use the text
+of this license as a model for your own license, but your license
+should not refer to the LPPL or otherwise give the impression that
+your work is distributed under the LPPL.
+
+The document `modguide.tex' in the base LaTeX distribution explains
+the motivation behind the conditions of this license. It explains,
+for example, why distributing LaTeX under the GNU General Public
+License (GPL) was considered inappropriate. Even if your work is
+unrelated to LaTeX, the discussion in `modguide.tex' may still be
+relevant, and authors intending to distribute their works under any
+license are encouraged to read it.
+
+A Recommendation on Modification Without Distribution
+-----------------------------------------------------
+
+It is wise never to modify a component of the Work, even for your own
+personal use, without also meeting the above conditions for
+distributing the modified component. While you might intend that such
+modifications will never be distributed, often this will happen by
+accident -- you may forget that you have modified that component; or
+it may not occur to you when allowing others to access the modified
+version that you are thus distributing it and violating the conditions
+of this license in ways that could have legal implications and, worse,
+cause problems for the community. It is therefore usually in your
+best interest to keep your copy of the Work identical with the public
+one. Many works provide ways to control the behavior of that work
+without altering any of its licensed components.
+
+How to Use This License
+-----------------------
+
+To use this license, place in each of the components of your work both
+an explicit copyright notice including your name and the year the work
+was authored and/or last substantially modified. Include also a
+statement that the distribution and/or modification of that
+component is constrained by the conditions in this license.
+
+Here is an example of such a notice and statement:
+
+ %% pig.dtx
+ %% Copyright 2005 M. Y. Name
+ %
+ % This work may be distributed and/or modified under the
+ % conditions of the LaTeX Project Public License, either version 1.3
+ % of this license or (at your option) any later version.
+ % The latest version of this license is in
+ % http://www.latex-project.org/lppl.txt
+ % and version 1.3 or later is part of all distributions of LaTeX
+ % version 2005/12/01 or later.
+ %
+ % This work has the LPPL maintenance status `maintained'.
+ %
+ % The Current Maintainer of this work is M. Y. Name.
+ %
+ % This work consists of the files pig.dtx and pig.ins
+ % and the derived file pig.sty.
+
+Given such a notice and statement in a file, the conditions
+given in this license document would apply, with the `Work' referring
+to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being
+generated from `pig.dtx' using `pig.ins'), the `Base Interpreter'
+referring to any `LaTeX-Format', and both `Copyright Holder' and
+`Current Maintainer' referring to the person `M. Y. Name'.
+
+If you do not want the Maintenance section of LPPL to apply to your
+Work, change `maintained' above into `author-maintained'.
+However, we recommend that you use `maintained', as the Maintenance
+section was added in order to ensure that your Work remains useful to
+the community even when you can no longer maintain and support it
+yourself.
+
+Derived Works That Are Not Replacements
+---------------------------------------
+
+Several clauses of the LPPL specify means to provide reliability and
+stability for the user community. They therefore concern themselves
+with the case that a Derived Work is intended to be used as a
+(compatible or incompatible) replacement of the original Work. If
+this is not the case (e.g., if a few lines of code are reused for a
+completely different task), then clauses 6b and 6d shall not apply.
+
+
+Important Recommendations
+-------------------------
+
+ Defining What Constitutes the Work
+
+ The LPPL requires that distributions of the Work contain all the
+ files of the Work. It is therefore important that you provide a
+ way for the licensee to determine which files constitute the Work.
+ This could, for example, be achieved by explicitly listing all the
+ files of the Work near the copyright notice of each file or by
+ using a line such as:
+
+ % This work consists of all files listed in manifest.txt.
+
+ in that place. In the absence of an unequivocal list it might be
+ impossible for the licensee to determine what is considered by you
+ to comprise the Work and, in such a case, the licensee would be
+ entitled to make reasonable conjectures as to which files comprise
+ the Work.
+
diff --git a/Makefile b/Makefile
index bd1ddfd7..8ccbc040 100644
--- a/Makefile
+++ b/Makefile
@@ -1,31 +1,54 @@
+# Makefile for SJTUThesis
+
+# Basename of thesis
THESIS = thesis
-# TEX, BIB, TEST dir
-TEX_DIR = tex
-BIB_DIR = bib
+PACKAGE = sjtuthesis
+CLSFILES = $(PACKAGE).cls $(PACKAGE)-bachelor.ltx $(PACKAGE)-graduate.ltx
# Option for latexmk
-LATEXMK_OPT_BASE = -xelatex -gg -silent
-LATEXMK_OPT = $(LATEXMK_OPT_BASE) -f
+LATEXMK_OPT = -xelatex -silent -file-line-error -halt-on-error -interaction=nonstopmode
LATEXMK_OPT_PVC = $(LATEXMK_OPT_BASE) -pvc
-all: $(THESIS).pdf
+# make deletion work on Windows
+ifdef SystemRoot
+ RM = del /Q
+ OPEN = start
+else
+ RM = rm -f
+ OPEN = open
+endif
+
+.PHONY : all cls doc pvc validate view viewdoc wordcount cleana cleanall FORCE_MAKE
+
+all : $(THESIS).pdf
+
+cls : $(CLSFILES)
+
+$(CLSFILES) : $(PACKAGE).dtx
+ xetex --interaction=batchmode $<
-.PHONY : all cleanall pvc view wordcount git zip
+doc : $(PACKAGE).pdf
-$(THESIS).pdf : $(THESIS).tex $(TEX_DIR)/*.tex $(BIB_DIR)/*.bib sjtuthesis.cls sjtuthesis.cfg Makefile
- -latexmk $(LATEXMK_OPT) $(THESIS)
+$(PACKAGE).pdf : $(PACKAGE).dtx FORCE_MAKE
+ latexmk $(LATEXMKOPTS) $<
-pvc :
+$(THESIS).pdf : $(THESIS).tex $(CLSFILES) FORCE_MAKE
+ latexmk $(LATEXMKOPTS) $<
+
+pvc : $(THESIS).tex $(CLSFILES)
latexmk $(LATEXMK_OPT_PVC) $(THESIS)
-validate :
+validate : $(THESIS).tex $(CLSFILES)
xelatex -no-pdf -halt-on-error $(THESIS)
biber --debug $(THESIS)
view : $(THESIS).pdf
- open $<
+ $(OPEN) $<
+
+viewdoc : $(PACKAGE).pdf
+ $(OPEN) $<
-wordcount: $(THESIS).tex
+wordcount : $(THESIS).tex
@if grep -v ^% $< | grep -qz '\\documentclass\[[^\[]*english'; then \
texcount $< -inc -char-only | awk '/total/ {getline; print "英文字符数\t\t\t:",$$4}'; \
else \
@@ -34,19 +57,11 @@ wordcount: $(THESIS).tex
@texcount $< -inc -chinese | awk '/total/ {getline; print "总字数(英文单词 + 中文字)\t:",$$4}'
clean :
- -@latexmk -c -silent 2> /dev/null
+ -@latexmk -c -silent $(THESIS).tex 2> /dev/null
+ -@latexmk -c -silent $(PACKAGE).dtx 2> /dev/null
-@rm -f $(TEX_DIR)/*.aux 2> /dev/null || true
cleanall :
- -@latexmk -C -silent 2> /dev/null
+ -@latexmk -C -silent $(THESIS).tex 2> /dev/null
+ -@latexmk -C -silent $(PACKAGE).dtx 2> /dev/null
-@rm -f $(TEX_DIR)/*.aux 2> /dev/null || true
-
-s3 : $(THESIS).pdf
- s3cmd put $< s3://sjtuthesis/README.pdf
-
-git :
- git push --tags github; git push github;
- git push --tags gitlab; git push gitlab;
-
-zip :
- git archive --format zip --output thesis.zip master
diff --git a/README.md b/README.md
index 5a59eca0..5eb1bb9c 100644
--- a/README.md
+++ b/README.md
@@ -6,21 +6,15 @@
[![GitHub Release Date](https://img.shields.io/github/release-date/sjtug/SJTUThesis.svg)](https://github.com/sjtug/SJTUThesis/releases)
[![Join the chat at https://gitter.im/sjtug/SJTUThesis](https://badges.gitter.im/sjtug/SJTUThesis.svg)](https://gitter.im/sjtug/SJTUThesis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-这是为撰写上海交通大学学士、硕士、博士学位论文或课程论文而准备的 XeLaTeX 模板,非官方出品。生成的学位论文文件参见 [README.pdf][README],详细使用说明参见 [SJTUThesis Wiki](https://github.com/sjtug/SJTUThesis/wiki)。
+这是为撰写上海交通大学学士、硕士、博士学位论文或课程论文而准备的 XeLaTeX 模板,非官方出品。使用文档参见 [sjtuthesis.pdf](./docs/sjtuthesis.pdf),详细使用说明参见 [SJTUThesis Wiki](https://github.com/sjtug/SJTUThesis/wiki)。
## 封面展示
-
-
-
-
-
-
## 如何使用
SJTUThesis 共有三种编译方式支持:
@@ -124,7 +118,6 @@ SJTUThesis 是一个由诸多感兴趣的同学一起维护的开源项目,我
## 软件许可证
-上海交通大学校徽图片(`sjtulogo.pdf` 等)的版权归上海交通大学所有。其他部分使用 [Apache License 2.0](LICENSE) 授权。
+上海交通大学校徽图片(`sjtulogo.pdf` 等)的版权归上海交通大学所有。
-[README]: http://sjtug.org/SJTUThesis/README.pdf
-[0.9.5]: https://github.com/sjtug/SJTUThesis/releases/tag/0.9.5
+其他部分使用 [LPPL](LICENSE) 授权。
diff --git a/README_en-US.md b/README_en-US.md
index dc9c9dfe..0b413d55 100644
--- a/README_en-US.md
+++ b/README_en-US.md
@@ -108,13 +108,7 @@ We are hearing from:
## License
-The copyright of image sources including SJTU badge (`sjtulog.png`) and
-banner (`sjtubanner.png`) belongs to the original owner.
+The copyright of image sources including SJTU logo (`sjtulogo.pdf` etc.)
+belongs to Shanghai Jiao Tong University.
-The remain part is under [Apache License 2.0](LICENSE)
-
-[README]: https://s3.amazonaws.com/sjtuthesis/README.pdf
-[0.9.3]: https://github.com/sjtug/SJTUThesis/releases/tag/0.9.3
-[0.8.7]: https://github.com/sjtug/SJTUThesis/releases/tag/0.8.7
-[0.7.7]: https://github.com/sjtug/SJTUThesis/releases/tag/0.7.7
-[0.7.1]: https://github.com/sjtug/SJTUThesis/releases/tag/0.7.1
+The remain part is under [LPPL](LICENSE)
diff --git a/docs/README.pdf b/docs/README.pdf
deleted file mode 100644
index 73e0795d..00000000
Binary files a/docs/README.pdf and /dev/null differ
diff --git a/docs/bachelor.pdf b/docs/bachelor.pdf
index 90a9688c..89cd5d32 100644
Binary files a/docs/bachelor.pdf and b/docs/bachelor.pdf differ
diff --git a/docs/coursepaper.pdf b/docs/coursepaper.pdf
deleted file mode 100644
index a03429a6..00000000
Binary files a/docs/coursepaper.pdf and /dev/null differ
diff --git a/docs/doctor.pdf b/docs/doctor.pdf
deleted file mode 100644
index 730f0a07..00000000
Binary files a/docs/doctor.pdf and /dev/null differ
diff --git a/docs/images/bachelor.png b/docs/images/bachelor.png
index 0433ce66..009d5160 100644
Binary files a/docs/images/bachelor.png and b/docs/images/bachelor.png differ
diff --git a/docs/images/coursepaper.png b/docs/images/coursepaper.png
deleted file mode 100644
index def67d34..00000000
Binary files a/docs/images/coursepaper.png and /dev/null differ
diff --git a/docs/images/doctor.png b/docs/images/doctor.png
deleted file mode 100644
index e18fcece..00000000
Binary files a/docs/images/doctor.png and /dev/null differ
diff --git a/docs/images/master.png b/docs/images/master.png
index 3cc1c4ee..2f26621b 100644
Binary files a/docs/images/master.png and b/docs/images/master.png differ
diff --git a/docs/master.pdf b/docs/master.pdf
index 5e2d438a..bd90c4ab 100644
Binary files a/docs/master.pdf and b/docs/master.pdf differ
diff --git a/docs/sjtuthesis.pdf b/docs/sjtuthesis.pdf
new file mode 100644
index 00000000..878617b1
Binary files /dev/null and b/docs/sjtuthesis.pdf differ
diff --git a/sjtuthesis-bachelor.ltx b/sjtuthesis-bachelor.ltx
new file mode 100644
index 00000000..8500eb3f
--- /dev/null
+++ b/sjtuthesis-bachelor.ltx
@@ -0,0 +1,195 @@
+%%
+%% This is file `sjtuthesis-bachelor.ltx',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% sjtuthesis.dtx (with options: `bachelor')
+%%
+%% Copyright (C) 2009-2017 by weijianwen
+%% (C) 2018-2019 by SJTUG
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This file has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Alexara Wu.
+%%
+\ProvidesFile{sjtuthesis-bachelor.ltx}
+ [2019/06/16 1.0.0rc Shanghai Jiao Tong University Thesis Template]
+\ifsjtu@course
+ \sjtu@def@label{degreetypeChi}{}
+ \sjtu@def@label{degreetypeEng}{}
+\else
+ \sjtu@def@label{degreetypeChi}{学士}
+ \sjtu@def@label{degreetypeEng}{Bachelor}
+\fi
+\sjtu@def@label{authorChi}{学生姓名}
+\sjtu@def@label{studentidChi}{学生学号}
+\sjtu@def@label{supervisorChi}{指导教师}
+\sjtu@def@label{coursenameChi}{课程名称}
+\sjtu@def@label{majorChi}{专业}
+\sjtu@def@label{departmentChi}{学院(系)}
+\ifsjtu@course
+ \sjtu@def@label{thesiscat}{课程论文}
+ \def\sjtu@label@thesistype{\sjtu@label@thesiscat}
+ \sjtu@def@label{subjectChi}{\sjtu@label@thesiscat}
+ \sjtu@def@label{subjectEng}{Course Paper}
+\else
+ \sjtu@def@label{thesiscat}{学位论文}
+ \def\sjtu@label@thesistype{毕业设计(论文)}
+ \sjtu@def@label{subjectChi}{\sjtu@label@degreetypeChi\sjtu@label@thesiscat}
+ \sjtu@def@label{subjectEng}{Thesis of \sjtu@label@degreetypeEng}
+\fi
+\sjtu@def@label{bigabstract}{英文大摘要}
+\geometry{%
+ paper = a4paper,
+ top = 84bp,
+ bottom = 72bp,
+ hmargin = 90bp,
+ headheight = 60bp,
+ headsep = 12bp}
+\ifsjtu@english
+ \def\sjtu@titlemark{\sjtu@value@entitle}
+ \newcommand{\sjtu@fancyhead}{%
+ \parbox[b]{0.75\textwidth}{%
+ \raggedleft\nouppercase{\footnotesize\heiti\sjtu@titlemark}}}
+ \newcommand{\sjtu@fancyfoot}[2]{%
+ \small --~~Page~~{\bfseries{#1}}~~of~~{\bfseries{#2}}~~--}
+\else
+ \def\sjtu@titlemark{\sjtu@value@title}
+ \newcommand{\sjtu@fancyhead}{%
+ \parbox[b]{0.75\textwidth}{%
+ \raggedleft\nouppercase{\small\heiti\sjtu@titlemark}}}
+ \newcommand{\sjtu@fancyfoot}[2]{%
+ \small 第~{\bfseries{#1}}~页\,共~{\bfseries{#2}}~页}
+\fi
+\fancypagestyle{sjtu@front}{%
+ \fancyhf{}
+ \fancyhead[L]{\includegraphics{figure/sjtubanner.pdf}}
+ \fancyhead[R]{\sjtu@fancyhead}
+ \fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.Roman}}}
+}
+\fancypagestyle{sjtu@plain}{%
+ \fancyhf{}
+ \fancyhead[L]{\includegraphics{figure/sjtubanner.pdf}}
+ \fancyhead[R]{\sjtu@fancyhead}
+ \fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.arabic}}}
+}
+\fancypagestyle{sjtu@biglast}{%
+ \fancyhf{}
+ \fancyhead[L]{\includegraphics{figure/sjtubanner.pdf}}
+ \fancyhead[R]{\sjtu@fancyhead}
+ \fancyfoot[C]{\sjtu@fancyfoot{\theCurrentPageLocal}%
+ {\lastpageref{pagesLTS.roman.local}}}
+}
+\renewcommand{\frontmatter}{%
+ \cleardoublepage
+ \@mainmatterfalse
+ \pagenumbering{Roman}
+ \pagestyle{sjtu@front}}
+\renewcommand{\mainmatter}{%
+ \cleardoublepage
+ \@mainmattertrue
+ \pagenumbering{arabic}
+ \pagestyle{sjtu@plain}}
+\ctexset{%
+ subsection/format = \zihao{-4}\normalfont,
+}
+\renewcommand{\cftchapfont}{\normalfont}
+\renewcommand{\cftchapleader}{\normalfont\cftdotfill{\cftdotsep}}
+\renewcommand{\cftchappagefont}{\normalfont}
+\NewDocumentEnvironment{abstract}{}%
+{\cleardoublepage
+ \pdfbookmark[0]{\sjtu@label@abstract}{abstract}
+ \chapter*{%
+ \sjtu@value@title \vskip 2ex
+ {\zihao{4}\sjtu@label@abstractChi}
+ }
+ \markboth{\sjtu@label@abstractChi}%
+ {\sjtu@label@abstractChi}
+}{%
+ \vspace{3ex}\noindent
+ {\zihao{-4}\heiti\sjtu@label@keywordsChi}{\zihao{5}\sjtu@value@keywords}
+}
+\NewDocumentEnvironment{enabstract}{}{%
+ \cleardoublepage
+ \chapter*{%
+ \MakeUppercase\sjtu@value@entitle \vskip 2ex
+ {\zihao{4}\MakeUppercase\sjtu@label@abstractEng}}
+ \markboth{\sjtu@label@abstractEng}%
+ {\sjtu@label@abstractEng}
+}{%
+ \vspace{3ex}\noindent
+ {\zihao{-4}\bfseries\sjtu@label@keywordsEng}
+ {\zihao{5}\sjtu@value@enkeywords}}
+\newcommand{\sjtu@bigabstract}[1]{\long\gdef\sjtu@bigabstract@body{#1}}
+\NewDocumentEnvironment{bigabstract}{}
+{\Collect@Body\sjtu@bigabstract}
+{\ifsjtu@course\relax\else%
+ \ifsjtu@english\relax\else%
+ \AtEndDocument{%
+ \cleardoublepage
+ \pagenumbering{roman}
+ \pagestyle{sjtu@biglast}
+ \pdfbookmark[0]{\sjtu@label@bigabstract}{bigabstract}%
+ \chapter*{\MakeUppercase\sjtu@value@entitle}
+ \sjtu@bigabstract@body}
+ \fi
+\fi}
+\RenewDocumentCommand\maketitle{}{%
+ \pdfbookmark[0]{\sjtu@label@titlepage}{titlepage}
+ \sjtu@makechinesetitle%
+}
+\newcommand{\sjtu@makechinesetitle}{
+ \cleardoublepage
+ \thispagestyle{empty}
+ \begin{center}
+ \kaishu
+ \vspace*{48bp}
+ \includegraphics{figure/sjtulogo.pdf}
+ \vskip 28bp
+ {\fontsize{32}{32}\sjtu@label@subjectChi}
+ \vskip 16bp
+ {\zihao{-2}\MakeUppercase\sjtu@label@subjectEng}
+ \vskip 16bp
+ \includegraphics{figure/sjtubadge.pdf}
+ \vskip \stretch{2}
+ {\zihao{2}
+ \begin{tabular}{r@{:}l}
+ 论文题目 &
+ \begin{minipage}[t]{300pt}
+ \zihao{-2}
+ \begin{center}
+ \sjtu@uline\sjtu@value@title
+ \end{center}
+ \end{minipage}
+ \end{tabular}}
+ \vskip \stretch{1}
+ {\zihao{3}
+ \def\arraystretch{1.1}
+ \begin{tabular}
+ {>{\begin{CJKfilltwosides}{4\ccwd}}r<{\end{CJKfilltwosides}}@{:}c}
+ \sjtu@label@authorChi & \sjtu@value@author \\ \cline{2-2}
+ \sjtu@label@studentidChi & \makebox[180pt]{\sjtu@value@studentid} \\
+ \cline{2-2}
+ \ifsjtu@course
+ \sjtu@label@coursenameChi & \sjtu@value@coursename \\ \cline{2-2}
+ \else
+ \sjtu@label@majorChi & \sjtu@value@major \\ \cline{2-2}
+ \fi
+ \sjtu@label@supervisorChi & \sjtu@value@supervisor \\ \cline{2-2}
+ \sjtu@label@departmentChi & \sjtu@value@department \\ \cline{2-2}
+ \end{tabular}}
+ \vskip 40bp
+ \end{center}
+ \cleardoublepage}
+\endinput
+%%
+%% End of file `sjtuthesis-bachelor.ltx'.
diff --git a/sjtuthesis-graduate.ltx b/sjtuthesis-graduate.ltx
new file mode 100644
index 00000000..c12093e3
--- /dev/null
+++ b/sjtuthesis-graduate.ltx
@@ -0,0 +1,207 @@
+%%
+%% This is file `sjtuthesis-graduate.ltx',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% sjtuthesis.dtx (with options: `graduate')
+%%
+%% Copyright (C) 2009-2017 by weijianwen
+%% (C) 2018-2019 by SJTUG
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This file has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Alexara Wu.
+%%
+\ProvidesFile{sjtuthesis-graduate.ltx}
+ [2019/06/16 1.0.0rc Shanghai Jiao Tong University Thesis Template]
+\ifsjtu@doctor
+ \sjtu@def@label{degreetypeChi}{博士}
+ \sjtu@def@label{degreetypeEng}{Doctor}
+\else
+ \sjtu@def@label{degreetypeChi}{硕士}
+ \sjtu@def@label{degreetypeEng}{Master}
+\fi
+\sjtu@def@label{authorChi}{\sjtu@label@degreetypeChi 研究生}
+\sjtu@def@label{authorEng}{Candidate}
+\sjtu@def@label{studentidChi}{学号}
+\sjtu@def@label{studentidEng}{Student ID}
+\sjtu@def@label{supervisorChi}{导师}
+\sjtu@def@label{supervisorEng}{Supervisor}
+\sjtu@def@label{assisupervisorChi}{副导师}
+\sjtu@def@label{assisupervisorEng}{Assistant Supervisor}
+\sjtu@def@label{degreeChi}{申请学位}
+\sjtu@def@label{degreeEng}{Academic Degree Applied for}
+\sjtu@def@label{majorChi}{学科}
+\sjtu@def@label{majorEng}{Speciality}
+\sjtu@def@label{departmentChi}{所在单位}
+\sjtu@def@label{departmentEng}{Affiliation}
+\sjtu@def@label{defenddateChi}{答辩日期}
+\sjtu@def@label{defenddateEng}{Date of Defence}
+\sjtu@def@label{conferringChi}{授予学位单位}
+\sjtu@def@label{conferringEng}{Degree-Conferring-Institution}
+\sjtu@def@label{fundChi}{资助基金}
+\sjtu@def@label{fundEng}{Funded by}
+\sjtu@def@label{thesiscat}{学位论文}
+\def\sjtu@label@thesistype{\sjtu@label@thesiscat}
+\sjtu@def@label{subjectChi}{%
+ \sjtu@label@schoolChi\sjtu@label@degreetypeChi\sjtu@label@thesiscat
+}
+\sjtu@def@label{subjectEng}{%
+ Dissertation Submitted to \sjtu@label@schoolEng \\%
+ for the Degree of \sjtu@label@degreetypeEng
+}
+\geometry{%
+ paper = a4paper,
+ top = 3.5cm,
+ bottom = 4.0cm,
+ left = 3.3cm,
+ right = 2.8cm,
+ headsep = 0.5cm}
+\newcommand{\sjtu@fancyfoot}[2]{
+ \ifsjtu@review\relax\else
+ \ifx#2\@empty\else
+ \zihao{-5}{\bfseries #1}\\{#2}
+ \fi
+ \fi
+}
+\fancypagestyle{sjtu@title}{%
+ \fancyhf{}
+ \fancyfoot[C]{\sjtu@fancyfoot{\sjtu@label@fundChi}{\sjtu@value@fund}}
+ \renewcommand{\headrulewidth}{0pt}
+ \renewcommand{\footrulewidth}{0pt}
+}
+\fancypagestyle{sjtu@entitle}{%
+ \fancyhf{}
+ \fancyfoot[C]{\sjtu@fancyfoot{\sjtu@label@fundEng}{\sjtu@value@enfund}}
+ \renewcommand{\headrulewidth}{0pt}
+ \renewcommand{\footrulewidth}{0pt}
+}
+\fancypagestyle{sjtu@plain}{%
+ \fancyhf{}
+ \fancyhead[C]{\zihao{-5}\sjtu@label@subjectChi}
+ \fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
+ \renewcommand{\headrule}{%
+ \hrule\@height2.25\p@\@width\headwidth
+ \vskip0.75\p@
+ \hrule\@height0.75\p@\@width\headwidth
+ \vskip-2.75\p@
+ }
+}
+\renewcommand{\frontmatter}{%
+ \cleardoublepage
+ \@mainmatterfalse
+ \pagenumbering{Roman}
+ \pagestyle{sjtu@plain}}
+\renewcommand{\mainmatter}{%
+ \cleardoublepage
+ \@mainmattertrue
+ \pagenumbering{arabic}
+ \pagestyle{sjtu@plain}}
+\renewcommand{\cftchapfont}{\bfseries\heiti}
+\renewcommand{\cftchapleader}{\normalfont\cftdotfill{\cftdotsep}}
+\NewDocumentEnvironment{abstract}{}%
+{\cleardoublepage
+ \pdfbookmark[0]{\sjtu@label@abstract}{abstract}
+ \chapter*{%
+ \sjtu@value@title \vskip 2ex
+ \sjtu@label@abstractChi
+ }
+ \markboth{\sjtu@label@abstractChi}%
+ {\sjtu@label@abstractChi}
+ \zihao{4}
+}{%
+ \vspace{3ex}\noindent
+ {\heiti\sjtu@label@keywordsChi}\sjtu@value@keywords
+}
+\NewDocumentEnvironment{enabstract}{}{%
+ \cleardoublepage
+ \chapter*{%
+ \MakeUppercase\sjtu@value@entitle \vskip 2ex
+ \MakeUppercase\sjtu@label@abstractEng}
+ \markboth{\sjtu@label@abstractEng}%
+ {\sjtu@label@abstractEng}
+ \zihao{4}
+}{%
+ \vspace{3ex}\noindent
+ {\bfseries\MakeUppercase\sjtu@label@keywordsEng}
+ \sjtu@value@enkeywords}
+\newcommand{\sjtu@bigabstract}[1]{\long\gdef\sjtu@bigabstract@body{#1}}
+\NewDocumentEnvironment{bigabstract}{}
+{\Collect@Body\sjtu@bigabstract}
+{}
+\RenewDocumentCommand\maketitle{}{%
+ \pdfbookmark[0]{\sjtu@label@titlepage}{titlepage}
+ \sjtu@makechinesetitle%
+ \sjtu@makeenglishtitle%
+}
+\newcommand{\sjtu@makechinesetitle}{
+ \cleardoublepage
+ \thispagestyle{sjtu@title}
+ \begin{center}
+ \vspace*{40bp}
+ {\zihao{-2}\sjtu@label@subjectChi}
+ \vskip \stretch{4}
+ {\zihao{2}\heiti\sjtu@value@title \vskip 1bp}
+ \vskip \stretch{5}
+ {\zihao{4}
+ \def\tabcolsep{1bp}
+ \def\arraystretch{1.25}
+ \begin{tabular}
+ {>{\begin{CJKfilltwosides}[t]{6.5\ccwd}\heiti}r<{\end{CJKfilltwosides}}
+ @{:}l}
+ \sjtu@label@authorChi & \sjtu@value@author \\
+ \sjtu@label@studentidChi & \sjtu@value@studentid \\
+ \sjtu@label@supervisorChi & \sjtu@value@supervisor \\
+ \ifx\sjtu@value@assisupervisor\@empty\else
+ \sjtu@label@assisupervisorChi & \sjtu@value@assisupervisor \\
+ \fi
+ \sjtu@label@degreeChi & \sjtu@value@degree \\
+ \sjtu@label@majorChi & \sjtu@value@major \\
+ \sjtu@label@departmentChi & \sjtu@value@department \\
+ \sjtu@label@defenddateChi & \sjtu@value@date \\
+ \sjtu@label@conferringChi & \sjtu@label@schoolChi \\
+ \end{tabular}}
+ \vskip 26bp
+ \end{center}
+ \cleardoublepage}
+\newcommand{\sjtu@makeenglishtitle}{%
+ \cleardoublepage
+ \thispagestyle{sjtu@entitle}
+ \begin{center}
+ \vspace*{28bp}
+ {\zihao{-2}\sjtu@label@subjectEng \vskip 1bp}
+ \vskip \stretch{4}
+ {\zihao{2}\bfseries\MakeUppercase\sjtu@value@entitle \vskip 1bp}
+ \vskip \stretch{5}
+ {\zihao{4}
+ \def\tabcolsep{1bp}
+ \def\arraystretch{1.3}
+ \begin{tabular}
+ {>{\bfseries}l<{:~}l}
+ \sjtu@label@authorEng & \sjtu@value@enauthor \\
+ \sjtu@label@studentidEng & \sjtu@value@studentid \\
+ \sjtu@label@supervisorEng & \sjtu@value@ensupervisor \\
+ \ifx\sjtu@value@enassisupervisor\@empty\else
+ \sjtu@label@assisupervisorEng & \sjtu@value@enassisupervisor \\
+ \fi
+ \sjtu@label@degreeEng & \sjtu@value@endegree \\
+ \sjtu@label@majorEng & \sjtu@value@enmajor \\
+ \sjtu@label@departmentEng & \sjtu@value@endepartment \\
+ \sjtu@label@defenddateEng & \sjtu@value@endate \\
+ \sjtu@label@conferringEng & \sjtu@label@schoolEng \\
+ \end{tabular}}
+ \vskip 26bp
+ \end{center}
+ \cleardoublepage}
+\endinput
+%%
+%% End of file `sjtuthesis-graduate.ltx'.
diff --git a/sjtuthesis.cfg b/sjtuthesis.cfg
deleted file mode 100644
index 831dfc19..00000000
--- a/sjtuthesis.cfg
+++ /dev/null
@@ -1,214 +0,0 @@
-%# -*- coding: utf-8-unix -*-
-%%==================================================
-%% sjtuthesis.cfg for SJTU Thesis
-%%==================================================
-
-\ProvidesFile{sjtuthesis.cfg}[2016/04/06 v0.9 sjtuthesis configuration file]
-
-%% labels in the title page
-\ifsjtu@master
- \def\sjtu@label@major{学科:}
- \def\sjtu@label@title{论文题目}
- \def\sjtu@label@thesis{学位论文}
- \def\sjtu@label@coadvisor{副导师:}
- \def\sjtu@label@defenddate{答辩日期:}
- \def\sjtu@label@institute{所在单位:}
- \def\sjtu@label@cnacademicdegree{申请学位:}
- \def\sjtu@label@school{授予学位单位:}
- \def\sjtu@label@author{硕士研究生:}
- \def\sjtu@label@studentnumber{学号:}
- \def\sjtu@label@advisor{导师:}
-\else
- \def\sjtu@label@major{专业}
- \def\sjtu@label@title{论文题目}
- \def\sjtu@label@thesis{学位论文}
- \def\sjtu@label@coadvisor{副导师}
- \def\sjtu@label@defenddate{答辩日期}
- \def\sjtu@label@institute{学院(系)}
- \def\sjtu@label@coursepaper{课程论文}
- \ifsjtu@bachelor
- \def\sjtu@label@author{学生姓名}
- \def\sjtu@label@studentnumber{学生学号}
- \def\sjtu@label@advisor{指导教师}
- \else
- \ifsjtu@coursepaper
- \def\sjtu@label@author{姓名}
- \def\sjtu@label@studentnumber{学号}
- \def\sjtu@label@coursename{课程}
- \else
- \def\sjtu@label@author{论文作者}
- \def\sjtu@label@studentnumber{学号}
- \def\sjtu@label@advisor{导师}
- \fi
- \fi
-\fi
-
-%% string values filled in the title page
-\def\sjtu@value@classification{}
-\def\sjtu@value@confidential{}
-\def\sjtu@value@serialnumber{}
-\def\sjtu@value@school{}
-\ifsjtu@coursepaper
- \def\sjtu@value@chinesedegree{}
- \def\sjtu@value@englishdegree{}
-\else
- \ifsjtu@bachelor
- \def\sjtu@value@chinesedegree{学士}
- \def\sjtu@value@englishdegree{Bachelor}
- \else
- \ifsjtu@master
- \def\sjtu@value@chinesedegree{硕士}
- \def\sjtu@value@englishdegree{Master}
- \else
- \ifsjtu@doctor
- \def\sjtu@value@chinesedegree{博士}
- \def\sjtu@value@englishdegree{Doctor}
- \else
- \ClassError{sjtuthesis}%
- {Unknown value for degree.}{}
- \fi
- \fi
- \fi
- \ifsjtu@master
- \def\sjtu@label@statement{\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
- \else
- \def\sjtu@label@statement{申请\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
- \fi
-\fi
-
-%% 论文原创性声明
-\def\sjtu@label@original{学位论文原创性声明}
-\def\sjtu@label@authorization{学位论文版权使用授权书}
-\def\sjtu@label@authorsign{学位论文作者签名:}
-\def\sjtu@label@Supervisorsign{指导教师签名:}
-\def\sjtu@label@originalDate{日期:\hrulefill\hrulefill 年 \hrulefill 月 \hrulefill 日}
-\def\sjtu@label@originalcontent{是本人在导师的指导下, 独立进行研究工作所取得的成果。除文中已经注明引用的内容外,本论文不包含任何其他个人或集体已经发表或撰写过的作品成果。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。本人完全意识到本声明的法律结果由本人承担。
-}
-\def\sjtu@label@authorizationcontent{本学位论文作者完全了解学校有关保留、使用学位论文的规定,同意学校保留并向国家有关部门或机构送交论文的复印件和电子版,允许论文被查阅和借阅。本人授权上海交通大学可以将本学位论文的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫描等复制手段保存和汇编本学位论文。\par
- 本学位论文属于\\
- \hspace*{9em}\textbf{保\hspace{1em}密} $\square$,在~\hrulefill~年解密后适用本授权书。\\
- \hspace*{9em}\textbf{不保密} $\square$。\\
- (请在以上方框内打“$\checked$”)
-}
-
-%% labels in the english title page
-\ifsjtu@master
- \def\sjtu@label@englishadvisor{Supervisor:}
- \def\sjtu@label@englishcoadvisor{Co-supervisor:}
- \def\sjtu@label@englishauthor{Candidate:}
- \def\sjtu@label@englishstudentid{Student ID:}
- \def\sjtu@label@enacademicdegree{Academic Degree Applied for:}
- \def\sjtu@label@englishmajor{Speciality:}
- \def\sjtu@label@englishinstitutemaster{Affiliation:}
- \def\sjtu@label@englishdate{Date of Defence:}
- \def\sjtu@label@englishschool{Degree-Conferring-Institution:}
- \def\sjtu@label@englishstatement{Dissertation Submitted to Shanghai Jiao Tong University \\[8pt] for the Degree of \sjtu@value@englishdegree}
-\else
- \def\sjtu@label@englishadvisor{Advisor}
- \def\sjtu@label@englishcoadvisor{Co-advisor}
- \def\sjtu@label@englishstatement{Submitted in total fulfillment
- of the requirements for the degree of \sjtu@value@englishdegree \\
- in \sjtu@value@englishmajor}
-\fi
-
-%% labels in the abstracts
-\def\sjtu@label@chineseabstract{摘~~~~要}
-\def\sjtu@label@englishabstract{Abstract}
-\def\sjtu@label@keywords{关键词:}
-\def\sjtu@label@englishkeywords{KEY WORDS:~}
-
-\ifsjtu@english
-
-%% labels in the titlepage, contents, lists, etc.
-\def\sjtu@titlepage{Title Page}
-\def\sjtu@label@abstract{\sjtu@label@englishabstract}
-\def\sjtu@contentsname{Contents}
-\def\sjtu@figurename{Figure}
-\def\sjtu@listfigurename{List of Figures}
-\def\sjtu@tablename{Table}
-\def\sjtu@listtablename{List of Tables}
-\def\sjtu@algorithmicrequire{Input:}
-\def\sjtu@algorithmicensure{Output:}
-\def\sjtu@listalgorithmname{List of Algorithms}
-\def\sjtu@nomenclature{Nomenclature}
-\DefineBibliographyStrings{english}{%
- bibliography = {Bibliography}
-}
-%% labels in the summary
-\def\sjtu@label@summary{Summary}
-%% labels in the publications
-\def\sjtu@label@publications{Publications}
-%% labels in the publications
-\def\sjtu@label@patents{Patents}
-%% labels in the projects
-\def\sjtu@label@projects{Projects}
-%% labels in the resume
-\def\sjtu@label@resume{Resume}
-%% labels in the thanks
-\def\sjtu@label@thanks{Acknowledgements}
-%% listings name
-\def\sjtu@value@listingname{Code}
-%% the theorem name definitions
-\def\sjtu@label@algo{Algorithm}
-\def\sjtu@label@thm{Theorem}
-\def\sjtu@label@lem{Lemma}
-\def\sjtu@label@prop{Proposition}
-\def\sjtu@label@cor{Corollary}
-\def\sjtu@label@defn{Definition}
-\def\sjtu@label@conj{Conjecture}
-\def\sjtu@label@exmp{Example}
-\def\sjtu@label@rem{Remark}
-\def\sjtu@label@case{Case}
-\def\sjtu@label@proof{Proof}
-
-\else
-
-%% 目录、插图索引、表格索引
-\def\sjtu@titlepage{扉~~~~页}
-\def\sjtu@label@abstract{\sjtu@label@chineseabstract}
-\def\sjtu@contentsname{目~~~~录}
-\def\sjtu@figurename{图}
-\ifsjtu@master
- \def\sjtu@listfigurename{图~~录}
- \def\sjtu@listtablename{表~~录}
-\else
- \def\sjtu@listfigurename{插图索引}
- \def\sjtu@listtablename{表格索引}
-\fi
-\def\sjtu@tablename{表}
-\def\sjtu@algorithmicrequire{输入:}
-\def\sjtu@algorithmicensure{输出:}
-\def\sjtu@listalgorithmname{算法索引}
-\def\sjtu@nomenclature{主要符号对照表}
-%% labels in the summary
-\def\sjtu@label@summary{全文总结}
-%% labels in the publications
-\def\sjtu@label@publications{攻读学位期间发表的学术论文}
-%% labels in the publications
-\def\sjtu@label@patents{攻读学位期间申请的专利}
-%% labels in the projects
-\def\sjtu@label@projects{攻读学位期间参与的项目}
-%% labels in the resume
-\def\sjtu@label@resume{简~~~~历}
-%% labels in the thanks
-\def\sjtu@label@thanks{致~~~~谢}
-%% listings name
-\def\sjtu@value@listingname{代码}
-%% the theorem name definitions
-\def\sjtu@label@algo{算法}
-\def\sjtu@label@thm{定理}
-\def\sjtu@label@lem{引理}
-\def\sjtu@label@prop{命题}
-\def\sjtu@label@cor{推论}
-\def\sjtu@label@defn{定义}
-\def\sjtu@label@conj{猜想}
-\def\sjtu@label@exmp{例}
-\def\sjtu@label@rem{注}
-\def\sjtu@label@case{情形}
-\def\sjtu@label@proof{证明}
-
-\fi
-
-\endinput
-
-%% End of file `sjtuthesis.cfg'.
diff --git a/sjtuthesis.cls b/sjtuthesis.cls
index 42c45e05..1e337a63 100644
--- a/sjtuthesis.cls
+++ b/sjtuthesis.cls
@@ -1,1020 +1,734 @@
-%# -*- coding: utf-8-unix -*-
-%==================================================
-%% sjtuthesis.cls for SJTU Master Thesis
-%%==================================================
-
-\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesClass{sjtuthesis}[2018/01/09 v0.10 Shanghai Jiao Tong University Template]
-\def\version{v0.10}
-\newif\ifsjtu@coursepaper\sjtu@coursepaperfalse
-\newif\ifsjtu@bachelor\sjtu@bachelorfalse
-\newif\ifsjtu@master\sjtu@masterfalse
-\newif\ifsjtu@doctor\sjtu@doctorfalse
-\newif\ifsjtu@english\sjtu@englishfalse
-\newif\ifsjtu@review\sjtu@reviewfalse
-\newif\ifsjtu@submit\sjtu@submitfalse
-\DeclareOption{coursepaper}{\sjtu@coursepapertrue}
-\DeclareOption{bachelor}{\sjtu@bachelortrue}
-\DeclareOption{master}{\sjtu@mastertrue}
-\DeclareOption{doctor}{\sjtu@doctortrue}
-\DeclareOption{english}{\sjtu@englishtrue}
-\DeclareOption{review}{\sjtu@reviewtrue}
-\DeclareOption{submit}{\sjtu@submittrue}
-\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
-\ProcessOptions\relax
+%%
+%% This is file `sjtuthesis.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% sjtuthesis.dtx (with options: `class')
+%%
+%% Copyright (C) 2009-2017 by weijianwen
+%% (C) 2018-2019 by SJTUG
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This file has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Alexara Wu.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{sjtuthesis}
+ [2019/06/16 1.0.0rc Shanghai Jiao Tong University Thesis Template]
+\hyphenation{SJTU-Thesis}
+\def\sjtuthesis{SJTUThesis}
+\def\version{1.0.0rc}
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{
+ family=sjtu,
+ prefix=sjtu@,
+ setkeys=\kvsetkeys}
+\DeclareStringOption[doctor]{degree}[doctor]
+\DeclareStringOption[chinese]{language}[chinese]
+\DeclareStringOption[gb7714-2015]{bibstyle}[gb7714-2015]
+\DeclareStringOption[5]{zihao}[5]
+\DeclareBoolOption{review}
+\DeclareBoolOption{unsetfont}
+\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
+\ProcessKeyvalOptions*
+\newcommand{\sjtu@validate@key}[1]{%
+ \@ifundefined{sjtu@\csname sjtu@#1\endcsname true}{%
+ \ClassError{sjtuthesis}{Invalid value '\csname sjtu@#1\endcsname'}{}%
+ }{%
+ \csname sjtu@\csname sjtu@#1\endcsname true\endcsname
+ }%
+}
+\newif\ifsjtu@course
+\newif\ifsjtu@bachelor
+\newif\ifsjtu@master
+\newif\ifsjtu@doctor
+\sjtu@validate@key{degree}
+\ifsjtu@course\sjtu@bachelortrue\fi
+\ifsjtu@doctor\sjtu@mastertrue\fi
+\newif\ifsjtu@chinese
+\newif\ifsjtu@english
+\sjtu@validate@key{language}
\ifsjtu@english
\PassOptionsToClass{scheme=plain}{ctexbook}
-\else
- \PassOptionsToClass{scheme=chinese}{ctexbook}
-\fi
-\ifsjtu@coursepaper
- \PassOptionsToClass{zihao=-4}{ctexbook}
-\else
- \ifsjtu@bachelor
- \PassOptionsToClass{zihao=5}{ctexbook}
- \else
- \PassOptionsToClass{zihao=-4}{ctexbook}
- \ifsjtu@master\relax\else
- \ifsjtu@doctor\relax\else
- \ClassError{sjtuthesis}%
- {You have to specify one of thesis options: coursepaper, bachelor, master or doctor.}{}
- \fi
- \fi
- \fi
\fi
\PassOptionsToPackage{no-math}{fontspec}
-\LoadClass[a4paper,UTF8]{ctexbook}
-
-%% sjtuthesis.cls segments
-% 0. Import sjtuthesis.cfg & define variables
-% 1. Import and configure LaTeX packages.
-% 2. Define general-purpose LaTeX commands.
-% 3. Configure the imported packages, also extend LaTeX command in sjtuthesis
-% 4. Draw the sjtuthesis
-
-%==========
-% Segment 0. Import sjtuthesis.cfg & define variables
-%==========
-
-\AtEndOfClass{\input{sjtuthesis.cfg}}
-
-% Chinese variables
-\newcommand\classification[1]{\def\sjtu@value@classification{#1}}
-\newcommand\studentnumber[1]{\def\sjtu@value@studentnumber{#1}}
-\newcommand\confidential[1]{\def\sjtu@value@confidential{#1}}
-\newcommand\school[1]{\def\sjtu@value@school{#1}}
-\newcommand\chinesedegree[1]{\def\sjtu@value@chinesedegree{#1}}
-\renewcommand\title[1]{%
- \def\sjtu@value@chinesetitle{\sjtu@title@handler{#1}}%
- \def\sjtu@value@chinesecovertitle{\sjtu@covertitle@handler{#1}}}
-\renewcommand\author[1]{\def\sjtu@value@author{#1}}
-\newcommand\advisor[1]{\def\sjtu@value@advisor{#1}}
-\newcommand\coadvisor[1]{\def\sjtu@value@coadvisor{#1}}
-\newcommand\major[1]{\def\sjtu@value@major{#1}}
-\newcommand\coursename[1]{\def\sjtu@value@coursename{#1}}
-\newcommand\submitdate[1]{\def\sjtu@value@submitdate{#1}}
-\newcommand\defenddate[1]{\def\sjtu@value@defenddate{#1}}
-\newcommand\institute[1]{\def\sjtu@value@institute{#1}}
-\newcommand\chairman[1]{\def\sjtu@value@chairman{#1}}
-\newcommand\keywords[1]{\def\sjtu@value@keywords{#1}}
-\newcommand\cnacademicdegree[1]{\def\sjtu@value@cnacademicdegree{#1}}
-
-% English variables
-\newcommand\englishtitle[1]{\def\sjtu@value@englishtitle{#1}}
-\newcommand\englishauthor[1]{\def\sjtu@value@englishauthor{#1}}
-\newcommand\englishadvisor[1]{\def\sjtu@value@englishadvisor{#1}}
-\newcommand\englishcoadvisor[1]{\def\sjtu@value@englishcoadvisor{#1}}
-\newcommand\englishschool[1]{\def\sjtu@value@englishschool{#1}}
-\newcommand\englishinstitute[1]{\def\sjtu@value@englishinstitute{#1}}
-\newcommand\englishinstitutemaster[1]{\def\sjtu@value@englishinstitutemaster{#1}}
-\newcommand\englishdate[1]{\def\sjtu@value@englishdate{#1}}
-\newcommand\englishdegree[1]{\def\sjtu@value@englishdegree{#1}}
-\newcommand\englishmajor[1]{\def\sjtu@value@englishmajor{#1}}
-\newcommand\englishstudentid[1]{\def\sjtu@value@englishstudentid{#1}}
-\newcommand\englishkeywords[1]{\def\sjtu@value@englishkeywords{#1}}
-\newcommand\enacademicdegree[1]{\def\sjtu@value@enacademicdegree{#1}}
-
-%==========
-% Segment 1. Import LaTeX packages.
-%==========
-
+\LoadClass[a4paper,zihao=\sjtu@zihao,linespread=1.3,UTF8]{ctexbook}
\RequirePackage{etoolbox}
-\RequirePackage{geometry} %设置版面
+\RequirePackage{xparse}
+\RequirePackage{environ}
+\RequirePackage{geometry}
\RequirePackage{fancyhdr}
\RequirePackage{pageslts}
-\RequirePackage[titles]{tocloft}
-\RequirePackage{mathtools,amsthm,amsfonts,amssymb,bm}
-\RequirePackage[defaultsups]{newtxtext}
-\RequirePackage{newtxmath}
-\RequirePackage[opentype]{sourcecodepro}
-\RequirePackage{upgreek}
-\RequirePackage{wasysym}
+\RequirePackage{mathtools}
+\ifsjtu@unsetfont\relax\else%
+ \RequirePackage[defaultsups]{newtxtext}
+ \RequirePackage{newtxmath}
+ \RequirePackage[opentype]{sourcecodepro}
+\fi
\RequirePackage{anyfontsize}
-\RequirePackage{metalogo,doc}
+\RequirePackage{xcolor}
+\RequirePackage{graphicx}
\RequirePackage{array}
-\RequirePackage{threeparttable}
-\RequirePackage{dcolumn}
-\RequirePackage{multirow}
\RequirePackage{booktabs}
-\RequirePackage{graphicx}
+\RequirePackage{longtable}
\RequirePackage{caption}
\RequirePackage[list=off]{bicaption}
\RequirePackage{subcaption}
-\RequirePackage[backend=biber,style=gb7714-2015]{biblatex}
-\RequirePackage{xcolor}
-\RequirePackage{listings}
-\RequirePackage{textcomp}
-\RequirePackage{longtable}
-\RequirePackage[perpage, bottom]{footmisc}
+\RequirePackage[backend=biber,style=\sjtu@bibstyle]{biblatex}
+\RequirePackage[titles]{tocloft}
\RequirePackage[inline]{enumitem}
+\RequirePackage[perpage, bottom]{footmisc}
\RequirePackage{pdfpages}
-\RequirePackage{calc}
-\RequirePackage{algorithm, algorithmicx, algpseudocode}
-\RequirePackage{siunitx}
-\RequirePackage{xparse}
-\RequirePackage{tikz}
-\RequirePackage{makecell}
-\usetikzlibrary{shapes.geometric, arrows}
-
-% Make hyperref to set PDF metadata (author, title, subject, keywords)
-\AtBeginDocument{
- \hypersetup{
- bookmarksnumbered,
- colorlinks,
- urlcolor=black,
- linkcolor=black,
- citecolor=black,
- plainpages=false,
- pdfstartview=FitH,
- pdfauthor={\sjtu@value@author},
- pdftitle={\sjtu@value@chinesetitle},
- pdfsubject={\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis},
- pdfkeywords={\sjtu@value@keywords},
- }
-}
+\includepdfset{fitpaper=true}
\RequirePackage{hyperref}
-\pdfstringdefDisableCommands{%
- \let\\\@empty%
- \let\sjtu@title@handler\@empty}
-
-%==========
-% Segment 2. Define general-purpose LaTeX commands.
-%==========
-\geometry{
- paper = a4paper,
- top = 3.5cm,
- bottom = 4.0cm,
- left = 3.3cm,
- right = 2.8cm,
-}
-\setcounter{secnumdepth}{4} % 章节编号深度 (part 对应 -1)
-\setcounter{tocdepth}{2} % 目录深度 (part 对应 -1)
-\renewcommand{\cftchapfont}{\bfseries\heiti} % 目录章节标题(黑体加粗)
-
-% User defined command list
-%% \me \mi \mj \dif \cleardoublepage \cndash \CJKLaTeX
-
-% A new column type
-\newcolumntype{d}[1]{D{.}{.}{#1}}% or D{.}{,}{#1} or D{.}{\cdot}{#1}
-
-% E-mail
-\newcommand{\email}[1]{\href{mailto:#1}{\texttt{#1}}}
-
-% upper math letter
-\newcommand{\me}{\mathrm{e}}
-\newcommand{\mi}{\mathrm{i}}
-\newcommand{\mj}{\mathrm{j}}
-\newcommand{\dif}{\mathrm{d}}
-
-% patch commands
-\patchcmd\cleardoublepage
- {\newpage}
- {\thispagestyle{empty}\newpage}
- {}{}
-\patchcmd\chapter
- {\thispagestyle{\CTEX@chapter@pagestyle}}
- {}{}{}
-\patchcmd\@chapter
- {\if@twocolumn}
- {\addtocontents{loa}{\protect\addvspace{10\p@}}%
- \if@twocolumn}
+\newcommand{\sjtu@def@term}[1]{%
+ \expandafter\gdef\csname #1\endcsname##1{%
+ \expandafter\gdef\csname sjtu@value@#1\endcsname{##1}}
+ \csname #1\endcsname{}
+ \define@key{sjtuvalue}{#1}{\csname #1\endcsname{##1}}}
+\sjtu@def@term{title}
+\sjtu@def@term{entitle}
+\sjtu@def@term{keywords}
+\sjtu@def@term{enkeywords}
+\sjtu@def@term{author}
+\sjtu@def@term{supervisor}
+\sjtu@def@term{assisupervisor}
+\sjtu@def@term{enauthor}
+\sjtu@def@term{ensupervisor}
+\sjtu@def@term{enassisupervisor}
+\sjtu@def@term{studentid}
+\sjtu@def@term{degree}
+\sjtu@def@term{endegree}
+\sjtu@def@term{department}
+\sjtu@def@term{endepartment}
+\sjtu@def@term{major}
+\sjtu@def@term{enmajor}
+\sjtu@def@term{coursename}
+\sjtu@def@term{encoursename}
+\sjtu@def@term{fund}
+\sjtu@def@term{enfund}
+\sjtu@def@term{date}
+\sjtu@def@term{endate}
+\NewDocumentCommand\sjtuSetInfo{}{\setkeys{sjtuvalue}}
+\newcommand{\sjtu@def@label}[2]{%
+ \expandafter\gdef\csname sjtu@label@#1\endcsname{#2}
+ \define@key{sjtulabel}{#1}{%
+ \expandafter\gdef\csname sjtu@label@#1\endcsname{##1}}}
+\sjtu@def@label{schoolChi}{上海交通大学}
+\sjtu@def@label{schoolEng}{Shanghai Jiao Tong University}
+\sjtu@def@label{originalityChi}{原创性声明}
+\sjtu@def@label{originalityEng}{Declaration of Originality}
+\sjtu@def@label{authorizationChi}{版权使用授权书}
+\sjtu@def@label{authorizationEng}{Declaration of Authorization}
+\sjtu@def@label{origtitle}{\sjtu@label@thesistype\sjtu@label@originalityChi}
+\sjtu@def@label{authtitle}{\sjtu@label@thesistype\sjtu@label@authorizationChi}
+\sjtu@def@label{origbody}{%
+ 本人郑重声明:所呈交的\sjtu@label@thesistype ,是本人在导师的指导下,
+ 独立进行研究工作所取得的成果。除文中已经注明引用的内容外,本论文不包含
+ 任何其他个人或集体已经发表或撰写过的作品成果。对本文的研究做出重要贡献
+ 的个人和集体,均已在文中以明确方式标明。本人完全意识到本声明的法律结果
+ 由本人承担。}
+\sjtu@def@label{authbody}{%
+ 本\sjtu@label@thesistype 作者完全了解学校有关保留、使用\sjtu@label@thesistype
+ 的规定,同意学校保留并向国家有关部门或机构送交论文的复印件和电子版,允
+ 许论文被查阅和借阅。本人授权上海交通大学可以将本\sjtu@label@thesistype
+ 的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫描等复制
+ 手段保存和汇编本\sjtu@label@thesistype 。}
+\sjtu@def@label{abstractChi}{摘\quad 要}
+\sjtu@def@label{abstractEng}{Abstract}
+\sjtu@def@label{keywordsChi}{关键词:}
+\sjtu@def@label{keywordsEng}{Key words:~}
+\ifsjtu@english
+ \sjtu@def@label{titlepage}{Title Page}
+ \def\sjtu@label@originality{\sjtu@label@originalityEng}
+ \def\sjtu@label@authorization{\sjtu@label@authorizationEng}
+ \def\sjtu@label@abstract{\sjtu@label@abstractEng}
+ \sjtu@def@label{contents}{Contents}
+ \sjtu@def@label{figure}{Figure}
+ \sjtu@def@label{listfigure}{List of Figures}
+ \sjtu@def@label{table}{Table}
+ \sjtu@def@label{listtable}{List of Tables}
+ \sjtu@def@label{algorithm}{Algorithm}
+ \sjtu@def@label{listalgorithm}{List of Algorithms}
+ \sjtu@def@label{nomenclature}{Nomenclature}
+ \sjtu@def@label{summary}{Summary}
+ \sjtu@def@label{acknowledgements}{Acknowledgements}
+ \sjtu@def@label{publications}{Publications}
+ \sjtu@def@label{patents}{Patents}
+ \sjtu@def@label{projects}{Projects}
+ \sjtu@def@label{resume}{Resume}
+\else
+ \sjtu@def@label{titlepage}{扉页}
+ \def\sjtu@label@originality{\sjtu@label@originalityChi}
+ \def\sjtu@label@authorization{\sjtu@label@authorizationChi}
+ \def\sjtu@label@abstract{\sjtu@label@abstractChi}
+ \sjtu@def@label{contents}{目\quad 录}
+ \sjtu@def@label{figure}{图}
+ \sjtu@def@label{listfigure}{插图索引}
+ \sjtu@def@label{table}{表}
+ \sjtu@def@label{listtable}{表格索引}
+ \sjtu@def@label{algorithm}{算法}
+ \sjtu@def@label{listalgorithm}{算法索引}
+ \sjtu@def@label{nomenclature}{主要符号对照表}
+ \sjtu@def@label{summary}{全文总结}
+ \sjtu@def@label{acknowledgements}{致\quad 谢}
+ \sjtu@def@label{publications}%
+ {攻读\sjtu@label@degreetypeChi 学位期间已发表或录用的论文}
+ \sjtu@def@label{patents}%
+ {攻读\sjtu@label@degreetypeChi 学位期间申请的专利}
+ \sjtu@def@label{projects}%
+ {攻读\sjtu@label@degreetypeChi 学位期间参与的项目}
+ \sjtu@def@label{resume}{简\quad 历}
+\fi
+\NewDocumentCommand\sjtuSetLabel{}{\setkeys{sjtulabel}}
+\ctexset{%
+ contentsname = \sjtu@label@contents,
+ listfigurename = \sjtu@label@listfigure,
+ listtablename = \sjtu@label@listtable}
+\patchcmd\cleardoublepage%
+ {\newpage}{\thispagestyle{empty}\newpage}
{}{}
-\patchcmd\tableofcontents
- {\chapter}
- {\cleardoublepage%
- \pdfbookmark[0]{\contentsname}{toc}%
- \chapter}
+\patchcmd\chapter%
+ {\thispagestyle{\CTEX@chapter@pagestyle}}{}
{}{}
-
-% CJK-LaTeX Logo \CJKLaTeX
-\newcommand{\CJKLaTeX}{CJK--\LaTeX}
-
-% cndash
-\newcommand{\cndash}{\rule{0.0em}{0pt}\rule[0.35em]{1.4em}{0.05em}\rule{0.2em}{0pt}}
-
-%==========
-% Segment 3. Configure the imported packages, also extend LaTeX command in sjtuthesis
-%==========
-
-%% 行距缩放因子
-\linespread{1.3}
-
-%% CTeX Settings
-% 名称:目录、表格索引、插图索引、算法、算法索引、代码
+\AtBeginDocument{%
+ \pagenumbering{Alph}
+ \pagestyle{empty}}
\ctexset{%
- contentsname = \sjtu@contentsname,
- listfigurename = \sjtu@listfigurename,
- listtablename = \sjtu@listtablename,
- autoindent = true,
chapter={%
format = \zihao{3}\bfseries\heiti\centering,
nameformat = {},
titleformat = {},
aftername = \quad,
afterindent = true,
- beforeskip = {15\p@},
- afterskip = {12\p@},
+ beforeskip = 1ex,
+ afterskip = 2ex
},
section={%
format = \zihao{4}\bfseries\heiti,
afterindent = true,
- afterskip = {1.0ex \@plus .2ex},
+ afterskip = 1ex \@plus .2ex
},
subsection={%
format = \zihao{-4}\bfseries\heiti,
afterindent = true,
- afterskip = {1.0ex \@plus .2ex},
+ afterskip = 1ex \@plus .2ex
},
subsubsection={%
- format = \normalsize\normalfont,
+ format = \zihao{-4}\normalfont,
afterindent = true,
- afterskip = {1.0ex \@plus .2ex},
+ afterskip = 1ex \@plus .2ex
},
paragraph/afterindent = true,
- subparagraph/afterindent = true,
+ subparagraph/afterindent = true}
+\ctexset{%
+ punct = quanjiao,
+ space = auto,
+ autoindent = true}
+\setlist{nosep}
+\setlist*{leftmargin=*}
+\setlist[1]{labelindent=\parindent}
+\setcounter{secnumdepth}{3}
+\setcounter{tocdepth}{2}
+\renewcommand{\tableofcontents}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\contentsname}{toc}%
+ \chapter*{\contentsname}%
+ \@mkboth{\contentsname}{\contentsname}%
+ \@starttoc{toc}
}
-
-\floatname{algorithm}{\sjtu@label@algo}
-\renewcommand{\algorithmicrequire}{\textbf{\sjtu@algorithmicrequire}}
-\renewcommand{\algorithmicensure}{\textbf{\sjtu@algorithmicensure}}
-\renewcommand{\listalgorithmname}{\sjtu@listalgorithmname}
-\renewcommand{\lstlistingname}{\sjtu@value@listingname}
-
-% bullets in the item
-\renewcommand{\labelitemi}{\ensuremath{\bullet}}
-
-%% Graphic path & file extension
-\graphicspath{{fig/}{figure/}{figures/}{logo/}{logos/}{graph/}{graphs}}
-\DeclareGraphicsExtensions{.pdf,.eps,.png,.jpg,.jpeg}
-
-% Caption setting in caption and bicaption pacakge
-\DeclareCaptionFont{kaishu}{\kaishu}
-\captionsetup{format=plain,labelformat=simple,labelsep=space,justification=centering,font={small,kaishu}}
-\captionsetup[bi-first]{bi-first}
-\captionsetup[bi-second]{bi-second}
-\captionsetup[sub]{font=footnotesize}
-
-\DeclareCaptionOption{bi-first}[]{%
- \def\tablename{\sjtu@tablename}
- \def\figurename{\sjtu@figurename}
+\renewcommand{\listoffigures}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\listfigurename}{lof}%
+ \chapter*{\listfigurename}%
+ \@mkboth{\listfigurename}{\listfigurename}%
+ \@starttoc{lof}
}
-\DeclareCaptionOption{bi-second}[]{%
- \def\tablename{Table}
- \def\figurename{Figure}
+\renewcommand{\listoftables}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\listtablename}{lot}%
+ \chapter*{\listtablename}%
+ \@mkboth{\listtablename}{\listtablename}%
+ \@starttoc{lot}
}
-
-% Set fontnote font size in threeparttable
-\appto\TPTnoteSettings{\footnotesize}
-
-% Ref https://github.com/sjtug/SJTUThesis/issues/186
-\@addtoreset{algorithm}{chapter}% algorithm counter resets every chapter
-
-% Floating parameters
+\renewcommand{\cftfigpresnum}{\sjtu@label@figure~}
+\newlength{\sjtu@cftfignumwidth@tmp}
+ \settowidth{\sjtu@cftfignumwidth@tmp}{\cftfigpresnum}
+\addtolength{\cftfignumwidth}{\sjtu@cftfignumwidth@tmp}
+\renewcommand{\cfttabpresnum}{\sjtu@label@table~}
+\newlength{\sjtu@cfttabnumwidth@tmp}
+ \settowidth{\sjtu@cfttabnumwidth@tmp}{\cfttabpresnum}
+\addtolength{\cfttabnumwidth}{\sjtu@cfttabnumwidth@tmp}
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}
-
-% 定公式、图、表、算法、代码的编号为"3-1"的形式,即分隔符由.变为短杠
\AtBeginDocument{%
\renewcommand{\theequation}{\thechapter--\arabic{equation}}
\renewcommand{\thefigure}{\thechapter--\arabic{figure}}
- \renewcommand\p@subfigure{\thefigure}
- \renewcommand{\thetable}{\thechapter--\arabic{table}}
- \renewcommand{\thealgorithm}{\thechapter--\arabic{algorithm}}
- \renewcommand{\thelstlisting}{\thechapter--\arabic{lstlisting}}
-}
-
-% 图表索引前加下“图”,“表”关键词
-\ifsjtu@master
- \renewcommand*\cftfigpresnum{\sjtu@figurename~}
- % \newlength{\sjtu@cftfignumwidth@tmp}
- % \settowidth{\sjtu@cftfignumwidth@tmp}{\cftfigpresnum}
- % \addtolength{\cftfignumwidth}{\sjtu@cftfignumwidth@tmp}
- \renewcommand{\cftfigaftersnumb}{\enspace~}
- \renewcommand*\cfttabpresnum{\sjtu@tablename~}
- % \newlength{\sjtu@cfttabnumwidth@tmp}
- % \settowidth{\sjtu@cfttabnumwidth@tmp}{\cfttabpresnum}
- % \addtolength{\cfttabnumwidth}{\sjtu@cfttabnumwidth@tmp}
- \renewcommand{\cfttabaftersnumb}{\enspace~}
-\fi
-% 使用enumitem宏包配制列表环境
-% 紧凑间距
-\setlist{nosep}
-% 列表和段落头对齐
-\setlist*{leftmargin=*}
-\setlist[1]{labelindent=\parindent} % Only the level 1
-
-% 流程图定义基本形状
-\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=2cm, minimum height=1cm, text centered, draw=black]
-\tikzstyle{io} = [trapezium, trapezium left angle=75, trapezium right angle=105, minimum width=1cm, minimum height=1cm, text centered, draw=black]
-\tikzstyle{process} = [rectangle, minimum width=2cm, minimum height=1cm, text centered, draw=black]
-\tikzstyle{decision} = [diamond, minimum width=2cm, minimum height=1cm, text centered, draw=black]
-\tikzstyle{arrow} = [thick,->,>=stealth]
-
-% Setting Package listings/lstlistings
-\lstset{tabsize=4, %
- frame=shadowbox, %把代码用带有阴影的框圈起来
- commentstyle=\color{red!50!green!50!blue!50},%浅灰色的注释
- rulesepcolor=\color{red!20!green!20!blue!20},%代码块边框为淡青色
- keywordstyle=\color{blue!90}\bfseries, %代码关键字的颜色为蓝色,粗体
- showstringspaces=false,%不显示代码字符串中间的空格标记
- stringstyle=\ttfamily, % 代码字符串的特殊格式
- keepspaces=true, %
- breakindent=22pt, %
- numbers=left,%左侧显示行号
- stepnumber=1,%
- numberstyle=\tiny, %行号字体用小号
- basicstyle={\footnotesize\ttfamily}, %
- showspaces=false, %
- flexiblecolumns=true, %
- breaklines=true, %对过长的代码自动换行
- breakautoindent=true,%
- breakindent=4em, %
- aboveskip=1em, %代码块边框
- %% added by http://bbs.ctex.org/viewthread.php?tid=53451
- fontadjust,
- captionpos=t,
- framextopmargin=2pt,framexbottommargin=2pt,abovecaptionskip=-9pt,belowcaptionskip=9pt,
- xleftmargin=4em,xrightmargin=4em, % 设定listing左右的空白
- texcl=true,
- % 设定中文冲突,断行,列模式,数学环境输入,listing数字的样式
- extendedchars=false,columns=flexible,mathescape=true
- numbersep=-1em,
- % 改变双引号和单引号的样式
- literate={"}{\textquotedbl}1,
- upquote=true
-}
-
-% Setting Package siunitx
-\sisetup{detect-all} % Detecting fonts
-
-% 定理环境
-\newtheoremstyle{break}% name
- {}% Space above, empty = `usual value'
- {}% Space below
- {\itshape}% Body font
- {}% Indent amount (empty = no indent, \parindent = para indent)
- {\bfseries}% Thm head font
- {.}% Punctuation after thm head
- {\newline}% Space after thm head: \newline = linebreak
- {}% Thm head spec
-\theoremstyle{plain}
- \newtheorem{algo}{\sjtu@label@algo~}[chapter]
- \newtheorem{thm}{\sjtu@label@thm~}[chapter]
- \newtheorem{lem}[thm]{\sjtu@label@lem~}
- \newtheorem{prop}[thm]{\sjtu@label@prop~}
- \newtheorem{cor}[thm]{\sjtu@label@cor~}
-\theoremstyle{definition}
- \newtheorem{defn}{\sjtu@label@defn~}[chapter]
- \newtheorem{conj}{\sjtu@label@conj~}[chapter]
- \newtheorem{exmp}{\sjtu@label@exmp~}[chapter]
- \newtheorem{rem}{\sjtu@label@rem~}
- \newtheorem{case}{\sjtu@label@case~}
-\theoremstyle{break}
- \newtheorem{bthm}[thm]{\sjtu@label@thm~}
- \newtheorem{blem}[thm]{\sjtu@label@lem~}
- \newtheorem{bprop}[thm]{\sjtu@label@prop~}
- \newtheorem{bcor}[thm]{\sjtu@label@cor~}
- \renewcommand{\proofname}{\bfseries\sjtu@label@proof}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% The following definitions add Switch statement to LaTeX algorithmicx package
-% It's based on Werner's answer on stackoverflow
-% http://tex.stackexchange.com/questions/53357/switch-cases-in-algorithmic
-
-% New definitions
-\algnewcommand\algorithmicswitch{\textbf{switch}}
-\algnewcommand\algorithmiccase{\textbf{case}}
-\algnewcommand\algorithmicdefault{\textbf{default}}
-
-% New "environments"
-% using \algtext*{} removes any typesetting of that command
-\algdef{SE}[SWITCH]{Switch}{EndSwitch}[1]{\algorithmicswitch\ (#1)}{\algorithmicend\ \algorithmicswitch}%
-%\algtext*{EndSwitch}%
-\algdef{SE}[CASE]{Case}{EndCase}[1]{\algorithmiccase\ #1:}{\algorithmicend\ \algorithmiccase}%
-\algtext*{EndCase}%
-\algdef{SE}[DEFAULT]{Default}{EndDefault}{\algorithmicdefault\ :}{\algorithmicend\ \algorithmicdefault}%
-\algtext*{EndDefault}%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% The following add some extra commands to LaTeX algorithmicx package
-
-% Assert
-\algnewcommand\algorithmicassert{\texttt{assert}}
-\algnewcommand\Assert[1]{\State \algorithmicassert(#1)}%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%==========
-% Segment 4. Draw the sjtuthesis
-%==========
-
-\renewcommand\maketitle{%
- \pdfbookmark[0]{\sjtu@titlepage}{titlepage}
- \ifsjtu@coursepaper
- \makechinesetitle@coursepaper
+ \renewcommand{\p@subfigure}{\thefigure}
+ \renewcommand{\thetable}{\thechapter--\arabic{table}}}
+\DeclareCaptionFont{sjtucaptionfont}{\zihao{5}\kaishu}
+\DeclareCaptionFont{sjtusubcaptionfont}{\zihao{-5}\normalfont}
+\captionsetup{%
+ format = plain,
+ labelformat = simple,
+ labelsep = space,
+ justification = centering,
+ font = sjtucaptionfont}
+\DeclareCaptionOption{bi-first}[]{%
+ \def\tablename{\sjtu@label@table}
+ \def\figurename{\sjtu@label@figure}}
+\DeclareCaptionOption{bi-second}[]{%
+ \def\tablename{Table}
+ \def\figurename{Figure}}
+\captionsetup[bi-first]{bi-first}
+\captionsetup[bi-second]{bi-second}
+\captionsetup[sub]{font=sjtusubcaptionfont}
+\newcommand{\sjtu@square}{%
+ \ifsjtu@unsetfont
+ {$\square$}
\else
- \ifsjtu@bachelor
- \makechinesetitle@bachelor
- \else
- \ifsjtu@master
- \makechinesetitle@master
- \makeenglishtitle@master
- \else
- \makechinesetitle
- \makeenglishtitle
- \fi
- \fi
+ \raisebox{-0.125ex}{\scalebox{1.5}{$\square$}}
\fi
}
-
-\ExplSyntaxOn
-\tl_new:N \l__sjtu_tmp_tl
-\seq_new:N \l__sjtu_tmp_seq
-\NewDocumentCommand{ \sjtu@covertitle@handler } { O { \\ } m }
- {
- \seq_set_split:Nnn \l__sjtu_tmp_seq { #1 } { #2 }
- \seq_pop_right:NN \l__sjtu_tmp_seq \l__sjtu_tmp_tl
- \seq_map_inline:Nn \l__sjtu_tmp_seq { \underline { \makebox [ 300pt ] { ##1 } } \\ }
- \underline { \makebox [ 300pt ] { \l__sjtu_tmp_tl } }
- }
-\NewDocumentCommand{ \sjtu@title@handler } { O { \\ } m }
- {
- \seq_set_split:Nnn \l__sjtu_tmp_seq { #1 } { #2 }
- \seq_map_inline:Nn \l__sjtu_tmp_seq { ##1 }
+\newcommand{\sjtu@authconf}{%
+ \par\hspace{7em}%
+ {\heiti 保\quad 密}~\sjtu@square,在 \uline{\hspace{3em}}
+ 年解密后适用本授权书。\par
+ 本\sjtu@label@thesiscat 属于
+ \par\hspace{7em}%
+ {\heiti 不保密}~\sjtu@square。
+ \vskip 1ex
+ (请在以上方框内打“$\checkmark$”)
+}
+\newcommand{\sjtu@signbox}[1]{%
+ \parbox{.45\textwidth}{%
+ #1 签名: \vskip 4em%
+ 日期: \hspace{\stretch{3}} 年%
+ \hspace{\stretch{2}} 月 \hspace{\stretch{2}} 日%
}
-\ExplSyntaxOff
-
-% “绘制”硕士论文模板中文标题页
-\newcommand\makechinesetitle@master{%
- \cleardoublepage
- \thispagestyle{empty}
- \begin{center}
- {\songti\zihao{-2} ~\\[35pt] \sjtu@label@statement}
- \vskip\stretch{1}
- {\heiti\zihao{2}\sjtu@value@chinesetitle}
- \vskip\stretch{1.2}
- {\fangsong\zihao{4}}
- \zihao{4}
- \def\tabcolsep{1pt}
- \def\arraystretch{1.25}
- \begin{tabular}{>{\begin{CJKfilltwosides}[t]{7\ccwd}\heiti }r<{\end{CJKfilltwosides}}l}
- \ifsjtu@review
- \sjtu@label@author & \enspace ~ \\
- \sjtu@label@studentnumber & \enspace ~ \\
- \sjtu@label@advisor & \enspace ~ \\
- \ifx\sjtu@value@coadvisor\undefined\else
- \sjtu@label@coadvisor & \enspace ~ \\
- \fi
- \else
- \sjtu@label@author & \enspace {\sjtu@value@author} \\
- \sjtu@label@studentnumber & \enspace {\sjtu@value@studentnumber} \\
- \sjtu@label@advisor & \enspace {\sjtu@value@advisor} \\
- \ifx\sjtu@value@coadvisor\undefined\else
- \sjtu@label@coadvisor & \enspace {\sjtu@value@coadvisor} \\
- \fi
- \fi
- \sjtu@label@cnacademicdegree & \enspace {\sjtu@value@cnacademicdegree } \\
- \sjtu@label@major & \enspace {\sjtu@value@major} \\
- \sjtu@label@institute & \enspace {\sjtu@value@institute} \\
- \sjtu@label@defenddate & \enspace {\sjtu@value@defenddate} \\
- \sjtu@label@school & \enspace {\sjtu@value@school}
- \end{tabular}
- \end{center}
- \vskip \stretch{0.25}
- \cleardoublepage
}
-% “绘制”硕士论文模板英文标题页
-\newcommand\makeenglishtitle@master{%
- \cleardoublepage
- \thispagestyle{empty}
- \begin{center}
- {\normalfont\zihao{-2} ~\\[35pt] \sjtu@label@englishstatement}
- \vskip\stretch{1}
- {\zihao{2} \textbf{\MakeUppercase{\sjtu@value@englishtitle}} \vskip 1pt}
- \vskip \stretch{1}
- {\normalfont\zihao{4}}
- \zihao{4}
- \def\tabcolsep{1pt}
- \def\arraystretch{1.3}
- \begin{tabular}{ll}
- \ifsjtu@review
- \textbf{\sjtu@label@englishauthor} & \enspace ~ \\
- \textbf{\sjtu@label@englishstudentid} & \enspace ~ \\
- \textbf{\sjtu@label@englishadvisor} & \enspace ~ \\
- \ifx\sjtu@value@englishcoadvisor\undefined\else
- \textbf{\sjtu@label@englishcoadvisor} & \enspace ~ \\
- \fi
- \else
- \textbf{\sjtu@label@englishauthor} & \enspace \sjtu@value@englishauthor \\
- \textbf{\sjtu@label@englishstudentid} & \enspace \sjtu@value@englishstudentid \\
- \textbf{\sjtu@label@englishadvisor} & \enspace \sjtu@value@englishadvisor \\
- \ifx\sjtu@value@englishcoadvisor\undefined\else
- \textbf{\sjtu@label@englishcoadvisor} & \enspace \sjtu@value@englishcoadvisor \\
- \fi
- \fi
- \textbf{\sjtu@label@enacademicdegree} & \enspace \sjtu@value@enacademicdegree \\
- \textbf{\sjtu@label@englishmajor} & \enspace \sjtu@value@englishmajor \\
- \textbf{\sjtu@label@englishinstitutemaster} & \enspace \makecell[l]{\sjtu@value@englishinstitutemaster} \\
- \textbf{\sjtu@label@englishdate} & \enspace \sjtu@value@englishdate \\
- \textbf{\sjtu@label@englishschool} & \enspace \sjtu@value@englishschool
- \end{tabular}
- \end{center}
- \vskip \stretch{0.4}
- \cleardoublepage
+\NewDocumentCommand{\makeDeclareOriginality}{o}{%
+ \ifsjtu@review\relax\else%
+ \cleardoublepage
+ \pdfbookmark[0]{\sjtu@label@originality}{origtitle}
+ \IfNoValueTF{#1}{%
+ \thispagestyle{empty}
+ \chapter*{\zihao{-2}\sjtu@label@schoolChi \\%
+ \sjtu@label@origtitle}
+ {\zihao{4}
+ \sjtu@label@origbody
+ \vskip16ex
+ \noindent
+ \begin{minipage}{\textwidth}
+ \hfill
+ \sjtu@signbox{\sjtu@label@thesiscat 作者}
+ \end{minipage}}}
+ {\includepdf[pagecommand={\thispagestyle{empty}}]{#1}}
+ \fi
}
-
-% “绘制”中文标题页
-\newcommand\makechinesetitle{%
- \cleardoublepage
- \thispagestyle{empty}
- \begin{center}
- {\zihao{-3}\sjtu@label@statement}
- \vskip\stretch{1}
- {\heiti\zihao{3}\sjtu@value@chinesetitle}
- \vskip\stretch{1}
- \def\tabcolsep{1pt}
- \def\arraystretch{1.5}
- \begin{tabular}{>{\begin{CJKfilltwosides}{4\ccwd}\heiti}r<{\end{CJKfilltwosides}}@{:}c}
- \ifsjtu@review
- \sjtu@label@author & \\ \cline{2-2}
- \sjtu@label@studentnumber & \makebox[150pt]{} \\ \cline{2-2}
- \sjtu@label@advisor & \\ \cline{2-2}
- \ifx\sjtu@value@coadvisor\undefined\else
- \sjtu@label@coadvisor & \\ \cline{2-2}
- \fi
- \else
- \sjtu@label@author & \sjtu@value@author \\ \cline{2-2}
- \sjtu@label@studentnumber & \makebox[150pt]{\sjtu@value@studentnumber} \\ \cline{2-2}
- \sjtu@label@advisor & \sjtu@value@advisor \\ \cline{2-2}
- \ifx\sjtu@value@coadvisor\undefined\else
- \sjtu@label@coadvisor & \sjtu@value@coadvisor \\ \cline{2-2}
- \fi
- \fi
- \sjtu@label@major & \sjtu@value@major \\ \cline{2-2}
- \sjtu@label@defenddate & \sjtu@value@defenddate \\ \cline{2-2}
- \end{tabular}
- \vskip 30pt
- \end{center}
- \cleardoublepage
+\NewDocumentCommand{\makeDeclareAuthorization}{o}{%
+ \ifsjtu@review\relax\else%
+ \cleardoublepage
+ \pdfbookmark[0]{\sjtu@label@authorization}{authtitle}
+ \IfNoValueTF{#1}{%
+ \thispagestyle{empty}
+ \chapter*{\zihao{-2}\sjtu@label@schoolChi \\%
+ \sjtu@label@authtitle}
+ {\zihao{4}
+ \sjtu@label@authbody
+ \vskip1ex
+ \sjtu@authconf
+ \vskip16ex
+ \noindent
+ \begin{minipage}{\textwidth}
+ \sjtu@signbox{\sjtu@label@thesiscat 作者}
+ \hfill
+ \sjtu@signbox{指导教师}
+ \end{minipage}}}
+ {\includepdf[pagecommand={\thispagestyle{empty}}]{#1}}
+ \fi
}
-
-% “绘制”英文标题页
-\newcommand\makeenglishtitle{%
+\NewDocumentEnvironment{nomenclature}{m}
+{\cleardoublepage
+ \pdfbookmark[0]{\sjtu@label@nomenclature}{nomenclature}
+ \chapter*{\sjtu@label@nomenclature}
+ \markboth{\sjtu@label@nomenclature}%
+ {\sjtu@label@nomenclature}
+ \begin{longtable}{#1}}
+{\end{longtable}}
+\NewDocumentEnvironment{summary}{}{%
\cleardoublepage
- \thispagestyle{empty}
- \begin{center}
- {\normalfont\zihao{4} \sjtu@label@englishstatement}
- \vspace{20pt} \vskip\stretch{1}
- {\huge\sjtu@value@englishtitle \vskip 1pt}
- \vskip \stretch{1}
- \ifsjtu@review
- \vskip \stretch{1}
- \vskip 3pt
- \vskip \stretch{2}
- \else
- {\normalfont\zihao{4}\sjtu@value@englishauthor}
- \vskip \stretch{1}
- {\normalfont\zihao{4}\sjtu@label@englishadvisor}
- \vskip 2pt
- {\normalfont\zihao{4}\sjtu@value@englishadvisor}
- \vskip 5pt
- \ifx\sjtu@value@englishcoadvisor\undefined\else
- {\normalfont\zihao{4}\sjtu@label@englishcoadvisor}
- \vskip 2pt
- {\normalfont\zihao{4}\sjtu@value@englishcoadvisor}
- \vskip \stretch{2}
- \fi
- \fi
- \normalfont\sjtu@value@englishinstitute \vskip 30pt
- \normalfont\sjtu@value@englishdate \vskip 20pt
- \end{center}
- \cleardoublepage
-}
-
-% “绘制”学士论文中文标题页
-\newcommand\makechinesetitle@bachelor{%
+ \chapter*{\sjtu@label@summary}
+ \markboth{\sjtu@label@summary}%
+ {\sjtu@label@summary}
+ \addcontentsline{toc}{chapter}{\sjtu@label@summary}
+}{}
+\newcommand{\sjtu@acknowledgements}[1]{\long\gdef\sjtu@acknowledgements@body{#1}}
+\NewDocumentEnvironment{acknowledgements}{}
+{\Collect@Body\sjtu@acknowledgements}
+{\ifsjtu@review\relax\else%
+ \cleardoublepage
+ \chapter*{\sjtu@label@acknowledgements}
+ \markboth{\sjtu@label@acknowledgements}%
+ {\sjtu@label@acknowledgements}
+ \addcontentsline{toc}{chapter}{\sjtu@label@acknowledgements}
+ \sjtu@acknowledgements@body
+ \fi}
+\NewDocumentEnvironment{sjtu@bibliolist}{o}{%
+ \list%
+ {\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}
+ \setlength{\labelsep}{\biblabelsep}%
+ \setlength{\leftmargin}{\bibhang}%
+ \addtolength{\leftmargin}{\labelwidth}%
+ \setlength{\itemindent}{0pt}%
+ \setlength{\itemsep}{\bibitemsep}%
+ \setlength{\parsep}{\bibparsep}}%
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand{\theenumiv}{\@arabic\c@enumiv}}
+{\def\@noitemerr
+ {\@latex@warning{Empty `bibliolist' environment}}%
+ \endlist}
+\NewDocumentEnvironment{publications}{O{99}}
+{\cleardoublepage
+ \chapter{\sjtu@label@publications}
+ \markboth{\sjtu@label@publications}%
+ {\sjtu@label@publications}
+ \begin{sjtu@bibliolist}[#1]}
+{\end{sjtu@bibliolist}}
+\NewDocumentEnvironment{patents}{O{99}}
+{\cleardoublepage
+ \chapter{\sjtu@label@patents}
+ \markboth{\sjtu@label@patents}%
+ {\sjtu@label@patents}
+ \begin{sjtu@bibliolist}[#1]}
+{\end{sjtu@bibliolist}}
+\NewDocumentEnvironment{projects}{O{99}}
+{\cleardoublepage
+ \chapter{\sjtu@label@projects}
+ \markboth{\sjtu@label@projects}%
+ {\sjtu@label@projects}
+ \begin{sjtu@bibliolist}[#1]}
+{\end{sjtu@bibliolist}}
+\newcommand{\sjtu@resume}[1]{\long\gdef\sjtu@resume@body{#1}}
+\NewDocumentEnvironment{resume}{}
+{\Collect@Body\sjtu@resume}
+{\ifsjtu@review\relax\else%
\cleardoublepage
- \thispagestyle{empty}
- \begin{center}
- \kaishu
- \vspace*{20pt} \vskip 7pt
- \includegraphics{sjtulogo}
- \vskip 30pt
- {\fontsize{32}{32}\sjtu@value@chinesedegree\sjtu@label@thesis}
- \vskip 15pt
- {\zihao{-2}\MakeUppercase{Thesis of \sjtu@value@englishdegree}}
- \vskip 15pt
- \includegraphics{sjtubadge}
- \vskip \stretch{2}
- {
- \zihao{2}
- \begin{tabular}{r@{:}l}
- \sjtu@label@title & {\zihao{-2}\parbox[t]{320pt}{\sjtu@value@chinesecovertitle}}
- \end{tabular}
- }
- \vskip \stretch{1}
- {
- \zihao{3}
- \def\arraystretch{1.1}
- \begin{tabular}{>{\begin{CJKfilltwosides}{4\ccwd}}r<{\end{CJKfilltwosides}}@{:}c}
- \ifsjtu@review
- \sjtu@label@author & \\ \cline{2-2}
- \sjtu@label@studentnumber & \makebox[180pt]{} \\ \cline{2-2}
- \else
- \sjtu@label@author & \sjtu@value@author \\ \cline{2-2}
- \sjtu@label@studentnumber & \makebox[180pt]{\sjtu@value@studentnumber} \\ \cline{2-2}
- \fi
- \sjtu@label@major & \sjtu@value@major \\ \cline{2-2}
- \ifsjtu@review
- \sjtu@label@advisor & \\ \cline{2-2}
- \else
- \sjtu@label@advisor & \sjtu@value@advisor \\ \cline{2-2}
- \fi
- \sjtu@label@institute & \sjtu@value@institute \\ \cline{2-2}
- \end{tabular}
+ \chapter{\sjtu@label@resume}
+ \markboth{\sjtu@label@resume}%
+ {\sjtu@label@resume}
+ \sjtu@resume@body
+\fi}
+\AtBeginDocument{
+ \ifsjtu@review%
+ \sjtuSetInfo{%
+ author={},
+ supervisor={},
+ assisupervisor={},
+ enauthor={},
+ ensupervisor={},
+ enassisupervisor={},
+ studentid={},
+ date={},
+ endate={}
}
- \end{center}
- \cleardoublepage
+ \fi
+ \hypersetup{%
+ pdftitle = \sjtu@value@title,
+ pdfauthor = \sjtu@value@author,
+ pdfsubject = \sjtu@label@subjectChi,
+ pdfkeywords = \sjtu@value@keywords,
+ pdfcreator = {LaTeX with SJTUThesis \version}
+ }%
}
-
-% “绘制”课程论文标题页
-\newcommand\makechinesetitle@coursepaper{%
- \cleardoublepage
- \thispagestyle{empty}
- \begin{center}
- \kaishu
- \vspace*{20pt} \vskip 7pt
- \includegraphics{sjtulogo}
- \vskip 30pt
- {\fontsize{32}{32}\sjtu@label@coursepaper}
- \vskip 15pt
- \includegraphics{sjtubadge}
- \vskip \stretch{2}
- {
- \zihao{2}
- \begin{tabular}{r@{:}l}
- \sjtu@label@title & {\zihao{-2}\parbox[t]{320pt}{\sjtu@value@chinesecovertitle}}
- \end{tabular}
- }
- \vskip \stretch{1}
- {
- \zihao{3}
- \def\arraystretch{1.1}
- \begin{tabular}{>{\begin{CJKfilltwosides}{4\ccwd}}r<{\end{CJKfilltwosides}}@{:}c}
- \sjtu@label@coursename & \sjtu@value@coursename \\ \cline{2-2}
- \sjtu@label@author & \sjtu@value@author \\ \cline{2-2}
- \sjtu@label@studentnumber & \makebox[180pt]{\sjtu@value@studentnumber} \\ \cline{2-2}
- \sjtu@label@institute & \sjtu@value@institute \\ \cline{2-2}
- \sjtu@label@major & \sjtu@value@major \\ \cline{2-2}
- \end{tabular}
- }
- \end{center}
- \cleardoublepage
+\NewDocumentCommand{\encrypt}{m O{***}}{%
+ \ifsjtu@review
+ {#2}
+ \else
+ {#1}
+ \fi
}
-
-% 原创性声明
-\newcommand\makeDeclareOriginal{%
- \cleardoublepage
- \thispagestyle{empty}
- \begin{center}
- ~\\[70pt]
- % \linespread{1.5}
- {\zihao{-2}\heiti \textbf{\sjtu@value@school}} \\[12pt]
- {\zihao{-2}\heiti \textbf{\sjtu@label@original}} \\[12pt]
- \end{center}
- \vskip 10pt
- {\par\linespread{2}\zihao{4}本人郑重声明:所呈交的学位论文《\sjtu@value@chinesetitle》,\sjtu@label@originalcontent\par}
- \vskip 80pt
- {\zihao{4}\hspace{13em}\sjtu@label@authorsign\hrulefill\hspace{1.5em}}
- \vskip 40pt
- {\zihao{4}\hspace{11em}\sjtu@label@originalDate\hspace{1em}}
- \cleardoublepage
+\newcommand{\sjtu@uline}[1]%
+{\begingroup
+ \setbox0=\vbox{\strut #1\strut}%
+ \dimen0=0pt
+ \loop\ifdim\ht0>0pt
+ \dimen1=\dimexpr\ht0 - \baselineskip\relax
+ \setbox1=\vsplit0 to \ht\strutbox
+ \advance\dimen1 by -\ht0
+ \noindent\raisebox{-\dimen0}[\ht\strutbox][\dp\strutbox]{\box1}%
+ \advance\dimen0 by \dimen1
+ \vspace{-0.2ex}\hrule\vskip 0.2ex
+ \repeat
+\endgroup}
+\hypersetup{
+ linktoc = all,
+ bookmarksnumbered = true,
+ bookmarksopen = true,
+ bookmarksopenlevel = 1,
+ unicode = true,
+ psdextra = true,
+ breaklinks = true,
+ plainpages = false,
+ hidelinks,
}
-
-% 授权声明
-\newcommand\makeDeclareAuthorization{%
- \cleardoublepage
- \thispagestyle{empty}
- \begin{center}
- ~\\[30pt]
- {\zihao{-2}\bfseries\heiti \sjtu@value@school} \\[12pt]
- {\zihao{-2}\bfseries\heiti \sjtu@label@authorization} \\[12pt]
- \end{center}
- \vskip 10pt
- {\par\linespread{1.5}\zihao{4}\sjtu@label@authorizationcontent\par}
- \vskip 150pt
- {\zihao{4} \sjtu@label@authorsign\hrulefill\hspace{3em}\sjtu@label@Supervisorsign\hrulefill}
- \vskip 40pt
- {\zihao{4} \sjtu@label@originalDate\hfill\hspace{3em}\sjtu@label@originalDate}
- \cleardoublepage
+\pdfstringdefDisableCommands{%
+ \let\\\@empty
+ \let\quad\@empty
+ \let\hspace\@gobble
}
-
-% fancyhdr页眉页脚设置
-\ifsjtu@english
- \def\sjtu@value@titlemark{\sjtu@value@englishtitle}
- \newcommand\sjtu@fancyhead{\footnotesize\kaishu}
- \newcommand\sjtu@fancyfoot[2]{\small --~~Page~~{\bfseries{#1}}~~of~~{\bfseries{#2}}~~--}
+\urlstyle{same}
+\def\UrlBreaks{%
+ \do\/%
+ \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l%
+ \do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z%
+ \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L%
+ \do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z%
+ \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:%
+ \do\*\do\-\do\~\do\'\do\"\do\-}
+\Urlmuskip=0mu plus 0.1mu
+\ifsjtu@bachelor%
+ \AtEndOfClass{\input{sjtuthesis-bachelor.ltx}}
\else
- \def\sjtu@value@titlemark{\sjtu@value@chinesetitle}
- \newcommand\sjtu@fancyhead{\small\kaishu}
- \newcommand\sjtu@fancyfoot[2]{\small 第~{\bfseries{#1}}~页\,共~{\bfseries{#2}}~页}
+ \ifsjtu@master%
+ \AtEndOfClass{\input{sjtuthesis-graduate.ltx}}
+ \fi
\fi
-\def\markboxwidth{0.75\textwidth}
-\AtBeginDocument{\pagenumbering{Alph}}
-
-\ifsjtu@coursepaper
- %% 本科学位论文页眉页脚设置
- %% 前言页眉页脚
- \fancypagestyle{front}{%
- \fancyhf{}
- \fancyhead[L]{\includegraphics{figure/sjtubanner}}
- \fancyhead[R]{\parbox[b]{\markboxwidth}{\raggedleft\nouppercase{\sjtu@fancyhead\sjtu@value@titlemark}}}
- \fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.Roman}}}
- \renewcommand{\headheight}{32pt}
+\newcommand{\sjtu@atendpackage}{\csname ctex_at_end_package:nn\endcsname}
+\sjtu@atendpackage{unicode-math}{
+ \unimathsetup{
+ math-style = ISO,
+ bold-style = ISO,
+ nabla = upright,
+ partial = upright,
}
- %% 正文页眉页脚
- \fancypagestyle{main}{%
- \fancyhf{}
- \fancyhead[L]{\includegraphics{figure/sjtubanner}}
- \fancyhead[R]{\parbox[b]{\markboxwidth}{\raggedleft\nouppercase{\sjtu@fancyhead\sjtu@value@titlemark}}}
- \fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.arabic}}}
- \renewcommand{\headheight}{32pt}
+ \newcommand{\bm}{\symbf}
+ \renewcommand{\boldsymbol}{\symbf}
+ \newcommand{\square}{\mdlgwhtsquare}
+ \@ifpackagelater{hyperref}{2019/04/27}{}{%
+ \g@addto@macro\psdmapshortnames{\let\mu\textmugreek}%
}
-\else
- \ifsjtu@bachelor
- %% 本科学位论文页眉页脚设置
- %% 前言页眉页脚
- \fancypagestyle{front}{%
- \fancyhf{}
- \fancyhead[L]{\includegraphics{figure/sjtubanner}}
- \fancyhead[R]{\parbox[b]{\markboxwidth}{\raggedleft\nouppercase{\sjtu@fancyhead\sjtu@value@titlemark}}}
- \fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.Roman}}}
- \renewcommand{\headheight}{32pt}
- }
- %% 正文页眉页脚
- \fancypagestyle{main}{%
- \fancyhf{}
- \fancyhead[L]{\includegraphics{figure/sjtubanner}}
- \fancyhead[R]{\parbox[b]{\markboxwidth}{\raggedleft\nouppercase{\sjtu@fancyhead\sjtu@value@titlemark}}}
- \fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.arabic}}}
- \renewcommand{\headheight}{32pt}
- }
- %% 英文大摘要
- \fancypagestyle{biglast}{%
- \fancyhf{}
- \fancyhead[L]{\includegraphics{figure/sjtubanner}}
- \fancyhead[R]{\parbox[b]{\markboxwidth}{\raggedleft\nouppercase{\sjtu@fancyhead\sjtu@value@titlemark}}}
- \fancyfoot[C]{\sjtu@fancyfoot{\theCurrentPageLocal}{\lastpageref{pagesLTS.roman.local}}}
- \renewcommand{\headheight}{32pt}
- }
- \else
- %% 研究生学位论文页眉页脚设置
- \if@twoside
- %% 双面打印页眉页脚
- \fancypagestyle{front}{%
- \fancyhf{}
- \fancyhead[LO,RE]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
- \fancyhead[LE,RO]{\nouppercase{\sjtu@fancyhead\leftmark}}
- \fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
- \renewcommand{\headheight}{32pt}
- }
- \fancypagestyle{main}{%
- \fancyhf{}
- \fancyhead[LO,RE]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
- \fancyhead[LE,RO]{\nouppercase{\sjtu@fancyhead\leftmark}}
- \fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
- \renewcommand{\headheight}{32pt}
- }
- \else
- %% 单面打印页眉页脚
- \fancypagestyle{front}{%
- \fancyhf{}
- \fancyhead[L]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
- \fancyhead[R]{\nouppercase{\sjtu@fancyhead\leftmark}}
- \fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
- \renewcommand{\headheight}{32pt}
- }
- \fancypagestyle{main}{%
- \fancyhf{}
- \fancyhead[L]{\small\kaishu\sjtu@value@school\sjtu@value@chinesedegree\sjtu@label@thesis}
- \fancyhead[R]{\nouppercase{\sjtu@fancyhead\leftmark}}
- \fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
- \renewcommand{\headheight}{32pt}
- }
- \fi
- \fi
-\fi
-
-\renewcommand\frontmatter{%
- \cleardoublepage
- \@mainmatterfalse
- \ifsjtu@coursepaper
- \pagestyle{front}
- \else
- \ifsjtu@bachelor
- \pagestyle{front}
- \else
- \pagestyle{main}
- \fi
- \fi
- \pagenumbering{Roman}
}
-\renewcommand\mainmatter{%
- \cleardoublepage
- \@mainmattertrue
- \pagestyle{main}
- \pagenumbering{arabic}
+\sjtu@atendpackage{threeparttable}{
+ \appto\TPTnoteSettings{\footnotesize}
}
-
-% 中英文摘要+关键词
-\newenvironment{abstract}{%
- \cleardoublepage
- \pdfbookmark[0]{\sjtu@label@abstract}{abstract}
- \ifsjtu@bachelor
- \chapter*{%
- {\zihao{3} \sjtu@value@chinesetitle}
- \vskip 20pt
- {\zihao{4} \sjtu@label@chineseabstract}
- }
- \zihao{5} \markboth{\sjtu@label@chineseabstract}{}
- \else
- \chapter*{%
- \sjtu@value@chinesetitle
- \vskip 20pt
- \sjtu@label@chineseabstract
+\sjtu@atendpackage{siunitx}{
+ \sisetup{
+ detect-all,
+ group-minimum-digits = 4,
+ separate-uncertainty = true,
+ inter-unit-product = \ensuremath{{}\cdot{}},
+ }
+ \ifsjtu@chinese
+ \sisetup{
+ list-final-separator = { 和 },
+ list-pair-separator = { 和 },
+ range-phrase = {~},
}
- \zihao{4} \markboth{\sjtu@label@chineseabstract}{}
- \fi
-}{
- \vspace{2ex}\noindent
- \ifsjtu@bachelor
- {\zihao{-4} \textbf{\sjtu@label@keywords}}{\zihao{5}{\sjtu@value@keywords}}
- \else
- {\zihao{4} \textbf{\sjtu@label@keywords}{\sjtu@value@keywords}}
\fi
}
-\newenvironment{englishabstract}{%
- \cleardoublepage
- \ifsjtu@bachelor
- \chapter*{%
- {\zihao{3} \MakeUppercase\sjtu@value@englishtitle}
- \vskip 20pt
- {\zihao{4} \MakeUppercase\sjtu@label@englishabstract}
- }
- \zihao{5} \markboth{\sjtu@label@englishabstract}{}
- \else
- \chapter*{%
- \MakeUppercase\sjtu@value@englishtitle
- \vskip 20pt
- \MakeUppercase\sjtu@label@englishabstract
- }
- \zihao{4} \markboth{\sjtu@label@englishabstract}{}
- \fi
-}{
- \vspace{2ex}\noindent
- \ifsjtu@bachelor
- {\zihao{-4} \textbf{\sjtu@label@englishkeywords}}{\zihao{5} \sjtu@value@englishkeywords}
+\PassOptionsToPackage{amsmath,thmmarks,hyperref}{ntheorem}
+\sjtu@atendpackage{ntheorem}{
+ \ifsjtu@chinese
+ \def\sjtu@label@assertion{断言}
+ \def\sjtu@label@assumption{假设}
+ \def\sjtu@label@axiom{公理}
+ \def\sjtu@label@corollary{推论}
+ \def\sjtu@label@definition{定义}
+ \def\sjtu@label@example{例}
+ \def\sjtu@label@lemma{引理}
+ \def\sjtu@label@proof{证明}
+ \def\sjtu@label@proposition{命题}
+ \def\sjtu@label@remark{注}
+ \def\sjtu@label@theorem{定理}
\else
- {\zihao{4} \textbf{\sjtu@label@englishkeywords}{\sjtu@value@englishkeywords}}
+ \def\sjtu@label@assertion{Assertion}
+ \def\sjtu@label@assumption{Assumption}
+ \def\sjtu@label@axiom{Axiom}
+ \def\sjtu@label@corollary{Corollary}
+ \def\sjtu@label@definition{Definition}
+ \def\sjtu@label@example{Example}
+ \def\sjtu@label@lemma{Lemma}
+ \def\sjtu@label@proof{Proof}
+ \def\sjtu@label@proposition{Proposition}
+ \def\sjtu@label@remark{Remark}
+ \def\sjtu@label@theorem{Theorem}
\fi
+ \theorembodyfont{\normalfont}
+ \theoremheaderfont{\bfseries\heiti}
+ \theoremseparator{\enspace}
+ \theoremsymbol{\ensuremath{\square}}
+ \newtheorem*{proof}{\sjtu@label@proof}
+ \theoremstyle{plain}
+ \theorembodyfont{\kaishu}
+ \theoremsymbol{}
+ \newtheorem{assertion} {\sjtu@label@assertion} [chapter]
+ \newtheorem{assumption} {\sjtu@label@assumption} [chapter]
+ \newtheorem{axiom} {\sjtu@label@axiom} [chapter]
+ \newtheorem{corollary} {\sjtu@label@corollary} [chapter]
+ \newtheorem{definition} {\sjtu@label@definition} [chapter]
+ \newtheorem{example} {\sjtu@label@example} [chapter]
+ \newtheorem{lemma} {\sjtu@label@lemma} [chapter]
+ \newtheorem{proposition}{\sjtu@label@proposition}[chapter]
+ \newtheorem{remark} {\sjtu@label@remark} [chapter]
+ \newtheorem{theorem} {\sjtu@label@theorem} [chapter]
}
-
-% 主要符号对照表
-\newenvironment{nomenclaturename}{\cleardoublepage
-\chapter{\sjtu@nomenclature}{}}{}
-
-\newenvironment{publications}[1]
- {\chapter{\sjtu@label@publications}%
- \@mkboth{\MakeUppercase\sjtu@label@publications}
- {\MakeUppercase\sjtu@label@publications}%
- \list{\@biblabel{\@arabic\c@enumiv}}%
- {\settowidth\labelwidth{\@biblabel{#1}}%
- \leftmargin\labelwidth
- \advance\leftmargin\labelsep
- \@openbib@code
- \usecounter{enumiv}%
- \let\p@enumiv\@empty
- \renewcommand\theenumiv{\@arabic\c@enumiv}}%
- \sloppy
- \clubpenalty4000
- \@clubpenalty \clubpenalty
- \widowpenalty4000%
- \sfcode`\.\@m}
- {\def\@noitemerr
- {\@latex@warning{Empty `publications' environment}}%
- \endlist}
-
-\newenvironment{patents}[1]
- {\chapter{\sjtu@label@patents}%
- \@mkboth{\MakeUppercase\sjtu@label@patents}
- {\MakeUppercase\sjtu@label@patents}%
- \list{\@biblabel{\@arabic\c@enumiv}}%
- {\settowidth\labelwidth{\@biblabel{#1}}%
- \leftmargin\labelwidth
- \advance\leftmargin\labelsep
- \@openbib@code
- \usecounter{enumiv}%
- \let\p@enumiv\@empty
- \renewcommand\theenumiv{\@arabic\c@enumiv}}%
- \sloppy
- \clubpenalty4000
- \@clubpenalty \clubpenalty
- \widowpenalty4000%
- \sfcode`\.\@m}
- {\def\@noitemerr
- {\@latex@warning{Empty `patents' environment}}%
- \endlist}
-
-\newenvironment{projects}[1]
- {\chapter{\sjtu@label@projects}%
- \@mkboth{\MakeUppercase\sjtu@label@projects}
- {\MakeUppercase\sjtu@label@projects}%
- \list{\@biblabel{\@arabic\c@enumiv}}%
- {\settowidth\labelwidth{\@biblabel{#1}}%
- \leftmargin\labelwidth
- \advance\leftmargin\labelsep
- \@openbib@code
- \usecounter{enumiv}%
- \let\p@enumiv\@empty
- \renewcommand\theenumiv{\@arabic\c@enumiv}}%
- \sloppy
- \clubpenalty4000
- \@clubpenalty \clubpenalty
- \widowpenalty4000%
- \sfcode`\.\@m}
- {\def\@noitemerr
- {\@latex@warning{Empty `projects' environment}}%
- \endlist}
-
-\newenvironment{resume}%
- {\chapter{\sjtu@label@resume}}%
- {}
-
-\newenvironment{resumesection}[1]%
- {{\noindent\normalfont\bfseries #1}
- \list{}{\labelwidth\z@
- \leftmargin 2\ccwd}
- \item\relax}%
- {\endlist}
-
-\newenvironment{resumelist}[1]%
- {{\noindent\normalfont\bfseries #1}
- \list{}{\labelwidth\z@
- \leftmargin 4\ccwd
- \itemindent -2\ccwd
- \listparindent\itemindent}}%
- {\endlist}
-
-\renewenvironment{thanks}{%
- \chapter*{%
- \sjtu@label@thanks
- \markboth{\sjtu@label@thanks}{}
+\PassOptionsToPackage{algochapter}{algorithm2e}
+\sjtu@atendpackage{algorithm2e}{
+ \SetAlgorithmName{\sjtu@label@algorithm}%
+ {\sjtu@label@algorithm}%
+ {\sjtu@label@listalgorithm}
+ \SetAlgoCaptionSeparator{~}
+ \newcommand{\cftalgpresnum}{\sjtu@label@algorithm~}
+ \newlength{\cftalgnumwidth}
+ \setlength{\cftalgnumwidth}{2.3em}
+ \newlength{\sjtu@cftalgnumwidth@tmp}
+ \settowidth{\sjtu@cftalgnumwidth@tmp}{\cftalgpresnum}
+ \addtolength{\cftalgnumwidth}{\sjtu@cftalgnumwidth@tmp}
+ \renewcommand*{\l@algocf}[2]{%
+ \vskip \cftbeforefigskip
+ {\leftskip \cftfigindent\relax
+ \rightskip \@tocrmarg
+ \parfillskip -\rightskip
+ \parindent \cftfigindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftalgnumwidth\relax
+ \let\@cftbsnum \cftalgpresnum
+ \let\@cftasnum \cftfigaftersnum
+ \let\@cftasnumb \cftfigaftersnumb
+ \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
+ {\cftfigfont #1}\nobreak
+ \cftfigfillnum{#2}}%
}
- \addcontentsline{toc}{chapter}{\sjtu@label@thanks}
-}{}
-
-\newenvironment{summary}{%
- \chapter*{%
- \sjtu@label@summary
- \markboth{\sjtu@label@summary}{}
+ \renewcommand{\listofalgorithms}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\listalgorithmcfname}{loa}%
+ \chapter*{\listalgorithmcfname}%
+ \@mkboth{\listalgorithmcfname}{\listalgorithmcfname}%
+ \@starttoc{loa}
}
- \addcontentsline{toc}{chapter}{\sjtu@label@summary}
-}{}
-
-\newenvironment{bigabstract}{%
- \cleardoublepage
- \pagenumbering{roman}
- \pagestyle{biglast}
- \chapter*{%
- \bfseries
- \MakeUppercase\sjtu@value@englishtitle
- \vskip 20pt
+ \AtBeginDocument{%
+ \renewcommand{\thealgocf}{\thechapter--\@arabic\c@algocf}
+ }
+}
+\sjtu@atendpackage{algorithm}{
+ \RequirePackage{algorithmicx, algpseudocode}
+ \floatname{algorithm}{\sjtu@label@algorithm}
+ \renewcommand{\listalgorithmname}{\sjtu@label@listalgorithm}
+ \@addtoreset{algorithm}{chapter}
+ \patchcmd\@chapter%
+ {\if@twocolumn}
+ {\addtocontents{loa}{\protect\addvspace{10\p@}}%
+ \if@twocolumn}
+ {}{}
+ \newcommand{\cftalgpresnum}{\sjtu@label@algorithm~}
+ \newlength{\cftalgnumwidth}
+ \setlength{\cftalgnumwidth}{2.3em}
+ \newlength{\sjtu@cftalgnumwidth@tmp}
+ \settowidth{\sjtu@cftalgnumwidth@tmp}{\cftalgpresnum}
+ \addtolength{\cftalgnumwidth}{\sjtu@cftalgnumwidth@tmp}
+ \newcommand*{\l@algorithm}[2]{%
+ \vskip \cftbeforefigskip
+ {\leftskip \cftfigindent\relax
+ \rightskip \@tocrmarg
+ \parfillskip -\rightskip
+ \parindent \cftfigindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftalgnumwidth\relax
+ \let\@cftbsnum \cftalgpresnum
+ \let\@cftasnum \cftfigaftersnum
+ \let\@cftasnumb \cftfigaftersnumb
+ \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
+ {\cftfigfont #1}\nobreak
+ \cftfigfillnum{#2}}%
+ }
+ \renewcommand{\listofalgorithms}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\listalgorithmname}{loa}%
+ \chapter*{\listalgorithmname}%
+ \@mkboth{\listalgorithmname}{\listalgorithmname}%
+ \@starttoc{loa}
}
-}{\cleardoublepage}
-
+ \AtBeginDocument{%
+ \renewcommand{\thealgorithm}{\thechapter--\arabic{algorithm}}
+ }
+}
+\sjtu@atendpackage{listings}{
+ \lstdefinestyle{lstStyleCode}{
+ aboveskip=\medskipamount,
+ belowskip=\medskipamount,
+ basicstyle=\footnotesize\ttfamily,
+ commentstyle=\slshape\color{black!60},
+ stringstyle=\color{green!40!black!100},
+ keywordstyle=\bfseries\color{blue!50!black},
+ extendedchars=false,
+ upquote=true,
+ tabsize=2,
+ showstringspaces=false,
+ xleftmargin=1em,
+ xrightmargin=1em,
+ breaklines=true,
+ breakindent=2em,
+ framexleftmargin=1em,
+ framexrightmargin=1em,
+ backgroundcolor=\color{gray!10},
+ columns=flexible,
+ keepspaces=true,
+ texcl=true,
+ mathescape=true
+ }
+ \lstnewenvironment{codeblock}[1][]
+ {\lstset{style=lstStyleCode,language=#1}}{}
+}
+\sjtu@atendpackage{tikz}{
+ \usetikzlibrary{shapes.geometric, arrows}
+ \tikzstyle{startstop} = [
+ rectangle,
+ rounded corners,
+ minimum width=2cm,
+ minimum height=1cm,
+ text centered,
+ draw=black
+ ]
+ \tikzstyle{io} = [
+ trapezium,
+ trapezium left angle=75,
+ trapezium right angle=105,
+ minimum width=1cm,
+ minimum height=1cm,
+ text centered,
+ draw=black
+ ]
+ \tikzstyle{process} = [
+ rectangle,
+ minimum width=2cm,
+ minimum height=1cm,
+ text centered,
+ draw=black
+ ]
+ \tikzstyle{decision} = [
+ diamond,
+ minimum width=2cm,
+ minimum height=1cm,
+ text centered,
+ draw=black]
+ \tikzstyle{arrow} = [thick, ->, >=stealth]
+}
\endinput
-
%%
%% End of file `sjtuthesis.cls'.
diff --git a/sjtuthesis.dtx b/sjtuthesis.dtx
new file mode 100644
index 00000000..5084916d
--- /dev/null
+++ b/sjtuthesis.dtx
@@ -0,0 +1,2014 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2009-2017 by weijianwen
+% (C) 2018-2019 by SJTUG
+%
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% https://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This file has the LPPL maintenance status "maintained".
+%
+% The Current Maintainer of this work is Alexara Wu.
+%
+%<*internal>
+\begingroup
+ \def\nameoflatex{LaTeX2e}
+\expandafter\endgroup\ifx\nameoflatex\fmtname\else
+\csname fi\endcsname
+%
+%<*install>
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+
+\preamble
+
+Copyright (C) 2009-2017 by weijianwen
+ (C) 2018-\the\year by SJTUG
+
+This file may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3c
+of this license or (at your option) any later version.
+The latest version of this license is in
+ https://www.latex-project.org/lppl.txt
+and version 1.3c or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This file has the LPPL maintenance status "maintained".
+
+The Current Maintainer of this work is Alexara Wu.
+
+\endpreamble
+
+\generate{
+ \usedir{tex/latex/sjtuthesis}
+ \file{\jobname.cls} {\from{\jobname.dtx}{class}}
+ \file{\jobname-bachelor.ltx}{\from{\jobname.dtx}{bachelor}}
+ \file{\jobname-graduate.ltx}{\from{\jobname.dtx}{graduate}}
+%
+%<*internal>
+ \usedir{source/latex/sjtuthesis}
+ \file{\jobname.ins} {\from{\jobname.dtx}{install}}
+%
+%<*install>
+}
+
+\Msg{* Happy TeXing!}
+
+\endbatchfile
+%
+%<*internal>
+\fi
+%
+%<*driver>
+\ProvidesFile{sjtuthesis.dtx}
+%
+%\NeedsTeXFormat{LaTeX2e}
+%\ProvidesClass{sjtuthesis}
+%\ProvidesFile{sjtuthesis-bachelor.ltx}
+%\ProvidesFile{sjtuthesis-graduate.ltx}
+%<*(class|bachelor|graduate)>
+ [2019/06/16 1.0.0rc Shanghai Jiao Tong University Thesis Template]
+%(class|bachelor|graduate)>
+%<*(driver|class)>
+\hyphenation{SJTU-Thesis}
+\def\sjtuthesis{SJTUThesis}
+\def\version{1.0.0rc}
+%(driver|class)>
+%<*driver>
+\documentclass{ctxdoc}
+\usepackage{graphicx}
+\usepackage{listings}
+\hypersetup{
+ allcolors = blue,
+ bookmarksnumbered = true,
+ bookmarksopen = true,
+}
+\definecolor{sjtublue}{cmyk}{1,0.8,0,0}
+\lstdefinestyle{lstStyleBase}{
+ basicstyle = \footnotesize\ttfamily,
+ commentstyle = \slshape\color{black!60},
+ stringstyle = \color{green!40!black!100},
+ keywordstyle = \bfseries\color{blue!50!black},
+ backgroundcolor = \color{gray!10},
+ gobble = 2, % 重要!否则会生成注释符号"%"
+ tabsize = 2,
+ xleftmargin = 1em,
+ xrightmargin = 1em,
+ framexleftmargin = 1em,
+ framexrightmargin = 1em
+}
+\lstdefinestyle{lstStyleShell}{
+ style=lstStyleBase,
+ language=bash
+}
+\lstdefinestyle{lstStyleLaTeX}{
+ style=lstStyleBase,
+ language=[LaTeX]TeX
+}
+\newcommand\shellcmd[1]{\colorbox{\color{gray!10}}{\lstinline[style=lstStyleShell]|#1|}}
+\lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{}
+\lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{}
+\newcommand{\note}[1]{{%
+\color{magenta}{\noindent\bfseries 说明:}\emph{#1}}}
+\newcommand{\BibLaTeX}{\textsc{Bib}\LaTeX}
+\newcommand{\CJKLaTeX}{CJK--\LaTeX}
+\newcommand{\macTeX}{Mac\TeX{}}
+\begin{document}
+ \DocInput{\jobname.dtx}
+ \PrintChanges
+\end{document}
+%
+% \fi
+%
+% \GetFileInfo{\jobname.dtx}
+%
+% \changes{v0.10}{2018/01/09}{项目转移至 \href{https://github.com/sjtug/SJTUThesis}{SJTUG} 名下,并增加了英文模版,修改了默认字体设置。}
+% \changes{v0.9.5}{2017/01/27}{改用 GB7714-2015 参考文献风格。}
+% \changes{v0.9.4}{2016/08/25}{增加算法和流程图。}
+% \changes{v0.9}{2015/06/19}{适配 \pkg{ctex} 2.x 宏包,需要使用 TeXLive 2015 编译。}
+% \changes{v0.8}{2015/03/15}{使用 \pkg{biber}/\pkg{biblatex} 组合替代 \BibTeX ,带来更强大稳定的参考文献处理能力;添加 \pkg{enumitem} 宏包增强列表环境控制能力;完善宏包文字描述。}
+% \changes{v0.7}{2015/02/15}{增加盲审选项,调用外部工具插入扫描件。}
+% \changes{v0.6.5}{2015/02/14}{修正一些小问题,缩减 git 仓库体积,仓库由 sjtu-thesis-template-latex 更名为 \cls{SJTUThesis}。}
+% \changes{v0.6}{2014/12/17}{学士、硕士、博士学位论文模板合并在了一起。}
+% \changes{v0.5.3}{2013/05/26}{更正 \env{subsubsection} 格式错误,这个错误导致如 ``1.1 小结'' 这样的标题没有被正确加粗。}
+% \changes{v0.5.2}{2012/12/27}{更正拼写错误。在 \file{diss.tex} 加入 \file{ack.tex}。}
+% \changes{v0.5.1}{2012/12/21}{在 \LaTeX 命令和中文字符之间留了空格,在 Makefile 中增加 release 功能。}
+% \changes{v0.5}{2012/12/05}{修改说明文件的措辞,更正 Makefile 文件,使用 \pkg{metalog} 宏包替换 \pkg{xltxtra} 宏包,使用 \pkg{mathtools} 宏包替换 \pkg{amsmath} 宏包,移除了所有 CJKtilde 符号。}
+% \changes{v0.4}{2012/05/30}{包含交大学士、硕士、博士学位论文模板。模板在 \href{https://github.com/weijianwen/SJTUThesis}{GitHub} 上管理和更新。}
+% \changes{v0.3a}{2010/12/05}{移植到 \XeTeX/\LaTeX 上。}
+% \changes{v0.2a}{2009/12/25}{模板由 \cls{CASthesis} 改名为 \cls{sjtumaster}。在 \file{diss.tex} 中可以方便地改变正文字号、切换但双面打印。增加了不编号的一章 ``全文总结''。添加了可伸缩符号(等号、箭头) 的例子,增加了长标题换行的例子。}
+% \changes{v0.1c}{2009/11/20}{增加了 Linux 下使用 \pkg{ctex} 宏包的注意事项、\file{.bib} 条目的规范要求,修正了 \pkg{ctexbook} 与 \pkg{listings} 共同使用时的断页错误。}
+% \changes{v0.1b}{2009/11/13}{完善了模板使用说明,增加了定理环境、并列子图、三线表格的例子。}
+% \changes{v0.1a}{2009/11/12}{上海交通大学硕士学位论文 \LaTeX 模板发布。}
+%
+% \title{\bfseries\color{sjtublue}\sjtuthesis:上海交通大学学位论文模板}
+% \author{SJTUG\\[5pt]\url{https://sjtug.org/}}
+% \date{\filedate\qquad v\fileversion}
+%
+% \maketitle
+% \thispagestyle{empty}
+% \vspace{\stretch{1}}
+% \begin{center}
+% \includegraphics[height=4cm]{figure/sjtubadge.pdf}
+% \end{center}
+% \vspace{\stretch{1}}
+% \begin{abstract}
+% 此宏包旨在建立一个简单易用的上海交通大学论文模板,包括学士、硕士、博士学位论文
+% 以及普通课程论文。
+% \end{abstract}
+% \vspace{\stretch{1}}
+% \def\abstractname{免责声明}
+% \begin{abstract}
+% \noindent
+% \begin{enumerate}
+% \item 本模板的发布遵守 \LaTeX\ Project Public License,使用前请认真阅读协议内
+% 容。
+% \item 本模板根据 \href{https://www.gs.sjtu.edu.cn/info/1143/5801.htm}
+% {《上海交通大学博士、硕士学位论文撰写指南》} 以及
+% \href{http://bysj.jwc.sjtu.edu.cn/shownews.aspx?newsno=C1uSkpxqiKCad13AzOcvQA....}
+% {《上海交通大学本科生毕业设计(论文)撰写规范》} 编写而成,同时参考了
+% \href{http://jdgs.sjtu.edu.cn/uploads/%E5%AD%A6%E4%BD%8D%E8%AE%BA%E6%96%87-%E7%AD%94%E8%BE%A9%E7%94%B3%E8%AF%B7%E6%B5%81%E7%A8%8B/11%E5%AD%A6%E4%BD%8D%E8%AE%BA%E6%96%87%E6%A0%BC%E5%BC%8F%E7%9A%84%E7%BB%9F%E4%B8%80%E8%A6%81%E6%B1%82.docx}
+% {《上海交通大学研究生学位论文格式的统一要求》}。旨在供上海交通大学准毕业生撰
+% 写学位论文使用。
+% \item 此模板仅为撰写指南的参考实现,不保证审查老师不提意见。任何由于使用本模板
+% 而引起的论文格式审查问题均与本模板作者无关。
+% \item 任何个人或组织以本模板为基础进行修改、扩展而生成的新的专用模板,请严格遵
+% 守 \LaTeX\ Project Public License 协议。由于违犯协议而引起的任何纠纷争端均与
+% 本模板作者无关。
+% \end{enumerate}
+% \end{abstract}
+% \vspace{\stretch{3}}
+%
+%
+% \clearpage
+% \tableofcontents
+% \clearpage
+%
+% \section{介绍}
+%
+% 这是为撰写上海交通大学学士、硕士、博士学位论文以及课程论文而准备的 \LaTeX\ 模
+% 板。
+%
+% 最早的一版学位模板由一位热心的物理系同学制作,中文字符处理采用了当时最为流行的
+% \CJKLaTeX\ 方案。
+%
+% 在此基础上,weijianwen 根据交大研究生院对学位论文的要求,完成了一份基本可用的
+% 交大 \LaTeX\ 学位论文模板。
+%
+% 由于 \CJKLaTeX\ 方案不易使用,weijianwen 与 William Wang 开始着手把模板向
+% \XeTeX\ 引擎移植。之后 weijianwen 又断断续续做了一些完善模板的工作,在原有硕
+% 士学位论文模板的基础上完成了交大学士和博士学位论文模板。
+%
+% 2012 年 5 月模板开始在 GitHub 上管理和更新,2018 年 1 月项目转移至 SJTUG 名下。
+%
+% 2019 年 6 月 Alexara Wu 重构了整个宏包的代码,并使用 doc 和 DocStrip 工具进行
+% 代码的管理,升级版本号为 1.0。
+%
+% \sjtuthesis 模板的许多实现细节离不开 \href{https://github.com/sjtug/SJTUThesis/graphs/contributors}
+% {热心同学们} 的贡献,在此感谢所有为模板贡献过代码的同学们, 以及所有测试和使用
+% 模板的各位同学!
+%
+% 本文档将尽量完整的介绍模板的使用方法,如有不清楚之处可以参考示例文档或者根据
+% 第~\ref{sec:howtoask}节说明提问,有兴趣者都可以参与完善此手册,也非常欢迎对代
+% 码的贡献。
+%
+% \note{模板的作用在于减少论文写作过程中格式调整的时间,前提是遵守模板的用法,否
+% 则即便用了\sjtuthesis 也难以保证输出的论文符合学校规范。}
+%
+% \section{安装}
+%
+% \subsection{系统要求}
+% \label{sec:requirements}
+%
+% 使用本模板需要你的 \TeX\ 系统支持 \XeTeX\ 引擎,并且带有 \pkg{ctex} 2.x 宏包。
+%
+% 对于新手来说,一般推荐完整安装当年最新版的 \TeXLive/\macTeX。您也可以根据自
+% 己的实际需求选择不同的 \TeX\ 发行版,具体可以参考 \href{https://github.com/sjtug/SJTUThesis/wiki/TeX-%E7%9A%84%E5%8F%91%E8%A1%8C%E7%89%88%E5%8F%8A%E5%85%B6%E5%AE%89%E8%A3%85}
+% {《\TeX\ 的发行版及其安装》}。
+%
+% \subsection{获取 \sjtuthesis}
+%
+% 你可以在 \href{https://github.com/sjtug/SJTUThesis/releases}{GitHub Release}
+% 中找到 \sjtuthesis 的所有版本,推荐使用最新版本以避免一些问题。
+%
+% 如果要使用开发版,可以直接克隆仓库:
+% \begin{shell}
+% git clone https://github.com/sjtug/SJTUThesis.git
+% \end{shell}
+%
+% \subsection{文件组成}
+%
+% 表~\ref{tab:files}列出了 \sjtuthesis 的主要文件及其功能介绍。
+%
+% \begin{table}[htb]
+% \centering
+% \caption{模板的文件组成}
+% \label{tab:files}
+% \begin{tabular}{lll}
+% \toprule
+% 类别 & 文件 & 说明 \\
+% \midrule
+% 模板文件 & \file{sjtuthesis.dtx} & 模板原始代码文件 (开发用) \\
+% & \file{sjtuthesis.cls} & 文档类文件 \\
+% & \file{sjtuthesis-*.ltx} & 文档类辅助文件 \\
+% \midrule
+% 生成文件 & \file{sjtuthesis.pdf} & 用户手册 (本文档) \\
+% \midrule
+% 示例文档 & \file{thesis.tex} & 主文档 \\
+% & \file{tex/*.tex} & 示例文档的各个章节 \\
+% & \file{figure/} & 图片目录 \\
+% & \file{bib/*.bib} & 参考文献目录 \\
+% \midrule
+% 其他 & \file{README.md} & 基本说明 \\
+% & \file{.latexmkrc} & latexmk 的配置文件 \\
+% & \file{Makefile} & GNU make 的配置文件 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%
+% \subsection{编译模板}
+% \label{sec:process}
+%
+% 本节介绍几种常见的编译模板生成论文的方法。用户可根据自己的情况选择。
+%
+% \subsubsection{\texorpdfstring{\XeLaTeX}{XeLaTeX}}
+%
+% 很多用户对 \LaTeX\ 命令执行的次数不太清楚。一个基本的原则是多次运行 \LaTeX\ 命
+% 令直至不再出现警告。下面给出生成示例文档的详细过程(\# 开头的行为注释),首先
+% 来看的 \XeLaTeX\ 方式:
+%
+% \begin{shell}
+% # 1.发现文件中的引用关系,文件后缀 .tex 可省略
+% xelatex thesis
+% # 2.编译参考文件源文件,生成 .bbl 文件
+% biber thesis
+% # 3.解决文件中的交叉引用
+% xelatex thesis
+% # 4.生成完整的pdf文件
+% xelatex thesis
+% # 5.更新目录
+% xelatex thesis
+% \end{shell}
+%
+% \subsubsection{latexmk}
+% \label{sec:latexmk}
+%
+% \texttt{latexmk} 命令支持全自动生成 \LaTeX\ 编写的文档,并且支持使用不同的工具
+% 链来进行生成,它会自动运行多次工具直到交叉引用都被解决。下面给出了一个用
+% \texttt{latexmk} 调用 \texttt{xelatex} 生成最终文档的示例:
+%
+% \begin{shell}
+% # 一句话就够了!
+% latexmk -xelatex thesis
+% \end{shell}
+%
+% \subsubsection{make}
+% \label{sec:make}
+%
+% 上面的方法虽然不复杂,但是每次都输入还是非常罗嗦,所以 \sjtuthesis 提供了一
+% 个 \file{Makefile}:
+%
+% \begin{shell}
+% make cls # 生成 sjtuthesis.cls
+% make sjtuthesis.pdf # 生成说明文档 sjtuthesis.pdf
+% make thesis.pdf # 生成示例文档 thesis.pdf
+% make clean
+% make cleanall
+% \end{shell}
+%
+% \sjtuthesis 的 \file{Makefile} 默认用 \texttt{latexmk} 调用\texttt{xelatex} 编
+% 译。如有需要可修改 \file{Makefile} 开头的参数或通过命令行传递参数,进一步还可
+% 以修改 \file{.latexmkrc} 进行定制。
+%
+% \section{使用说明}
+%
+% 本手册假定用户已经能处理一般的 \LaTeX\ 文档,并对 \BibLaTeX\ 有一定了解。如果
+% 从来没有接触过 \TeX\ 和 \LaTeX,建议先学习相关的基础知识。
+%
+% \subsection{关于提问}
+% \label{sec:howtoask}
+% 按照优先级推荐提问的位置如下:
+%
+% \begin{itemize}
+% \item \href{https://github.com/sjtug/SJTUThesis/issues}{Github Issues}
+% \item \href{https://bbs.sjtu.edu.cn/bbsdoc?board=TeX_LaTeX}{水源LaTeX版}
+% \end{itemize}
+%
+% \subsection{示例文件}
+% \label{sec:userguide}
+%
+% 模板核心文件有:\file{sjtuthesis.cls},\file{sjtuthesis-bachelor.ltx} 和
+% \file{sjtuthesis-graduate.ltx},但如果没有示例文档会很难下手,所以推荐从模板自
+% 带的示例文档入手,其中包括了论文写作用到的所有命令及其使用方法,只需要用自己的
+% 内容进行相应替换就可以。对于不清楚的命令可以查阅本手册。下面的例子描述了模板中
+% 章节的组织形式,来自于示例文档,具体内容可以参考模板附带的 \file{thesis.tex}
+% 和 \file{tex/}。
+%
+% \lstinputlisting[style=lstStyleLaTeX]{thesis.tex}
+%
+% \subsection{文档类选项}
+%
+% \DescribeOption{degree=\meta{degree}}
+% 选择论文类型,当前支
+% 持:\opt{bachelor},\opt{master},\opt{doctor},\opt{course}。
+% 为必选项。
+% \begin{latex}
+% % 博士论文
+% \documentclass[degree=doctor]{sjtuthesis}
+%
+% % 硕士论文
+% \documentclass[degree=master]{sjtuthesis}
+% \end{latex}
+%
+% \DescribeOption{language=\meta{language}}
+% 论文的主要语言(默认:中文)。可选:\opt{chinese},\opt{english}。
+%
+% \DescribeOption{bibstyle=\meta{bibstyle}}
+% 参考文献样式(默认:gb7714-2015)。
+% 可选:\opt{gb7714-2015},\opt{gb7714-2015ay}, \opt{ieee}。
+%
+% \DescribeOption{review}
+% 盲审模式开关(默认:关闭)。
+%
+% \DescribeOption{unsetfont}
+% 是否取消模版预设的西文字体(默认:关闭)。如果取消,则需要自行设置西文字体。
+%
+% \subsection{中文字体}
+%
+% \subsubsection{字体配置}
+%
+% \DescribeOption{fontset=\meta{font}}
+% 模板默认使用 \CTeX 的字体配置。默认情况下,本模板可以自动检测操作系统,并配置
+% 合适的字体。
+% 用户可以在调用文档类时加入选项
+% \opt{fontset=mac/windows/adobe} 指定加载的字库,
+% 也可以使用 \opt{fontset=none},然后自行配置,
+% 详见 \pkg{ctex}、\pkg{xeCJK}、\pkg{fontspec} 等宏包的使用说明。
+%
+% 注意,Linux 系统下默认的中文字库 Fandol 容易出现缺字的情况。
+% 我们建议 Linux 用户自行配置合适的字体。
+%
+% \subsubsection{字体命令}
+% \label{sec:fontcmds}
+% \DescribeMacro{\songti}
+% \DescribeMacro{\fangsong}
+% \DescribeMacro{\heiti}
+% \DescribeMacro{\kaishu}
+% 用来切换宋体、仿宋、黑体、楷体四种基本字体。
+%
+% \begin{latex}
+% {\songti 力微任重久神疲,}
+% {\fangsong 再竭衰庸定不支。}
+% {\heiti 苟利国家生死以,}
+% {\kaishu 岂因祸福避趋之?}
+% \end{latex}
+%
+% \DescribeMacro{\zihao\marg{num}}
+% 用来切换字号大小。
+%
+% \subsection{标题页信息}
+%
+% \DescribeMacro{\maketitle}
+% 标题页可由 \cs{maketitle} 命令生成,其中的各项信息提供两种配置方法。
+%
+% 一是使用 \cs{\meta{item}\marg{info}} 的方式独立设置各项信息,
+% 本模板提供的命令如表~\ref{tab:covercmds},
+% 其中带 |en| 前缀的命令是 设置英文标题页的命令:
+% \begin{table}[htb]
+% \centering\small
+% \caption{录入标题页信息的命令}
+% \label{tab:covercmds}
+% \begin{tabular}{lll}
+% \toprule
+% 命令 & 命令(英文) & 说明 \\
+% \midrule
+% \cs{title} & \cs{entitle} & 论文标题 \\
+% \cs{keywords} & \cs{enkeywords} & 关键字 \\
+% \cs{author} & \cs{enauthor} & 作者姓名 \\
+% \cs{supervisor} & \cs{ensupervisor} & 导师姓名 \\
+% \cs{cosupervisor} & \cs{encosupervisor} & 副导师姓名 \\
+% \cs{degree} & \cs{endegree} & 申请学位 \\
+% \cs{department} & \cs{endepartment} & 院系 \\
+% \cs{major} & \cs{enmajor} & 学科专业 \\
+% \cs{coursename} & \cs{encoursename} & 课程名称 \\
+% \cs{fund} & \cs{enfund} & 资助基金 \\
+% \cs{date} & \cs{endate} & 答辩日期 \\
+% \cs{studentid} & - & 学号 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%
+% 二是通过统一设置命令 \cs{sjtuSetInfo} 通过\emph{key=value} 形式完成:
+% \begin{latex}
+% \sjtuSetInfo{
+% title = XXX,
+% keywords = {AAA, BBB},
+% }
+% % 可以多次调用
+% \sjtuSetInfo{
+% author = CCC,
+% title = YYY, % 覆盖 XXX
+% }
+% \end{latex}
+%
+% \subsection{摘要和章节}
+%
+% 对于特殊的章节,\sjtuthesis 还提供了相应的环境:
+% \begin{itemize}
+% \item 中文摘要:\env{abstract}
+% \DescribeEnv{abstract}
+% \item 英文摘要:\env{enabstract}
+% \DescribeEnv{enabstract}
+% \item 符号说明:\env{nomenclature}
+% \DescribeEnv{nomenclature}
+% \item 致谢: \env{acknowledgements}
+% \DescribeEnv{acknowledgements}
+% \item 发表成果:\env{publications}
+% \DescribeEnv{publications}
+% \item 申请专利:\env{patents}
+% \DescribeEnv{patents}
+% \item 参与项目:\env{projects}
+% \DescribeEnv{projects}
+% \end{itemize}
+%
+% 目录和图、表清单可以使用命令自动生成:
+% \begin{itemize}
+% \item 目录: \cs{tableofcontents}
+% \DescribeMacro{\tableofcontents}
+% \item 图清单:\cs{listoffigures}
+% \DescribeMacro{\listoffigures}
+% \item 表清单:\cs{listoftables}
+% \DescribeMacro{\listoftables}
+% \end{itemize}
+%
+% \subsection{浮动体}
+%
+% 图题置于图的下方,表题置于表的上方。
+% \LaTeX{} 的 \cs{caption} 命令并不能控制在浮动体中的位置,
+% 需要作者注意写在合适的地方。
+%
+% 关于图片的并排,推荐使用较新的 \pkg{subcaption} 宏包,不建议使用
+% \pkg{subfigure} 或 \pkg{subfig}。
+%
+% 更多的表格样式参见 \pkg{booktabs}(三线表)、\pkg{longtable}(跨页表格)。
+%
+% 算法可以使用 \pkg{algorithms} 宏包或者较新的 \pkg{algorithm2e}。
+%
+% \subsection{参考文献}
+%
+% 教务处要求参考文献外观应符合国家标准 GB/T7714。按照《GB/T 7714-2015》的规定,
+% 参考文献的标注体系分为“顺序编码制”和“著者-出版年制”(authoryear)。
+%
+% 模版默认使用顺序编码制,用户也可以按需要在文档类参数中设置样式,如:
+% \begin{shell}
+% \documentclass[degree=master, bibstyle=ieee]{sjtuthesis}
+% \end{shell}
+%
+% \DescribeMacro{\cite}
+% 在正文中引用文献时应使用 \cs{cite} 命令,可以产生上标引用的参考文献。
+% 同一处引用多篇文献时,需要将各篇文献的 key 一同写在参数中,
+% 如 |\cite{Meta_CN,chen2007act,DPMG}|。
+% 它可以自动排序并用处理连续编号。
+%
+% \DescribeMacro{\parencite}
+% 需要临时将文献序号与正文平排,可以使用 \cs{parencite} 命令。
+%
+% \DescribeMacro{\printbibliography}
+% 参考文献表可以使用 \BibLaTeX\ 生成,其表现形式的控制逻辑通过
+% \pkg{biblatex-gb7714-2015} 实现。在文中使用 \cs{printbibliography} 命令输出参
+% 考文献表。添加参数 \opt{heading=bibintoc} 可将参考文献表加入目录。
+%
+% \section{实现细节}
+%
+% \begin{macrocode}
+%<*class>
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{
+ family=sjtu,
+ prefix=sjtu@,
+ setkeys=\kvsetkeys}
+% \end{macrocode}
+%
+% 用 \pkg{kvoptions} 的 \texttt{key=value} 方式来设置论文类型。
+% \begin{macrocode}
+\DeclareStringOption[doctor]{degree}[doctor]
+% \end{macrocode}
+%
+% 论文是否使用英文。
+% \begin{macrocode}
+\DeclareStringOption[chinese]{language}[chinese]
+% \end{macrocode}
+%
+% 参考文献样式。
+% \begin{macrocode}
+\DeclareStringOption[gb7714-2015]{bibstyle}[gb7714-2015]
+% \end{macrocode}
+%
+% 字号大小。
+% \begin{macrocode}
+\DeclareStringOption[5]{zihao}[5]
+% \end{macrocode}
+%
+% 盲审模式开关。
+% \begin{macrocode}
+\DeclareBoolOption{review}
+% \end{macrocode}
+%
+% 是否取消设置西文字体。
+% \begin{macrocode}
+\DeclareBoolOption{unsetfont}
+% \end{macrocode}
+%
+% 将选项传递给 \pkg{ctexbook}。
+% \begin{macrocode}
+\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
+% \end{macrocode}
+%
+% 解析用户传递过来的选项,并加载 \pkg{ctexbook}。
+% \begin{macrocode}
+\ProcessKeyvalOptions*
+\newcommand{\sjtu@validate@key}[1]{%
+ \@ifundefined{sjtu@\csname sjtu@#1\endcsname true}{%
+ \ClassError{sjtuthesis}{Invalid value '\csname sjtu@#1\endcsname'}{}%
+ }{%
+ \csname sjtu@\csname sjtu@#1\endcsname true\endcsname
+ }%
+}
+\newif\ifsjtu@course
+\newif\ifsjtu@bachelor
+\newif\ifsjtu@master
+\newif\ifsjtu@doctor
+\sjtu@validate@key{degree}
+\ifsjtu@course\sjtu@bachelortrue\fi
+\ifsjtu@doctor\sjtu@mastertrue\fi
+\newif\ifsjtu@chinese
+\newif\ifsjtu@english
+\sjtu@validate@key{language}
+\ifsjtu@english
+ \PassOptionsToClass{scheme=plain}{ctexbook}
+\fi
+% \end{macrocode}
+%
+% 使用 XeTeX 引擎时,fontspec 宏包会被 xeCJK 自动调用。传递给 fontspec 宏包
+% no-math 选项,避免部分数学符号字体自动调整为 CMR。
+% \begin{macrocode}
+\PassOptionsToPackage{no-math}{fontspec}
+% \end{macrocode}
+%
+% 使用 \pkg{ctexbook} 类,优于调用 \pkg{ctex} 宏包。
+% \begin{macrocode}
+\LoadClass[a4paper,zihao=\sjtu@zihao,linespread=1.3,UTF8]{ctexbook}
+% \end{macrocode}
+%
+% \subsection{载入宏包}
+%
+% 建议在模板开始处载入全部宏包,不要轻易改变加载顺序。\pkg{hyperref} 一般在最后
+% 加载。
+% \begin{macrocode}
+\RequirePackage{etoolbox}
+\RequirePackage{xparse}
+\RequirePackage{environ}
+% \end{macrocode}
+%
+% 使用 \pkg{geometry} 设置页面。
+% \begin{macrocode}
+\RequirePackage{geometry}
+% \end{macrocode}
+%
+% 使用 \pkg{fancyhdr} 设置页眉页脚。
+% \begin{macrocode}
+\RequirePackage{fancyhdr}
+% \end{macrocode}
+%
+% 使用 \pkg{pageslts} 设置页码格式。
+% \begin{macrocode}
+\RequirePackage{pageslts}
+% \end{macrocode}
+%
+% 使用 \pkg{mathtools} 处理数学公式。
+% \begin{macrocode}
+\RequirePackage{mathtools}
+% \end{macrocode}
+%
+% 字体相关宏包。
+% \begin{macrocode}
+\ifsjtu@unsetfont\relax\else%
+ \RequirePackage[defaultsups]{newtxtext}
+ \RequirePackage{newtxmath}
+ \RequirePackage[opentype]{sourcecodepro}
+\fi
+\RequirePackage{anyfontsize}
+% \end{macrocode}
+%
+% 颜色支持宏包。
+% \begin{macrocode}
+\RequirePackage{xcolor}
+% \end{macrocode}
+%
+% 图形支持宏包。
+% \begin{macrocode}
+\RequirePackage{graphicx}
+% \end{macrocode}
+%
+% 表格支持宏包。
+% \begin{macrocode}
+\RequirePackage{array}
+\RequirePackage{booktabs}
+\RequirePackage{longtable}
+% \end{macrocode}
+%
+% 题注支持宏包。
+% \begin{macrocode}
+\RequirePackage{caption}
+\RequirePackage[list=off]{bicaption}
+\RequirePackage{subcaption}
+% \end{macrocode}
+%
+% 参考文献支持宏包。
+% \begin{macrocode}
+\RequirePackage[backend=biber,style=\sjtu@bibstyle]{biblatex}
+% \end{macrocode}
+%
+% 使用 \pkg{tocloft} 设置目录格式。
+% \begin{macrocode}
+\RequirePackage[titles]{tocloft}
+% \end{macrocode}
+%
+% \pkg{enumitem} 更好的列表环境。
+% \begin{macrocode}
+\RequirePackage[inline]{enumitem}
+% \end{macrocode}
+%
+% 脚注支持宏包。
+% \begin{macrocode}
+\RequirePackage[perpage, bottom]{footmisc}
+% \end{macrocode}
+%
+% \pkg{pdfpages} 便于我们插入扫描版的原创性声明和授权声明 PDF 文档。
+% \begin{macrocode}
+\RequirePackage{pdfpages}
+\includepdfset{fitpaper=true}
+% \end{macrocode}
+%
+% \pkg{hyperref} 处理超链接。
+% \begin{macrocode}
+\RequirePackage{hyperref}
+% \end{macrocode}
+%
+% \subsection{信息录入}
+%
+% 定义命令用于录入信息。
+% \begin{macrocode}
+\newcommand{\sjtu@def@term}[1]{%
+ \expandafter\gdef\csname #1\endcsname##1{%
+ \expandafter\gdef\csname sjtu@value@#1\endcsname{##1}}
+ \csname #1\endcsname{}
+ \define@key{sjtuvalue}{#1}{\csname #1\endcsname{##1}}}
+% \end{macrocode}
+%
+% 论文中英文题目。
+% \begin{macrocode}
+\sjtu@def@term{title}
+\sjtu@def@term{entitle}
+% \end{macrocode}
+%
+% 关键字。
+% \begin{macrocode}
+\sjtu@def@term{keywords}
+\sjtu@def@term{enkeywords}
+% \end{macrocode}
+%
+% 作者、导师、副导师。
+% \begin{macrocode}
+\sjtu@def@term{author}
+\sjtu@def@term{supervisor}
+\sjtu@def@term{assisupervisor}
+\sjtu@def@term{enauthor}
+\sjtu@def@term{ensupervisor}
+\sjtu@def@term{enassisupervisor}
+% \end{macrocode}
+%
+% 学号。
+% \begin{macrocode}
+\sjtu@def@term{studentid}
+% \end{macrocode}
+%
+% 申请学位中英文名称。
+% \begin{macrocode}
+\sjtu@def@term{degree}
+\sjtu@def@term{endegree}
+% \end{macrocode}
+%
+% 院系中英文名称。
+% \begin{macrocode}
+\sjtu@def@term{department}
+\sjtu@def@term{endepartment}
+% \end{macrocode}
+%
+% 专业中英文名称。
+% \begin{macrocode}
+\sjtu@def@term{major}
+\sjtu@def@term{enmajor}
+% \end{macrocode}
+%
+% 课程中英文名称。
+% \begin{macrocode}
+\sjtu@def@term{coursename}
+\sjtu@def@term{encoursename}
+% \end{macrocode}
+%
+% 资助基金名称。
+% \begin{macrocode}
+\sjtu@def@term{fund}
+\sjtu@def@term{enfund}
+% \end{macrocode}
+%
+% 答辩日期。
+% \begin{macrocode}
+\sjtu@def@term{date}
+\sjtu@def@term{endate}
+\NewDocumentCommand\sjtuSetInfo{}{\setkeys{sjtuvalue}}
+% \end{macrocode}
+%
+% 定义一些文字常量。
+% \begin{macrocode}
+\newcommand{\sjtu@def@label}[2]{%
+ \expandafter\gdef\csname sjtu@label@#1\endcsname{#2}
+ \define@key{sjtulabel}{#1}{%
+ \expandafter\gdef\csname sjtu@label@#1\endcsname{##1}}}
+\sjtu@def@label{schoolChi}{上海交通大学}
+\sjtu@def@label{schoolEng}{Shanghai Jiao Tong University}
+%
+%<*bachelor>
+\ifsjtu@course
+ \sjtu@def@label{degreetypeChi}{}
+ \sjtu@def@label{degreetypeEng}{}
+\else
+ \sjtu@def@label{degreetypeChi}{学士}
+ \sjtu@def@label{degreetypeEng}{Bachelor}
+\fi
+\sjtu@def@label{authorChi}{学生姓名}
+\sjtu@def@label{studentidChi}{学生学号}
+\sjtu@def@label{supervisorChi}{指导教师}
+\sjtu@def@label{coursenameChi}{课程名称}
+\sjtu@def@label{majorChi}{专业}
+\sjtu@def@label{departmentChi}{学院(系)}
+\ifsjtu@course
+ \sjtu@def@label{thesiscat}{课程论文}
+ \def\sjtu@label@thesistype{\sjtu@label@thesiscat}
+ \sjtu@def@label{subjectChi}{\sjtu@label@thesiscat}
+ \sjtu@def@label{subjectEng}{Course Paper}
+\else
+ \sjtu@def@label{thesiscat}{学位论文}
+ \def\sjtu@label@thesistype{毕业设计(论文)}
+ \sjtu@def@label{subjectChi}{\sjtu@label@degreetypeChi\sjtu@label@thesiscat}
+ \sjtu@def@label{subjectEng}{Thesis of \sjtu@label@degreetypeEng}
+\fi
+\sjtu@def@label{bigabstract}{英文大摘要}
+%
+%<*graduate>
+\ifsjtu@doctor
+ \sjtu@def@label{degreetypeChi}{博士}
+ \sjtu@def@label{degreetypeEng}{Doctor}
+\else
+ \sjtu@def@label{degreetypeChi}{硕士}
+ \sjtu@def@label{degreetypeEng}{Master}
+\fi
+\sjtu@def@label{authorChi}{\sjtu@label@degreetypeChi 研究生}
+\sjtu@def@label{authorEng}{Candidate}
+\sjtu@def@label{studentidChi}{学号}
+\sjtu@def@label{studentidEng}{Student ID}
+\sjtu@def@label{supervisorChi}{导师}
+\sjtu@def@label{supervisorEng}{Supervisor}
+\sjtu@def@label{assisupervisorChi}{副导师}
+\sjtu@def@label{assisupervisorEng}{Assistant Supervisor}
+\sjtu@def@label{degreeChi}{申请学位}
+\sjtu@def@label{degreeEng}{Academic Degree Applied for}
+\sjtu@def@label{majorChi}{学科}
+\sjtu@def@label{majorEng}{Speciality}
+\sjtu@def@label{departmentChi}{所在单位}
+\sjtu@def@label{departmentEng}{Affiliation}
+\sjtu@def@label{defenddateChi}{答辩日期}
+\sjtu@def@label{defenddateEng}{Date of Defence}
+\sjtu@def@label{conferringChi}{授予学位单位}
+\sjtu@def@label{conferringEng}{Degree-Conferring-Institution}
+\sjtu@def@label{fundChi}{资助基金}
+\sjtu@def@label{fundEng}{Funded by}
+\sjtu@def@label{thesiscat}{学位论文}
+\def\sjtu@label@thesistype{\sjtu@label@thesiscat}
+\sjtu@def@label{subjectChi}{%
+ \sjtu@label@schoolChi\sjtu@label@degreetypeChi\sjtu@label@thesiscat
+}
+\sjtu@def@label{subjectEng}{%
+ Dissertation Submitted to \sjtu@label@schoolEng \\%
+ for the Degree of \sjtu@label@degreetypeEng
+}
+%
+%<*class>
+\sjtu@def@label{originalityChi}{原创性声明}
+\sjtu@def@label{originalityEng}{Declaration of Originality}
+\sjtu@def@label{authorizationChi}{版权使用授权书}
+\sjtu@def@label{authorizationEng}{Declaration of Authorization}
+\sjtu@def@label{origtitle}{\sjtu@label@thesistype\sjtu@label@originalityChi}
+\sjtu@def@label{authtitle}{\sjtu@label@thesistype\sjtu@label@authorizationChi}
+\sjtu@def@label{origbody}{%
+ 本人郑重声明:所呈交的\sjtu@label@thesistype ,是本人在导师的指导下,
+ 独立进行研究工作所取得的成果。除文中已经注明引用的内容外,本论文不包含
+ 任何其他个人或集体已经发表或撰写过的作品成果。对本文的研究做出重要贡献
+ 的个人和集体,均已在文中以明确方式标明。本人完全意识到本声明的法律结果
+ 由本人承担。}
+\sjtu@def@label{authbody}{%
+ 本\sjtu@label@thesistype 作者完全了解学校有关保留、使用\sjtu@label@thesistype
+ 的规定,同意学校保留并向国家有关部门或机构送交论文的复印件和电子版,允
+ 许论文被查阅和借阅。本人授权上海交通大学可以将本\sjtu@label@thesistype
+ 的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫描等复制
+ 手段保存和汇编本\sjtu@label@thesistype 。}
+\sjtu@def@label{abstractChi}{摘\quad 要}
+\sjtu@def@label{abstractEng}{Abstract}
+\sjtu@def@label{keywordsChi}{关键词:}
+\sjtu@def@label{keywordsEng}{Key words:~}
+\ifsjtu@english
+ \sjtu@def@label{titlepage}{Title Page}
+ \def\sjtu@label@originality{\sjtu@label@originalityEng}
+ \def\sjtu@label@authorization{\sjtu@label@authorizationEng}
+ \def\sjtu@label@abstract{\sjtu@label@abstractEng}
+ \sjtu@def@label{contents}{Contents}
+ \sjtu@def@label{figure}{Figure}
+ \sjtu@def@label{listfigure}{List of Figures}
+ \sjtu@def@label{table}{Table}
+ \sjtu@def@label{listtable}{List of Tables}
+ \sjtu@def@label{algorithm}{Algorithm}
+ \sjtu@def@label{listalgorithm}{List of Algorithms}
+ \sjtu@def@label{nomenclature}{Nomenclature}
+ \sjtu@def@label{summary}{Summary}
+ \sjtu@def@label{acknowledgements}{Acknowledgements}
+ \sjtu@def@label{publications}{Publications}
+ \sjtu@def@label{patents}{Patents}
+ \sjtu@def@label{projects}{Projects}
+ \sjtu@def@label{resume}{Resume}
+\else
+ \sjtu@def@label{titlepage}{扉页}
+ \def\sjtu@label@originality{\sjtu@label@originalityChi}
+ \def\sjtu@label@authorization{\sjtu@label@authorizationChi}
+ \def\sjtu@label@abstract{\sjtu@label@abstractChi}
+ \sjtu@def@label{contents}{目\quad 录}
+ \sjtu@def@label{figure}{图}
+ \sjtu@def@label{listfigure}{插图索引}
+ \sjtu@def@label{table}{表}
+ \sjtu@def@label{listtable}{表格索引}
+ \sjtu@def@label{algorithm}{算法}
+ \sjtu@def@label{listalgorithm}{算法索引}
+ \sjtu@def@label{nomenclature}{主要符号对照表}
+ \sjtu@def@label{summary}{全文总结}
+ \sjtu@def@label{acknowledgements}{致\quad 谢}
+ \sjtu@def@label{publications}%
+ {攻读\sjtu@label@degreetypeChi 学位期间已发表或录用的论文}
+ \sjtu@def@label{patents}%
+ {攻读\sjtu@label@degreetypeChi 学位期间申请的专利}
+ \sjtu@def@label{projects}%
+ {攻读\sjtu@label@degreetypeChi 学位期间参与的项目}
+ \sjtu@def@label{resume}{简\quad 历}
+\fi
+\NewDocumentCommand\sjtuSetLabel{}{\setkeys{sjtulabel}}
+\ctexset{%
+ contentsname = \sjtu@label@contents,
+ listfigurename = \sjtu@label@listfigure,
+ listtablename = \sjtu@label@listtable}
+%
+% \end{macrocode}
+%
+% \subsection{页面设置}
+%
+% 设置纸张、页边距。
+% \begin{macrocode}
+%<*(bachelor|graduate)>
+\geometry{%
+ paper = a4paper,
+%<*bachelor>
+ top = 84bp,
+ bottom = 72bp,
+ hmargin = 90bp,
+ headheight = 60bp,
+ headsep = 12bp}
+%
+%<*graduate>
+ top = 3.5cm,
+ bottom = 4.0cm,
+ left = 3.3cm,
+ right = 2.8cm,
+ headsep = 0.5cm}
+%
+% \end{macrocode}
+%
+% 设置页眉页脚。
+% \begin{macrocode}
+%<*bachelor>
+\ifsjtu@english
+ \def\sjtu@titlemark{\sjtu@value@entitle}
+ \newcommand{\sjtu@fancyhead}{%
+ \parbox[b]{0.75\textwidth}{%
+ \raggedleft\nouppercase{\footnotesize\heiti\sjtu@titlemark}}}
+ \newcommand{\sjtu@fancyfoot}[2]{%
+ \small --~~Page~~{\bfseries{#1}}~~of~~{\bfseries{#2}}~~--}
+\else
+ \def\sjtu@titlemark{\sjtu@value@title}
+ \newcommand{\sjtu@fancyhead}{%
+ \parbox[b]{0.75\textwidth}{%
+ \raggedleft\nouppercase{\small\heiti\sjtu@titlemark}}}
+ \newcommand{\sjtu@fancyfoot}[2]{%
+ \small 第~{\bfseries{#1}}~页\,共~{\bfseries{#2}}~页}
+\fi
+\fancypagestyle{sjtu@front}{%
+ \fancyhf{}
+ \fancyhead[L]{\includegraphics{figure/sjtubanner.pdf}}
+ \fancyhead[R]{\sjtu@fancyhead}
+ \fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.Roman}}}
+}
+%
+%<*graduate>
+\newcommand{\sjtu@fancyfoot}[2]{
+ \ifsjtu@review\relax\else
+ \ifx#2\@empty\else
+ \zihao{-5}{\bfseries #1}\\{#2}
+ \fi
+ \fi
+}
+\fancypagestyle{sjtu@title}{%
+ \fancyhf{}
+ \fancyfoot[C]{\sjtu@fancyfoot{\sjtu@label@fundChi}{\sjtu@value@fund}}
+ \renewcommand{\headrulewidth}{0pt}
+ \renewcommand{\footrulewidth}{0pt}
+}
+\fancypagestyle{sjtu@entitle}{%
+ \fancyhf{}
+ \fancyfoot[C]{\sjtu@fancyfoot{\sjtu@label@fundEng}{\sjtu@value@enfund}}
+ \renewcommand{\headrulewidth}{0pt}
+ \renewcommand{\footrulewidth}{0pt}
+}
+%
+\fancypagestyle{sjtu@plain}{%
+ \fancyhf{}
+%<*bachelor>
+ \fancyhead[L]{\includegraphics{figure/sjtubanner.pdf}}
+ \fancyhead[R]{\sjtu@fancyhead}
+ \fancyfoot[C]{\sjtu@fancyfoot{\thepage}{\lastpageref{pagesLTS.arabic}}}
+%
+%<*graduate>
+ \fancyhead[C]{\zihao{-5}\sjtu@label@subjectChi}
+ \fancyfoot[C]{\small ---~{\bfseries\thepage}~---}
+ \renewcommand{\headrule}{%
+ \hrule\@height2.25\p@\@width\headwidth
+ \vskip0.75\p@
+ \hrule\@height0.75\p@\@width\headwidth
+ \vskip-2.75\p@
+ }
+%
+}
+%<*bachelor>
+\fancypagestyle{sjtu@biglast}{%
+ \fancyhf{}
+ \fancyhead[L]{\includegraphics{figure/sjtubanner.pdf}}
+ \fancyhead[R]{\sjtu@fancyhead}
+ \fancyfoot[C]{\sjtu@fancyfoot{\theCurrentPageLocal}%
+ {\lastpageref{pagesLTS.roman.local}}}
+}
+%
+%(bachelor|graduate)>
+% \end{macrocode}
+%
+% \begin{macro}{\cleardoublepage}
+% 空白页清空页眉页脚。
+% \begin{macrocode}
+%<*class>
+\patchcmd\cleardoublepage%
+ {\newpage}{\thispagestyle{empty}\newpage}
+ {}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\chapter}
+% 每章第一页默认会设置特殊的 pagestyle, 我们将其清除。
+% \begin{macrocode}
+\patchcmd\chapter%
+ {\thispagestyle{\CTEX@chapter@pagestyle}}{}
+ {}{}
+% \end{macrocode}
+% \end{macro}
+%
+% 设置文档开始时初始的页码与页眉页脚风格。
+% \begin{macrocode}
+\AtBeginDocument{%
+ \pagenumbering{Alph}
+ \pagestyle{empty}}
+%
+% \end{macrocode}
+%
+% \begin{macro}{\frontmatter}
+% \begin{macro}{\mainmatter}
+% 前言的页码设置为大写罗马数字,同时设置前言与正文的页眉页脚风格。
+% \begin{macrocode}
+%<*(bachelor|graduate)>
+\renewcommand{\frontmatter}{%
+ \cleardoublepage
+ \@mainmatterfalse
+ \pagenumbering{Roman}
+%<*bachelor>
+ \pagestyle{sjtu@front}}
+%
+%<*graduate>
+ \pagestyle{sjtu@plain}}
+%
+\renewcommand{\mainmatter}{%
+ \cleardoublepage
+ \@mainmattertrue
+ \pagenumbering{arabic}
+ \pagestyle{sjtu@plain}}
+%(bachelor|graduate)>
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{主文档格式}
+%
+% \subsubsection{章节标题}
+% 各级标题格式设置。
+% \begin{macrocode}
+%<*class>
+\ctexset{%
+ chapter={%
+ format = \zihao{3}\bfseries\heiti\centering,
+ nameformat = {},
+ titleformat = {},
+ aftername = \quad,
+ afterindent = true,
+ beforeskip = 1ex,
+ afterskip = 2ex
+ },
+ section={%
+ format = \zihao{4}\bfseries\heiti,
+ afterindent = true,
+ afterskip = 1ex \@plus .2ex
+ },
+ subsection={%
+ format = \zihao{-4}\bfseries\heiti,
+ afterindent = true,
+ afterskip = 1ex \@plus .2ex
+ },
+ subsubsection={%
+ format = \zihao{-4}\normalfont,
+ afterindent = true,
+ afterskip = 1ex \@plus .2ex
+ },
+ paragraph/afterindent = true,
+ subparagraph/afterindent = true}
+%
+% \end{macrocode}
+%
+% 本科与研究生论文三级标题格式不同。
+% \begin{macrocode}
+%<*bachelor>
+\ctexset{%
+ subsection/format = \zihao{-4}\normalfont,
+}
+%
+% \end{macrocode}
+%
+% \subsubsection{段落}
+%
+% 全文首行缩进 2 字符,标点符号用全角。
+% \begin{macrocode}
+%<*class>
+\ctexset{%
+ punct = quanjiao,
+ space = auto,
+ autoindent = true}
+% \end{macrocode}
+%
+% 利用 \pkg{enumitem} 命令调整默认列表环境间的距离,以符合中文习惯。
+% \begin{macrocode}
+\setlist{nosep}
+\setlist*{leftmargin=*}
+\setlist[1]{labelindent=\parindent}
+% \end{macrocode}
+%
+% \subsubsection{目录}
+%
+% 章节编号深度最多 4 层,即: x.x.x.x,对应的命令和层序号分别是:
+% \cs{chapter}(0), \cs{section}(1), \cs{subsection}(2), \cs{subsubsection}(3)。
+% \begin{macrocode}
+\setcounter{secnumdepth}{3}
+\setcounter{tocdepth}{2}
+% \end{macrocode}
+%
+% \begin{macro}{\tableofcontents}
+% 目录生成命令,添加 PDF 标签。
+% \begin{macrocode}
+\renewcommand{\tableofcontents}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\contentsname}{toc}%
+ \chapter*{\contentsname}%
+ \@mkboth{\contentsname}{\contentsname}%
+ \@starttoc{toc}
+}
+\renewcommand{\listoffigures}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\listfigurename}{lof}%
+ \chapter*{\listfigurename}%
+ \@mkboth{\listfigurename}{\listfigurename}%
+ \@starttoc{lof}
+}
+\renewcommand{\listoftables}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\listtablename}{lot}%
+ \chapter*{\listtablename}%
+ \@mkboth{\listtablename}{\listtablename}%
+ \@starttoc{lot}
+}
+%
+% \end{macrocode}
+% \end{macro}
+%
+% 本科与研究生论文设置不同的目录格式。
+% \begin{macrocode}
+%<*bachelor>
+\renewcommand{\cftchapfont}{\normalfont}
+\renewcommand{\cftchapleader}{\normalfont\cftdotfill{\cftdotsep}}
+\renewcommand{\cftchappagefont}{\normalfont}
+%
+%<*graduate>
+\renewcommand{\cftchapfont}{\bfseries\heiti}
+\renewcommand{\cftchapleader}{\normalfont\cftdotfill{\cftdotsep}}
+%
+% \end{macrocode}
+%
+% 图表索引前加下“图”,“表”关键词。
+% \begin{macrocode}
+%<*class>
+\renewcommand{\cftfigpresnum}{\sjtu@label@figure~}
+\newlength{\sjtu@cftfignumwidth@tmp}
+ \settowidth{\sjtu@cftfignumwidth@tmp}{\cftfigpresnum}
+\addtolength{\cftfignumwidth}{\sjtu@cftfignumwidth@tmp}
+\renewcommand{\cfttabpresnum}{\sjtu@label@table~}
+\newlength{\sjtu@cfttabnumwidth@tmp}
+ \settowidth{\sjtu@cfttabnumwidth@tmp}{\cfttabpresnum}
+\addtolength{\cfttabnumwidth}{\sjtu@cfttabnumwidth@tmp}
+%
+% \end{macrocode}
+%
+% \subsubsection{浮动对象以及表格}
+%
+% 下面这组命令使浮动对象的缺省值稍微宽松一点,从而防止幅度对象占据过多的文本页
+% 面,也可以防止在很大空白的浮动页上放置很小的图形。
+% \begin{macrocode}
+%<*class>
+\renewcommand{\textfraction}{0.15}
+\renewcommand{\topfraction}{0.85}
+\renewcommand{\bottomfraction}{0.65}
+\renewcommand{\floatpagefraction}{0.60}
+% \end{macrocode}
+%
+% 定义公式、图、表的编号为“3-1”的形式,即分隔符由“.”变为“-”。
+% \begin{macrocode}
+\AtBeginDocument{%
+ \renewcommand{\theequation}{\thechapter--\arabic{equation}}
+ \renewcommand{\thefigure}{\thechapter--\arabic{figure}}
+ \renewcommand{\p@subfigure}{\thefigure}
+ \renewcommand{\thetable}{\thechapter--\arabic{table}}}
+% \end{macrocode}
+%
+% 设置双语题注。
+% \begin{macrocode}
+\DeclareCaptionFont{sjtucaptionfont}{\zihao{5}\kaishu}
+\DeclareCaptionFont{sjtusubcaptionfont}{\zihao{-5}\normalfont}
+\captionsetup{%
+ format = plain,
+ labelformat = simple,
+ labelsep = space,
+ justification = centering,
+ font = sjtucaptionfont}
+\DeclareCaptionOption{bi-first}[]{%
+ \def\tablename{\sjtu@label@table}
+ \def\figurename{\sjtu@label@figure}}
+\DeclareCaptionOption{bi-second}[]{%
+ \def\tablename{Table}
+ \def\figurename{Figure}}
+\captionsetup[bi-first]{bi-first}
+\captionsetup[bi-second]{bi-second}
+\captionsetup[sub]{font=sjtusubcaptionfont}
+%
+% \end{macrocode}
+%
+% \subsubsection{声明}
+%
+% 支持扫描文件替换。
+% \begin{macrocode}
+%<*class>
+\newcommand{\sjtu@square}{%
+ \ifsjtu@unsetfont
+ {$\square$}
+ \else
+ \raisebox{-0.125ex}{\scalebox{1.5}{$\square$}}
+ \fi
+}
+\newcommand{\sjtu@authconf}{%
+ \par\hspace{7em}%
+ {\heiti 保\quad 密}~\sjtu@square,在 \uline{\hspace{3em}}
+ 年解密后适用本授权书。\par
+ 本\sjtu@label@thesiscat 属于
+ \par\hspace{7em}%
+ {\heiti 不保密}~\sjtu@square。
+ \vskip 1ex
+ (请在以上方框内打“$\checkmark$”)
+}
+\newcommand{\sjtu@signbox}[1]{%
+ \parbox{.45\textwidth}{%
+ #1 签名: \vskip 4em%
+ 日期: \hspace{\stretch{3}} 年%
+ \hspace{\stretch{2}} 月 \hspace{\stretch{2}} 日%
+ }
+}
+\NewDocumentCommand{\makeDeclareOriginality}{o}{%
+ \ifsjtu@review\relax\else%
+ \cleardoublepage
+ \pdfbookmark[0]{\sjtu@label@originality}{origtitle}
+ \IfNoValueTF{#1}{%
+ \thispagestyle{empty}
+ \chapter*{\zihao{-2}\sjtu@label@schoolChi \\%
+ \sjtu@label@origtitle}
+ {\zihao{4}
+ \sjtu@label@origbody
+ \vskip16ex
+ \noindent
+ \begin{minipage}{\textwidth}
+ \hfill
+ \sjtu@signbox{\sjtu@label@thesiscat 作者}
+ \end{minipage}}}
+ {\includepdf[pagecommand={\thispagestyle{empty}}]{#1}}
+ \fi
+}
+\NewDocumentCommand{\makeDeclareAuthorization}{o}{%
+ \ifsjtu@review\relax\else%
+ \cleardoublepage
+ \pdfbookmark[0]{\sjtu@label@authorization}{authtitle}
+ \IfNoValueTF{#1}{%
+ \thispagestyle{empty}
+ \chapter*{\zihao{-2}\sjtu@label@schoolChi \\%
+ \sjtu@label@authtitle}
+ {\zihao{4}
+ \sjtu@label@authbody
+ \vskip1ex
+ \sjtu@authconf
+ \vskip16ex
+ \noindent
+ \begin{minipage}{\textwidth}
+ \sjtu@signbox{\sjtu@label@thesiscat 作者}
+ \hfill
+ \sjtu@signbox{指导教师}
+ \end{minipage}}}
+ {\includepdf[pagecommand={\thispagestyle{empty}}]{#1}}
+ \fi
+}
+%
+% \end{macrocode}
+%
+% \subsubsection{摘要}
+%
+% 定义摘要环境,本科与研究生论文的摘要样式要求略有不同。
+% \begin{macrocode}
+%<*(bachelor|graduate)>
+\NewDocumentEnvironment{abstract}{}%
+{\cleardoublepage
+ \pdfbookmark[0]{\sjtu@label@abstract}{abstract}
+ \chapter*{%
+ \sjtu@value@title \vskip 2ex
+%<*bachelor>
+ {\zihao{4}\sjtu@label@abstractChi}
+%
+%<*graduate>
+ \sjtu@label@abstractChi
+%
+ }
+ \markboth{\sjtu@label@abstractChi}%
+ {\sjtu@label@abstractChi}
+%<*graduate>
+ \zihao{4}
+%
+}{%
+ \vspace{3ex}\noindent
+%<*bachelor>
+ {\zihao{-4}\heiti\sjtu@label@keywordsChi}{\zihao{5}\sjtu@value@keywords}
+%
+%<*graduate>
+ {\heiti\sjtu@label@keywordsChi}\sjtu@value@keywords
+%
+}
+% \end{macrocode}
+%
+% 英文摘要。
+% \begin{macrocode}
+\NewDocumentEnvironment{enabstract}{}{%
+ \cleardoublepage
+ \chapter*{%
+ \MakeUppercase\sjtu@value@entitle \vskip 2ex
+%<*bachelor>
+ {\zihao{4}\MakeUppercase\sjtu@label@abstractEng}}
+%
+%<*graduate>
+ \MakeUppercase\sjtu@label@abstractEng}
+%
+ \markboth{\sjtu@label@abstractEng}%
+ {\sjtu@label@abstractEng}
+%<*graduate>
+ \zihao{4}
+%
+}{%
+ \vspace{3ex}\noindent
+%<*bachelor>
+ {\zihao{-4}\bfseries\sjtu@label@keywordsEng}
+ {\zihao{5}\sjtu@value@enkeywords}}
+%
+%<*graduate>
+ {\bfseries\MakeUppercase\sjtu@label@keywordsEng}
+ \sjtu@value@enkeywords}
+%
+% \end{macrocode}
+%
+% 本科论文英文大摘要。
+% \begin{macrocode}
+\newcommand{\sjtu@bigabstract}[1]{\long\gdef\sjtu@bigabstract@body{#1}}
+\NewDocumentEnvironment{bigabstract}{}
+{\Collect@Body\sjtu@bigabstract}
+%<*bachelor>
+{\ifsjtu@course\relax\else%
+ \ifsjtu@english\relax\else%
+ \AtEndDocument{%
+ \cleardoublepage
+ \pagenumbering{roman}
+ \pagestyle{sjtu@biglast}
+ \pdfbookmark[0]{\sjtu@label@bigabstract}{bigabstract}%
+ \chapter*{\MakeUppercase\sjtu@value@entitle}
+ \sjtu@bigabstract@body}
+ \fi
+\fi}
+%
+%<*graduate>
+{}
+%
+%(bachelor|graduate)>
+% \end{macrocode}
+%
+% \subsubsection{主要符号对照表}
+%
+% 使用 \pkg{longtable} 实现符号对照表。
+% \begin{macrocode}
+%<*class>
+\NewDocumentEnvironment{nomenclature}{m}
+{\cleardoublepage
+ \pdfbookmark[0]{\sjtu@label@nomenclature}{nomenclature}
+ \chapter*{\sjtu@label@nomenclature}
+ \markboth{\sjtu@label@nomenclature}%
+ {\sjtu@label@nomenclature}
+ \begin{longtable}{#1}}
+{\end{longtable}}
+% \end{macrocode}
+%
+% \subsubsection{全文总结}
+%
+% \begin{macrocode}
+\NewDocumentEnvironment{summary}{}{%
+ \cleardoublepage
+ \chapter*{\sjtu@label@summary}
+ \markboth{\sjtu@label@summary}%
+ {\sjtu@label@summary}
+ \addcontentsline{toc}{chapter}{\sjtu@label@summary}
+}{}
+% \end{macrocode}
+%
+% \subsubsection{致谢}
+%
+% 定义致谢环境,盲审模式下隐藏致谢。
+% \begin{macrocode}
+\newcommand{\sjtu@acknowledgements}[1]{\long\gdef\sjtu@acknowledgements@body{#1}}
+\NewDocumentEnvironment{acknowledgements}{}
+{\Collect@Body\sjtu@acknowledgements}
+{\ifsjtu@review\relax\else%
+ \cleardoublepage
+ \chapter*{\sjtu@label@acknowledgements}
+ \markboth{\sjtu@label@acknowledgements}%
+ {\sjtu@label@acknowledgements}
+ \addcontentsline{toc}{chapter}{\sjtu@label@acknowledgements}
+ \sjtu@acknowledgements@body
+ \fi}
+% \end{macrocode}
+%
+% \subsubsection{附录}
+%
+% 定义附录使用的列表环境,使用和参考文献列表相同的样式。
+% \begin{macrocode}
+\NewDocumentEnvironment{sjtu@bibliolist}{o}{%
+ \list%
+ {\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}
+ \setlength{\labelsep}{\biblabelsep}%
+ \setlength{\leftmargin}{\bibhang}%
+ \addtolength{\leftmargin}{\labelwidth}%
+ \setlength{\itemindent}{0pt}%
+ \setlength{\itemsep}{\bibitemsep}%
+ \setlength{\parsep}{\bibparsep}}%
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand{\theenumiv}{\@arabic\c@enumiv}}
+{\def\@noitemerr
+ {\@latex@warning{Empty `bibliolist' environment}}%
+ \endlist}
+% \end{macrocode}
+%
+% 分别定义论文、专利和项目三个附录环境。
+% \begin{macrocode}
+\NewDocumentEnvironment{publications}{O{99}}
+{\cleardoublepage
+ \chapter{\sjtu@label@publications}
+ \markboth{\sjtu@label@publications}%
+ {\sjtu@label@publications}
+ \begin{sjtu@bibliolist}[#1]}
+{\end{sjtu@bibliolist}}
+\NewDocumentEnvironment{patents}{O{99}}
+{\cleardoublepage
+ \chapter{\sjtu@label@patents}
+ \markboth{\sjtu@label@patents}%
+ {\sjtu@label@patents}
+ \begin{sjtu@bibliolist}[#1]}
+{\end{sjtu@bibliolist}}
+\NewDocumentEnvironment{projects}{O{99}}
+{\cleardoublepage
+ \chapter{\sjtu@label@projects}
+ \markboth{\sjtu@label@projects}%
+ {\sjtu@label@projects}
+ \begin{sjtu@bibliolist}[#1]}
+{\end{sjtu@bibliolist}}
+% \end{macrocode}
+%
+% 定义简历环境。
+% \begin{macrocode}
+\newcommand{\sjtu@resume}[1]{\long\gdef\sjtu@resume@body{#1}}
+\NewDocumentEnvironment{resume}{}
+{\Collect@Body\sjtu@resume}
+{\ifsjtu@review\relax\else%
+ \cleardoublepage
+ \chapter{\sjtu@label@resume}
+ \markboth{\sjtu@label@resume}%
+ {\sjtu@label@resume}
+ \sjtu@resume@body
+\fi}
+% \end{macrocode}
+%
+% \subsubsection{盲审模式}
+%
+% 盲审模式下隐藏作者、导师姓名等信息。同时将论文信息写入 PDF 元数据。
+% \begin{macrocode}
+\AtBeginDocument{
+ \ifsjtu@review%
+ \sjtuSetInfo{%
+ author={},
+ supervisor={},
+ assisupervisor={},
+ enauthor={},
+ ensupervisor={},
+ enassisupervisor={},
+ studentid={},
+ date={},
+ endate={}
+ }
+ \fi
+ \hypersetup{%
+ pdftitle = \sjtu@value@title,
+ pdfauthor = \sjtu@value@author,
+ pdfsubject = \sjtu@label@subjectChi,
+ pdfkeywords = \sjtu@value@keywords,
+ pdfcreator = {LaTeX with SJTUThesis \version}
+ }%
+}
+% \end{macrocode}
+%
+% \begin{macro}{\encrypt}
+% 定义盲审模式工具宏\cs{encrypt}:
+% \begin{macrocode}
+\NewDocumentCommand{\encrypt}{m O{***}}{%
+ \ifsjtu@review
+ {#2}
+ \else
+ {#1}
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{封面}
+%
+% 定义一个特殊的下划线命令供绘制本科论文封面时使用。
+% \begin{macrocode}
+\newcommand{\sjtu@uline}[1]%
+{\begingroup
+ \setbox0=\vbox{\strut #1\strut}%
+ \dimen0=0pt
+ \loop\ifdim\ht0>0pt
+ \dimen1=\dimexpr\ht0 - \baselineskip\relax
+ \setbox1=\vsplit0 to \ht\strutbox
+ \advance\dimen1 by -\ht0
+ \noindent\raisebox{-\dimen0}[\ht\strutbox][\dp\strutbox]{\box1}%
+ \advance\dimen0 by \dimen1
+ \vspace{-0.2ex}\hrule\vskip 0.2ex
+ \repeat
+\endgroup}
+%
+% \end{macrocode}
+%
+% 绘制封面
+% \begin{macrocode}
+%<*(bachelor|graduate)>
+\RenewDocumentCommand\maketitle{}{%
+ \pdfbookmark[0]{\sjtu@label@titlepage}{titlepage}
+ \sjtu@makechinesetitle%
+%<*graduate>
+ \sjtu@makeenglishtitle%
+%
+}
+\newcommand{\sjtu@makechinesetitle}{
+ \cleardoublepage
+%<*bachelor>
+ \thispagestyle{empty}
+ \begin{center}
+ \kaishu
+ \vspace*{48bp}
+ \includegraphics{figure/sjtulogo.pdf}
+ \vskip 28bp
+ {\fontsize{32}{32}\sjtu@label@subjectChi}
+ \vskip 16bp
+ {\zihao{-2}\MakeUppercase\sjtu@label@subjectEng}
+ \vskip 16bp
+ \includegraphics{figure/sjtubadge.pdf}
+ \vskip \stretch{2}
+ {\zihao{2}
+ \begin{tabular}{r@{:}l}
+ 论文题目 &
+ \begin{minipage}[t]{300pt}
+ \zihao{-2}
+ \begin{center}
+ \sjtu@uline\sjtu@value@title
+ \end{center}
+ \end{minipage}
+ \end{tabular}}
+ \vskip \stretch{1}
+ {\zihao{3}
+ \def\arraystretch{1.1}
+ \begin{tabular}
+ {>{\begin{CJKfilltwosides}{4\ccwd}}r<{\end{CJKfilltwosides}}@{:}c}
+ \sjtu@label@authorChi & \sjtu@value@author \\ \cline{2-2}
+ \sjtu@label@studentidChi & \makebox[180pt]{\sjtu@value@studentid} \\
+ \cline{2-2}
+ \ifsjtu@course
+ \sjtu@label@coursenameChi & \sjtu@value@coursename \\ \cline{2-2}
+ \else
+ \sjtu@label@majorChi & \sjtu@value@major \\ \cline{2-2}
+ \fi
+ \sjtu@label@supervisorChi & \sjtu@value@supervisor \\ \cline{2-2}
+ \sjtu@label@departmentChi & \sjtu@value@department \\ \cline{2-2}
+ \end{tabular}}
+ \vskip 40bp
+%
+%<*graduate>
+ \thispagestyle{sjtu@title}
+ \begin{center}
+ \vspace*{40bp}
+ {\zihao{-2}\sjtu@label@subjectChi}
+ \vskip \stretch{4}
+ {\zihao{2}\heiti\sjtu@value@title \vskip 1bp}
+ \vskip \stretch{5}
+ {\zihao{4}
+ \def\tabcolsep{1bp}
+ \def\arraystretch{1.25}
+ \begin{tabular}
+ {>{\begin{CJKfilltwosides}[t]{6.5\ccwd}\heiti}r<{\end{CJKfilltwosides}}
+ @{:}l}
+ \sjtu@label@authorChi & \sjtu@value@author \\
+ \sjtu@label@studentidChi & \sjtu@value@studentid \\
+ \sjtu@label@supervisorChi & \sjtu@value@supervisor \\
+ \ifx\sjtu@value@assisupervisor\@empty\else
+ \sjtu@label@assisupervisorChi & \sjtu@value@assisupervisor \\
+ \fi
+ \sjtu@label@degreeChi & \sjtu@value@degree \\
+ \sjtu@label@majorChi & \sjtu@value@major \\
+ \sjtu@label@departmentChi & \sjtu@value@department \\
+ \sjtu@label@defenddateChi & \sjtu@value@date \\
+ \sjtu@label@conferringChi & \sjtu@label@schoolChi \\
+ \end{tabular}}
+ \vskip 26bp
+%
+ \end{center}
+ \cleardoublepage}
+%(bachelor|graduate)>
+%<*graduate>
+\newcommand{\sjtu@makeenglishtitle}{%
+ \cleardoublepage
+ \thispagestyle{sjtu@entitle}
+ \begin{center}
+ \vspace*{28bp}
+ {\zihao{-2}\sjtu@label@subjectEng \vskip 1bp}
+ \vskip \stretch{4}
+ {\zihao{2}\bfseries\MakeUppercase\sjtu@value@entitle \vskip 1bp}
+ \vskip \stretch{5}
+ {\zihao{4}
+ \def\tabcolsep{1bp}
+ \def\arraystretch{1.3}
+ \begin{tabular}
+ {>{\bfseries}l<{:~}l}
+ \sjtu@label@authorEng & \sjtu@value@enauthor \\
+ \sjtu@label@studentidEng & \sjtu@value@studentid \\
+ \sjtu@label@supervisorEng & \sjtu@value@ensupervisor \\
+ \ifx\sjtu@value@enassisupervisor\@empty\else
+ \sjtu@label@assisupervisorEng & \sjtu@value@enassisupervisor \\
+ \fi
+ \sjtu@label@degreeEng & \sjtu@value@endegree \\
+ \sjtu@label@majorEng & \sjtu@value@enmajor \\
+ \sjtu@label@departmentEng & \sjtu@value@endepartment \\
+ \sjtu@label@defenddateEng & \sjtu@value@endate \\
+ \sjtu@label@conferringEng & \sjtu@label@schoolEng \\
+ \end{tabular}}
+ \vskip 26bp
+ \end{center}
+ \cleardoublepage}
+%
+% \end{macrocode}
+%
+% \subsection{文档部件}
+%
+% \subsubsection{超链接}
+%
+% \begin{macrocode}
+%<*class>
+\hypersetup{
+ linktoc = all,
+ bookmarksnumbered = true,
+ bookmarksopen = true,
+ bookmarksopenlevel = 1,
+ unicode = true,
+ psdextra = true,
+ breaklinks = true,
+ plainpages = false,
+ hidelinks,
+}
+\pdfstringdefDisableCommands{%
+ \let\\\@empty
+ \let\quad\@empty
+ \let\hspace\@gobble
+}
+% \end{macrocode}
+%
+% 设置 url 样式,与上下文一致。
+% \begin{macrocode}
+\urlstyle{same}
+% \end{macrocode}
+%
+% 使用 \pkg{xurl} 的方法,增加 URL 可断行的位置。
+% \begin{macrocode}
+\def\UrlBreaks{%
+ \do\/%
+ \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l%
+ \do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z%
+ \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L%
+ \do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z%
+ \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:%
+ \do\*\do\-\do\~\do\'\do\"\do\-}
+\Urlmuskip=0mu plus 0.1mu
+% \end{macrocode}
+%
+% 根据选项载入配置文件。
+% \begin{macrocode}
+\ifsjtu@bachelor%
+ \AtEndOfClass{\input{sjtuthesis-bachelor.ltx}}
+\else
+ \ifsjtu@master%
+ \AtEndOfClass{\input{sjtuthesis-graduate.ltx}}
+ \fi
+\fi
+%
+% \end{macrocode}
+%
+% \subsection{其他宏包的设置}
+%
+% 这些宏包并非格式要求,但是为了方便同学们使用,在这里进行简单设置。
+% \begin{macrocode}
+%<*class>
+\newcommand{\sjtu@atendpackage}{\csname ctex_at_end_package:nn\endcsname}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{unicode-math} 宏包}
+%
+% \begin{macrocode}
+\sjtu@atendpackage{unicode-math}{
+ \unimathsetup{
+ math-style = ISO,
+ bold-style = ISO,
+ nabla = upright,
+ partial = upright,
+ }
+ \newcommand{\bm}{\symbf}
+ \renewcommand{\boldsymbol}{\symbf}
+ \newcommand{\square}{\mdlgwhtsquare}
+ \@ifpackagelater{hyperref}{2019/04/27}{}{%
+ \g@addto@macro\psdmapshortnames{\let\mu\textmugreek}%
+ }
+}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{threeparttable} 宏包}
+%
+% \begin{macrocode}
+\sjtu@atendpackage{threeparttable}{
+ \appto\TPTnoteSettings{\footnotesize}
+}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{siunitx} 宏包}
+%
+% \begin{macrocode}
+\sjtu@atendpackage{siunitx}{
+ \sisetup{
+ detect-all,
+ group-minimum-digits = 4,
+ separate-uncertainty = true,
+ inter-unit-product = \ensuremath{{}\cdot{}},
+ }
+ \ifsjtu@chinese
+ \sisetup{
+ list-final-separator = { 和 },
+ list-pair-separator = { 和 },
+ range-phrase = {~},
+ }
+ \fi
+}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{ntheorem} 宏包}
+%
+% \begin{macrocode}
+\PassOptionsToPackage{amsmath,thmmarks,hyperref}{ntheorem}
+\sjtu@atendpackage{ntheorem}{
+ \ifsjtu@chinese
+ \def\sjtu@label@assertion{断言}
+ \def\sjtu@label@assumption{假设}
+ \def\sjtu@label@axiom{公理}
+ \def\sjtu@label@corollary{推论}
+ \def\sjtu@label@definition{定义}
+ \def\sjtu@label@example{例}
+ \def\sjtu@label@lemma{引理}
+ \def\sjtu@label@proof{证明}
+ \def\sjtu@label@proposition{命题}
+ \def\sjtu@label@remark{注}
+ \def\sjtu@label@theorem{定理}
+ \else
+ \def\sjtu@label@assertion{Assertion}
+ \def\sjtu@label@assumption{Assumption}
+ \def\sjtu@label@axiom{Axiom}
+ \def\sjtu@label@corollary{Corollary}
+ \def\sjtu@label@definition{Definition}
+ \def\sjtu@label@example{Example}
+ \def\sjtu@label@lemma{Lemma}
+ \def\sjtu@label@proof{Proof}
+ \def\sjtu@label@proposition{Proposition}
+ \def\sjtu@label@remark{Remark}
+ \def\sjtu@label@theorem{Theorem}
+ \fi
+ \theorembodyfont{\normalfont}
+ \theoremheaderfont{\bfseries\heiti}
+ \theoremseparator{\enspace}
+ \theoremsymbol{\ensuremath{\square}}
+ \newtheorem*{proof}{\sjtu@label@proof}
+ \theoremstyle{plain}
+ \theorembodyfont{\kaishu}
+ \theoremsymbol{}
+ \newtheorem{assertion} {\sjtu@label@assertion} [chapter]
+ \newtheorem{assumption} {\sjtu@label@assumption} [chapter]
+ \newtheorem{axiom} {\sjtu@label@axiom} [chapter]
+ \newtheorem{corollary} {\sjtu@label@corollary} [chapter]
+ \newtheorem{definition} {\sjtu@label@definition} [chapter]
+ \newtheorem{example} {\sjtu@label@example} [chapter]
+ \newtheorem{lemma} {\sjtu@label@lemma} [chapter]
+ \newtheorem{proposition}{\sjtu@label@proposition}[chapter]
+ \newtheorem{remark} {\sjtu@label@remark} [chapter]
+ \newtheorem{theorem} {\sjtu@label@theorem} [chapter]
+}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{algorithm2e} 宏包}
+%
+% \begin{macrocode}
+\PassOptionsToPackage{algochapter}{algorithm2e}
+\sjtu@atendpackage{algorithm2e}{
+ \SetAlgorithmName{\sjtu@label@algorithm}%
+ {\sjtu@label@algorithm}%
+ {\sjtu@label@listalgorithm}
+ \SetAlgoCaptionSeparator{~}
+ \newcommand{\cftalgpresnum}{\sjtu@label@algorithm~}
+ \newlength{\cftalgnumwidth}
+ \setlength{\cftalgnumwidth}{2.3em}
+ \newlength{\sjtu@cftalgnumwidth@tmp}
+ \settowidth{\sjtu@cftalgnumwidth@tmp}{\cftalgpresnum}
+ \addtolength{\cftalgnumwidth}{\sjtu@cftalgnumwidth@tmp}
+ \renewcommand*{\l@algocf}[2]{%
+ \vskip \cftbeforefigskip
+ {\leftskip \cftfigindent\relax
+ \rightskip \@tocrmarg
+ \parfillskip -\rightskip
+ \parindent \cftfigindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftalgnumwidth\relax
+ \let\@cftbsnum \cftalgpresnum
+ \let\@cftasnum \cftfigaftersnum
+ \let\@cftasnumb \cftfigaftersnumb
+ \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
+ {\cftfigfont #1}\nobreak
+ \cftfigfillnum{#2}}%
+ }
+ \renewcommand{\listofalgorithms}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\listalgorithmcfname}{loa}%
+ \chapter*{\listalgorithmcfname}%
+ \@mkboth{\listalgorithmcfname}{\listalgorithmcfname}%
+ \@starttoc{loa}
+ }
+ \AtBeginDocument{%
+ \renewcommand{\thealgocf}{\thechapter--\@arabic\c@algocf}
+ }
+}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{algorithm} 宏包}
+%
+% \begin{macrocode}
+\sjtu@atendpackage{algorithm}{
+ \RequirePackage{algorithmicx, algpseudocode}
+ \floatname{algorithm}{\sjtu@label@algorithm}
+ \renewcommand{\listalgorithmname}{\sjtu@label@listalgorithm}
+ \@addtoreset{algorithm}{chapter}
+ \patchcmd\@chapter%
+ {\if@twocolumn}
+ {\addtocontents{loa}{\protect\addvspace{10\p@}}%
+ \if@twocolumn}
+ {}{}
+ \newcommand{\cftalgpresnum}{\sjtu@label@algorithm~}
+ \newlength{\cftalgnumwidth}
+ \setlength{\cftalgnumwidth}{2.3em}
+ \newlength{\sjtu@cftalgnumwidth@tmp}
+ \settowidth{\sjtu@cftalgnumwidth@tmp}{\cftalgpresnum}
+ \addtolength{\cftalgnumwidth}{\sjtu@cftalgnumwidth@tmp}
+ \newcommand*{\l@algorithm}[2]{%
+ \vskip \cftbeforefigskip
+ {\leftskip \cftfigindent\relax
+ \rightskip \@tocrmarg
+ \parfillskip -\rightskip
+ \parindent \cftfigindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftalgnumwidth\relax
+ \let\@cftbsnum \cftalgpresnum
+ \let\@cftasnum \cftfigaftersnum
+ \let\@cftasnumb \cftfigaftersnumb
+ \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
+ {\cftfigfont #1}\nobreak
+ \cftfigfillnum{#2}}%
+ }
+ \renewcommand{\listofalgorithms}{%
+ \cleardoublepage%
+ \pdfbookmark[0]{\listalgorithmname}{loa}%
+ \chapter*{\listalgorithmname}%
+ \@mkboth{\listalgorithmname}{\listalgorithmname}%
+ \@starttoc{loa}
+ }
+ \AtBeginDocument{%
+ \renewcommand{\thealgorithm}{\thechapter--\arabic{algorithm}}
+ }
+}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{listings} 宏包}
+%
+% \begin{macrocode}
+\sjtu@atendpackage{listings}{
+ \lstdefinestyle{lstStyleCode}{
+ aboveskip=\medskipamount,
+ belowskip=\medskipamount,
+ basicstyle=\footnotesize\ttfamily,
+ commentstyle=\slshape\color{black!60},
+ stringstyle=\color{green!40!black!100},
+ keywordstyle=\bfseries\color{blue!50!black},
+ extendedchars=false,
+ upquote=true,
+ tabsize=2,
+ showstringspaces=false,
+ xleftmargin=1em,
+ xrightmargin=1em,
+ breaklines=true,
+ breakindent=2em,
+ framexleftmargin=1em,
+ framexrightmargin=1em,
+ backgroundcolor=\color{gray!10},
+ columns=flexible,
+ keepspaces=true,
+ texcl=true,
+ mathescape=true
+ }
+ \lstnewenvironment{codeblock}[1][]
+ {\lstset{style=lstStyleCode,language=#1}}{}
+}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{tikz} 宏包}
+%
+% \begin{macrocode}
+\sjtu@atendpackage{tikz}{
+ \usetikzlibrary{shapes.geometric, arrows}
+ \tikzstyle{startstop} = [
+ rectangle,
+ rounded corners,
+ minimum width=2cm,
+ minimum height=1cm,
+ text centered,
+ draw=black
+ ]
+ \tikzstyle{io} = [
+ trapezium,
+ trapezium left angle=75,
+ trapezium right angle=105,
+ minimum width=1cm,
+ minimum height=1cm,
+ text centered,
+ draw=black
+ ]
+ \tikzstyle{process} = [
+ rectangle,
+ minimum width=2cm,
+ minimum height=1cm,
+ text centered,
+ draw=black
+ ]
+ \tikzstyle{decision} = [
+ diamond,
+ minimum width=2cm,
+ minimum height=1cm,
+ text centered,
+ draw=black]
+ \tikzstyle{arrow} = [thick, ->, >=stealth]
+}
+%
+% \end{macrocode}
+%
+% \Finale
+\endinput
diff --git a/sjtuthesis.ins b/sjtuthesis.ins
new file mode 100644
index 00000000..79cebc11
--- /dev/null
+++ b/sjtuthesis.ins
@@ -0,0 +1,59 @@
+%%
+%% This is file `sjtuthesis.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% sjtuthesis.dtx (with options: `install')
+%%
+%% Copyright (C) 2009-2017 by weijianwen
+%% (C) 2018-2019 by SJTUG
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This file has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Alexara Wu.
+%%
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+
+\preamble
+
+Copyright (C) 2009-2017 by weijianwen
+ (C) 2018-\the\year by SJTUG
+
+This file may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3c
+of this license or (at your option) any later version.
+The latest version of this license is in
+ https://www.latex-project.org/lppl.txt
+and version 1.3c or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This file has the LPPL maintenance status "maintained".
+
+The Current Maintainer of this work is Alexara Wu.
+
+\endpreamble
+
+\generate{
+ \usedir{tex/latex/sjtuthesis}
+ \file{\jobname.cls} {\from{\jobname.dtx}{class}}
+ \file{\jobname-bachelor.ltx}{\from{\jobname.dtx}{bachelor}}
+ \file{\jobname-graduate.ltx}{\from{\jobname.dtx}{graduate}}
+}
+
+\Msg{* Happy TeXing!}
+
+\endbatchfile
+\endinput
+%%
+%% End of file `sjtuthesis.ins'.
diff --git a/sjtuthesis.sty b/sjtuthesis.sty
new file mode 100644
index 00000000..8412d178
--- /dev/null
+++ b/sjtuthesis.sty
@@ -0,0 +1,106 @@
+%%
+%% This is file `sjtuthesis.sty',
+%% You can put any packages you would like to use here.
+%%
+\ProvidesPackage{sjtuthesis}
+ [2018/01/09 v0.10 Shanghai Jiao Tong University Template]
+
+\RequirePackage{bm}
+
+% \RequirePackage{unicode-math}
+% \setmainfont{TeX Gyre Termes}
+% \setsansfont{TeX Gyre Heros}
+% \setmonofont{TeX Gyre Cursor}
+% \setmathfont{TeX Gyre Termes Math}
+
+\RequirePackage{upgreek}
+\RequirePackage{wasysym}
+
+% 表格中支持跨行
+\RequirePackage{multirow}
+
+\RequirePackage{dcolumn}
+% A new column type
+\newcolumntype{d}[1]{D{.}{.}{#1}}% or D{.}{,}{#1} or D{.}{\cdot}{#1}
+
+\RequirePackage{threeparttable}
+
+\RequirePackage{siunitx}
+
+\RequirePackage{hologo}
+\newcommand{\XeTeX}{\hologo{XeTeX}}
+\newcommand{\BibTeX}{\hologo{BibTeX}}
+\newcommand{\CJKLaTeX}{CJK--\LaTeX}
+
+\RequirePackage{tikz}
+
+\RequirePackage{ntheorem}
+
+\RequirePackage{listings}
+
+% \RequirePackage[ruled,vlined,linesnumbered]{algorithm2e}
+
+\RequirePackage{algorithm}
+
+\sjtu@atendpackage{algorithm}{
+
+\ifsjtu@english
+ \def\sjtu@label@algorequire{Input:}
+ \def\sjtu@label@algoensure{Output:}
+\else
+ \def\sjtu@label@algorequire{输入:}
+ \def\sjtu@label@algoensure{输出:}
+\fi
+\renewcommand{\algorithmicrequire}{\textbf{\sjtu@label@algorequire}}
+\renewcommand{\algorithmicensure}{\textbf{\sjtu@label@algoensure}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% The following definitions add Switch statement to LaTeX algorithmicx package
+% It's based on Werner's answer on stackoverflow
+% http://tex.stackexchange.com/questions/53357/switch-cases-in-algorithmic
+
+% New definitions
+\algnewcommand\algorithmicswitch{\textbf{switch}}
+\algnewcommand\algorithmiccase{\textbf{case}}
+\algnewcommand\algorithmicdefault{\textbf{default}}
+
+% New "environments"
+% using \algtext*{} removes any typesetting of that command
+\algdef{SE}[SWITCH]{Switch}{EndSwitch}[1]{\algorithmicswitch\ (#1)}{\algorithmicend\ \algorithmicswitch}%
+%\algtext*{EndSwitch}%
+\algdef{SE}[CASE]{Case}{EndCase}[1]{\algorithmiccase\ #1:}{\algorithmicend\ \algorithmiccase}%
+\algtext*{EndCase}%
+\algdef{SE}[DEFAULT]{Default}{EndDefault}{\algorithmicdefault\ :}{\algorithmicend\ \algorithmicdefault}%
+\algtext*{EndDefault}%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% The following add some extra commands to LaTeX algorithmicx package
+
+% Assert
+\algnewcommand\algorithmicassert{\texttt{assert}}
+\algnewcommand\Assert[1]{\State \algorithmicassert(#1)}%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+}
+
+% 自定义命令
+
+% E-mail
+\newcommand{\email}[1]{\href{mailto:#1}{\texttt{#1}}}
+
+% upper math letter
+\newcommand{\me}{\mathrm{e}}
+\newcommand{\mi}{\mathrm{i}}
+\newcommand{\mj}{\mathrm{j}}
+\newcommand{\dif}{\mathrm{d}}
+
+% bullets in the item
+\renewcommand{\labelitemi}{\ensuremath{\bullet}}
+
+%% Graphic path & file extension
+\graphicspath{{fig/}{figure/}{figures/}{logo/}{logos/}{graph/}{graphs}}
+\DeclareGraphicsExtensions{.pdf,.eps,.png,.jpg,.jpeg}
+
+\endinput
+%%
+%% End of file `sjtuthesis.sty'.
diff --git a/tex/abstract.tex b/tex/abstract.tex
index 592de99b..503847c0 100644
--- a/tex/abstract.tex
+++ b/tex/abstract.tex
@@ -24,7 +24,7 @@
\end{abstract}
-\begin{englishabstract}
+\begin{enabstract}
An imperial edict issued in 1896 by Emperor Guangxu, established Nanyang Public School in Shanghai. The normal school, school of foreign studies, middle school and a high school were established. Sheng Xuanhuai, the person responsible for proposing the idea to the emperor, became the first president and is regarded as the founder of the university.
@@ -38,5 +38,5 @@
Its total enrollment of students amounts to 35,929, of which 1,564 are international students. There are 16,802 undergraduates, and 17,563 masters and Ph.D. candidates. After more than a century of operation, Jiao Tong University has inherited the old tradition of "high starting points, solid foundation, strict requirements and extensive practice." Students from SJTU have won top prizes in various competitions, including ACM International Collegiate Programming Contest, International Mathematical Contest in Modeling and Electronics Design Contests. Famous alumni include Jiang Zemin, Lu Dingyi, Ding Guangen, Wang Daohan, Qian Xuesen, Wu Wenjun, Zou Taofen, Mao Yisheng, Cai Er, Huang Yanpei, Shao Lizi, Wang An and many more. More than 200 of the academics of the Chinese Academy of Sciences and Chinese Academy of Engineering are alumni of Jiao Tong University.
-\end{englishabstract}
+\end{enabstract}
diff --git a/tex/ack.tex b/tex/ack.tex
index 0e6d477a..f57d8fa3 100644
--- a/tex/ack.tex
+++ b/tex/ack.tex
@@ -3,7 +3,7 @@
% !TEX root = ../thesis.tex
% !TEX encoding = UTF-8 Unicode
%TC:ignore
-\begin{thanks}
+\begin{acknowledgements}
感谢所有测试和使用交大学位论文 \LaTeX 模板的同学!
@@ -17,5 +17,5 @@
感谢所有为模板贡献过代码的同学们, 以及所有测试和使用模板的各位同学!
-\end{thanks}
+\end{acknowledgements}
%TC:endignore
diff --git a/tex/app_eq.tex b/tex/app_eq.tex
index ebd53d99..f0f5ff5f 100644
--- a/tex/app_eq.tex
+++ b/tex/app_eq.tex
@@ -14,57 +14,57 @@ \chapter{Maxwell Equations}
选择二维情况,有如下的偏振矢量:
\begin{subequations}
- \begin{eqnarray}
- {\bf E}&=&E_z(r,\theta)\hat{\bf z} \\
- {\bf H}&=&H_r(r,\theta))\hat{ \bf r}+H_\theta(r,\theta)\hat{\bm
+ \begin{align}
+ {\bf E}&=E_z(r,\theta)\hat{\bf z} \\
+ {\bf H}&=H_r(r,\theta))\hat{ \bf r}+H_\theta(r,\theta)\hat{\bm
\theta}
- \end{eqnarray}
+ \end{align}
\end{subequations}
对上式求旋度:
\begin{subequations}
- \begin{eqnarray}
- \nabla\times{\bf E}&=&\frac{1}{r}\frac{\partial E_z}{\partial\theta}{\hat{\bf r}}-\frac{\partial E_z}{\partial r}{\hat{\bm\theta}}\\
- \nabla\times{\bf H}&=&\left[\frac{1}{r}\frac{\partial}{\partial
+ \begin{align}
+ \nabla\times{\bf E}&=\frac{1}{r}\frac{\partial E_z}{\partial\theta}{\hat{\bf r}}-\frac{\partial E_z}{\partial r}{\hat{\bm\theta}}\\
+ \nabla\times{\bf H}&=\left[\frac{1}{r}\frac{\partial}{\partial
r}(rH_\theta)-\frac{1}{r}\frac{\partial
H_r}{\partial\theta}\right]{\hat{\bf z}}
- \end{eqnarray}
+ \end{align}
\end{subequations}
因为在柱坐标系下,$\overline{\overline\mu}$是对角的,所以Maxwell方程组中电场$\bf E$的旋度:
\begin{subequations}
- \begin{eqnarray}
- &&\nabla\times{\bf E}=\mathbf{i}\omega{\bf B} \\
- &&\frac{1}{r}\frac{\partial E_z}{\partial\theta}{\hat{\bf
+ \begin{align}
+ &\nabla\times{\bf E}=\mathbf{i}\omega{\bf B} \\
+ &\frac{1}{r}\frac{\partial E_z}{\partial\theta}{\hat{\bf
r}}-\frac{\partial E_z}{\partial
r}{\hat{\bm\theta}}=\mathbf{i}\omega\mu_rH_r{\hat{\bf r}}+\mathbf{i}\omega\mu_\theta
H_\theta{\hat{\bm\theta}}
- \end{eqnarray}
+ \end{align}
\end{subequations}
所以$\bf H$的各个分量可以写为:
\begin{subequations}
- \begin{eqnarray}
- H_r=\frac{1}{\mathbf{i}\omega\mu_r}\frac{1}{r}\frac{\partial
+ \begin{align}
+ H_r&=\frac{1}{\mathbf{i}\omega\mu_r}\frac{1}{r}\frac{\partial
E_z}{\partial\theta } \\
- H_\theta=-\frac{1}{\mathbf{i}\omega\mu_\theta}\frac{\partial E_z}{\partial r}
- \end{eqnarray}
+ H_\theta&=-\frac{1}{\mathbf{i}\omega\mu_\theta}\frac{\partial E_z}{\partial r}
+ \end{align}
\end{subequations}
同样地,在柱坐标系下,$\overline{\overline\epsilon}$是对角的,所以Maxwell方程组中磁场$\bf H$的旋度:
\begin{subequations}
- \begin{eqnarray}
- &&\nabla\times{\bf H}=-\mathbf{i}\omega{\bf D}\\
- &&\left[\frac{1}{r}\frac{\partial}{\partial
+ \begin{align}
+ &\nabla\times{\bf H}=-\mathbf{i}\omega{\bf D}\\
+ &\left[\frac{1}{r}\frac{\partial}{\partial
r}(rH_\theta)-\frac{1}{r}\frac{\partial
H_r}{\partial\theta}\right]{\hat{\bf
z}}=-\mathbf{i}\omega{\overline{\overline\epsilon}}{\bf
E}=-\mathbf{i}\omega\epsilon_zE_z{\hat{\bf z}} \\
- &&\frac{1}{r}\frac{\partial}{\partial
+ &\frac{1}{r}\frac{\partial}{\partial
r}(rH_\theta)-\frac{1}{r}\frac{\partial
H_r}{\partial\theta}=-\mathbf{i}\omega\epsilon_zE_z
- \end{eqnarray}
+ \end{align}
\end{subequations}
由此我们可以得到关于$E_z$的波函数方程:
-\begin{eqnarray}
+\begin{equation}
\frac{1}{\mu_\theta\epsilon_z}\frac{1}{r}\frac{\partial}{\partial r}
\left(r\frac{\partial E_z}{\partial r}\right)+
\frac{1}{\mu_r\epsilon_z}\frac{1}{r^2}\frac{\partial^2E_z}{\partial\theta^2}
+\omega^2 E_z=0
-\end{eqnarray}
+\end{equation}
diff --git a/tex/app_setup.tex b/tex/app_setup.tex
index 51aeb77b..44273a68 100644
--- a/tex/app_setup.tex
+++ b/tex/app_setup.tex
@@ -11,9 +11,9 @@ \subsection{Mac OS X}
Mac用户可以从MacTeX主页\footnote{\url{https://tug.org/mactex/}}下载MacTeX。
也可以通过brew包管理器\footnote{\url{http://caskroom.io}}安装MacTeX。
-\begin{lstlisting}[basicstyle=\small\ttfamily, numbers=none]
+\begin{codeblock}[sh]
brew cask install mactex
-\end{lstlisting}
+\end{codeblock}
\subsection{Linux}
@@ -21,12 +21,12 @@ \subsection{Linux}
以下命令将把TeXLive发行版安装到当前用户的家目录下。
若计划安装一个供系统上所有用户使用的TeXLive,请使用root账户操作。
-\begin{lstlisting}[basicstyle=\small\ttfamily, numbers=none]
+\begin{codeblock}[sh]
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar xzvpf install-tl-unx.tar.gz
cd install-tl-20150411/
./install-tl
-\end{lstlisting}
+\end{codeblock}
\section{安装中文字体}
@@ -38,10 +38,10 @@ \subsection{RedHat/CentOS用户}
RedHat/CentOS用户请先将字体文件复制到字体目录下,调用fc-cache刷新缓存后即可在TeXLive中使用新字体。
-\begin{lstlisting}[basicstyle=\small\ttfamily, numbers=none]
+\begin{codeblock}[sh]
mkdir ~/.fonts
cp *.ttf ~/.fonts # 当前用户可用新字体
cp *.ttf /usr/share/fonts/local/ # 所有用户可以使用新字体
fc-cache -f
-\end{lstlisting}
+\end{codeblock}
diff --git a/tex/example.tex b/tex/example.tex
index 96dc478d..4442bea5 100644
--- a/tex/example.tex
+++ b/tex/example.tex
@@ -126,7 +126,7 @@ \subsection{定理环境}
bthm(断言定理),blem(断言引理),bprop(断言命题),bcor(断言推论)。
amsmath还提供了一个proof(证明)的环境。
这里举一个“定理”和“证明”的例子。
-\begin{thm}[留数定理]
+\begin{theorem}[留数定理]
\label{thm:res}
假设$U$是复平面上的一个单连通开子集,$a_1,\ldots,a_n$是复平面上有限个点,$f$是定义在$U\backslash \{a_1,\ldots,a_n\}$上的全纯函数,
如果$\gamma$是一条把$a_1,\ldots,a_n$包围起来的可求长曲线,但不经过任何一个$a_k$,并且其起点与终点重合,那么:
@@ -158,7 +158,7 @@ \subsection{定理环境}
所以……
\end{proof}
-\end{thm}
+\end{theorem}
上面的公式例子中,有一些细节希望大家注意。微分号d应该使用“直立体”也就是用mathrm包围起来。
并且,微分号和被积函数之间应该有一段小间隔,可以插入\verb+\,+得到。
@@ -344,26 +344,26 @@ \section{参考文献管理}
下面是在Google Scholar上搜索到的一条文献信息,格式是纯文本:
-\begin{lstlisting}[caption={从Google Scholar找到的参考文献条目}, label=googlescholar, escapeinside="", numbers=none]
+\begin{codeblock}
@phdthesis{"白2008信用风险传染模型和信用衍生品的定价",
- title={"信用风险传染模型和信用衍生品的定价"},
- author={"白云芬"},
- year={2008},
- school={"上海交通大学"}
+ title={"信用风险传染模型和信用衍生品的定价"},
+ author={"白云芬"},
+ year={2008},
+ school={"上海交通大学"}
}
-\end{lstlisting}
+\end{codeblock}
推荐修改后在bib文件中的内容为:
-\begin{lstlisting}[caption={修改后的参考文献条目}, label=itemok, escapeinside="", numbers=none]
- @phdthesis{bai2008,
- title={"信用风险传染模型和信用衍生品的定价"},
- author={"白云芬"},
- date={2008},
- address={"上海"},
- school={"上海交通大学"}
- }
-\end{lstlisting}
+\begin{codeblock}
+ @phdthesis{bai2008,
+ title={"信用风险传染模型和信用衍生品的定价"},
+ author={"白云芬"},
+ date={2008},
+ address={"上海"},
+ school={"上海交通大学"}
+ }
+\end{codeblock}
按照教务处的要求,参考文献外观应符合国标GBT7714的要求\footnote{\url{http://www.cces.net.cn/guild/sites/tmxb/Files/19798_2.pdf}}。
在模板中,表现形式的控制逻辑通过biblatex-gb7714-2015包实现\footnote{\url{https://www.ctan.org/pkg/biblatex-gb7714-2015}},基于{Bib\LaTeX}管理文献。在目前的多数TeX发行版中,可能都没有默认包含biblatex-gb7714-2015,需要手动安装。
@@ -390,7 +390,7 @@ \section{用listings插入源代码}
另外,listings宏包真可谓博大精深,可以实现各种复杂、漂亮的效果,想要进一步学习的同学,可以参考
\href{http://mirror.ctan.org/macros/latex/contrib/listings/listings.pdf}{listings宏包手册}。
-\begin{lstlisting}[language={C}, caption={一段C源代码}]
+\begin{codeblock}[C]
#include
#include
#include
@@ -417,7 +417,7 @@ \section{用listings插入源代码}
return 0;
}
-\end{lstlisting}
+\end{codeblock}
\section{用algorithm和algorithmicx宏包插入算法描述}
diff --git a/tex/faq.tex b/tex/faq.tex
index 1feb88ee..a2539beb 100644
--- a/tex/faq.tex
+++ b/tex/faq.tex
@@ -65,7 +65,7 @@ \chapter{常见问题}
A:如果报错是“pdf: image inclusion failed for "./figure/chap2/sjtulogo.pdf".”,则采取以下步骤
-\begin{lstlisting}[basicstyle=\small\ttfamily, caption={编译模板}, numbers=none]
+\begin{codeblock}[sh]
brew install xpdf
wget http://mirrors.ctan.org/support/epstopdf.zip
unzip epstopdf.zip
@@ -76,7 +76,7 @@ \chapter{常见问题}
pdfcrop sjtulogo.pdf
mv sjtulogo.pdf backup.pdf
mv sjtulogo-crop.pdf sjtulogo.pdf
-\end{lstlisting}
+\end{codeblock}
{\bfseries{}Q:为什么维普等查重系统无法识别此模板生成的 pdf 内所有的中文?}
diff --git a/tex/id.tex b/tex/id.tex
index 2c81605b..0efa392d 100644
--- a/tex/id.tex
+++ b/tex/id.tex
@@ -3,31 +3,28 @@
% !TEX root = ../thesis.tex
% !TEX encoding = UTF-8 Unicode
%TC:ignore
-\title{上海交通大学学位论文 \\ \LaTeX{} 模板示例文档}
+\title{上海交通大学学位论文 \LaTeX{} 模板示例文档}
\author{某\quad{}某}
-\advisor{某某教授}
-% \coadvisor{某某教授}
-\defenddate{2014年12月17日}
-\coursename{某某课程}
-\school{上海交通大学}
-\institute{某某系}
-\studentnumber{0010900990}
-\cnacademicdegree{工学硕士}
+\studentid{0010900990}
+\supervisor{某某教授}
+% \assisupervisor{某某教授}
+\degree{工学硕士}
\major{某某专业}
+\department{某某系}
+\coursename{某某课程}
+\date{2014年12月17日}
+% \fund{国家 973 项目 (No. 2025CB000000) \\ 国家自然科学基金 (No. 81120250000)}
\keywords{上海交大, 饮水思源, 爱国荣校}
-\englishtitle{A Sample Document for \LaTeX-based SJTU Thesis Template}
-\englishauthor{\textsc{Mo Mo}}
-\englishadvisor{Prof. \textsc{Mou Mou}}
-% \englishcoadvisor{Prof. \textsc{Uom Uom}}
-\englishschool{Shanghai Jiao Tong University}
-\englishinstitute{\textsc{Depart of XXX, School of XXX} \\
- \textsc{Shanghai Jiao Tong University} \\
- \textsc{Shanghai, P.R.China}}
-\englishinstitutemaster{Depart of XXX, \\ School of XXX}
-\englishmajor{A Very Important Major}
-\englishdate{Dec. 17th, 2014}
-\enacademicdegree{Master of Engineering}
-\englishstudentid{0010900990}
-\englishkeywords{SJTU, master thesis, XeTeX/LaTeX template}
+\entitle{A Sample Document for \LaTeX-based SJTU Thesis Template}
+\enauthor{\textsc{Mo Mo}}
+\ensupervisor{Prof. \textsc{Mou Mou}}
+% \enassisupervisor{Prof. \textsc{Uom Uom}}
+\endegree{Master of Engineering}
+\enmajor{A Very Important Major}
+\endepartment{\textsc{Depart of XXX, School of XXX}}
+\endate{Dec. 17th, 2014}
+% \enfund{National Basic Research Program of China (Grant No. 2025CB000000) \\
+% National Natural Science Foundation of China (Grant No. 81120250000)}
+\enkeywords{SJTU, master thesis, XeTeX/LaTeX template}
%TC:endignore
diff --git a/tex/intro.tex b/tex/intro.tex
index 14a062ea..2edfb58c 100644
--- a/tex/intro.tex
+++ b/tex/intro.tex
@@ -60,29 +60,29 @@ \subsection{编译模板}
模板默认使用GNUMake构建,GNUMake将调用latemk工具自动完成模板多轮编译:
-\begin{lstlisting}[basicstyle=\small\ttfamily, caption={编译模板}, numbers=none]
+\begin{codeblock}[sh]
make clean thesis.pdf
-\end{lstlisting}
+\end{codeblock}
若需要生成包含“原创性声明扫描件”的学位论文文档,请将扫描件保存为statement.pdf,然后调用make生成submit.pdf。
-\begin{lstlisting}[basicstyle=\small\ttfamily, caption={生成用于提交的学位论文}, numbers=none]
+\begin{codeblock}[sh]
make clean submit.pdf
-\end{lstlisting}
+\end{codeblock}
编译失败时,可以尝试手动逐次编译,定位故障。
-\begin{lstlisting}[basicstyle=\small\ttfamily, caption={手动逐次编译}, numbers=none]
+\begin{codeblock}[sh]
xelatex -no-pdf thesis
biber --debug thesis
xelatex thesis
xelatex thesis
-\end{lstlisting}
+\end{codeblock}
\subsection{模板文件布局}
\label{sec:layout}
-\begin{lstlisting}[basicstyle=\small\ttfamily,caption={模板文件布局},label=layout,float,numbers=none]
+\begin{codeblock}
├── LICENSE
├── Makefile
├── README.md
@@ -118,7 +118,7 @@ \subsection{模板文件布局}
│ ├── pub.tex
│ └── symbol.tex
└── thesis.tex
-\end{lstlisting}
+\end{codeblock}
本节介绍学位论文模板中木要文件和目录的功能。
diff --git a/tex/patents.tex b/tex/patents.tex
index c741a6b7..e92e881d 100644
--- a/tex/patents.tex
+++ b/tex/patents.tex
@@ -3,7 +3,7 @@
% !TEX root = ../thesis.tex
% !TEX encoding = UTF-8 Unicode
%TC:ignore
-\begin{patents}{99}
+\begin{patents}[99]
\item 第一发明人,“永动机”,专利申请号202510149890.0
\end{patents}
%TC:endignore
diff --git a/tex/projects.tex b/tex/projects.tex
index ceed30fe..dc4f1b43 100644
--- a/tex/projects.tex
+++ b/tex/projects.tex
@@ -7,7 +7,7 @@
%% Encoding: UTF-8
%%==================================================
%TC:ignore
-\begin{projects}{99}
+\begin{projects}[99]
\item 973项目“XXX”
\item 自然基金项目“XXX”
\item 国防项目“XXX”
diff --git a/tex/projectsreview.tex b/tex/projectsreview.tex
index 9657f58d..36b3ad31 100644
--- a/tex/projectsreview.tex
+++ b/tex/projectsreview.tex
@@ -3,7 +3,7 @@
% !TEX root = ../thesis.tex
% !TEX encoding = UTF-8 Unicode
%TC:ignore
-\begin{projects}{99}
+\begin{projects}[99]
\item 参与973项目子课题(2007年6月--2008年5月)
\item 参与自然基金项目(2005年5月--2005年8月)
\item 参与国防项目(2005年8月--2005年10月)
diff --git a/tex/pub.tex b/tex/pub.tex
index 14a0a2d2..b5af5be8 100644
--- a/tex/pub.tex
+++ b/tex/pub.tex
@@ -7,7 +7,7 @@
%% Encoding: UTF-8
%%==================================================
%TC:ignore
-\begin{publications}{99}
+\begin{publications}[99]
\item\textsc{Chen H, Chan C~T}. {Acoustic cloaking in three dimensions using acoustic metamaterials}[J]. Applied Physics Letters, 2007, 91:183518.
\item\textsc{Chen H, Wu B~I, Zhang B}, et al. {Electromagnetic Wave Interactions with a Metamaterial Cloak}[J]. Physical Review Letters, 2007, 99(6):63903.
\end{publications}
diff --git a/tex/pubreview.tex b/tex/pubreview.tex
index ed5da068..f46a7044 100644
--- a/tex/pubreview.tex
+++ b/tex/pubreview.tex
@@ -3,7 +3,7 @@
% !TEX root = ../thesis.tex
% !TEX encoding = UTF-8 Unicode
%TC:ignore
-\begin{publications}{99}
+\begin{publications}[99]
\item\textsc{第一作者}. {中文核心期刊论文}, 2007.
\item\textsc{第一作者}. {EI国际会议论文}, 2006.
\end{publications}
diff --git a/tex/resume.tex b/tex/resume.tex
index 97011d09..4a505678 100644
--- a/tex/resume.tex
+++ b/tex/resume.tex
@@ -1,22 +1,22 @@
%TC:ignore
\begin{resume}
- \begin{resumesection}{基本情况}
+ \subsection*{基本情况}
某某,yyyy 年 mm 月生于 xxxx。
- \end{resumesection}
- \begin{resumelist}{教育背景}
+ \subsection*{教育背景}
+ \begin{itemize}
\item yyyy 年 mm 月至今,上海交通大学,博士研究生,xx 专业
\item yyyy 年 mm 月至 yyyy 年 mm 月,上海交通大学,硕士研究生,xx 专业
\item yyyy 年 mm 月至 yyyy 年 mm 月,上海交通大学,本科,xx 专业
- \end{resumelist}
+ \end{itemize}
- \begin{resumesection}{研究兴趣}
+ \subsection*{研究兴趣}
\LaTeX{} 排版
- \end{resumesection}
- \begin{resumelist}{联系方式}
+ \subsection*{联系方式}
+ \begin{itemize}
\item 地址: 上海市闵行区东川路 800 号,200240
\item E-mail: \email{xxx@sjtu.edu.cn}
- \end{resumelist}
+ \end{itemize}
\end{resume}
%TC:endignore
diff --git a/tex/symbol.tex b/tex/symbol.tex
index c860673f..f6f43bdc 100644
--- a/tex/symbol.tex
+++ b/tex/symbol.tex
@@ -3,10 +3,8 @@
% !TEX root = ../thesis.tex
% !TEX encoding = UTF-8 Unicode
%TC:ignore
-\begin{nomenclaturename}
+\begin{nomenclature}{rl}
\label{chap:symb}
-
-\begin{longtable}{rl}
$\epsilon$ & 介电常数 \\
$\mu$ & 磁导率 \\
$\epsilon$ & 介电常数 \\
@@ -61,7 +59,5 @@
$\mu$ & 磁导率 \\
$\epsilon$ & 介电常数 \\
$\mu$ & 磁导率 \\
-\end{longtable}
-
-\end{nomenclaturename}
+\end{nomenclature}
%TC:endignore
diff --git a/thesis.tex b/thesis.tex
index 801e1340..91b02ce1 100644
--- a/thesis.tex
+++ b/thesis.tex
@@ -1,88 +1,66 @@
-%# -*- coding: utf-8-unix -*-
-%%==================================================
-%% thesis.tex
-%%==================================================
-
-% 双面打印
-\documentclass[doctor, openright, twoside]{sjtuthesis}
-% \documentclass[bachelor, openany, oneside, submit]{sjtuthesis}
-% \documentclass[master, review]{sjtuthesis}
-% \documentclass[%
-% bachelor|master|doctor|coursepaper, % 必选项,分别是学士,硕士,博士学位论文以及课程论文
-% fontset=fandol|windows|mac|ubuntu|adobe|founder, % 字体选项
-% oneside|twoside, % 单面打印,双面打印(奇偶页交换页边距,默认)
-% openany|openright, % 可以在奇数或者偶数页开新章|只在奇数页开新章(默认)
-% english, % 启用英文模版
-% review, % 盲审论文,隐去作者姓名、学号、导师姓名、致谢、发表论文和参与的项目
-% submit % 定稿提交的论文,插入签名扫描版的原创性声明、授权声明
-% ]
-
-% 逐个导入参考文献数据库
+% 设置 biblatex 额外选项
+% \PassOptionsToPackage{gbpub=false, gbtype=false}{biblatex}
+
+% 载入 SJTUThesis 模版
+% \documentclass[degree=doctor, zihao=-4, language=english, review]{sjtuthesis}
+\documentclass[degree=master, zihao=-4]{sjtuthesis}
+% \documentclass[degree=bachelor, openany, oneside]{sjtuthesis}
+% \documentclass[degree=course, language=english, openright, twoside]{sjtuthesis}
+% 选项
+% degree=[doctor|master|bachelor|course], % 必选,学位类型
+% language=[chinese|english], % 可选(默认:chinese),论文的主要语言
+% bibstyle=[gb7714-2015|gb7714-2015ay|ieee], % 可选(默认:gb7714-2015),参考文献样式
+% review, % 可选(默认:关闭),盲审模式
+
+% 所有其它可能用到的包都统一放到这里了,可以根据自己的实际添加或者删除。
+\usepackage{sjtuthesis}
+
+% 导入参考文献数据库
\addbibresource{bib/thesis.bib}
% \addbibresource{bib/chap2.bib}
-\input{tex/id} % NOTE: the enclosed commands must be executed in preamble
+% 信息录入,必须在导言区进行!
+\input{tex/id}
+
+% 自定义项目标签名称
+% \sjtuSetLabel{
+% listfigure = {图\quad 录},
+% listtable = {表\quad 录}
+% }
\begin{document}
% 无编号内容:中英文论文封面、授权页
\maketitle
-\makeatletter
-
-\ifsjtu@coursepaper
-% 摘要 部分课程论文需要,可以自行选择添加或者去除
-% \include{tex/abstract}
-
-% 目录 部分课程论文需要,可以自行选择添加或者去除
-% \tableofcontents
-
-\else
- \ifsjtu@submit\relax
- \includepdf{pdf/original.pdf}
- \cleardoublepage
- \includepdf{pdf/authorization.pdf}
- \cleardoublepage
- \else
- \ifsjtu@review\relax
- % exclude the original claim and authorization
- \else
- \makeDeclareOriginal
- \makeDeclareAuthorization
- \fi
- \fi
- \frontmatter % 使用罗马数字对前言编号
-
- % 摘要
- \include{tex/abstract}
-
- % 目录、插图目录、表格目录
- \tableofcontents
- \listoffigures
- \addcontentsline{toc}{chapter}{\listfigurename} % 将插图目录加入全文目录
- \listoftables
- \addcontentsline{toc}{chapter}{\listtablename} % 将表格目录加入全文目录
- \listofalgorithms
- \addcontentsline{toc}{chapter}{\listalgorithmname} % 将算法目录加入全文目录
-
- \include{tex/symbol} % 主要符号、缩略词对照表
-\fi
-
-\makeatother
-\mainmatter % 使用阿拉伯数字对正文编号
+\makeDeclareOriginality[pdf/original.pdf]
+\makeDeclareAuthorization
+
+% 使用罗马数字对前言编号
+\frontmatter
+
+% 摘要
+\include{tex/abstract}
+
+% 目录、插图目录、表格目录
+\tableofcontents
+\listoffigures
+\listoftables
+\listofalgorithms
+
+\include{tex/symbol} % 主要符号、缩略词对照表
+
+% 使用阿拉伯数字对正文编号
+\mainmatter
% 正文内容
-\include{tex/intro}
\include{tex/example}
-\include{tex/faq}
\include{tex/summary}
-\appendix % 使用英文字母对附录编号
+% 使用英文字母对附录编号
+\appendix
% 附录内容,本科学位论文可以用翻译的文献替代。
-\include{tex/app_setup}
\include{tex/app_eq}
-\include{tex/app_cjk}
-\include{tex/app_log}
\backmatter % 文后无编号部分
@@ -91,39 +69,16 @@
% 致谢、发表论文、申请专利、参与项目、简历
% 用于盲审的论文需隐去致谢、发表论文、申请专利、参与的项目
-\makeatletter
-
-\ifsjtu@coursepaper
-\else
-
- % "研究生学位论文送盲审印刷格式的统一要求"
- % http://www.gs.sjtu.edu.cn/inform/3/2015/20151120_123928_738.htm
-
- % 盲审删去删去致谢页
- \ifsjtu@review\relax\else
- \include{tex/ack} % 致谢
- \fi
-
- \ifsjtu@bachelor
- \ifsjtu@english
- \else
- % 中文学士学位论文要求在最后有一个英文大摘要,单独编页码,英文学士学位论文不需要
- \include{tex/end_english_abstract}
- \fi
- \else
- % 盲审论文中,发表学术论文及参与科研情况等仅以第几作者注明即可,不要出现作者或他人姓名
- \ifsjtu@review\relax
- \include{tex/pubreview}
- \include{tex/projectsreview}
- \else
- \include{tex/pub} % 发表论文
- \include{tex/projects} % 参与的项目
- % \include{tex/patents} % 申请专利
- \include{tex/resume} % 个人简历
- \fi
- \fi
-\fi
-
-\makeatother
+
+\include{tex/ack} % 致谢
+
+% 中文学士学位论文要求在最后有一个英文大摘要,单独编页码,英文学士学位论文不需要
+\include{tex/end_english_abstract}
+
+% 盲审论文中,发表学术论文及参与科研情况等仅以第几作者注明即可,不要出现作者或他人姓名
+\include{tex/pub} % 发表论文
+\include{tex/projects} % 参与的项目
+\include{tex/patents} % 申请专利
+\include{tex/resume} % 个人简历
\end{document}