summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/ot-tableau/ot-tableau.pdfbin65650 -> 108735 bytes
-rw-r--r--macros/latex/contrib/ot-tableau/ot-tableau.sty36
-rw-r--r--macros/latex/contrib/ot-tableau/ot-tableau.tex49
-rw-r--r--macros/latex/contrib/setspaceenhanced/LICENSE.md19
-rw-r--r--macros/latex/contrib/setspaceenhanced/README.md154
-rw-r--r--macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx730
-rw-r--r--macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdfbin0 -> 315105 bytes
-rw-r--r--macros/luatex/latex/lualinalg/README.txt2
-rw-r--r--macros/luatex/latex/lualinalg/lualinalg-complex.lua347
-rw-r--r--macros/luatex/latex/lualinalg/lualinalg-fractions.lua225
-rw-r--r--macros/luatex/latex/lualinalg/lualinalg.pdfbin269062 -> 271088 bytes
-rw-r--r--macros/luatex/latex/lualinalg/lualinalg.sty21
-rw-r--r--macros/luatex/latex/lualinalg/lualinalg.tex7
-rw-r--r--macros/luatex/latex/luamaths/README.txt2
-rw-r--r--macros/luatex/latex/luamaths/luamaths-complex.lua10
-rw-r--r--macros/luatex/latex/luamaths/luamaths-fractions.lua5
-rw-r--r--macros/luatex/latex/luamaths/luamaths.bib1
-rw-r--r--macros/luatex/latex/luamaths/luamaths.pdfbin145138 -> 146025 bytes
-rw-r--r--macros/luatex/latex/luamaths/luamaths.sty4
-rw-r--r--macros/luatex/latex/luamaths/luamaths.tex18
-rw-r--r--macros/xetex/latex/buctthesis/README.md9
-rw-r--r--macros/xetex/latex/buctthesis/buctthesis.pdfbin462539 -> 0 bytes
-rw-r--r--macros/xetex/latex/buctthesis/doc/buctthesis.pdfbin0 -> 468603 bytes
-rw-r--r--macros/xetex/latex/buctthesis/source/buctthesis.dtx (renamed from macros/xetex/latex/buctthesis/buctthesis.dtx)1096
-rw-r--r--macros/xetex/latex/buctthesis/source/buctthesis.ins (renamed from macros/xetex/latex/buctthesis/buctthesis.ins)12
25 files changed, 1570 insertions, 1177 deletions
diff --git a/macros/latex/contrib/ot-tableau/ot-tableau.pdf b/macros/latex/contrib/ot-tableau/ot-tableau.pdf
index 46a08bd942..307a031d50 100644
--- a/macros/latex/contrib/ot-tableau/ot-tableau.pdf
+++ b/macros/latex/contrib/ot-tableau/ot-tableau.pdf
Binary files differ
diff --git a/macros/latex/contrib/ot-tableau/ot-tableau.sty b/macros/latex/contrib/ot-tableau/ot-tableau.sty
index 3d2ac05907..a8770ca00e 100644
--- a/macros/latex/contrib/ot-tableau/ot-tableau.sty
+++ b/macros/latex/contrib/ot-tableau/ot-tableau.sty
@@ -11,11 +11,11 @@
%
% This work has the LPPL maintenance status `maintained'.
%
-% The Current Maintainer of this work is Adam Bker.
+% The Current Maintainer of this work is Adam Baker.
%
% This work consists of the files ot-tableau.sty and ot-tableau.tex.
-\ProvidesPackage{ot-tableau}[2021-05-19]
+\ProvidesPackage{ot-tableau}[2023-08-01]
% Package option: notipa
\newif\ifottableau@tipa
@@ -159,20 +159,40 @@
&
\ifottableau@fingerfirst \rowletter \else #1 \fi%
&#2\ExclOff}
-
-\def\vio#1{&%
+% add multi-input candidates (added by Alan Munn 2023/08/01)
+\newcommand\mcand[2][]{\OptimalOff\properlines%
+ \ifottableau@fingerfirst \ipa{#1} \fi%
+ &
+ \ifottableau@fingerfirst \else \ipa{#1} \fi%
+ &
+ \ipa{#2}\ExclOff}
+
+\WithSuffix\newcommand\mcand*[2][]{\OptimalOff\properlines%
+ \ifottableau@fingerfirst #1 \fi%
+ &
+ \ifottableau@fingerfirst \else #1 \fi%
+ &#2\ExclOff}
+
+% add starred version of \vio to remove vertical lines for initial multi-input candidates
+% (added by Alan Munn 2023/08/01)
+\NewDocumentCommand{\vio}{sm}{
+ \IfBooleanTF{#1}
+ {&\multicolumn{1}{c}{#2}}
+ {&%
\ifottableau@circledviolations
\ifottableau@optimal
- \StrSubstitute{#1}{*}{\CircledViolationMarker}
+ \StrSubstitute{#2}{*}{\CircledViolationMarker}
\else
- \StrSubstitute{#1}{*}{\ViolationMarker}
+ \StrSubstitute{#2}{*}{\ViolationMarker}
\fi
\else
- \StrSubstitute{#1}{*}{\ViolationMarker}
+ \StrSubstitute{#2}{*}{\ViolationMarker}
\fi
\ifottableau@excl \ifottableau@shadedcells \ShadeTheCell \fi \fi%
- \ifottableau@excl \empty \else \IfSubStr{#1}{!}{\ExclOn}{\ExclOff} \fi%
+ \ifottableau@excl \empty \else \IfSubStr{#2}{!}{\ExclOn}{\ExclOff} \fi%
}
+ }
+
\newcommand\inp[1]{\multicolumn{3}{|l||}{#1}}
diff --git a/macros/latex/contrib/ot-tableau/ot-tableau.tex b/macros/latex/contrib/ot-tableau/ot-tableau.tex
index 0eba320896..cc583bd1af 100644
--- a/macros/latex/contrib/ot-tableau/ot-tableau.tex
+++ b/macros/latex/contrib/ot-tableau/ot-tableau.tex
@@ -4,7 +4,7 @@
%\usepackage[notipa,usehhline]{ot-tableau}
\usepackage{fullpage,pifont}
\title{The \textsf{ot-tableau} package}
-\date{Revised 2021-05-19}
+\date{Revised 2023-08-01}
\author{Adam Baker}
\def\eg{e.g.,~}
\def\tabl{\textsf{ot-tableau}}
@@ -248,5 +248,52 @@ It makes the most sense to set these options as package options, but if you want
\item[fingerafter] Place the finger-of-optimality after the letter rather than before it. (\verb+\FingerBeforeLetter+, \verb+\LetterBeforeFinger+)
\item[usehhline] Use the \verb+hhline+ package to draw prettier tableau lines. (As of 2021-05-19, a package conflict means that the lines are not actually prettier. Hopefully this will be fixed in the future and we can go back to pretty lines!)
\end{description}
+\section{Multiple input candidates}
+To input candidates with multiple inputs, you can use the \verb+\mcand+ command instead of the \verb+\cand+ command. This suppresses the numbering of the candidate. Since multiple input candidates usually appear with no constraint markings on the candidate itself, the starred version of the \verb+\viol+ command suppresses vertical lines in that cell of the tableau. Here's a full example, adapted from Petrova et al. (2006) in \emph{The Linguistic Review} 23-1.
+\bigskip
+
+\LetterBeforeFinger
+\begin{tableau}{c:c|c|c|c}
+\inp{} \const{Agree} \const{ID preson voi} \const{ID-wf voi} \const{IDvoi}\const{*voi}
+\cand{\ips{pigds}} \vio*{} \vio*{} \vio*{} \vio*{} \vio{}
+\mcand{pigds} \vio{!*} \vio{} \vio{} \vio{} \vio{**}
+\mcand{pigdz} \vio{} \vio{} \vio{*!} \vio{*} \vio{***}
+\mcand[\Optimal]{pikts} \vio{} \vio{} \vio{} \vio{**} \vio{}
+\cand{\ips{pigts}} \vio*{} \vio*{} \vio*{} \vio*{} \vio{}
+\mcand{pigts} \vio{*!} \vio{} \vio{} \vio{} \vio{*}
+\mcand[\Optimal]{pikts} \vio{} \vio{} \vio{} \vio{*} \vio{}
+\mcand{pigdz} \vio{} \vio{} \vio{!*} \vio{**} \vio{***}
+\cand{\ips{pigtz}} \vio*{} \vio*{} \vio*{} \vio*{} \vio{}
+\mcand[\Optimal]{pigdz} \vio{} \vio{} \vio{} \vio{**} \vio{***}
+\mcand{piktz} \vio{*!} \vio{} \vio{} \vio{} \vio{}
+\mcand{pigts} \vio{} \vio{} \vio{!*} \vio{*} \vio{}
+\end{tableau}
+
+\bigskip
+
+Generated by:
+
+\begin{verbatim}
+\LetterBeforeFinger
+\begin{tableau}{c:c|c|c|c}
+\inp{} \const{Agree} \const{ID preson voi} \const{ID-wf voi} \const{IDvoi} \const{*voi}
+\cand{\ips{pigds}} \vio*{} \vio*{} \vio*{} \vio*{} \vio{}
+\mcand{pigds} \vio{!*} \vio{} \vio{} \vio{} \vio{**}
+\mcand{pigdz} \vio{} \vio{} \vio{*!} \vio{*} \vio{***}
+\mcand[\Optimal]{pikts} \vio{} \vio{} \vio{} \vio{**} \vio{}
+\cand{\ips{pigts}} \vio*{} \vio*{} \vio*{} \vio*{} \vio{}
+\mcand{pigts} \vio{*!} \vio{} \vio{} \vio{} \vio{*}
+\mcand[\Optimal]{pikts} \vio{} \vio{} \vio{} \vio{*} \vio{}
+\mcand{pigdz} \vio{} \vio{} \vio{!*} \vio{**} \vio{***}
+\cand{\ips{pigtz}} \vio*{} \vio*{} \vio*{} \vio*{} \vio{}
+\mcand[\Optimal]{pigdz} \vio{} \vio{} \vio{} \vio{**} \vio{***}
+\mcand{piktz} \vio{*!} \vio{} \vio{} \vio{} \vio{}
+\mcand{pigts} \vio{} \vio{} \vio{!*} \vio{*} \vio{}
+\end{tableau}
+\end{verbatim}
+
+
+
+
\end{document}
diff --git a/macros/latex/contrib/setspaceenhanced/LICENSE.md b/macros/latex/contrib/setspaceenhanced/LICENSE.md
new file mode 100644
index 0000000000..99a6973749
--- /dev/null
+++ b/macros/latex/contrib/setspaceenhanced/LICENSE.md
@@ -0,0 +1,19 @@
+----------------------------------------------------------------------------
+
+This work may be distributed and/or modified under the conditions of the
+LaTeX Project Public License, version 1.3c of the license. The latest
+version of this license is in http://www.latex-project.org/lppl.txt and
+version 1.3c or later is part of all distributions of LaTeX 2005/12/01
+or later. This work has the LPPL maintenance status “maintained”.
+The current maintainer and author of this work is Markus Kohm.
+
+----------------------------------------------------------------------------
+
+Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz
+in der Version 1.3c, verteilt und/oder verändert werden. Die aktuelle
+Version dieser Lizenz ist http://www.latex-project.org/lppl.txt und
+Version 1.3c oder später ist Teil aller Verteilungen von LaTeX 2005/12/01
+oder später. Dieses Werk hat den LPPL-Verwaltungs-Status „maintained”
+Der aktuelle Verwalter und Autor dieses Werks ist Markus Kohm.
+
+----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/setspaceenhanced/README.md b/macros/latex/contrib/setspaceenhanced/README.md
new file mode 100644
index 0000000000..601ae4b8ca
--- /dev/null
+++ b/macros/latex/contrib/setspaceenhanced/README.md
@@ -0,0 +1,154 @@
+# Package `setspaceenhanced`
+
+Copyright © 2008–2023 Markus Kohm
+
+Release: 2023-08-04 v1.0
+
+License: LPPL 1.3c
+
+KOMA presents the `setspaceenhanced` package to extend the functionality of
+package [`setspace`](https://ctan.org/pkg/setspace). The `setspaceenhanced`
+package is part of the *third-party enhancements* project.
+
+----------------------------------------------------------------------------
+
+This work may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, version 1.3c of the license.
+The latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+and version 1.3c or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This work has the LPPL maintenance status "maintained".
+
+The Current Maintainer and author of this work is Markus Kohm.
+
+----------------------------------------------------------------------------
+
+# Abstract
+
+For several years
+[KOMA-Script](https://www.sourceforge.net/project/koma-script) provided a
+package `scrhack`, that has been made not only to improve the compatibility of
+third-party packages with KOMA-Script classes, but also to generally improve
+third-party packages. The package consisted not only in the package file
+`scrhack.sty` but also in several so called hacks as separate files with
+extension `.hak`. In the course of splitting off former KOMA-Script packages
+from the KOMA-Script collection, it was decided to create independent packages
+from the individual hacks. These new independent packages then serve as
+replacements for the original packages they were intended to improve. Package
+`setspaceenhanced` is such an enhancement package. It provides additional
+features and improvements by patching package
+[`setspace`](https://ctan.org/pkg/setspace).
+
+# Unpacking and Installation for Users
+
+If you are a user, you should wait until all the packages has been added to
+your preferred TeX distribution. Then you can use the package manager of your
+TeX distribution to install all the packages.
+
+# Unpacking for Distributors
+
+Distributors should download the [distribution from
+CTAN](https://www.ctan.org/pkg/setspaceenhanced). This consists in:
+
+* `setspaceenhanced.dtx`
+* `README.md`
+* `LICENSE.md`
+* `setspaceenhanced.pdf`
+
+If distributors also want to distribute `setspaceenhanced.sty`, they can
+unpack it using
+
+ tex setspaceenhanced.dtx
+
+Note, that you have to use `tex` not `latex`, `pdflatex`, `xelatex` or
+`lualatex`!
+
+Note also, that a legal distribution consists at least in:
+
+* `setspaceenhanced.dtx`
+* `README.md`
+
+The following files are optionally, but must not be distributed without the
+previous ones:
+
+* `LICENSE.md`
+* `setspaceenhanced.sty`
+* `setspaceenhanced.pdf`
+
+# Unpacking and Installation for Developers
+
+Developers who want the current developer version of the code to be installed
+for testing, should clone [the `third-party-enhancements`
+repository](https://github.com/komascript/third-party-enhancements), e.g.,
+using
+
+ git clone https://github.com/komascript/third-party-enhancements.git
+
+You can
+than either unpack and install all the third-party enhancements using:
+
+ l3build install --full
+
+from within the main directory of the cloned respository (omit option `--full`
+if you don't want the manual) or `setspaceenhanced` only doing the same from
+within the `setspaceenhanced` sub-directory.
+
+# How to get the Manuals
+
+After installation you should get the user manual using:
+
+ texdoc setspaceenhanced
+
+See the manual of your TeX distribution for more information.
+
+Developers or distributors can also build the manuals from the source using:
+
+ l3build doc
+
+# How to Contribute
+
+To become a contributor, e.g., do heavy testing. If you find an issue, please
+report it using the [issue
+tracker](https://github.com/komascript/third-party-enhancements/issues). You
+can also become a developer and, e.g., make new test files to the
+packages. See the [`l3build`](https://ctan.prg/pkg/l3build) manual for more
+information about tests. If you've created a new test and think that it would
+be useful. Please either do a pull request or [add a new
+issue](https://github.com/komascript/third-party-enhancements/issues/new/choose)
+and include your test file.
+
+Another kind of contribution would be to contact an author of one of the
+third-party packages and convince her or him to integrate the code of the
+corresponding enhancement package from this project into her or his package.
+
+# How to Report Issues
+
+If you think you have found a bug (or another kind of issue) using
+`setspaceenhanced` you should use the [issue
+tracker](https://github.com/komascript/third-party-enhancements/issues). Please
+first search for similar issues already reported and maybe also already fixed
+and closed. Maybe the replies to such a similar report would help you too.
+
+If your issue is new, you should report it also using the [issue
+tracker](https://github.com/komascript/third-party-enhancements/issues). Please
+be kind, not only when writing the report but also when reading replies and
+commenting or answering. And please always add a minimal working example and
+usually the relevant parts of the `log`-file to your report. Please use the
+[markdown for
+code](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks)
+to add such files into the text of your report. The correct language
+identifier for LaTeX code would be `latex`. For `log`-files you won't need any
+language identifier. Usually you should not use attachments for code or
+`log`-files unless you've been asked to do so. And please note, reports should
+always be self-containing. External links often break and so the report become
+useles.
+
+# How to Say Thank You for my Work
+
+Hey, I'm doing this as a hobby. So no need to say thank you. But I'm a vain
+fop, so I'm certainly up for a quick thank you by email. On komascript.de you
+can find an [explanation of my wishes](https://komascript.de/wunschliste) if
+you want to give more. If you don't understand German, just click to links at
+that page.
diff --git a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx
new file mode 100644
index 0000000000..97cfc589c5
--- /dev/null
+++ b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx
@@ -0,0 +1,730 @@
+% \iffalse meta-comment
+% ======================================================================
+% setspaceenhanced.dtx
+% Copyright © 2008–2023 Markus Kohm
+%
+% This work is a KOMA-Script spin-off. For the original sources of
+% KOMA-Script's `float.hak' see file `scrhack.dtx' in the KOMA-Script
+% sources at <https://sourceforge.net/p/koma-script/code/>.
+%
+% Development is taking place as part of `scrhack' at
+% <https://github.com/komascript/third-party-enhancements>. New issues
+% should be reported there as well as known issues can be found.
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, version 1.3c of the license.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.<3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later and of this work.
+%
+% The Current Maintainer and author of this work is Markus Kohm.
+%
+% This work consists of the file `setspaceenhanced.dtx' and `README.md'.
+%
+% The recommended way to install `setspaceenhanced' is to use
+% the package manager of your TeX distribution.
+% ======================================================================
+%
+%<*dtx>
+\ifx\ProvidesExplFile\undefined\def\ProvidesExplFile#1#2#3#4{}\fi
+\ProvidesExplFile{setspaceenhanced.dtx}
+%</dtx>
+%<*dtx|package>
+%<package>\ProvidesExplPackage{setspaceenhanced}
+ {2023-08-04}{1.0}
+ {%
+%<*dtx>
+ sources and unpack driver of
+%</dtx>
+ improved setspace package%
+ }
+%</dtx|package>
+%<*dtx>
+\ifx\documentclass\undefined
+ \input docstrip.tex
+ \generate{%
+ \file{setspaceenhanced.sty}{%
+ \from{setspaceenhanced.dtx}{package}%
+ }%
+ }%
+\else
+ \let\endbatchfile\ExplSyntaxOff
+\fi
+\endbatchfile
+\documentclass[ngerman,USenglish]{koma-script-source-doc}
+\NewDocElement[%
+ macrolike = true,
+ toplevel = true,
+ idxtype = \textit{const.},
+ idxgroup = Constants,
+ printtype = \textit{const.},
+]{Constant}{Constant}
+\NewDocElement[%
+ macrolike = true,
+ toplevel = true,
+ idxtype = \textit{var.},
+ idxgroup = Variable,
+ printtype = \textit{var.},
+]{Variable}{Variable}
+\usepackage{babel}
+\usepackage{csquotes}
+\usepackage[style=alphabetic]{biblatex}
+\begin{filecontents}[force]{\jobname.bib}
+@online{pkg:setspace,
+ author={David Carlisle and Erica Harris and Geoffrey Tobin and
+ Robin Fairbairns},
+ title={\pkg*{setspace} --- Set space between lines},
+ version={6.7b},
+ date={2022-12-04},
+ url={https://ctan.org/pkg/setspace},
+ urldate={2023-07-25},
+ note={Provides support for setting the spacing between lines in a
+ document. Package options include \opt{singlespacing},
+ \opt{onehalfspacing}, and \opt{doublespacing}. Alternatively
+ the spacing can be changed as required with the
+ \cs{singlespacing}, \cs{onehalfspacing}, and
+ \cs{doublespacing} commands. Other size spacings also
+ available.},
+}
+@manual{pkg:setspace:manual,
+ author={Geoffrey Tobin and Robin Fairbairns},
+ date={2022-12-04},
+ title={The \pkg*{setspace} Package},
+ url={https://ctan.org/tex-archive/macros/latex/contrib/setspace},
+ urldate={2023-07-25},
+ abstract={},
+}
+@online{pkg:scrlfile,
+ author = {Markus Kohm},
+ version = {3.41},
+ date = {2023-07-07},
+ title = {\pkg*{scrlfile} – Installation control (not only) for
+ \KOMAScript{} packages},
+ url = {https://ctan.org/pkg/scrlfile},
+ urldate = {2023-07-19},
+ note = {The package provides hooks for the execution of commands before
+ or after loading files, classes or packages independent from the
+ \LaTeX{} kernel version.},
+}
+@online{pkg:koma-script,
+ author={Markus Kohm},
+ version={3.41},
+ date={2023-07-07},
+ title={{\KOMAScript} --- A bundle of versatile classes and packages},
+ url={https://ctan.org/pkg/koma-script},
+ urldate={2023-07-14},
+ note={The \KOMAScript{} bundle provides replacements for the \pkg*{article},
+ \pkg*{report}, and \pkg*{book} classes with emphasis on typography and
+ versatility. There is also a letter class.},
+}
+@manual{pkg:koma-script:manual:de,
+ author={Markus Kohm},
+ date={2023-06-16},
+ title={{\KOMAScript}},
+ subtitle={Die Anleitung},
+ url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-de.pdf},
+ urldate={2023-07-04},
+}
+@manual{pkg:koma-script:manual:en,
+ author={Markus Kohm},
+ date={2023-06-16},
+ title={{\KOMAScript}},
+ subtitle={The Guide},
+ url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-en.pdf},
+ urldate={2023-07-14},
+}
+@article{latexnews35,
+ author={{The {\LaTeX} Project Team}},
+ shortauthor={TLT},
+ year={2022},
+ month={6},
+ title={Issue 35},
+ journal={{\LaTeX} News},
+ url={http://mirrors.ctan.org/macros/latex/base/ltnews35.pdf},
+ urldate={2023-07-14},
+}
+\end{filecontents}
+\addbibresource{\jobname.bib}
+\setcounter{StandardModuleDepth}{2}
+\begin{document}
+ \nocite{pkg:setspace,pkg:koma-script}
+ \DocInput{setspaceenhanced.dtx}
+\end{document}
+%</dtx>
+%\fi
+%
+% \changes{v0.1}{2023/06/01}{new \KOMAScript{} spin-off}
+%
+% \GetFileInfo{setspaceenhanced.dtx}
+% \title{Improving ``\pkg{setspace}''}
+% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}\thanks{Repository and
+% bug reports:
+% \url{https://github.com/komascript/third-party-enhancements}}}
+% \date{Version \filedate{} \fileversion}
+% \maketitle
+% \begin{abstract}
+% Package \pkg*{setspaceenhanced} has started as hack module of the
+% \KOMAScript{} package \pkg*{scrhack} years ago to fix an issue when using
+% package \pkg{setspace} with other document font sizes than 10\,pt, 11\,pt
+% or 12\,pt. This became necessary because package \pkg{setspace} originally
+% only supported these three font sizes and loading the package with a
+% floating point definition of \cs{@ptsize} even resulted in errors. These
+% two issues has been fixed some years ago. Now, \pkg{setspace} uses a
+% static factor for all font sizes but 10\,pt, 11\,pt, or
+% 12\,pt.
+%
+% Additionally, if you change font size inside the document
+% \pkg{setspace} still uses the stretch factor of the document font size
+% instead of using a proper stretch factor for the new font size.
+%
+% Package \pkg*{setspaceenhanced} provides improvements for all these
+% limitations and also some additional enhancements.
+% \end{abstract}
+%
+% \tableofcontents
+%
+%\iffalse
+%<*doc>
+%\fi
+\section{Why should I use this package instead of
+ \texorpdfstring{\pkg{setpace}}{setspace} at least if I use a \KOMAScript{}
+ class or \KOMAScript{} package \texorpdfstring{\pkg{scrextend}}{scrextend}
+ or a similar package?}
+\label{sec:whywithkomascript}
+
+From 2006 \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} classes and
+\KOMAScript{} package \pkg{scrextend} provide option \opt{fontsize} for
+setting document font sizes not limited to 10\,pt, 11\,pt, or 12\,pt. Using
+this option is also not limited to integer font sizes but also supports
+floating point sizes like 11.5\,pt. To support such font sizes, the
+specification of macro \cs{@ptsize} has been changed to be no longer either 0,
+1 or 2 but to be the font size minus 10 in pt.
+
+By the way, e.g., Ivan Valbusa's package \pkg{fontsize} adopted this existing
+definition of \cs{@ptsize} from \KOMAScript{} by using most of the font size
+code of \KOMAScript.
+
+Unfortunately package \pkg{setspace} provides stretch factors for individual
+font sizes only for 10\,pt, 11\,pt or 12\,pt. For all sizes between these
+size, it uses the factor of the down rounded integer. For all sizes below
+10\,pt or 11\,pt it uses a static value, 1.25 for \cs{onehalfspacing} and
+1.667 for \cs{doublespacing}. Package \pkg*{setspaceenhanced} uses for
+\cs{onehalfspacing} and \cs{doublespacing} a calculation of the stretch factor
+depending on the selected baseline skip and font size. With this, every font
+size is supported.
+
+But that's just the tip of the iceberg and even comparatively
+unimportant. Much more important are the reasons in the following section,
+which also apply when using a \KOMAScript{} class or the \KOMAScript{} package
+\pkg{scrextend} or a similar package.
+
+
+\section{Why should I use this package instead of
+ \texorpdfstring{\pkg{setpace}}{setspace} independent from using a
+ \KOMAScript{} class or \KOMAScript{} package
+ \texorpdfstring{\pkg{scrextend}}{scrextend} or similar packages?}
+\label{sec:whywithoutkomascript}
+
+\pkg{setspace} does not care for the \cs{baselineskip} selected by
+\cs{fontsize}. Instead it sets the stretch factor always depending on the
+document font size. And using \cs{singlespacing}, \cs{onehalfspacing} or
+\cs{doublespacing} or even \cs{setstretch}\SpecialCommandIndex{\setstretch}
+after switching the font size using \cs{fontsize} instead of \cs{Huge},
+\cs{huge}, \cs{LARGE}, \cs{Large}, \cs{large}, \cs{normalsize}, \cs{small},
+\cs{footnotesize}, \cs{scriptsize}, \cs{tiny}, or another command defined
+using \cs{@setsize}, reactivates the last used such font size commd. So using
+something like
+\begin{verbatim}
+ \normalsize\fontsize{5pt}{7pt}\selectfont\onehalfspacing
+\end{verbatim}
+result in \cs{normalsize} with onehalfspacing, not 5\,pt with onehalfspacing!
+
+Package \pkg*{setspaceenhanced} uses for
+\cs{onehalfspacing} and \cs{doublespacing} a calculation of the stretch factor
+depending on the selected baseline skip and font size. So using something like
+\begin{verbatim}
+ \normalsize\fontsize{5pt}{7pt}\onehalfspacing
+\end{verbatim}
+will not set the stretch factor based on \cs{normalsize} but based on font
+size 5\,pt with baseline skip 7\,pt. So this results in real onehalfspacing
+of the 5\,pt font.
+
+In other words: Package \pkg*{setspaceenhanced} uses a completely different
+definition of \cs{onehalfspacing} and \cs{doublespacing}. It always uses
+\cs{f@size} and \cs{f@baselineskip} to calculate a factor resulting in real
+onehalfspacing and doublespacing. This also means, if you use one of these
+commands after changing the font size, a new stretch factor is calculated
+depending on the current font size without changing the font size.
+
+\section{How to use
+ \texorpdfstring{\pkg*{setspaceenhanced}}{setspaceenhanced}?}
+\label{sec:howtouse}
+
+In the document preamble of your document you just can replace
+\begin{verbatim}
+ \usepackage{setspace}
+\end{verbatim}
+by
+\begin{verbatim}
+ \usepackage{setspaceenhanced}
+\end{verbatim}
+to load package \pkg*{setspaceenhanced}. This does still also load package
+\pkg{setspace} but additionally replaces several commands of \pkg{setspace} to
+avoid the issues shown in \autoref{sec:whywithkomascript} and
+\autoref{sec:whywithoutkomascript}. \pkg*{setspaceenhanced} also does support
+the same options as \pkg{setspace}. So you can also replace, e.g.
+\begin{verbatim}
+ \usepackage[onehalfspaceing]{setspace}
+\end{verbatim}
+by
+\begin{verbatim}
+ \usepackage[onehalfspacing]{setspaceenhanced}
+\end{verbatim}
+
+If you want you can alternatively also load both packages explicitly, either
+\pkg{setspace} before \pkg{setspaceenhanced} or---if you
+want---\pkg{setspaceenhanced} before \pkg{setspace}. In this case, you should
+use the same options for both package.
+
+This is also useful, if you use a package, that uses \pkg{setspace} itself. In
+this case, you always should load \pkg*{setspaceenhanced} \emph{before} the
+package, that uses \pkg{setspace}. Otherwise it is very likely that the
+initial line spacing is still done with the unchanged commands and settings of
+\pkg{setspace} and therefore the full functionality of \pkg*{setspaceenhanced}
+cannot be reached. Only if \pkg*{setspaceenhanced} is loaded before the first
+use of \cs{singlespacing}, \cs{onehalfspacing}, \cs{doublespacing}, or
+\cs{setstretch} can it be ensured that the enhancements of
+\pkg*{setspaceenhanced} are initialized and used correctly.
+
+When using a class that uses \pkg{setspace}, the correct operation can be
+ensured with
+\begin{verbatim}
+ \AddToHook{package/setspace/after}{\RequirePackage{setspaceenhanced}}
+\end{verbatim}
+even before \cs{documentclass}. This requires at least \LaTeX{}
+2020/10/01. For older versions of \LaTeX{} you can use
+\begin{verbatim}
+ \RequirePackage{scrlfile}
+ \AfterPackage{setspace}{\RequirePackage{setspaceenhanced}}
+\end{verbatim}
+also before \cs{documentclass}. This would require the \KOMAScript{} package
+\pkg{scrlfile}\nocite{pkg:scrlfile}. In both cases you should also use the
+same optional argument for \cs{RequirePackage}, that is used for loading
+\pkg{setspace}.
+
+Package \pkg*{setspaceenhanced} provides all options and commands of the user
+interface of \pkg{setspace}, see \autocite{pkg:setspace:manual}. Following we
+document only the differences and enhancements.
+
+There are some options influencing the behavior and result of the examples
+shown in the section before. All these options are
+\opt{\meta{key}=\meta{value}} options using the new \LaTeX{} kernel
+interface. Therefore the package needs at least \LaTeX{} 2022-06-01.
+
+\DescribeCommand{\spacesetup}
+Options can be set as global option via \cs{documentclass}, as package option
+via \cs{usepackage} or using:
+\begin{quote}
+ \cs{spacesetup}\marg{options}
+\end{quote}
+The command can be used in the document preamble and also in the document
+body. In the document body the changes are local to the current
+group.
+
+\subsubsection*{Available options:}
+
+\begin{description}\setkomafont{descriptionlabel}{\ttfamily}
+\item[byselectfont=\meta{boolean}]%
+ \DescribeOption{byselectfont}%
+ \hfill initial=\optvalue{false}, default=\optvalue{true}\\
+ In the \pkg*{setspaceenhanced} examples in the previous section, the correct
+ factor has only been used, because of using \cs{onehalfspacing} after
+ changing the font size, e.g., to \cs{small}. If you use \cs{onehalfspacing}
+ before changing the font size, the factor is calculated with the previous
+ valid font size, which is the document font size 12\,pt in all these
+ examples. This\SpecialCommandIndex{\selectfont}\marginline{\cs{selectfont}}
+ behavior can be changed to a more dynamic automatism using option
+ \opt{byselectfont} or \opt{byselectfont=true}. This will use the generic
+ \LaTeX{} hook \texttt{selectfont} to reactivate \cs{onehalfspacing} or
+ \cs{doublespacing} after every \cs{selectfont} if the font size has been
+ changed.
+\item[doublespacing=\meta{real}]%
+ \DescribeOption{onehalfspacing}%
+ \hfill initial=\texttt{nan}, default=\emph{empty}\\
+ If this option is used without value, it is the same as \pkg{setspace}'s
+ package option \opt{doublespacing} or using command \cs{doublespacing}. But
+ if you assign a real number\footnote{\label{ftn:fp}Here are all values
+ allowed, that would be allowed as second argument of \LaTeX3 function
+ \cs{fp\string_set:Nn}} this would be used as the new stretch factor used
+ for doublespacing. This also means, that the default calculation of the
+ factor is deactivated. But a factor of \texttt{nan} would reactivate the
+ calculation of the factor depending on the font size and the baseline skip
+ set for the font size. It is recommended to use the option always without
+ value!
+\item[fontsize=\meta{boolean}]%
+ \DescribeOption{fontsize}%
+ \DescribeCommand{\setstretch}%
+ \hfill initial=\optvalue{false}, default=\optvalue{true}\\
+ As explained in \autoref{sec:whywithoutkomascript}, \pkg{setspace}'s
+ \cs{setstretch} behaves different after a font size command like \cs{Huge},
+ \cs{huge}, \cs{LARGE}, \cs{Large}, \cs{large}, \cs{normalsize}, \cs{small},
+ \cs{footnotesize}, \cs{scriptsize}, \cs{tiny}, or another command defined
+ using \cs{@setsize} than after using |\fontsize{…}{…}\selectfont|. With the
+ last the font size will be reset to the previous usage of one of the other
+ or the document font size. For a lot of users this is somehow
+ unexpected. With option \opt{fontsize} or \opt{fontsize=true} this is
+ changed and using \cs{setstretch} does not reactivate the last used
+ \cs{Huge}, \cs{huge}, \cs{LARGE}, \cs{Large}, \cs{large}, \cs{normalsize},
+ \cs{small}, \cs{footnotesize}, \cs{scriptsize}, \cs{tiny}.
+\item[onehalfspacing=\meta{real}]%
+ \DescribeOption{onehalfspacing}%
+ \hfill initial=\texttt{nan}, default=\emph{empty}\\
+ If this option is used without value, it is the same as \pkg{setspace}'s
+ package option \opt{onehalfspacing} or using command
+ \cs{onehalfspacing}. But if you assign a real number\footref{ftn:fp} this
+ would be used as the new stretch factor used for onehalfspacing. This also
+ means, that the default calculation of the factor is deactivated. But a
+ factor of \texttt{nan} would reactivate the calculation of the factor
+ depending on the font size and the baseline skip set for the font size. It
+ is recommended to use the option always without value!
+\item[singlespacing=\meta{real}]%
+ \DescribeOption{singlespacing}%
+ \hfill initial=1, default=\emph{empty}\\
+ If this option is used without value, it is the same as \pkg{setspace}'s
+ package option \opt{singlespacing} or using command \cs{singlespacing}. But
+ if you assign a real number\footref{ftn:fp} this would be used as the new
+ stretch factor used for singlespacing. So this is similar to using
+ \cs{SetSinglespace}\marg{real}\cs{singlespacing}. A factor of \texttt{nan}
+ would activate the calculation of the factor depending on the font size and
+ the baseline skip set for the font size. It is recommended to use the option
+ always without value!
+\end{description}
+
+\subsubsection*{Compatibility Notes:}
+
+\begin{description}
+\item[\pkg*{scrhack}] If you want to use this package together with package
+ \pkg*{scrhack} from \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript}
+ before version 3.42, you should deactivate the \file{setspace} hack using
+ \pkg*{scrhack}' option \opt{setspace=false}. From version 3.42
+ \pkg*{scrhack} does not use the old hacks any longer but
+ \pkg*{setspaceenhanced} and is therefore compatible again.
+\end{description}
+
+\section{How does the result of
+ \texorpdfstring{\pkg*{setspaceenhanced}}{setspaceenhanced} differ from
+ \texorpdfstring{\pkg{setspace}}{setspace} even for using the standard font
+ sizes of the standard classes?}
+
+For example if you have a document:
+\begin{verbatim}
+ \documentclass[12pt]{article}
+ \usepackage{setspace}
+ \begin{document}
+ \small\onehalfspacing This is font size
+ \csname f@size\endcsname pt with
+ normal baseline skip \csname f@baselineskip\endcsname.
+ The current stretch factor is \baselinestretch. This
+ results in a baseline skip of \the\baselineskip.
+ \end{document}
+\end{verbatim}
+this will result in:
+\begin{quote}
+ This is font size 10.95pt with normal baseline skip 13.6pt. The current
+ stretch factor is 1.241. This results in a baseline skip of 16.87756pt.
+\end{quote}
+But one moment: $10.95\,\textrm{pt}\cdot 1.5 = 16.425\,\textrm{pt}$. So the
+factor seems to be wrong. It is not real onehalfspacing depending on the used
+font size. It is also not onehalfspacing depending on the document font size,
+because this would need a baseline skip of 18\,pt. So what is it? It is using
+the stretch factor of 12\,pt for the 10.95\,pt of \cs{small}.
+
+With \pkg{setspaceenhanced}:
+\begin{verbatim}
+ \documentclass[12pt]{article}
+ \usepackage{setspaceenhanced}
+ \begin{document}
+ \small\onehalfspacing This is font size
+ \csname f@size\endcsname pt with
+ normal baseline skip \csname f@baselineskip\endcsname.
+ The current stretch factor is \baselinestretch. This
+ results in a baseline skip of \the\baselineskip.
+ \end{document}
+\end{verbatim}
+the result changes:
+\begin{quote}
+ This is font size 10.95pt with normal baseline skip 13.6pt. The current
+ stretch factor is 1.207720046225135. This results in a baseline skip of
+ 16.42496pt.
+\end{quote}
+Here the difference from the correct value 16.425\,pt is very, very small:
+0.00004\,pt. So you can say, this is really onehalfspacing depending on the
+used font size.
+
+Moreover if you have a document:
+\begin{verbatim}
+ \documentclass[12pt]{article}
+ \usepackage{setspace}
+ \begin{document}
+ \fontsize{5pt}{7pt}\selectfont\onehalfspacing This is font size
+ \csname f@size\endcsname pt with
+ normal baseline skip \csname f@baselineskip\endcsname.
+ The current stretch factor is \baselinestretch. This
+ results in a baseline skip of \the\baselineskip.
+ \end{document}
+\end{verbatim}
+this result in:
+\begin{quote}
+ This is font size 12pt with normal baseline skip 14.5pt. The current stretch
+ factor is 1.241. This results in a baseline skip of 17.99446pt.
+\end{quote}
+But
+\begin{verbatim}
+ \documentclass[12pt]{article}
+ \usepackage[fontsize]{setspaceenhanced}
+ \begin{document}
+ \fontsize{5pt}{7pt}\selectfont\onehalfspacing This is font size
+ \csname f@size\endcsname pt with
+ normal baseline skip \csname f@baselineskip\endcsname.
+ The current stretch factor is \baselinestretch. This
+ results in a baseline skip of \the\baselineskip.
+ \end{document}
+\end{verbatim}
+results in:
+\begin{quote}
+ This is font size 5pt with normal baseline skip 7.0pt. The current stretch
+ factor is 1.071428571428571. This results in a baseline skip of 7.49998pt.
+\end{quote}
+In my opinion this is more the expected result. See the previous
+\autoref{sec:howtouse} for more information about options like \opt{fontsize}.
+% \iffalse
+%</doc>
+% \fi
+%
+% \MaybeStop{\printbibliography[heading=bibintoc]\PrintIndex}
+%
+% \iffalse
+%<*package>
+%<@@=setspaceenhanced>
+% \fi
+% \section{Implementation}
+%
+% We use the new \LaTeX{} kernel feature of \opt{\meta{key}=\meta{value}}
+% options introduced in \autocite{latexnews35}. So we need at least \LaTeX{}
+% 2022-06-01:
+% \begin{macrocode}
+\ifnum 0=\ifcsname IfFormatAtLeastTF\endcsname
+ \IfFormatAtLeastTF{2022-06-01}{1}{0}
+ \else
+ 0
+ \fi\relax
+ \PackageError{setspaceenhanced}{LaTeX~kernel~too~old}{
+ The~package~needs~at~least~LaTeX~2022-06-01.\MessageBreak
+ This~error~is~fatal.~Loading~will~be~aborted
+ }
+ \endinput
+\fi
+% \end{macrocode}
+%
+% We do not pass any options to \pkg{setspace}, because we handle them
+% different. So we can just load the package here:
+% \begin{macrocode}
+\RequirePackage{setspace}
+% \end{macrocode}
+%
+% \ExplSyntaxOn
+% \begin{Constant}{\c_@@_single_fp,\c_@@_onehalf_fp,\c_@@_double_fp}
+% \ExplSyntaxOff
+% The internal constants store the absolute factor for singlespacing,
+% onehalfspacing and doublespacing used to calculate the stretch factors.
+% \begin{macrocode}
+\fp_const:Nn \c_@@_single_fp { 1.2 }
+\fp_const:Nn \c_@@_onehalf_fp { 1.5 }
+\fp_const:Nn \c_@@_double_fp { 2.0 }
+% \end{macrocode}
+% \end{Constant}
+%
+% \begin{Variable}{\@@_single_factor_fp,
+% \@@_onehalf_factor_fp,
+% \@@_double_factor_fp}
+% \ExplSyntaxOff
+% The internal variables used to store the configured stretch factors for
+% singlespacing, onehalfspacing and doublespacing. If \texttt{nan}
+% \cs{@@\_linespread} is calculated.
+% \begin{macrocode}
+\fp_new:N \@@_single_factor_fp \fp_set:Nn \@@_single_factor_fp { 1.0 }
+\fp_new:N \@@_onehalf_factor_fp \fp_set_eq:NN \@@_onehalf_factor_fp \c_nan_fp
+\fp_new:N \@@_double_factor_fp \fp_set_eq:NN \@@_double_factor_fp \c_nan_fp
+% \end{macrocode}
+% \end{Variable}
+%
+% \begin{Variable}{\@@_linespread_fp,\@@_fp}
+% \ExplSyntaxOff
+% Storage of the current calculated stretch factor and the used constant.
+% \begin{macrocode}
+\fp_new:N \@@_linespread_fp \fp_set:Nn \@@_linespread_fp { 1.0 }
+% \end{macrocode}
+% \end{Variable}
+%
+% \begin{macro}{\@@_set_spacing:nn}
+% \ExplSyntaxOff
+% These commands are used to set the stretch factor for one of the
+% spacings.
+% \begin{macrocode}
+\cs_new:Nn \@@_set_spacing:nn
+ {
+ \tl_if_blank:nF { #1 }
+ {
+ \fp_set:cn { @@_#2_factor_fp } { #1 }
+ }
+ \fp_if_nan:nTF { \tl_use:c { @@_#2_factor_fp } }
+ {
+ \fp_set_eq:Nc \@@_fp { c_@@_#2_fp }
+ \@@_calc_stretch:
+ }
+ {
+ \fp_set_eq:Nc \@@_linespread_fp { @@_#2_factor_fp }
+ \fp_set_eq:NN \@@_fp \c_nan_fp
+ }
+ \setstretch{ \fp_to_decimal:N \@@_linespread_fp }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_calc_stretch:}
+% \ExplSyntaxOff
+% This macro is used to (re-)calculate the stretch factor
+% \cs{@@\_calcstretch} if the the current used constant is not
+% \texttt{nan}.
+% \begin{macrocode}
+\cs_new:Nn \@@_calc_stretch:
+ {
+ \fp_if_nan:nF { \@@_fp }
+ {
+ \fp_set:Nn \@@_linespread_fp
+ {
+ \f@size / \dim_to_fp:n { \f@baselineskip } * \@@_fp
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+% \ExplSyntaxOff
+%
+% \begin{command}{\selectfont}
+% We also need to hook into \cs{selectfont} using the general
+% \texttt{selectfont} hook to re-calculate the stretch factor after the font
+% size has been changed and \opt{byselectfont=true}.
+% \begin{macrocode}
+\hook_gput_code:nnn { selectfont } { setspaceenhanced }
+ {%
+ \bool_if:NT \__setspaceenhanced_byselectfont_bool
+ {
+ \cs_if_exist:NT \size@update
+ {
+ \fp_set:Nn \l_tmpa_fp { \f@linespread }
+ \fp_compare:nNnT \__setspaceenhanced_linespread_fp = \l_tmpa_fp
+ {
+ \__setspaceenhanced_calc_stretch:
+ \set@fontsize
+ {
+ \fp_to_decimal:N \__setspaceenhanced_linespread_fp
+ }
+ \f@size \f@baselineskip
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{command}
+%
+% \begin{command}{\setstretch}
+% If \opt{fontsize=false}, we use the original functionality of
+% \pkg{setspace}. But with \opt{fontsize=true} we use \cs{linespread}:
+% \begin{macrocode}
+\renewcommand*{\setstretch}[1]{
+ \bool_if:NTF \@@_fontsize_bool
+ {
+ \linespread{#1}\selectfont
+ }
+ {
+ \def\baselinestretch{#1}%
+ \@currsize
+ }
+}
+% \end{macrocode}
+% \end{command}
+%
+% Almost the end of the package we define all options:
+% \begin{macrocode}
+\DeclareKeys{%
+ singlespacing .code = \@@_set_spacing:nn {#1} {single},
+ singlespacing .usage = general,
+ onehalfspacing .code = \@@_set_spacing:nn {#1} {onehalf},
+ onehalfspacing .usage = general,
+ doublespacing .code = \@@_set_spacing:nn {#1} {double},
+ doublespacing .usage = general,
+ byselectfont .bool_set:N = \@@_byselectfont_bool,
+ byselectfont .default:n = true,
+ byselectfont .initial:n = false,
+ fontsize .bool_set:N = \@@_fontsize_bool,
+ fontsize .default:n = true,
+ fontsize .initial:n = false,
+}
+% \end{macrocode}
+% And process them:
+% \begin{macrocode}
+\ProcessKeyOptions\relax
+% \end{macrocode}
+%
+% \begin{command}{\singlespacing,\onehalfspacing,\doublespacing,\SetSingleSpace}
+% We have to redefine the user interface commands for
+% singlespacing, onehalfspacing and doublespacing.
+% \begin{macrocode}
+\renewcommand*{\singlespacing}{
+ \__setspaceenhanced_set_spacing:nn {} {single}
+}
+\renewcommand*{\onehalfspacing}{
+ \__setspaceenhanced_set_spacing:nn {} {onehalf}
+}
+\renewcommand*{\doublespacing}{
+ \__setspaceenhanced_set_spacing:nn {} {double}
+}
+\renewcommand*{\SetSinglespace}[1]{
+ \fp_set:Nn \@@_single_factor_fp { #1 }
+}
+% \end{macrocode}
+% \end{command}
+%
+% \begin{macro}{\setspace@singlespace}
+% \begin{description}
+% \item[Note:] Defining this internal macro does not work using
+% \pkg*{setspaceenhanced}.
+% \marginline{\raisebox{\dimexpr\ht\strutbox-\height\relax}{\Huge\textcolor{red}{?}}}^^A
+% Should we add a test for users and package authors, who do not use
+% \cs{SetSinglespace} but redefine the internal macro?
+% \end{description}
+% \end{macro}
+%
+% \begin{command}{spacesetup}
+% User interface to not need to use \cs{SetKeys}:
+% \begin{macrocode}
+\newcommand*{\spacesetup}{\SetKeys[setspaceenhanced]}
+% \end{macrocode}
+% \end{command}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \Finale
+% \PrintChanges
+%
+% \endinput
+% Local Variables:
+% mode: doctex
+% ispell-local-dictionary: "en_US"
+% eval: (flyspell-mode 1)
+% TeX-master: t
+% End:
diff --git a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf
new file mode 100644
index 0000000000..ac6c07e0a2
--- /dev/null
+++ b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf
Binary files differ
diff --git a/macros/luatex/latex/lualinalg/README.txt b/macros/luatex/latex/lualinalg/README.txt
index 03a71035cb..8f664663c1 100644
--- a/macros/luatex/latex/lualinalg/README.txt
+++ b/macros/luatex/latex/lualinalg/README.txt
@@ -1,5 +1,5 @@
# The lualinalg package
-# version 1.3
+# version 1.4
# Authors: Chetan Shirore and Ajit Kumar
# Email: mathsbeauty@gmail.com
diff --git a/macros/luatex/latex/lualinalg/lualinalg-complex.lua b/macros/luatex/latex/lualinalg/lualinalg-complex.lua
deleted file mode 100644
index 68fd055b5e..0000000000
--- a/macros/luatex/latex/lualinalg/lualinalg-complex.lua
+++ /dev/null
@@ -1,347 +0,0 @@
---Version=1.3, Date=30-July-2023
--- provides module for complex numbers
---Contains a modified version of the file complex.lua. It is availalbe on the link https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua. This is licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions.
---Licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions.
-
-frac= require("luamaths-fractions")
-complex = {}
-complex_meta = {}
-
-local function parse_scalar(s, pos0)
- local x, n, pos = s:match('^([+-]?[%d%.]+)(.?)()', pos0)
- if not x then return end
- if n == 'e' or n == 'E' then
- local x2, n2, pos2 = s:match('^([+-]?%d+)(.?)()', pos)
- if not x2 then error 'number format error' end
- x = tonumber(x..n..x2)
- if not x then error 'number format error' end
- return x, n2, pos2
- else
- x = tonumber(x)
- if not x then error 'number format error' end
- return x, n, pos
- end
-end
-local function parse_component(s, pos0)
- local x, n, pos = parse_scalar(s, pos0)
- if not x then
- local x2, n2, pos2 = s:match('^([+-]?)(i)()$', pos0)
- if not x2 then error 'number format error' end
- return (x2=='-' and -1 or 1), n2, pos2
- end
- if n == '/' then
- local x2, n2, pos2 = parse_scalar(s, pos)
- x = x / x2
- return x, n2, pos2
- end
- return x, n, pos
-end
-local function parse_complex(s)
- local x, n, pos = parse_component(s, 1)
- if n == '+' or n == '-' then
- local x2, n2, pos2 = parse_component(s, pos)
- if n2 ~= 'i' or pos2 ~= #s+1 then error 'number format error' end
- if n == '-' then x2 = - x2 end
- return x, x2
- elseif n == '' then
- return x, 0
- elseif n == 'i' then
- if pos ~= #s+1 then error 'number format error' end
- return 0, x
- else
- error 'number format error'
- end
-end
-
-function complex.to( num )
- -- check for table type
- if type( num ) == "table" then
- -- check for a complex number
- if getmetatable( num ) == complex_meta then
- return num
- end
-
- if getmetatable( num) == frac_mt then
- return setmetatable( { num, 0 }, complex_meta )
- end
-
- local real,imag = tonumber( num[1] ),tonumber( num[2] )
- if real and imag then
- return setmetatable( { real,imag }, complex_meta )
- end
- return
- end
- local isnum = tonumber( num )
- if isnum then
- return setmetatable( { isnum,0 }, complex_meta )
- end
- if type( num ) == "string" then
- local real, imag = parse_complex(num)
- return setmetatable( { real, imag }, complex_meta )
- end
-end
-
-setmetatable( complex, { __call = function( _,num ) return complex.to( num ) end } )
-
-function complex.new( x,y)
- return setmetatable( {x,y}, complex_meta )
-end
-
-lcomplex = complex.new
-function complex.type( arg )
- if getmetatable( arg ) == complex_meta then
- return "complex"
- end
-end
-
-function complex.convpolar( radius, phi )
- return setmetatable( { radius * math.cos( phi ), radius * math.sin( phi ) }, complex_meta )
-end
-
-function complex.convpolardeg( radius, phi )
- phi = phi/180 * math.pi
- return setmetatable( { radius * math.cos( phi ), radius * math.sin( phi ) }, complex_meta )
-end
-
-function complex.tostring( cx,formatstr )
- imunit = "\\imUnit"
- local real,imag = cx[1],cx[2]
- if type(cx[1]) ~= "table" and type(cx[2]) ~= "table" then
- if imag == 0 then
- return real
- elseif real == 0 then
- return ((imag==1 and "") or (imag==-1 and "-") or imag)..imunit
- elseif imag > 0 then
- return real.."+"..(imag==1 and "" or imag)..imunit
- end
- return real..(imag==-1 and "-" or imag)..imunit
- end
-
- if type(cx[1]) == "table" and type(cx[2]) ~= "table" then
- if cx[2] == 0 then
- return frac.tostring(cx[1])
- end
- if cx[2] > 0 then
- return frac.tostring(cx[1]).. "+"..(imag==1 and "" or imag)..imunit
- end
- if cx[2] < 0 then
- return frac.tostring(cx[1])..(imag==-1 and "-" or imag)..imunit
- end
-
- end
-
- if type(cx[1]) ~= "table" and type(cx[2]) == "table" then
- if frac.toFnumber(cx[2])==0 then return cx[1] end
- return cx[1].."+"..frac.tostring(cx[2])..imunit
- end
-
- if type(cx[1]) == "table" and type(cx[2]) == "table" then
- if frac.toFnumber(cx[1]) == 0 and frac.toFnumber(cx[2]) ~= 0 then
- return frac.tostring(cx[2])..imunit
- end
-
- if frac.toFnumber(cx[2]) == 0 then
- return frac.tostring(cx[1] + 0)
- end
-
- if cx[2].d == 1 then
- if cx[2].n > 0 then
- return frac.tostring(cx[1]).. "+"..(cx[2].n==1 and "" or math.floor(cx[2].n))..imunit
- end
- if cx[2].n < 0 then
- return frac.tostring(cx[1])..(cx[2].n==-1 and "-" or math.floor(cx[2].n))..imunit
- end
- end
- end
- return frac.tostring(cx[1]).. "+"..frac.tostring(cx[2])..imunit
-end
-
-function complex.print( ... )
- print( complex.tostring( ... ) )
-end
-
-function complex.polar( cx )
- return math.sqrt( cx[1]^2 + cx[2]^2 ), math.atan2( cx[2], cx[1] )
-end
-
-function complex.polardeg( cx )
- return math.sqrt( cx[1]^2 + cx[2]^2 ), math.atan2( cx[2], cx[1] ) / math.pi * 180
-end
-
-function complex.norm2( cx )
- return cx[1]^2 + cx[2]^2
-end
-
-function complex.abs( cx )
- return math.sqrt( cx[1]^2 + cx[2]^2 )
-end
-
-function complex.get( cx )
- return cx[1],cx[2]
-end
-
-function complex.set( cx,real,imag )
- cx[1],cx[2] = real,imag
-end
-
-function complex.is( cx,real,imag )
- if cx[1] == real and cx[2] == imag then
- return true
- end
- return false
-end
-
-function complex.copy( cx )
- return setmetatable( { cx[1],cx[2] }, complex_meta )
-end
-
-function complex.add( cx1,cx2 )
- return setmetatable( { cx1[1]+cx2[1], cx1[2]+cx2[2] }, complex_meta )
-end
-
-function complex.sub( cx1,cx2 )
- return setmetatable( { cx1[1]-cx2[1], cx1[2]-cx2[2] }, complex_meta )
-end
-
-function complex.mul( cx1,cx2 )
- return setmetatable( { cx1[1]*cx2[1] - cx1[2]*cx2[2],cx1[1]*cx2[2] + cx1[2]*cx2[1] }, complex_meta )
-end
-
-function complex.mulnum( cx,num )
- return setmetatable( { cx[1]*num,cx[2]*num }, complex_meta )
-end
-
-function complex.div( cx1,cx2 )
- local val = cx2[1]*cx2[1] + cx2[2]*cx2[2]
- return setmetatable( { (cx1[1]*cx2[1]+cx1[2]*cx2[2])/val,(cx1[2]*cx2[1]-cx1[1]*cx2[2])/val }, complex_meta )
-end
-
-function complex.divnum( cx,num )
- return setmetatable( { cx[1]/num,cx[2]/num }, complex_meta )
-end
-
-function complex.pow( cx,num )
- if math.floor( num ) == num then
- if num < 0 then
- local val = cx[1]^2 + cx[2]^2
- cx = { cx[1]/val,-cx[2]/val }
- num = -num
- end
- local real,imag = cx[1],cx[2]
- for i = 2,num do
- real,imag = real*cx[1] - imag*cx[2],real*cx[2] + imag*cx[1]
- end
- return setmetatable( { real,imag }, complex_meta )
- end
- local length,phi = math.sqrt( cx[1]^2 + cx[2]^2 )^num, math.atan2( cx[2], cx[1] )*num
- return setmetatable( { length * math.cos( phi ), length * math.sin( phi ) }, complex_meta )
-end
-
-function complex.sqrt( cx )
- local h
- local k
-
- if type(cx[1]) ~= "table" then h = cx[1] end
- if type(cx[2]) ~= "table" then k = cx[2] end
-
- if type(cx[1]) == "table" then h = frac.toFnumber(cx[1]) end
- if type(cx[2]) == "table" then k = frac.toFnumber(cx[2]) end
- local len = math.sqrt( h^2 + k^2 )
- local sign = ( h<0 and -1) or 1
- return setmetatable( { math.sqrt((h +len)/2), sign*math.sqrt((len-h)/2) }, complex_meta )
-end
-
-function complex.ln( cx )
- return setmetatable( { math.log(math.sqrt( cx[1]^2 + cx[2]^2 )),
- math.atan2( cx[2], cx[1] ) }, complex_meta )
-end
-
-function complex.exp( cx )
- local expreal = math.exp(cx[1])
- return setmetatable( { expreal*math.cos(cx[2]), expreal*math.sin(cx[2]) }, complex_meta )
-end
-
-function complex.conjugate( cx )
- return setmetatable( { cx[1], -cx[2] }, complex_meta )
-end
-
-function Xround(num, numDecimalPlaces)
- if type(num)=="number" then
- if num==math.floor(num) then
- return math.floor(num)
- end
- end
- if type(num)=="number" then
- local mult = 10^(numDecimalPlaces or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- return num
-end
-
-function complex.round( cx,idp )
- local mult =10^( idp or 0 )
- if type(cx[1]) ~= "table" and type(cx[2]) ~= "table" then
- return setmetatable( {Xround(cx[1],idp), Xround(cx[2],idp)}, complex_meta )
- end
- if type(cx[1]) ~= "table" and type(cx[2]) == "table" then
- return setmetatable( {Xround(cx[1],idp), cx[2]}, complex_meta )
- end
- if type(cx[1]) == "table" and type(cx[2]) ~= "table" then
- return setmetatable({cx[1],Xround(cx[2],idp)}, complex_meta )
- end
- if type(cx[1]) == "table" and type(cx[2]) == "table" then
- return setmetatable({cx[1],cx[2]}, complex_meta )
- end
-end
-
-complex.zero = complex.new(0, 0)
-complex.one = complex.new(1, 0)
-
-complex_meta.__add = function( cx1,cx2 )
-local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 )
-return complex.add( cx1,cx2 )
-end
-complex_meta.__sub = function( cx1,cx2 )
-local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 )
-return complex.sub( cx1,cx2 )
-end
-complex_meta.__mul = function( cx1,cx2 )
-local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 )
-return complex.mul( cx1,cx2 )
-end
-complex_meta.__div = function( cx1,cx2 )
-local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 )
-return complex.div( cx1,cx2 )
-end
-complex_meta.__pow = function( cx,num )
-if num == "*" then
-return complex.conjugate( cx )
-end
-return complex.pow( cx,num )
-end
-complex_meta.__unm = function( cx )
-return setmetatable( { -cx[1], -cx[2] }, complex_meta )
-end
-complex_meta.__eq = function( cx1,cx2 )
-if cx1[1] == cx2[1] and cx1[2] == cx2[2] then
-return true
-end
-return false
-end
-complex_meta.__tostring = function( cx )
-return tostring( complex.tostring( cx ) )
-end
-complex_meta.__concat = function( cx,cx2 )
-return tostring(cx)..tostring(cx2)
-end
--- cx( cx, formatstr )
-complex_meta.__call = function( ... )
-print( complex.tostring( ... ) )
-end
-complex_meta.__index = {}
-for k,v in pairs( complex ) do
-complex_meta.__index[k] = v
-end
-
-return complex
-
diff --git a/macros/luatex/latex/lualinalg/lualinalg-fractions.lua b/macros/luatex/latex/lualinalg/lualinalg-fractions.lua
deleted file mode 100644
index e4ab7a2329..0000000000
--- a/macros/luatex/latex/lualinalg/lualinalg-fractions.lua
+++ /dev/null
@@ -1,225 +0,0 @@
--- The luafractions module
--- Authors: Chetan Shirore and Ajit Kumar
--- version 1.0, Date=03-Aug-2023
--- Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt.
-
-M = {} -- the module
-frac_mt = {} -- the metatable
-function M.new (n, d, mode)
- mode = mode or 'fracs'
- if mode == 'nofracs' then
- return (n/d)
- end
- if mode == 'fracs' then
- if n~=math.floor(n) or d~=math.floor(d) then
- error('Only integers are expected.')
- end
- if d == 0 then
- error('Invalid fraction')
- end
- local fr = {}
- local g = M.lgcd(n,d)
- fr = {n=n/g, d=d/g}
- return setmetatable(fr,frac_mt)
- end
-end
-lfrac = M.new
-
-function M.lgcd (a, b)
- local r
- while (b ~= 0) do
- r = a % b
- a = b
- b = r
- end
- return a
-end
-
-function M.simp (num)
- local cf = gcd(num[1], num[2])
- return M.new(num[1] / cf, num2[2] / cf)
-end
-
-function M.toFnumber(c)
- return c.n / c.d
-end
-
-function M.toFrac(x)
- if type(x) == "number" then
- if x==math.floor(x) then
- return M.new(math.floor(x),1)
- else
- return x
- end
- end
- return x
-end
-
-
-function addFracs (c1, c2)
- return M.new(c1.n * c2.d + c1.d * c2.n, c1.d*c2.d)
-end
-
-function subFracs (c1, c2)
- return M.new(c1.n * c2.d - c1.d * c2.n, c1.d*c2.d)
-end
-
-function mulFracs (c1, c2)
- return M.new(c1.n * c2.n, c1.d*c2.d)
-end
-
-function divFracs (c1, c2)
- return M.new(c1.n * c2.d, c1.d*c2.n)
-end
-
-function minusFracs (c1)
- return M.new(-c1.n,c1.d)
-end
-
-function powerFracs (c1,m)
- return M.new((c1.n)^m,(c1.d)^m)
-end
-
-
-function M.add(a, b)
- if type(a) == "number" then
- if a==math.floor(a) then
- return addFracs(M.new(a,1),b)
- else
- return a + M.toFnumber(b)
- end
- end
-
- if type(b) == "number" then
- if b==math.floor(b) then
- return addFracs(a,M.new(b,1))
- else
- return M.toFnumber(a) + b
- end
- end
-
- if type( a ) == "table" and type(b) =="table" then
- if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then
- return setmetatable( { a+b[1], b[2] }, complex_meta )
- end
- end
-
- if type( a ) == "table" and type(b) =="table" then
- if getmetatable( b ) == frac_mt and getmetatable( a ) == complex_meta then
- return setmetatable( { b+a[1], a[2] }, complex_meta )
- end
- end
- return addFracs(a, b)
-end
-
-
-function M.sub(a, b)
- if type(a) == "number" then
- if a==math.floor(a) then
- return subFracs(M.new(a,1),b)
- else
- return a - M.toFnumber(b)
- end
- end
-
- if type(b) == "number" then
- if b==math.floor(b) then
- return subFracs(a,M.new(b,1))
- else
- return M.toFnumber(a) - b
- end
- end
-
- if type( a ) == "table" and type(b) =="table" then
- if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then
- return setmetatable( { a-b[1], b[2] }, complex_meta )
- end
- end
-
- if type( a ) == "table" and type(b) =="table" then
- if getmetatable( b ) == frac_mt and getmetatable( a ) == complex_meta then
- return setmetatable( { a[1]-b, a[2] }, complex_meta )
- end
- end
- return subFracs(a, b)
-end
-
-
-function M.mul(a, b)
- if type(a) == "number" then
- if a==math.floor(a) then
- return mulFracs(M.new(a,1),b)
- else
- return a * M.toFnumber(b)
- end
- end
-
- if type(b) == "number" then
- if b==math.floor(b) then
- return mulFracs(a,M.new(b,1))
- else
- return M.toFnumber(a) * b
- end
- end
-
- if type( a ) == "table" and type(b) =="table" then
- if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then
- return setmetatable( { a*b[1], a*b[2] }, complex_meta )
- end
- end
-
- if type( a ) == "table" and type(b) =="table" then
- if getmetatable( b ) == frac_mt and getmetatable( a ) == complex_meta then
- return setmetatable( { b*a[1], b*a[2] }, complex_meta )
- end
- end
- return mulFracs(a, b)
-end
-
-
-function M.div(a, b)
- if type(a) == "number" then
- if a==math.floor(a) then
- return divFracs(M.new(a,1),b)
- else
- return a / M.toFnumber(b)
- end
- end
-
- if type(b) == "number" then
- if b==math.floor(b) then
- return divFracs(a,M.new(b,1))
- else
- return M.toFnumber(a) / b
- end
- end
-
- if type( a ) == "table" and type(b) =="table" then
- if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then
- b= setmetatable( { M.toFrac(b[1]), M.toFrac(b[2]) }, complex_meta )
- return a*(1/b)
- end
- end
- return divFracs(a, b)
-end
-
-function M.tostring (c)
- if c.d == 1 then
- return string.format("%g",c.n)
- end
- if c.d == -1 then
- return string.format("%g",-c.n)
- end
- return string.format("\\frac{%g}{%g}", c.n, c.d)
-end
-
---Setting Metatable operations.
-frac_mt.__add = M.add
-frac_mt.__sub = M.sub
-frac_mt.__mul = M.mul
-frac_mt.__div = M.div
-frac_mt.__unm = minusFracs
-frac_mt.__pow = powerFracs
-frac_mt.__tostring = M.tostring
-
-return M \ No newline at end of file
diff --git a/macros/luatex/latex/lualinalg/lualinalg.pdf b/macros/luatex/latex/lualinalg/lualinalg.pdf
index b164d33407..adc8fe3290 100644
--- a/macros/luatex/latex/lualinalg/lualinalg.pdf
+++ b/macros/luatex/latex/lualinalg/lualinalg.pdf
Binary files differ
diff --git a/macros/luatex/latex/lualinalg/lualinalg.sty b/macros/luatex/latex/lualinalg/lualinalg.sty
index de120d131a..c16cfa1e14 100644
--- a/macros/luatex/latex/lualinalg/lualinalg.sty
+++ b/macros/luatex/latex/lualinalg/lualinalg.sty
@@ -1,18 +1,17 @@
% The lualinalg package
% Authors: Chetan Shirore and Ajit Kumar
-% version 1.3, Date=03-Aug-2023
+% version 1.4, Date=04-Aug-2023
% Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt.
-\ProvidesPackage{lualinalg}[1.3]
+\ProvidesPackage{lualinalg}[1.4]
\RequirePackage{xkeyval}
\RequirePackage{amsmath}
\RequirePackage{luamaths}
\RequirePackage{luacode}
\begin{luacode*}
-local complex = require "lualinalg-complex"
- local lfrac = require "lualinalg-fractions"
+
-- matrices part
matrices = {}
@@ -774,9 +773,9 @@ function matrix.gauss0E(mtx, augmt, fom, dignum)
tostring(stepCnt) ..
": Divide row " ..
tostring(r) ..
- " by " ..
+ " by $" ..
tostring(complex.round(complex(m), dignum)) ..
- ".$$" ..
+ "$. $$" ..
tostring(matrix.show(matrix.concath(mtx, augmt), fom, dignum)) ..
"$$"
end
@@ -798,9 +797,9 @@ function matrix.gauss0E(mtx, augmt, fom, dignum)
tostring(stepCnt) ..
": Multiply row " ..
tostring(r) ..
- " by " ..
+ " by $" ..
tostring(complex.round(complex(m), dignum)) ..
- " and subtract it from row " ..
+ "$ and subtract it from row " ..
tostring(i) ..
".$$" ..
tostring(
@@ -1183,9 +1182,9 @@ function vector.gsX(inptTbl, brckt, dignum)
str = str .. "\\ \\newline Take given vectors as $v_1,\\ldots, v_" .. k .. "$ in order."
if vector.euclidnorm(inptTbl[1]) ~= complex(0.0) then
- tbl[1] = vector.mulnum(inptTbl[1], 1 / vector.euclidnorm(inptTbl[1]))
+ tbl[1] = vector.mulnum(inptTbl[1], 1.0 / vector.euclidnorm(inptTbl[1]))
else
- tbl[1] = vector.mulnum(inptTbl[1], 1)
+ tbl[1] = vector.mulnum(inptTbl[1], 1.0)
end
setmetatable(tbl[1], vector_meta)
str = str .. "\\ \\newline Step " .. cnt .. ": $$ u_" .. cnt .. "=v_" .. cnt .. "="
@@ -1206,7 +1205,7 @@ function vector.gsX(inptTbl, brckt, dignum)
if vector.euclidnorm(tbl[i]) ~= complex(0.0) then
tbl[i] = vector.mulnum(tbl[i], 1 / vector.euclidnorm(tbl[i]))
else
- tbl[i] = vector.mulnum(tbl[i], 1)
+ tbl[i] = vector.mulnum(tbl[i], 1.0)
end
cnt = cnt + 1
diff --git a/macros/luatex/latex/lualinalg/lualinalg.tex b/macros/luatex/latex/lualinalg/lualinalg.tex
index 10b2d55c34..7c49480d27 100644
--- a/macros/luatex/latex/lualinalg/lualinalg.tex
+++ b/macros/luatex/latex/lualinalg/lualinalg.tex
@@ -1046,7 +1046,7 @@ The package has command \verb|\matrixRREFSteps| to produce step-by-step computat
\renewcommand*{\arraystretch}{1.0}
The command \verb|\matrixGaussJordan| is used to obtain Gauss-Jordan elimination of an augmented matrix.
\begin{lstlisting}
-\def\a{{{1,1,1},{2,-1,-1},{1,-1,1}}}
+\def\a{{{lfrac(1,2),1,1},{2,-1,-1},{1,-1,1}}}
\def\b{{{3},{3},{9}}}
\matrixNew{S}{\a}
\matrixNew{T}{\b}
@@ -1056,11 +1056,12 @@ $$W = \matrixPrint{W}$$
$$U = \matrixPrint{U}$$
\end{lstlisting}
The above code produces the following output.
-\def\a{{{1,1,1},{2,-1,-1},{1,-1,1}}}
+\def\a{{{lfrac(1,2),1,1},{2,-1,-1},{1,-1,1}}}
\def\b{{{3},{3},{9}}}
\matrixNew{S}{\a}
\matrixNew{T}{\b}
\matrixConcatH{W}{S}{T}
+\renewcommand{\arraystretch}{1.5}
\begin{framed}
$$W = \matrixPrint{W}$$
\matrixGaussJordan{U}{S}{T}
@@ -1070,6 +1071,7 @@ The package also has a command \verb|\matrixGaussJordanSteps| to produce step-by
\begin{framed}
\matrixGaussJordanSteps{S}{T}
\end{framed}
+\renewcommand{\arraystretch}{1.0}
\section{Customized usage}\label{customuse}
The commands available in the package can be used for performing further operations on vectors and matrices. The command \verb|\vectorAdd| can be extended to add more than two vectors. The latex document (listing \ref{code:custluavec}) provides some instances of such usage.
\begin{lstlisting}[label={code:custluavec}, caption={Customized usage of the lualinalg package}]
@@ -1179,4 +1181,5 @@ The sum of matrices \(m1,m2 \text{ and } m3 =\begin{bmatrix} 111 & 222 & 333 \
\item The error handling mechanism in the tool is not robust. There are some custom errors included in the package. However the package mostly depends on error handling mechanism of Lua. The error handling can be strengthened in future updates of the package.
\end{itemize}
+
\end{document} \ No newline at end of file
diff --git a/macros/luatex/latex/luamaths/README.txt b/macros/luatex/latex/luamaths/README.txt
index 926a94962c..43acb565dd 100644
--- a/macros/luatex/latex/luamaths/README.txt
+++ b/macros/luatex/latex/luamaths/README.txt
@@ -1,5 +1,5 @@
# The luamaths package
-# version 1.1
+# version 1.3
# Authors: Chetan Shirore and Ajit Kumar
# Email: mathsbeauty@gmail.com
diff --git a/macros/luatex/latex/luamaths/luamaths-complex.lua b/macros/luatex/latex/luamaths/luamaths-complex.lua
index 68fd055b5e..d8ad289d3f 100644
--- a/macros/luatex/latex/luamaths/luamaths-complex.lua
+++ b/macros/luatex/latex/luamaths/luamaths-complex.lua
@@ -1,7 +1,7 @@
---Version=1.3, Date=30-July-2023
+--Version=1.4, Date=04-Aug-2023
-- provides module for complex numbers
--Contains a modified version of the file complex.lua. It is availalbe on the link https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua. This is licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions.
---Licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions.
+--This file is also licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions.
frac= require("luamaths-fractions")
complex = {}
@@ -107,6 +107,12 @@ function complex.tostring( cx,formatstr )
imunit = "\\imUnit"
local real,imag = cx[1],cx[2]
if type(cx[1]) ~= "table" and type(cx[2]) ~= "table" then
+ if imag == 0 and math.floor(real)==real then
+ return math.floor(real)
+ end
+ if real == 0 and math.floor(imag)==imag and math.abs(math.floor(imag))~=1 then
+ return math.floor(imag)..imunit
+ end
if imag == 0 then
return real
elseif real == 0 then
diff --git a/macros/luatex/latex/luamaths/luamaths-fractions.lua b/macros/luatex/latex/luamaths/luamaths-fractions.lua
index e4ab7a2329..540e5b21a2 100644
--- a/macros/luatex/latex/luamaths/luamaths-fractions.lua
+++ b/macros/luatex/latex/luamaths/luamaths-fractions.lua
@@ -1,6 +1,6 @@
-- The luafractions module
-- Authors: Chetan Shirore and Ajit Kumar
--- version 1.0, Date=03-Aug-2023
+-- version 1.1, Date=04-Aug-2023
-- Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt.
M = {} -- the module
@@ -204,6 +204,9 @@ function M.div(a, b)
end
function M.tostring (c)
+ if c.n == 0 then
+ return string.format("%g",0)
+ end
if c.d == 1 then
return string.format("%g",c.n)
end
diff --git a/macros/luatex/latex/luamaths/luamaths.bib b/macros/luatex/latex/luamaths/luamaths.bib
index 4069c4adc2..8078492e11 100644
--- a/macros/luatex/latex/luamaths/luamaths.bib
+++ b/macros/luatex/latex/luamaths/luamaths.bib
@@ -1,4 +1,3 @@
-\begin{filecontents}{luamodtbl.bib}
@online{online.luaorg,
title = {Lua Programming Language},
diff --git a/macros/luatex/latex/luamaths/luamaths.pdf b/macros/luatex/latex/luamaths/luamaths.pdf
index 0b5d310b1d..d5389a3894 100644
--- a/macros/luatex/latex/luamaths/luamaths.pdf
+++ b/macros/luatex/latex/luamaths/luamaths.pdf
Binary files differ
diff --git a/macros/luatex/latex/luamaths/luamaths.sty b/macros/luatex/latex/luamaths/luamaths.sty
index 524b36a210..b73759c00b 100644
--- a/macros/luatex/latex/luamaths/luamaths.sty
+++ b/macros/luatex/latex/luamaths/luamaths.sty
@@ -1,9 +1,9 @@
% The luamaths package
-% version 1.1
+% version 1.3
% Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt.
%Authors: Chetan Shirore and Ajit Kumar
-\ProvidesPackage{luamaths}[1.1]
+\ProvidesPackage{luamaths}[1.3]
\RequirePackage{xkeyval}
\RequirePackage{amsmath}
\RequirePackage{luacode}
diff --git a/macros/luatex/latex/luamaths/luamaths.tex b/macros/luatex/latex/luamaths/luamaths.tex
index 8e501abf14..3cb499b88c 100644
--- a/macros/luatex/latex/luamaths/luamaths.tex
+++ b/macros/luatex/latex/luamaths/luamaths.tex
@@ -42,7 +42,7 @@ The \verb|luamaths| package is released under the LaTeX Project Public License v
\section{Commands in the luamaths package}
Table \ref{tbl:opluamaths} lists operations in the \verb|luamaths| package.
\begin{center}
-\begin{longtable}{llm{6cm}}
+\begin{longtable}{llm{6.5cm}}
\toprule
\multicolumn{1}{c}{\textcolor{blue}{Function}} & \multicolumn{1}{l}{\textcolor{blue}{Command Format}} & \multicolumn{1}{c}{\textcolor{blue}{Description}} \\
\toprule
@@ -161,7 +161,7 @@ Table \ref{tbl:opluamaths} lists operations in the \verb|luamaths| package.
\end{lstlisting} &
\begin{lstlisting}
\mathRound{number}{digits}
-\end{lstlisting} & It rounds off a real number to a specified number of digits. \\
+\end{lstlisting} & It rounds off a real number to a specified number of decimal places. \\
\midrule
\begin{lstlisting}
\mathSin
@@ -183,6 +183,15 @@ Table \ref{tbl:opluamaths} lists operations in the \verb|luamaths| package.
\begin{lstlisting}
\mathTan{number}
\end{lstlisting} & Gives the tangent of a real number. Here the number is in radians.\\
+\midrule
+\begin{lstlisting}
+\complexRound
+\end{lstlisting} &
+\begin{lstlisting}
+\complexRound{cx_num}{digits}
+\end{lstlisting} & It rounds off a complex number to a specified number of decimal places.\\
+
+
\bottomrule \\
\caption{Operations in the luamaths package}
\label{tbl:opluamaths}
@@ -319,6 +328,11 @@ Table \ref{tbl:illluamaths} illustrates operations in the \verb|luamaths| packag
\begin{lstlisting}
\mathRound{\mathOp{9+\mathSin{4}}}{6}
\end{lstlisting} & \(\mathRound{\mathOp{9+\mathSin{4}}}{6}\)\\
+\midrule
+
+\begin{lstlisting}
+\complexRound{lcomplex(\mathPi,6)}{4}
+\end{lstlisting} & \(\complexRound{lcomplex(\mathPi,6)}{4}\)\\
\bottomrule \\
\caption{Illustrations of commands in the luamaths package}
\label{tbl:illluamaths}
diff --git a/macros/xetex/latex/buctthesis/README.md b/macros/xetex/latex/buctthesis/README.md
index b019dd7dba..055a50f047 100644
--- a/macros/xetex/latex/buctthesis/README.md
+++ b/macros/xetex/latex/buctthesis/README.md
@@ -40,13 +40,14 @@ BUCTthesis (**B**eijing **U**niversity of **C**hemical **T**echnology LaTeX **
- `chapter` 文件夹用于存放各部分内容,并在 `main.tex` 调用;
- `figure` 和 `code` 文件夹下分别保存插图和源代码,以方便写作时调用;
6. 对 `main.tex` 文件执行 `latexmk` 或 `xelatex -> bibtex -> xelatex -> xelatex` 的全编译。
-7. 在 `cover` 文件夹中可生成硕博论文的封面,使用方法请阅读说明文档 `buctthesis.pdf`。(本科可直接删除该文件夹)
## 注意事项
- 北京化工大学教务处与研究生院仅提供了写作规范(见下)而**未对本模板做任何测试或授权**。模板作者自当尽力,但限于软件等各种因素,由本模板生成的文档可能仍与要求有所出入。所以使用本模板类造成(包括但不限于)论文审核不通过等问题作者不负责,请使用时慎酌。
- 模板在 TeX Live 2020 及更新版本、[Overleaf](https://www.overleaf.com/) 上可顺利编译,可能不兼容于低版本。**不支持** CTeX 套装。
-- 学校会统一印制论文封面,而其中包括标题和作者的内容需要用笔填写。为保证论文的完整性,本模板仿制了研究生论文的封面,且与实物相比有少许差别。
+- 论文封面相关:
+ - 学校会统一印制论文封面,而其中包括标题和作者等的内容需要用笔填写。但为保证论文的完整性,本模板对其进行了仿制,故与实际相比可能有少许差别;
+ - 封面使用的方正系列字体需要自行安装,字体清单参见说明文档 `buctthesis.pdf`。
## 写作规范
@@ -77,3 +78,7 @@ BUCTthesis (**B**eijing **U**niversity of **C**hemical **T**echnology LaTeX **
## 开源许可
本项目的代码部分基于 [LaTeX Project Public License](http://www.latex-project.org/lppl.txt)(版本 1.3c 或更高)开源于 [GitHub](https://github.com/Miracle0565/BUCTthesis) 。同时为了方便国内用户,在 [Gitee](https://gitee.com/Miracle0565/BUCTthesis) 建有代码的镜像。
+
+## 迁移
+
+原有的 [本科开题报告模板](https://github.com/the-ccsn/buct-proposal) 目前暂存于本仓库根目录下文件夹内。
diff --git a/macros/xetex/latex/buctthesis/buctthesis.pdf b/macros/xetex/latex/buctthesis/buctthesis.pdf
deleted file mode 100644
index 6d2e2d8416..0000000000
--- a/macros/xetex/latex/buctthesis/buctthesis.pdf
+++ /dev/null
Binary files differ
diff --git a/macros/xetex/latex/buctthesis/doc/buctthesis.pdf b/macros/xetex/latex/buctthesis/doc/buctthesis.pdf
new file mode 100644
index 0000000000..53834afea8
--- /dev/null
+++ b/macros/xetex/latex/buctthesis/doc/buctthesis.pdf
Binary files differ
diff --git a/macros/xetex/latex/buctthesis/buctthesis.dtx b/macros/xetex/latex/buctthesis/source/buctthesis.dtx
index 42a8290981..26d42f82af 100644
--- a/macros/xetex/latex/buctthesis/buctthesis.dtx
+++ b/macros/xetex/latex/buctthesis/source/buctthesis.dtx
@@ -1,8 +1,9 @@
% \iffalse meta-comment
%
% Copyright (C) 2019-2022 by Miracle0565
+% Copyright (C) 2022-2023 by The-CCSN
%
-% https://github.com/Miracle0565/BUCTthesis
+% https://github.com/the-ccsn/BUCTthesis
% -------------------------------------------------------
%
% This file may be distributed and/or modified under
@@ -20,7 +21,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \iffalse
%<*driver>
-\ProvidesFile{buctthesis.dtx}[2022/07/29 v1.4.1 BUCT Thesis Template]
+\ProvidesFile{buctthesis.dtx}[2023/05/20 v2.0 BUCT Thesis Template]
\documentclass{ltxdoc}
\usepackage{manual}
\begin{document}
@@ -58,7 +59,7 @@
% \GetFileInfo{buctthesis.dtx}
%
% \title{\textsf{BUCTthesis}:北京化工大学学位论文模板}
-% \author{Miracle0565\\ \texttt{https://github.com/Miracle0565}}
+% \author{长城学生网络 \\ \texttt{https://github.com/the-ccsn}}
% \date{\fileversion (\filedate)}
%
% \newgeometry{hcentering}
@@ -68,25 +69,25 @@
% \section{欢迎!}
% BUCTthesis是北京化工大学本科与硕士、博士研究生毕业论文的 \LaTeX\ 写作模板,版本号~\fileversion。
% 本文是模板的使用指南,旨在帮助北化毕业生掌握此模板的使用方法,从而写出符合北化
-% \href{https://jiaowuchu.buct.edu.cn/2018/1009/c515a22046/page.htm}{《本科生毕业设计(论文)撰写规范》}(以下称《本科规范》)
+% \href{https://jiaowuchu.buct.edu.cn/2018/1009/c515a22046/page.htm}{《本科生毕业设计(论文)撰写规范》}(以下称《本科生规范》)
% 和 \href{https://xxgk.buct.edu.cn/2017/1107/c2835a39437/page.htm}{《北京化工大学研究生学位论文撰写规范(修订)》}(以下称《研究生规范》)
% 要求的毕业论文。
%
% \subsection{模板内容}
% 本模板为中文论文模板,暂不支持英语专业的论文写作。以下是完整论文的书序,其中划线部分为模板未完成的部分。
% \begin{description}
-% \item[本科] \without{开题报告} \footnote{格式未指定。}、\without{中期进展情况检查表} \footnote{由学校提供 Word,可转换为 PDF 文件插入。}、\without{论文封面} \footnote{学校统一印制,论文题目等信息需手写,可使用扫描件插入。}、诚信声明、任务书、摘要、目录、前言、正文、结论、参考文献、符号说明、致谢和附录;
-% \item[研究生] 论文封面、版权页(独创性声明和授权书)、\without{学位论文数据集} \footnotemark[2]、中英文摘要、中英文目录、符号和缩略词说明、正文、参考文献、附录、致谢、作者攻读学位期间发表的学术论文及科研成果目录、作者和导师简介和\without{答辩委员会决议} \footnote{使用扫描件插入。}。
+% \item[本科] 开题报告 \footnote{目前处于实验性质,参见根目录下的 \file{buct-proposal} 文件夹。}、\CJKsout{中期进展情况检查表} \footnote{由学校提供 Word,可转换为 PDF 文件插入。}、论文封面、诚信声明、任务书、摘要、目录、前言、正文、结论、参考文献、符号说明、致谢和附录;
+% \item[研究生] 论文封面、版权页(独创性声明和授权书)、\CJKsout{学位论文数据集} \footnotemark[2]、中英文摘要、中英文目录、符号和缩略词说明、正文、参考文献、附录、致谢、作者攻读学位期间发表的学术论文及科研成果目录、作者和导师简介和\CJKsout{答辩委员会决议} \footnote{使用扫描件插入。}。
% \end{description}
%
% \subsection{免责声明}
-% 请您注意,至本文档编译时,北京化工大学教务处仅提供《本科规范》和《研究生规范》而未对本模板做任何测试或授权。
+% 请您注意,至本文档编译时,北京化工大学教务处仅提供《本科生规范》和《研究生规范》而未对本模板做任何测试或授权。
% 模板作者自当尽力,但限于软件等各种因素,由本模板生成的文档可能仍与要求有所出入,
% 故不保证审查老师对格式不提意见。在开始使用之前,您需要同意:
% 任何由于使用本模板而引起的论文格式审查问题均与本模板作者无关。
%
% \subsection{开源说明}
-% 本模板开源于 \href{https://github.com/Miracle0565/BUCTthesis}{GitHub},代码部分遵循
+% 本模板开源于 \href{https://github.com/the-ccsn/BUCTthesis}{GitHub},代码部分遵循
% \href{https://www.latex-project.org/lppl.txt}{\LaTeX\ Project Public License 1.3c} 及以上协议。
% 模板文件夹中有关学校校徽和校名的插图,其版权归北京化工大学所有。
%
@@ -112,8 +113,8 @@
% \begin{enumerate}
% \item \TeX\ 发行版:
% \begin{description}
-% \item[本地编译] 建议完整安装 \TeX\ Live 2020 或更新版本。模板\emph{不支持} \CTeX\ 套装。安装 \TeX 发行版的详细步骤可参考\href{https://github.com/OsbertWang/install-latex-guide-zh-cn}{《一份简短的关于 \LaTeX 安装的介绍》}。此外,该文档简要地介绍了几款常见的文本编辑器,可根据喜好自行选择。
-% \item[在线编译] 推荐 \href{https://www.overleaf.com/}{Overleaf},它提供了 Ubuntu 系统下的 \TeX\ Live,目前为 2021 版。免费版本足以应对模板的正常编译,至于完整的文档历史和协作编辑等功能则需付费订阅。
+% \item[本地编译] 建议完整安装 \TeX\ Live 2022 或更新版本。模板\emph{不支持} \CTeX\ 套装。安装 \TeX 发行版的详细步骤可参考\href{https://github.com/OsbertWang/install-latex-guide-zh-cn}{《一份简短的关于 \LaTeX 安装的介绍》}。此外,该文档简要地介绍了几款常见的文本编辑器,可根据喜好自行选择。
+% \item[在线编译] 推荐 \href{https://www.overleaf.com/}{Overleaf},它提供了 Ubuntu 系统下的 \TeX\ Live,目前为 2022 版。免费版本足以应对模板的正常编译,至于完整的文档历史和协作编辑等功能则需付费订阅。
% \end{description}
% \item \TeX\ 技能:本文档不是一份 \LaTeX\ 零基础教程,使用本模板需要对 \LaTeX\ 和参考文献管理工具 \BibTeX 有一定的熟练度。若您是新手,我们建议您先阅读一些入门文档,如\href{http://mirror.ctan.org/info/lshort/chinese/lshort-zh-cn.pdf}{《一份不太简短的 \LaTeXe 介绍》}。
% \end{enumerate}
@@ -180,7 +181,7 @@
% 示例文件会随模板一同发布。建议在写作开始前对示例文件执行一次全编译,以检查编程环境是否合适。
%
% \subsection{提问}
-% 对于模板的任何问题或新功能需求请提交至 \href{https://github.com/Miracle0565/BUCTthesis/issues}{GitHub Issues}。
+% 对于模板的任何问题或新功能需求请提交至 \href{https://github.com/the-ccsn/BUCTthesis/issues}{GitHub Issues}。
% 以下步骤可能对排除与精简问题有所帮助:
% \begin{enumerate}
% \item 将 \file{buctthesis.cls} 和 \file{main.tex} 文件复制到一空白文件夹;
@@ -201,7 +202,7 @@
% \subsubsection{文档类选项}
% 主文件 \file{main.tex} 以
% \begin{latex}
-% \documentclass[
+% \documentclass [
% type = doctor, % bachelor | master | doctor
% fontset = windows, % fandol | windows | ...
% submit,
@@ -212,18 +213,18 @@
%
% 以下逐一简述各个选项:
%
-% \DescribeOpt{type = }
+% \DescribeOpt{type}
% \emph{必须指定一种类型}:本科 \opt{bachelor},硕士 \opt{master},以及博士 \opt{doctor}。
% 如:
% \begin{latex}
% % 博士论文
-% \documentclass[type = doctor,]{buctthesis}
+% \documentclass[type = doctor]{buctthesis}
% % 或:
% % 本科论文
-% \documentclass[type = bachelor,]{buctthesis}
+% \documentclass[type = bachelor]{buctthesis}
% \end{latex}
%
-% \DescribeOpt{fontset = }
+% \DescribeOpt{fontset}
% 该选项会传递至 \pkg{ctex} 宏集,从而指定全文的字体。模板的设置如表~\ref{tab:fontset}~所示。
%
% 其中选项 \opt{fandol} 或使用 \opt{\meta{others}} 选项 \footnote{参见\pkg{ctex}宏集第 4.3 小节。}是为了一些不方便安装字体的系统或平台(如 Overleaf)所采取的\emph{临时解决方案}。
@@ -243,6 +244,8 @@
% \end{tabular}
% \end{table}
%
+% \emph{此外,论文封面使用的字体比较特殊,因此需要做另外设置。参见~\ref{subsec:cover}~中对封面相关字体的说明。}
+%
% \DescribeOpt{submit}
% 是否为提交版本。如果启用则会将文章超链接和代码块的文字颜色全部设置为黑色,适合论文最终提交与付梓。
% 需要提醒的是,它不能转换插图的颜色。
@@ -257,15 +260,19 @@
%
% \subsubsection{论文信息}\label{subsec:buctsetup}
% \DescribeMacro{\buctsetup}
-% \DescribeOpt{ctitle}
-% \DescribeOpt{etitle}
-% \DescribeOpt{cauthor}
+% \DescribeOpt{ChineseTitle}
+% \DescribeOpt{ChineseTitleLineA}
+% \DescribeOpt{ChineseTitleLineB}
+% \DescribeOpt{EnglishTitle}
+% \DescribeOpt{author}
% \DescribeOpt{class}
% \DescribeOpt{studentid}
% \DescribeOpt{school}
% \DescribeOpt{major}
% \DescribeOpt{supervisor}
% \DescribeOpt{msupervisor}
+% \DescribeOpt{ChineseKeywords}
+% \DescribeOpt{EnglishKeywords}
% \begin{syntax}{buctsetup}
% \marg{键值列表}
% \end{syntax}
@@ -275,26 +282,35 @@
% \begin{latex}
% \buctsetup{
% % 论文的中文标题
-% ctitle = {基于 \LaTeX\ 的北京化工大学毕业论文写作模板},
+% ChineseTitle = {基于 \LaTeX\ 的北京化工大学本硕博毕业论文写作模板},
+% % 封面上的标题。总字数不要超过 36 个汉字长度。
+% % 本科:可以一行或分两行写,如无第二行将 ChineseTitleLineB 留空或注释掉;
+% % 硕博:封面的标题有两行,每一行控制在 18 个汉字长度以内。
+% % 封面标题首行
+% ChineseTitleLineA = {基于 \LaTeX\ 的北京化工大学本硕博},
+% % 封面标题次行
+% ChineseTitleLineB = {毕业论文写作模板},
% % 论文的英文标题,一般需要大写
-% etitle = {BUCTthesis: A \LaTeX\ WRITING TEMPLATE FOR BUCT},
+% EnglishTitle = {BUCTthesis: A \LaTeX\ WRITING TEMPLATE FOR BUCT},
% % 作者的中文姓名
-% cauthor = {张三},
+% author = {张三},
% % 班级(仅本科)
% class = {某某1024},
-% % 学号(仅本科)
+% % 学号
% studentid = {2018020999},
% % 学院(仅本科)
% school = {材料科学与工程学院},
-% % 专业名称(仅本科)
+% % 专业名称
% major = {高分子材料与工程},
-% % 导师的姓名与职称(仅本科)
+% % 导师的姓名与职称
% supervisor = {李四教授},
% % 专业负责人姓名(仅本科)
% msupervisor = {王五},
% % 中文、英文关键词,各关键词间以西文逗号“,”分隔
-% ckeywords = {论文,\LaTeX{},模板},
-% ekeywords = {thesis,\LaTeX{},template},
+% ChineseKeywords = {论文,\LaTeX{},模板},
+% EnglishKeywords = {thesis,\LaTeX{},template},
+% % 日期,请注意务必使用形如“YYYY-MM-DD”的格式
+% date = {2021-12-23},
% }
% \end{latex}
%
@@ -303,15 +319,48 @@
% 此外,\cs{buctsetup}\marg{键值列表} 与下列命令等价:
% \begin{latex}
% % 于导言区
-% \ctitle{基于 \LaTeX\ 的北京化工大学毕业论文写作模板}
-% \etitle{BUCTthesis: A \LaTeX\ WRITING TEMPLATE FOR BUCT}
+% \ChineseTitle{基于 \LaTeX\ 的北京化工大学本硕博毕业论文写作模板}
+% \EnglishTitle{BUCTthesis: A \LaTeX\ WRITING TEMPLATE FOR BUCT}
% % ...(下同)
% \end{latex}
%
+% \subsection{封面}\label{subsec:cover}
+% \DescribeMacro{\makecover}
+% \begin{syntax}{makecover}
+% \oarg{文件路径}
+% \end{syntax}
+%
+% \emph{注意:从2.0版本起,模板将封面集成至论文中而不再单独使用一个文档类文件。}
+%
+% BUCTthesis 对学校印刷的纸质封面进行了仿制,
+% 直接使用而不带任何参数的 \cs{makecover} 会根据所选 \opt{type} 生成对应的封面,封面上的各项信息从前述的 \cs{buctsetup} 处定义。
+% 需要注意的是,这里的“仿制”仅是实现封面的效果,学校印制的封面需要手写内容,故不能在纸本上替代学校统一印制的封面;
+% 若无特殊说明,可以在提交电子版时使用此封面。但,仍请以教务处最新通告为准。
+%
+% 此外,学校封面使用的方正系列字体未预装于一些操作系统上,
+% 可访问\href{https://www.foundertype.com}{方正字库官网}下载和安装,具体步骤从略。
+%
+% 封面所使用的中文字体清单如下:
+% \begin{enumerate}
+% \item SimSun,中易宋体
+% \item SimHei,中易黑体
+% \item KaiTi,中易楷体
+% \item STXingkai,华文行楷
+% \item FZXiaoBiaoSong-B05S,方正小标宋简体
+% \item FZDaBiaoSong-B06S,方正大标宋简体(仅硕博封面需要)
+% \end{enumerate}
+%
+% 当且仅当存在上述字体文件时模板才会输出电子版的封面。
+% 当然,考虑到有时需要插入扫描页,所以该命令可跟一个可选参数,如:
+% \begin{latex}
+% \makecover[figure/mycover.pdf]
+% \end{latex}
+% 即可插入位于 \file{figure/mycover.pdf} 的图片来代替。
+%
% \subsection{前置部分}\label{subsec:frontmatter}
%
-% 在“目录”之前的几个部分,包括“诚信声明”\footnote{根据《现代汉语词典》对“申明”与“声明”二词的释义,%
-% 《本科规范》中的“诚信申明”应作“诚信声明”;模板以后者作为标题。}(仅本科)、
+% 在封面之后、“目录”之前的几个部分,包括“诚信声明”\footnote{根据《现代汉语词典》对“申明”与“声明”二词的释义,%
+% 《本科生规范》中的“诚信申明”应作“诚信声明”;模板以后者作为标题。}(仅本科)、
% 版权页(仅硕博)、“任务书”(仅本科)、“摘要”和“Abstract”,
% 分别对应于 \file{chapter/frontmatter.tex} 中的不同命令或环境。
%
@@ -323,7 +372,7 @@
%
% 直接使用而不带任何参数的 \cs{makedeclare} 会根据所选 \opt{type} 生成对应内容。
%
-% 此外,考虑到有时需要插入扫描页,所以该命令可跟一个可选参数,如:
+% 和 \cs{makecover} 一样,该命令也可跟一个可选参数来插入扫描页,如:
% \begin{latex}
% \makedeclare[figure/declare.png]
% \end{latex}
@@ -352,9 +401,21 @@
% 该环境仅适用于本科论文中。
%
% “本科生毕业设计(论文)任务书”部分使用 \env{taskbook} 环境。
-% 主文件中所定义的部分信息会作用于“任务书”的开头部分;
-% 该部分以 \cs{taskinfo} 或 \cs{taskinfo*} 命令来插入,
-% 二者的区别在于后者比前者少了一次换行,是《本科规范》中示例的实现,但不适合文字较多时使用。
+% 此环境后可跟一个 \texttt{*}(注意不是 \env{taskbook*}),
+% 它会使得生成的任务书页不带任何页眉和页脚,以适合某些特殊情况下使用。
+% \begin{latex}
+% \begin{taskbook}
+% ……“任务书”内容(带页眉页脚)
+% \end{taskbook}
+% % 或者:
+% \begin{taskbook}*
+% ……“任务书”内容(不带页眉页脚)
+% \end{taskbook}
+% \end{latex}
+%
+% \cs{buctsetup} 中定义的信息会作用于“任务书”的开头部分,该部分以 \cs{taskinfo} 命令来插入。
+% 这个命令同样有一个带星号的版本即 \cs{taskinfo*},
+% 二者的区别在于后者比前者少了一次换行,是《本科生规范》中示例的实现,但不适合文字较多时使用。
%
% 除此之外,可以选择使用 \env{bibenumerate} 环境来排版有序文献列表,
% 序号已经设置为带方括号的数字。
@@ -373,14 +434,14 @@
% \end{latex}
%
% 三者是互相独立的。
-% 英文目录通过 \cs{echapter} 等命令指定某一标题的英文标题,参见~\ref{subsubsec:bitoc}。
-% 设计图纸目录通过 \env{dfigure} 环境指定插图为“设计图纸”并计数编号,参见~\ref{subsubsec:dfigure}。
+% 为生成英文目录,需要在正文中以 \cs{echapter} 等命令指定各级标题的对应英文,参见~\ref{subsubsec:bitoc};
+% 为生成设计图纸目录,需要在正文中以 \env{dfigure} 环境指定插图为“设计图纸”并计数编号,参见~\ref{subsubsec:dfigure}。
%
% \subsubsection{符号说明表}\label{subsubsec:deno}
% \DescribeEnv{denotation}
% 符号说明表的源文件位于 \file{chapter/denotation.tex},
% 使用 \env{denotation} 环境。
-% 《本科规范》和《研究生规范》中都未详细规定符号说明表的格式,
+% 《本科生规范》和《研究生规范》中都未详细规定符号说明表的格式,
% 模板设计了一个无框线、可跨页的长表格,直接在环境里填入内容即可。
% 环境接受一个可选参数 \meta{width} ,代表“说明”一列的宽度,用于在必要时调整。
% \begin{latex}
@@ -436,7 +497,7 @@
% 我们只需在正文章节标题命令后加上对应标签即可。
% 如:
% \begin{latex}
-% \chapter{绪论}\echapter{Intorduciton}
+% \chapter{绪论}\echapter{Introduciton}
% \section{基本概念}\esection{Basic Conceptions}
% \section{本章小结}\esection{Chapter Summary}
% \chapter{实验}\echapter{The Experiments}
@@ -452,7 +513,7 @@
% \oarg{中文目录标题}\marg{中文正文标题}\marg{英文目录标题}
% \end{syntax}
%
-% 可见与 \cs{chapter} 相比,它多了一个参数用于接受 \meta{英文目录的标题}。
+% 可见与 \cs{chapter} 相比,它多了一个必选参数用于接受 \meta{英文目录的标题}。
% 于是,上面这个例子可以这样简化:
% \begin{latex}
% \bichapter{绪论}{Intorduciton}
@@ -477,11 +538,13 @@
%
% 该命令仅适用于硕博论文中。
%
-% 具体的用法很简单:使用 \cs{bicaption} 代替 \cs{caption} 命令即可,如:
+% 具体的用法很简单:在 \env{figure} 环境中使用 \cs{bicaption} 代替 \cs{caption},如:
% \begin{latex}
% \begin{figure}
-% \centering \includegraphics[]{file}
+% \centering
+% \includegraphics[<options>]{My-Fig}
% \bicaption{中文标题}{English Title}
+% \label{fig:my-fig}
% \end{figure}
% \end{latex}
%
@@ -490,24 +553,29 @@
%
% 关于一般的插图请看示例文件,这里介绍关于“设计图纸”及编目的方法。
%
-% 由于《本科规范》未对所谓“设计图纸”详细说明,因此模板设计了两种编目方式:
+% 由于《本科生规范》未对所谓“设计图纸”详细说明,因此模板设计了两种编目方式:
% 一是加入主目录,另一种是单独生成目录。
%
% \DescribeEnv{dfigure}
-% 设计图纸的计数器是独立于一般插图的,故需要使用 \env{dfigure} 环境来代替 \env{figure}。
-
+% 设计图纸的计数器是独立于一般插图的。
+% 因此,无论编目方式如何,
+% 都需要使用 \env{dfigure} 而非 \env{figure} 环境,来为一张插图指定为“设计图纸”。
+%
% \DescribeMacro{\dcaption}
-% 先来看编入主目录的方式,在正文内插入插图的代码处,
-% 除了使用 \cs{dcaption} 代替 \cs{caption}外都一样。
+% 如果需要编入主目录,需要使用 \cs{dcaption} 代替 \cs{caption},如:
% \begin{latex}
-% \begin{dfigure}[htbp]
-% \centering\includegraphics[]{file}
+% \begin{dfigure}
+% \centering
+% \includegraphics[<options>]{My-Fig}
% \dcaption{设计图纸示例}
% \end{dfigure}
% \end{latex}
+% 也就是说,\cs{dcaption} 命令用于添加编号与标题的同时将它编入主目录。
%
% \DescribeMacro{\listofdesignfigures}
-% 而独立目录也很简单,一个 \cs{listofdesignfigures} 即可。参见~\ref{subsubsec:content}。
+% 而独立目录也很简单:只需要 \env{dfigure} 指定为“设计图纸”,
+% 并在主目录(\cs{tableofcontents})后跟一个 \cs{listofdesignfigures} 即可。参见~\ref{subsubsec:content}。
+%
% \subsubsection{结论}
% \DescribeEnv{conclusion}
% 该环境仅适用于本科论文中。
@@ -533,18 +601,23 @@
% \marg{CiteKey}
% \end{syntax}
%
-% 模板使用 \cs{cite} 实现上标、方括号按“顺序编码制”引用参考文献;
-% \cs{inlinecite} 可实现行间引用,适合某些特殊情况使用;
-% 而 \cs{nocite}\marg{CiteKey} 则指明不引用但需要列出的参考文献。
+% 模板使用 \BibTeX 来实现参考文献的引用。
+% 一般情况下,使用 \cs{cite} 实现上标、方括号按“顺序编码制”引用参考文献;
+% 而 \cs{inlinecite} 可实现行间引用,适合某些特殊情况使用;
+% 此外,\cs{nocite}\marg{CiteKey} 则指明不在正文中引用但仍需要列出的参考文献,一般不使用。
% 在同一处引用多个文献时,应将各篇文献的引用标签一同写在参数里,
-% 并以西文逗号“,”分隔每个 \meta{CiteKey}。
+% 并以西文逗号“,”分隔每个 \meta{CiteKey},如:
+% \begin{latex}
+% ……多喝热水。\cite{bib1, bib2}
+% \end{latex}
%
-% 主文件中以
+% 至于参考文献列表,主文件中以下列命令来生成符合格式要求的参考文献章节:
% \begin{latex}
% \bibliographystyle{gbt7714-numerical}
% \bibliography{thesisbib.bib}
% \end{latex}
-% 来增加符合格式要求的参考文献章节。为罗列各条参考文献,
+%
+% 为罗列各条参考文献,
% 需要在 \file{thesisbib.bib} 文件中增删需引用的文献数据。
% 在文章中相应位置引用文献后,需执行一次全编译以确保正确显示。
%
@@ -558,12 +631,14 @@
%
% 文献翻译的源文件位于 \file{chapter/translation.tex},
% 使用 \env{translation} 环境,原文和翻译都要有。
+%
+% \emph{注意:部分学院要求该部分作为单独的一份文件,此时可直接删除该文件并删除主文件的插入代码。}
% \begin{latex}
-% \begin{translations}
+% \begin{translation}
% English.
%
% 汉语。
-% \end{translations}
+% \end{translation}
% \end{latex}
%
% \subsubsection{附录}\label{subsubsec:app}
@@ -611,68 +686,6 @@
% \end{resume}
% \end{latex}
%
-% \subsection{封面}\label{subsec:cover}
-% \DescribeMacro{\makecover}
-% BUCTthesis 对学校印刷的纸质封面进行了仿制,本小节将简单介绍相关代码与编译方法。
-%
-% 由于字体的原因,BUCTthesis 将封面模板另置于 \file{cover} 文件夹,可根据需要使用。
-% 在该文件夹中的三个文件都与封面有关,编译时请确保它们位于同一路径之下。
-%
-% \emph{注意:这里的“仿制”仅是实现封面的效果,学校印制的封面需要手写内容,故不能在纸本上替代学校统一印制的封面;
-% 若无特殊说明,可以在提交电子版时使用此封面。但,仍请以教务处最新通告为准。}
-% \begin{enumerate}
-% \item \file{buctcover.tex}:源文档。在 \cs{documentclass} 后定义封面所属学位,在 \cs{coversetup} 中定义论文相关信息。除导言区外无需修改。
-% \begin{latex}
-% \documentclass[
-% type = bachelor % type = [ bechelor | master | doctor ]
-% ]{buctcover}
-% \coversetup{
-% %班级,位于右上角,仅本科
-% class = {计科1024},
-% % 学号,位于右上角
-% studentid = {2021010234},
-% % 标题。总字数不要超过 36 个汉字长度。
-% % 本科:可以一行或分两行写,如果无第二行将 titleB 留空或注释掉;
-% % 硕博:封面的标题有两行,每一行控制在 18 个汉字长度以内。
-% titleA = {甲乙丙丁戊己庚辛壬癸一二三},
-% titleB = {四五六七八九十甲乙丙丁戊己},
-% % 作者
-% author = {张三},
-% % 专业
-% major = {计算机科学与技术},
-% % 导师
-% supervisor = {某某某教授},
-% % 日期,不填为当日。请注意:务必使用形如“YYYY-MM-DD”的格式
-% date = {2021-12-23},
-% }
-% \end{latex}
-%
-% 至于编译,只需一遍 xelatex 即可,扩展名可省略。
-% \begin{shell}
-% xelatex buctcover.tex
-% \end{shell}
-% 如果编译两遍,还会生成封面的 PDF 书签。
-% 此时可以用其他 PDF 工具将封面整合到论文中,同时还能保留封面书签以便于跳转。
-%
-% \item \file{buctcover.cls}:格式控制文件。类似 \file{buctthesis.cls},亦可由 \file{buctthesis.ins} 和 \file{buctthesis.dtx} 生成:
-% \begin{shell}
-% xelatex buctthesis.ins
-% \end{shell}
-% 请注意执行以上命令时会同时生成 \file{buctcover.cls} 和 \file{buctthesis.cls},只有前者是用于控制封面的。
-% \end{enumerate}
-%
-% 除此之外,封面使用的方正系列字体未预装于一些操作系统上,
-% 可访问\href{https://www.foundertype.com}{方正字库官网}下载和安装,具体步骤从略。
-%
-% 封面所使用的中文字体清单:
-% \begin{enumerate}
-% \item SimSun,中易宋体
-% \item SimHei,中易黑体
-% \item KaiTi,中易楷体
-% \item STXingkai,华文行楷
-% \item FZXiaoBiaoSong-B05S,方正小标宋简体
-% \item FZDaBiaoSong-B06S,方正大标宋简体(仅硕博封面需要)
-% \end{enumerate}
%
%
% \StopEventually{\PrintChanges\PrintIndex}
@@ -681,9 +694,9 @@
% \section{实现细节}\label{sec:implementation}
% \subsection{文档类信息与选项}
% \begin{macrocode}
-%<class|cover>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<*class>
-\ProvidesClass{buctthesis}[2022/07/29 v1.4.1 BUCT Thesis Template]
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesClass{buctthesis}[2023/05/20 v2.0 BUCT Thesis Template]
% \end{macrocode}
%
% 装载 \pkg{ifxetex} 宏包,并通过 \cs{RequireXeTeX} 命令检查编译命令。
@@ -759,18 +772,19 @@
% \begin{macro}{\buct@def@key}
% 定义用于定义论文相关信息的内部命令。例如:
% \begin{latex}
-% \buct@def@key{ctitle}
+% \buct@def@key{ChineseTitle}
% \end{latex}
% 相当于:
% \begin{latex}
-% \newcommand{\ctitle}[1]{\newcommand{\buct@ctitle}{#1}}
-% \define@key{buct}{ctitle}{\ctitle{#1}}
+% \newcommand{\ChineseTitle}[1]{\newcommand{\buct@ChineseTitle}{#1}}
+% \define@key{buct}{ChineseTitle}{\ChineseTitle{#1}}
% \end{latex}
%
+% 这个命令我们让它能接受两个参数,其中第一个必选参数为选项的键名称,后一个可选参数则是选项的默认值。
% \begin{macrocode}
-\newcommand{\buct@def@key}[1]{
+\NewDocumentCommand{\buct@def@key}{ m o }{
\@namedef{#1}##1{\@namedef{buct@#1}{##1}}
- \define@key{buct}{#1}{\@nameuse{#1}{##1}}
+ \define@key{buct}{#1}[#2]{\@nameuse{#1}{##1}}
}
% \end{macrocode}
% \end{macro}
@@ -779,21 +793,27 @@
% 定义 \cs{buctsetup} 命令作为接口,方便在主文件中设置。
% \begin{macrocode}
\newcommand{\buctsetup}[1]{\kvsetkeys{buct}{#1}}
-\buct@def@key{ctitle}
-\buct@def@key{etitle}
-\buct@def@key{cauthor}
-\buct@def@key{class}
+\buct@def@key{ChineseTitle}
+\buct@def@key{EnglishTitle}
+\buct@def@key{ChineseTitleLineA}
+\buct@def@key{ChineseTitleLineB}
+\buct@def@key{ChineseTitle}
+\buct@def@key{author}
\buct@def@key{studentid}
-\buct@def@key{school}
-\buct@def@key{major}
\buct@def@key{supervisor}
-\buct@def@key{msupervisor}
+\buct@def@key{major}
+\buct@def@key{date}[\the\year-\two@digits{\month}-\two@digits{\day}]
+\ifbuct@bachelor
+ \buct@def@key{school}
+ \buct@def@key{class}
+ \buct@def@key{msupervisor}
+\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\buct@def@sep@key}
-% 对于 \opt{ckeywords} 等键接受的是以西文逗号“,”分隔的值,上面的定义就不合适了。
-% 所以要对值做分隔。相比 \cs{buct@def@key} 这里多一个参数,即为在论文中的分隔符。
+% 对于 \opt{ChineseKeywords} 等键接受的是以西文逗号“,”分隔的值,上面的定义就不合适了。
+% 所以要对值做分隔。相比 \cs{buct@def@key} 这里的后一个参数为必选项,即为在论文中的分隔符。
% 此处的宏展开可参考\href{https://www.zhihu.com/question/26916597}{这篇讨论}。
% \begin{macrocode}
\newcommand{\buct@def@sep@key}[2]{%
@@ -809,8 +829,8 @@
}
\define@key{buct}{#1}{\@nameuse{#1}{##1}}%
}
-\buct@def@sep@key{ckeywords}{\buct@ckeywords@sep}
-\buct@def@sep@key{ekeywords}{\buct@ekeywords@sep}
+\buct@def@sep@key{ChineseKeywords}{\buct@ChineseKeywords@sep}
+\buct@def@sep@key{EnglishKeywords}{\buct@EnglishKeywords@sep}
% \end{macrocode}
% \end{macro}
% \subsection{载入宏包}
@@ -868,6 +888,15 @@
\RequirePackage{tikz}
% \end{macrocode}
%
+% 绘制封面的一些宏包。\pkg{calc} 能够方便地计算文本长度;
+% \pkg{textpos} 配合 \pkg{tikz},这样就能在页面的任何地方作画了。
+% 另外, 在 ctex 宏集 2.5 版本之后需要手动载入\pkg{xeCJKfntef} 。
+% \begin{macrocode}
+\RequirePackage{calc}
+\RequirePackage[absolute,overlay]{textpos}
+\RequirePackage{xeCJKfntef}
+% \end{macrocode}
+%
% 代码块环境。
% \begin{macrocode}
\RequirePackage{listings}
@@ -899,6 +928,11 @@
\RequirePackage{xpatch}
% \end{macrocode}
%
+% 判断语句。
+% \begin{macrocode}
+\RequirePackage{xifthen}
+% \end{macrocode}
+%
% 在页面画上标尺、边框线,和标注行号。仅当开启调试时。
% \begin{macrocode}
\ifbuct@debugger
@@ -959,7 +993,7 @@
% \end{macrocode}
% \end{macro}
%
-% 对于西文正文,全部统一设置为Times New Roman,以尽可能避免格式审查问题。
+% 其次,对于西文,全部统一设置为 Times New Roman,以尽可能避免格式审查问题。
% \begin{macrocode}
\setmainfont{Times New Roman}
\setsansfont{Times New Roman}
@@ -1099,7 +1133,7 @@
\newcommand\buct@dcl@sign{本人签名:\hspace{14em}年\hspace{2.5em}月\hspace{2.5em}日}
\newcommand\buct@task@title{本科生毕业设计(论文)任务书}
\newcommand\buct@task@pdf{任务书}
- \newcommand\buct@task@ctitle{设计(论文)题目:}
+ \newcommand\buct@task@ChineseTitle{设计(论文)题目:}
\newcommand\buct@task@school{学院:}
\newcommand\buct@task@major{专业:}
\newcommand\buct@task@class{班级:}
@@ -1112,10 +1146,10 @@
\newcommand\buct@task@itemd{4.进度安排}
\newcommand\buct@cabstract@title{摘要}
\newcommand\buct@eabstract@title{ABSTRACT}
- \newcommand\buct@ckeywords@title{关键词:}
- \newcommand\buct@ekeywords@title{Keywords:~}
- \newcommand\buct@ckeywords@sep{\quad}
- \newcommand\buct@ekeywords@sep{; }
+ \newcommand\buct@ChineseKeywords@title{关键词:}
+ \newcommand\buct@EnglishKeywords@title{Keywords:~}
+ \newcommand\buct@ChineseKeywords@sep{\quad}
+ \newcommand\buct@EnglishKeywords@sep{; }
\newcommand\buct@supervisor@title{指导教师:}
\newcommand\buct@content@title{目\hspace{\ccwd}录}
\newcommand\buct@dfigurename{设计图纸}
@@ -1156,13 +1190,13 @@
\newcommand\buct@sign@supervisor{导师签名:\rule{7em}{.4pt}\qquad{日期:}\rule{7em}{.4pt}}
\newcommand\buct@cabstract@title{摘\hspace{\ccwd}要}
\newcommand\buct@eabstract@title{ABSTRACT}
- \newcommand\buct@ckeywords@title{关键词:}
- \newcommand\buct@ekeywords@title{KEY WORDS:~}
- \newcommand\buct@ckeywords@sep{,}
- \newcommand\buct@ekeywords@sep{,~}
+ \newcommand\buct@ChineseKeywords@title{关键词:}
+ \newcommand\buct@EnglishKeywords@title{KEY WORDS:~}
+ \newcommand\buct@ChineseKeywords@sep{,}
+ \newcommand\buct@EnglishKeywords@sep{,~}
\newcommand\buct@content@title{目\hspace{\ccwd}录}
\newcommand\buct@econtent@chapter{Chapter~}
- \newcommand\econtentsname{Contents}
+ \newcommand\buct@econtentsname{Contents}
\newcommand\buct@deno@title{符号和缩略词说明}
\newcommand\buct@ack@title{致谢}
\newcommand\buct@eack@title{Acknowledgement}
@@ -1224,6 +1258,312 @@
% \end{macrocode}
% \end{macro}
%
+%% \subsection{封面}
+% 由于学校会统一印制封面,这里仅提供本科和硕博的一个参考实现。
+% 并且由于学校所给的参考封面每年都有细微的变动,由本模板所生成的封面上文字间距不能保证与参考一致。
+% 还请留心。
+%
+% 标尺,用于调试。手动取消注释来开启。
+% \begin{macrocode}
+% \usepackage[unit=cm,type=upperleft,hshift=0cm,vshift=0cm]{fgruler}
+% \end{macrocode}
+%
+% \begin{macro}{\buct@title@ul}
+% 定义下划线命令,这里利用了 \pkg{calc} 宏包的 \cs{widthof} 命令,
+% 取 \cs{buct@ChineseTitleLineA} (即首行标题)的长度,用以固定下划线的长度。
+% 文本末尾加一个 \cs{enspace} 会让横线右端稍长于最后一个文字,显得更美观一些。
+% \begin{macrocode}
+\newcommand\buct@title@ul[1]{%
+ \CJKunderline{\makebox[\widthof{\buct@ChineseTitleLineA\enspace}][l]{#1}}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\buct@major@ul}
+% 但是对于本科封面而言,“专业”“学生”“指导教师”与“题目”之间有一大段空白,
+% 可以看做相互独立的表格。因此,这里我们让横线的宽度取所填入专业文本的宽度。
+% 使用 \cs{quad} 会让横线右端长于最后一个文字更多一点,更贴合封面的参考样例。
+% \begin{macrocode}
+\newcommand\buct@major@ul[1]{%
+ \CJKunderline{\makebox[\widthof{\buct@major\quad}][c]{#1}}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\buct@format@date}
+% 日期格式处理,将输入的 \cs{buct@date} 拆分。
+% \begin{macrocode}
+\newcommand\buct@format@date[1]{%
+ \edef\buct@@date{\buct@date}%
+ \def\buct@@process@date##1-##2-##3\@nil{%
+ #1{##1}{##2}{##3}%
+ }%
+ \expandafter\buct@@process@date\buct@@date\@nil
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \cs{@zhdate} 命令接受三个数字。
+% 本科的日期要求比较简单,直接输出对应的数字即可。
+% 但是样例所给的数字前后有一些空白,我们用 \cs{makebox} 来定格它。
+% \begin{macrocode}
+\newcommand\@zhdate[3]{%
+ \bfseries\zhkai
+ \ifbuct@bachelor
+ \zihao{4}
+ #1年\makebox[1.5em]{#2}月\makebox[1.5em]{#3}日
+% \end{macrocode}
+%
+% 如果是硕博,则将“年”转换为中文数字串,“月”和“日”转换为中文数字;其中“年”中的 0 映射为“〇”而非“零”。
+% \begin{macrocode}
+ \else
+ \Large\ziju{.1}%
+ 日\hspace{1.5\ccwd}期:\zhdigits{#1}年\zhnumber{#2}月\zhnumber{#3}日%
+ \fi
+}
+% \end{macrocode}
+%
+% \begin{macro}{\buct@makecover}
+% 接下来是重头戏:定义 \cs{buct@makecover} 命令来生成封面。
+% \begin{macrocode}
+\newcommand{\buct@makecover}{%
+% \end{macrocode}
+%
+% 首先是页边距和页眉页脚。
+% 经过测量,各边距值比正文部分都要小;本科暂与硕博设置一致。
+% \begin{macrocode}
+ \newgeometry{
+ top = 2.1cm, bottom = 2.2cm,
+ left = 2cm, right = 2cm,
+ headheight = 0cm, footskip = 0cm
+ }
+% \end{macrocode}
+% 清空页眉、页脚。
+% \begin{macrocode}
+ \thispagestyle{empty}
+% \end{macrocode}
+%
+% 其次是字体。关于字体的检查和定义放在了文档命令 \cs{makecover} 的定义中。(见本节末尾)
+% 在这里,我们只开启伪粗体,并且应设置得比正文更粗一些。
+% \begin{macrocode}
+ \xeCJKsetup{EmboldenFactor=2.3}
+% \end{macrocode}
+%
+% 封面右上角的“单位代码”和“学号”,先分别设置格式。
+% \begin{macrocode}
+ \begin{table}[h]
+ \raggedleft
+ \ifbuct@bachelor
+ \songti\zihao{5}
+ \else
+ \renewcommand{\arraystretch}{1.3}\large
+ \fi
+% \end{macrocode}
+%
+% 用一个无线表格来排版文字。需要注意二者都要以中文字体来书写数字。
+% 注意本科封面的表格右端并不是严格顶头,所以这里空开两个字符的宽度。
+% \begin{macrocode}
+ \begin{tabular}{l@{}l}
+ \ifbuct@bachelor%
+ 班\hspace{2\ccwd}级&:\CJKfamily+{zhsong}\buct@class\hspace*{2\ccwd}\\
+ 学\hspace{2\ccwd}号&:\CJKfamily+{zhsong}\buct@studentid\hspace*{2\ccwd}\\
+ \else%
+ \xbsong 单位代码 & :\CJKfamily+{zhsong}\mbox{10010}\\
+ \xbsong 学\hspace{2\ccwd}号 & :\CJKfamily+{zhsong}\mbox{\buct@studentid}\\
+ \fi
+ \end{tabular}
+ \end{table}
+ \ifbuct@bachelor\vspace{3bp}\else\vspace{26bp}\fi
+% \end{macrocode}
+%
+% 校徽与校名。前者是插图,后者是文字。
+% 需要注意,本科和硕博封面的“北京化工大学”几个字的字距是有差别的。
+% 由于并未设置居中,所以本科还需要手动空一点距离让文本近似居于页面中央。
+% \begin{macrocode}
+ \begin{minipage}[c][][c]{2.35cm}
+ \includegraphics[width = 2.35cm]{figure/BUCT-badge.pdf}
+ \end{minipage}
+ \qquad
+ \begin{minipage}[c][2.35cm][c]{9cm}
+ \xingkai
+ \ifbuct@bachelor
+ \ziju{0.1}\hspace*{0.8\ccwd}\zihao{-0}
+ \else
+ \ziju{-0.02}\zihao{0}
+ \fi
+ {北京化工大学}
+ \end{minipage}
+ \ifbuct@bachelor\vspace{12bp}\else\vspace{18bp}\fi
+% \end{macrocode}
+%
+% 标题。本科的标题中的“(论文)”使用了半角括号,字体使用 Times New Roman Bold。
+% 但按照排版规范,模板使用全角标点和对应的中文字体。
+% 对于这项更改,我们使用 \pkg{xeCJK} 里的命令来吃掉一点括号的空白。
+%
+% 注:\cs{punctstyle\{banjiao\}} 和 \cs{xeCJKsetup\{PunctStyle = banjiao\}} 和 \cs{ctexset\{punct = banjiao\}}是一样的。
+% \begin{macrocode}
+ \begin{center}
+ \ifbuct@bachelor
+ \ziju{0.15}\xbsong\zihao{-0}\CJKfamily+{}{%
+ \punctstyle{banjiao}毕业设计(论文)% (论文)
+ }
+ \else%
+ %\ziju{-0.05}
+ \dbsong\fontsize{38bp}{60bp}\selectfont
+ \ifbuct@master{硕}\else{博}\fi{}士研究生学位论文
+ \fi
+ \end{center}
+% \end{macrocode}
+%
+% 对于论文标题之下的部分,我们将本科和硕博分开设置。
+%
+% 本科封面有两条横贯页面的横线,位于纸张顶部向下 \SI{10}{\centi\metre} 左右,
+% 我们用 \pkg{textpos} 的 \env{textblock} 环境定位,用 \pkg{tikz} 将它们画出来。
+% 两条线的间距取 \SI{0.2}{\centi\metre}。
+% \begin{macrocode}
+ \ifbuct@bachelor
+ \setlength{\TPHorizModule}{1cm}
+ \setlength{\TPVertModule}{1cm}
+ \begin{textblock}{0}(0,10)
+ \noindent%
+ \tikz[line width=1.2pt] \draw (0,0) -- (21,0) (0,0.2) -- (21,0.2);
+ \end{textblock}
+ \vspace{72bp}
+% \end{macrocode}
+%
+% 接下来书写题目。先使用 \pkg{xeCJK} 的功能来禁用下划线的断点,并调整其粗细。
+% \begin{macrocode}
+ \begin{center}
+ \xeCJKsetup{
+ underline = {
+ skip = false,
+ thickness = 1.4pt,
+ }
+ }
+% \end{macrocode}
+%
+% 然后是“题目”及其内容。
+% 题目需要手动断行,且长度控制在 \SI{36}{em} 以内。
+% 因表格本身的横线与文字间距较大,这里采用下划线的方式来划线。
+% 注意这里我们要判断题目是否有第二行(即 \cs{buct@ChineseTitleLineB} 是否有值)
+% 来输出一行还是两行题目。
+% \begin{macrocode}
+ \renewcommand{\arraystretch}{2}
+ \begin{tabular}{%
+ >{\zihao{-2}\xbsong}l
+ >{\zihao{3}\bfseries}l
+ }
+ 题\hspace{\ccwd}目 & \buct@title@ul{\buct@ChineseTitleLineA}\\
+ \ifthenelse{\equal{\buct@ChineseTitleLineB}{}}{\relax}{
+ & \buct@title@ul{\buct@ChineseTitleLineB}\\
+ }
+ \end{tabular}
+ \vskip144bp\zihao{3}
+% \end{macrocode}
+%
+% 使用一个表格来排版论文的信息,如前定义 \cs{buct@major@ul} 所述,这里横线的宽度取“专业”内容的宽度。
+% \begin{macrocode}
+ \begin{tabular}{
+ >{\begin{CJKfilltwosides}[b]{4\ccwd}\xbsong}r%
+ <{\end{CJKfilltwosides}}%
+ @{}>{\enspace\zihao{4}\bfseries}l%
+ <{\vspace{.2em}}%
+ }
+ 专业 & \buct@major@ul{\buct@major}\\
+ 学生 & \buct@major@ul{\buct@author}\\
+ 指导教师 & \buct@major@ul{\buct@supervisor}\\
+ \end{tabular}
+ \end{center}
+% \end{macrocode}
+%
+% 在页面底部书写日期。
+% \begin{macrocode}
+ \vfill{%
+ \begin{center}%
+ \buct@format@date{\@zhdate}%
+ \end{center}%
+ }
+% \end{macrocode}
+%
+% 硕博论文的处理方式与本科相似。
+% \begin{macrocode}
+ \else
+ \vspace{76bp}
+ \begin{center}
+ \xeCJKsetup{
+ underline = {
+ skip = false,
+ thickness = 1.2pt,
+ }
+ }
+ \renewcommand{\arraystretch}{2.7}
+ \begin{tabular}{
+ >{\fontsize{20}{36}\selectfont\begin{CJKfilltwosides}[b]{4\ccwd}\sffamily\bfseries}r%
+ <{\end{CJKfilltwosides}}%
+ @{}>{\enspace\zihao{3}\bfseries}l%
+ <{\vspace{.2em}}%
+ }
+ 题目 & \buct@title@ul{\buct@ChineseTitleLineA}\\
+ \ifthenelse{\equal{\buct@ChineseTitleLineB}{}}{\relax}{
+ & \buct@title@ul{\buct@ChineseTitleLineB}\\
+ }
+ 专业 & \buct@title@ul{\zihao{4}\buct@major}\\
+ 研究生 & \buct@title@ul{\zihao{4}\buct@author}\\
+ 指导教师 & \buct@title@ul{\zihao{4}\buct@supervisor}\\
+ \end{tabular}
+ \end{center}
+ \vfill{%
+ \begin{center}%
+ \buct@format@date{\@zhdate}%
+ \end{center}%
+ }
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\makecover}
+% 这里定义文档命令 \cs{makecover},接受一个可选参数用于插入扫描页,否则调用 \cs{buct@makecover} 生成封面。
+% \begin{macrocode}
+\NewDocumentCommand{\makecover}{ o }{%
+ \hypertarget{cover}{}
+ \pdfbookmark{封面}{cover}
+ \IfNoValueTF{#1}{
+% \end{macrocode}
+% 在不插入扫描页的情况下调用时,需要先检查字体存在情况。
+% 因为只有硕博论文封面才会用到方正大标宋,为简单起见,这里只检查方正小标宋。
+% 如果存在方正小标宋,则默认也存在方正大标宋、华文行楷和中易楷体,并定义上述所有字体。
+% 至于西文字体则不做设置,也就是说沿用模板默认的 Times New Roman。
+% 事实上该字体只会作用于本科封面的数字日期,除此之外的数字(如学号)使用中文字体。
+% \begin{macrocode}
+ \IfFontExistsTF{FZXiaoBiaoSong-B05S}{%
+ \newCJKfontfamily[xbsong] \xbsong {FZXiaoBiaoSong-B05S}
+ \newCJKfontfamily[dbsong] \dbsong {FZDaBiaoSong-B06S}
+ \newCJKfontfamily[xingkai]\xingkai{STXingkai}
+ \newCJKfontfamily[zhkai] \zhkai {KaiTi} [AutoFakeBold]
+% \end{macrocode}
+% 只有当存在方正小标宋时,令 \cs{makecover} 调用 \cs{buct@makecover},否则输出空白页。
+% \begin{macrocode}
+ \buct@makecover
+ }{
+ \cleardoublepage
+ }
+
+ }{%
+% \end{macrocode}
+% 在选择插入扫描页的情况下(命令后跟了一个可选参数)则无需检查和设置字体,直接插入 PDF 文件即可。
+% \begin{macrocode}
+ \includepdf[pages=-]{#1}
+ }
+% \end{macrocode}
+% 输出封面完成后,页边距从封面中恢复。
+% \begin{macrocode}
+\restoregeometry
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \subsection{前置部分}
% \begin{macro}{\buct@pdfmark}
% 为了方便查看,模板将前置部分编入PDF书签,实现跳转。
@@ -1280,12 +1620,17 @@
% \subsubsection{任务书}
% \begin{environment}{taskbook}
% 环境 \env{taskbook} 用于插入任务书部分,该部分排在诚信声明之后。
+% 如果环境后带星号,则生成的任务书清空页眉和页脚。
+%
+% 留意 \pkg{xparse} 宏包的 \cs{NewDocumentEnvironment} 还没法一次性定义带或不带星号的环境
+% ——比如 \env{tabular} 和 \env{tabular*}。
% \begin{macrocode}
\ifbuct@bachelor
- \newenvironment{taskbook}{%
+ \NewDocumentEnvironment{taskbook}{ s }{%
\cleardoublepage%
\buct@pdfmark{\buct@task@pdf}{taskbook}%
\section*{\buct@task@title}%
+ \IfBooleanTF{#1}{\pagestyle{empty}}{}%
}{\clearpage}
% \end{macrocode}
% \end{environment}
@@ -1307,12 +1652,12 @@
\noindent%
\begin{minipage}{\textwidth}%
\punctstyle{plain}\linespread{1.94}%
- \buct@task@ctitle\buct@ul[27em]{\buct@ctitle}\\[3pt]
+ \buct@task@ChineseTitle\buct@ul[27em]{\buct@ChineseTitle}\\[3pt]
\IfBooleanTF{#1}{% less lines break
\buct@task@school\buct@ul[10em]{\buct@school}\quad
\buct@task@major\buct@ul[10em]{\buct@major}\quad
\buct@task@class\buct@ul[5em]{\buct@class}\\[3pt]
- \buct@task@student\buct@ul[5em]{\buct@cauthor}\quad
+ \buct@task@student\buct@ul[5em]{\buct@author}\quad
\buct@task@supervisor\buct@ul[6em]{\buct@supervisor}\quad
\buct@task@msupervisor\buct@ul[4em]{\buct@msupervisor}%
}{% more lines break
@@ -1324,7 +1669,7 @@
\buct@task@school\buct@ul[15em]{\buct@school}\qquad
\buct@task@major\buct@ul[13em]{\buct@major}\\[3pt]
\buct@task@class\buct@ul[15em]{\buct@class}\qquad
- \buct@task@student\buct@ul[13em]{\buct@cauthor}\\[3pt]
+ \buct@task@student\buct@ul[13em]{\buct@author}\\[3pt]
\buct@task@supervisor\buct@ul[8em]{\buct@supervisor}\qquad
\buct@task@msupervisor\buct@ul[10em]{\buct@msupervisor}%
}
@@ -1377,27 +1722,27 @@
\cleardoublepage
\buct@pdfmark{\buct@cabstract@title}{cabstract}
\begin{center}
- \buct@abs@titfont\buct@ctitle
+ \buct@abs@titfont\buct@ChineseTitle
\vskip22pt
- \buct@abs@infofont\buct@cauthor\quad%
+ \buct@abs@infofont\buct@author\quad%
\buct@class\quad\buct@studentid\quad%
\buct@supervisor@title\buct@supervisor%
\vskip22pt
\buct@abs@absfont\buct@cabstract@title
\end{center}\par\vspace{18pt}
- }{\vskip1em\noindent\buct@keywordsfont\buct@ckeywords@title\buct@ckeywords}
+ }{\vskip1em\noindent\buct@keywordsfont\buct@ChineseKeywords@title\buct@ChineseKeywords}
\else
\newenvironment{cabstract}{%
\cleardoublepage
- \buct@pdfmark{\buct@cabstract@title}{cabstract}\markboth{\buct@cabstract@title}{}
+ \buct@pdfmark{\buct@cabstract@title}{cabstract}\markboth{\buct@cabstract@title}{\buct@cabstract@title}
\begin{center}
- \buct@abs@titfont\buct@ctitle
+ \buct@abs@titfont\buct@ChineseTitle
\vskip24pt
\buct@abs@absfont\buct@cabstract@title
\end{center}\par\vspace{12pt}
\buct@abs@textfont
}{\vskip24pt%
- \noindent\buct@keywords@titfont\buct@ckeywords@title\buct@keywords@font\buct@ckeywords}
+ \noindent\buct@keywords@titfont\buct@ChineseKeywords@title\buct@keywords@font\buct@ChineseKeywords}
\fi
% \end{macrocode}
% \end{environment}
@@ -1410,24 +1755,24 @@
\cleardoublepage%
\buct@pdfmark{\buct@eabstract@title}{abstracten}
\begin{center}
- \buct@abs@titfonten\buct@etitle\vskip22pt
+ \buct@abs@titfonten\buct@EnglishTitle\vskip22pt
\buct@abs@absfonten\buct@eabstract@title
\end{center}
\par\vspace{22pt}
- }{\vskip1em\noindent\buct@keywordsfonten \buct@ekeywords@title\buct@ekeywords}
+ }{\vskip1em\noindent\buct@keywordsfonten \buct@EnglishKeywords@title\buct@EnglishKeywords}
\else
\newenvironment{eabstract}{%
\cleardoublepage%
- \buct@pdfmark{\buct@eabstract@title}{eabstract}\markboth{\buct@eabstract@title}{}
+ \buct@pdfmark{\buct@eabstract@title}{eabstract}\markboth{\buct@eabstract@title}{\buct@eabstract@title}
\begin{center}
\setlength{\leftskip}{3em plus 1em minus .5em}
\setlength{\rightskip}{3em plus 1em minus .5em}
- \buct@abs@titfonten\buct@etitle\vskip76pt
+ \buct@abs@titfonten\buct@EnglishTitle\vskip76pt
\buct@abs@absfonten\buct@eabstract@title
\end{center}\par\vspace{40pt}
\buct@abs@textfont
}{\vskip48pt%
- \noindent\buct@keywords@titfonten\buct@ekeywords@title\buct@keywords@fonten\buct@ekeywords}
+ \noindent\buct@keywords@titfonten\buct@EnglishKeywords@title\buct@keywords@fonten\buct@EnglishKeywords}
\fi
% \end{macrocode}
% \end{environment}
@@ -1451,7 +1796,7 @@
\cleardoublepage
\pdfbookmark{\contentsname}{toc}%
\chapter*{\buct@toc@tocfont\buct@content@title}%
- \ifbuct@bachelor\relax\else\markboth{\buct@content@title}\fi
+ \ifbuct@bachelor\relax\else\markboth{\buct@content@title}{\buct@content@title}\fi
\@starttoc{toc}
}
% \end{macrocode}
@@ -1464,10 +1809,10 @@
\ifbuct@bachelor\relax\else
\newcommand\tableofcontentsEN{%
\cleardoublepage
- \pdfbookmark{\econtentsname}{toce}%
+ \pdfbookmark{\buct@econtentsname}{toce}%
\chapter*{%
- \em\econtentsname%
- \ifbuct@bachelor\relax\else\markboth{\econtentsname}\fi%
+ \em\buct@econtentsname%
+ \ifbuct@bachelor\relax\else\markboth{\buct@econtentsname}{\buct@econtentsname}\fi%
}%
\@starttoc{toce}
}
@@ -1533,11 +1878,11 @@
{\buct@toc@chapfont\vspace{3pt}}
{\thecontentslabel\quad}{}
{\titlerule*[.4em]{$\cdot$}\bfseries\contentspage}
- \titlecontents{section}[2em]
+ \titlecontents{section}[2.5em]
{\buct@toc@secfont\vspace{-3pt}}
{\thecontentslabel\quad}{}
{\titlerule*[.5em]{$\cdot$}\contentspage}
- \titlecontents{subsection}[5em]
+ \titlecontents{subsection}[4em]
{\buct@toc@ssecfont\vspace{-3pt}}
{\thecontentslabel\quad}{}
{\titlerule*[1em]{$\cdot$}\contentspage}
@@ -1568,7 +1913,7 @@
\addcontentsline{toc}{chapter}{\bibname}
\ifbuct@bachelor\relax\else
\addcontentsline{toce}{chapter}{\buct@toce@chapfont\buct@ebib@title}
- \markboth{\bibname}
+ \markboth{\bibname}{\bibname}
\fi
}
% \end{macrocode}
@@ -1722,7 +2067,7 @@
% 使用 \pkg{enumitem} 宏包分别设置编号列表、无编号列表、描述列表环境的间距。
% 这里将三种列表默认增加的垂直间距全部清除,即各行间距与正文行间距相同,以符合中文习惯。
%
-% 如果一级列表环境作为标题(对应《本科规范》中的五级标题,即带圈序号),
+% 如果一级列表环境作为标题(对应《本科生规范》中的五级标题,即带圈序号),
% 则不设置加粗、不增加段间距。由于列表间的垂直间距减小了,所以
% 相应地稍微调小列表序号和文字之间的距离,使得文字更紧凑。
%
@@ -1855,12 +2200,10 @@
% 在“符号说明表”中我们嵌套了 \env{longtable} 环境,但其中的字号仍应为小四号。
% 因此这里需要保留原先的定义。
% \begin{macrocode}
-\ifbuct@bachelor\relax\else
- \let\oldlongtable\longtable
- \let\endoldlongtable\endlongtable
- \def\longtable{\zihao{5}\oldlongtable}
- \AtEndEnvironment{longtable}{\normalsize}
-\fi
+\let\oldlongtable\longtable
+\let\endoldlongtable\endlongtable
+\def\longtable{\zihao{5}\oldlongtable}
+\AtEndEnvironment{longtable}{\normalsize}
% \end{macrocode}
%
% 设置插图的文件路径。
@@ -2005,7 +2348,7 @@
\newenvironment{achievements}{%
\cleardoublepage
\chapter*{\buct@achi@title}
- \markboth{\buct@achi@title}{}
+ \markboth{\buct@achi@title}{\buct@achi@title}
\addcontentsline{toc}{chapter}{\buct@achi@title}
\addcontentsline{toce}{chapter}{\buct@toce@chapfont\buct@eachi@title}
}{}
@@ -2018,7 +2361,7 @@
\newenvironment{resume}{%
\cleardoublepage
\chapter*{\buct@resu@title}
- \markboth{\buct@resu@title}{}
+ \markboth{\buct@resu@title}{\buct@resu@title}
\addcontentsline{toc}{chapter}{\buct@resu@title}
\addcontentsline{toce}{chapter}{\buct@toce@chapfont\buct@eresu@title}
}{}
@@ -2032,7 +2375,7 @@
\newenvironment{acknowledgement}{%
\chapter*{\buct@ack@title}
\ifbuct@bachelor\relax\else
- \markboth{\buct@ack@title}{}
+ \markboth{\buct@ack@title}{\buct@ack@title}
\addcontentsline{toce}{chapter}{\buct@toce@chapfont\buct@eack@title}
\fi
\addcontentsline{toc}{chapter}{\buct@ack@title}
@@ -2052,7 +2395,7 @@
\addcontentsline{toc}{chapter}{\buct@deno@title}
\else
\buct@pdfmark{\buct@deno@title}{denotation}
- \markboth{\buct@deno@title}{}
+ \markboth{\buct@deno@title}{\buct@deno@title}
\fi
\vspace{-1em}%
\begin{oldlongtable}[c]{l@{\extracolsep{3em}}p{#1}}
@@ -2135,374 +2478,16 @@
% \end{macrocode}
%
%
-% \subsection{封面}
-% 由于学校会统一印制封面,这里仅提供本科和硕博的一个参考实现。
-% 并且由于学校所给的参考封面每年都有细微的变动,由本模板所生成的封面上文字间距不能保证与参考一致。
-% 还请留心。
-% \begin{macrocode}
-%<*cover>
-\ProvidesClass{buctcover}[2022/06/21 Cover Maker for BUCTthesis]
-% \end{macrocode}
-% 和论文本体一样,目前只支持 \XeLaTeX\ 引擎编译封面,其余设置基本一致。
-% \begin{macrocode}
-\RequirePackage{ifxetex}
-\RequireXeTeX
-\RequirePackage{kvoptions}
-\SetupKeyvalOptions{
- family = buct,
- prefix = buct@,
- setkeys = \kvsetkeys,
-}
-\newif\ifbuct@bachelor\buct@bachelorfalse
-\newif\ifbuct@master\buct@masterfalse
-\newif\ifbuct@doctor\buct@doctorfalse
-\define@key{buct}{type}{\expandafter\csname buct@#1true\endcsname}
-\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
-\ProcessKeyvalOptions*
-\PassOptionsToPackage{quiet}{xeCJK}
-\LoadClass[zihao=-4]{ctexbook}
-% \end{macrocode}
-%
-% 封面的 \opt{type} 对于三种学位类型都能支持,但是必须选择其中的一项。
-% \begin{macrocode}
-\ifbuct@bachelor\relax\else
- \ifbuct@master\relax\else
- \ifbuct@doctor\relax\else
- \ClassError{buctthesis}{%
- Specified thesis type is obligatory: \MessageBreak%
- type = [ bachelor | master | doctor ]%
- }{}
-\fi\fi\fi
-% \end{macrocode}
-%
-% 定义用于定义论文相关信息的内部命令。
-% 与 \cls{buctthesis} 不同的是:这里仅能通过 \cs{coversetup} 定义论文信息。
-% 其中 \opt{titleA} 和 \opt{titleB} 分别用于封面标题的第一行与第二行。
-% 由于可能存在只用一行就能写完标题的情况,所以这里不设置后者的默认文本。
-% \begin{macrocode}
-\newcommand{\coversetup}[1]{\kvsetkeys{buct}{#1}}
-\DeclareStringOption[班级未定义]{class}
-\DeclareStringOption[学号未定义]{studentid}
-\DeclareStringOption[题目首行未定义]{titleA}
-\DeclareStringOption{titleB}
-\DeclareStringOption[专业未定义]{major}
-\DeclareStringOption[作者未定义]{author}
-\DeclareStringOption[导师未定义]{supervisor}
-\DeclareStringOption[\the\year-\two@digits{\month}-\two@digits{\day}]{date}
-% \end{macrocode}
-%
-% 页边距设置。经过测量,各边距值比正文部分都要小;本科暂与硕博设置一致。
-% \begin{macrocode}
-\RequirePackage[a4paper,nomarginpar,
- top = 2.1cm, bottom = 2.2cm, left = 2cm, right = 2cm,
- headheight = 0cm, footskip = 0cm
-]{geometry}
-% \end{macrocode}
-%
-% 载入 \pkg{xeCJKfntef} 宏包。在 \pkg{ctex} 宏集 2.5 版本之后需要手动载入。
-% \begin{macrocode}
-\RequirePackage{xeCJKfntef}
-% \end{macrocode}
-%
-% 以下宏包分别用于排版表格、插图,计算标题文本长度,划本科封面线条,
-% 判断语句和添加封面的 PDF 书签。
-% \pkg{textpos} 配合 \pkg{tikz},这样就能在页面的任何地方作画了。
-% \begin{macrocode}
-\RequirePackage{array,graphicx,calc,tikz,xifthen,hyperref}
-\RequirePackage[absolute,overlay]{textpos}
-% \end{macrocode}
-%
-% 清空页眉页脚。
-% \begin{macrocode}
-\pagestyle{empty}
-% \end{macrocode}
-%
-% 字体配置。
-%
-% 开启伪粗体,并且应比正文更粗一些。
-% \begin{macrocode}
-\xeCJKsetup{EmboldenFactor=2.3}
-% \end{macrocode}
-%
-% 各种字体的声明与设置。分别是:中易宋体、中易黑体、华文行楷、中易楷体、方正小标宋和方正大标宋。
-% 后二者需前往方正字库网站下载。
-% \begin{macrocode}
-\setCJKmainfont{SimSun}[AutoFakeBold]
-\setCJKsansfont{SimHei}[AutoFakeBold]
-\newCJKfontfamily[xingkai]\xingkai{STXingkai}
-\newCJKfontfamily[zhkai] \zhkai {KaiTi} [AutoFakeBold]
-\newCJKfontfamily[xbsong] \xbsong {FZXiaoBiaoSong-B05S}
-\newCJKfontfamily[dbsong] \dbsong {FZDaBiaoSong-B06S}
-% \end{macrocode}
-% 设置西文字体。事实上该字体这只会作用于本科封面的数字日期,除此之外的数字(如学号)使用中文字体。
-% \begin{macrocode}
-\setmainfont{Times New Roman}
-% \end{macrocode}
-%
-% 标尺,用于调试。手动取消注释来开启。
-% \begin{macrocode}
-% \usepackage[unit=cm,type=upperleft,hshift=0cm,vshift=0cm]{fgruler}
-% \end{macrocode}
-%
-% \begin{macro}{\buct@title@ul}
-% 定义下划线命令,这里利用了 \pkg{calc} 宏包的 \cs{widthof} 命令,
-% 取 \cs{buct@titleA} (即首行标题)的长度,用以固定下划线的长度。
-% 文本末尾加一个 \cs{enspace} 会让横线右端稍长于最后一个文字,显得更美观一些。
-% \begin{macrocode}
-\newcommand\buct@title@ul[1]{%
- \CJKunderline{\makebox[\widthof{\buct@titleA\enspace}][l]{#1}}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\buct@major@ul}
-% 但是对于本科封面而言,“专业”“学生”“指导教师”与“题目”之间有一大段空白,
-% 可以看做相互独立的表格。因此,这里我们让横线的宽度取所填入专业文本的宽度。
-% 使用 \cs{quad} 会让横线右端长于最后一个文字更多一点,更贴合封面的参考样例。
-% \begin{macrocode}
-\newcommand\buct@major@ul[1]{%
- \CJKunderline{\makebox[\widthof{\buct@major\quad}][c]{#1}}
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\buct@format@date}
-% 日期格式处理,将输入的 \cs{buct@date} 拆分。
-% \begin{macrocode}
-\newcommand\buct@format@date[1]{%
- \edef\buct@@date{\buct@date}%
- \def\buct@@process@date##1-##2-##3\@nil{%
- #1{##1}{##2}{##3}%
- }%
- \expandafter\buct@@process@date\buct@@date\@nil
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \cs{@zhdate} 命令接受三个数字。
-% 本科的日期要求比较简单,直接输出对应的数字即可。
-% 但是样例所给的数字前后有一些空白,我们用 \cs{makebox} 来定格它。
-% \begin{macrocode}
-\newcommand\@zhdate[3]{%
- \bfseries\zhkai
- \ifbuct@bachelor
- \zihao{4}
- #1年\makebox[1.5em]{#2}月\makebox[1.5em]{#3}日
-% \end{macrocode}
-%
-% 如果是硕博,则将“年”转换为中文数字串,“月”和“日”转换为中文数字;其中“年”中的 0 映射为“〇”而非“零”。
-% \begin{macrocode}
- \else
- \Large\ziju{.1}%
- 日\hspace{1.5\ccwd}期:\zhdigits{#1}年\zhnumber{#2}月\zhnumber{#3}日%
- \fi
-}
-% \end{macrocode}
-%
-% \begin{macro}{\buct@makecover}
-% 接下来是重头戏:定义 \cs{buct@makecover} 命令来生成封面。
-% \begin{macrocode}
-\newcommand{\buct@makecover}{%
-% \end{macrocode}
-%
-% 封面右上角的“单位代码”和“学号”,先分别设置格式。
-% \begin{macrocode}
- \begin{table}[h]
- \raggedleft
- \ifbuct@bachelor
- \songti\zihao{5}
- \else
- \renewcommand{\arraystretch}{1.3}\large
- \fi
-% \end{macrocode}
-%
-% 用一个无线表格来排版文字。需要注意二者都要以中文字体来书写数字。
-% 注意本科封面的表格右端并不是严格顶头,所以这里空开两个字符的宽度。
-% \begin{macrocode}
- \begin{tabular}{l@{}l}
- \ifbuct@bachelor%
- 班\hspace{2\ccwd}级&:\CJKfamily+{zhsong}\buct@class\hspace*{2\ccwd}\\
- 学\hspace{2\ccwd}号&:\CJKfamily+{zhsong}\buct@studentid\hspace*{2\ccwd}\\
- \else%
- \xbsong 单位代码 & :\CJKfamily+{zhsong}\mbox{10010}\\
- \xbsong 学\hspace{2\ccwd}号 & :\CJKfamily+{zhsong}\mbox{\buct@studentid}\\
- \fi
- \end{tabular}
- \end{table}
- \ifbuct@bachelor\vspace{3bp}\else\vspace{26bp}\fi
-% \end{macrocode}
-%
-% 校徽与校名。前者是插图,后者是文字。
-% 需要注意,本科和硕博封面的“北京化工大学”几个字的字距是有差别的。
-% 由于并未设置居中,所以本科还需要手动空一点距离让文本近似居于页面中央。
-% \begin{macrocode}
- \begin{minipage}[c][][c]{2.35cm}
- \includegraphics[width = 2.35cm]{BUCT-badge.pdf}
- \end{minipage}
- \qquad
- \begin{minipage}[c][2.35cm][c]{9cm}
- \xingkai
- \ifbuct@bachelor
- \ziju{0.1}\hspace*{0.8\ccwd}\zihao{-0}
- \else
- \ziju{-0.02}\zihao{0}
- \fi
- {北京化工大学}
- \end{minipage}
- \ifbuct@bachelor\vspace{12bp}\else\vspace{18bp}\fi
-% \end{macrocode}
-%
-% 标题。本科的标题中的“(论文)”使用了半角括号,字体使用 Times New Roman Bold。
-% 按照排版规范,但模板使用全角和对应的中文字体。
-% 对于这项更改,我们使用 \pkg{xeCJK} 里的命令来吃掉一点括号的空白。
-%
-% 注:\cs{punctstyle\{banjiao\}} 和 \cs{xeCJKsetup\{PunctStyle = banjiao\}} 和 \cs{ctexset\{punct = banjiao\}}是一样的。
-% \begin{macrocode}
- \begin{center}
- \ifbuct@bachelor
- \ziju{0.15}\xbsong\zihao{-0}\CJKfamily+{}{%
- \punctstyle{banjiao}毕业设计(论文)% (论文)
- }
- \else%
- %\ziju{-0.05}
- \dbsong\fontsize{38bp}{60bp}\selectfont
- \ifbuct@master{硕}\else{博}\fi{}士研究生学位论文
- \fi
- \end{center}
-% \end{macrocode}
-%
-% 对于论文标题之下的部分,我们将本科和硕博分开设置。
-%
-% 本科封面有两条横贯页面的横线,位于纸张顶部向下 \SI{10}{\centi\metre} 左右,
-% 我们用 \pkg{textpos} 的 \env{textblock} 环境定位,用 \pkg{tikz} 将它们画出来。
-% 两条线的间距取 \SI{0.2}{\centi\metre}。
-% \begin{macrocode}
- \ifbuct@bachelor
- \setlength{\TPHorizModule}{1cm}
- \setlength{\TPVertModule}{1cm}
- \begin{textblock}{0}(0,10)
- \noindent%
- \tikz[line width=1.2pt] \draw (0,0) -- (21,0) (0,0.2) -- (21,0.2);
- \end{textblock}
- \vspace{72bp}
-% \end{macrocode}
-%
-% 接下来书写题目。先使用 \pkg{xeCJK} 的功能来禁用下划线的断点,并调整其粗细。
-% \begin{macrocode}
- \begin{center}
- \xeCJKsetup{
- underline = {
- skip = false,
- thickness = 1.4pt,
- }
- }
-% \end{macrocode}
-%
-% 然后是“题目”及其内容。
-% 题目需要手动断行,且长度控制在 \SI{36}{em} 以内。
-% 因表格本身的横线与文字间距较大,这里采用下划线的方式来划线。
-% 注意这里我们要判断题目是否有第二行(即 \cs{buct@titleB} 是否有值)
-% 来输出一行还是两行题目。
-% \begin{macrocode}
- \renewcommand{\arraystretch}{2}
- \begin{tabular}{%
- >{\zihao{-2}\xbsong}l
- >{\zihao{3}\bfseries}l
- }
- 题\hspace{\ccwd}目 & \buct@title@ul{\buct@titleA}\\
- \ifthenelse{\equal{\buct@titleB}{}}{\relax}{
- & \buct@title@ul{\buct@titleB}\\
- }
- \end{tabular}
- \vskip144bp\zihao{3}
-% \end{macrocode}
-%
-% 使用一个表格来排版论文的信息,如前定义 \cs{buct@major@ul} 所述,这里横线的宽度取“专业”内容的宽度。
-% \begin{macrocode}
- \begin{tabular}{
- >{\begin{CJKfilltwosides}[b]{4\ccwd}\xbsong}r%
- <{\end{CJKfilltwosides}}%
- @{}>{\enspace\zihao{4}\bfseries}l%
- <{\vspace{.2em}}%
- }
- 专业 & \buct@major@ul{\buct@major}\\
- 学生 & \buct@major@ul{\buct@author}\\
- 指导教师 & \buct@major@ul{\buct@supervisor}\\
- \end{tabular}
- \end{center}
-% \end{macrocode}
-%
-% 在页面底部书写日期。
-% \begin{macrocode}
- \vfill{%
- \begin{center}%
- \buct@format@date{\@zhdate}%
- \end{center}%
- }
-% \end{macrocode}
-%
-% 硕博论文的处理方式与本科相似。
-% \begin{macrocode}
- \else
- \vspace{76bp}
- \begin{center}
- \fontsize{20}{36}\selectfont
- \xeCJKsetup{
- underline = {
- skip = false,
- thickness = 1.2pt,
- }
- }
- \begin{tabular}{
- >{\begin{CJKfilltwosides}[b]{4\ccwd}\sffamily\bfseries}r%
- <{\end{CJKfilltwosides}}%
- @{}>{\enspace\zihao{3}\bfseries}l%
- <{\vspace{.2em}}%
- }
- 题目 & \buct@title@ul{\buct@titleA}\\
- \ifthenelse{\equal{\buct@titleB}{}}{\relax}{
- & \buct@title@ul{\buct@titleB}\\
- }
- 专业 & \buct@title@ul{\zihao{4}\buct@major}\\
- 研究生 & \buct@title@ul{\zihao{4}\buct@author}\\
- 指导教师 & \buct@title@ul{\zihao{4}\buct@supervisor}\\
- \end{tabular}
- \end{center}
- \vfill{%
- \begin{center}%
- \buct@format@date{\@zhdate}%
- \end{center}%
- }
- \fi
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\makecover}
-% 文档命令 \cs{makecover} 类似 \cs{makedeclare},
-% 接受一个可选参数用于插入扫描页,否则调用 \cs{buct@makecover} 生成封面。
-% \begin{macrocode}
-\NewDocumentCommand{\makecover}{ o }{%
- \hypertarget{cover}{}
- \pdfbookmark{封面}{cover}
- \IfNoValueTF{#1}{\buct@makecover}{%
- \includepdf[pages=-]{#1}
- }
-}
-%</cover>
-% \end{macrocode}
-% \end{macro}
-%
-%
% \iffalse
% \begin{macrocode}
%<*manual>
-\ProvidesPackage{manual}[2021/09/25 document style for BUCTthesis]
+\ProvidesPackage{manual}[2023/05/20 document style for BUCTthesis]
\RequirePackage{hypdoc}
\PassOptionsToPackage{AutoFakeSlant}{xeCJK}
\RequirePackage[UTF8, heading, fontset = none, linespread = 1.2,]{ctex}
\RequirePackage[toc]{multitoc}
\RequirePackage{
+ xeCJKfntef,
listings,
float,
tabularx,
@@ -2586,7 +2571,6 @@
\setlist[enumerate]{%
itemindent = 2em,
}
-\newcommand\without\CJKsout
\newcommand\Arg[1]{ \texttt{\char`\{} \meta{#1} \texttt{\char`\}} }
\providecommand\marg[1]{ \Arg{#1} }
\providecommand\oarg[1]{ \texttt[ \meta{#1} \texttt] }
@@ -2596,25 +2580,11 @@
\DeclareRobustCommand{\pkg}{\textsf}
\DeclareRobustCommand{\cls}{\textsf}
\DeclareRobustCommand{\file}{\textsf}
-\def\DescribeOpt{\leavevmode\@bsphack%
- \begingroup\MakePrivateLetters\Describe@Opt}
-\def\Describe@Opt#1{\endgroup%
- \marginpar{\raggedleft\PrintDescribeOpt{#1}}%
- \SpecialOptIndex{#1}\@esphack\ignorespaces}
-\def\PrintDescribeOpt#1{\strut \MacroFont #1\ }
-\def\SpecialOptIndex#1{\@bsphack%
- \begingroup%
- \HD@target%
- \let\HDorg@encapchar\encapchar%
- \edef\encapchar usage{%
- \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
- }%
- \@bsphack
- \index{#1\actualchar{\protect\ttfamily#1}
- (option)\encapchar usage}%
- \index{options:\levelchar#1\actualchar%
- {\protect\ttfamily#1}\encapchar usage}\@esphack%
- \endgroup\@esphack}
+\NewDocElement[macrolike = false ,
+ idxtype = opt. ,
+ idxgroup = options ,
+ printtype = \textit{opt.}
+ ]{Opt}{option}
\NewDocumentEnvironment{syntax}{ m }{%
\linespread{1}\xeCJKsetup{PunctStyle=plain}\xeCJKsetup{CJKecglue}%
\cs{#1}\ignorespaces%
@@ -2634,7 +2604,7 @@
}
\hypersetup{
pdftitle = {BUCTthesis:北京化工大学学位论文模板},
- pdfauthor = {Miracle0565},
+ pdfauthor = {The-CCSN},
}
\CodelineIndex
\EnableCrossrefs
diff --git a/macros/xetex/latex/buctthesis/buctthesis.ins b/macros/xetex/latex/buctthesis/source/buctthesis.ins
index 4396724f77..f91d20dd39 100644
--- a/macros/xetex/latex/buctthesis/buctthesis.ins
+++ b/macros/xetex/latex/buctthesis/source/buctthesis.ins
@@ -1,7 +1,8 @@
%%
%% Copyright (C) 2019-2022 by Miracle0565
+%% Copyright (C) 2022-2023 by The-CCSN
%%
-%% https://github.com/Miracle0565/BUCTthesis
+%% https://github.com/the-ccsn/BUCTthesis
%%
%% This file may be distributed and/or modified under
%% the conditions of the LaTeX Project Public License,
@@ -25,7 +26,8 @@
This is a generated file.
-Copyright (C) 2019-\the\year by Miracle0565
+Copyright (C) 2019-2022 by Miracle0565
+Copyright (C) 2022-\the\year by The-CCSN
https://github.com/Miracle0565/BUCTthesis
@@ -48,11 +50,6 @@ of LaTeX version 1999/12/01 or later.
\file{manual.sty} {\from{\jobname.dtx}{manual}}
}
-\generate{
- \usedir{tex/latex/buctthesis/cover}
- \file{buctcover.cls}{\from{\jobname.dtx}{cover}}
-}
-
\obeyspaces
\Msg{*************************************************************}
\Msg{* *}
@@ -61,7 +58,6 @@ of LaTeX version 1999/12/01 or later.
\Msg{* *}
\Msg{* buctthesis.cls *}
\Msg{* munual.sty *}
-\Msg{* buctcover.cls *}
\Msg{* *}
\Msg{* To produce the documentation run the file buctthesis.dtx *}
\Msg{* through LaTeX. *}