├── sjtutex ├── testfiles │ ├── support │ │ ├── common-digest.tex │ │ ├── common-acknowledgements-de.tex │ │ ├── common-acknowledgements-en.tex │ │ ├── common-acknowledgements-zh.tex │ │ ├── common-acknowledgements-ja.tex │ │ ├── common-abstract-zh.tex │ │ ├── common-abstract-ja.tex │ │ ├── common-abstract-en.tex │ │ ├── common-abstract-de.tex │ │ ├── common-achievements-en.tex │ │ ├── common-achievements-de.tex │ │ ├── common-achievements-ja.tex │ │ ├── common-achievements-zh.tex │ │ ├── common-package.tex │ │ ├── common-nomenclature-ja.tex │ │ ├── common-nomenclature-zh.tex │ │ ├── ref.bib │ │ ├── common-setup-thesis.tex │ │ ├── common-nomenclature-en.tex │ │ ├── common-nomenclature-de.tex │ │ ├── common-mainmatter-ja.tex │ │ ├── common-mainmatter-zh.tex │ │ ├── common-mainmatter-de.tex │ │ └── common-mainmatter-en.tex │ ├── sample-report-zh.tlg │ ├── sample-thesis-de.tlg │ ├── sample-thesis-en.tlg │ ├── sample-thesis-ja.tlg │ ├── sample-thesis-zh.tlg │ ├── sample-article-zh.tlg │ ├── sample-report-zh.tex │ ├── sample-article-zh.tex │ ├── sample-thesis-en.tex │ ├── sample-thesis-zh.tex │ ├── sample-thesis-ja.tex │ └── sample-thesis-de.tex ├── source │ └── vi │ │ ├── sjtu-vi-badge-cor-red.pdf │ │ ├── sjtu-vi-badge-reg-red.pdf │ │ ├── sjtu-vi-logo-eng-h-cor-red.pdf │ │ ├── sjtu-vi-logo-eng-h-reg-red.pdf │ │ ├── sjtu-vi-logo-std-c-cor-red.pdf │ │ ├── sjtu-vi-logo-std-c-reg-red.pdf │ │ ├── sjtu-vi-logo-std-h-cor-red.pdf │ │ ├── sjtu-vi-logo-std-h-reg-red.pdf │ │ ├── sjtu-vi-logo-std-v-cor-red.pdf │ │ └── sjtu-vi-logo-std-v-reg-red.pdf ├── README.md ├── build.lua ├── CHANGELOG.md └── support │ └── ctxdoc.cls ├── .editorconfig ├── Makefile ├── .gitignore ├── support └── sjtu-vi-gen.tex ├── .github └── workflows │ ├── release.yml │ └── build.yml ├── README.md └── LICENSE /sjtutex/testfiles/support/common-digest.tex: -------------------------------------------------------------------------------- 1 | \begin{digest} 2 | \lipsum[11] 3 | \end{digest} -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-acknowledgements-de.tex: -------------------------------------------------------------------------------- 1 | \begin{acknowledgements} 2 | \blindtext[11] 3 | \end{acknowledgements} -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-acknowledgements-en.tex: -------------------------------------------------------------------------------- 1 | \begin{acknowledgements} 2 | \lipsum[9-10] 3 | \end{acknowledgements} -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-acknowledgements-zh.tex: -------------------------------------------------------------------------------- 1 | \begin{acknowledgements} 2 | \zhlipsum[9-10] 3 | \end{acknowledgements} -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-badge-cor-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-badge-cor-red.pdf -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-badge-reg-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-badge-reg-red.pdf -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-acknowledgements-ja.tex: -------------------------------------------------------------------------------- 1 | \begin{acknowledgements} 2 | \jalipsum[9-10]{kusamakura} 3 | \end{acknowledgements} -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-logo-eng-h-cor-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-logo-eng-h-cor-red.pdf -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-logo-eng-h-reg-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-logo-eng-h-reg-red.pdf -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-logo-std-c-cor-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-logo-std-c-cor-red.pdf -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-logo-std-c-reg-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-logo-std-c-reg-red.pdf -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-logo-std-h-cor-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-logo-std-h-cor-red.pdf -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-logo-std-h-reg-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-logo-std-h-reg-red.pdf -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-logo-std-v-cor-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-logo-std-v-cor-red.pdf -------------------------------------------------------------------------------- /sjtutex/source/vi/sjtu-vi-logo-std-v-reg-red.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjtug/SJTUTeX/HEAD/sjtutex/source/vi/sjtu-vi-logo-std-v-reg-red.pdf -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-abstract-zh.tex: -------------------------------------------------------------------------------- 1 | 学位论文是本科生从事科研工作的成果的主要表现,集中表明了作者在研究工作中获得的 2 | 新的发明、理论或见解,也是科研领域中的重要文献资料和社会的宝贵财富。 3 | 4 | 为了提高本科生学位论文的质量,做到学位论文在内容和格式上的规范化与统一化,特制 5 | 作本模板。 6 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-abstract-ja.tex: -------------------------------------------------------------------------------- 1 | 学位論文は大学生が科学研究の成果をアピールする主要な形式である。 2 | 研究の中で得られた新しい発明や理論、見解を集中的に示すもので、 3 | 研究分野における重要な文献資料及び社会の貴重な財産ともなる。 4 | 5 | 学生の学位論文の品質を高め、学位論文の内容や形式上の規範化及び 6 | 統一化を実現するために、本見本を制作することに至った。 7 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-report-zh.tlg: -------------------------------------------------------------------------------- 1 | *************** 2 | Compilation 1 of test file completed with exit status 0 3 | Compilation 2 of test file completed with exit status 0 4 | Compilation 3 of test file completed with exit status 0 5 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-thesis-de.tlg: -------------------------------------------------------------------------------- 1 | *************** 2 | Compilation 1 of test file completed with exit status 0 3 | Compilation 2 of test file completed with exit status 0 4 | Compilation 3 of test file completed with exit status 0 5 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-thesis-en.tlg: -------------------------------------------------------------------------------- 1 | *************** 2 | Compilation 1 of test file completed with exit status 0 3 | Compilation 2 of test file completed with exit status 0 4 | Compilation 3 of test file completed with exit status 0 5 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-thesis-ja.tlg: -------------------------------------------------------------------------------- 1 | *************** 2 | Compilation 1 of test file completed with exit status 0 3 | Compilation 2 of test file completed with exit status 0 4 | Compilation 3 of test file completed with exit status 0 5 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-thesis-zh.tlg: -------------------------------------------------------------------------------- 1 | *************** 2 | Compilation 1 of test file completed with exit status 0 3 | Compilation 2 of test file completed with exit status 0 4 | Compilation 3 of test file completed with exit status 0 5 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-article-zh.tlg: -------------------------------------------------------------------------------- 1 | *************** 2 | Compilation 1 of test file completed with exit status 0 3 | Compilation 2 of test file completed with exit status 0 4 | Compilation 3 of test file completed with exit status 0 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [{*.bat,*.cmd}] 15 | indent_style = tab 16 | indent_size = 4 17 | end_of_line = crlf 18 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-abstract-en.tex: -------------------------------------------------------------------------------- 1 | As a primary means of demonstrating research findings for undergraduate 2 | students, dissertation is a systematic and standardized record of the new 3 | inventions, theories or insights obtained by the author in the research work. 4 | It can not only function as an important reference when students pursue further 5 | studies, but also contribute to scientific research and social development. 6 | 7 | This template is therefore made to improve the quality of undergraduates' 8 | dissertation and to further standardize it both in content and in format. 9 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-abstract-de.tex: -------------------------------------------------------------------------------- 1 | Als prim\"ares Mittel zur Darstellung von Forschungsergebnissen f\"ur 2 | Bachelor-Studenten ist die Dissertation ein systematischer und standardisierter 3 | Bericht \"uber neue Erfindungen, Theorien oder Erkenntnisse, die der Autor in 4 | seiner Forschungsarbeit gewonnen hat. Sie kann nicht nur als wichtige Referenz 5 | dienen, wenn Studenten weitere Studien betreiben, sondern auch zur 6 | wissenschaftlichen Forschung und gesellschaftlichen Entwicklung beitragen. 7 | 8 | Dieses Template wurde daher erstellt, um die Qualit\"at der 9 | Bachelor-Dissertationen zu verbessern und sowohl den Inhalt als auch das 10 | Format weiter zu standardisieren. -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-report-zh.tex: -------------------------------------------------------------------------------- 1 | \documentclass{sjtureport} 2 | 3 | \input{common-package} 4 | \usepackage{zhlipsum} 5 | \usepackage[backend=biber,style=gb7714-2015]{biblatex} 6 | \addbibresource{ref.bib} 7 | 8 | % 标题 9 | \title{上海交通大学 \LaTeX{} 文稿模板示例文档} 10 | % 作者 11 | \author{某\quad{}某} 12 | % 主题 13 | \subject{XX期末课程论文} 14 | % 关键词 15 | \keywords{上海交大, 饮水思源, 爱国荣校} 16 | 17 | \begin{document} 18 | 19 | % 标题页 20 | \maketitle 21 | 22 | % 摘要 23 | \begin{abstract} 24 | \input{common-abstract-zh.tex} 25 | \end{abstract} 26 | 27 | % 目录 28 | \tableofcontents 29 | 30 | \input{common-mainmatter-zh} 31 | 32 | % 参考文献 33 | \nocite{*} 34 | \printbibliography[heading=bibintoc] 35 | 36 | \end{document} 37 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # ---------------- 2 | # User commands 3 | # ---------------- 4 | 5 | SOURCE_DIR=sjtutex 6 | 7 | all: build-ctan 8 | 9 | # Clean all temporary files and generated files 10 | clean: 11 | cd $(SOURCE_DIR) && l3build clean 12 | git clean -dfX 13 | 14 | # Build sjtutex package 15 | build-ctan: 16 | cd $(SOURCE_DIR) && l3build ctan 17 | 18 | build: 19 | cd $(SOURCE_DIR) && l3build doc 20 | 21 | test: 22 | cd $(SOURCE_DIR) && l3build check 23 | 24 | # For TeX Live/MacTeX users to install the package 25 | install: 26 | cd $(SOURCE_DIR) && l3build install 27 | 28 | # Generate `.sty` files and copy resources 29 | generate: 30 | cd $(SOURCE_DIR) && l3build unpack && cd .. 31 | 32 | .PHONY: build test build-ctan install clean generate 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Core latex/pdflatex auxiliary files: 2 | *.aux 3 | *.lof 4 | *.log 5 | *.lot 6 | *.fls 7 | *.out 8 | *.toc 9 | *.fmt 10 | *.fot 11 | *.cb 12 | *.cb2 13 | .*.lb 14 | 15 | # TikZ & PGF 16 | *.dpth 17 | *.md5 18 | *.auxlock 19 | 20 | ## Build tool auxiliary files: 21 | *.fdb_latexmk 22 | *.synctex 23 | *.synctex(busy) 24 | *.synctex.gz 25 | *.synctex.gz(busy) 26 | *.pdfsync 27 | *.rubbercache 28 | rubber.cache 29 | 30 | ## Project 31 | 32 | # `l3build` generated files 33 | build/ 34 | *.zip 35 | 36 | # sjtutex 37 | sjtutex/*.pdf 38 | sjtutex/support/*.id 39 | 40 | # support 41 | support/*.pdf 42 | 43 | ## Editors 44 | 45 | # VSCode 46 | .vscode/ 47 | 48 | ## System 49 | 50 | # macOS 51 | .DS_Store 52 | ._* 53 | 54 | # Windows 55 | Thumbs.db 56 | [Dd]esktop.ini 57 | -------------------------------------------------------------------------------- /support/sjtu-vi-gen.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \usepackage{sjtuvi} 3 | \usetikzlibrary{external} 4 | \tikzexternalize[prefix=sjtu-vi-] 5 | \begin{document} 6 | \tikzsetnextfilename{badge-reg-red} \SJTUBadge 7 | \tikzsetnextfilename{badge-cor-red} \SJTUBadge* 8 | \tikzsetnextfilename{logo-std-h-reg-red} \SJTULogoStdH 9 | \tikzsetnextfilename{logo-std-h-cor-red} \SJTULogoStdH* 10 | \tikzsetnextfilename{logo-eng-h-reg-red} \SJTULogoEngH 11 | \tikzsetnextfilename{logo-eng-h-cor-red} \SJTULogoEngH* 12 | \tikzsetnextfilename{logo-std-c-reg-red} \SJTULogoStdC 13 | \tikzsetnextfilename{logo-std-c-cor-red} \SJTULogoStdC* 14 | \tikzsetnextfilename{logo-std-v-reg-red} \SJTULogoStdV 15 | \tikzsetnextfilename{logo-std-v-cor-red} \SJTULogoStdV* 16 | \end{document} 17 | \endinput 18 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-achievements-en.tex: -------------------------------------------------------------------------------- 1 | \begin{achievements} 2 | 3 | \subsection*{Thesis} 4 | 5 | \begin{bibliolist}{00} 6 | \item Chen H, Chan C~T. Acoustic cloaking in three dimensions using acoustic metamaterials[J]. Applied Physics Letters, 2007, 91:183518. 7 | \item Chen H, Wu B~I, Zhang B, et al. Electromagnetic Wave Interactions with a Metamaterial Cloak[J]. Physical Review Letters, 2007, 99(6):63903. 8 | \end{bibliolist} 9 | 10 | \begin{bibliolist*}{00} 11 | \item First Author. CCF-A thesis, 2007. 12 | \item First Author. EI thesis, 2006. 13 | \end{bibliolist*} 14 | 15 | \subsection*{Patent} 16 | 17 | \begin{bibliolist}{00} 18 | \item ... 19 | \end{bibliolist} 20 | 21 | \begin{bibliolist*}{00} 22 | \item ... 23 | \end{bibliolist*} 24 | 25 | \end{achievements} 26 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-achievements-de.tex: -------------------------------------------------------------------------------- 1 | \begin{achievements} 2 | 3 | \subsection*{These} 4 | 5 | \begin{bibliolist}{} 6 | \item Chen H, Chan C~T. Acoustic cloaking in three dimensions using acoustic metamaterials. \textit{Applied Physics Letters}, vol. 91, 2007, p.183518. 7 | \item Chen H, Wu B~I, Zhang B, et al. Electromagnetic Wave Interactions with a Metamaterial Cloak. \textit{Physical Review Letters}, vol. 99, no. 6, 2007, p. 63903. 8 | \end{bibliolist} 9 | 10 | \begin{bibliolist*}{} 11 | \item Erster autor. These, 2007. 12 | \item Erster autor. These, 2006. 13 | \end{bibliolist*} 14 | 15 | \subsection*{Patent} 16 | 17 | \begin{bibliolist}{} 18 | \item ... 19 | \end{bibliolist} 20 | 21 | \begin{bibliolist*}{} 22 | \item ... 23 | \end{bibliolist*} 24 | 25 | \end{achievements} 26 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-achievements-ja.tex: -------------------------------------------------------------------------------- 1 | \begin{achievements} 2 | 3 | \subsection*{学術論文} 4 | 5 | \begin{bibliolist}{00} 6 | \item Chen H, Chan C~T. Acoustic cloaking in three dimensions using acoustic metamaterials[J]. Applied Physics Letters, 2007, 91:183518. 7 | \item Chen H, Wu B~I, Zhang B, et al. Electromagnetic Wave Interactions with a Metamaterial Cloak[J]. Physical Review Letters, 2007, 99(6):63903. 8 | \end{bibliolist} 9 | 10 | \begin{bibliolist*}{00} 11 | \item 著者. 学術論文, 2007. 12 | \item 著者. 国際会議論文, 2006. 13 | \end{bibliolist*} 14 | 15 | \subsection*{特許} 16 | 17 | \begin{bibliolist}{00} 18 | \item 発明者,“永久機関”,No. 202510149890.0 19 | \end{bibliolist} 20 | 21 | \begin{bibliolist*}{00} 22 | \item 発明者,“永久機関”,No. XXXXXXXXXXXX.X 23 | \end{bibliolist*} 24 | 25 | \end{achievements} 26 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-achievements-zh.tex: -------------------------------------------------------------------------------- 1 | \begin{achievements} 2 | 3 | \subsection*{学术论文} 4 | 5 | \begin{bibliolist}{00} 6 | \item Chen H, Chan C~T. Acoustic cloaking in three dimensions using acoustic metamaterials[J]. Applied Physics Letters, 2007, 91:183518. 7 | \item Chen H, Wu B~I, Zhang B, et al. Electromagnetic Wave Interactions with a Metamaterial Cloak[J]. Physical Review Letters, 2007, 99(6):63903. 8 | \end{bibliolist} 9 | 10 | \begin{bibliolist*}{00} 11 | \item 第一作者. 中文核心期刊论文, 2007. 12 | \item 第一作者. EI 国际会议论文, 2006. 13 | \end{bibliolist*} 14 | 15 | \subsection*{专利} 16 | 17 | \begin{bibliolist}{00} 18 | \item 第一发明人,“永动机”,专利申请号202510149890.0 19 | \end{bibliolist} 20 | 21 | \begin{bibliolist*}{00} 22 | \item 第一发明人,“永动机”,专利申请号XXXXXXXXXXXX.X 23 | \end{bibliolist*} 24 | 25 | \end{achievements} 26 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*" 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | release: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | - name: Build 18 | uses: xu-cheng/texlive-action@v2 19 | with: 20 | scheme: full 21 | run: | 22 | apk add zip diffutils font-noto-cjk 23 | git config --global --add safe.directory "${GITHUB_WORKSPACE}" 24 | cd sjtutex && l3build ctan 25 | - name: Release 26 | uses: softprops/action-gh-release@v2 27 | with: 28 | body: ${{ github.event.head_commit.message }} 29 | draft: true 30 | files: | 31 | sjtutex/sjtutex.pdf 32 | sjtutex/sjtutex-ctan.zip 33 | sjtutex/sjtutex.tds.zip 34 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-article-zh.tex: -------------------------------------------------------------------------------- 1 | \documentclass{sjtuarticle} 2 | 3 | \input{common-package} 4 | \usepackage{zhlipsum} 5 | \usepackage[backend=biber,style=gb7714-2015]{biblatex} 6 | \addbibresource{ref.bib} 7 | 8 | % 标题 9 | \title{上海交通大学 \LaTeX{} 文稿模板示例文档} 10 | % 作者 11 | \author{某\quad{}某} 12 | % 主题 13 | \subject{XX期末课程论文} 14 | % 关键词 15 | \keywords{上海交大, 饮水思源, 爱国荣校} 16 | 17 | \begin{document} 18 | 19 | % 标题块 20 | \maketitle 21 | 22 | % 摘要 23 | \begin{abstract} 24 | \zhlipsum[1] 25 | \end{abstract} 26 | 27 | \section{简介} 28 | 29 | \zhlipsum[2] 30 | 31 | \section{相关工作} 32 | 33 | \zhlipsum[3] 34 | 35 | \section{主要方法} 36 | 37 | \zhlipsum[4-5] 38 | 39 | \begin{equation} 40 | \int_{a}^b f(x)\,\mathrm{d}x=\lim_{|P|\rightarrow 0}\sum_{i=1}^n f(\xi_i)\increment x_i 41 | \end{equation} 42 | 43 | \section{测试结果} 44 | 45 | \zhlipsum[6] 46 | 47 | \section{结论} 48 | 49 | \zhlipsum[7] 50 | 51 | % 参考文献 52 | \nocite{*} 53 | \printbibliography[heading=bibintoc] 54 | 55 | \end{document} 56 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - v2 7 | pull_request: 8 | branches: 9 | - v2 10 | workflow_dispatch: 11 | branches: 12 | - v2 13 | 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v4 20 | - name: Build 21 | uses: xu-cheng/texlive-action@v2 22 | with: 23 | scheme: full 24 | run: | 25 | apk add zip diffutils font-noto-cjk 26 | git config --global --add safe.directory "${GITHUB_WORKSPACE}" 27 | cd sjtutex && l3build ctan && rm build/distrib/tds/sjtutex.tds.zip 28 | - name: Upload TDS 29 | uses: actions/upload-artifact@v4 30 | with: 31 | name: sjtutex.tds 32 | path: sjtutex/build/distrib/tds/ 33 | - name: Upload samples 34 | uses: actions/upload-artifact@v4 35 | with: 36 | name: samples 37 | path: sjtutex/build/result/ 38 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-package.tex: -------------------------------------------------------------------------------- 1 | \usepackage{lipsum} 2 | \usepackage[perpage,bottom,hang]{footmisc} 3 | \usepackage{xcolor} 4 | \usepackage{booktabs} 5 | \usepackage{longtable} 6 | \usepackage{threeparttable} 7 | \usepackage{threeparttablex} 8 | \usepackage[ruled,vlined,linesnumbered]{algorithm2e} 9 | \usepackage{listings} 10 | \lstdefinestyle{lstStyleCode}{% 11 | aboveskip = \medskipamount, 12 | belowskip = \medskipamount, 13 | basicstyle = \ttfamily\zihao{6}, 14 | commentstyle = \slshape\color{black!60}, 15 | stringstyle = \color{green!40!black!100}, 16 | keywordstyle = \bfseries\color{blue!50!black}, 17 | extendedchars = false, 18 | upquote = true, 19 | tabsize = 2, 20 | showstringspaces = false, 21 | xleftmargin = 1em, 22 | xrightmargin = 1em, 23 | breaklines = false, 24 | framexleftmargin = 1em, 25 | framexrightmargin = 1em, 26 | backgroundcolor = \color{gray!10}, 27 | columns = flexible, 28 | keepspaces = true, 29 | texcl = true, 30 | mathescape = true 31 | } 32 | \lstnewenvironment{codeblock}[1][]{% 33 | \lstset{style=lstStyleCode,#1}}{} 34 | \usepackage{hyperref} 35 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-thesis-en.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | 3 | % 载入 SJTUThesis 模版 4 | \documentclass[type=master,lang=en]{sjtuthesis} 5 | 6 | \input{common-package} 7 | \input{common-setup-thesis} 8 | \usepackage[backend=biber,style=gb7714-2015]{biblatex} 9 | \addbibresource{ref.bib} 10 | 11 | \begin{document} 12 | 13 | % 标题页 14 | \maketitle 15 | 16 | % 原创性声明及使用授权书 17 | \copyrightpage 18 | 19 | % 前置部分 20 | \frontmatter 21 | 22 | \begin{abstract}[lang=zh] 23 | \input{common-abstract-zh.tex} 24 | \end{abstract} 25 | 26 | \begin{abstract}[lang=en] 27 | \input{common-abstract-en.tex} 28 | \end{abstract} 29 | 30 | 31 | % 目录 32 | \tableofcontents 33 | % 插图索引 34 | \listoffigures 35 | % 表格索引 36 | \listoftables 37 | % 算法索引 38 | % \listofalgorithms 39 | 40 | % 主体部分 41 | \mainmatter 42 | 43 | \input{common-mainmatter-en} 44 | 45 | % 参考文献 46 | \nocite{*} 47 | \printbibliography[heading=bibintoc] 48 | 49 | % 附录 50 | \appendix 51 | 52 | % 附录中图表不加入索引 53 | \captionsetup{list=no} 54 | 55 | \input{common-nomenclature-en} 56 | 57 | % 结尾部分 58 | \backmatter 59 | 60 | % 用于盲审的论文需隐去致谢、发表论文、科研成果、简历 61 | 62 | \input{common-achievements-en} 63 | 64 | \input{common-acknowledgements-en} 65 | 66 | \input{common-digest} 67 | 68 | \end{document} 69 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-thesis-zh.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | 3 | % 载入 SJTUThesis 模版 4 | \documentclass[type=master,lang=zh]{sjtuthesis} 5 | 6 | \input{common-package} 7 | \usepackage{zhlipsum} 8 | \input{common-setup-thesis} 9 | \usepackage[backend=biber,style=gb7714-2015]{biblatex} 10 | \addbibresource{ref.bib} 11 | 12 | \begin{document} 13 | 14 | % 标题页 15 | \maketitle 16 | 17 | % 原创性声明及使用授权书 18 | \copyrightpage 19 | 20 | % 前置部分 21 | \frontmatter 22 | 23 | \begin{abstract}[lang=zh] 24 | \input{common-abstract-zh.tex} 25 | \end{abstract} 26 | 27 | \begin{abstract}[lang=en] 28 | \input{common-abstract-en.tex} 29 | \end{abstract} 30 | 31 | % 目录 32 | \tableofcontents 33 | % 插图索引 34 | \listoffigures 35 | % 表格索引 36 | \listoftables 37 | % 算法索引 38 | % \listofalgorithms 39 | 40 | % 主体部分 41 | \mainmatter 42 | 43 | \input{common-mainmatter-zh} 44 | 45 | % 参考文献 46 | \nocite{*} 47 | \printbibliography[heading=bibintoc] 48 | 49 | % 附录 50 | \appendix 51 | 52 | % 附录中图表不加入索引 53 | \captionsetup{list=no} 54 | 55 | \input{common-nomenclature-zh} 56 | 57 | % 结尾部分 58 | \backmatter 59 | 60 | % 用于盲审的论文需隐去致谢、发表论文、科研成果、简历 61 | 62 | \input{common-achievements-zh} 63 | 64 | \input{common-acknowledgements-zh} 65 | 66 | \input{common-digest} 67 | 68 | \end{document} 69 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-nomenclature-ja.tex: -------------------------------------------------------------------------------- 1 | \begin{nomenclature} 2 | 3 | \begin{longtable}{rl} 4 | $\epsilon$ & 誘電率 \\ 5 | $\mu$ & 透過性 \\ 6 | $\epsilon$ & 誘電率 \\ 7 | $\mu$ & 透過性 \\ 8 | $\epsilon$ & 誘電率 \\ 9 | $\mu$ & 透過性 \\ 10 | $\epsilon$ & 誘電率 \\ 11 | $\mu$ & 透過性 \\ 12 | $\epsilon$ & 誘電率 \\ 13 | $\mu$ & 透過性 \\ 14 | $\epsilon$ & 誘電率 \\ 15 | $\mu$ & 透過性 \\ 16 | $\epsilon$ & 誘電率 \\ 17 | $\mu$ & 透過性 \\ 18 | $\epsilon$ & 誘電率 \\ 19 | $\mu$ & 透過性 \\ 20 | $\epsilon$ & 誘電率 \\ 21 | $\mu$ & 透過性 \\ 22 | $\epsilon$ & 誘電率 \\ 23 | $\mu$ & 透過性 \\ 24 | $\epsilon$ & 誘電率 \\ 25 | $\mu$ & 透過性 \\ 26 | $\epsilon$ & 誘電率 \\ 27 | $\mu$ & 透過性 \\ 28 | $\epsilon$ & 誘電率 \\ 29 | $\mu$ & 透過性 \\ 30 | $\epsilon$ & 誘電率 \\ 31 | $\mu$ & 透過性 \\ 32 | $\epsilon$ & 誘電率 \\ 33 | $\mu$ & 透過性 \\ 34 | $\epsilon$ & 誘電率 \\ 35 | $\mu$ & 透過性 \\ 36 | $\epsilon$ & 誘電率 \\ 37 | $\mu$ & 透過性 \\ 38 | $\epsilon$ & 誘電率 \\ 39 | $\mu$ & 透過性 \\ 40 | $\epsilon$ & 誘電率 \\ 41 | $\mu$ & 透過性 \\ 42 | $\epsilon$ & 誘電率 \\ 43 | $\mu$ & 透過性 \\ 44 | $\epsilon$ & 誘電率 \\ 45 | $\mu$ & 透過性 \\ 46 | $\epsilon$ & 誘電率 \\ 47 | $\mu$ & 透過性 \\ 48 | $\epsilon$ & 誘電率 \\ 49 | $\mu$ & 透過性 \\ 50 | $\epsilon$ & 誘電率 \\ 51 | $\mu$ & 透過性 \\ 52 | $\epsilon$ & 誘電率 \\ 53 | $\mu$ & 透過性 \\ 54 | $\epsilon$ & 誘電率 \\ 55 | $\mu$ & 透過性 \\ 56 | $\epsilon$ & 誘電率 \\ 57 | $\mu$ & 透過性 \\ 58 | \end{longtable} 59 | 60 | \end{nomenclature} 61 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-nomenclature-zh.tex: -------------------------------------------------------------------------------- 1 | \begin{nomenclature} 2 | 3 | \begin{longtable}{rl} 4 | $\epsilon$ & 介电常数 \\ 5 | $\mu$ & 磁导率 \\ 6 | $\epsilon$ & 介电常数 \\ 7 | $\mu$ & 磁导率 \\ 8 | $\epsilon$ & 介电常数 \\ 9 | $\mu$ & 磁导率 \\ 10 | $\epsilon$ & 介电常数 \\ 11 | $\mu$ & 磁导率 \\ 12 | $\epsilon$ & 介电常数 \\ 13 | $\mu$ & 磁导率 \\ 14 | $\epsilon$ & 介电常数 \\ 15 | $\mu$ & 磁导率 \\ 16 | $\epsilon$ & 介电常数 \\ 17 | $\mu$ & 磁导率 \\ 18 | $\epsilon$ & 介电常数 \\ 19 | $\mu$ & 磁导率 \\ 20 | $\epsilon$ & 介电常数 \\ 21 | $\mu$ & 磁导率 \\ 22 | $\epsilon$ & 介电常数 \\ 23 | $\mu$ & 磁导率 \\ 24 | $\epsilon$ & 介电常数 \\ 25 | $\mu$ & 磁导率 \\ 26 | $\epsilon$ & 介电常数 \\ 27 | $\mu$ & 磁导率 \\ 28 | $\epsilon$ & 介电常数 \\ 29 | $\mu$ & 磁导率 \\ 30 | $\epsilon$ & 介电常数 \\ 31 | $\mu$ & 磁导率 \\ 32 | $\epsilon$ & 介电常数 \\ 33 | $\mu$ & 磁导率 \\ 34 | $\epsilon$ & 介电常数 \\ 35 | $\mu$ & 磁导率 \\ 36 | $\epsilon$ & 介电常数 \\ 37 | $\mu$ & 磁导率 \\ 38 | $\epsilon$ & 介电常数 \\ 39 | $\mu$ & 磁导率 \\ 40 | $\epsilon$ & 介电常数 \\ 41 | $\mu$ & 磁导率 \\ 42 | $\epsilon$ & 介电常数 \\ 43 | $\mu$ & 磁导率 \\ 44 | $\epsilon$ & 介电常数 \\ 45 | $\mu$ & 磁导率 \\ 46 | $\epsilon$ & 介电常数 \\ 47 | $\mu$ & 磁导率 \\ 48 | $\epsilon$ & 介电常数 \\ 49 | $\mu$ & 磁导率 \\ 50 | $\epsilon$ & 介电常数 \\ 51 | $\mu$ & 磁导率 \\ 52 | $\epsilon$ & 介电常数 \\ 53 | $\mu$ & 磁导率 \\ 54 | $\epsilon$ & 介电常数 \\ 55 | $\mu$ & 磁导率 \\ 56 | $\epsilon$ & 介电常数 \\ 57 | $\mu$ & 磁导率 \\ 58 | \end{longtable} 59 | 60 | \end{nomenclature} 61 | -------------------------------------------------------------------------------- /sjtutex/README.md: -------------------------------------------------------------------------------- 1 | # SJTUTeX 2 | 3 | ## 简介 4 | 5 | SJTUTeX 旨在建立一个简单易用的上海交通大学文档类集,包括学位论文文档类 `sjtuthesis`,以及普通文档类 `sjtuarticle` 和 `sjtureport`。 6 | 7 | 在使用该文档类集之前,请仔细阅读文档 `sjtutex.pdf`。 8 | 9 | 本项目也是 [SJTUThesis](https://github.com/sjtug/SJTUThesis) 项目使用的文档类集,如果遇到使用问题,请前往 [Discussions](https://github.com/sjtug/SJTUThesis/discussions) 提问或提交 [Issues](https://github.com/sjtug/SJTUThesis/issues);如果对文档类有改进建议,也欢迎提交 [Pull Requests](https://github.com/sjtug/SJTUTeX/pulls)。 10 | 11 | ## 软件许可证 12 | 13 | [交大视觉形象系统](https://vi.sjtu.edu.cn)的相关图像资源版权归上海交通大学所有。其他部分使用 [LaTeX Project Public License](http://www.latex-project.org/lppl.txt) 授权。 14 | 15 | --- 16 | 17 | # SJTUTeX 18 | 19 | ## Description 20 | 21 | SJTUTeX aims to establish a simple and easy-to-use collection of document classes for Shanghai Jiao Tong University, including the thesis document class `sjtuthesis`, as well as the regular document classes `sjtuarticle` and `sjtureport`. 22 | 23 | Before using this collection of document classes, please read the document `sjtutex.pdf` carefully. 24 | 25 | This project is also used by the [SJTUThesis](https://github.com/sjtug/SJTUThesis) project. If you encounter any usage problems, please go to [Discussions](https://github.com/sjtug/SJTUThesis/discussions) to ask questions or open [Issues](https://github.com/sjtug/SJTUThesis/issues); if you have any suggestions for improving the document class, you could also submit [Pull Requests](https://github.com/sjtug/SJTUTeX/pulls). 26 | 27 | ## License 28 | 29 | This work may be distributed and/or modified under the 30 | conditions of the [LaTeX Project Public License](https://www.latex-project.org/lppl.txt), either version 1.3c 31 | of this license or (at your option) any later version. 32 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/ref.bib: -------------------------------------------------------------------------------- 1 | @article{Yang1999, 2 | author = {杨瑞林 and 李力军}, 3 | title = {新型低合金高强韧性耐磨钢的研究}, 4 | number = {7}, 5 | pages = {41-45}, 6 | journal = {钢铁}, 7 | year = {1999} 8 | } 9 | 10 | @article{Yu2012, 11 | author = {于潇 and 刘义 and 柴跃廷 and 孙宏波}, 12 | journal = {清华大学学报(自然科学版)}, 13 | number = {11}, 14 | pages = {1518-1523}, 15 | title = {互联网药品可信交易环境中主体资质审核备案模式}, 16 | volume = {52}, 17 | year = {2012} 18 | } 19 | 20 | @article{Schinstock2000, 21 | author = {D.E. Schinstock and J.F. Cuttino}, 22 | title = {Real time kinematic solutions of a non-contacting, three dimensional metrology frame}, 23 | number = {1}, 24 | pages = {70-76}, 25 | volume = {24}, 26 | journal = {Precision Engineering}, 27 | year = {2000} 28 | } 29 | 30 | @book{Wen1990, 31 | author = {温诗铸}, 32 | publisher = {清华大学出版社}, 33 | title = {摩擦学原理}, 34 | year = {1990}, 35 | address = {北京}, 36 | pages = {296-300} 37 | } 38 | 39 | @book{Jiang1998, 40 | author = {蒋有绪 and 郭泉水 and 马娟 and 王兵 and 王丽丽 and 徐庆}, 41 | publisher = {科学出版社}, 42 | title = {中国森林群落分类及其群落学特征}, 43 | year = {1998}, 44 | address = {北京}, 45 | pages = {5-17} 46 | } 47 | 48 | @mastersthesis{Jia2000, 49 | author = {贾名字}, 50 | school = {上海交通大学}, 51 | title = {工程硕士论文撰写规范}, 52 | year = {2000}, 53 | address = {上海}, 54 | pages = {177-178} 55 | } 56 | 57 | @patent{Zhang2012, 58 | number = {201220158825.2}, 59 | author = {张凯军}, 60 | title = {轨道火车及高速轨道火车紧急安全制动辅助装置}, 61 | date = {2012-04-05} 62 | } 63 | 64 | @standard{S2010, 65 | title = {文献著录: 第4部分~非书资料: GB/T 3792.4-2009}, 66 | address = {北京}, 67 | author = {全国信息与文献标准化技术委员会}, 68 | year = {2010}, 69 | pages = {3}, 70 | publisher = {中国标准出版社} 71 | } 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SJTUTeX 2 | 3 | [![CTAN](https://img.shields.io/ctan/v/sjtutex)](https://www.ctan.org/pkg/sjtutex) 4 | 5 | ## 简介 6 | 7 | SJTUTeX 是 [SJTUThesis](https://github.com/sjtug/SJTUThesis) 项目使用的文档类集, 8 | 包含上海交通大学学位论文文档类 `sjtuthesis`,以及普通文档类 `sjtuarticle` 和 `sjtureport`。 9 | 对于 LaTeX 模版的更改,都应该在这个 repo 中进行,而后把解包后的结果同步到 SJTUThesis。 10 | 11 | 本文档类集基于 LaTeX3 编写,使用说明详见 [发布区](https://github.com/sjtug/SJTUTeX/releases) 文档。 12 | 13 | SJTUTeX 和 SJTUThesis 项目共享讨论区与社区写作模式。如遇问题,请在 [SJTUThesis](https://github.com/sjtug/SJTUThesis) 中反馈。 14 | 15 | ## 安装至发行版 16 | 17 | 如果你正在使用 TeX Live 或 MacTeX,可以在终端输入下面的命令安装至本地发行版中。 18 | 19 | ```bash 20 | cd sjtutex 21 | l3build install 22 | ``` 23 | 24 | 也可以将 [发布区](https://github.com/sjtug/SJTUTeX/releases/latest) 的 `sjtutex.tds.zip` 手动解压到发行版的 TDS 目录下。 25 | 26 | ## 开发指南 27 | 28 | 开发主要在 `sjtutex` 文件夹中进行,生成发布包会进行解包、测试、文档等全部流程。 29 | 30 | ```bash 31 | cd sjtutex 32 | l3build unpack # 解包 33 | l3build doc # 文档 34 | l3build check # 测试 35 | l3build ctan # 生成发布包 36 | ``` 37 | 38 | ### 解包 39 | 40 | 文档类主要代码在 `source/sjtutex.dtx` 中,需要解包之后才能够使用。 41 | ``` 42 | l3build unpack 43 | ``` 44 | 解包结果将置于 `build/unpacked`(含有 dtx 文件)和 `build/local`(不含 dtx 文件) 文件夹下。 45 | 46 | ### 文档 47 | 48 | 从 `source/sjtutex.dtx` 编译出文档类文档 `sjtutex.pdf` 可以使用 49 | 50 | ``` 51 | l3build doc 52 | ``` 53 | 54 | > 请注意文档类文档 `sjtutex.pdf` 的正确编译需要使用 Noto CJK 字体(即 `ctex` 字体配置中的 `fontset=ubuntu`)。 55 | 56 | ### 测试 57 | 58 | 文档类还含有多个测试用例(比如 `sample-thesis-zh`),主要存放于 `testfiles` 文件夹中(支持文件存放于 `testfiles/support` 文件夹)。 59 | 60 | 测试全部示例使用 61 | ``` 62 | l3build check 63 | ``` 64 | 65 | 上面的过程默认隐藏编译细节。为了查看单个测试用例 `` 的编译细节,可以使用 66 | 67 | ``` 68 | l3build check 69 | ``` 70 | 71 | 测试的 PDF 结果生成于 `build/result` 文件夹。 72 | 73 | > 请使用尽可能新版本的 [l3build](https://github.com/latex3/l3build),更多细节请参见 [l3build 文档](https://mirrors.sjtug.sjtu.edu.cn/CTAN/macros/latex/contrib/l3build/l3build.pdf)(`texdoc l3build`)。 74 | 75 | ## 软件许可证 76 | 77 | 上海交通大学校徽图片(`sjtu-vi-badge-cor-red.pdf` 等)的版权归上海交通大学所有。 78 | 79 | 其他部分使用 [LPPL](LICENSE) 授权。 80 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-setup-thesis.tex: -------------------------------------------------------------------------------- 1 | \sjtusetup{ 2 | % 3 | %************************************ 4 | % 注意: 5 | % 1. 配置里面不要出现空行 6 | % 2. 不需要的配置信息可以删除 7 | % 3. 封面信息将会按照设置顺序输出 8 | %************************************ 9 | % 10 | % 信息录入 11 | % 12 | info = {% 13 | % 14 | % 标题 15 | % 16 | zh / title = {上海交通大学学位论文 \LaTeX{} 模板示例文档}, 17 | en / title = {A Sample Document for \LaTeX-based SJTU Thesis Template}, 18 | % 19 | % 标题页标题 20 | % 可使用“\\”命令手动控制换行 21 | % 22 | zh / display-title = {上海交通大学学位论文\\ \LaTeX{} 模板示例文档}, 23 | en / display-title = {A Sample Document \\ for \LaTeX-based SJTU Thesis Template}, 24 | % 25 | % 关键词 26 | % 27 | zh / keywords = {学位论文,论文格式,规范化,模板}, 28 | en / keywords = {dissertation, dissertation format, standardization, template}, 29 | % 30 | % 姓名 31 | % 32 | zh / author = {某\quad{}某}, 33 | en / author = {Mo Mo}, 34 | % 35 | % 学号 36 | % 37 | id = {0010900990}, 38 | % 39 | % 指导教师 40 | % 41 | zh / supervisor = {某某教授}, 42 | en / supervisor = {Prof. Mou Mou}, 43 | % 44 | % 所属院系 45 | % 46 | zh / department = {某某系}, 47 | en / department = {School of XXX}, 48 | % 49 | % 专业 50 | % 51 | zh / major = {某某专业}, 52 | en / major = {A Very Important Major}, 53 | % 54 | % 学位 55 | % 56 | zh / degree = {工学硕士}, 57 | en / degree = {Master of Engineering}, 58 | % 59 | % 日期 60 | % 使用 ISO 格式 (yyyy-mm-dd 或 yyyy-mm);默认为当前时间 61 | % 62 | % date = {2014-12-17}, 63 | % 64 | % 资助基金 65 | % 66 | % zh / fund = { 67 | % {国家 973 项目 (No. 2025CB000000)}, 68 | % {国家自然科学基金 (No. 81120250000)}, 69 | % }, 70 | % en / fund = { 71 | % {National Basic Research Program of China (Grant No. 2025CB000000)}, 72 | % {National Natural Science Foundation of China (Grant No. 81120250000)}, 73 | % }, 74 | }, 75 | style = {% 76 | % 77 | % 关键词首行悬挂 78 | % 79 | keywords-format = hang, 80 | }, 81 | } 82 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-nomenclature-en.tex: -------------------------------------------------------------------------------- 1 | \begin{nomenclature} 2 | 3 | \begin{longtable}{rl} 4 | $\epsilon$ & dielectric constant \\ 5 | $\mu$ & magnetic conductivity \\ 6 | $\epsilon$ & dielectric constant \\ 7 | $\mu$ & magnetic conductivity \\ 8 | $\epsilon$ & dielectric constant \\ 9 | $\mu$ & magnetic conductivity \\ 10 | $\epsilon$ & dielectric constant \\ 11 | $\mu$ & magnetic conductivity \\ 12 | $\epsilon$ & dielectric constant \\ 13 | $\mu$ & magnetic conductivity \\ 14 | $\epsilon$ & dielectric constant \\ 15 | $\mu$ & magnetic conductivity \\ 16 | $\epsilon$ & dielectric constant \\ 17 | $\mu$ & magnetic conductivity \\ 18 | $\epsilon$ & dielectric constant \\ 19 | $\mu$ & magnetic conductivity \\ 20 | $\epsilon$ & dielectric constant \\ 21 | $\mu$ & magnetic conductivity \\ 22 | $\epsilon$ & dielectric constant \\ 23 | $\mu$ & magnetic conductivity \\ 24 | $\epsilon$ & dielectric constant \\ 25 | $\mu$ & magnetic conductivity \\ 26 | $\epsilon$ & dielectric constant \\ 27 | $\mu$ & magnetic conductivity \\ 28 | $\epsilon$ & dielectric constant \\ 29 | $\mu$ & magnetic conductivity \\ 30 | $\epsilon$ & dielectric constant \\ 31 | $\mu$ & magnetic conductivity \\ 32 | $\epsilon$ & dielectric constant \\ 33 | $\mu$ & magnetic conductivity \\ 34 | $\epsilon$ & dielectric constant \\ 35 | $\mu$ & magnetic conductivity \\ 36 | $\epsilon$ & dielectric constant \\ 37 | $\mu$ & magnetic conductivity \\ 38 | $\epsilon$ & dielectric constant \\ 39 | $\mu$ & magnetic conductivity \\ 40 | $\epsilon$ & dielectric constant \\ 41 | $\mu$ & magnetic conductivity \\ 42 | $\epsilon$ & dielectric constant \\ 43 | $\mu$ & magnetic conductivity \\ 44 | $\epsilon$ & dielectric constant \\ 45 | $\mu$ & magnetic conductivity \\ 46 | $\epsilon$ & dielectric constant \\ 47 | $\mu$ & magnetic conductivity \\ 48 | $\epsilon$ & dielectric constant \\ 49 | $\mu$ & magnetic conductivity \\ 50 | $\epsilon$ & dielectric constant \\ 51 | $\mu$ & magnetic conductivity \\ 52 | $\epsilon$ & dielectric constant \\ 53 | $\mu$ & magnetic conductivity \\ 54 | $\epsilon$ & dielectric constant \\ 55 | $\mu$ & magnetic conductivity \\ 56 | $\epsilon$ & dielectric constant \\ 57 | $\mu$ & magnetic conductivity \\ 58 | \end{longtable} 59 | 60 | \end{nomenclature} 61 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-thesis-ja.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | 3 | % 载入 SJTUThesis 模版 4 | \documentclass[type=master,lang=ja]{sjtuthesis} 5 | 6 | \input{common-package} 7 | \usepackage{bxjalipsum} 8 | \input{common-setup-thesis} 9 | \makeatletter 10 | \def\@biblabel#1{(#1)} 11 | \makeatother 12 | % 日语模板补充字段 13 | \sjtusetup{ 14 | info = { 15 | ja / title = {上海交通大学学位論文見本}, 16 | ja / display-title = {上海交通大学学位論文見本}, 17 | ja / keywords = {学位論文, 論文書式, 規範化, 見本}, 18 | ja / degree = {工学修士}, 19 | ja / author = {某}, 20 | ja / supervisor = {某教授}, 21 | ja / major = {某メジャー}, 22 | ja / department = {某カレッジ}, 23 | % ja / fund = { 24 | % {国家973プロジェクト (No. 2025CB000000)}, 25 | % {中国国家自然科学基金会 (No. 81120250000)}, 26 | % }, 27 | } 28 | } 29 | 30 | \begin{document} 31 | 32 | % 标题页 33 | \maketitle 34 | 35 | % 原创性声明及使用授权书 36 | \copyrightpage 37 | 38 | % 前置部分 39 | \frontmatter 40 | 41 | \begin{abstract}[lang=zh] 42 | \input{common-abstract-zh.tex} 43 | \end{abstract} 44 | 45 | \begin{abstract}[lang=en] 46 | \input{common-abstract-en.tex} 47 | \end{abstract} 48 | 49 | \begin{abstract}[lang=ja] 50 | \input{common-abstract-ja.tex} 51 | \end{abstract} 52 | 53 | % 目录 54 | \tableofcontents 55 | % 插图索引 56 | \listoffigures 57 | % 表格索引 58 | \listoftables 59 | % 算法索引 60 | % \listofalgorithms 61 | 62 | % 主体部分 63 | \mainmatter 64 | 65 | \input{common-mainmatter-ja} 66 | 67 | % 参考文献 68 | \begin{thebibliography}{99} 69 | \item 大内田鶴子「草の根の自治の技術」『社会学評論』1999(4),513-530 70 | \item K・J・アロー 長名寛明訳『社会的選択と個人的評価』日本経済新聞社 1977,94 71 | \item 鈴木光男・武藤滋夫『協力ゲームの理論』東京大学出版会 1985,149 72 | \item 鈴木孝夫『ことばと文化』岩波書店 1973 73 | \item 舩橋晴俊「環境問題の未来と社会変動――社会の自己破壊性と自己組織性」 74 | 舩橋晴俊・飯島伸子編『講座社会学 12 環境』東京大学出版会 1998,191-224 75 | \item 真田信治 他『社会言語学』おうふう 1992 76 | \item 真木悠介『現代社会の存立構造』筑摩書房 1977a 77 | \item ------『気流の鳴る音』筑摩書房 1977b 78 | \item 横山紀子「インプットの効果を高める教室活動:日本語教育における実践」国際交流基金『日本語国際センター紀要』第10号 1999,37-53 79 | \item http://www.ninjal.ac.jp/(国立国語研究所)(作成日時、更新日時、アクセス日時) 80 | \end{thebibliography} 81 | 82 | % 附录 83 | \appendix 84 | 85 | % 附录中图表不加入索引 86 | \captionsetup{list=no} 87 | 88 | \input{common-nomenclature-ja} 89 | 90 | % 结尾部分 91 | \backmatter 92 | 93 | % 用于盲审的论文需隐去致谢、发表论文、科研成果、简历 94 | 95 | \input{common-achievements-ja} 96 | 97 | \input{common-acknowledgements-ja} 98 | 99 | \input{common-digest} 100 | 101 | \end{document} 102 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-nomenclature-de.tex: -------------------------------------------------------------------------------- 1 | \begin{nomenclature} 2 | 3 | \begin{longtable}{rl} 4 | $\epsilon$ & Dielektrizitätskonstante \\ 5 | $\mu$ & magnetische Leitfähigkeit \\ 6 | $\epsilon$ & Dielektrizitätskonstante \\ 7 | $\mu$ & magnetische Leitfähigkeit \\ 8 | $\epsilon$ & Dielektrizitätskonstante \\ 9 | $\mu$ & magnetische Leitfähigkeit \\ 10 | $\epsilon$ & Dielektrizitätskonstante \\ 11 | $\mu$ & magnetische Leitfähigkeit \\ 12 | $\epsilon$ & Dielektrizitätskonstante \\ 13 | $\mu$ & magnetische Leitfähigkeit \\ 14 | $\epsilon$ & Dielektrizitätskonstante \\ 15 | $\mu$ & magnetische Leitfähigkeit \\ 16 | $\epsilon$ & Dielektrizitätskonstante \\ 17 | $\mu$ & magnetische Leitfähigkeit \\ 18 | $\epsilon$ & Dielektrizitätskonstante \\ 19 | $\mu$ & magnetische Leitfähigkeit \\ 20 | $\epsilon$ & Dielektrizitätskonstante \\ 21 | $\mu$ & magnetische Leitfähigkeit \\ 22 | $\epsilon$ & Dielektrizitätskonstante \\ 23 | $\mu$ & magnetische Leitfähigkeit \\ 24 | $\epsilon$ & Dielektrizitätskonstante \\ 25 | $\mu$ & magnetische Leitfähigkeit \\ 26 | $\epsilon$ & Dielektrizitätskonstante \\ 27 | $\mu$ & magnetische Leitfähigkeit \\ 28 | $\epsilon$ & Dielektrizitätskonstante \\ 29 | $\mu$ & magnetische Leitfähigkeit \\ 30 | $\epsilon$ & Dielektrizitätskonstante \\ 31 | $\mu$ & magnetische Leitfähigkeit \\ 32 | $\epsilon$ & Dielektrizitätskonstante \\ 33 | $\mu$ & magnetische Leitfähigkeit \\ 34 | $\epsilon$ & Dielektrizitätskonstante \\ 35 | $\mu$ & magnetische Leitfähigkeit \\ 36 | $\epsilon$ & Dielektrizitätskonstante \\ 37 | $\mu$ & magnetische Leitfähigkeit \\ 38 | $\epsilon$ & Dielektrizitätskonstante \\ 39 | $\mu$ & magnetische Leitfähigkeit \\ 40 | $\epsilon$ & Dielektrizitätskonstante \\ 41 | $\mu$ & magnetische Leitfähigkeit \\ 42 | $\epsilon$ & Dielektrizitätskonstante \\ 43 | $\mu$ & magnetische Leitfähigkeit \\ 44 | $\epsilon$ & Dielektrizitätskonstante \\ 45 | $\mu$ & magnetische Leitfähigkeit \\ 46 | $\epsilon$ & Dielektrizitätskonstante \\ 47 | $\mu$ & magnetische Leitfähigkeit \\ 48 | $\epsilon$ & Dielektrizitätskonstante \\ 49 | $\mu$ & magnetische Leitfähigkeit \\ 50 | $\epsilon$ & Dielektrizitätskonstante \\ 51 | $\mu$ & magnetische Leitfähigkeit \\ 52 | $\epsilon$ & Dielektrizitätskonstante \\ 53 | $\mu$ & magnetische Leitfähigkeit \\ 54 | $\epsilon$ & Dielektrizitätskonstante \\ 55 | $\mu$ & magnetische Leitfähigkeit \\ 56 | $\epsilon$ & Dielektrizitätskonstante \\ 57 | $\mu$ & magnetische Leitfähigkeit \\ 58 | \end{longtable} 59 | 60 | \end{nomenclature} 61 | -------------------------------------------------------------------------------- /sjtutex/testfiles/sample-thesis-de.tex: -------------------------------------------------------------------------------- 1 | % !TeX encoding = UTF-8 2 | 3 | % 载入 SJTUThesis 模版 4 | \documentclass[type=master,lang=de]{sjtuthesis} 5 | 6 | \input{common-package} 7 | % \usepackage[ngerman]{babel} 8 | \usepackage{ngerman} 9 | \usepackage[pangram]{blindtext} 10 | \input{common-setup-thesis} 11 | % 使用 MLA 引用格式 12 | \usepackage[backend=biber,style=mla-new]{biblatex} 13 | % 变更为自订的引用样式 (Kafka: 67) 14 | \DeclareDelimFormat{postnotedelim}{\addcolon\space} 15 | \renewbibmacro*{postnote}{% 16 | \iffieldundef{postnote}% 17 | {} 18 | {\setunit{\printdelim{postnotedelim}}%% 19 | \ifbool{cbx@hyperpages}% 20 | {\printtext[bibhyperref]{\printfield[ibidpostnote]{postnote}}}% 21 | {\printfield[ibidpostnote]{postnote}}}}% 22 | % 调整引用标题,不使用 Works Cited 23 | \AtBeginDocument{ 24 | \renewcommand{\bibname}{Literaturverzeichnis} 25 | } 26 | % 添加引用数据库 27 | \addbibresource{ref.bib} 28 | % 德语模板补充字段 29 | \sjtusetup{ 30 | info = { 31 | de / title = {Vorlage für Abschlussarbeiten der Shanghai Jiao Tong Universität}, 32 | de / display-title = {Vorlage für Abschlussarbeiten der \\ Shanghai Jiao Tong Universität}, 33 | de / keywords = {Dissertation, Dissertation-Format, Standardisierung, Vorlage}, 34 | de / degree = {Master of Engineering}, 35 | de / author = {Jemand}, 36 | de / supervisor = {Professor Jemand}, 37 | de / major = {Ein bestimmtes Fachgebiet}, 38 | de / department = {Gewisse Abteilung}, 39 | % de / fund = { 40 | % {National 973 Project (No. 2025CB000000)}, 41 | % {Nationale Stiftung für Naturwissenschaften Chinas (No. 81120250000)}, 42 | % }, 43 | } 44 | } 45 | 46 | \begin{document} 47 | 48 | % 标题页 49 | \maketitle 50 | 51 | % 原创性声明及使用授权书 52 | \copyrightpage 53 | 54 | % 前置部分 55 | \frontmatter 56 | 57 | \begin{abstract}[lang=zh] 58 | \input{common-abstract-zh.tex} 59 | \end{abstract} 60 | 61 | \begin{abstract}[lang=en] 62 | \input{common-abstract-en.tex} 63 | \end{abstract} 64 | 65 | \begin{abstract}[lang=de] 66 | \input{common-abstract-de.tex} 67 | \end{abstract} 68 | 69 | % 目录 70 | \tableofcontents 71 | % 插图索引 72 | \listoffigures 73 | % 表格索引 74 | \listoftables 75 | % 算法索引 76 | % \listofalgorithms 77 | 78 | % 主体部分 79 | \mainmatter 80 | 81 | \input{common-mainmatter-de} 82 | 83 | % 参考文献 84 | \printbibliography[heading=bibintoc] 85 | 86 | % 附录 87 | \appendix 88 | 89 | % 附录中图表不加入索引 90 | \captionsetup{list=no} 91 | 92 | \input{common-nomenclature-de} 93 | 94 | % 结尾部分 95 | \backmatter 96 | 97 | % 用于盲审的论文需隐去致谢、发表论文、科研成果、简历 98 | 99 | \input{common-achievements-de} 100 | 101 | \input{common-acknowledgements-de} 102 | 103 | \input{common-digest} 104 | 105 | \end{document} 106 | -------------------------------------------------------------------------------- /sjtutex/build.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env texlua 2 | 3 | module = "sjtutex" 4 | 5 | sourcefiledir = "source" 6 | sourcefiles = {"sjtutex.dtx","vi/sjtu-vi-*.pdf"} 7 | installfiles = {"*.cls","*.def","*.pdf"} 8 | 9 | typesetexe = "xelatex" 10 | typesetfiles = {"sjtutex.dtx"} 11 | typesetsuppfiles = {"ctxdoc.cls"} 12 | 13 | bibtexexe = "bibtex" 14 | biberexe = "biber" 15 | biberopts = "--quiet" 16 | 17 | unpackexe = "luatex" 18 | unpackfiles = {"sjtutex.dtx"} 19 | unpacksuppfiles = {"sjtutex.id"} 20 | gitverfiles = {"sjtutex.dtx"} 21 | 22 | checkruns = 3 23 | checkengines = {"luatex","xetex"} -- do not reorder this, related to runtest_tasks() 24 | checkopts = "-file-line-error -halt-on-error -interaction=nonstopmode" 25 | recordstatus = true 26 | lvtext = ".tex" 27 | xdvext = ".xdv" 28 | 29 | packtdszip = true 30 | 31 | tdslocations = { 32 | "tex/latex/sjtutex/font/sjtu-*-font-*.def", 33 | "tex/latex/sjtutex/lang/sjtu-lang-*.def", 34 | "tex/latex/sjtutex/scheme/sjtu-scheme-*.def", 35 | "tex/latex/sjtutex/thesis/sjtu-thesis-*.def", 36 | "tex/latex/sjtutex/vi/sjtu-vi-*.pdf" 37 | } 38 | 39 | shellescape = os.type == "windows" 40 | and function (s) return s end 41 | or function (s) 42 | s = s:gsub([[\]], [[\\]]) 43 | s = s:gsub([[%$]], [[\$]]) 44 | return s 45 | end 46 | 47 | git_id_info = { } 48 | 49 | function extract_git_version() 50 | mkdir(supportdir) 51 | for _,i in ipairs(gitverfiles) do 52 | for _,j in ipairs({sourcefiledir}) do 53 | for _,k in ipairs(filelist(j, i)) do 54 | local idfile = normalize_path(supportdir .. "/" .. jobname(k) .. ".id") 55 | local file = normalize_path(j .. "/" .. k) 56 | local cmdline = shellescape([[git log -1 --pretty=format:"$Id: ]] 57 | .. k .. [[ %h %ai %an <%ae> $" ]] .. file) 58 | local f = assert(io.popen(cmdline, "r")) 59 | local id = f:read("*all") 60 | f:close() 61 | git_id_info[k] = id 62 | f = assert(io.open(idfile, "wb")) 63 | f:write(id, "\n") 64 | f:close() 65 | end 66 | end 67 | end 68 | end 69 | 70 | function expand_git_version() 71 | local sourcedir = tdsdir .. "/source/" .. moduledir 72 | for _,i in ipairs(gitverfiles) do 73 | for _,j in ipairs({sourcedir}) do 74 | for _,k in ipairs(filelist(j, i)) do 75 | replace_git_id(j, k) 76 | end 77 | end 78 | end 79 | end 80 | 81 | function replace_git_id (path, file) 82 | local f = assert(io.open(path .. "/" .. file, "rb")) 83 | local s = f:read("*all") 84 | f:close() 85 | local id = assert(git_id_info[file]) 86 | local s, n = s:gsub([[(\GetIdInfo)%b$$]], "%1" .. id) 87 | if n > 0 then 88 | f = assert(io.open(path .. "/" .. file, "wb")) 89 | f:write(s) 90 | f:close() 91 | cp(file, path, ctandir .. "/" .. ctanpkg) 92 | end 93 | end 94 | 95 | function update_tag(file, content, tagname, tagdate) 96 | local content, date = content, tagdate:gsub("%-", "/") 97 | if file:match("%.dtx$") then 98 | content = content:gsub("({\\ExplFileDate})%b{}", "%1{" .. tagname .. "}") 99 | content = content:gsub("{%d%d%d%d/%d%d/%d%d v%S+", "{" .. date .. " v" .. tagname) 100 | content = content:gsub("(\\changes){unreleased}", "%1{v" .. tagname .. "}") 101 | end 102 | return content 103 | end 104 | 105 | function tag_hook(tagname) 106 | os.execute("git commit -a -m \"Bump version to " .. tagname .. "\"") 107 | os.execute("git tag v" .. tagname) 108 | end 109 | 110 | -- Similar to dvitopdf() 111 | function xdvtopdf(name, dir) 112 | runcmd( 113 | "xdvipdfmx -E -q " .. name .. xdvext, 114 | dir 115 | ) 116 | end 117 | 118 | function runtest_tasks(name, run) 119 | if run == 1 and fileexists(testdir .. "/" .. name .. ".bcf") then 120 | return biberexe .. " " .. name .. " " .. biberopts 121 | else 122 | if run == checkruns then 123 | local engine 124 | if not(fileexists(testdir .. "/" .. name .. xdvext)) then 125 | engine = "luatex" 126 | else 127 | engine = "xetex" 128 | xdvtopdf(name, testdir) 129 | end 130 | cp(name .. pdfext,testdir,resultdir) 131 | ren(resultdir, name .. pdfext, name .. "." .. engine .. pdfext) 132 | end 133 | return "" 134 | end 135 | end 136 | 137 | null_function = function() return 0 end 138 | 139 | unpack_prehook = unpack_prehook or null_function 140 | unpack_posthook = unpack_posthook or null_function 141 | unhooked_bundleunpack = bundleunpack 142 | bundleunpack = function (...) 143 | extract_git_version() 144 | unpack_prehook() 145 | local retval = unhooked_bundleunpack(...) 146 | is_unpacked = true 147 | unpack_posthook() 148 | return retval 149 | end 150 | target_list.bundleunpack.func = bundleunpack 151 | 152 | copyctan_prehook = copyctan_prehook or null_function 153 | copyctan_posthook = copyctan_posthook or null_function 154 | unhooked_copyctan = copyctan 155 | copyctan = function (...) 156 | copyctan_prehook() 157 | local retval = unhooked_copyctan(...) 158 | expand_git_version() 159 | copyctan_posthook() 160 | return retval 161 | end 162 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-mainmatter-ja.tex: -------------------------------------------------------------------------------- 1 | \chapter{序論} 2 | 3 | \section{前書き} 4 | 5 | \jalipsum[1]{kusamakura} 6 | 7 | \section{本研究の主要内容} 8 | 9 | \jalipsum[2]{kusamakura} 10 | 11 | \section{本研究の意義} 12 | 13 | \jalipsum[3]{kusamakura} 14 | 15 | \section{先行研究} 16 | 17 | \jalipsum[4]{kusamakura} 18 | 19 | 20 | \chapter{正文の文字書式} 21 | 22 | \section{論文の正文} 23 | 24 | 論文の正文が主体で、一般的に標題、叙述、図、表、公式などからなる。 25 | 理論分析、計算方法、実験とテスト方法などの方法を用い、... 26 | 27 | 論文は一般的に十部分の内容から構成される。 28 | \footnote[1]{脚注 1} 29 | \footnote[11]{脚注 11} 30 | \footnote[21]{脚注 21} 31 | \footnote[32]{脚注 32} 32 | \footnote[50]{脚注 50} 33 | 34 | \section{字数要求} 35 | 36 | \subsection{学士論文の要求} 37 | 38 | 日本語の論文の字数は12000字以上で、読書報告書の字数は15000字以上となる。 39 | 40 | \section{本章のまとめ} 41 | 42 | \jalipsum[5]{kusamakura} 43 | 44 | 45 | \chapter{図表、公式の書式} 46 | 47 | \section{図表の書式} 48 | 49 | \begin{figure}[ht] 50 | \centering 51 | \includegraphics[width=4cm]{example-image.pdf} 52 | \caption{例} 53 | \label{fig:example} 54 | \end{figure} 55 | 56 | \begin{ThreePartTable} 57 | \begin{TableNotes} 58 | \item[a] 脚注 59 | \item[b] 脚注 60 | \end{TableNotes} 61 | \begin{longtable}[c]{c*{6}{r}} 62 | \caption{実験データ} 63 | \label{tab:performance} \\ 64 | \toprule 65 | 試験プログラム & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{B} 66 | & \multicolumn{1}{c}{C} & \multicolumn{1}{c}{D} 67 | & \multicolumn{1}{c}{E} & \multicolumn{1}{c}{C} \\ 68 | & \multicolumn{1}{c}{時間 (s)} & \multicolumn{1}{c}{時間 (s)} 69 | & \multicolumn{1}{c}{時間 (s)} & \multicolumn{1}{c}{時間 (s)} 70 | & \multicolumn{1}{c}{時間 (s)} & 資料(KB)\\ 71 | \midrule 72 | \endfirsthead 73 | \multicolumn{7}{l}{\textbf{表のつづき~\thetable}} \\ 74 | \toprule 75 | 試験プログラム & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{B} 76 | & \multicolumn{1}{c}{C} & \multicolumn{1}{c}{D} 77 | & \multicolumn{1}{c}{E} & \multicolumn{1}{c}{C} \\ 78 | & \multicolumn{1}{c}{時間 (s)} & \multicolumn{1}{c}{時間 (s)} 79 | & \multicolumn{1}{c}{時間 (s)} & \multicolumn{1}{c}{時間 (s)} 80 | & \multicolumn{1}{c}{時間 (s)} & 資料(KB)\\ 81 | \midrule 82 | \endhead 83 | \hline 84 | \endfoot 85 | \insertTableNotes 86 | \endlastfoot 87 | CG.A.2 & 23.05 & 0.002 & 0.116 & 0.035 & 0.589 & 32491 \\ 88 | CG.A.4 & 15.06 & 0.003 & 0.067 & 0.021 & 0.351 & 18211 \\ 89 | CG.A.8 & 13.38 & 0.004 & 0.072 & 0.023 & 0.210 & 9890 \\ 90 | CG.B.2 & 867.45 & 0.002 & 0.864 & 0.232 & 3.256 & 228562 \\ 91 | CG.B.4 & 501.61 & 0.003 & 0.438 & 0.136 & 2.075 & 123862 \\ 92 | CG.B.8 & 384.65 & 0.004 & 0.457 & 0.108 & 1.235 & 63777 \\ 93 | MG.A.2 & 112.27 & 0.002 & 0.846 & 0.237 & 3.930 & 236473 \\ 94 | MG.A.4 & 59.84 & 0.003 & 0.442 & 0.128 & 2.070 & 123875 \\ 95 | MG.A.8 & 31.38 & 0.003 & 0.476 & 0.114 & 1.041 & 60627 \\ 96 | MG.B.2 & 526.28 & 0.002 & 0.821 & 0.238 & 4.176 & 236635 \\ 97 | MG.B.4 & 280.11 & 0.003 & 0.432 & 0.130 & 1.706 & 123793 \\ 98 | MG.B.8 & 148.29 & 0.003 & 0.442 & 0.116 & 0.893 & 60600 \\ 99 | LU.A.2 & 2116.54 & 0.002 & 0.110 & 0.030 & 0.532 & 28754 \\ 100 | LU.A.4 & 1102.50 & 0.002 & 0.069 & 0.017 & 0.255 & 14915 \\ 101 | LU.A.8 & 574.47 & 0.003 & 0.067 & 0.016 & 0.192 & 8655 \\ 102 | LU.B.2 & 9712.87 & 0.002 & 0.357 & 0.104 & 1.734 & 101975 \\ 103 | LU.B.4 & 4757.80 & 0.003 & 0.190 & 0.056 & 0.808 & 53522 \\ 104 | LU.B.8 & 2444.05 & 0.004 & 0.222 & 0.057 & 0.548 & 30134 \\ 105 | EP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1834 \\ 106 | EP.A.4 & 61.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1743 \\ 107 | EP.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1661 \\ 108 | EP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2011 \\ 109 | EP.B.4 & 247.69 & 0.002 & 0.012 & 0.004 & 0.122 & 1663 \\ 110 | EP.B.8 & 126.74 & 0.003 & 0.017 & 0.005 & 0.083 & 1656 \\ 111 | SP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1854 \\ 112 | SP.A.4 & 51.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1543 \\ 113 | SP.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1671 \\ 114 | SP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2411 \\ 115 | SP.B.4 \tnote{a} & 247.69 & 0.002 & 0.014 & 0.006 & 0.152 & 2653 \\ 116 | SP.B.8 \tnote{b} & 126.74 & 0.003 & 0.017 & 0.005 & 0.082 & 1755 \\ 117 | \bottomrule 118 | \end{longtable} 119 | \end{ThreePartTable} 120 | 121 | \section{公式の書式} 122 | 123 | \begin{equation}\label{eq:example} 124 | \frac{1}{\mu}\nabla^2\mathbf{A}-j\omega\sigma\mathbf{A} 125 | -\nabla\left(\frac{1}{\mu}\right)\times(\nabla\times\mathbf{A}) 126 | +\mathbf{J}_0=0 127 | \end{equation} 128 | 129 | \begin{equation} 130 | \int_{a}^b f(x)\,\mathrm{d}x=\lim_{|P|\rightarrow 0}\sum_{i=1}^n f(\xi_i)\increment x_i 131 | \end{equation} 132 | 133 | \section{コード環境} 134 | 135 | \begin{codeblock}[language=C] 136 | #include 137 | #include 138 | #include 139 | #include 140 | 141 | int main() { 142 | pid_t pid; 143 | 144 | switch ((pid = fork())) { 145 | case -1: 146 | printf("fork failed\n"); 147 | break; 148 | case 0: 149 | /* child calls exec */ 150 | execl("/bin/ls", "ls", "-l", (char*)0); 151 | printf("execl failed\n"); 152 | break; 153 | default: 154 | /* parent uses wait to suspend execution until child finishes */ 155 | wait((int*)0); 156 | printf("is completed\n"); 157 | break; 158 | } 159 | return 0; 160 | } 161 | \end{codeblock} 162 | 163 | \section{アルゴリズム環境} 164 | 165 | \begin{algorithm}[htb] 166 | \caption{アルゴリズム例} 167 | \label{algo:algorithm} 168 | \small 169 | \SetAlgoLined 170 | \KwData{this text} 171 | \KwResult{how to write algorithm with \LaTeXe } 172 | 173 | initialization\; 174 | \While{not at end of this document}{ 175 | read current\; 176 | \eIf{understand}{ 177 | go to next section\; 178 | current section becomes this one\; 179 | }{ 180 | go back to the beginning of current section\; 181 | } 182 | } 183 | \end{algorithm} 184 | 185 | \section{本章のまとめ} 186 | 187 | \jalipsum[6]{kusamakura} 188 | 189 | \chapter{結論} 190 | 191 | \section{主要結論} 192 | 193 | \jalipsum[7]{kusamakura} 194 | 195 | \section{今後の展望} 196 | 197 | \jalipsum[8]{kusamakura} 198 | 199 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-mainmatter-zh.tex: -------------------------------------------------------------------------------- 1 | \chapter{绪论} 2 | 3 | \section{引言} 4 | 5 | \zhlipsum[1] 6 | 7 | \section{本文研究主要内容} 8 | 9 | \zhlipsum[2] 10 | 11 | \section{本文研究意义} 12 | 13 | \zhlipsum[3] 14 | 15 | \section{本章小结} 16 | 17 | \zhlipsum[4] 18 | 19 | 20 | \chapter{正文文字格式} 21 | 22 | \section{论文正文} 23 | 24 | 论文正文是主体,一般由标题、文字叙述、图、表格和公式等部分构成。一般可包括理论分析、计算方法、 25 | 实验装置和测试方法,经过整理加工的实验结果分析和讨论,与理论计算结果的比较以及本研究方法与已有 26 | 研究方法的比较等,因学科性质不同可有所变化。\cite{Jia2000} 27 | 28 | 论文内容一般应由十个主要部分组成,依次为: 29 | 1. 封面 30 | 2. 中文摘要 31 | 3. 英文摘要 32 | 4. 目录 33 | 5. 符号说明 34 | 6. 论文正文 35 | 7. 参考文献 36 | 8. 附录 37 | 9. 致谢 38 | 10. 攻读学位期间发表的学术论文目录 39 | 40 | 以上各部分独立为一部分,每部分应从新的一页开始,且纸质论文应装订在论文的右侧。 41 | \footnote[1]{测试第 1 号脚注} 42 | \footnote[11]{测试第 11 号脚注} 43 | \footnote[21]{测试第 21 号脚注} 44 | \footnote[32]{测试第 32 号脚注} 45 | \footnote[50]{测试第 50 号脚注} 46 | 47 | \section{字数要求} 48 | 49 | \subsection{本科论文要求} 50 | 51 | 各学科和学院自定。理工科研究类论文一般不少于 2 万字,设计类一般不少于 1.5 万字; 52 | 医科、文科类论文一般不少于 1 万字。 53 | 54 | \section{本章小结} 55 | 56 | \zhlipsum[5] 57 | 58 | 59 | \chapter{图表、公式格式} 60 | 61 | \section{图表格式} 62 | 63 | \begin{figure}[ht] 64 | \centering 65 | \includegraphics[width=4cm]{example-image.pdf} 66 | \caption{示例图片} 67 | \label{fig:example} 68 | \end{figure} 69 | 70 | \begin{ThreePartTable} 71 | \begin{TableNotes} 72 | \item[a] 一个脚注 73 | \item[b] 另一个脚注 74 | \end{TableNotes} 75 | \begin{longtable}[c]{c*{6}{r}} 76 | \caption{实验数据} 77 | \label{tab:performance} \\ 78 | \toprule 79 | 测试程序 & \multicolumn{1}{c}{正常运行} & \multicolumn{1}{c}{同步} 80 | & \multicolumn{1}{c}{检查点} & \multicolumn{1}{c}{卷回恢复} 81 | & \multicolumn{1}{c}{进程迁移} & \multicolumn{1}{c}{检查点} \\ 82 | & \multicolumn{1}{c}{时间 (s)} & \multicolumn{1}{c}{时间 (s)} 83 | & \multicolumn{1}{c}{时间 (s)} & \multicolumn{1}{c}{时间 (s)} 84 | & \multicolumn{1}{c}{时间 (s)} & 文件(KB)\\ 85 | \midrule 86 | \endfirsthead 87 | \multicolumn{7}{l}{\textbf{续表~\thetable}} \\ 88 | \toprule 89 | 测试程序 & \multicolumn{1}{c}{正常运行} & \multicolumn{1}{c}{同步} 90 | & \multicolumn{1}{c}{检查点} & \multicolumn{1}{c}{卷回恢复} 91 | & \multicolumn{1}{c}{进程迁移} & \multicolumn{1}{c}{检查点} \\ 92 | & \multicolumn{1}{c}{时间 (s)} & \multicolumn{1}{c}{时间 (s)} 93 | & \multicolumn{1}{c}{时间 (s)} & \multicolumn{1}{c}{时间 (s)} 94 | & \multicolumn{1}{c}{时间 (s)}& 文件(KB)\\ 95 | \midrule 96 | \endhead 97 | \hline 98 | \endfoot 99 | \insertTableNotes 100 | \endlastfoot 101 | CG.A.2 & 23.05 & 0.002 & 0.116 & 0.035 & 0.589 & 32491 \\ 102 | CG.A.4 & 15.06 & 0.003 & 0.067 & 0.021 & 0.351 & 18211 \\ 103 | CG.A.8 & 13.38 & 0.004 & 0.072 & 0.023 & 0.210 & 9890 \\ 104 | CG.B.2 & 867.45 & 0.002 & 0.864 & 0.232 & 3.256 & 228562 \\ 105 | CG.B.4 & 501.61 & 0.003 & 0.438 & 0.136 & 2.075 & 123862 \\ 106 | CG.B.8 & 384.65 & 0.004 & 0.457 & 0.108 & 1.235 & 63777 \\ 107 | MG.A.2 & 112.27 & 0.002 & 0.846 & 0.237 & 3.930 & 236473 \\ 108 | MG.A.4 & 59.84 & 0.003 & 0.442 & 0.128 & 2.070 & 123875 \\ 109 | MG.A.8 & 31.38 & 0.003 & 0.476 & 0.114 & 1.041 & 60627 \\ 110 | MG.B.2 & 526.28 & 0.002 & 0.821 & 0.238 & 4.176 & 236635 \\ 111 | MG.B.4 & 280.11 & 0.003 & 0.432 & 0.130 & 1.706 & 123793 \\ 112 | MG.B.8 & 148.29 & 0.003 & 0.442 & 0.116 & 0.893 & 60600 \\ 113 | LU.A.2 & 2116.54 & 0.002 & 0.110 & 0.030 & 0.532 & 28754 \\ 114 | LU.A.4 & 1102.50 & 0.002 & 0.069 & 0.017 & 0.255 & 14915 \\ 115 | LU.A.8 & 574.47 & 0.003 & 0.067 & 0.016 & 0.192 & 8655 \\ 116 | LU.B.2 & 9712.87 & 0.002 & 0.357 & 0.104 & 1.734 & 101975 \\ 117 | LU.B.4 & 4757.80 & 0.003 & 0.190 & 0.056 & 0.808 & 53522 \\ 118 | LU.B.8 & 2444.05 & 0.004 & 0.222 & 0.057 & 0.548 & 30134 \\ 119 | EP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1834 \\ 120 | EP.A.4 & 61.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1743 \\ 121 | EP.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1661 \\ 122 | EP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2011 \\ 123 | EP.B.4 & 247.69 & 0.002 & 0.012 & 0.004 & 0.122 & 1663 \\ 124 | EP.B.8 & 126.74 & 0.003 & 0.017 & 0.005 & 0.083 & 1656 \\ 125 | SP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1854 \\ 126 | SP.A.4 & 51.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1543 \\ 127 | SP.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1671 \\ 128 | SP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2411 \\ 129 | SP.B.4 \tnote{a} & 247.69 & 0.002 & 0.014 & 0.006 & 0.152 & 2653 \\ 130 | SP.B.8 \tnote{b} & 126.74 & 0.003 & 0.017 & 0.005 & 0.082 & 1755 \\ 131 | \bottomrule 132 | \end{longtable} 133 | \end{ThreePartTable} 134 | 135 | \section{公式格式} 136 | 137 | \begin{equation}\label{eq:example} 138 | \frac{1}{\mu}\nabla^2\mathbf{A}-j\omega\sigma\mathbf{A} 139 | -\nabla\left(\frac{1}{\mu}\right)\times(\nabla\times\mathbf{A}) 140 | +\mathbf{J}_0=0 141 | \end{equation} 142 | 143 | \begin{equation} 144 | \int_{a}^b f(x)\,\mathrm{d}x=\lim_{|P|\rightarrow 0}\sum_{i=1}^n f(\xi_i)\increment x_i 145 | \end{equation} 146 | 147 | \section{代码环境} 148 | 149 | \begin{codeblock}[language=C] 150 | #include 151 | #include 152 | #include 153 | #include 154 | 155 | int main() { 156 | pid_t pid; 157 | 158 | switch ((pid = fork())) { 159 | case -1: 160 | printf("fork failed\n"); 161 | break; 162 | case 0: 163 | /* child calls exec */ 164 | execl("/bin/ls", "ls", "-l", (char*)0); 165 | printf("execl failed\n"); 166 | break; 167 | default: 168 | /* parent uses wait to suspend execution until child finishes */ 169 | wait((int*)0); 170 | printf("is completed\n"); 171 | break; 172 | } 173 | return 0; 174 | } 175 | \end{codeblock} 176 | 177 | \section{算法环境} 178 | 179 | \begin{algorithm}[htb] 180 | \caption{算法示例} 181 | \label{algo:algorithm} 182 | \small 183 | \SetAlgoLined 184 | \KwData{this text} 185 | \KwResult{how to write algorithm with \LaTeXe } 186 | 187 | initialization\; 188 | \While{not at end of this document}{ 189 | read current\; 190 | \eIf{understand}{ 191 | go to next section\; 192 | current section becomes this one\; 193 | }{ 194 | go back to the beginning of current section\; 195 | } 196 | } 197 | \end{algorithm} 198 | 199 | \section{本章小结} 200 | 201 | \zhlipsum[6] 202 | 203 | \chapter{全文总结} 204 | 205 | \section{主要结论} 206 | 207 | \zhlipsum[7] 208 | 209 | \section{研究展望} 210 | 211 | \zhlipsum[8] 212 | 213 | -------------------------------------------------------------------------------- /sjtutex/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | # Changelog 3 | 4 | 此处记载了 SJTUTeX 中所有值得留意的改动,格式参照[《如何维护更新日志》](https://keepachangelog.com/zh-CN/1.1.0/)。 5 | 6 | 点击版本号即可在 GitHub 上查看相邻版本间的代码变动。 7 | 8 | ## [Unreleased] 9 | 10 | ## [v2.2.1] - 2025-03-28 11 | 12 | ### Added 13 | 14 | - 新增本科新版原创性声明变体([#72](https://github.com/sjtug/SJTUTeX/pull/72))。 15 | - 新增语言设置钩子([#75](https://github.com/sjtug/SJTUTeX/pull/75))。 16 | 17 | ### Removed 18 | 19 | - 不再自动载入 `xcolor` 宏包([#73](https://github.com/sjtug/SJTUTeX/pull/73))。 20 | 21 | ### Fixed 22 | 23 | - `subject` 初始化时不再完全展开,避免使用 pdfTeX 时德语模板标题页生成错误的问题([#74](https://github.com/sjtug/SJTUTeX/pull/74))。 24 | - 修正插入外置版权页的 PDF 书签。 25 | 26 | ## [v2.2] - 2025-02-12 27 | 28 | ### Added 29 | 30 | - 新增 `info//custom` 键,可自定义标题页信息。 31 | - `style/page-number` 支持设置总页码数。 32 | - 新增 `hanyi` CJK 字体选项。 33 | 34 | ### Changed 35 | 36 | - 同步 LaTeX 2024-06-01,无需显式调用 `xtemplate` 宏包,内部实现使用 e 型展开替代 x 型展开。 37 | - 取消对标准文档选项的包装,未知选项将转递给标准文档类。 38 | - 简化 CJK 字体配置文件,pdfLaTeX 下直接使用 `ctex` 的默认设置。 39 | - 内置文档命令与环境修改为使用键值对参数,废弃对应的带星号版本。 40 | - 移除 `bibliolist` 环境的使用限制,修改为默认重置计数,新增 `resume` 选项设置连续编号。 41 | - 视觉形象系统文件重命名。 42 | 43 | ## [v2.1.5] - 2024-11-06 44 | 45 | ### Fixed 46 | 47 | - 修复了 `array` 更新造成的标题页生成失败的问题([#68](https://github.com/sjtug/SJTUTeX/pull/68))。 48 | 49 | ## [v2.1.4] - 2024-10-20 50 | 51 | ### Changed 52 | 53 | - 标题页信息栏允许手动换行([#66](https://github.com/sjtug/SJTUTeX/pull/66))。 54 | 55 | ## [v2.1.3] - 2024-06-29 56 | 57 | ### Changed 58 | 59 | - 更新目录样式。 60 | 61 | ## [v2.1.2] - 2024-04-05 62 | 63 | ### Changed 64 | 65 | - 改用 `titletoc` 设置目录格式,不再使用原 `tocloft` 包([#62](https://github.com/sjtug/SJTUTeX/pull/62))。 66 | 67 | ## [v2.1.1] - 2024-03-23 68 | 69 | ### Added 70 | 71 | - 新增 `style/theorem-header-font`、`style/theorem-body-font` 选项,支持修改预设数学环境字体。 72 | - 兼容 `thmtools` 包,使用 `tocloft` 包设置 `\listoftheorems` 的样式([#57](https://github.com/sjtug/SJTUTeX/issues/57)、[#60](https://github.com/sjtug/SJTUTeX/pull/60))。 73 | 74 | ### Changed 75 | 76 | - 预定义的数学环境声明移至导言区末尾,且不会覆盖重名的已定义环境。 77 | 78 | ## [v2.1] - 2024-02-18 79 | 80 | ### Added 81 | 82 | - 新增 `style/equation-font` 选项:行间数学公式的字体设置。 83 | - 新增 `style/indent-first` 选项:章节标题后首段是否缩进([#51](https://github.com/sjtug/SJTUTeX/pull/51))。 84 | - 新增 `style/keywords-format` 选项:设置关键词格式为普通段落或悬挂格式。 85 | - 新增 `style/num-sep` 选项及子选项 `style/float-num-sep`, `style/equation-num-sep` 和 `style/theorem-num-sep` 来定义编号中的分隔符。 86 | - 添加 `baselineskip` 文档类选项,替换原 `lineskip` 选项。 87 | 88 | ### Changed 89 | 90 | - `abstract` 环境添加目录条目,`abstract*` 环境对应修改为不添加目录条目。 91 | - `\tableofcontents` 添加目录条目,`\tableofcontents*` 对应修改为不添加目录条目。 92 | - 同步 LaTeX 2020/10/01,无需显式调用 `expl3` 和 `xparse` 宏包。 93 | - 更新题注格式。 94 | - 标题页信息栏改用表格实现。 95 | 96 | ## [v2.0.3] - 2023-09-25 97 | 98 | ### Added 99 | 100 | - 新增 `libertinus` 西文字体设置([#44](https://github.com/sjtug/SJTUTeX/pull/44))。 101 | - 添加 `siunitx` 宏包的本地化支持。 102 | 103 | ### Changed 104 | 105 | - 更新学位论文初始英文主题。 106 | 107 | ### Removed 108 | 109 | - 移除文档类内的 `listings` 宏包预设,相关预设移至主文档中。 110 | 111 | ### Fixed 112 | 113 | - 页面统一纵向顶部对齐。 114 | 115 | ## [v2.0.2] - 2023-04-01 116 | 117 | ### Changed 118 | 119 | - 标题页日期底部增加空白。 120 | 121 | ### Fixed 122 | 123 | - 修复使用 `unicode-math` 字体配置时,`math-style` 设置不生效的问题。 124 | 125 | ## [v2.0.1] - 2023-03-31 126 | 127 | ### Changed 128 | 129 | - 取消索引条目的缩进。 130 | - 调整索引编号宽度,`thesis` 和 `report` 分章编号的加长编号宽度 2.3em -> 2.8em,`article` 默认不分节编号的减小宽度 2.3em -> 1.8em。 131 | 132 | ### Fixed 133 | 134 | - 修复表格索引中编号宽度不正确的问题。 135 | 136 | ## [v2.0] - 2023-03-29 137 | 138 | ### Added 139 | 140 | - 对 `sjtuthesis` 文档类:`sjtu/info` 域现在使用 `/` 接口(比如 `zh/title`),`abstract` 和 `digest` 现在接受一个可选语言参数,移除 `running-title`;对 `sjtureport` 和 `sjtuarticle` 文档类:添加 `\keywords` 和 `\subject` 命令,推荐使用标准文档类接口,`sjtureport` 恢复标准文档类默认封面([#36](https://github.com/sjtug/SJTUTeX/pull/36))。 141 | - 新增日语模板([#37](https://github.com/sjtug/SJTUTeX/pull/37))。 142 | - 新增德语模板([#38](https://github.com/sjtug/SJTUTeX/pull/38))。 143 | - 新增 `sjtu/style/fnmark-style` 选项以支持脚注在带圈数字(`lang=zh` 和 `lang=ja` 时默认)和普通数字(`lang=en` 和 `lang=de` 时默认)间做切换;`sjtu/style/fnmark-font` 可以使用 `haranoaji` 预设([#39](https://github.com/sjtug/SJTUTeX/pull/39))。 144 | 145 | ### Changed 146 | 147 | - `sjtu/name` 域中的 `abbr`, `nom`, `ack`, `achv` 键仍然兼容旧接口,但请尽快更新为新用法。 148 | - `abbreviation`、`nomenclature`、`acknowledgements`、`achievements`、`resume` 现在支持使用可选参数变更标题。 149 | - 每个 `achievements` 环境将重置 `bibliolist` 和 `bibliolist*` 环境内部文献条目的计数器,而且 `bibliolist` 和 `bibliolist*` 现在只允许在 `achievements` 环境中使用。 150 | - `abbreviation`、`nomenclature` 现在是带编号的章节([#34](https://github.com/sjtug/SJTUTeX/pull/34))。 151 | 152 | ### Removed 153 | 154 | - 移除 `summary` 环境。 155 | 156 | ### Fixed 157 | 158 | - 统一西文无衬线字体缩放。 159 | - 修复 `review` 文档类选项的行为。 160 | - 在 `math-font=none` 时 `\QED` 可用。 161 | 162 | ## [v2.0-beta] - 2023-02-05 163 | 164 | ### Changed 165 | 166 | - 更新 `math-style` 文档类选项,默认值由 `TeX` 改为 `ISO`;废弃 `nointlimits`, `intlimits`, `upint`, `slint` 文档类选项,改为 `integral-limits=true/false` 和 `integral=slanted/upright`;添加文档类选项 `uppercase-greek=slanted/upright`([#23](https://github.com/sjtug/SJTUTeX/pull/23))。 167 | 168 | ### Deprecated 169 | 170 | - 文档类选项 `fontset` 已过时。 171 | 172 | ### Fixed 173 | 174 | - 修复 `\copyrightpage` 使用可选参数时不换页的错误。 175 | 176 | ## [v2.0-alpha] - 2022-12-28 177 | 178 | SJTUTeX 使用 LaTeX3 进行了重构,并对学校新毕业设计模版的要求做了适配。与此同时,新增了 `sjtuarticle` 和 `sjtureport` 文档类,可以用在实验报告等短文中。欢迎使用! 179 | 180 | 181 | [Unreleased]: https://github.com/sjtug/SJTUTeX/compare/v2.2.1...HEAD 182 | [v2.2.1]: https://github.com/sjtug/SJTUTeX/compare/v2.2...v2.2.1 183 | [v2.2]: https://github.com/sjtug/SJTUTeX/compare/v2.1.5...v2.2 184 | [v2.1.5]: https://github.com/sjtug/SJTUTeX/compare/v2.1.4...v2.1.5 185 | [v2.1.4]: https://github.com/sjtug/SJTUTeX/compare/v2.1.3...v2.1.4 186 | [v2.1.3]: https://github.com/sjtug/SJTUTeX/compare/v2.1.2...v2.1.3 187 | [v2.1.2]: https://github.com/sjtug/SJTUTeX/compare/v2.1.1...v2.1.2 188 | [v2.1.1]: https://github.com/sjtug/SJTUTeX/compare/v2.1...v2.1.1 189 | [v2.1]: https://github.com/sjtug/SJTUTeX/compare/v2.0.3...v2.1 190 | [v2.0.3]: https://github.com/sjtug/SJTUTeX/compare/v2.0.2...v2.0.3 191 | [v2.0.2]: https://github.com/sjtug/SJTUTeX/compare/v2.0.1...v2.0.2 192 | [v2.0.1]: https://github.com/sjtug/SJTUTeX/compare/v2.0...v2.0.1 193 | [v2.0]: https://github.com/sjtug/SJTUTeX/compare/v2.0-beta...v2.0 194 | [v2.0-beta]: https://github.com/sjtug/SJTUTeX/compare/v2.0-alpha...v2.0-beta 195 | [v2.0-alpha]: https://github.com/sjtug/SJTUTeX/releases/tag/v2.0-alpha 196 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-mainmatter-de.tex: -------------------------------------------------------------------------------- 1 | \chapter{Einf\"uhrung} 2 | 3 | \section{Vorwort} 4 | 5 | \blindtext[1] 6 | 7 | \section{Der Hauptinhalt dieses Papiers} 8 | 9 | \blindtext[2] 10 | 11 | \section{Die Bedeutung dieses Artikels} 12 | 13 | \blindtext[3] 14 | 15 | \blindtext[4] 16 | 17 | \section{Zusammenfassung} 18 | 19 | \blindtext[5] 20 | 21 | 22 | \chapter{Anleitung zur Formatierung von Flie\"stext} 23 | 24 | \section{Grundlegende Anforderungen an das Textformat} 25 | 26 | Der Inhalt der Abschlussarbeit sollte im Allgemeinen aus zehn Hauptteilen bestehen 27 | \autocite[11]{Schinstock2000}. 28 | \footnote{Test Fu\"snote Nummer 1.} 29 | \footnote{Test Fu\"snote Nummer 2.} 30 | 31 | \section{Wortanzahlanforderungen} 32 | 33 | \subsection{Anforderungen an eine Bachelorarbeit} 34 | 35 | \blindtext[6] 36 | 37 | \section{Zusammenfassung} 38 | 39 | \blindtext[7] 40 | 41 | 42 | \chapter{Anleitung zur Formatierung von Abbildungen, Tabellen und Formeln} 43 | 44 | \section{Anleitung zur Formatierung von Abbildungen} 45 | 46 | \begin{figure}[ht] 47 | \centering 48 | \includegraphics[width=4cm]{example-image.pdf} 49 | \caption{Beispielbild} 50 | \label{fig:example} 51 | \end{figure} 52 | 53 | \begin{ThreePartTable} 54 | \begin{TableNotes} 55 | \item[a] Eine Notiz. 56 | \item[b] Noch eine Notiz. 57 | \end{TableNotes} 58 | \begin{longtable}[c]{c*{6}{r}} 59 | \caption{Experimentelle Daten} 60 | \label{tab:performance} \\ 61 | \toprule 62 | Testprogramm & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{B} 63 | & \multicolumn{1}{c}{C} & \multicolumn{1}{c}{D} 64 | & \multicolumn{1}{c}{E} & \multicolumn{1}{c}{C} \\ 65 | & \multicolumn{1}{c}{Zeit (s)} & \multicolumn{1}{c}{Zeit (s)} 66 | & \multicolumn{1}{c}{Zeit (s)} & \multicolumn{1}{c}{Zeit (s)} 67 | & \multicolumn{1}{c}{Zeit (s)} & Dateigr\"o\"se (KB)\\ 68 | \midrule 69 | \endfirsthead 70 | \multicolumn{7}{r}{\textbf{Tabelle~\thetable~(fortgesetzt)}} \\ 71 | \toprule 72 | Testprogramm & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{B} 73 | & \multicolumn{1}{c}{C} & \multicolumn{1}{c}{D} 74 | & \multicolumn{1}{c}{E} & \multicolumn{1}{c}{C} \\ 75 | & \multicolumn{1}{c}{Zeit (s)} & \multicolumn{1}{c}{Zeit (s)} 76 | & \multicolumn{1}{c}{Zeit (s)} & \multicolumn{1}{c}{Zeit (s)} 77 | & \multicolumn{1}{c}{Zeit (s)} & Dateigr\"o\"se (KB)\\ 78 | \midrule 79 | \endhead 80 | \hline 81 | \endfoot 82 | \insertTableNotes 83 | \endlastfoot 84 | CG.A.2 & 23.05 & 0.002 & 0.116 & 0.035 & 0.589 & 32491 \\ 85 | CG.A.4 & 15.06 & 0.003 & 0.067 & 0.021 & 0.351 & 18211 \\ 86 | CG.A.8 & 13.38 & 0.004 & 0.072 & 0.023 & 0.210 & 9890 \\ 87 | CG.B.2 & 867.45 & 0.002 & 0.864 & 0.232 & 3.256 & 228562 \\ 88 | CG.B.4 & 501.61 & 0.003 & 0.438 & 0.136 & 2.075 & 123862 \\ 89 | CG.B.8 & 384.65 & 0.004 & 0.457 & 0.108 & 1.235 & 63777 \\ 90 | MG.A.2 & 112.27 & 0.002 & 0.846 & 0.237 & 3.930 & 236473 \\ 91 | MG.A.4 & 59.84 & 0.003 & 0.442 & 0.128 & 2.070 & 123875 \\ 92 | MG.A.8 & 31.38 & 0.003 & 0.476 & 0.114 & 1.041 & 60627 \\ 93 | MG.B.2 & 526.28 & 0.002 & 0.821 & 0.238 & 4.176 & 236635 \\ 94 | MG.B.4 & 280.11 & 0.003 & 0.432 & 0.130 & 1.706 & 123793 \\ 95 | MG.B.8 & 148.29 & 0.003 & 0.442 & 0.116 & 0.893 & 60600 \\ 96 | LU.A.2 & 2116.54 & 0.002 & 0.110 & 0.030 & 0.532 & 28754 \\ 97 | LU.A.4 & 1102.50 & 0.002 & 0.069 & 0.017 & 0.255 & 14915 \\ 98 | LU.A.8 & 574.47 & 0.003 & 0.067 & 0.016 & 0.192 & 8655 \\ 99 | LU.B.2 & 9712.87 & 0.002 & 0.357 & 0.104 & 1.734 & 101975 \\ 100 | LU.B.4 & 4757.80 & 0.003 & 0.190 & 0.056 & 0.808 & 53522 \\ 101 | LU.B.8 & 2444.05 & 0.004 & 0.222 & 0.057 & 0.548 & 30134 \\ 102 | EP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1834 \\ 103 | EP.A.4 & 61.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1743 \\ 104 | EP.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1661 \\ 105 | EP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2011 \\ 106 | EP.B.4 & 247.69 & 0.002 & 0.012 & 0.004 & 0.122 & 1663 \\ 107 | EP.B.8 & 126.74 & 0.003 & 0.017 & 0.005 & 0.083 & 1656 \\ 108 | SP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1854 \\ 109 | SP.A.4 & 51.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1543 \\ 110 | SP.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1671 \\ 111 | SP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2411 \\ 112 | SP.B.4 \tnote{a} & 247.69 & 0.002 & 0.014 & 0.006 & 0.152 & 2653 \\ 113 | SP.B.8 \tnote{b} & 126.74 & 0.003 & 0.017 & 0.005 & 0.082 & 1755 \\ 114 | \bottomrule 115 | \end{longtable} 116 | \end{ThreePartTable} 117 | 118 | \section{Formelformat} 119 | 120 | \begin{equation}\label{eq:example} 121 | \frac{1}{\mu}\nabla^2\mathbf{A}-j\omega\sigma\mathbf{A} 122 | -\nabla\left(\frac{1}{\mu}\right)\times(\nabla\times\mathbf{A}) 123 | +\mathbf{J}_0=0 124 | \end{equation} 125 | 126 | \begin{equation} 127 | \int_{a}^b f(x)\,\mathrm{d}x=\lim_{|P|\rightarrow 0}\sum_{i=1}^n f(\xi_i)\increment x_i 128 | \end{equation} 129 | 130 | \section{Codeblock Beispiel} 131 | 132 | \begin{codeblock}[language=C] 133 | #include 134 | #include 135 | #include 136 | #include 137 | 138 | int main() { 139 | pid_t pid; 140 | 141 | switch ((pid = fork())) { 142 | case -1: 143 | printf("fork failed\n"); 144 | break; 145 | case 0: 146 | /* child calls exec */ 147 | execl("/bin/ls", "ls", "-l", (char*)0); 148 | printf("execl failed\n"); 149 | break; 150 | default: 151 | /* parent uses wait to suspend execution until child finishes */ 152 | wait((int*)0); 153 | printf("is completed\n"); 154 | break; 155 | } 156 | return 0; 157 | } 158 | \end{codeblock} 159 | 160 | \section{Algorithmus Beispiel} 161 | 162 | \begin{algorithm}[htb] 163 | \caption{Algorithmus Beispiel} 164 | \label{algo:algorithm} 165 | \small 166 | \SetAlgoLined 167 | \KwData{this text} 168 | \KwResult{how to write algorithm with \LaTeXe } 169 | 170 | initialization\; 171 | \While{not at end of this document}{ 172 | read current\; 173 | \eIf{understand}{ 174 | go to next section\; 175 | current section becomes this one\; 176 | }{ 177 | go back to the beginning of current section\; 178 | } 179 | } 180 | \end{algorithm} 181 | 182 | \section{Zusammenfassung} 183 | 184 | \blindtext[8] 185 | \footnote{Test Fu\"snote Nummer 1.} 186 | \footnote{Test Fu\"snote Nummer 2.} 187 | \footnote{Test Fu\"snote Nummer 3.} 188 | 189 | \chapter{Schlussfolgerungen} 190 | 191 | \section{Hauptergebnisse} 192 | 193 | \blindtext[9] 194 | 195 | \section{Forschungsaussicht} 196 | 197 | \blindtext[10] 198 | 199 | -------------------------------------------------------------------------------- /sjtutex/testfiles/support/common-mainmatter-en.tex: -------------------------------------------------------------------------------- 1 | \chapter{Introduction} 2 | 3 | \section{Foreword} 4 | 5 | \lipsum[1] 6 | 7 | \section{The main content of this paper} 8 | 9 | \lipsum[2] 10 | 11 | \section{The significance of this article} 12 | 13 | \lipsum[3] 14 | 15 | \section{Summary} 16 | 17 | \lipsum[4] 18 | 19 | 20 | \chapter{Guide to Formatting Body Text} 21 | 22 | \section{Basic text format requirements} 23 | 24 | The content of the thesis should generally consist of ten main parts\cite{Jia2000}, in order: 25 | 1. cover 26 | 2. Chinese abstract 27 | 3. English abstract 28 | 4. table of contents 29 | 5. symbol description 30 | 6. thesis body 31 | 7. references 32 | 8. appendices 33 | 9. acknowledgements 34 | 10. published academic papers during degree study 35 | \footnote[1]{Test footnote Number 1.} 36 | \footnote[11]{Test footnote Number 11.} 37 | \footnote[21]{Test footnote Number 21.} 38 | \footnote[32]{Test footnote Number 32.} 39 | \footnote[50]{Test footnote Number 50.} 40 | 41 | \section{Word count requirements} 42 | 43 | \subsection{Undergraduate thesis requirements} 44 | 45 | \lipsum[5] 46 | 47 | \section{Summary} 48 | 49 | \lipsum[6] 50 | 51 | 52 | \chapter{Guide to Formatting Figure, Table and Formula} 53 | 54 | \section{Guide to formatting figure} 55 | 56 | \begin{figure}[ht] 57 | \centering 58 | \includegraphics[width=4cm]{example-image.pdf} 59 | \caption{Example image} 60 | \label{fig:example} 61 | \end{figure} 62 | 63 | \begin{ThreePartTable} 64 | \begin{TableNotes} 65 | \item[a] A note. 66 | \item[b] Another note. 67 | \end{TableNotes} 68 | \begin{longtable}[c]{c*{6}{r}} 69 | \caption{Experimental data} 70 | \label{tab:performance} \\ 71 | \toprule 72 | Test Program & \multicolumn{1}{c}{Run} & \multicolumn{1}{c}{Sync} 73 | & \multicolumn{1}{c}{Checkpoint} & \multicolumn{1}{c}{Rollback} 74 | & \multicolumn{1}{c}{Transfer} & \multicolumn{1}{c}{Checkpoint} \\ 75 | & \multicolumn{1}{c}{Time (s)} & \multicolumn{1}{c}{Time (s)} 76 | & \multicolumn{1}{c}{Time (s)} & \multicolumn{1}{c}{Time (s)} 77 | & \multicolumn{1}{c}{Time (s)} & File Size (KB)\\ 78 | \midrule 79 | \endfirsthead 80 | \multicolumn{7}{r}{\textbf{Table~\thetable~(continued)}} \\ 81 | \toprule 82 | Test Program & \multicolumn{1}{c}{Run} & \multicolumn{1}{c}{Sync} 83 | & \multicolumn{1}{c}{Checkpoint} & \multicolumn{1}{c}{Rollback} 84 | & \multicolumn{1}{c}{Transfer} & \multicolumn{1}{c}{Checkpoint} \\ 85 | & \multicolumn{1}{c}{Time (s)} & \multicolumn{1}{c}{Time (s)} 86 | & \multicolumn{1}{c}{Time (s)} & \multicolumn{1}{c}{Time (s)} 87 | & \multicolumn{1}{c}{Time (s)} & File Size (KB)\\ 88 | \midrule 89 | \endhead 90 | \hline 91 | \endfoot 92 | \insertTableNotes 93 | \endlastfoot 94 | CG.A.2 & 23.05 & 0.002 & 0.116 & 0.035 & 0.589 & 32491 \\ 95 | CG.A.4 & 15.06 & 0.003 & 0.067 & 0.021 & 0.351 & 18211 \\ 96 | CG.A.8 & 13.38 & 0.004 & 0.072 & 0.023 & 0.210 & 9890 \\ 97 | CG.B.2 & 867.45 & 0.002 & 0.864 & 0.232 & 3.256 & 228562 \\ 98 | CG.B.4 & 501.61 & 0.003 & 0.438 & 0.136 & 2.075 & 123862 \\ 99 | CG.B.8 & 384.65 & 0.004 & 0.457 & 0.108 & 1.235 & 63777 \\ 100 | MG.A.2 & 112.27 & 0.002 & 0.846 & 0.237 & 3.930 & 236473 \\ 101 | MG.A.4 & 59.84 & 0.003 & 0.442 & 0.128 & 2.070 & 123875 \\ 102 | MG.A.8 & 31.38 & 0.003 & 0.476 & 0.114 & 1.041 & 60627 \\ 103 | MG.B.2 & 526.28 & 0.002 & 0.821 & 0.238 & 4.176 & 236635 \\ 104 | MG.B.4 & 280.11 & 0.003 & 0.432 & 0.130 & 1.706 & 123793 \\ 105 | MG.B.8 & 148.29 & 0.003 & 0.442 & 0.116 & 0.893 & 60600 \\ 106 | LU.A.2 & 2116.54 & 0.002 & 0.110 & 0.030 & 0.532 & 28754 \\ 107 | LU.A.4 & 1102.50 & 0.002 & 0.069 & 0.017 & 0.255 & 14915 \\ 108 | LU.A.8 & 574.47 & 0.003 & 0.067 & 0.016 & 0.192 & 8655 \\ 109 | LU.B.2 & 9712.87 & 0.002 & 0.357 & 0.104 & 1.734 & 101975 \\ 110 | LU.B.4 & 4757.80 & 0.003 & 0.190 & 0.056 & 0.808 & 53522 \\ 111 | LU.B.8 & 2444.05 & 0.004 & 0.222 & 0.057 & 0.548 & 30134 \\ 112 | EP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1834 \\ 113 | EP.A.4 & 61.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1743 \\ 114 | EP.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1661 \\ 115 | EP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2011 \\ 116 | EP.B.4 & 247.69 & 0.002 & 0.012 & 0.004 & 0.122 & 1663 \\ 117 | EP.B.8 & 126.74 & 0.003 & 0.017 & 0.005 & 0.083 & 1656 \\ 118 | SP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1854 \\ 119 | SP.A.4 & 51.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1543 \\ 120 | SP.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1671 \\ 121 | SP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2411 \\ 122 | SP.B.4 \tnote{a} & 247.69 & 0.002 & 0.014 & 0.006 & 0.152 & 2653 \\ 123 | SP.B.8 \tnote{b} & 126.74 & 0.003 & 0.017 & 0.005 & 0.082 & 1755 \\ 124 | \bottomrule 125 | \end{longtable} 126 | \end{ThreePartTable} 127 | 128 | \section{Formula format} 129 | 130 | \begin{equation}\label{eq:example} 131 | \frac{1}{\mu}\nabla^2\mathbf{A}-j\omega\sigma\mathbf{A} 132 | -\nabla\left(\frac{1}{\mu}\right)\times(\nabla\times\mathbf{A}) 133 | +\mathbf{J}_0=0 134 | \end{equation} 135 | 136 | \begin{equation} 137 | \int_{a}^b f(x)\,\mathrm{d}x=\lim_{|P|\rightarrow 0}\sum_{i=1}^n f(\xi_i)\increment x_i 138 | \end{equation} 139 | 140 | \section{Codeblock Example} 141 | 142 | \begin{codeblock}[language=C] 143 | #include 144 | #include 145 | #include 146 | #include 147 | 148 | int main() { 149 | pid_t pid; 150 | 151 | switch ((pid = fork())) { 152 | case -1: 153 | printf("fork failed\n"); 154 | break; 155 | case 0: 156 | /* child calls exec */ 157 | execl("/bin/ls", "ls", "-l", (char*)0); 158 | printf("execl failed\n"); 159 | break; 160 | default: 161 | /* parent uses wait to suspend execution until child finishes */ 162 | wait((int*)0); 163 | printf("is completed\n"); 164 | break; 165 | } 166 | return 0; 167 | } 168 | \end{codeblock} 169 | 170 | \section{Algorithm Example} 171 | 172 | \begin{algorithm}[htb] 173 | \caption{Algorithm Example} 174 | \label{algo:algorithm} 175 | \small 176 | \SetAlgoLined 177 | \KwData{this text} 178 | \KwResult{how to write algorithm with \LaTeXe } 179 | 180 | initialization\; 181 | \While{not at end of this document}{ 182 | read current\; 183 | \eIf{understand}{ 184 | go to next section\; 185 | current section becomes this one\; 186 | }{ 187 | go back to the beginning of current section\; 188 | } 189 | } 190 | \end{algorithm} 191 | 192 | \section{Summary} 193 | 194 | \lipsum[7] 195 | 196 | \chapter{Conclusions} 197 | 198 | \section{Main conclusions} 199 | 200 | \lipsum[8] 201 | 202 | \section{Research outlook} 203 | 204 | \lipsum[9] 205 | 206 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The LaTeX Project Public License 2 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 3 | 4 | LPPL Version 1.3c 2008-05-04 5 | 6 | Copyright 1999 2002-2008 LaTeX3 Project 7 | Everyone is allowed to distribute verbatim copies of this 8 | license document, but modification of it is not allowed. 9 | 10 | 11 | PREAMBLE 12 | ======== 13 | 14 | The LaTeX Project Public License (LPPL) is the primary license under 15 | which the LaTeX kernel and the base LaTeX packages are distributed. 16 | 17 | You may use this license for any work of which you hold the copyright 18 | and which you wish to distribute. This license may be particularly 19 | suitable if your work is TeX-related (such as a LaTeX package), but 20 | it is written in such a way that you can use it even if your work is 21 | unrelated to TeX. 22 | 23 | The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', 24 | below, gives instructions, examples, and recommendations for authors 25 | who are considering distributing their works under this license. 26 | 27 | This license gives conditions under which a work may be distributed 28 | and modified, as well as conditions under which modified versions of 29 | that work may be distributed. 30 | 31 | We, the LaTeX3 Project, believe that the conditions below give you 32 | the freedom to make and distribute modified versions of your work 33 | that conform with whatever technical specifications you wish while 34 | maintaining the availability, integrity, and reliability of 35 | that work. If you do not see how to achieve your goal while 36 | meeting these conditions, then read the document `cfgguide.tex' 37 | and `modguide.tex' in the base LaTeX distribution for suggestions. 38 | 39 | 40 | DEFINITIONS 41 | =========== 42 | 43 | In this license document the following terms are used: 44 | 45 | `Work' 46 | Any work being distributed under this License. 47 | 48 | `Derived Work' 49 | Any work that under any applicable law is derived from the Work. 50 | 51 | `Modification' 52 | Any procedure that produces a Derived Work under any applicable 53 | law -- for example, the production of a file containing an 54 | original file associated with the Work or a significant portion of 55 | such a file, either verbatim or with modifications and/or 56 | translated into another language. 57 | 58 | `Modify' 59 | To apply any procedure that produces a Derived Work under any 60 | applicable law. 61 | 62 | `Distribution' 63 | Making copies of the Work available from one person to another, in 64 | whole or in part. Distribution includes (but is not limited to) 65 | making any electronic components of the Work accessible by 66 | file transfer protocols such as FTP or HTTP or by shared file 67 | systems such as Sun's Network File System (NFS). 68 | 69 | `Compiled Work' 70 | A version of the Work that has been processed into a form where it 71 | is directly usable on a computer system. This processing may 72 | include using installation facilities provided by the Work, 73 | transformations of the Work, copying of components of the Work, or 74 | other activities. Note that modification of any installation 75 | facilities provided by the Work constitutes modification of the Work. 76 | 77 | `Current Maintainer' 78 | A person or persons nominated as such within the Work. If there is 79 | no such explicit nomination then it is the `Copyright Holder' under 80 | any applicable law. 81 | 82 | `Base Interpreter' 83 | A program or process that is normally needed for running or 84 | interpreting a part or the whole of the Work. 85 | 86 | A Base Interpreter may depend on external components but these 87 | are not considered part of the Base Interpreter provided that each 88 | external component clearly identifies itself whenever it is used 89 | interactively. Unless explicitly specified when applying the 90 | license to the Work, the only applicable Base Interpreter is a 91 | `LaTeX-Format' or in the case of files belonging to the 92 | `LaTeX-format' a program implementing the `TeX language'. 93 | 94 | 95 | 96 | CONDITIONS ON DISTRIBUTION AND MODIFICATION 97 | =========================================== 98 | 99 | 1. Activities other than distribution and/or modification of the Work 100 | are not covered by this license; they are outside its scope. In 101 | particular, the act of running the Work is not restricted and no 102 | requirements are made concerning any offers of support for the Work. 103 | 104 | 2. You may distribute a complete, unmodified copy of the Work as you 105 | received it. Distribution of only part of the Work is considered 106 | modification of the Work, and no right to distribute such a Derived 107 | Work may be assumed under the terms of this clause. 108 | 109 | 3. You may distribute a Compiled Work that has been generated from a 110 | complete, unmodified copy of the Work as distributed under Clause 2 111 | above, as long as that Compiled Work is distributed in such a way that 112 | the recipients may install the Compiled Work on their system exactly 113 | as it would have been installed if they generated a Compiled Work 114 | directly from the Work. 115 | 116 | 4. If you are the Current Maintainer of the Work, you may, without 117 | restriction, modify the Work, thus creating a Derived Work. You may 118 | also distribute the Derived Work without restriction, including 119 | Compiled Works generated from the Derived Work. Derived Works 120 | distributed in this manner by the Current Maintainer are considered to 121 | be updated versions of the Work. 122 | 123 | 5. If you are not the Current Maintainer of the Work, you may modify 124 | your copy of the Work, thus creating a Derived Work based on the Work, 125 | and compile this Derived Work, thus creating a Compiled Work based on 126 | the Derived Work. 127 | 128 | 6. If you are not the Current Maintainer of the Work, you may 129 | distribute a Derived Work provided the following conditions are met 130 | for every component of the Work unless that component clearly states 131 | in the copyright notice that it is exempt from that condition. Only 132 | the Current Maintainer is allowed to add such statements of exemption 133 | to a component of the Work. 134 | 135 | a. If a component of this Derived Work can be a direct replacement 136 | for a component of the Work when that component is used with the 137 | Base Interpreter, then, wherever this component of the Work 138 | identifies itself to the user when used interactively with that 139 | Base Interpreter, the replacement component of this Derived Work 140 | clearly and unambiguously identifies itself as a modified version 141 | of this component to the user when used interactively with that 142 | Base Interpreter. 143 | 144 | b. Every component of the Derived Work contains prominent notices 145 | detailing the nature of the changes to that component, or a 146 | prominent reference to another file that is distributed as part 147 | of the Derived Work and that contains a complete and accurate log 148 | of the changes. 149 | 150 | c. No information in the Derived Work implies that any persons, 151 | including (but not limited to) the authors of the original version 152 | of the Work, provide any support, including (but not limited to) 153 | the reporting and handling of errors, to recipients of the 154 | Derived Work unless those persons have stated explicitly that 155 | they do provide such support for the Derived Work. 156 | 157 | d. You distribute at least one of the following with the Derived Work: 158 | 159 | 1. A complete, unmodified copy of the Work; 160 | if your distribution of a modified component is made by 161 | offering access to copy the modified component from a 162 | designated place, then offering equivalent access to copy 163 | the Work from the same or some similar place meets this 164 | condition, even though third parties are not compelled to 165 | copy the Work along with the modified component; 166 | 167 | 2. Information that is sufficient to obtain a complete, 168 | unmodified copy of the Work. 169 | 170 | 7. If you are not the Current Maintainer of the Work, you may 171 | distribute a Compiled Work generated from a Derived Work, as long as 172 | the Derived Work is distributed to all recipients of the Compiled 173 | Work, and as long as the conditions of Clause 6, above, are met with 174 | regard to the Derived Work. 175 | 176 | 8. The conditions above are not intended to prohibit, and hence do not 177 | apply to, the modification, by any method, of any component so that it 178 | becomes identical to an updated version of that component of the Work as 179 | it is distributed by the Current Maintainer under Clause 4, above. 180 | 181 | 9. Distribution of the Work or any Derived Work in an alternative 182 | format, where the Work or that Derived Work (in whole or in part) is 183 | then produced by applying some process to that format, does not relax or 184 | nullify any sections of this license as they pertain to the results of 185 | applying that process. 186 | 187 | 10. a. A Derived Work may be distributed under a different license 188 | provided that license itself honors the conditions listed in 189 | Clause 6 above, in regard to the Work, though it does not have 190 | to honor the rest of the conditions in this license. 191 | 192 | b. If a Derived Work is distributed under a different license, that 193 | Derived Work must provide sufficient documentation as part of 194 | itself to allow each recipient of that Derived Work to honor the 195 | restrictions in Clause 6 above, concerning changes from the Work. 196 | 197 | 11. This license places no restrictions on works that are unrelated to 198 | the Work, nor does this license place any restrictions on aggregating 199 | such works with the Work by any means. 200 | 201 | 12. Nothing in this license is intended to, or may be used to, prevent 202 | complete compliance by all parties with all applicable laws. 203 | 204 | 205 | NO WARRANTY 206 | =========== 207 | 208 | There is no warranty for the Work. Except when otherwise stated in 209 | writing, the Copyright Holder provides the Work `as is', without 210 | warranty of any kind, either expressed or implied, including, but not 211 | limited to, the implied warranties of merchantability and fitness for a 212 | particular purpose. The entire risk as to the quality and performance 213 | of the Work is with you. Should the Work prove defective, you assume 214 | the cost of all necessary servicing, repair, or correction. 215 | 216 | In no event unless required by applicable law or agreed to in writing 217 | will The Copyright Holder, or any author named in the components of the 218 | Work, or any other party who may distribute and/or modify the Work as 219 | permitted above, be liable to you for damages, including any general, 220 | special, incidental or consequential damages arising out of any use of 221 | the Work or out of inability to use the Work (including, but not limited 222 | to, loss of data, data being rendered inaccurate, or losses sustained by 223 | anyone as a result of any failure of the Work to operate with any other 224 | programs), even if the Copyright Holder or said author or said other 225 | party has been advised of the possibility of such damages. 226 | 227 | 228 | MAINTENANCE OF THE WORK 229 | ======================= 230 | 231 | The Work has the status `author-maintained' if the Copyright Holder 232 | explicitly and prominently states near the primary copyright notice in 233 | the Work that the Work can only be maintained by the Copyright Holder 234 | or simply that it is `author-maintained'. 235 | 236 | The Work has the status `maintained' if there is a Current Maintainer 237 | who has indicated in the Work that they are willing to receive error 238 | reports for the Work (for example, by supplying a valid e-mail 239 | address). It is not required for the Current Maintainer to acknowledge 240 | or act upon these error reports. 241 | 242 | The Work changes from status `maintained' to `unmaintained' if there 243 | is no Current Maintainer, or the person stated to be Current 244 | Maintainer of the work cannot be reached through the indicated means 245 | of communication for a period of six months, and there are no other 246 | significant signs of active maintenance. 247 | 248 | You can become the Current Maintainer of the Work by agreement with 249 | any existing Current Maintainer to take over this role. 250 | 251 | If the Work is unmaintained, you can become the Current Maintainer of 252 | the Work through the following steps: 253 | 254 | 1. Make a reasonable attempt to trace the Current Maintainer (and 255 | the Copyright Holder, if the two differ) through the means of 256 | an Internet or similar search. 257 | 258 | 2. If this search is successful, then enquire whether the Work 259 | is still maintained. 260 | 261 | a. If it is being maintained, then ask the Current Maintainer 262 | to update their communication data within one month. 263 | 264 | b. If the search is unsuccessful or no action to resume active 265 | maintenance is taken by the Current Maintainer, then announce 266 | within the pertinent community your intention to take over 267 | maintenance. (If the Work is a LaTeX work, this could be 268 | done, for example, by posting to comp.text.tex.) 269 | 270 | 3a. If the Current Maintainer is reachable and agrees to pass 271 | maintenance of the Work to you, then this takes effect 272 | immediately upon announcement. 273 | 274 | b. If the Current Maintainer is not reachable and the Copyright 275 | Holder agrees that maintenance of the Work be passed to you, 276 | then this takes effect immediately upon announcement. 277 | 278 | 4. If you make an `intention announcement' as described in 2b. above 279 | and after three months your intention is challenged neither by 280 | the Current Maintainer nor by the Copyright Holder nor by other 281 | people, then you may arrange for the Work to be changed so as 282 | to name you as the (new) Current Maintainer. 283 | 284 | 5. If the previously unreachable Current Maintainer becomes 285 | reachable once more within three months of a change completed 286 | under the terms of 3b) or 4), then that Current Maintainer must 287 | become or remain the Current Maintainer upon request provided 288 | they then update their communication data within one month. 289 | 290 | A change in the Current Maintainer does not, of itself, alter the fact 291 | that the Work is distributed under the LPPL license. 292 | 293 | If you become the Current Maintainer of the Work, you should 294 | immediately provide, within the Work, a prominent and unambiguous 295 | statement of your status as Current Maintainer. You should also 296 | announce your new status to the same pertinent community as 297 | in 2b) above. 298 | 299 | 300 | WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE 301 | ====================================================== 302 | 303 | This section contains important instructions, examples, and 304 | recommendations for authors who are considering distributing their 305 | works under this license. These authors are addressed as `you' in 306 | this section. 307 | 308 | Choosing This License or Another License 309 | ---------------------------------------- 310 | 311 | If for any part of your work you want or need to use *distribution* 312 | conditions that differ significantly from those in this license, then 313 | do not refer to this license anywhere in your work but, instead, 314 | distribute your work under a different license. You may use the text 315 | of this license as a model for your own license, but your license 316 | should not refer to the LPPL or otherwise give the impression that 317 | your work is distributed under the LPPL. 318 | 319 | The document `modguide.tex' in the base LaTeX distribution explains 320 | the motivation behind the conditions of this license. It explains, 321 | for example, why distributing LaTeX under the GNU General Public 322 | License (GPL) was considered inappropriate. Even if your work is 323 | unrelated to LaTeX, the discussion in `modguide.tex' may still be 324 | relevant, and authors intending to distribute their works under any 325 | license are encouraged to read it. 326 | 327 | A Recommendation on Modification Without Distribution 328 | ----------------------------------------------------- 329 | 330 | It is wise never to modify a component of the Work, even for your own 331 | personal use, without also meeting the above conditions for 332 | distributing the modified component. While you might intend that such 333 | modifications will never be distributed, often this will happen by 334 | accident -- you may forget that you have modified that component; or 335 | it may not occur to you when allowing others to access the modified 336 | version that you are thus distributing it and violating the conditions 337 | of this license in ways that could have legal implications and, worse, 338 | cause problems for the community. It is therefore usually in your 339 | best interest to keep your copy of the Work identical with the public 340 | one. Many works provide ways to control the behavior of that work 341 | without altering any of its licensed components. 342 | 343 | How to Use This License 344 | ----------------------- 345 | 346 | To use this license, place in each of the components of your work both 347 | an explicit copyright notice including your name and the year the work 348 | was authored and/or last substantially modified. Include also a 349 | statement that the distribution and/or modification of that 350 | component is constrained by the conditions in this license. 351 | 352 | Here is an example of such a notice and statement: 353 | 354 | %% pig.dtx 355 | %% Copyright 2008 M. Y. Name 356 | % 357 | % This work may be distributed and/or modified under the 358 | % conditions of the LaTeX Project Public License, either version 1.3 359 | % of this license or (at your option) any later version. 360 | % The latest version of this license is in 361 | % https://www.latex-project.org/lppl.txt 362 | % and version 1.3c or later is part of all distributions of LaTeX 363 | % version 2008 or later. 364 | % 365 | % This work has the LPPL maintenance status `maintained'. 366 | % 367 | % The Current Maintainer of this work is M. Y. Name. 368 | % 369 | % This work consists of the files pig.dtx and pig.ins 370 | % and the derived file pig.sty. 371 | 372 | Given such a notice and statement in a file, the conditions 373 | given in this license document would apply, with the `Work' referring 374 | to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being 375 | generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' 376 | referring to any `LaTeX-Format', and both `Copyright Holder' and 377 | `Current Maintainer' referring to the person `M. Y. Name'. 378 | 379 | If you do not want the Maintenance section of LPPL to apply to your 380 | Work, change `maintained' above into `author-maintained'. 381 | However, we recommend that you use `maintained', as the Maintenance 382 | section was added in order to ensure that your Work remains useful to 383 | the community even when you can no longer maintain and support it 384 | yourself. 385 | 386 | Derived Works That Are Not Replacements 387 | --------------------------------------- 388 | 389 | Several clauses of the LPPL specify means to provide reliability and 390 | stability for the user community. They therefore concern themselves 391 | with the case that a Derived Work is intended to be used as a 392 | (compatible or incompatible) replacement of the original Work. If 393 | this is not the case (e.g., if a few lines of code are reused for a 394 | completely different task), then clauses 6b and 6d shall not apply. 395 | 396 | 397 | Important Recommendations 398 | ------------------------- 399 | 400 | Defining What Constitutes the Work 401 | 402 | The LPPL requires that distributions of the Work contain all the 403 | files of the Work. It is therefore important that you provide a 404 | way for the licensee to determine which files constitute the Work. 405 | This could, for example, be achieved by explicitly listing all the 406 | files of the Work near the copyright notice of each file or by 407 | using a line such as: 408 | 409 | % This work consists of all files listed in manifest.txt. 410 | 411 | in that place. In the absence of an unequivocal list it might be 412 | impossible for the licensee to determine what is considered by you 413 | to comprise the Work and, in such a case, the licensee would be 414 | entitled to make reasonable conjectures as to which files comprise 415 | the Work. 416 | -------------------------------------------------------------------------------- /sjtutex/support/ctxdoc.cls: -------------------------------------------------------------------------------- 1 | %% 2 | %% File ctxdoc.cls 3 | %% 4 | %% Copyright (C) 2016--2022 5 | %% CTEX.ORG and any individual authors listed in the documentation. 6 | %%--------------------------------------------------------------------- 7 | %% 8 | %% This work may be distributed and/or modified under the 9 | %% conditions of the LaTeX Project Public License, either 10 | %% version 1.3c of this license or (at your option) any later 11 | %% version. This version of this license is in 12 | %% http://www.latex-project.org/lppl/lppl-1-3c.txt 13 | %% and the latest version of this license is in 14 | %% http://www.latex-project.org/lppl.txt 15 | %% and version 1.3 or later is part of all distributions of 16 | %% LaTeX version 2005/12/01 or later. 17 | %% 18 | %% This work has the LPPL maintenance status "maintained". 19 | %% 20 | %%--------------------------------------------------------------------- 21 | %% 22 | \NeedsTeXFormat{LaTeX2e} 23 | \RequirePackage{expl3} 24 | \GetIdInfo$Id$ 25 | {ctex documentation (CTEX)} 26 | \ProvidesExplClass{ctxdoc}{\ExplFileDate}{}{\ExplFileDescription} 27 | \ExplSyntaxOff 28 | \DeclareOption*{\PassOptionsToClass{\CurrentOption}{l3doc}} 29 | \PassOptionsToClass{a4paper,full}{l3doc} 30 | \ProcessOptions 31 | \LoadClass{l3doc}[2023-10-10] 32 | \RequirePackage[UTF8, punct=kaiming, heading, linespread=1.2, sub3section]{ctex} 33 | \ctexset{ 34 | abstractname = 简介, 35 | indexname = 代码索引, 36 | section/format = \Large\bfseries\raggedright, 37 | section/name = {第,节}, 38 | } 39 | \RequirePackage[toc]{multitoc} 40 | \RequirePackage{geometry} 41 | \RequirePackage{tabularx} 42 | \RequirePackage{makecell} 43 | \RequirePackage{threeparttable} 44 | \RequirePackage{siunitx} 45 | \RequirePackage{unicode-math} 46 | \RequirePackage{xcolor} 47 | \RequirePackage{caption} 48 | \RequirePackage{fancyvrb-ex} 49 | \RequirePackage{zref-base} 50 | \geometry{includemp, hmargin={0mm,15mm}, vmargin={25mm,15mm}, footskip=7mm} 51 | \hypersetup{pdfstartview=FitH, bookmarksdepth=subparagraph} 52 | \setcounter{secnumdepth}{4} 53 | \setcounter{tocdepth}{2} 54 | \newcommand*\email{\nolinkurl} 55 | \setmainfont{texgyrepagella}[ 56 | Extension = .otf, 57 | UprightFont = *-regular, 58 | BoldFont = *-bold, 59 | ItalicFont = *-italic, 60 | BoldItalicFont = *-bolditalic] 61 | \setsansfont{texgyreheros}[ 62 | Extension = .otf, 63 | UprightFont = *-regular, 64 | BoldFont = *-bold, 65 | ItalicFont = *-italic, 66 | BoldItalicFont = *-bolditalic] 67 | \setmonofont{cmun}[ 68 | Extension = .otf, 69 | UprightFont = *btl, 70 | BoldFont = *tb, 71 | ItalicFont = *bto, 72 | BoldItalicFont = *tx, 73 | HyphenChar = None] 74 | \setmathfont{texgyrepagella-math.otf} 75 | \captionsetup{% 76 | strut=off, labelsep=quad, labelfont+=bf, 77 | figureposition = bottom, tableposition = top} 78 | %% <--- http://tex.stackexchange.com/a/40896 79 | \patchcmd{\@addtocurcol}% 80 | {\vskip \intextsep}% 81 | {\edef\save@first@penalty{\the\lastpenalty}\unpenalty 82 | \ifnum \lastpenalty = \@M % hopefully the OR penalty 83 | \unpenalty 84 | \else 85 | \penalty \save@first@penalty \relax % put it back 86 | \fi 87 | \ifnum\outputpenalty <-\@Mii 88 | \addvspace\intextsep 89 | \vskip\parskip 90 | \else 91 | \addvspace\intextsep 92 | \fi}% 93 | {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}} 94 | \patchcmd{\@addtocurcol}% 95 | {\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}% 96 | {\ifnum\outputpenalty <-\@Mii 97 | \aftergroup\vskip\aftergroup\intextsep 98 | \aftergroup\nointerlineskip 99 | \else 100 | \vskip\intextsep 101 | \fi}% 102 | {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}} 103 | \patchcmd{\@getpen}{\@M}{\@Mi} 104 | {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}} 105 | %% ---> 106 | %% 不对代码实现的 \section 以下标题编目录。 107 | \AtBeginEnvironment{implementation}{% 108 | \ifnum\value{tocdepth}>\@ne 109 | \addtocontents{toc}{\protect\value{tocdepth}=1\relax}% 110 | \fi} 111 | \ifxetex 112 | \let\ctexdocverbaddon\xeCJKVerbAddon 113 | \def\ctexdisableecglue{\xeCJKsetup{CJKecglue}} 114 | \def\ctexplainps{\xeCJKsetup{PunctStyle=plain}} 115 | \appto\meta@font@select{\ifinner\ctexdisableecglue\fi} 116 | \else 117 | \let\ctexdocverbaddon\relax 118 | \let\ctexplainps\relax 119 | \def\ctexdisableecglue{\ltjsetparameter{autoxspacing=false}} 120 | \appto\meta@font@select{\ctexdisableecglue} 121 | \fi 122 | \setlist{noitemsep,topsep=\smallskipamount} 123 | \setlist[1]{labelindent=\parindent} 124 | \setlist[enumerate]{leftmargin=*} 125 | \setlist[itemize]{leftmargin=*} 126 | \setlist[trivlist]{topsep=\medskipamount} 127 | \renewlist{arguments}{enumerate}{1} 128 | \setlist[arguments]{nolistsep, 129 | leftmargin=\parindent, labelindent=0pt, labelsep=*, 130 | label=\texttt{\#\arabic*}\,:} 131 | \newlist{optdesc}{description}{3} 132 | %% 设置间距为 \marginparsep,与 l3doc 一致 133 | \setlist[optdesc]{% 134 | font=\mdseries\small\ttfamily,align=right,listparindent=\parindent, 135 | labelsep=\marginparsep,labelindent=-\marginparsep,leftmargin=0pt} 136 | %% 重新定义 threeparttable 包的 tablenotes 环境 137 | \renewlist{tablenotes}{description}{1} 138 | \setlist[tablenotes]{% 139 | format=\normalfont\tnote@item,align=right,listparindent=\parindent, 140 | labelindent=\tabcolsep,leftmargin=*,rightmargin=\tabcolsep, 141 | after=\@noparlisttrue} 142 | \AtBeginEnvironment{tablenotes}{% 143 | \setlength\parindent{2\ccwd}% 144 | \normalfont\footnotesize} 145 | \AtBeginEnvironment{threeparttable}{% 146 | \stepcounter{tpt@id}% 147 | \edef\curr@tpt@id{tpt@\arabic{tpt@id}}} 148 | \newcounter{tpt@id} 149 | \def\tnote@item#1{% 150 | \Hy@raisedlink{\hyper@anchor{\curr@tpt@id-#1}}#1} 151 | \def\TPTtagStyle#1{\hyperlink{\curr@tpt@id-#1}{#1}} 152 | \fvset{ 153 | fontsize=\small,baselinestretch=1,numbersep=5pt, 154 | formatcom=\ctexdocverbaddon, 155 | listparameters=\setlength\topsep{\MacrocodeTopsep}} 156 | \DefineVerbatimEnvironment{frameverb}{Verbatim}{% 157 | gobble=4, 158 | frame=single,framesep=8pt, 159 | listparameters= 160 | \setlength\topsep{\medskipamount}% 161 | \appto\FV@EndList{\nointerlineskip}} 162 | \DefineVerbatimEnvironment{ctexexam}{Verbatim}{% 163 | gobble=4, 164 | frame=single,framesep=10pt, 165 | label=\rule{0pt}{12pt}\textnormal{\bfseries 例 \arabic{ctexexam}}, 166 | listparameters= 167 | \setlength\topsep{\bigskipamount}% 168 | \refstepcounter{ctexexam}\ctexexamlabelref 169 | \appto\FV@EndList{\nointerlineskip}} 170 | \define@key{FV}{labelref}{\def\ctexexamlabelref{\label{#1}}} 171 | \let\ctexexamlabelref\empty 172 | \newcounter{ctexexam} 173 | \AtEndEnvironment{function}{\ctexsetverticalspacing} 174 | \AfterEndEnvironment{function}{\ctexfixverticalspacing} 175 | \AtBeginEnvironment{syntax}{\linespread{1}\ctexplainps\ctexdisableecglue} 176 | \newrobustcmd\exptarget{% 177 | \AddLineBeginMainAux{\csgdef{Codedoc@expstar}{}}% 178 | \Hy@raisedlink{\hypertarget{expstar}{}}} 179 | \newrobustcmd\rexptarget{% 180 | \AddLineBeginMainAux{\csgdef{Codedoc@rexpstar}{}}% 181 | \Hy@raisedlink{\hypertarget{rexpstar}{}}} 182 | \newrobustcmd\expstar{\hyperlink{expstar}{$\star$}} 183 | \newrobustcmd\rexpstar{\hyperlink{rexpstar}{\ding{73}}} 184 | \ExplSyntaxOn 185 | \cs_new_protected:Npn \ctexsetverticalspacing 186 | { 187 | \par 188 | \tl_gset:Nx \ctexfixverticalspacing 189 | { \dim_set:Nn \prevdepth { \dim_use:N \prevdepth } } 190 | \int_compare:nNnT \lastnodetype = { 11 } 191 | { 192 | \tl_gput_right:Nx \ctexfixverticalspacing 193 | { \exp_not:N \skip_vertical:n { \skip_use:N \lastskip } } 194 | \unskip 195 | } 196 | } 197 | \tl_new:N \ctexfixverticalspacing 198 | \NewDocumentCommand \SideBySideExampleSet { } 199 | { \prop_put_from_keyval:Nn \l__ctxdoc_side_example_prop } 200 | \prop_new:N \l__ctxdoc_side_example_prop 201 | \prop_set_from_keyval:Nn \l__ctxdoc_side_example_prop 202 | { frame=single, numbers=left, gobble=5, xrightmargin=.5\linewidth } 203 | \tl_put_left:Nn \SideBySideExample 204 | { 205 | \trivlist \item \relax 206 | \exp_args:Ne \fvset 207 | { \prop_to_keyval:N \l__ctxdoc_side_example_prop } 208 | } 209 | \tl_put_right:Nn \endSideBySideExample 210 | { \endtrivlist } 211 | \ctex_patch_cmd:Nnn \__codedoc_function_typeset_start: 212 | { \bigskip } 213 | { \nointerlineskip \addvspace { \bigskipamount } } 214 | %% l3doc 会设置列表环境中 \listparindent=\z@,我们在这里恢复它。 215 | \cs_set_eq:NN \list \__codedoc_oldlist:nn 216 | \cs_new_nopar:Npn \zihaopt #1 217 | { 218 | \exp_last_unbraced:Nf \tl_head:w 219 | { \prop_item:Nn \c__ctex_font_size_prop {#1} } { } \q_stop 220 | } 221 | %% 抑制首段的 \parskip 222 | \ctex_patch_cmd_once:NnnnTF \__codedoc_function_descr_start:w 223 | { } 224 | { \noindent } 225 | { \skip_vertical:n { -\parskip } \noindent } 226 | { \iow_term:n { *** ~ SUCCESS ~ *** } } 227 | { \iow_term:n { *** ~ FAIL ~ *** } } 228 | %% l3doc 会在 function 环境的 syntax 和 descr 盒子中间加上 \medskipamount 的距离。 229 | %% 但是若 syntax 盒子为空(未使用 syntax 环境),就会显得不好看。 230 | %% 此时我们通过将 \medskipamount 设置为零来修正。若盒子非空,则将 \parskip 还回去。 231 | \ctex_preto_cmd:NnnTF \__codedoc_function_assemble: 232 | { } 233 | { \ctex_doc_fix_yoffset: } 234 | { \iow_term:n { *** ~ SUCCESS ~ *** } } 235 | { \iow_term:n { *** ~ FAIL ~ *** } } 236 | \cs_new_protected_nopar:Npn \ctex_doc_fix_yoffset: 237 | { 238 | \box_if_empty:NTF \g__codedoc_syntax_box 239 | { \skip_zero:N \medskipamount } 240 | { \skip_add:Nn \medskipamount { \parskip } } 241 | } 242 | %% 左侧边注的函数列表采用单倍行距 243 | \ctex_preto_cmd:NnnTF \__codedoc_typeset_functions: 244 | { } 245 | { \MacroFont } 246 | { \iow_term:n { *** ~ SUCCESS ~ *** } } 247 | { \iow_term:n { *** ~ FAIL ~ *** } } 248 | \ctex_patch_cmd_once:NnnnTF \__codedoc_macro_init: 249 | { } 250 | { \hbox:n } 251 | { \MacroFont \hbox:n } 252 | { \iow_term:n { *** ~ SUCCESS ~ *** } } 253 | { \iow_term:n { *** ~ FAIL ~ *** } } 254 | \ctex_patch_cmd_once:NnnnTF \__codedoc_macro_dump: 255 | { } 256 | { \hbox_unpack_drop:N } 257 | { \MacroFont \hbox_unpack_drop:N } 258 | { \iow_term:n { *** ~ SUCCESS ~ *** } } 259 | { \iow_term:n { *** ~ FAIL ~ *** } } 260 | \cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n 261 | \cs_set_protected:Npn \__codedoc_macro_typeset_one:nN #1#2 262 | { 263 | \vbox_set:Nn \l__codedoc_macro_box 264 | { 265 | \MacroFont 266 | \vbox_unpack_drop:N \l__codedoc_macro_box 267 | \hbox_set:Nn \l_tmpa_box 268 | { \__codedoc_print_macroname:nN {#1} #2 } 269 | \dim_set:Nn \l_tmpa_dim { \marginparwidth - \labelsep } 270 | \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > \l_tmpa_dim 271 | { 272 | \box_resize_to_wd_and_ht:Nnn \l_tmpa_box 273 | { \l_tmpa_dim } 274 | { \box_ht:N \l_tmpa_box } 275 | } 276 | \hbox_overlap_left:n 277 | { 278 | \box_use:N \l_tmpa_box 279 | \skip_horizontal:n { \marginparsep - \labelsep } 280 | } 281 | } 282 | \int_incr:N \l__codedoc_macro_int 283 | } 284 | \cs_set_protected:Npn \__codedoc_print_macroname:nN #1#2 285 | { 286 | \strut 287 | \__codedoc_get_hyper_target:eN 288 | { 289 | \exp_not:n {#1} 290 | \bool_if:NT #2 { \tl_to_str:n {TF} } 291 | } 292 | \l__codedoc_tmpa_tl 293 | \cs_if_exist:cTF { r@ \l__codedoc_tmpa_tl } 294 | { \exp_args:NNo \label@hyperref [ \l__codedoc_tmpa_tl ] } 295 | { \use:n } 296 | { 297 | \tl_set:Nn \l__codedoc_tmpa_tl {#1} 298 | \tl_replace_all:NVn \l__codedoc_tmpa_tl 299 | \c_catcode_other_space_tl 300 | { \fontspec_visible_space: } 301 | \__codedoc_print_macroname_aux:on 302 | \l__codedoc_tmpa_tl { \bool_if:NT #2 { \__codedoc_typeset_TF: } } 303 | } 304 | } 305 | \AtBeginEnvironment { syntax } 306 | { 307 | \char_set_catcode_active:N \| 308 | \char_set_active_eq:NN \| \orbar 309 | \char_set_catcode_active:N \( 310 | \char_set_active_eq:NN \( \defaultvalaux 311 | } 312 | %% 不对目录中出现的 \cs 和 \tn 等编索引 313 | \DeclareDocumentCommand \StopSpecialIndexModule { } 314 | { \cs_set_eq:NN \__codedoc_special_index_module:nnnnN \use_none:nnnnn } 315 | \tl_map_inline:nn { \actualchar \encapchar \levelchar } 316 | { \exp_args:Nx \DoNotIndex { \bslash \tl_to_str:N #1 } } 317 | \DeclareDocumentCommand \package { o m } 318 | { 319 | \exp_args:Nx \href 320 | { 321 | http \c_colon_str //www.ctan.org/pkg/ 322 | \IfNoValueTF {#1} { \str_lowercase:n {#2} } {#1} 323 | } 324 | { \pkg {#2} } 325 | } 326 | \DeclareDocumentCommand \GetFileId { m } 327 | { 328 | \GetFileInfo {#1} 329 | \file_get:nnNTF { \c_sys_jobname_str .id } 330 | { \int_set:Nn \tex_endlinechar:D { -1 } } \l__ctxdoc_tmp_tl 331 | { \tl_if_empty:NTF \l__ctxdoc_tmp_tl } 332 | { \use_i:nn } 333 | { \GetIdInfo $Id$ } 334 | { \exp_after:wN \GetIdInfo \l__ctxdoc_tmp_tl } 335 | { \fileinfo } 336 | } 337 | \cs_new_eq:NN \__ctxdoc_ltx_changes:nnn \changes@ 338 | \cs_set_protected:Npn \changes@ #1#2 339 | { 340 | \__ctxdoc_save_version_date:nn {#1} {#2} 341 | \tl_if_empty:nTF {#1} 342 | { \__ctxdoc_ltx_changes:nnn } 343 | { \__ctxdoc_version_zfill:wnnn #1 \q_stop } 344 | {#1} {#2} 345 | } 346 | \cs_new_protected:Npn \__ctxdoc_version_zfill:wnnn #1#2 \q_stop 347 | { 348 | \str_if_eq:nnTF {#1} { v } 349 | { \__ctxdoc_version_zfill:nnnn {#2} } 350 | { \__ctxdoc_ltx_changes:nnn } 351 | } 352 | \cs_new_protected:Npn \__ctxdoc_version_zfill:nnnn #1#2 353 | { 354 | \tl_clear:N \l__ctxdoc_tmp_tl 355 | \int_zero:N \l_tmpa_int 356 | \seq_set_split:Nnn \l_tmpa_seq { . } {#1} 357 | \seq_map_function:NN \l_tmpa_seq \__ctxdoc_version_zfill:n 358 | \int_compare:nNnF \l_tmpa_int > 2 359 | { 360 | \tl_put_right:Nx \l__ctxdoc_tmp_tl 361 | { \prg_replicate:nn { 3 - \l_tmpa_int } { 00000 } } 362 | } 363 | \__ctxdoc_ltx_changes:nnn { \l__ctxdoc_tmp_tl \actualchar #2 } 364 | } 365 | \tl_new:N \l__ctxdoc_tmp_tl 366 | \cs_new_protected:Npn \__ctxdoc_version_zfill:n #1 367 | { 368 | \int_incr:N \l_tmpa_int 369 | \tl_put_right:Nx \l__ctxdoc_tmp_tl 370 | { 371 | \prg_replicate:nn 372 | { \int_max:nn { 0 } { 5 - \tl_count:n {#1} } } { 0 } 373 | \exp_not:n {#1} 374 | } 375 | } 376 | \cs_new_protected:Npn \__ctxdoc_save_version_date:nn #1#2 377 | { 378 | \prop_get:NnNTF \g__ctxdoc_version_date_prop {#1} \l__ctxdoc_tmp_tl 379 | { \exp_after:wN \__ctxdoc_save_version_date:nnnn \l__ctxdoc_tmp_tl {#2} {#1} } 380 | { \__ctxdoc_save_version_date:nnn {#1} {#2} {#2} } 381 | } 382 | \cs_new_protected:Npn \__ctxdoc_save_version_date:nnnn #1#2#3#4 383 | { 384 | \__ctxdoc_if_date_later:nnTF {#1} {#3} 385 | { \__ctxdoc_save_version_date:nnn {#4} {#3} {#2} } 386 | { 387 | \__ctxdoc_if_date_later:nnT {#3} {#2} 388 | { \__ctxdoc_save_version_date:nnn {#4} {#1} {#3} } 389 | } 390 | } 391 | \prg_new_conditional:Npnn \__ctxdoc_if_date_later:nn #1#2 { TF , T } 392 | { 393 | \if_int_compare:w \__ctxdoc_parse_date:w #1 / / / 0 \q_stop > 394 | \__ctxdoc_parse_date:w #2 / / / 0 \q_stop \exp_stop_f: 395 | \prg_return_true: \else: \prg_return_false: \fi: 396 | } 397 | \cs_new:Npn \__ctxdoc_parse_date:w #1/#2/#3/ #4 \q_stop 398 | { #1#2#3 } 399 | \cs_new_protected:Npn \__ctxdoc_save_version_date:nnn #1#2#3 400 | { \prop_gput:Nnn \g__ctxdoc_version_date_prop {#1} { {#2} {#3} } } 401 | \cs_new_protected:Npn \CTEX@versionitem #1 \efill 402 | { 403 | \@idxitem 404 | \prop_get:NnNTF \g__ctxdoc_version_date_prop {#1} \l__ctxdoc_tmp_tl 405 | { \exp_after:wN \__ctxdoc_version_item:nnn \l__ctxdoc_tmp_tl {#1} } 406 | { \BOOM } 407 | } 408 | \cs_new_protected:Npn \__ctxdoc_version_item:nnn #1#2#3 409 | { 410 | \noindent 411 | \Hy@raisedlink { \belowpdfbookmark {#3} { HD.#3 } } 412 | \textbf {#3} \hfill 413 | \hbox:n 414 | { 415 | \footnotesize 416 | \str_if_eq:nnTF {#1} {#2} 417 | { ( #1 ) } 418 | { ( #1 ~ -- ~ #2 ) } 419 | } 420 | \par \nopagebreak 421 | } 422 | \prop_new:N \g__ctxdoc_version_date_prop 423 | \ctex_patch_cmd:Nnn \HDorg@theglossary 424 | { \let \item \@idxitem } 425 | { \let \item \CTEX@versionitem } 426 | \ctex_patch_cmd:Nnn \l@section { 2.5em } { 1.5em } 427 | \ctex_patch_cmd:Nnn \l@subsection { 2.5em } { 1.5em } 428 | \ctex_patch_cmd:Nnn \@wrglossary 429 | { hdpindex } 430 | { 431 | \ifnum \c@HD@hypercount = \z@ 432 | hdpindex 433 | \else 434 | hdclindex { \the \c@HD@hypercount } 435 | \fi 436 | } 437 | %% 重定义 macrocode 环境的实现,逐行处理 438 | \cs_set_protected_nopar:Npn \xmacro@code 439 | { \__ctxdoc_marco_code:w } 440 | \cs_set_protected_nopar:Npn \sxmacro@code 441 | { 442 | \fontspec_print_visible_spaces: 443 | \xmacro@code 444 | } 445 | \cs_new_protected_nopar:Npn \__ctxdoc_marco_code:w 446 | { 447 | \ifcodeline@index 448 | \__ctxdoc_marco_every_par:n { \__ctxdoc_code_line_no: } 449 | \else: 450 | \__ctxdoc_marco_every_par:n { } 451 | \fi: 452 | \exp_args:Nx \__ctxdoc_make_finish_tag:n { \@currenvir } 453 | \__ctxdoc_verbatim_start:w 454 | } 455 | \cs_new_protected:Npn \__ctxdoc_marco_every_par:n #1 456 | { 457 | \everypar 458 | { 459 | \everypar {#1} 460 | \if@inlabel 461 | \global \@inlabelfalse 462 | \@noparlistfalse 463 | \unless \ifvoid \CTEX@labelbox 464 | \llap { \box \CTEX@labelbox \hskip \leftskip } 465 | \fi 466 | \fi 467 | #1 468 | } 469 | } 470 | \ctex_patch_cmd:Nnn \macro@code 471 | { \if@inlabel \leavevmode \fi } 472 | { 473 | \partopsep \z@skip 474 | \if@inlabel \setbox \CTEX@labelbox \copy \@labels \fi 475 | } 476 | \newbox \CTEX@labelbox 477 | \group_begin: 478 | \int_set:Nn \tex_endlinechar:D { -1 } 479 | \use:n 480 | { 481 | \char_set_catcode_active:n { 32 } 482 | \tl_const:Nn \c__ctxdoc_active_space_tl 483 | } 484 | { } 485 | \group_end: 486 | \group_begin: 487 | \char_set_catcode_active:n { 13 } 488 | \cs_new_protected:Npx \__ctxdoc_make_finish_tag:n #1 489 | { 490 | \tl_set:Nn \exp_not:N \l__ctxdoc_verbatim_finish_tl 491 | { 492 | \c_percent_str 493 | \prg_replicate:nn { 4 } 494 | { \exp_not:o { \c__ctxdoc_active_space_tl } } 495 | \exp_not:o { \active@escape@char } end 496 | \c_left_brace_str #1 \c_right_brace_str 497 | \exp_not:N ^^M 498 | } 499 | } 500 | \cs_new_protected:Npn \__ctxdoc_verbatim_start:w #1 501 | { 502 | \str_if_eq:nnTF {#1} { ^^M } 503 | { \__ctxdoc_verbatim_read_line:w } 504 | { \__ctxdoc_verbatim_read_line:w #1 } 505 | } 506 | \cs_new_protected:Npn \__ctxdoc_verbatim_read_line:w #1 ^^M 507 | { 508 | \tl_set:Nn \l__ctxdoc_verbatim_line_tl { #1 ^^M } 509 | \tl_if_eq:NNTF \l__ctxdoc_verbatim_line_tl \l__ctxdoc_verbatim_finish_tl 510 | { \exp_args:Nx \end { \@currenvir } } 511 | { 512 | \__ctxdoc_verbatim_process_line: 513 | \__ctxdoc_verbatim_read_line:w 514 | } 515 | } 516 | \cs_new_protected:Npn \__ctxdoc_swap_cr: 517 | { \exp_after:wN \__ctxdoc_swap_cr:w \l__ctxdoc_verbatim_line_tl } 518 | \cs_new_protected:Npn \__ctxdoc_swap_cr:w #1 ^^M 519 | { 520 | \group_insert_after:N ^^M 521 | \tl_set:Nn \l__ctxdoc_verbatim_line_tl {#1} 522 | } 523 | \tl_const:Nn \c__ctxdoc_active_cr_tl { ^^M } 524 | \group_end: 525 | \tl_new:N \l__ctxdoc_verbatim_line_tl 526 | \tl_new:N \l__ctxdoc_verbatim_finish_tl 527 | \tl_new:N \g__ctxdoc_verbatim_verb_stop_tl 528 | \cs_new_protected_nopar:Npn \__ctxdoc_process_normal_line: 529 | { 530 | \str_if_eq:eeTF 531 | { \str_head:N \l__ctxdoc_verbatim_line_tl } { \c_percent_str } 532 | { \__ctxdoc_check_angle:x { \tl_tail:N \l__ctxdoc_verbatim_line_tl } } 533 | { \__ctxdoc_output_line: } 534 | } 535 | \cs_new_protected_nopar:Npn \__ctxdoc_process_verb_line: 536 | { 537 | \tl_if_eq:NNTF \l__ctxdoc_verbatim_line_tl \g__ctxdoc_verbatim_verb_stop_tl 538 | { 539 | \tl_gclear:N \g__ctxdoc_verbatim_verb_stop_tl 540 | \cs_gset_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_process_normal_line: 541 | \__ctxdoc_output_module:nn 542 | { \color { verb@guard } } 543 | { 544 | \__ctxdoc_swap_cr: 545 | \__ctxdoc_module_pop:n { \l__ctxdoc_verbatim_line_tl } 546 | } 547 | } 548 | { \tl_use:N \l__ctxdoc_verbatim_line_tl } 549 | } 550 | \cs_new_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_process_normal_line: 551 | \DeclareDocumentCommand \CheckModules { } 552 | { \cs_set_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_process_normal_line: } 553 | \DeclareDocumentCommand \DontCheckModules { } 554 | { \cs_set_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_output_line: } 555 | \cs_new_protected:Npn \__ctxdoc_check_angle:n #1 556 | { 557 | \str_if_eq:eeTF { \str_head:n {#1} } { < } 558 | { \__ctxdoc_check_module:x { \tl_tail:n {#1} } } 559 | { \__ctxdoc_output_percent_line: } 560 | } 561 | \cs_generate_variant:Nn \__ctxdoc_check_angle:n { x } 562 | \cs_new_protected:Npn \__ctxdoc_check_module:n #1 563 | { 564 | \exp_args:Nx \str_case:nnF { \str_head:n {#1} } 565 | { 566 | { * } { \__ctxdoc_module_star:w } 567 | { / } { \__ctxdoc_module_slash:w } 568 | { @ } { \__ctxdoc_module_at:w } 569 | { < } { \__ctxdoc_module_verb:w } 570 | } 571 | { \__ctxdoc_module_pm:w } 572 | #1 \q_stop 573 | } 574 | \cs_generate_variant:Nn \__ctxdoc_check_module:n { x } 575 | \group_begin: 576 | \char_set_catcode_active:N \> 577 | \cs_new_protected:Npn \__ctxdoc_module_star:w #1 > #2 \q_stop 578 | { 579 | \__ctxdoc_output_module:nn 580 | { \__ctxdoc_star_color: } 581 | { \__ctxdoc_module_push:n { \__ctxdoc_module_angle:n {#1} } } 582 | \__ctxdoc_output_line:n {#2} 583 | \__ctxdoc_star_format: 584 | } 585 | \cs_new_protected:Npn \__ctxdoc_module_slash:w #1 > #2 \q_stop 586 | { 587 | \__ctxdoc_output_module:nn 588 | { \__ctxdoc_slash_color: } 589 | { \__ctxdoc_module_pop:n { \__ctxdoc_module_angle:n {#1} } } 590 | \__ctxdoc_output_line:n {#2} 591 | \__ctxdoc_slash_format: 592 | } 593 | \cs_new_protected:Npn \__ctxdoc_module_at:w @ @ = #1 > #2 \q_stop 594 | { 595 | \__ctxdoc_output_module:nn 596 | { \color { at@guard } } 597 | { \__ctxdoc_module_angle:n { @ @ = #1 } } 598 | \tl_gset:Nn \g__codedoc_module_name_tl {#1} 599 | \__ctxdoc_output_line:n {#2} 600 | } 601 | \cs_new_protected:Npn \__ctxdoc_module_pm:w #1 > #2 \q_stop 602 | { 603 | \tex_noindent:D 604 | \hbox_overlap_left:n 605 | { 606 | \__ctxdoc_output_module:nn 607 | { \__ctxdoc_pm_color: } 608 | { \__ctxdoc_module_angle:n {#1} } 609 | \skip_horizontal:n { \leftskip + \smallskipamount } 610 | } 611 | \group_begin: 612 | \__ctxdoc_pm_format: 613 | \__ctxdoc_output_line:n {#2} 614 | \group_end: 615 | } 616 | \cs_new_protected:Npn \__ctxdoc_module_verb:w #1 \q_stop 617 | { 618 | \cs_gset_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_process_verb_line: 619 | \tl_gset:Nx \g__ctxdoc_verbatim_verb_stop_tl 620 | { \c_percent_str \tl_tail:n {#1} } 621 | \__ctxdoc_output_module:nn 622 | { \color { verb@guard } } 623 | { 624 | \__ctxdoc_swap_cr: 625 | \__ctxdoc_module_push:n { \l__ctxdoc_verbatim_line_tl } 626 | } 627 | } 628 | \group_end: 629 | \cs_new_protected_nopar:Npn \__ctxdoc_output_line: 630 | { 631 | \tex_noindent:D 632 | \__ctxdoc_replace_at_at:N \l__ctxdoc_verbatim_line_tl 633 | \tl_use:N \l__ctxdoc_verbatim_line_tl 634 | } 635 | \cs_new_protected:Npn \__ctxdoc_replace_at_at:N #1 636 | { 637 | \tl_if_empty:NF \g__codedoc_module_name_tl 638 | { 639 | \exp_args:NNo \__ctxdoc_replace_at_at_aux:Nn 640 | #1 \g__codedoc_module_name_tl 641 | } 642 | } 643 | \cs_new_protected:Npx \__ctxdoc_replace_at_at_aux:Nn #1#2 644 | { 645 | \tl_replace_all:Nnn #1 { \token_to_str:N @ } { @ } 646 | \tl_replace_all:Nnn #1 { \token_to_str:N _ } { _ } 647 | \tl_replace_all:Nnn #1 { @ @ @ @ } { \token_to_str:N a a } 648 | \tl_replace_all:Nnn #1 { _ _ @ @ } { _ _ #2 } 649 | \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 } 650 | \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 } 651 | \tl_replace_all:Nnn #1 { \token_to_str:N a a } { @ @ } 652 | } 653 | \cs_new_protected:Npn \__ctxdoc_output_line:n #1 654 | { 655 | \tl_set:Nn \l__ctxdoc_verbatim_line_tl {#1} 656 | \tl_if_eq:NNTF \l__ctxdoc_verbatim_line_tl \c__ctxdoc_active_cr_tl 657 | { \tl_use:N \l__ctxdoc_verbatim_line_tl } 658 | { 659 | \str_if_eq:eeTF 660 | { \str_head:N \l__ctxdoc_verbatim_line_tl } 661 | { \c_percent_str } 662 | { \__ctxdoc_output_percent_line: } 663 | { \__ctxdoc_output_line: } 664 | } 665 | } 666 | \cs_new_protected:Npn \__ctxdoc_output_percent_line: 667 | { 668 | \tex_noindent:D 669 | \group_begin: 670 | \color { code@gray } 671 | \__ctxdoc_swap_cr: 672 | \str_if_eq:eeTF { \f@shape } { \updefault } 673 | { \slshape } 674 | { \upshape } 675 | \__ctxdoc_output_line: 676 | \group_end: 677 | } 678 | \cs_new_protected_nopar:Npn \__ctxdoc_module_push:n 679 | { \exp_args:No \__ctxdoc_module_push_aux:nn { \int_use:N \c@HD@hypercount } } 680 | \cs_new_protected:Npn \__ctxdoc_module_push_aux:nn #1 681 | { 682 | \seq_gpush:Nn \g__ctxdoc_module_dest_seq {#1} 683 | \hypersetup { hidelinks } 684 | \exp_args:Nx \hdclindex 685 | { \zref@extractdefault { HD.#1 } { guard@end } { 1 } } { } 686 | } 687 | \cs_new_protected_nopar:Npn \__ctxdoc_module_pop:n 688 | { 689 | \seq_gpop:NNTF \g__ctxdoc_module_dest_seq \l__ctxdoc_tmp_tl 690 | { \exp_args:No \__ctxdoc_module_pop_aux:nn { \l__ctxdoc_tmp_tl } } 691 | { \BOOM \use:n } 692 | } 693 | \cs_new_protected:Npn \__ctxdoc_module_pop_aux:nn #1 694 | { 695 | \zref@labelbylist { HD.#1 } { ctxdoc } 696 | \hypersetup { hidelinks } 697 | \hdclindex {#1} { } 698 | } 699 | \seq_new:N \g__ctxdoc_module_dest_seq 700 | \zref@newlist { ctxdoc } 701 | \zref@newprop { guard@end } [ 1 ] 702 | { \int_eval:n { \c@HD@hypercount - 1 } } 703 | \zref@addprop { ctxdoc } { guard@end } 704 | \cs_new_protected_nopar:Npn \__ctxdoc_star_format: 705 | { 706 | \seq_gpush:No \g__ctxdoc_slash_format_seq { \macro@font } 707 | \seq_gpop:NNF \g__ctxdoc_star_format_seq \l__ctxdoc_format_tl 708 | { \__ctxdoc_pop_format: } 709 | \__ctxdoc_select_format: 710 | } 711 | \cs_new_protected_nopar:Npn \__ctxdoc_slash_format: 712 | { 713 | \seq_gpop:NNTF \g__ctxdoc_slash_format_seq \l__ctxdoc_format_tl 714 | { 715 | \seq_gpush:No \g__ctxdoc_star_format_seq { \macro@font } 716 | \__ctxdoc_select_format: 717 | } 718 | { \BOOM } 719 | } 720 | \cs_new_protected_nopar:Npn \__ctxdoc_pm_format: 721 | { 722 | \seq_get:NNF \g__ctxdoc_star_format_seq \l__ctxdoc_format_tl 723 | { 724 | \__ctxdoc_pop_format: 725 | \seq_gpush:No \g__ctxdoc_star_format_seq { \l__ctxdoc_format_tl } 726 | } 727 | \cs_if_eq:NNF \macro@font \l__ctxdoc_format_tl 728 | { \l__ctxdoc_format_tl } 729 | } 730 | \cs_new_protected_nopar:Npn \__ctxdoc_pop_format: 731 | { 732 | \seq_gpop_left:NN \g__ctxdoc_format_seq \l__ctxdoc_format_tl 733 | \seq_gput_right:No \g__ctxdoc_format_seq { \l__ctxdoc_format_tl } 734 | } 735 | \cs_new_protected_nopar:Npn \__ctxdoc_select_format: 736 | { 737 | \cs_if_eq:NNF \macro@font \l__ctxdoc_format_tl 738 | { 739 | \cs_gset_eq:NN \macro@font \l__ctxdoc_format_tl 740 | \macro@font 741 | } 742 | } 743 | \tl_new:N \l__ctxdoc_format_tl 744 | \seq_new:N \g__ctxdoc_format_seq 745 | \seq_new:N \g__ctxdoc_star_format_seq 746 | \seq_new:N \g__ctxdoc_slash_format_seq 747 | \seq_gput_right:Nn \g__ctxdoc_format_seq { \MacroFont } 748 | \seq_gput_right:Nn \g__ctxdoc_format_seq { \AltMacroFont } 749 | \cs_set_protected:Npn \MacroFont 750 | { 751 | \linespread { 1 } 752 | \small 753 | \fontseries { \mddefault } 754 | \fontshape { \updefault } 755 | \ttfamily 756 | \ctexdocverbaddon 757 | } 758 | \cs_set_protected:Npn \AltMacroFont 759 | { 760 | \linespread { 1 } 761 | \small 762 | \fontseries { \mddefault } 763 | \fontshape { \sldefault } 764 | \ttfamily 765 | \ctexdocverbaddon 766 | } 767 | \AtBeginDocument 768 | { 769 | \tl_gset:Nx \macro@font 770 | { \seq_item:Nn \g__ctxdoc_format_seq { 1 } } 771 | } 772 | \cs_new_protected:Npn \__ctxdoc_output_module:nn #1#2 773 | { 774 | \tex_noindent:D 775 | \group_begin: 776 | #1 777 | \footnotesize \normalfont \sffamily #2 778 | \group_end: 779 | } 780 | \cs_new_protected_nopar:Npn \__ctxdoc_star_color: 781 | { 782 | \seq_gpop:NNTF \g__ctxdoc_star_color_seq \current@color 783 | { \set@color } 784 | { \__ctxdoc_select_color: } 785 | \seq_gpush:No \g__ctxdoc_slash_color_seq { \current@color } 786 | } 787 | \cs_new_protected_nopar:Npn \__ctxdoc_slash_color: 788 | { 789 | \seq_gpop:NNTF \g__ctxdoc_slash_color_seq \current@color 790 | { 791 | \set@color 792 | \seq_gpush:No \g__ctxdoc_star_color_seq { \current@color } 793 | } 794 | { \BOOM } 795 | } 796 | \cs_new_protected_nopar:Npn \__ctxdoc_pm_color: 797 | { 798 | \seq_get:NNTF \g__ctxdoc_star_color_seq \current@color 799 | { \set@color } 800 | { 801 | \__ctxdoc_select_color: 802 | \seq_gpush:No \g__ctxdoc_star_color_seq { \current@color } 803 | } 804 | } 805 | \seq_new:N \g__ctxdoc_star_color_seq 806 | \seq_new:N \g__ctxdoc_slash_color_seq 807 | \cs_new_protected_nopar:Npn \__ctxdoc_select_color: 808 | { \color { guard@series!!+ } } 809 | \definecolorseries { guard@series } 810 | { cmyk } { last } { blue } { purple } 811 | \resetcolorseries [ 3 ] { guard@series } 812 | \definecolor { verb@guard } { rgb } { 0.5 , 0.5 , 0 } 813 | \definecolor { at@guard } { rgb } { 0.5 , 0 , 0.5 } 814 | \definecolor { code@gray } { gray } { 0.5 } 815 | \cs_new_protected:Npn \__ctxdoc_module_angle:n #1 816 | { \textlangle #1 \textrangle } 817 | \cs_new_protected_nopar:Npn \__ctxdoc_code_line_no: 818 | { 819 | \int_gincr:N \c@CodelineNo 820 | \hbox_overlap_left:n 821 | { 822 | \hbox_to_wd:nn 823 | { \MacroIndent } 824 | { 825 | \HD@target 826 | \tex_hss:D 827 | \__ctxdoc_code_line_no_style: 828 | \theCodelineNo \enspace 829 | } 830 | \tex_kern:D \@totalleftmargin 831 | } 832 | } 833 | \tl_set:Nn \theCodelineNo 834 | { \arabic { CodelineNo } } 835 | \cs_new_protected_nopar:Npn \__ctxdoc_code_line_no_style: 836 | { \color { code@gray } \normalfont \sffamily \tiny } 837 | \cs_set_protected:Npn \HD@SetMacroIndent #1 838 | { 839 | \group_begin: 840 | \settowidth \MacroIndent 841 | { 842 | \__ctxdoc_code_line_no_style: 843 | \prg_replicate:nn { \tl_count:n {#1} } { 0 } 844 | \enspace 845 | } 846 | \dim_gset_eq:NN \MacroIndent \MacroIndent 847 | \group_end: 848 | } 849 | \ExplSyntaxOff 850 | \AtBeginDocument{\addtocontents{toc}{\StopSpecialIndexModule}} 851 | \pdfstringdefDisableCommands{% 852 | \let\path\meta 853 | \let\opt\@firstofone} 854 | % full expansion of \MakeUppercase is changed in LaTeX2e 2022-11-01, 855 | % see latex3/latex2e repo, commit 7447e931820114aa459e66b1a7937cdc9aebb0f4 856 | \ifcsdef{MakeUppercase\space\space\space} 857 | {\preto\@thehead 858 | {\protected\long\csdef{MakeUppercase\space\space\space}[#1]#2{{#2}}}} 859 | {\preto\@thehead 860 | {\protected\long\csdef{MakeUppercase\space}#1{{#1}}}} 861 | \def\orbar{\textup{\textbar}} 862 | \def\defaultval#1{\textbf{\textup{#1}}} 863 | \def\defaultvalaux#1){\defaultval{#1}} 864 | \def\TF{true\orbar false} 865 | \def\TTF{\defaultval{true}\orbar false} 866 | \def\TFF{true\orbar\defaultval{false}} 867 | \protected\def\opt{\texttt} 868 | \def\TeX{\hologo{TeX}} 869 | \def\pdfTeX{\hologo{pdfTeX}} 870 | \def\XeTeX{\hologo{XeTeX}} 871 | \def\XeLaTeX{\hologo{XeLaTeX}} 872 | \def\LuaLaTeX{\hologo{LuaLaTeX}} 873 | \def\pdfLaTeX{\hologo{pdfLaTeX}} 874 | \def\LaTeX{\hologo{LaTeX}} 875 | \def\LaTeXe{\hologo{LaTeX2e}} 876 | \def\LaTeXiii{\hologo{LaTeX3}} 877 | \def\dvipdfmx{\hologo{DVIPDFMx}} 878 | \def\TeXLive{\hologo{TeXLive}} 879 | \def\MiKTeX{\hologo{MiKTeX}} 880 | \def\pTeX{\hologo{pTeX}} 881 | \def\ApTeX{\hologo{ApTeX}} 882 | \def\upTeX{\hologo{upTeX}} 883 | \def\ApLaTeX{\hologo{ApLaTeX}} 884 | \def\upLaTeX{\hologo{upLaTeX}} 885 | \def\HoLogo@pTeX#1{p\kern -.15em \hologo{TeX}} 886 | \def\HoLogo@pLaTeX#1{p\kern -.05em \hologo{LaTeX}} 887 | \def\HoLogo@ApTeX#1{A\kern -.05em \hologo{pTeX}} 888 | \def\HoLogo@upTeX#1{u\kern -.05em \hologo{pTeX}} 889 | \def\HoLogo@ApLaTeX#1{A\kern -.05em \hologo{pLaTeX}} 890 | \def\HoLogo@upLaTeX#1{u\kern -.05em \hologo{pLaTeX}} 891 | \def\HoLogoBkm@pTeX#1{p\hologo{TeX}} 892 | \def\HoLogoBkm@pLaTeX#1{p\hologo{LaTeX}} 893 | \def\HoLogoBkm@ApTeX#1{A\hologo{pTeX}} 894 | \def\HoLogoBkm@upTeX#1{u\hologo{pTeX}} 895 | \def\HoLogoBkm@ApLaTeX#1{A\hologo{pLaTeX}} 896 | \def\HoLogoBkm@upLaTeX#1{u\hologo{pLaTeX}} 897 | \def\HoLogo@TeXLive#1{\TeX\ Live} 898 | \def\HoLogo@DVIPDFMx#1{DVIPDFM\ensuremath{x}} 899 | \def\bashcmd{\texttt} 900 | \def\BSTACK{\begin{tabular}[t]{@{}l@{}}} 901 | \def\ESTACK{\end{tabular}} 902 | \newenvironment{defaultcapconfig}{% 903 | \MakePercentComment 904 | \input{ctex-name-utf8.cfg}% 905 | \ExplSyntaxOff 906 | \MakePercentIgnore}{} 907 | \def\ctexkit{\href{https://github.com/CTeX-org/ctex-kit/}{\texttt{ctex-kit}}} 908 | \def\ctexkitrev#1{% 909 | \href{https://github.com/CTeX-org/ctex-kit/commit/#1}{\texttt{ctex-kit} rev. #1}} 910 | \appto\GlossaryParms{% 911 | \raggedcolumns 912 | \let\Hy@writebookmark\HDorg@writebookmark 913 | \def\@idxitem{\par\hangindent 2em }% 914 | \def\subitem{\@idxitem\hspace*{1em}}% 915 | \def\subsubitem{\@idxitem\hspace*{2em}}} 916 | \def\glossaryname{版本历史} 917 | \GlossaryPrologue{\section{\glossaryname}} 918 | \IndexPrologue{% 919 | \section{\indexname} 920 | \textit{意大利体的数字表示描述对应索引项的页码; 921 | 带下划线的数字表示定义对应索引项的代码行号; 922 | 罗马字体的数字表示使用对应索引项的代码行号。}} 923 | \def\IndexLayout{% 924 | \newgeometry{hmargin=15mm,vmargin={25mm,15mm},footskip=7mm}% 925 | \setlength\IndexMin{.5\textheight}% 926 | \ctexset{section/numbering=false}% 927 | \StopSpecialIndexModule} 928 | \EnableCrossrefs 929 | \CodelineIndex 930 | \RecordChanges 931 | %% 932 | %% 933 | %% End of file ctxdoc.cls. 934 | --------------------------------------------------------------------------------