diff options
Diffstat (limited to 'macros/latex')
40 files changed, 2811 insertions, 639 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-bath/Makefile b/macros/latex/contrib/biblatex-contrib/biblatex-bath/Makefile index 09d8c427cb..12f3602b24 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-bath/Makefile +++ b/macros/latex/contrib/biblatex-contrib/biblatex-bath/Makefile @@ -1,5 +1,7 @@ STYLE = bath NAME = biblatex-$(STYLE) +TEST = test-output +COMP = test-compat SHELL = bash PWD = $(shell pwd) TEMP := $(shell mktemp -d -t tmp.XXXXXXXXXX) @@ -7,28 +9,45 @@ TDIR = $(TEMP)/$(NAME) VERS = $(shell ltxfileinfo -v $(NAME).dtx) LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL) UTREE = $(shell kpsewhich --var-value TEXMFHOME) +AUX = aux bbl bcf blg fdb_latexmk fls listing log out run.xml .PHONY: source clean distclean inst install uninst uninstall zip ctan +.INTERMEDIATE: $(TEST).pdf $(COMP).tex $(COMP).pdf all: $(NAME).pdf clean @exit 0 source: $(NAME).dtx - luatex -interaction=batchmode $(NAME).dtx >/dev/null + luatex -interaction=batchmode $< >/dev/null $(STYLE).bbx $(STYLE).cbx $(STYLE).dbx english-$(STYLE).lbx british-$(STYLE).lbx $(NAME).bib: source -$(NAME).pdf: source - latexmk -silent -lualatex -interaction=batchmode $(NAME).dtx >/dev/null +$(NAME).pdf: $(NAME).dtx + latexmk -silent -lualatex -interaction=batchmode $< >/dev/null @echo "Compilation complete." +$(TEST).pdf: $(TEST).tex $(STYLE).bbx $(NAME).bib + latexmk -silent -lualatex -interaction=batchmode $< >/dev/null + +$(TEST).bbi: $(TEST).pdf + pdftotext $< $@ + +$(COMP).tex: $(TEST).tex + sed 's/biblatex-bath.bib/..\/bst\/bath-bst.bib/' $< > $@ + +$(COMP).pdf: $(COMP).tex $(STYLE).bbx ../bst/bath-bst.bib + latexmk -silent -lualatex -interaction=batchmode $< >/dev/null + +$(COMP).bbi: $(COMP).pdf + pdftotext $< $@ + clean: - rm -f $(NAME).{aux,bbl,bcf,blg,doc,fdb_latexmk,fls,glo,gls,hd,idx,ilg,ind,listing,log,nav,out,run.xml,snm,synctex.gz,tcbtemp,toc,vrb} - rm -f $(NAME).markdown.in + rm -f $(AUX:%=$(NAME).%) $(NAME).markdown.in rm -rf _markdown_$(NAME) + rm -f $(AUX:%=$(TEST).%) $(AUX:%=$(COMP).%) distclean: clean - rm -f $(NAME).{pdf,bib,ins} $(STYLE).{b,c,d}bx {english,british}-$(STYLE).lbx + rm -f $(NAME).{pdf,bib,ins} $(STYLE).{b,c,d}bx {english,british}-$(STYLE).lbx {$(TEST),$(COMP)}.bbi inst: all diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-bath/README.md b/macros/latex/contrib/biblatex-contrib/biblatex-bath/README.md index 6b73edbfc0..1575f459f1 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-bath/README.md +++ b/macros/latex/contrib/biblatex-contrib/biblatex-bath/README.md @@ -96,7 +96,7 @@ documentation. ## Licence -Copyright 2016-2021 University of Bath. +Copyright 2016-2022 University of Bath. This work consists of the documented LaTeX file biblatex-bath.dtx and a Makefile. diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-bath/biblatex-bath.dtx b/macros/latex/contrib/biblatex-contrib/biblatex-bath/biblatex-bath.dtx index a7e02886de..59e99148e3 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-bath/biblatex-bath.dtx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-bath/biblatex-bath.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment %<*internal|bbx|cbx|dbx|lbx|lbx-gb> -\def\Version{2021/02/25 v4.0} +\def\Version{2022/03/04 v5.0} %</internal|bbx|cbx|dbx|lbx|lbx-gb> %<*internal> \iffalse @@ -63,7 +63,7 @@ See: http://www.latex-project.org/lppl.txt \endpreamble \postamble -Copyright (C) 2016-2021 by University of Bath +Copyright (C) 2016-2022 by University of Bath \endpostamble \usedir{tex/latex/\jobname} @@ -178,6 +178,7 @@ Copyright (C) 2016-2021 by University of Bath , addbibresource , assignrefcontextentries , newrefcontext + , bibhang } , moredelim=**[s][\color{violet}]{[}{]} , moredelim=**[s][\color{blue!75!black}]{\{}{\}} @@ -427,7 +428,7 @@ This style has been tested with \textsf{biblatex} versions 3.12 and 3.14. To use the style, specify it when you load \textsf{biblatex}. To get the sorting order of your \emph{citations} right, specify the \texttt{ynt} sorting scheme. -To avoid possible inconsistencies (e.g.\@ in how disambiguation letters are +To avoid possible inconsistencies (e.g.~in how disambiguation letters are assigned), force all entries to use the global reference context: \begin{tcblisting}{listing only} @@ -456,7 +457,7 @@ throughout. To make a citation in the text, use the key that corresponds to the entry in your \texttt{.bib} file: \begin{tcblisting}{} -While collections can be supplemented by other means \autocite{williams1997edd}, +While collections can be supplemented by other means \autocite{devlin.etal2021ipp}, the absence of an invisible collection amongst historians is noted by \textcite[556]{stieg1981inh}. It may be, as \textcite{burchard1965hhl} points out, that they have no assistants or are reluctant to delegate, or it may be @@ -472,12 +473,17 @@ references, as the style relies on Biber functionality to deal with some of the more exotic types of entry. -\section{Change history} +\section{Breaking changes between versions} -\subsection{Version 1 to version 2} +The following sections list implementation changes that might affect the way +in which you write your bibliography database files. -If you have previously used version 1 of this style, there are some changes -you need to be aware of. +In addition to the changes listed, when upgrading between major versions, +you should expect some changes in formatting relating to the evolution of the +Harvard (Bath) style itself. Some of the style's internal settings and +structures may also change without warning. + +\subsection{Version 2} \begin{itemize} \item @@ -501,12 +507,6 @@ you need to be aware of. \href{http://ctan.org/pkg/biblatex-apa}{\textsf{biblatex-apa}}. Again, for the sake of backwards compatibility, before it does this it strips off any brackets you may have added by hand around your field value. - -\item - Since version 1 was released, there have been improvements made both to the - Harvard (Bath) style itself and to \textsf{biblatex} internals. You may therefore - notice some changes in how certain entries are styled, and if you have made your - own adaptations to the style, these may no longer work with version 2. \end{itemize} There is now a companion Bib\TeX\ style available (\texttt{bathx} in version 2+ @@ -515,10 +515,7 @@ sense that it will render the same \texttt{.bib} file the same way, so long as s adjustments are made that won't affect the \textsf{biblatex} rendering (mainly concerning the handling of dates). -\subsection{Version 2 to version 3} - -If you have previously used version 2 of this style, there are some changes -you need to be aware of. +\subsection{Version 3} \begin{itemize} \item @@ -538,6 +535,21 @@ you need to be aware of. your .bib file accordingly. \end{itemize} +\subsection{Version 5} + +\begin{itemize} +\item + Series names (except those in \texttt{legislation} and \texttt{jurisdiction} + entries) are now coerced to sentence case, so any capital letters you + want to keep need to be protected with braces. +\item + The `[Online]' tag is now also triggered by \texttt{urldate}\slash + \texttt{urlyear}. +\item + The style now sets \lstinline{\bibhang} to 0pt instead of + \lstinline{\parindent} (or 1em). +\end{itemize} + \section{Examples} The examples below are shown in three parts. @@ -548,15 +560,8 @@ The second, marked with \faCog, shows the reference as formatted by \textsf{bibl The last shows how the reference was entered in the \texttt{.bib} file. The bottom right corner shows the source of the example: `RX' indicates the `Reference examples (A-Z)' section of the Guide; `RL' indicates the `Organise a reference list' section of the Guide; `RI' indicates \emph{Referencing images}. -% Some examples are highlighted in -% \tcbox[colframe=hacked,colback=hacked!5!white,nobeforeafter,size=fbox,tcbox raise base]{orange}. -% This indicates that some fields have been `abused' to achieve the right effect; -% in other words, they contain information that would normally be entered in another field. -% Particular care should be taken with such items when switching between different styles, -% though of course any item might need adjustment to take account of differing conventions. - You may notice that the examples tend to use BibTeX aliases and conventions for -fields (e.g.\@ \texttt{address}, \texttt{journal}, \texttt{year}) rather than the +fields (e.g.~\texttt{address}, \texttt{journal}, \texttt{year}) rather than the native \textsf{biblatex} fields. This is simply to ease transitions to and from BibTeX, and not a symptom of recalcitrance on the part of the author. @@ -566,7 +571,7 @@ BibTeX, and not a symptom of recalcitrance on the part of the author. \subsubsection*{Book with author(s)} \begin{bibexbox}<RX>{rang.etal2012rdp} - Rang, H.P., Dale, M.M., Ritter, J.M., Flower, R.J. and Henderson, G., 2012. \emph{Rang and Dale's pharmacology}. 7th ed. Edinburgh:\@ Elsevier Churchill Livingstone. + Rang, H.P., Dale, M.M., Ritter, J.M., Flower, R.J. and Henderson, G., 2012. \emph{Rang and Dale's pharmacology}. 7th ed. Edinburgh: Elsevier Churchill Livingstone. \tcblower \begin{Verbatim} %</driver> @@ -584,7 +589,7 @@ BibTeX, and not a symptom of recalcitrance on the part of the author. \end{bibexbox} \begin{bibexbox}<RX>{ou1972em} - Open University, 1972. \emph{Electricity and magnetism}. Bletchley:\@ Open University Press. + Open University, 1972. \emph{Electricity and magnetism}. Bletchley: Open University Press. \tcblower \begin{Verbatim} %</driver> @@ -600,11 +605,29 @@ BibTeX, and not a symptom of recalcitrance on the part of the author. \end{Verbatim} \end{bibexbox} +\begin{bibexbox}<RX>{solomon.etal2019cbe} + Solomon, M.R., Askegaard, S., Hogg, M. and Bamossy, G.J., 2019. \emph{Consumer behaviour: a European perspective}. 7th ed. Harlow: Pearson. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@book{solomon.etal2019cbe, + author = {Solomon, M. R. and Askegaard, S. and Hogg, M. and Bamossy, G. J.}, + year = {2019}, + title = {Consumer Behaviour: a {European} Perspective}, + edition = {7}, + address = {Harlow}, + publisher = {Pearson}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + \subsubsection*{Book with editor(s) instead of author(s)} \begin{bibexbox}<RX>{rothman.etal2008me} - Rothman, K.J., Greenland, S. and Lash, T.L., eds, 2008. \emph{Modern epidemiology}. 3rd ed. Philadelphia, Pa.:\@ Lippincott Williams \& Wilkins. + Rothman, K.J., Greenland, S. and Lash, T.L., eds, 2008. \emph{Modern epidemiology}. 3rd ed. Philadelphia, Pa.: Lippincott Williams \& Wilkins. \tcblower \begin{Verbatim} %</driver> @@ -625,7 +648,7 @@ BibTeX, and not a symptom of recalcitrance on the part of the author. \subsubsection*{Electronic book} \begin{bibexbox}<RX>{haynes2014crc} - Haynes, W.M., ed.\@, 2014. \emph{CRC handbook of chemistry and physics} [Online]. 94th ed. Boca Raton, Fla.:\@ CRC Press/Taylor and Francis. Available from:\@ \url{http://www.hbcpnetbase.com} [Accessed 16 June 2016]. + Haynes, W.M., ed., 2014. \emph{CRC handbook of chemistry and physics} [Online]. 94th ed. Boca Raton, Fla.: CRC Press/Taylor and Francis. Available from: \url{http://www.hbcpnetbase.com} [Accessed 16 June 2016]. \tcblower \begin{Verbatim} %</driver> @@ -644,19 +667,20 @@ BibTeX, and not a symptom of recalcitrance on the part of the author. \end{Verbatim} \end{bibexbox} -\begin{bibexbox}<RX>{hodds2016re} - Hodds, J., 2016. \emph{Referencing ebooks} [Kindle version 4.18]. Bath:\@ University of Bath. +\begin{bibexbox}<RX>{blockley2021evs} + Blockley, D., 2021. \emph{Engineering: a very short introduction} [Online]. Oxford: Oxford University Press. Available from: \url{https://www.amazon.co.uk/kindle} [Accessed 30 June 2021]. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@book{hodds2016re, - author = {Hodds, J.}, - year = {2016}, - title = {Referencing ebooks}, - titleaddon = {Kindle version 4.18}, - address = {Bath}, - publisher = {University of Bath}} +@book{blockley2021evs, + author = {Blockley, D.}, + year = {2021}, + title = {Engineering: a Very Short Introduction}, + address = {Oxford}, + publisher = {Oxford University Press}, + url = {https://www.amazon.co.uk/kindle}, + urldate = {2021-06-30}} %</driver|bib> %<*driver> \end{Verbatim} @@ -665,10 +689,10 @@ BibTeX, and not a symptom of recalcitrance on the part of the author. \subsubsection*{Book known by its title} -\begin{info}\item +\begin{tips}\item Use the most appropriate \texttt{reference} entry type instead of, say, \texttt{book} or \texttt{collection}. -\end{info} +\end{tips} \begin{bibexbox}<RX>{bnf2020} British National Formulary, 2020. 79th ed. London: Pharmaceutical Press. @@ -687,14 +711,14 @@ Use the most appropriate \texttt{reference} entry type instead of, say, \end{Verbatim} \end{bibexbox} -\begin{bibexbox}<RX>{asprin2020bnf} - British National Formulary, 2020. 79th ed. \emph{Asprin.} London: Pharmaceutical Press. +\begin{bibexbox}<RX>{aspirin2020bnf} + British National Formulary, 2020. 79th ed. \emph{Aspirin}. London: Pharmaceutical Press. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@inreference{asprin2020bnf, - title = {Asprin}, +@inreference{aspirin2020bnf, + title = {Aspirin}, year = {2020}, booktitle = {{British National Formulary}}, edition = {79}, @@ -712,14 +736,14 @@ entry is placed correctly in the reference list. If you use Biber, this is done automatically for you. \end{info} -\begin{bibexbox}<RX>{asprin2019bnf} +\begin{bibexbox}<RX>{aspirin2019bnf} British National Formulary, 2019. \emph{Aspirin} [Online]. London: Pharmaceutical Press. Available from: \url{https://www.medicinescomplete.com/#/content/bnf/_456850132} [Accessed 26 November 2019]. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@inreference{asprin2019bnf, - title = {Asprin}, +@inreference{aspirin2019bnf, + title = {Aspirin}, year = {2019}, booktitle = {{British National Formulary}}, address = {London}, @@ -732,10 +756,10 @@ automatically for you. \end{bibexbox} -\subsubsection*{One chapter\slash paper from a collection (by different authors) in an edited book} +\subsubsection*{Chapter\slash paper from a collection (by different authors) in an edited book} \begin{bibexbox}<RL>{burchard1965hhl} - Burchard, J.E., 1965. How humanists use a library. In:\@ C.F.J. Overhage and J.R. Harman, eds. \emph{Intrex:\@ report on a planning conference and information transfer experiments}. Cambridge, Mass.:\@ MIT Press, pp.41--87. + Burchard, J.E., 1965. How humanists use a library. In: C.F.J. Overhage and J.R. Harman, eds. \emph{Intrex: report on a planning conference and information transfer experiments}. Cambridge, Mass.: MIT Press, pp.41--87. \tcblower \begin{Verbatim} %</driver> @@ -756,7 +780,7 @@ automatically for you. \end{bibexbox} \begin{bibexbox}<RX>{reid1967ptp} - Reid, D.R., 1967. Physical testing of polymer films. In:\@ S.H. Pinner, ed. \emph{Modern packaging films}. London:\@ Butterworths, pp.143--183. + Reid, D.R., 1967. Physical testing of polymer films. In: S.H. Pinner, ed. \emph{Modern packaging films}. London: Butterworths, pp.143--183. \tcblower \begin{Verbatim} %</driver> @@ -819,7 +843,7 @@ automatically for you. \end{bibexbox} \begin{bibexbox}<RX>{newman2010mcb} - Newman, R., 2010. Malaria control beyond 2010. \emph{Brit.\@ Med.\@ J.}, 341(7765), pp.157--208. + Newman, R., 2010. Malaria control beyond 2010. \emph{Brit. Med. J.}, 341(7765), pp.157--208. \tcblower \begin{Verbatim} %</driver> @@ -837,31 +861,70 @@ automatically for you. \end{Verbatim} \end{bibexbox} +\begin{bibexbox}<RX>{wetzstein.etal2020iai} + Wetzstein, G., Ozcan, A., Gigan, S., Fan, S., Englund, D., Soljacic, M., Denz, C., Miller, D.A.B. and Psaltis, D., 2020. Inference in artificial intelligence with deep optics and photonics. \emph{Nature}, 588(7836), pp.39--47. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@article{wetzstein.etal2020iai, + author = {Wetzstein, G. and Ozcan, A. and Gigan, S. and Fan, S. and + Englund, D. and Soljacic, M. and Denz, C. and Miller, D. A. B. and + Psaltis, D.}, + year = {2020}, + title = {Inference in Artificial Intelligence with Deep Optics and Photonics}, + journal = {Nature}, + volume = {588}, + number = {7836}, + pages = {39-47}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + \subsubsection*{Electronic journal article} -\begin{bibexbox}<RX>{williams1997edd} - Williams, F., 1997. Electronic document delivery:\@ a trial in an academic library. \emph{Ariadne} [Online], 10. Available from:\@ \url{http://www.ariadne.ac.uk/issue10/edd/} [Accessed 5 December 1997]. +\begin{bibexbox}<RX>{devlin.etal2021ipp} + Devlin, S.M., Martin, A. and Ostrovnaya, I., 2021. Identifying prognostic pairwise relationships among bacterial species in microbiome studies. \emph{PLOS Computational Biology} [Online], 17(11). Available from: \url{https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1009501} [Accessed 9 December 2021]. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@article{williams1997edd, - author = {Williams, F.}, - year = {1997}, - title = {Electronic Document Delivery}, - subtitle = {A Trial in an Academic Library}, - journal = {Ariadne}, - volume = {10}, - url = {http://www.ariadne.ac.uk/issue10/edd/}, - urldate = {1997-12-05}} +@article{devlin.etal2021ipp, + author = {Devlin, S. M. and Martin, A. and Ostrovnaya, I.}, + year = {2021}, + title = {Identifying Prognostic Pairwise Relationships Among Bacterial + Species in Microbiome Studies}, + journal = {{PLOS Computational Biology}}, + volume = {17}, + number = {11}, + url = {https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1009501}, + urldate = {2021-12-09}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} -\begin{tips} -\item +\begin{bibexbox}<RX>{steward.etal2020eys} + Steward, S., Connelly, D. and Robinson, J., 2020. Everything you should know about the coronavirus outbreak. \emph{The pharmaceutical journal} [Online]. Available from: \url{https://www.pharmaceutical-journal.com/news-and-analysis/features/everything-you-should-know-about-the-coronavirus-outbreak/20207629.article} [Accessed 30 April 2020]. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@article{steward.etal2020eys, + author = {Steward, S. and Connelly, D. and Robinson, J.}, + year = {2020}, + title = {Everything You Should Know About the Coronavirus Outbreak}, + journal = {The Pharmaceutical Journal}, + url = {https://www.pharmaceutical-journal.com/news-and-analysis/features/everything-you-should-know-about-the-coronavirus-outbreak/20207629.article}, + urldate = {2020-04-30}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + +\begin{tips}\item If citing an article yet to be officially published, use the \texttt{pubstate} field with the keyword \texttt{inpress} for `in press' and \texttt{inpreparation} or \texttt{submitted} (whichever is more accurate) @@ -869,7 +932,7 @@ for `preprint'. \end{tips} \begin{bibexbox}<RX>{liontou.etal2019dra} - Liontou, C., Kontopodis, E., Oikonomidis, N., Maniotis, C., Tassopoulos, A., Tsiafoutis, I., Lazaris, E. and Koutouzis, M., 2019. Distal radial access:\@ a review article. \emph{Cardiovascular revascularization medicine} [Online], in press. Available from: \url{https://www.sciencedirect.com/science/article/pii/S1553838919303367} [Accessed 19 June 2019]. + Liontou, C., Kontopodis, E., Oikonomidis, N., Maniotis, C., Tassopoulos, A., Tsiafoutis, I., Lazaris, E. and Koutouzis, M., 2019. Distal radial access: a review article. \emph{Cardiovascular revascularization medicine} [Online], in press. Available from: \url{https://www.sciencedirect.com/science/article/pii/S1553838919303367} [Accessed 19 June 2019]. \tcblower \begin{Verbatim} %</driver> @@ -889,10 +952,10 @@ for `preprint'. \end{bibexbox} -\subsubsection*{Preprint in a digital repository} +\subsubsection*{Preprint or trial study in a digital repository} \begin{bibexbox}<RX>{shah.corrick2016hsc} - Shah, I. and Corrick, I., 2016. \emph{How should central banks respond to non-neutral inflation expectations?} Bath:\@ University of Bath. \emph{OPUS} [Online]. Available from:\@ \url{http://opus.bath.ac.uk} [Accessed 4 May 2016]. + Shah, I. and Corrick, I., 2016. \emph{How should central banks respond to non-neutral inflation expectations?} Bath: University of Bath. \emph{OPUS} [Online]. Available from: \url{http://opus.bath.ac.uk} [Accessed 4 May 2016]. \tcblower \begin{Verbatim} %</driver> @@ -911,8 +974,31 @@ for `preprint'. \end{Verbatim} \end{bibexbox} -\begin{tips} -\item +\begin{bibexbox}<RX>{ganju2021sed} + Ganju, V., 2021. \emph{A study of EnGeneIC Dream Vectors (EDV's) packaged with the chemotherapy, E-EDV-D682 given simultaneously as non-targeted EDVs carrying an immune enhancer called EDV-GC, in participants with advanced pancreatic and other cancers whose disease has progressed after one or two treatment regimes, or where other standard therapies are not appropriate}. Sydney: University of Sydney. \emph{Australian and New Zealand Clinical Trials Registry} [Online]. Available from: \url{http://www.anzctr.org.au/Trial/Registration/TrialReview.aspx?id=365258} [Accessed 29 April 2021]. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@report{ganju2021sed, + author = {Ganju, V.}, + year = {2021}, + title = {A study of {EnGeneIC} {Dream} {Vectors} {(EDV's)} packaged with the chemotherapy, + {E-EDV-D682} given simultaneously as non-targeted {EDVs} carrying an immune enhancer + called {EDV-GC}, in participants with advanced pancreatic and other cancers whose disease + has progressed after one or two treatment regimes, or where other standard therapies are + not appropriate}, + address = {Sydney}, + institution = {University of Sydney}, + library = {Australian and New Zealand Clinical Trials Registry}, + url = {http://www.anzctr.org.au/Trial/Registration/TrialReview.aspx?id=365258}, + urldate = {2021-04-29}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + +\begin{tips}\item The Harvard (Bath) style treats preprints as grey literature, and so the \texttt{report} entry type is the best match semantically. Use \texttt{library} to specify the name of the preprint repository. @@ -959,13 +1045,31 @@ for the work and provide preprint details using the \texttt{eprinttype}, \end{Verbatim} \end{bibexbox} +\begin{bibexbox}<RX>{cogley2020ccs} + Cogley, M., 2020. Corporate confidence slumps to record low. \emph{The Telegraph} [Online], 4 May. Available from: \url{https://www.telegraph.co.uk/business/2020/05/03/corporate-confidence-slumps-all-time-low/} [Accessed 5 May 2020]. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@article{cogley2020ccs, + author = {Cogley, M.}, + date = {2020-05-04}, + title = {Corporate Confidence Slumps to Record Low}, + journal = {{The Telegraph}}, + url = {https://www.telegraph.co.uk/business/2020/05/03/corporate-confidence-slumps-all-time-low/}, + urldate = {2020-05-05}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + \subsection{Conference papers} \subsubsection*{Conference paper (when proceedings have a named editor)} \begin{bibexbox}<RX>{crawford1965oim} - Crawford, G.I., 1965. Oxygen in metals. In:\@ J.M.A. Lenihan and S.J. Thompson, eds. \emph{Activation analysis:\@ proceedings of a NATO Advanced Study Institute}, 2--4 August 1964, Glasgow. London:\@ Academic Press, pp.113--118. + Crawford, G.I., 1965. Oxygen in metals. In: J.M.A. Lenihan and S.J. Thompson, eds. \emph{Activation analysis: proceedings of a NATO Advanced Study Institute}, 2--4 August 1964, Glasgow. London: Academic Press, pp.113--118. \tcblower \begin{Verbatim} %</driver> @@ -991,7 +1095,7 @@ for the work and provide preprint details using the \texttt{eprinttype}, \subsubsection*{Conference paper (when proceedings have no named editor or are part of a major series)} \begin{bibexbox}<RX>{soper1972rbc} - Soper, D., 1972. Review of bracken control experiments with asulam. \emph{Proceedings of the 11th British Weed Control Conference}, 15--17 November 1972, Brighton. Brighton:\@ University of Sussex, pp.24--31. + Soper, D., 1972. Review of bracken control experiments with asulam. \emph{Proceedings of the 11th British Weed Control Conference}, 15--17 November 1972, Brighton. Brighton: University of Sussex, pp.24--31. \tcblower \begin{Verbatim} %</driver> @@ -1034,10 +1138,10 @@ for the work and provide preprint details using the \texttt{eprinttype}, \end{bibexbox} -\subsubsection*{Report} +\subsubsection*{Report, working paper, or research briefing} \begin{bibexbox}<RX>{unesco1993gip} - UNESCO, 1993. \emph{General information programme and UNISIST}\@. (PGI-93/WS/22). Paris:\@ UNESCO. + UNESCO, 1993. \emph{General information programme and UNISIST}. (PGI-93/WS/22). Paris: UNESCO. \tcblower \begin{Verbatim} %</driver> @@ -1055,7 +1159,7 @@ for the work and provide preprint details using the \texttt{eprinttype}, \end{bibexbox} \begin{bibexbox}<RX>{bre2007dqb} - BRE, 2007. \emph{Designing quality buildings:\@ a BRE guide}. (Report 497). Bracknell:\@ BRE. + BRE, 2007. \emph{Designing quality buildings: a BRE guide}. (Report 497). Bracknell: BRE. \tcblower \begin{Verbatim} %</driver> @@ -1073,12 +1177,36 @@ for the work and provide preprint details using the \texttt{eprinttype}, \end{Verbatim} \end{bibexbox} +\begin{bibexbox}<RX>{deneulin.dinerstein2010hms} + Deneulin, S. and Dinerstein, A.C., 2010. \emph{Hope movements: social movements in the pursuit of human development}. (Bath papers in international development and wellbeing, no.~8). Bath: University of Bath. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@report{deneulin.dinerstein2010hms, + author = {Deneulin, S. and Dinerstein, A. C.}, + year = {2010}, + title = {Hope Movements: Social Movements in the Pursuit of Human Development}, + address = {Bath}, + institution = {University of Bath}, + series = {Bath Papers in International Development and Wellbeing}, + number = {no.~8}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + +\begin{info}\item +The style inserts a comma between the \texttt{series} and \texttt{number} +fields, but does not insert one between \texttt{type} and \texttt{number}. +\end{info} + \subsubsection*{Standard} \begin{bibexbox}<RX>{bs5605:1990} BSI, 1990. \emph{BS 5605:1990 Recommendations for citing and referencing - published material.} London: BSI. + published material}. London: BSI. \tcblower \begin{Verbatim} %</driver> @@ -1096,7 +1224,7 @@ for the work and provide preprint details using the \texttt{eprinttype}, \begin{bibexbox}<RX>{astm.d1655} ASTM, 2019. \emph{ASTM D1655 - 19 Standard specification for aviation - turbine fuels.} West Conshohocken, Pa.: ASTM. + turbine fuels}. West Conshohocken, Pa.: ASTM. \tcblower \begin{Verbatim} %</driver> @@ -1141,7 +1269,7 @@ patent requests\slash applications. \subsubsection*{Unpublished written material and personal communications} \begin{bibexbox}<RX>{harris2013fgr} - Harris, G., 2013. \emph{Focus group recommendations:\@ internal task group + Harris, G., 2013. \emph{Focus group recommendations: internal task group report}. Unpublished. \tcblower \begin{Verbatim} @@ -1157,7 +1285,7 @@ patent requests\slash applications. \end{bibexbox} \begin{bibexbox}<RX>{hadley2015bir} - Hadley, S., 2015. \emph{Biomechanics:\@ introductory reading, BM289:\@ sport + Hadley, S., 2015. \emph{Biomechanics: introductory reading, BM289: sport biomechanics}. University of Bath. Unpublished. \tcblower \begin{Verbatim} @@ -1175,7 +1303,7 @@ patent requests\slash applications. \begin{bibexbox}<RX>{thomas2015wcr} Thomas, D., 2015. Word count and referencing style. \emph{Frequently - asked questions discussion board:\@ PHYS 2011:\@ housing studies.} + asked questions discussion board: PHYS 2011: housing studies}. University of Bath. Unpublished. \tcblower \begin{Verbatim} @@ -1198,7 +1326,7 @@ patent requests\slash applications. \subsubsection*{Image} \begin{bibexbox}<RI>{nasa2015nat} - NASA, 2015, \emph{NASA astronaut Tim Kopra on Dec.\@ 21 spacewalk} [Online]. Washington:\@ NASA. Available from:\@ \url{http://www.nasa.gov/image-feature/nasa-astronaut-tim-kopra-on-dec-21-spacewalk} [Accessed 7 January 2015]. + NASA, 2015. \emph{NASA astronaut Tim Kopra on Dec. 21 spacewalk} [Online]. Washington: NASA. Available from: \url{http://www.nasa.gov/image-feature/nasa-astronaut-tim-kopra-on-dec-21-spacewalk} [Accessed 7 January 2015]. \tcblower \begin{Verbatim} %</driver> @@ -1222,7 +1350,7 @@ record the source of the image. \end{tips} \begin{bibexbox}<RI>{iliff2006rcb} - Iliff, D., 2006. \emph{Royal Crescent in Bath, England - July 2006} [Online]. San Francisco:\@ Wikimedia Foundation. Available from:\@ \url{https://commons.wikimedia.org/wiki/File:Royal_Crescent_in_Bath,_England_-_July_2006.jpg} [Accessed 7 January 2016]. + Iliff, D., 2006. \emph{Royal Crescent in Bath, England - July 2006} [Online]. San Francisco: Wikimedia Foundation. Available from: \url{https://commons.wikimedia.org/wiki/File:Royal_Crescent_in_Bath,_England_-_July_2006.jpg} [Accessed 7 January 2016]. \tcblower \begin{Verbatim} %</driver> @@ -1234,14 +1362,14 @@ record the source of the image. address = {San Francisco}, organization = {Wikimedia Foundation}, url = {https://commons.wikimedia.org/wiki/File:Royal_Crescent_in_Bath,_England_-_July_2006.jpg}, - urldate = {2015-01-07}} + urldate = {2016-01-07}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} \begin{bibexbox}<RI>{anon1946peb} - Anon., 1946. \emph{Prototype electric bicycle displayed at the \enquote{Britain Can Make It} exhibition organised by the Council of Industrial Design and held at the Victoria and Albert Museum, London, 1946. Designed by B.~G. Bowden} [Photograph]. At:\@ London. Design Council Slide Collection. + Anon., 1946. \emph{Prototype electric bicycle displayed at the \enquote{Britain Can Make It} exhibition organised by the Council of Industrial Design and held at the Victoria and Albert Museum, London, 1946. Designed by B.~G. Bowden} [Photograph]. At: London. Design Council Slide Collection. \tcblower \begin{Verbatim} %</driver> @@ -1273,7 +1401,7 @@ but the \texttt{organization} field if the location relates to the archive. \subsubsection*{Map} \begin{bibexbox}<RX>{andrews.dury1773wilts} - Andrews, J. and Dury, A., 1773. \emph{Map of Wiltshire}, 1 inch to 2 miles. Devizes:\@ Wiltshire Record Society. + Andrews, J. and Dury, A., 1773. \emph{Map of Wiltshire}, 1 inch to 2 miles. Devizes: Wiltshire Record Society. \tcblower \begin{Verbatim} %</driver> @@ -1304,7 +1432,7 @@ The \texttt{book} entry type would also work for this reference. author = {{Ordnance Survey}}, year = {2020}, title = {Street view map of {University of Bath}}, - series = {1:5000, OS VectorMap® Local}, + series = {1:5000, {OS VectorMap® Local}}, url = {https://digimap.edina.ac.uk/roam/map/os}, urldate = {2020-04-30}} %</driver|bib> @@ -1322,7 +1450,7 @@ The \texttt{book} entry type would also work for this reference. author = {{Google}}, year = {2020}, title = {{Harbourside, Bristol}}, - series = {Google Maps}, + series = {{Google Maps}}, url = {https://www.google.co.uk/maps/place/Harbourside,+Bristol/}, urldate = {2020-04-30}} %</driver|bib> @@ -1334,7 +1462,7 @@ The \texttt{book} entry type would also work for this reference. \subsubsection*{Film, video or DVD} \begin{bibexbox}<RX>{macbeth1948} - \emph{Macbeth}, 1948. Film.\@ Directed by Orson Welles. USA:\@ Republic Pictures. + \emph{Macbeth}, 1948. Film. Directed by Orson Welles. USA: Republic Pictures. \tcblower \begin{Verbatim} %</driver> @@ -1369,45 +1497,48 @@ In the above entry, the following would also work instead of using \texttt{note} You can also use \texttt{movie} as an alias for \texttt{video}. \end{info} - -\subsubsection*{Streamed video (YouTube, TED Talks, etc.)} - -\begin{bibexbox}<RX>{moran2016sol} - Moran, C., 2016. \emph{Save our libraries} [Online]. Available from:\@ \url{https://www.youtube.com/watch?v=gKTfCz4JtVE&feature=youtu.be} [Accessed 29 April 2016]. +\begin{bibexbox}<RX>{elephant-man1980} + \emph{The elephant man} [Online], 1980. Film. Directed by David Lynch. USA: Brooksfilms. Available from: BBC iPlayer [Accessed 4 May 2021]. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@video{moran2016sol, - author = {Moran, C.}, - year = {2016}, - title = {Save Our Libraries}, - url = {https://www.youtube.com/watch?v=gKTfCz4JtVE&feature=youtu.be}, - urldate = {2016-04-29}} +@video{elephant-man1980, + year = {1980}, + title = {The elephant man}, + type = {Film}, + note = {Directed by David Lynch}, + address = {USA}, + publisher = {Brooksfilms}, + library = {BBC iPlayer}, + urldate = {2021-05-04}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} -\begin{bibexbox}<RI>{uob2015wie} - University of Bath, 2015. \emph{What is engineering?} [Online]. Available from:\@ \url{https://www.youtube.com/watch?v=NoyZarq-Zbo} [Accessed 12 January 2016]. + +\subsubsection*{Online video\slash audio} + +\begin{bibexbox}<RX>{moran2016sol} + Moran, C., 2016. \emph{Save our libraries} [Online]. Available from: \url{https://www.youtube.com/watch?v=gKTfCz4JtVE&feature=youtu.be} [Accessed 29 April 2016]. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@video{uob2015wie, - author = {{University of Bath}}, - year = {2015}, - title = {What is Engineering?}, - url = {https://www.youtube.com/watch?v=NoyZarq-Zbo}, - urldate = {2016-01-12}} +@video{moran2016sol, + author = {Moran, C.}, + year = {2016}, + title = {Save Our Libraries}, + url = {https://www.youtube.com/watch?v=gKTfCz4JtVE&feature=youtu.be}, + urldate = {2016-04-29}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} -\begin{bibexbox}<RI>{chakrabarti2016hac} - Chakrabarti, V., 2016. \emph{How architecture and city planning can combat social inequality} [Online]. Available from:\@ \url{https://www.curbed.com/2016/5/5/11593058/vishaan-chakrabarti-pau-curbed-appeal-podcast} [Accessed 28 March 2019]. +\begin{bibexbox}<RX>{chakrabarti2016hac} + Chakrabarti, V., 2016. \emph{How architecture and city planning can combat social inequality} [Online]. Available from: \url{https://www.curbed.com/2016/5/5/11593058/vishaan-chakrabarti-pau-curbed-appeal-podcast} [Accessed 28 March 2019]. \tcblower \begin{Verbatim} %</driver> @@ -1426,8 +1557,33 @@ You can also use \texttt{movie} as an alias for \texttt{video}. \subsubsection*{Television or radio broadcast} +\begin{tips}\item +Use \texttt{type} for the medium and \texttt{publisher} for the channel. +\item +If the episode has an individual title, use \texttt{series} for the series and \texttt{number} for the episode number. +Otherwise, give both series and episode number as the \texttt{title}. +\end{tips} + +\begin{bibexbox}<RX>{inn2021huw} + Hurry up and wait, 2021. \emph{Inside no.9}, \emph{Episode 6:4}. TV. BBC2, 31 May. 21.30 hrs. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@video{inn2021huw, + date = {2021-05-31T21:30:00}, + title = {Hurry up and wait}, + series = {Inside No.9}, + number = {{Episode} 6:4}, + type = {TV}, + publisher = {BBC2}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + \begin{bibexbox}<RX>{rsfo2006ep5} - \emph{Rick Stein's French odyssey:\@ Episode 5}, 2006. TV. BBC2, 23 August. 20.30 hrs. + Rick Stein's French odyssey: Episode 5, 2006. TV. BBC2, 23 August. 20.30 hrs. \tcblower \begin{Verbatim} %</driver> @@ -1443,12 +1599,8 @@ You can also use \texttt{movie} as an alias for \texttt{video}. \end{Verbatim} \end{bibexbox} -\begin{tips}\item -Use \texttt{type} for the medium and \texttt{publisher} for the channel. -\end{tips} - \begin{bibexbox}<RX>{archers20060823} - \emph{The Archers}, 2006. Radio. BBC Radio 4, 23 August. 19.02 hrs. + The Archers, 2006. Radio. BBC Radio 4, 23 August. 19.02 hrs. \tcblower \begin{Verbatim} %</driver> @@ -1467,11 +1619,30 @@ Use \texttt{type} for the medium and \texttt{publisher} for the channel. You can also use \texttt{music} as an alias for \texttt{audio}. \end{info} +\begin{bibexbox}<RX>{tkmmm2020ts} + The secret, 2020. \emph{Tiger king: murder, mayhem and madness}, \emph{Episode 3} [Online]. TV. Available from: Netflix [Accessed 4 May 2021]. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@video{tkmmm2020ts, + year = {2020}, + title = {The Secret}, + series = {Tiger King: Murder, Mayhem and Madness}, + number = {{Episode} 3}, + type = {TV}, + library = {Netflix}, + urldate = {2021-05-04}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + \subsubsection*{Music score} \begin{bibexbox}<RX>{beethoven1950symph1} - Beethoven, L. van, 1950. \emph{Symphony no.1 in C, Op.21}. Harmondsworth:\@ Penguin. + Beethoven, L. van, 1950. \emph{Symphony no.1 in C, Op.21}. Harmondsworth: Penguin. \tcblower \begin{Verbatim} %</driver> @@ -1490,32 +1661,105 @@ You can also use \texttt{music} as an alias for \texttt{audio}. \subsection{Digital media} -\subsubsection*{Website\slash webpage} +\subsubsection*{Website or webpage} + +\begin{bibexbox}<RX>{who2018ttc} + World Health Organization, 2018. \emph{The top 10 causes of death} [Online]. Geneva: World Health Organization. Available from: \url{https://www.who.int/news-room/fact-sheets/detail/the-top-10-causes-of-death} [Accessed 29 June 2020]. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@online{who2018ttc, + author = {{World Health Organization}}, + year = {2018}, + title = {The Top 10 Causes of Death}, + address = {Geneva}, + organization = {World Health Organization}, + url = {https://www.who.int/news-room/fact-sheets/detail/the-top-10-causes-of-death}, + urldate = {2020-06-29}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + +\begin{bibexbox}<RX>{manco2013va} + Manco, J., 2013. \emph{Vernacular architecture} [Online]. Available from: \url{https://www.buildinghistory.org/style/vernacular.shtml} [Accessed 20 February 2020]. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@online{manco2013va, + author = {Manco, J.}, + year = {2013}, + title = {Vernacular Architecture}, + url = {https://www.buildinghistory.org/style/vernacular.shtml}, + urldate = {2020-02-20}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + -\begin{bibexbox}<RX>{holland2002gci} - Holland, M., 2002. \emph{Guide to citing internet sources} [Online]. Poole:\@ Bournemouth University. Available from:\@ \url{http://www.bournemouth.ac.uk/library/using/guide_to_citing_internet_sourc.html} [Accessed 4 November 2002]. +\subsubsection*{Social media} + +\begin{bibexbox}<RX>{gaiman2021fbp} + Gaiman, N., 2021. \emph{Facebook post} [Online], 21 April. Available from: \url{https://www.facebook.com/neilgaiman/posts/305187897642814} [Accessed 13 May 2021]. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@online{holland2002gci, - author = {Holland, M.}, - year = {2002}, - title = {Guide to Citing Internet Sources}, - address = {Poole}, - organization = {Bournemouth University}, - url = {http://www.bournemouth.ac.uk/library/using/guide_to_citing_internet_sourc.html}, - urldate = {2002-11-04}} +@online{gaiman2021fbp, + author = {Gaiman, N.}, + date = {2021-04-21}, + title = {Facebook post}, + url = {https://www.facebook.com/neilgaiman/posts/305187897642814}, + urldate = {2021-05-13}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} +\begin{bibexbox}<RX>{ublib2021tp} + Library at University of Bath [@bathunilibrary], 2021. \emph{Twitter post} [Online], 10 May. Available from: \url{https://twitter.com/BathUniLibrary/status/1391774402618998795?s=20} [Accessed 12 May 2021]. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@online{ublib2021tp, + author = {{Library at University of Bath}}, + nameaddon = {@bathunilibrary}, + date = {2021-05-10}, + title = {Twitter post}, + url = {https://twitter.com/BathUniLibrary/status/1391774402618998795?s=20}, + urldate = {2021-05-12}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} + +\begin{bibexbox}<RX>{ublib2021ip} + University of Bath Library [@unibathlib], 2021. \emph{Instagram post} [Online], 15 March. Available from: \url{https://www.instagram.com/p/CMb5GHjFv9A/?utm_source=ig_web_copy_link} [Accessed 7 May 2021]. + \tcblower +\begin{Verbatim} +%</driver> +%<*driver|bib> +@online{ublib2021ip, + author = {{University of Bath Library}}, + nameaddon = {@unibathlib}, + date = {2021-03-15}, + title = {Instagram post}, + url = {https://www.instagram.com/p/CMb5GHjFv9A/?utm_source=ig_web_copy_link}, + urldate = {2021-05-07}} +%</driver|bib> +%<*driver> +\end{Verbatim} +\end{bibexbox} -\subsubsection*{Email discussion lists (jiscmail\slash listserv etc.)} + +\subsubsection*{Email discussion list} \begin{bibexbox}<RX>{clark2004euk} - Clark, T., 5 July 2004. A European UK Libraries Plus? \emph{Lis-link} [Online]. Available from:\@ \url{lis-link@jiscmail.ac.uk} [Accessed 30 July 2004]. + Clark, T., 5 July 2004. A European UK Libraries Plus? \emph{Lis-link} [Online]. Available from: \url{lis-link@jiscmail.ac.uk} [Accessed 30 July 2004]. \tcblower \begin{Verbatim} %</driver> @@ -1541,7 +1785,7 @@ Use the \texttt{journal} field to specify the mailing list. If you omit the \subsubsection*{Database} \begin{bibexbox}<RX>{bvd2008bt} - Bureau van Dijk, 2008. \emph{BT Group plc company report}. \emph{FAME} [Online]. London:\@ Bureau van Dijk. Available from:\@ \url{http://www.portal.euromonitor.com} [Accessed 6 November 2014]. + Bureau van Dijk, 2008. \emph{BT Group plc company report}. \emph{FAME} [Online]. London: Bureau van Dijk. Available from: \url{http://www.portal.euromonitor.com} [Accessed 6 November 2014]. \tcblower \begin{Verbatim} %</driver> @@ -1569,7 +1813,7 @@ and the \texttt{library} field for the name of the database itself. \subsubsection*{Dataset} \begin{bibexbox}<RX>{wilson2013rgc} - Wilson, D., 2013. \emph{Real geometry and connectedness via triangular description:\@ CAD example bank} [Online]. Bath:\@ University of Bath. Available from:\@ \url{https://doi.org/10.15125/BATH-00069} [Accessed 20 April 2016]. + Wilson, D., 2013. \emph{Real geometry and connectedness via triangular description: CAD example bank} [Online]. Bath: University of Bath. Available from: \url{https://doi.org/10.15125/BATH-00069} [Accessed 20 April 2016]. \tcblower \begin{Verbatim} %</driver> @@ -1592,7 +1836,7 @@ and the \texttt{library} field for the name of the database itself. \subsubsection*{Computer program} \begin{bibexbox}<RX>{screencasto} - @screencasto, n.d. \emph{Screencast-O-Matic} (v.2) [computer program]. Available from:\@ \url{https://screencast-o-matic.com/} [Accessed 16 May 2016]. + @screencasto, n.d. \emph{Screencast-O-Matic} (v.2) [computer program]. Available from: \url{https://screencast-o-matic.com/} [Accessed 16 May 2016]. \tcblower \begin{Verbatim} %</driver> @@ -1615,7 +1859,7 @@ and the \texttt{library} field for the name of the database itself. \subsubsection*{Work in translation} \begin{bibexbox}<RX>{aristotle2007ne} - Aristotle, 2007. \emph{Nicomachean ethics} (W.D. Ross, Trans.). South Dakota:\@ NuVisions. + Aristotle, 2007. \emph{Nicomachean ethics} (W.D. Ross, Trans.). South Dakota: NuVisions. \tcblower \begin{Verbatim} %</driver> @@ -1636,7 +1880,7 @@ and the \texttt{library} field for the name of the database itself. \subsubsection*{Work in the Roman alphabet} \begin{bibexbox}<RX>{esquivel2003cap} - Esquivel, L., 2003. \emph{Como agua para chocolate} [Like water for chocolate]. Barcelona:\@ Debolsillo. + Esquivel, L., 2003. \emph{Como agua para chocolate} [Like water for chocolate]. Barcelona: Debolsillo. \tcblower \begin{Verbatim} %</driver> @@ -1680,7 +1924,7 @@ Use the \texttt{titleaddon} field to supply the English translation of the title \subsubsection*{Work in a non-Roman alphabet} \begin{bibexbox}<RX>{hua1999qys1} - Hua, L. 華林甫, 1999. Qingdai yilai Sanxia diqu shuihan zaihai de chubu yanjiu 清代以來三峽地區水旱災害的初步硏 [A preliminary study of floods and droughts in the Three Gorges region since the Qing dynasty]. \emph{Zhongguo shehui kexue} 中國社會科學, 1, pp.168--79. + Hua, L. 華林甫, 1999. Qingdai yilai Sanxia diqu shuihan zaihai de chubu yanjiu 清代以來三峽地區水旱災害的初步硏 [A preliminary study of floods and droughts in the Three Gorges region since the Qing dynasty]. \emph{Zhongguo shehui kexue \textup{中國社會科學}}, 1, pp.168--79. \tcblower \begin{Verbatim} %</driver> @@ -1769,66 +2013,97 @@ faithful to the original orthography), you can specify this using \end{bibexbox} -\subsection{Legal references: UK legislation and parliamentary reports} +\subsection{Legal or government document: UK parliamentary reports\slash legislation} -% UK Primary Legislation +% Parliamentary reports -\subsubsection*{Act of Parliament (UK Statutes) before 1963} +\subsubsection*{House of Commons paper} -\begin{bibexbox}<RX>{gb.wa1735} - \emph{Witchcraft Act 1735} (9 Geo.2, c.5). +\begin{tips}\item +Use this form for reports of House of Commons select committees. +\end{tips} + +\begin{bibexbox}<RX>{gb.hc2003/04-30} + Great Britain. Parliament. House of Commons, 2004. \emph{National Savings investment deposits: account 2002--2003}. (HC 2003/04, 30). London: National Audit Office. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@legislation{gb.wa1735, - title = {Witchcraft {Act}}, - year = {1735}, - series = {9 Geo.2}, - chapter = {5}} +@report{gb.hc2003/04-30, + author = {{Great Britain. Parliament. House of Commons}}, + year = {2004}, + title = {National {Savings} Investment Deposits}, + subtitle = {Account 2002--2003}, + address = {London}, + publisher = {National Audit Office}, + series = {{HC} 2003/04}, + number = {30}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} -\begin{info}\item -You could instead combine the series and chapter in the \texttt{number} field: -\begin{tcolorbox}% - [ colframe = Slate - , colback = white - , fontupper = \footnotesize - ] +\subsubsection*{House of Lords paper} + +\begin{tips}\item +Use this form for reports of House of Lords select committees. +\end{tips} + +\begin{bibexbox}<RX>{gb.hl1986/87-66} + Great Britain. Parliament. House of Lords, 1987. \emph{Social fund (maternity and funeral expenses) bill}. (HL 1986/87, (66)). London: HMSO. + \tcblower \begin{Verbatim} - number = {9 Geo.2, c.5} +%</driver> +%<*driver|bib> +@report{gb.hl1986/87-66, + author = {{Great Britain. Parliament. House of Lords}}, + year = {1987}, + title = {Social Fund (Maternity and Funeral Expenses) Bill}, + address = {London}, + publisher = {HMSO}, + series = {{HL} 1986/87}, + number = {66}} +%</driver|bib> +%<*driver> \end{Verbatim} -\end{tcolorbox} -\end{info} +\end{bibexbox} -\subsubsection*{Act of Parliament (UK Statutes) 1963 onwards} +\begin{hacks}\item +For joint committees, you will have to hack this slightly, putting the session +years in \texttt{series} and the HL and HC numbers in \texttt{number}. +\end{hacks} -\begin{bibexbox}<RX>{gb.pa2014} - \emph{Pensions Act 2014}, c.19. London:\@ TSO. + +\subsubsection*{Command paper} + +\begin{bibexbox}<RX>{gb.cm6041} + Great Britain. Ministry of Defence, 2004. \emph{Delivering security in a changing world: defence white paper}. (Cm. 6041). London: TSO. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@legislation{gb.pa2014, - title = {Pensions {Act}}, - year = {2014}, - chapter = {19}, +@report{gb.cm6041, + author = {{Great Britain. Ministry of Defence}}, + year = {2004}, + title = {Delivering Security in a Changing World}, + subtitle = {Defence White Paper}, address = {London}, - publisher = {TSO}} + publisher = {TSO}, + series = {Cm}, + number = {6041}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} -\subsubsection*{House of Commons/House of Lords bill} +% UK Primary Legislation + +\subsubsection*{House of Commons\slash House of Lords bill} \begin{bibexbox}<RX>{gb.bill1987/88-66} - Great Britain.\@ Parliament.\@ House of Commons, 1988. \emph{Local government finance bill}. (Bills | 1987/88, 66). London:\@ HMSO. + Great Britain. Parliament. House of Commons, 1988. \emph{Local government finance bill}. (Bills | 1987/88, 66). London: HMSO. \tcblower \begin{Verbatim} %</driver> @@ -1847,119 +2122,112 @@ You could instead combine the series and chapter in the \texttt{number} field: \end{bibexbox} -% UK secondary legislation - -\subsubsection*{Statutory instrument} +\subsubsection*{Act of Parliament (UK Statutes) before 1963} -\begin{bibexbox}<RX>{gb.hmr2012} - \emph{The Human Medicines Regulations 2012} [Online], No.1916, United Kingdom:\@ HMSO. Available from:\@ \url{http://www.legislation.gov.uk/uksi/2012/1916/pdfs/uksi_20121916_en.pdf} [Accessed 17 April 2016]. +\begin{bibexbox}<RX>{gb.wa1735} + \emph{Witchcraft Act} \emph{1735} (9 Geo.2, c.5). \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@legislation{gb.hmr2012, - entrysubtype = {secondary}, - title = {The {Human} {Medicines} {Regulations}}, - year = {2012}, - number = {No.1916}, - address = {United Kingdom}, - publisher = {HMSO}, - url = {http://www.legislation.gov.uk/uksi/2012/1916/pdfs/uksi_20121916_en.pdf}, - urldate = {2016-04-17}} +@legislation{gb.wa1735, + title = {Witchcraft {Act}}, + year = {1735}, + series = {9 Geo.2}, + chapter = {5}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} -\begin{tips}\item -Use the \texttt{entrysubtype} `secondary' to put the number in the right place. -\end{tips} +\begin{info}\item +You could instead combine the series and chapter in the \texttt{number} field: -% Parliamentary reports +\begin{tcolorbox}% + [ colframe = Slate + , colback = white + , fontupper = \footnotesize + ] +\begin{Verbatim} + number = {9 Geo.2, c.5} +\end{Verbatim} +\end{tcolorbox} +\end{info} -\subsubsection*{House of Commons paper} -\begin{tips}\item -Use this form for reports of House of Commons select committees. -\end{tips} +\subsubsection*{Act of Parliament (UK Statutes) 1963 onwards} -\begin{bibexbox}<RX>{gb.hc2003/04-30} - Great Britain.\@ Parliament.\@ House of Commons, 2004. \emph{National Savings investment deposits:\@ account 2002--2003}. (HC 2003/04, 30). London:\@ National Audit Office. +\begin{bibexbox}<RX>{gb.pa2014} + \emph{Pensions Act} \emph{2014}, c.19. London: TSO. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@report{gb.hc2003/04-30, - author = {{Great Britain. Parliament. House of Commons}}, - year = {2004}, - title = {National {Savings} Investment Deposits}, - subtitle = {Account 2002--2003}, +@legislation{gb.pa2014, + title = {Pensions {Act}}, + year = {2014}, + chapter = {19}, address = {London}, - publisher = {National Audit Office}, - series = {HC 2003/04}, - number = {30}} + publisher = {TSO}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} -\subsubsection*{House of Lords paper} +% UK secondary legislation -\begin{tips}\item -Use this form for reports of House of Lords select committees. -\end{tips} +\subsubsection*{Statutory instrument} -\begin{bibexbox}<RX>{gb.hl1986/87-66} - Great Britain.\@ Parliament.\@ House of Lords, 1987. \emph{Social fund (maternity and funeral expenses) bill}. (HL 1986/87, (66)). London:\@ HMSO. +\begin{bibexbox}<RX>{gb.hmr2012} + \emph{The Human Medicines Regulations} \emph{2012} [Online], No.1916, United Kingdom: HMSO. Available from: \url{http://www.legislation.gov.uk/uksi/2012/1916/pdfs/uksi_20121916_en.pdf} [Accessed 17 April 2016]. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@report{gb.hl1986/87-66, - author = {{Great Britain. Parliament. House of Lords}}, - year = {1987}, - title = {Social Fund (Maternity and Funeral Expenses) Bill}, - address = {London}, +@legislation{gb.hmr2012, + entrysubtype = {secondary}, + title = {The {Human} {Medicines} {Regulations}}, + year = {2012}, + number = {No.1916}, + address = {United Kingdom}, publisher = {HMSO}, - series = {HL 1986/87}, - number = {66}} + url = {http://www.legislation.gov.uk/uksi/2012/1916/pdfs/uksi_20121916_en.pdf}, + urldate = {2016-04-17}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} -\begin{hacks}\item -For joint committees, you will have to hack this slightly, putting the session -years in \texttt{series} and the HL and HC numbers in \texttt{number}. -\end{hacks} +\begin{tips}\item +Use the \texttt{entrysubtype} `secondary' to put the number in the right place. +\end{tips} -\subsubsection*{Command paper} +\subsection{Legal or government document: EU reports\slash legislation} -\begin{bibexbox}<RX>{gb.cm6041} - Great Britain.\@ Ministry of Defence, 2004. \emph{Delivering security in a changing world:\@ defence white paper}. (Cm.\@ 6041). London:\@ TSO. +% European reports + +\subsubsection*{EU publication} + +\begin{bibexbox}<RX>{ec2015gra} + European Commission, 2015. \emph{General report on the activities of the European Union 2014}. Luxembourg: Publications Office of the European Union. \tcblower \begin{Verbatim} %</driver> %<*driver|bib> -@report{gb.cm6041, - author = {{Great Britain. Ministry of Defence}}, - year = {2004}, - title = {Delivering Security in a Changing World}, - subtitle = {Defence White Paper}, - address = {London}, - publisher = {TSO}, - series = {Cm}, - number = {6041}} +@report{ec2015gra, + author = {{European Commission}}, + year = {2015}, + title = {General Report on the Activities of the {European} {Union} 2014}, + address = {Luxembourg}, + publisher = {Publications Office of the European Union}} %</driver|bib> %<*driver> \end{Verbatim} \end{bibexbox} -\subsection{Legal references: EU legislation and reports} - % European legislation \subsubsection*{EU regulation or directive, decision, recommendation or opinion} @@ -1989,29 +2257,7 @@ The \texttt{shorttitle} will be used in citations instead of the full title. \end{info} -% European reports - -\subsubsection*{EU publication} - -\begin{bibexbox}<RX>{ec2015gra} - European Commission, 2015. \emph{General report on the activities of the European Union 2014}. Luxembourg:\@ Publications Office of the European Union. - \tcblower -\begin{Verbatim} -%</driver> -%<*driver|bib> -@report{ec2015gra, - author = {{European Commission}}, - year = {2015}, - title = {General Report on the Activities of the {European} {Union} 2014}, - address = {Luxembourg}, - publisher = {Publications Office of the European Union}} -%</driver|bib> -%<*driver> -\end{Verbatim} -\end{bibexbox} - - -\subsection{Legal references: case reports} +\subsection{Legal or government document: case reports} \subsubsection*{Legal case study} @@ -2045,9 +2291,9 @@ By default, the style assumes the year is essential if and only if a volume numb , colback = white , fontupper = \footnotesize ] - \begin{Verbatim} +\begin{Verbatim} options = {year-essential=true}, - \end{Verbatim} +\end{Verbatim} \end{tcolorbox} To use Scottish style for a case, you can either use the \key{scottish-style} option or @@ -2058,10 +2304,10 @@ the keyword \texttt{sc}: , colback = white , fontupper = \footnotesize ] - \begin{Verbatim} +\begin{Verbatim} options = {scottish-style}, keywords = {sc}, - \end{Verbatim} +\end{Verbatim} \end{tcolorbox} \end{tips} @@ -2069,7 +2315,7 @@ the keyword \texttt{sc}: This should cover most cases, but legal references tend to enforce their own conventions no matter what the rest of the reference list is doing, and it is out of scope for this style to cater for every variation. -Therefore if you need a different format (e.g.\@ for an American case), +Therefore if you need a different format (e.g.~for an American case), you may prefer to format the reference more-or-less by hand: \begin{tcolorbox}% @@ -2077,14 +2323,15 @@ you may prefer to format the reference more-or-less by hand: , colback = white , fontupper = \footnotesize ] - \begin{Verbatim} +\begin{Verbatim} title = {Seldon v.~{Clarkson} {Wright} \& {Jakes}}, sortyear = {2012}, note = {[2012]. UKSC 16} - \end{Verbatim} +\end{Verbatim} \end{tcolorbox} \end{hacks} + \subsubsection*{Judgment of the European Court of Justice} \begin{bibexbox}<RX>{srl.etal-v-comm2005} @@ -2094,7 +2341,7 @@ you may prefer to format the reference more-or-less by hand: %</driver> %<*driver|bib> @jurisdiction{srl.etal-v-comm2005, - title = {Alessandrini {Srl} and others v.\@ {Commission}}, + title = {Alessandrini {Srl} and others v. {Commission}}, number = {C-295/03 P}, year = {2005}, journal = {ECR}, @@ -2125,7 +2372,7 @@ Commission case number, \texttt{number} for the formal decision number, and give %<readme>## Licence %<readme> %<*driver|readme> -Copyright 2016-2021 University of Bath. +Copyright 2016-2022 University of Bath. This work consists of the documented LaTeX file biblatex-bath.dtx and a Makefile. @@ -2238,6 +2485,7 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. % We allow the bibliography look more like the Bib\TeX\ default. % % \begin{macrocode} +\setlength{\bibhang}{0pt} \setlength{\bibitemsep}{1em plus 0.2em minus 0.2em} \renewcommand*{\bibfont}{\normalfont\normalsize} % \end{macrocode} @@ -2263,6 +2511,28 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. (test {\iffieldequalstr{labeldatesource}{}} or test {\iffieldequalstr{labeldatesource}{year}})}}% } +% \end{macrocode} +% +% This makes \textsf{biblatex} take notice of parentheses, brackets +% and angle brackets when deciding whether to suppress double punctuation. +% +% \begin{macrocode} +\def\blx@setsfcodes{% + \let\blx@setsfcodes\relax + \let\frenchspacing\blx@setfrcodes + \let\nonfrenchspacing\blx@setencodes + \ifnum\sfcode`\.>2000 + \blx@setencodes + \else + \blx@setfrcodes + \fi + \@setquotesfcodes + \sfcode`\(=\@m + \sfcode`\)=\@m + \sfcode`\[=\@m + \sfcode`\]=\@m + \sfcode`\<=\@m + \sfcode`\>=\@m} % \end{macrocode} % @@ -2386,6 +2656,38 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. % \end{macrocode} % +% We support the |nameaddon| field. +% +% \begin{macrocode} +\DeclareFieldFormat{nameaddon}{\mkbibbrackets{#1}} +\renewbibmacro*{author}{% + \ifboolexpr{ + test \ifuseauthor + and + not test {\ifnameundef{author}} + } + {\usebibmacro{bbx:dashcheck} + {\bibnamedash} + {\usebibmacro{bbx:savehash}% + \printnames{author}% + \iffieldundef{nameaddon} + {} + {\setunit{\addspace}% + \printfield{nameaddon}}% + \iffieldundef{authortype} + {\setunit{\printdelim{nameyeardelim}}} + {\setunit{\printdelim{authortypedelim}}}}% + \iffieldundef{authortype} + {} + {\usebibmacro{authorstrg}% + \setunit{\printdelim{nameyeardelim}}}}% + {\global\undef\bbx@lasthash + \usebibmacro{labeltitle}% + \setunit*{\printdelim{nonameyeardelim}}}% + \usebibmacro{date+extradate}% + \usebibmacro{labeltitleaddon}} +% \end{macrocode} +% % With videos, names in credits are printed in full. % % \begin{macrocode} @@ -2512,9 +2814,6 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. [article,inbook,incollection,inproceedings]% {title}{#1} \DeclareFieldFormat - [patent,thesis]% - {title}{\mkbibemph{#1}} -\DeclareFieldFormat [reference,mvreference]% {title}{\ifnameundef{author}{#1}{\mkbibemph{#1}}} \DeclareFieldFormat @@ -2524,6 +2823,16 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. [inreference]% {booktitle}{\ifnameundef{author}{#1}{\mkbibemph{#1}}} \DeclareFieldFormat + [patent,thesis]% + {title}{\mkbibemph{#1}} +\DeclareFieldFormat + [audio,video,music,video]% + {title}{\ifboolexpr{ + test {\iffieldequalstr{type}{TV}} + or + test {\iffieldequalstr{type}{Radio}} + }{#1}{\mkbibemph{#1}}} +\DeclareFieldFormat [unpublished]% {title}{\iffieldundef{booktitle}{\mkbibemph{#1}}{#1}} @@ -2541,6 +2850,8 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. and test {\iffieldundef{url}} and + test {\iffieldundef{urlyear}} + and not test {\ifentrytype{online}} ) or togl {bbx:onlineshown} @@ -2591,24 +2902,29 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. test {\iffieldundef{journaltitle}} and test {\iffieldundef{booktitle}} - and - test {\iffieldundef{library}} - and - not test {\ifentrytype{software}} and ( - test {\iffieldundef{type}} + test {\iffieldundef{library}} + or + test {\ifentrytype{image}} or - test {\nottoggle{bbx:labelistitle}} + test {\ifentrytype{audio}} or + test {\ifentrytype{video}} + or + test {\ifentrytype{music}} + or + test {\ifentrytype{movie}} + ) and + not test {\ifentrytype{software}} + and ( not ( - test {\ifentrytype{audio}} - or - test {\ifentrytype{video}} + test {\iffieldequalstr{type}{TV}} or - test {\ifentrytype{music}} - or - test {\ifentrytype{movie}} - )) + test {\iffieldequalstr{type}{Radio}} + ) + or + test {\iffieldundef{series}} + ) }{% \setunit*{\addspace}% \usebibmacro{isonline}% @@ -2700,6 +3016,41 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. \printfield[midsentencecase]{subtitle}}% \clearfield{title}\clearfield{subtitle}% \toggletrue{bbx:labelistitle}}% + \ifboolexpr{ + test {\iffieldundef{journaltitle}} + and + test {\iffieldundef{booktitle}} + and ( + test {\iffieldundef{library}} + or + test {\ifentrytype{image}} + or + test {\ifentrytype{audio}} + or + test {\ifentrytype{video}} + or + test {\ifentrytype{music}} + or + test {\ifentrytype{movie}} + ) and + not test {\ifentrytype{software}} + and + not test {\ifentrytype{legislation}} + and + not test {\ifentrytype{jurisdiction}} + and ( + not ( + test {\iffieldequalstr{type}{TV}} + or + test {\iffieldequalstr{type}{Radio}} + ) + or + test {\iffieldundef{series}} + ) + }{% + \setunit*{\addspace}% + \usebibmacro{isonline}% + }{}% }% }{% \printfield{label}% @@ -2714,35 +3065,21 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. \setunit*{\addspace}% \printfield{titleaddon}% \clearfield{titleaddon}% - \ifboolexpr{ + \ifboolexpr{( + test {\ifentrytype{legislation}} + or + test {\ifentrytype{jurisdiction}} + ) + and test {\iffieldundef{journaltitle}} and test {\iffieldundef{booktitle}} - and ( - test {\iffieldundef{library}} - or - test {\ifentrytype{image}} - ) and - not test {\ifentrytype{software}} - and ( - test {\iffieldundef{type}} - or - not ( - test {\ifentrytype{audio}} - or - test {\ifentrytype{video}} - or - test {\ifentrytype{music}} - or - test {\ifentrytype{movie}} - )) }{% \setunit*{\addspace}% \usebibmacro{isonline}% }{}% }{}% } -\xapptobibmacro{author}{\usebibmacro{labeltitleaddon}}{}{} \xapptobibmacro{bbx:editor}{\usebibmacro{labeltitleaddon}}{}{} \xapptobibmacro{bbx:translator}{\usebibmacro{labeltitleaddon}}{}{} @@ -3066,26 +3403,26 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. % \begin{macrocode} \newrobustcmd*{\mknoyeardaterangefull}[2]{% \iffieldundef{#2month}{}{% - \datecircaprint - \printtext[#2date]{% - \iffieldundef{#2season}{% - \csuse{mkbibdate#1}{}{#2month}{#2day}% - \blx@printtime{#2}{}% - }{% - \csuse{mkbibseasondate#1}{}{#2season}}% - \dateuncertainprint - \iffieldundef{#2endmonth}{}{% - \iffieldequalstr{#2endmonth}{}{% - \mbox{\bibdaterangesep}% + \printtext[{#2date}]{% + \datecircaprint + \iffieldundef{#2yeardivision}{% + \csuse{mkbibdate#1}{}{#2month}{#2day}% + \blx@printtime{#2}{}% }{% - \bibdaterangesep - \enddatecircaprint - \iffieldundef{#2season}{% - \csuse{mkbibdate#1}{}{#2endmonth}{#2endday}% - \blx@printtime{#2}{end}% + \csuse{mkbibyeardivisiondate#1}{}{#2yeardivision}}% + \dateuncertainprint + \iffieldundef{#2endmonth}{}{% + \iffieldequalstr{#2endmonth}{}{% + \mbox{\bibdaterangesep}% }{% - \csuse{mkbibseasondate#1}{}{#2endseason}}% - \enddateuncertainprint}}}}} + \bibdaterangesep + \enddatecircaprint + \iffieldundef{#2yeardivision}{% + \csuse{mkbibdate#1}{}{#2endmonth}{#2endday}% + \blx@printtime{#2}{end}% + }{% + \csuse{mkbibyeardivisiondate#1}{}{#2endyeardivision}}% + \enddateuncertainprint}}}}} % \end{macrocode} % % There is a potential problem for |\mknoyeardaterangetrunc|, in that if @@ -3097,11 +3434,11 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. % \begin{macrocode} \newrobustcmd*{\mknoyeardaterangetrunc}[2]{% \iffieldundef{#2month}{}{% - \datecircaprint - \printtext[#2date]{% - \iffieldundef{#2season}{% + \printtext[{#2date}]{% + \datecircaprint + \iffieldundef{#2yeardivision}{% \ifboolexpr{ - test {\iffieldsequal{labelyear}{labelendyear}} + test {\ifdateyearsequal{label}{labelend}} and test {\iffieldsequal{#2month}{#2endmonth}} }{% @@ -3109,7 +3446,7 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. }{% \csuse{mkbibdate#1}{}{#2month}{#2day}}% }{% - \csuse{mkbibseasondate#1}{}{#2season}}% + \csuse{mkbibyeardivisiondate#1}{}{#2yeardivision}}% \dateuncertainprint \iffieldundef{#2endmonth}{}{% \iffieldequalstr{#2endmonth}{}{% @@ -3117,10 +3454,10 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. }{% \bibdaterangesep \enddatecircaprint - \iffieldundef{#2season}{% + \iffieldundef{#2yeardivision}{% \csuse{mkbibdate#1}{}{#2endmonth}{#2endday}% }{% - \csuse{mkbibseasondate#1}{}{#2endseason}}% + \csuse{mkbibyeardivisiondate#1}{}{#2endyeardivision}}% \enddateuncertainprint}}}}} % \end{macrocode} % @@ -3242,6 +3579,27 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. % % \begin{macrocode} \DeclareFieldFormat{type}{\ifbibstring{#1}{\biblstring{#1}}{#1}} +\DeclareFieldFormat{series}{\MakeSentenceCase*{#1}} +\DeclareFieldFormat + [audio,video,music,video]% + {series}{\ifboolexpr{ + test {\iffieldequalstr{type}{TV}} + or + test {\iffieldequalstr{type}{Radio}} + }{\mkbibemph{\MakeSentenceCase*{#1}}}{\MakeSentenceCase*{#1}}} +\DeclareFieldFormat + [audio,video,music,video]% + {number}{\ifboolexpr{ + test {\iffieldequalstr{type}{TV}} + or + test {\iffieldequalstr{type}{Radio}} + }{\mkbibemph{#1}}{#1}} +\DeclareFieldFormat[legislation,jurisdiction]{series}{#1} +\renewbibmacro*{series+number}{% + \printfield{series}% + \setunit*{\addcomma\space}% + \printfield{number}% + \newunit} % \end{macrocode} % % \subsection{Events} @@ -3281,10 +3639,24 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. \printlist{institution}% \newunit \usebibmacro{publisher+location+date}}} -\letbibmacro{plain:organization+location+date}{organization+location+date} +% \end{macrocode} +% +% As an additional hack for social media entries where the date is preceded by a +% comma, we tweak the punctuation logic for \texttt{organization+location+date}. +% +% \begin{macrocode} \renewbibmacro*{organization+location+date}{% \iflistundef{publisher}{% - \usebibmacro{plain:organization+location+date}% + \printlist{location}% + \iflistundef{organization} + {\setunit*{\addcomma\space}} + {\setunit*{\addcolon\space}}% + \printlist{organization}% + \iflistundef{location} + {\setunit{\addcomma\space}}% + {\setunit*{\addcomma\space}}% + \usebibmacro{date}% + \newunit }{% \printlist{organization}% \newunit @@ -3298,7 +3670,7 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. \DeclareFieldFormat{library}{\mkbibemph{#1}} \newbibmacro*{library}{% \iffieldundef{library}{}{% - \printfield{library}% + \printfield{library}\clearfield{library}% \setunit*{\addspace}% \usebibmacro{isonline}% }% @@ -3321,18 +3693,25 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. % \begin{macrocode} \DeclareFieldFormat{url}{\bibsentence\bibstring{urlfrom}\addcolon\space\url{#1}} \DeclareFieldFormat{doi}{\bibsentence\bibstring{urlfrom}\addcolon\space\url{https://doi.org/#1}} +\DeclareFieldFormat{pseudourl}{\bibsentence\bibstring{urlfrom}\addcolon\space#1} \DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}} % \end{macrocode} % % Since URLs and DOIs are presented in exactly the same way, we combine them -% such that the DOI overrides the URL. +% such that the DOI overrides the URL. We also allow the \texttt{library} field +% to be used as a fallback URL. % % \begin{macrocode} \renewbibmacro*{url}{% - \iffieldundef{doi}% - {\printfield{url}}% - {\printfield{doi}}% -} + \iffieldundef{doi}{% + \ifboolexpr{ + test {\iffieldundef{url}} + and not + test {\iffieldundef{urlyear}} + }{\printfield[pseudourl]{library}}{\printfield{url}}% + }{% + \printfield{doi}% + }} \renewbibmacro*{doi+eprint+url}{% \iftoggle{bbx:eprint} {\usebibmacro{eprint}} @@ -3651,7 +4030,7 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. \setunit*{\addcomma\space}}% \printfield{type}% \setunit*{\addspace}% - \IfBeginWith{\thefield{series}}{HL}{% + \IfBeginWith{\thefield{series}}{{HL}}{% \printfield[forceparens]{number}% }{% \printfield{number}% @@ -3774,25 +4153,25 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. % The \texttt{audio} and \texttt{video} drivers are based on \texttt{misc}. % % \begin{macrocode} -\newbibmacro*{type+online}{% - \printfield{type}% - \ifboolexpr{ - test {\iffieldundef{type}} - or - test {\nottoggle{bbx:labelistitle}} - }{}{% - \setunit{\addspace}% - \usebibmacro{isonline}}} \DeclareBibliographyDriver{audio}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \usebibmacro{author/editor+others/translator+others}% \setunit{\printdelim{nametitledelim}}\newblock \usebibmacro{title}% + \newunit\newblock + \usebibmacro{series+number}% + \ifboolexpr{ + test {\iffieldequalstr{type}{TV}} + or + test {\iffieldequalstr{type}{Radio}} + }{% + \setunit{\addspace}% + \usebibmacro{isonline}}{}% \newunit \printlist{language}% \newunit\newblock - \usebibmacro{type+online}% + \printfield{type}% \newunit\newblock \usebibmacro{byauthor}[given-family:full]% \newunit\newblock @@ -4297,7 +4676,7 @@ This work is `maintained' (as per LPPL maintenance status) by [Alex Ball][me]. \setunit{\addcolon\space}% \printlist{location}% \setunit*{\addperiod\space}% - \printfield{library}% + \printfield{library}\clearfield{library}% }% } diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-bath/biblatex-bath.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-bath/biblatex-bath.pdf Binary files differindex d02f0e43dd..b65fcf099d 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-bath/biblatex-bath.pdf +++ b/macros/latex/contrib/biblatex-contrib/biblatex-bath/biblatex-bath.pdf diff --git a/macros/latex/contrib/create-theorem/README.md b/macros/latex/contrib/create-theorem/README.md index 80f2a02181..4da4d7324b 100644 --- a/macros/latex/contrib/create-theorem/README.md +++ b/macros/latex/contrib/create-theorem/README.md @@ -2,7 +2,7 @@ # `create-theorem` - Initializing theorem-like environments with multilingual support -The package `create-theorem` provides the commands `\NameTheorem` and `\CreateTheorem` for naming and initializing theorem-like environments. They both have key-value based interface and are especially useful in multi-language documents, allowing you to easily declare theorem-like environments that automatically adapt to the language settings. +The package `create-theorem` provides the commands `\NameTheorem`, `\CreateTheorem` and `\SetTheorem` for naming, initializing and configuring theorem-like environments. All of these commands have key-value based interface and are especially useful in multi-language documents, allowing the easy declaration of theorem-like environments that can automatically adapt to the language settings. *For more information, please refer to its documentation.* diff --git a/macros/latex/contrib/create-theorem/create-theorem-doc.pdf b/macros/latex/contrib/create-theorem/create-theorem-doc.pdf Binary files differindex 99b8e7290c..0339c47d91 100644 --- a/macros/latex/contrib/create-theorem/create-theorem-doc.pdf +++ b/macros/latex/contrib/create-theorem/create-theorem-doc.pdf diff --git a/macros/latex/contrib/create-theorem/create-theorem-doc.tex b/macros/latex/contrib/create-theorem/create-theorem-doc.tex index 749b345a2a..8a3bf3f607 100644 --- a/macros/latex/contrib/create-theorem/create-theorem-doc.tex +++ b/macros/latex/contrib/create-theorem/create-theorem-doc.tex @@ -5,10 +5,6 @@ \usepackage{ProjLib} -\makeatletter -\pretocmd{\@maketitle}{\vspace*{-2.5\baselineskip}}{}{} -\makeatother - %%================================ %% For typesetting code %%================================ @@ -41,7 +37,9 @@ Crefthe,Crefthename, selectlanguage, theoremstyle, - NameTheorem, CreateTheorem, + NameTheorem, + CreateTheorem, + SetTheorem, regexpatchcmd, } } @@ -89,14 +87,14 @@ \title{\createtheorempackage{}\\\smallskip\itshape Initializing theorem-like environments with multilingual support} \author{Jinwen XU} -\thanks{Corresponding to: \texttt{\createtheorempackage{} 2022/03/01}} +\thanks{Corresponding to: \texttt{\createtheorempackage{} 2022/03/03}} \date{March 2022, in Paris} \maketitle \begin{abstract} \raggedleft - The package \createtheorempackage{} provides the commands \lstinline|\NameTheorem| and \lstinline|\CreateTheorem| for naming and initializing theorem-like environments. They both have key-value based interface and are especially useful in multi-language documents, allowing you to easily declare theorem-like environments that automatically adapt to the language settings. + The package \createtheorempackage{} provides commands for naming, initializing and configuring theorem-like environments. All of these commands have key-value based interface and \\are especially useful in multi-language documents, allowing the easy declaration of \\theorem-like environments that can automatically adapt to the language settings. \end{abstract} \vspace{-.5\baselineskip} @@ -117,12 +115,13 @@ First, you need a backend to provide the command \lstinline|\newtheorem| with th Since \createtheorempackage{} uses \textsf{cleveref} internally, it should usually be placed near the last of your preamble --- notably, it needs to be loaded after \textsf{varioref} and \textsf{hyperref}. \end{tip} +\medskip It has the following options: \begin{itemize} - \item \packageoption{draft} or \packageoption{fast} - \begin{itemize} - \item Fast mode. The functionality will be appropriately reduced to get faster compilation speed, recommended to use during the writing stage. - \end{itemize} + % \item \packageoption{draft} or \packageoption{fast} + % \begin{itemize} + % \item Fast mode. The functionality will be appropriately reduced to get faster compilation speed, recommended to use during the writing stage. + % \end{itemize} \item \packageoption{name as context} \begin{itemize} \item When referencing, the names correspond to the current language context. For example, the English names will be displayed when referencing a theorem-like environment in English context, no matter which language context the original environment is in. @@ -170,6 +169,11 @@ Supported keys are: \end{code} \end{itemize} \end{itemize} + \item \commandoption{heading style}\lstinline| = |\meta{style} + \begin{itemize} + \item The style of the heading, you can specify the font, text style, color, etc. + \item Synonymous names: \commandoption{heading-style} \,$|$\, \commandoption{headingstyle} + \end{itemize} \item \commandoption{crefname}\lstinline| = |\meta{configuration} \begin{itemize} \item The name for \lstinline|\cref| the environment, where \meta{configuration} can be: @@ -187,13 +191,29 @@ Supported keys are: [(*\meta{singular definite article}*)]{(*\meta{singular name}*)}[(*\meta{plural definite article}*)]{(*\meta{plural name}*)} \end{code} \end{itemize} + \item \commandoption{crefname style}\lstinline| = |\meta{style} + \begin{itemize} + \item The style of the ``crefname'', you can specify the font, text style, color, etc. + \item Synonymous names: \commandoption{crefname-style} \,$|$\, \commandoption{crefnamestyle} + \end{itemize} \item \commandoption{Crefname} \begin{itemize} \item The name for \lstinline|\Cref| the environment, its syntax is the same as that of \commandoption{crefname}. \item Also supports the syntax of \lstinline|\Crefthename|. \end{itemize} + \item \commandoption{Crefname style}\lstinline| = |\meta{style} + \begin{itemize} + \item The style of the ``Crefname'', you can specify the font, text style, color, etc. + \item Synonymous names: \commandoption{Crefname-style} \,$|$\, \commandoption{Crefnamestyle} + \end{itemize} + \item \commandoption{numbering style}\lstinline| = |\meta{style} + \begin{itemize} + \item The style of numbering in the reference, you can specify the font, text style, color, etc. + \item Synonymous names: \commandoption{numbering-style} \,$|$\, \commandoption{numberingstyle} + \end{itemize} \end{itemize} +\medskip \begin{center} \itshape If you're feeling confused, don't worry, there is an Examples section later illustrating its usage. @@ -216,7 +236,12 @@ Supported keys are: \begin{itemize} \item \commandoption{name}\lstinline| = |\meta{configuration} \begin{itemize} - \item Same as \lstinline|\NameTheorem{|\meta{name of environment}\lstinline|}{|\meta{configuration}\lstinline|}|. + \item Setting the names. Same as \lstinline|\NameTheorem{|\meta{name of environment}\lstinline|}{|\meta{configuration}\lstinline|}|. + \end{itemize} + \item \commandoption{name style}\lstinline| = |\meta{configuration} + \begin{itemize} + \item Setting the style of names. Same as using \lstinline|\NameTheorem|. + \item Synonymous names: \commandoption{name-style} \,$|$\, \commandoption{namestyle} \end{itemize} \item \commandoption{style}\lstinline| = |\meta{theorem style} \begin{itemize} @@ -256,24 +281,53 @@ Supported keys are: \begin{center} \itshape - If you're feeling confused, don't worry, check out the Examples section below. + If you're feeling confused, don't worry, there is an Examples section later illustrating its usage. \end{center} \begin{tip} - The names for the following environments have been preset: \texttt{assertion}, \texttt{assumption}, \texttt{axiom}, \texttt{conclusion}, \texttt{conjecture}, \texttt{convention}, \texttt{corollary}, \texttt{definition}, \texttt{example}, \texttt{exercise}, \texttt{fact}, \texttt{hypothesis}, \texttt{lemma}, \texttt{notation}, \texttt{observation}, \texttt{postulate}, \texttt{problem}, \texttt{property}, \texttt{proposition}, \texttt{question}, \texttt{remark} and \texttt{theorem}. If you are fine with the preset names, then you don't need to specify the key ``\commandoption{name}'' while creating them, otherwise you shall have to use the package option ``\packageoption{no preset names}'' to disable the presets and define your own ones. + The names for the following environments have been preset: \texttt{assertion}, \texttt{assumption}, \texttt{axiom}, \texttt{conclusion}, \texttt{conjecture}, \texttt{convention}, \texttt{corollary}, \texttt{definition}, \texttt{example}, \texttt{exercise}, \texttt{fact}, \texttt{hypothesis}, \texttt{lemma}, \texttt{notation}, \texttt{observation}, \texttt{postulate}, \texttt{problem}, \texttt{property}, \texttt{proposition}, \texttt{question}, \texttt{remark} and \texttt{theorem}. If you are fine with the preset names, then you don't need to specify the key ``\commandoption{name}'' while creating them, otherwise you shall have to use the package option ``\packageoption{no preset names}'' to disable the presets and then define your own ones. \end{tip} \medskip Please note that, by default, an normal environment \meta{env} and its starred relative \meta{env}\texttt{*} do \emph{not} share the same set of names, for the sake of generality. However, with proper usage of \commandoption{create starred version} and \commandoption{copy existed}, you are already able to produce all of the following combinations that shares the same set of names: 1$)$ numbered \meta{env}, numbered \meta{env}\texttt{*} ; 2$)$ numbered \meta{env}, unnumbered \meta{env}\texttt{*} ; 3$)$ unnumbered \meta{env}, numbered \meta{env}\texttt{*} ; and 4$)$ unnumbered \meta{env}, unnumbered \meta{env}\texttt{*}. I left it as an easy exercise for you ;-) -% \subsection[Configuring theorem-like environments]{Configuring theorem-like environments with \texttt{\textbackslash\textcolor{maintheme}{SetTheorem}}} -% Even after defining the environments, you can still configure them with \lstinline|\SetTheorem|. The syntax of which is as follows: +\bigskip +\subsection[Configuring theorem-like environments]{Configuring theorem-like environments with \texttt{\textbackslash\textcolor{maintheme}{SetTheorem}}} + +The previous two commands are especially useful for package or class writers, while this one is more for the users. If you are not satisfied with preset name styles or numbering settings, then even after initializing the environments, you can still further configure them by means of \lstinline|\SetTheorem|, the syntax of which is as follows: + +\begin{code} +\SetTheorem{(*\meta{list of the name of environments}*)}{(*\meta{key-value configuration}*)} +\end{code} -% \begin{code} -% \SetTheorem{(*\meta{list of the name of environments}*)}{(*\meta{key-value configuration}*)} -% \end{code} +\begin{tip} + \lstinline|\SetTheorem| should only be used in the preamble of your document. +\end{tip} + +Supported keys are: +\vspace{-.2\baselineskip} +\begin{itemize} + \item \commandoption{name style}\lstinline| = |\meta{configuration} + \begin{itemize} + \item Same as \lstinline|\NameTheorem{|\meta{name of environment}\lstinline|}{|\meta{configuration}\lstinline|}|. + \item Note that this configuration can overwrite those already specified in \lstinline|\NameTheorem|. + \item Synonymous names: \commandoption{name-style} \,$|$\, \commandoption{namestyle} + \end{itemize} + \item \commandoption{parent counter}\lstinline| = |\meta{parent counter} + \begin{itemize} + \item Specifying the \meta{parent counter} for the current environment, \emph{i.e.}, numbering will restart whenever that sectional level is encountered. + \item Note that this configuration can overwrite those already specified in \lstinline|\CreateTheorem|. + \item Synonymous names: \commandoption{parent-counter} \,$|$\, \commandoption{parentcounter} \,$|$\, \\\phantom{Synonymous names: }\commandoption{number within} \,$|$\, \commandoption{number-within} \,$|$\, \commandoption{numberwithin} + \end{itemize} + \item \commandoption{shared counter}\lstinline| = |\meta{shared counter} + \begin{itemize} + \item Specifying the \meta{shared counter} for the current environment, \emph{i.e.}, numbering will progress sequentially for all theorem-like environments using this counter. + \item Note that this configuration can overwrite those already specified in \lstinline|\CreateTheorem|. + \item Synonymous names: \commandoption{shared-counter} \,$|$\, \commandoption{sharedcounter} \,$|$\, \\\phantom{Synonymous names: }\commandoption{number like} \,$|$\, \commandoption{number-like} \,$|$\, \commandoption{numberlike} + \end{itemize} +\end{itemize} \section{Examples} @@ -288,7 +342,7 @@ First, let's getting familiar with these two commands by creating the environmen (*\commandoption{crefname}*) = {idea}{ideas}, (*\commandoption{Crefname}*) = {Idea}{Ideas}, } -\CreateTheorem{idea}{ parent counter = section } +\CreateTheorem{idea}{ (*\commandoption{parent counter}*) = section } \end{code} or to do it in one turn: @@ -328,7 +382,7 @@ Next we shall deal with the numbering problem. Let's continue to use this enviro \subsection{Let's play with numbering} -Remember the exercise I left you at the end of the previous section? Let's do it together now. +Remember the exercise I left you in the previous section? Let's do it together now. \subsubsection{Numbered \texttt{idea} and numbered \texttt{idea*}} diff --git a/macros/latex/contrib/create-theorem/create-theorem.sty b/macros/latex/contrib/create-theorem/create-theorem.sty index e966ff9752..f9fa3d4e9f 100644 --- a/macros/latex/contrib/create-theorem/create-theorem.sty +++ b/macros/latex/contrib/create-theorem/create-theorem.sty @@ -13,14 +13,11 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {create-theorem} - {2022/03/01} {} + {2022/03/03} {} {Initializing theorem-like environments with multilingual support} \keys_define:nn { create-theorem } { - , draft .bool_set:N = \l__crthm_fast_bool - , draft .initial:n = { false } - , fast .bool_set:N = \l__crthm_fast_bool , name-as-context .bool_set:N = \l__crthm_regionalref_bool , name-as-context .initial:n = { true } , name~as~context .bool_set:N = \l__crthm_regionalref_bool @@ -85,41 +82,74 @@ \keys_define:nn { create-theorem-naming } { - , heading .code:n = { \crthm_set_name_heading:ee { \l__crthm_current_env_tl } { #1 } } - , heading .value_required:n = true - , crefname .code:n = { \crthm_set_name_crefname:ee { \l__crthm_current_env_tl } { #1 } } - , crefname .value_required:n = true - , Crefname .code:n = { \crthm_set_name_Crefname:ee { \l__crthm_current_env_tl } { #1 } } - , Crefname .value_required:n = true - , unknown .code:n = {} + , heading .code:n = { \crthm_set_name_heading:en { \l__crthm_current_env_tl } { #1 } } + , heading .value_required:n = true + , crefname .code:n = { \crthm_set_name_crefname:en { \l__crthm_current_env_tl } { #1 } } + , crefname .value_required:n = true + , Crefname .code:n = { \crthm_set_name_Crefname:en { \l__crthm_current_env_tl } { #1 } } + , Crefname .value_required:n = true + , heading~style .code:n = { \crthm_set_name_style_heading:en { \l__crthm_current_env_tl } { #1 } } + , heading~style .value_required:n = true + , heading-style .meta:n = { heading~style = #1 } + , heading-style .value_required:n = true + , heading style .meta:n = { heading~style = #1 } + , heading style .value_required:n = true + , crefname~style .code:n = { \crthm_set_name_style_crefname:en { \l__crthm_current_env_tl } { #1 } } + , crefname~style .value_required:n = true + , crefname-style .meta:n = { crefname~style = #1 } + , crefname-style .value_required:n = true + , crefname style .meta:n = { crefname~style = #1 } + , crefname style .value_required:n = true + , Crefname~style .code:n = { \crthm_set_name_style_Crefname:en { \l__crthm_current_env_tl } { #1 } } + , Crefname~style .value_required:n = true + , Crefname-style .meta:n = { Crefname~style = #1 } + , Crefname-style .value_required:n = true + , Crefname style .meta:n = { Crefname~style = #1 } + , Crefname style .value_required:n = true + , numbering~style .code:n = { \crthm_set_name_style_numbering:en { \l__crthm_current_env_tl } { #1 } } + , numbering~style .value_required:n = true + , numbering-style .meta:n = { numbering~style = #1 } + , numbering-style .value_required:n = true + , numbering style .meta:n = { numbering~style = #1 } + , numbering style .value_required:n = true + , unknown .code:n = {} } -\cs_new:Nn \crthm_set_name_heading:nn - % #1 = env name - % #2 = the settings +\cs_new:Nn \__crthm_set_generic:nnn { \str_if_in:nnTF { #2 } { = } {% key-value definition \keyval_parse:nnn {} - { \__crthm_set_name_heading:nnn { #1 } } + { \use:c { __crthm_ #3 :nnn } { #1 } } { #2 } } {% simple definition \clist_map_inline:Nn \g_crthm_supported_language_clist { - \__crthm_set_name_heading:nnn { #1 } { ##1 } { #2 } + \use:c { __crthm_ #3 :nnn } { #1 } { ##1 } { #2 } } } } -\cs_generate_variant:Nn \crthm_set_name_heading:nn { ee } + +\cs_new:Nn \crthm_set_name_heading:nn + % #1 = env name + % #2 = the settings + { + \__crthm_set_generic:nnn { #1 } { #2 } { set_name_heading } + } +\cs_generate_variant:Nn \crthm_set_name_heading:nn { en } \cs_new:Nn \__crthm_set_name_heading:nnn % #1 = env name % #2 = language name % #3 = corresponding heading name { - \tl_gset:cn { g_crthm_name_heading_ #1 _ #2 _tl } { #3 } + \tl_if_exist:cF { g_crthm_style_heading_ #1 _ #2 _tl } + { + \tl_new:c { g_crthm_style_heading_ #1 _ #2 _tl } + } + \tl_gset:cn { g_crthm_name_heading_ #1 _ #2 _tl } { \tl_use:c { g_crthm_style_heading_ #1 _ #2 _tl } { #3 } } } \cs_new:Nn \crthm_set_name_crefname:nn @@ -128,7 +158,7 @@ { \crthm_set_name_crefname_generic:nnn { #1 } { #2 } { c } } -\cs_generate_variant:Nn \crthm_set_name_crefname:nn { ee } +\cs_generate_variant:Nn \crthm_set_name_crefname:nn { en } \cs_new:Nn \crthm_set_name_Crefname:nn % #1 = env name @@ -136,26 +166,14 @@ { \crthm_set_name_crefname_generic:nnn { #1 } { #2 } { C } } -\cs_generate_variant:Nn \crthm_set_name_Crefname:nn { ee } +\cs_generate_variant:Nn \crthm_set_name_Crefname:nn { en } \cs_new:Nn \crthm_set_name_crefname_generic:nnn % #1 = env name % #2 = the settings % #3 = c or C { - \str_if_in:nnTF { #2 } { = } - {% key-value definition - \keyval_parse:nnn - {} - { \use:c { __crthm_set_name_ #3 refname:nnn } { #1 } } - { #2 } - } - {% simple definition - \clist_map_inline:Nn \g_crthm_supported_language_clist - { - \use:c { __crthm_set_name_ #3 refname:nnn } { #1 } { ##1 } { #2 } - } - } + \__crthm_set_generic:nnn { #1 } { #2 } { set_name_ #3 refname } } \cs_new:Nn \__crthm_set_name_crefname:nnn @@ -181,22 +199,35 @@ { \tl_if_blank:eTF { #3 } { - \tl_gset:cn { g_crthm_name_ #7 ref_article_singular_ #1 _ #2 _tl } { \crefthemark{ \!\! } } - \tl_gset:cn { g_crthm_name_ #7 ref_article_plural_ #1 _ #2 _tl } { \crefthemark{ \!\! } } + \tl_gset:cn { g_crthm_name_ #7 ref_article_singular_ #1 _ #2 _tl } { \crefthemark{ \skip_horizontal:n { -1ex } } } + \tl_gset:cn { g_crthm_name_ #7 ref_article_plural_ #1 _ #2 _tl } { \crefthemark{ \skip_horizontal:n { -1ex } } } } { \tl_gset:cn { g_crthm_name_ #7 ref_article_singular_ #1 _ #2 _tl } { \crefthemark { #3 } } \tl_gset:cn { g_crthm_name_ #7 ref_article_plural_ #1 _ #2 _tl } { \crefthemark { #5 } } } - \tl_gset:cn { g_crthm_name_ #7 ref_singular_ #1 _ #2 _tl } { #4 } - \tl_gset:cn { g_crthm_name_ #7 ref_plural_ #1 _ #2 _tl } { #6 } + + \tl_if_exist:cF { g_crthm_style_ #7 refname_ #1 _ #2 _tl } + { + \tl_new:c { g_crthm_style_ #7 refname_ #1 _ #2 _tl } + } + + \tl_gset:cn { g_crthm_name_ #7 ref_singular_ #1 _ #2 _tl } { \tl_use:c { g_crthm_style_ #7 refname_ #1 _ #2 _tl } { #4 } } + \tl_gset:cn { g_crthm_name_ #7 ref_plural_ #1 _ #2 _tl } { \tl_use:c { g_crthm_style_ #7 refname_ #1 _ #2 _tl } { #6 } } \bool_if:NTF \l__crthm_regionalref_bool {% "regionalref" mode \use:c { __crthm_set_name_ #7 refname_do:nnn } { #1 _crthm_regional } { #1 } { \languagename } } {% "originalref" mode - \tl_if_exist:cF { c@ #1 _crthm_original_ #2 } { \newaliascnt { #1 _crthm_original_ #2 } { #1 } } + \tl_if_exist:cF { c@ #1 _crthm_original_ #2 } + { + \newaliascnt { #1 _crthm_original_ #2 } { #1 } + \hook_gput_code:nnn { begindocument/before } { crthm } + { + \cs_set_eq:cc { the #1 _crthm_original_ #2 } { the #1 } + } + } \use:c { __crthm_set_name_ #7 refname_do:nnn } { #1 _crthm_original_ #2 } { #1 } { #2 } } } @@ -237,7 +268,8 @@ } } \tl_gset:cn { #4 ref@ #1 @name@plural } - { % Use the definite article of the original language, with name's casing depends on the preposition and the article + { % Use the definite article of the original language, + % with name's casing depends on the preposition and the article \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } \bool_if:NTF \g__crefthe_has_prep_bool { @@ -247,113 +279,218 @@ \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } } } - %% Use the definite article of the original language, with name's casing correspond to the article - % \tl_gset:cn { #4 ref@ #1 @name } - % { - % \tl_use:c { g_crthm_name_ #4 ref_article_singular_ #2 _ #3 _tl } - % \tl_use:c { g_crthm_name_ #4 ref_singular_ #2 _ #3 _tl } - % } - % \tl_gset:cn { #4 ref@ #1 @name@plural } - % { - % \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } - % \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } - % } - %% Use the definite article of the current language, with name's casing correspond to the article - % \tl_gset:cn { #4 ref@ #1 @name } - % { - % \tl_use:c { g_crthm_name_ #4 ref_article_singular_ #2 _ \languagename _tl } - % \tl_use:c { g_crthm_name_ #4 ref_singular_ #2 _ #3 _tl } - % } - % \tl_gset:cn { #4 ref@ #1 @name@plural } - % { - % \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ \languagename _tl } - % \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } - % } \seq_if_in:NnF \g__crthm_format_already_set_seq { #2 _ #3 } { - \@crefcopyformats { #2 _ #3 } { #1 } + \@crefdefineallformats { #1 } \seq_gput_right:Nn \g__crthm_format_already_set_seq { #2 _ #3 } } - \bool_if:NF \l__crthm_fast_bool - { % Patch the cref formats so that definite articles are placed outside the hyperlinks - \bool_if:NT \l__crthm_nameinlink_bool - { % Use the definite article of the original language, with name's casing depends on the preposition and the article - \crefthe_patch_format:nnnn { #4 ref@ #1 @format } { #4 ref@ #1 @name } - { \tl_use:c { g_crthm_name_ #4 ref_article_singular_ #2 _ #3 _tl } } - { - \bool_if:NTF \g__crefthe_has_prep_bool - { - \tl_use:c { g_crthm_name_ cref_singular_ #2 _ #3 _tl } - } - { - \tl_use:c { g_crthm_name_ #4 ref_singular_ #2 _ #3 _tl } - } - } - \crefthe_patch_format:nnnn { #4 ref@ #1 @format@first } { #4 ref@ #1 @name@plural } - { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } - { - \bool_if:NTF \g__crefthe_has_prep_bool - { - \tl_use:c { g_crthm_name_ cref_plural_ #2 _ #3 _tl } - } - { - \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } - } - } - \crefthe_patch_format:nnnn { #4 refrange@ #1 @format } { #4 ref@ #1 @name@plural } - { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } - { - \bool_if:NTF \g__crefthe_has_prep_bool - { - \tl_use:c { g_crthm_name_ cref_plural_ #2 _ #3 _tl } - } - { - \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } - } - } - \crefthe_patch_format:nnnn { #4 refrange@ #1 @format@first } { #4 ref@ #1 @name@plural } - { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } - { - \bool_if:NTF \g__crefthe_has_prep_bool - { - \tl_use:c { g_crthm_name_ cref_plural_ #2 _ #3 _tl } - } - { - \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } - } - } - %% Use the definite article of the original language, with name's casing correspond to the article - % \crefthe_patch_format:nnnn { #4 ref@ #1 @format } { #4 ref@ #1 @name } - % { \tl_use:c { g_crthm_name_ #4 ref_article_singular_ #2 _ #3 _tl } } - % { \tl_use:c { g_crthm_name_ #4 ref_singular_ #2 _ #3 _tl } } - % \crefthe_patch_format:nnnn { #4 ref@ #1 @format@first } { #4 ref@ #1 @name@plural } - % { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } - % { \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } } - % \crefthe_patch_format:nnnn { #4 refrange@ #1 @format } { #4 ref@ #1 @name@plural } - % { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } - % { \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } } - % \crefthe_patch_format:nnnn { #4 refrange@ #1 @format@first } { #4 ref@ #1 @name@plural } - % { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } - % { \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } } - %% Use the definite article of the current language, with name's casing correspond to the article - % \crefthe_patch_format:nnnn { #4 ref@ #1 @format } { #4 ref@ #1 @name } - % { \tl_use:c { g_crthm_name_ #4 ref_article_singular_ #2 _ \languagename _tl } } - % { \tl_use:c { g_crthm_name_ #4 ref_singular_ #2 _ #3 _tl } } - % \crefthe_patch_format:nnnn { #4 ref@ #1 @format@first } { #4 ref@ #1 @name@plural } - % { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ \languagename _tl } } - % { \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } } - % \crefthe_patch_format:nnnn { #4 refrange@ #1 @format } { #4 ref@ #1 @name@plural } - % { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ \languagename _tl } } - % { \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } } - % \crefthe_patch_format:nnnn { #4 refrange@ #1 @format@first } { #4 ref@ #1 @name@plural } - % { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ \languagename _tl } } - % { \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } } + \tl_if_exist:cF { g_crthm_number_style_ #2 _tl } + { + \tl_new:c { g_crthm_number_style_ #2 _tl } + } + + % Redefine the cref formats so that definite articles are placed outside the hyperlinks + \crthm_define_format_short_version:nnnn { #2 } { #4 ref@ #1 @format } + { \tl_use:c { g_crthm_name_ #4 ref_article_singular_ #2 _ #3 _tl } } + { + \bool_if:NTF \g__crefthe_has_prep_bool + { + \tl_use:c { g_crthm_name_ cref_singular_ #2 _ #3 _tl } + } + { + \tl_use:c { g_crthm_name_ #4 ref_singular_ #2 _ #3 _tl } + } + } + \crthm_define_format_short_version:nnnn { #2 } { #4 ref@ #1 @format@first } + { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } + { + \bool_if:NTF \g__crefthe_has_prep_bool + { + \tl_use:c { g_crthm_name_ cref_plural_ #2 _ #3 _tl } + } + { + \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } + } + } + \cs_set:cpn { #4 ref@ #1 @format@second } ##1##2##3 + { + \crefpairconjunction + \crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 } + } + \cs_set:cpn { #4 ref@ #1 @format@middle } ##1##2##3 + { + \crefmiddleconjunction + \crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 } + } + \cs_set:cpn { #4 ref@ #1 @format@last } ##1##2##3 + { + \creflastconjunction + \crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 } + } + + \crthm_define_format_long_version:nnnn { #2 } { #4 refrange@ #1 @format } + { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } + { + \bool_if:NTF \g__crefthe_has_prep_bool + { + \tl_use:c { g_crthm_name_ cref_plural_ #2 _ #3 _tl } } + { + \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } + } + } + \crthm_define_format_long_version:nnnn { #2 } { #4 refrange@ #1 @format@first } + { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } + { + \bool_if:NTF \g__crefthe_has_prep_bool + { + \tl_use:c { g_crthm_name_ cref_plural_ #2 _ #3 _tl } + } + { + \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } + } + } + \cs_set:cpn { #4 refrange@ #1 @format@second } ##1##2##3##4##5##6 + { + \crefpairconjunction + \crthm_format_long_generic:nnnnnn + { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } + { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##2 } } + { ##3 } { ##4 } { ##5 } { ##6 } + } + \cs_set:cpn { #4 refrange@ #1 @format@middle } ##1##2##3##4##5##6 + { + \crefmiddleconjunction + \crthm_format_long_generic:nnnnnn + { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } + { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##2 } } + { ##3 } { ##4 } { ##5 } { ##6 } + } + \cs_set:cpn { #4 refrange@ #1 @format@last } ##1##2##3##4##5##6 + { + \creflastconjunction + \crthm_format_long_generic:nnnnnn + { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } + { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##2 } } + { ##3 } { ##4 } { ##5 } { ##6 } } } +\cs_new:Nn \crthm_define_format_short_version:nnnn + { % #1 = name of the environment + % #2 = name of the format command + % #3 = content before the hyperlink beginning mark + % #4 = content after the hyperlink beginning mark + \cs_if_exist:cF { crthm_format_ #2 :nnn } + { + \cs_new:cn { crthm_format_ #2 :nnn } + { + #3 ##2 #4 \nobreakspace { \tl_use:c { g_crthm_number_style_ #1 _tl } { ##1 } } ##3 + } + \cs_set_eq:cc { #2 } { crthm_format_ #2 :nnn } + } + } +\cs_new:Nn \crthm_define_format_long_version:nnnn + { % #1 = name of the environment + % #2 = name of the format command + % #3 = content before the hyperlink beginning mark + % #4 = content after the hyperlink beginning mark + \cs_if_exist:cF { crthm_format_ #2 :nnnnnn } + { + \cs_new:cn { crthm_format_ #2 :nnnnnn } + { + #3 ##3 #4 + \nobreakspace \crefrangepreconjunction + { \tl_use:c { g_crthm_number_style_ #1 _tl } { ##1 } } + ##4 \crefrangeconjunction + ##5 { \tl_use:c { g_crthm_number_style_ #1 _tl } { ##2 } } ##6 + \crefrangepostconjunction + } + \cs_set_eq:cc { #2 } { crthm_format_ #2 :nnnnnn } + } + } + +\cs_new:Nn \crthm_format_short_generic:nnn + { + #2 { #1 } #3 + } +\cs_new:Nn \crthm_format_long_generic:nnnnnn + { + \crefrangepreconjunction + #3 { #1 } #4 + \crefrangeconjunction + #5 { #2 } #6 + \crefrangepostconjunction + } + + +\cs_new:Nn \crthm_set_name_style_heading:nn + % #1 = env name + % #2 = the settings + { + \__crthm_set_generic:nnn { #1 } { #2 } { set_name_style_heading } + } +\cs_generate_variant:Nn \crthm_set_name_style_heading:nn { en } + +\cs_new:Nn \__crthm_set_name_style_heading:nnn + % #1 = env name + % #2 = language name + % #3 = corresponding heading style + { + \tl_gset:cn { g_crthm_style_heading_ #1 _ #2 _tl } { \normalfont #3 } + } + +\cs_new:Nn \crthm_set_name_style_crefname:nn + % #1 = env name + % #2 = the settings + { + \__crthm_set_generic:nnn { #1 } { #2 } { set_name_style_crefname } + } +\cs_generate_variant:Nn \crthm_set_name_style_crefname:nn { en } + +\cs_new:Nn \__crthm_set_name_style_crefname:nnn + % #1 = env name + % #2 = language name + % #3 = corresponding crefname style + { + \tl_gset:cn { g_crthm_style_crefname_ #1 _ #2 _tl } { \normalfont #3 } + } + +\cs_new:Nn \crthm_set_name_style_Crefname:nn + % #1 = env name + % #2 = the settings + { + \__crthm_set_generic:nnn { #1 } { #2 } { set_name_style_Crefname } + } +\cs_generate_variant:Nn \crthm_set_name_style_Crefname:nn { en } + +\cs_new:Nn \__crthm_set_name_style_Crefname:nnn + % #1 = env name + % #2 = language name + % #3 = corresponding Crefname style + { + \tl_gset:cn { g_crthm_style_Crefname_ #1 _ #2 _tl } { \normalfont #3 } + } + +\cs_new:Nn \crthm_set_name_style_numbering:nn + % #1 = env name + % #2 = the settings + { + \__crthm_set_generic:nnn { #1 } { #2 } { set_name_style_numbering } + } +\cs_generate_variant:Nn \crthm_set_name_style_numbering:nn { en } + +\cs_new:Nn \__crthm_set_name_style_numbering:nnn + % #1 = env name + % #2 = language name + % #3 = corresponding numbering style + { + \tl_gset:cn { g_crthm_number_style_ #1 _tl } { #3 } + } + + \NewDocumentCommand \NameTheorem { m m } { \crthm_name_theorem:nn { #1 } { #2 } @@ -362,10 +499,14 @@ \cs_new:Nn \crthm_name_theorem:nn { \tl_set:Nn \l__crthm_current_env_tl { #1 } - \newcounter { #1 } + \cs_if_exist:cF { c@ #1 } + { + \newcounter { #1 } + } \keys_set:nn { create-theorem-naming } { #2 } } + \bool_new:N \l__crthm_creating_apply_style_bool \tl_new:N \l__crthm_creating_apply_style_tl \bool_new:N \l__crthm_creating_numberless_bool @@ -376,6 +517,12 @@ { , name .code:n = { \exp_args:Ne \NameTheorem { \l__crthm_current_env_tl } { #1 } } , name .value_required:n = true + , name~style .code:n = { \exp_args:Ne \NameTheorem { \l__crthm_current_env_tl } { #1 } } + , name~style .value_required:n = true + , name-style .meta:n = { name~style = #1 } + , name-style .value_required:n = true + , name style .meta:n = { name~style = #1 } + , name style .value_required:n = true , style .code:n = { \bool_set_true:N \l__crthm_creating_apply_style_bool \tl_set:Nn \l__crthm_creating_apply_style_tl { #1 } } , style .value_required:n = true @@ -399,12 +546,14 @@ , copy-existed .value_required:n = true , copy existed .meta:n = { copy~existed = #1 } , copy existed .value_required:n = true + , quiet .bool_set:N = \l__crthm_creating_quiet_bool + , quiet .initial:n = { false } , unknown .code:n = {} } \keys_define:nn { create-theorem-creating / counter-management } { - , parent~counter .code:n = { \crthm_counter_within:ee { \l__crthm_current_env_tl } { #1 } } + , parent~counter .code:n = { \crthm_counter_within:en { \l__crthm_current_env_tl } { #1 } } , parent~counter .value_required:n = true , parent-counter .meta:n = { parent~counter = #1 } , parent-counter .value_required:n = true @@ -416,7 +565,7 @@ , number-within .value_required:n = true , number within .meta:n = { parent~counter = #1 } , number within .value_required:n = true - , shared~counter .code:n = { \crthm_counter_alias:ee { \l__crthm_current_env_tl } { #1 } } + , shared~counter .code:n = { \crthm_counter_alias:en { \l__crthm_current_env_tl } { #1 } } , shared~counter .value_required:n = true , shared-counter .meta:n = { shared~counter = #1 } , shared-counter .value_required:n = true @@ -431,6 +580,7 @@ , unknown .code:n = {} } + \NewDocumentCommand \CreateTheorem { m m } { \clist_map_inline:nn { #1 } @@ -439,8 +589,26 @@ } } +\msg_new:nnn { create-theorem } + { env-not-created } + { The~theorem-like~environment~"#1"~cannot~be~created,~an~environment~with~the~same~name~has~already~existed. } + \cs_new:Nn \crthm_create_theorem:nn { + \cs_if_exist:cTF { #1 } + { + \bool_if:NF \l__crthm_creating_quiet_bool + { + \msg_warning:nnn { create-theorem } { env-not-created } { #1 } + } + } + { + \__crthm_create_theorem:nn { #1 } { #2 } + } + } + +\cs_new:Nn \__crthm_create_theorem:nn + { \tl_set:Nn \l__crthm_current_env_tl { #1 } \bool_set_false:N \l__crthm_creating_apply_style_bool \bool_set_false:N \l__crthm_creating_numberless_bool @@ -449,10 +617,10 @@ \keys_set:nn { create-theorem-creating } { #2 } \bool_if:NTF \l__crthm_creating_copy_existed_bool { - \__crthm_define_env:ee { #1 } { \l__crthm_creating_copy_existed_tl } + \__crthm_define_env:en { #1 } { \l__crthm_creating_copy_existed_tl } \bool_if:NT \l__crthm_creating_create_starred_bool { - \__crthm_define_env:ee { #1 * } { \l__crthm_creating_copy_existed_tl * } + \__crthm_define_env:en { #1 * } { \l__crthm_creating_copy_existed_tl * } } } { @@ -473,7 +641,13 @@ % In "regionalref" mode, the counter received by the referencing system is "#1 _crthm_regional" % while in "originalref" mode, the counter received is "#1 _crthm_original_\languagename" { - \begin{ #1 _crthm_regional }[##1] + \tl_if_blank:eTF { ##1 } + { + \begin{ #1 _crthm_regional } + } + { + \begin{ #1 _crthm_regional }[##1] + } \bool_if:NF \l__crthm_regionalref_bool { \addtocounter { #1 _crthm_original_\languagename } { -1 } @@ -496,20 +670,68 @@ \cs_set_eq:cc { #1 } { #2 } \cs_set_eq:cc { end #1 } { end #2 } } -\cs_generate_variant:Nn \__crthm_define_env:nn { ee } +\cs_generate_variant:Nn \__crthm_define_env:nn { en } \cs_new:Nn \crthm_counter_within:nn { \counterwithin { #1 } { #2 } } -\cs_generate_variant:Nn \crthm_counter_within:nn { ee } +\cs_generate_variant:Nn \crthm_counter_within:nn { en } \cs_new:Nn \crthm_counter_alias:nn { \cs_set_eq:cc { c@ #1 } { c@ #2 } \cs_set_eq:cc { the #1 } { the #2 } } -\cs_generate_variant:Nn \crthm_counter_alias:nn { ee } +\cs_generate_variant:Nn \crthm_counter_alias:nn { en } + + +\keys_define:nn { create-theorem-setting } + { + , name .code:n = { \exp_args:Ne \NameTheorem { \l__crthm_current_env_tl } { #1 } } + , name .value_required:n = true + , name~style .code:n = { \exp_args:Ne \NameTheorem { \l__crthm_current_env_tl } { #1 } } + , name~style .value_required:n = true + , name-style .meta:n = { name~style = #1 } + , name-style .value_required:n = true + , name style .meta:n = { name~style = #1 } + , name style .value_required:n = true + , parent~counter .code:n = { \crthm_counter_within:en { \l__crthm_current_env_tl } { #1 } } + , parent~counter .value_required:n = true + , parent-counter .meta:n = { parent~counter = #1 } + , parent-counter .value_required:n = true + , parent counter .meta:n = { parent~counter = #1 } + , parent counter .value_required:n = true + , number~within .meta:n = { parent~counter = #1 } + , number~within .value_required:n = true + , number-within .meta:n = { parent~counter = #1 } + , number-within .value_required:n = true + , number within .meta:n = { parent~counter = #1 } + , number within .value_required:n = true + , shared~counter .code:n = { \crthm_counter_alias:en { \l__crthm_current_env_tl } { #1 } } + , shared~counter .value_required:n = true + , shared-counter .meta:n = { shared~counter = #1 } + , shared-counter .value_required:n = true + , shared counter .meta:n = { shared~counter = #1 } + , shared counter .value_required:n = true + , number~like .meta:n = { shared~counter = #1 } + , number~like .value_required:n = true + , number-like .meta:n = { shared~counter = #1 } + , number-like .value_required:n = true + , number like .meta:n = { shared~counter = #1 } + , number like .value_required:n = true + , unknown .code:n = {} + } + + +\NewDocumentCommand \SetTheorem { m m } + { + \clist_map_inline:nn { #1 } + { + \tl_set:Nn \l__crthm_current_env_tl { ##1 } + \keys_set:nn { create-theorem-setting } { #2 } + } + } \bool_if:NF \l__crthm_presetname_bool { \endinput } diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index e1f1d02949..b9abdff6f6 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -15,7 +15,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2022/03/02}{1.635} +\ProvidesExplClass{easybook}{2022/03/04}{1.638} {Easily typesetting Chinese theses or books} \bool_set_false:N \l__eb_compile_draft_bool @@ -303,7 +303,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplPackage{easybase}{2022/03/02}{1.635} +\ProvidesExplPackage{easybase}{2022/03/04}{1.638} {Easily typesetting Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -1212,8 +1212,9 @@ \ctex_define:n { list/#1 .meta:nn = { ctex/#1 } {##1} } \cs_new_protected:Npn \eb_toc_entry_if_hang:n #1 { - \bool_if:NT \l__eb_toc_entry_hang_bool + \bool_if:NTF \l__eb_toc_entry_hang_bool { \contentspush } + { \use:n } { \bool_if:NTF \l__eb_toc_number_color_bool { \textcolor{ctex@toc@number} } @@ -1222,7 +1223,7 @@ \tl_use:c { l__eb_toc_#1_after_tl } } } -\cs_new_protected:Npn \eb_toc_assign_keys:n #1 +\cs_new_protected:Npn \RegisterTocName #1 { \ctex_define:n { @@ -1242,7 +1243,7 @@ [\tl_use:c { l__eb_toc_#1_below_tl }] } \seq_map_function:NN -\c__ctex_headings_seq \eb_toc_assign_keys:n +\c__ctex_headings_seq \RegisterTocName \eb_seq_map_inline:nn { figure,table,lstlisting } { @@ -1290,6 +1291,8 @@ lolskip .initial:n = 10pt, between .tl_set:N = \l__eb_toc_main_between_hook_tl, between .initial:n = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-1pc} }, + bibetween .tl_set:N = \l__eb_toc_bimain_between_hook_tl, + bibetween .initial:n = \bool_if:NT \l__eb_class_mode_book_bool { \vspace*{-1pc} }, dotalign .bool_set:N = \l__eb_toc_dot_align_bool, dotalign .default:n = true, dotalign .initial:n = true, @@ -1492,6 +1495,24 @@ multoc .int_set:N = \l__eb_toc_columns_int, multoc .default:n = 2, multoc .initial:n = 1, + plan .choice:, + plan .value_required:n = true, + plan/cn .code:n = + { + \bool_set_true:N \l__eb_toc_plan_cn_bool + \bool_set_false:N \l__eb_toc_plan_bi_bool + }, + plan/bi .code:n = + { + \bool_set_false:N \l__eb_toc_plan_cn_bool + \bool_set_true:N \l__eb_toc_plan_bi_bool + }, + plan/both .code:n = + { + \bool_set_true:N \l__eb_toc_plan_cn_bool + \bool_set_true:N \l__eb_toc_plan_bi_bool + }, + plan .initial:n = cn, columns .meta:n = { multoc = #1 }, title .code:n = \eb_assign_toc_title:n {#1}, bilist .tl_gset:N = \g__eb_bilist_permute_value_tl @@ -1559,11 +1580,16 @@ } { \eb_list_content_cmd_set:nn #1 } \cs_set_eq:NN \listoflistings \listoflstlistings +\ctex_define:n + { + bicontentsname .tl_set:N = \bicontentsname, + bicontentsname .initial:n = Contents + } \RenewDocumentCommand{\tableofcontents}{st+oD(){}} { \group_begin: \tl_set_eq:NN \eb@toc@title \contentsname - \tl_set:Nn \eb@bitoc@title { Contents } + \tl_set_eq:NN \eb@bitoc@title \bicontentsname \tl_set:Nn \eb@toc@title@level { \bool_if:NTF \l__eb_class_mode_book_bool @@ -1571,13 +1597,16 @@ { \section* } } \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} - \IfBooleanF{#1}{\eb@toc@title@level{\eb@toc@title}{}} - \eb_toc_if_title_between_hook:nn {#1} { main } - \eb_toc_start_multi_column_ext:n { toc }#4 - \IfBooleanT{#2} + \bool_if:NT \l__eb_toc_plan_cn_bool { - \IfBooleanF{#1}{\eb@toc@title@level{\eb@bitoc@title}{}} + \IfBooleanF{#1}{\eb@toc@title@level{\eb@toc@title}{}} \eb_toc_if_title_between_hook:nn {#1} { main } + \eb_toc_start_multi_column_ext:n { toc }#4 + } + \bool_if:NT \l__eb_toc_plan_bi_bool + { + \IfBooleanF{#1}{\eb@toc@title@level{\eb@bitoc@title}{}} + \eb_toc_if_title_between_hook:nn {#1} { bimain } \eb_toc_start_multi_column_ext:n { tec } } \group_end: @@ -2273,7 +2302,7 @@ } %</package> %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2022/03/02}{1.635} +\ProvidesExplFile{eb-tcolorbox.cfg}{2022/03/04}{1.638} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf Binary files differindex 20fc2f8bcc..3197e48a69 100644 --- a/macros/latex/contrib/easybook/easybook.pdf +++ b/macros/latex/contrib/easybook/easybook.pdf diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index ee32700153..eac5a47373 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -21,8 +21,8 @@ name = easybook, color-scheme = blue, title = EASYBOOK使用手册, - version = v1.635, - date = 2022/03/02, + version = v1.638, + date = 2022/03/04, authors = 瞿毅, info = 简便地排版中文学位论文或书籍, email = q1jx@foxmail.com, @@ -329,8 +329,14 @@ \subsection{目录命令} \begin{commands} - \command{tableofcontents}[\sarg\oarg{键值列表}\darg{附加代码}] - 文档主目录命令。带有星号参数的命令不输出目录标题。带有 \parg{} 号参数的命令输出双语目录,需要与双语目录标题命令 \cs{bichapter} 等或设置图片、表格和代码等英文目录的标题配合使用。附加代码是中文与英文主目录之间的代码,可以插入目录样式和换页等命令。 + \command{tableofcontents}[\sarg\oarg{键值列表}\darg{代码钩子}] + 文档主目录命令。带有星号参数的命令不输出目录标题。\meta{代码钩子} 是当方案 \keyis{plan}{both} 时中文与英文目录之间执行的代码,可以插入目录样式和换页等命令。 + \begin{options} + \keychoice{plan}{cn,bi,both}\Default{cn}\newtag[Exp]% + 文档主目录的输出方案。\code{cn} 只输出中文目录,\code{bi} 只输出英文目录。\code{both} 同时连续输出中文和英文目录,需要与双语目录标题命令 \cs{bichapter} 等或双语标题选项 \option{title} 配合使用。 + \keyval{bicontentsname}{英文目录标题}\Default{Contents}\newtag% + 英文目录的标题,为通用接口命令 \cs*{ctexset} 的选项。 + \end{options} \command{listoffigures}[\sarg\oarg{键值列表}] 输出图片目录命令。带有星号参数的命令不输出目录标题。 \command{listoftables}[\sarg\oarg{键值列表}] @@ -339,7 +345,7 @@ 输出代码目录命令。带有星号参数的命令不输出目录标题。 \end{commands} -如果需要部分而不是全文的目录或其它类型的目录,可以查看 \pkg*{titletoc} 宏包的相关命令。上面目录命令的可选参数改进了原本单一的功能,其中 \meta{键值列表} 的选项如下: +如果需要部分而不是全文的目录或其它类型的目录,可以查看 \pkg*{titletoc} 宏包的相关示例。如果需要双语图表目录,可以查看 \pkg*{bicaption} 宏包的相关示例。上面目录命令的可选参数改进了原本单一的功能,其中 \meta{键值列表} 的选项如下: \begin{options} \keyval{level}{标题命令}\newtag% 设定输出目录标题的命令。如果使用 \option{title} 选项设置了双语标题则需要配合双语标题命令。 @@ -350,9 +356,9 @@ \keyval{multoc}{整数}\Default{2} 设置目录的排版栏数。\meta{整数} 代表目录栏数,不指定栏数的值则默认为双栏。 \kvsplit{title}{中文目录标题,英文目录标题} - 用于更改目录的标题。标题之间用一个英文逗号分开,也可以只有一部分,表示中文目录的标题。当设置了英文目录标题时,英文目录标题将会自动加入文档主目录 \cs*{tableofcontents}\parg{} 命令。 + 用于更改目录的双语标题。标题之间用一个英文逗号分开,对主目录来说前部分为中文目录标题,后部分为英文目录标题,对图表和代码目录来说后部分则是加入英文目录的条目。也可以只有一部分,表示中文目录的标题。 \keychoice{bilist}{mix,new}\Default{new} - 确定文档主目录中双语标题列表的输出排列方式。选项 \code{mix} 使每个英文标题条目在中文目录中跟随对应的中文标题输出,\code{new} 则新建一个英文目录输出英文标题。 + 确定文档主目录中双语标题列表的输出排列方式。选项 \code{mix} 使每个英文标题条目在中文目录中跟随对应的中文标题输出,\code{new} 则在新建的英文目录中输出英文标题。 \keyval{format}{目录标题格式} 设置目录标题的格式,在标题级别为 \code{chapter} 或者 \cls*{article} 模式且标题级别为 \code{section} 时有效。 \keyval{aftertitle}{标题后代码} @@ -517,7 +523,7 @@ 上下标命令 \cs{supersub} 对应的上下标共同水平偏移量。 \kvsplit{spbcmd}{上标格式,下标格式} 上下标命令 \cs{supersub} 对应的上下标格式命令。以英文逗号分隔为前后两个部分分别设置上下标格式,也可以只有前部分,表示上标的格式。 - \kvsplit{vsep}{上标偏移,下标偏移}\Default{0.6ex}\newtag[Changed]% + \kvsplit{vsep}{上标偏移,下标偏移}\Default{0.6ex} 上下标命令 \cs{supersub} 对应的上下标额外垂直距离。前部分为上标的偏移量,后部分为下标的偏移量。如果只有前部分则上下标各自垂直移动当前值的一半。 \keychoice{halign}{l,c,r}\Default{l} 上下标命令 \cs{supersub} 对应的上下标水平对齐方式,有左 \code{l}、居中 \code{c} 和右 \code{r} 三种对齐方式。 @@ -604,13 +610,13 @@ 参考文献格式使用中国参考文献推荐标准GB/T 7714-2015,对应顺序编码制和著者—出版年制两种风格。若使用其它格式,使用 \hologo{BibTeX} 处理时需确保正确的 \code{bst} 文件,使用 \hologo{biber} 处理可使用 \pkg*{biblatex} 宏包支持的参考文献风格名称。 \keyval{citestyle}{标注风格} 标注参考文献的风格。选项 \keyis{backend}{bibtex} 下可使用 \option{super}(数字上标标注,默认)或 \option{numbers}(数字标注)等 \pkg*{natbib} 宏包带有的标注风格,选项 \keyis{backend}{biblatex} 下可使用 \pkg*{biblatex} 宏包支持的标注风格名称。 - \keyval{datafile}{参考文献数据库列表} + \keyval{datafile}{数据库列表} 参考文献数据库的文件名列表,文件列表以花括号包裹并以英文逗号分隔。使用 \hologo{biber} 处理时要带有 \code{bib} 后缀,若参考文献文件不在当前文件夹则文件名需要包含路径。不设置参考文献数据库名时 \module*{bibset} 模块中的选项会失效,即不自动载入 \pkg*{natbib} 或 \pkg*{biblatex} 宏包,此时需要手动载入相关宏包配置参考文献。 \end{options} \begin{commands} \command{printbibliography}[\oarg{键值列表}] - 两种方式\textbf{均使用}此命令打印参考文献,不同处理后端此命令的 \meta{键值列表} 不同。使用 \hologo{BibTeX} 处理时选项与\ref{sec:document command} 目录的选项相同,使用 \hologo{biber} 处理时常用的选项如下: + 两种方式\textbf{均使用}此命令打印参考文献,不同处理后端此命令的 \meta{键值列表} 不同。使用 \hologo{BibTeX} 处理时选项与\ref{sec:document command} 目录命令的选项相同,使用 \hologo{biber} 处理时常用的选项如下: \begin{options} \keychoice*{heading}{bibliography,subbibliography,bibintoc,subbibintoc}\Default{bibintoc} 参考文献通常有一个章标题或者节标题,该选项选择由 \cs*{defbibheading} 定义的标题名。 @@ -654,15 +660,12 @@ 选项的值为使用 \cs{declaretheoremstyle} 命令新定义的定理样式。 \end{options} - 使用 \cs{declaretheorem} 命令以\ref{exam:new theorem sty} 中的定理样式 \code{mythm} 新建一个定理环境猜想,然后用一个基于 \pkg*{tcolorbox} 宏包的预置彩色盒子 \env{easybox} 增加背景: + 使用 \cs{declaretheorem} 命令以\ref{exam:new theorem sty} 中的定理样式 \code{fancy} 新建一个定理环境猜想,然后用一个基于 \pkg*{tcolorbox} 宏包的预置彩色盒子 \env{easybox} 增加背景: \begin{ctexexam}[labelref = exam:new theorem env] - \declaretheorem[style = mythm,name = 猜想]{caixiang} + \declaretheorem[style = fancy,name = 猜想]{caixiang} \addtotcbstyle{tc-easybox}{colback = GreenYellow} \tcolorboxenvironment{caixiang}{tc-easybox} \end{ctexexam} -\end{commands} - -\begin{commands} \command{declaretheoremstyle}[\oarg{键值列表1}\marg{定理样式}\oarg{键值列表2}] 定理样式声明命令,键值列表支持自身以及定理声明命令 \cs{declaretheorem} 的所有选项。可选参数的 \meta{键值列表1} 与 \meta{键值列表2} 等效,其中支持的选项如下: \begin{options} @@ -687,17 +690,19 @@ \keyval{headformat}{标题排列} 定理标题各组成元素的位置排列和格式。定理标题由定理名、编号和题注组成,\meta{标题排列} 中命令 \cs*{NAME}、\cs*{NUMBER} 和 \cs*{NOTE} 分别代表定理名、编号和题注。 \end{options} + \command{theoremstyle}[\marg{定理样式}] + 设置其后由 \cs{declaretheorem} 命令声明的定理环境的样式。 - 下面定义一个名为 \code{mythm} 的定理样式用于 \cs{declaretheorem} 的 \option*{style} 选项: + 下面定义一个名为 \code{fancy} 的定理样式用于 \cs{declaretheorem} 的 \option*{style} 选项: \begin{ctexexam}[labelref = exam:new theorem sty] - \declaretheoremstyle{mythm}[ - wihin = chapter, - spaceabove = 6pt, - spacebelow = 6pt, - headfont = \normalfont\bfseries, - notefont = \sffamily, - notebraces = {[}{]}, - bodyfont = \itshape + \declaretheoremstyle{fancy}[ + wihin = chapter, + spaceabove = 6pt, + spacebelow = 6pt, + headfont = \normalfont\bfseries, + notefont = \sffamily, + notebraces = {[}{]}, + bodyfont = \itshape ] \end{ctexexam} \end{commands} @@ -816,8 +821,8 @@ \command{setfntsymbol}[\marg{符号表名}] 这两个命令用于在脚注短编号标记为 \code{s} 自定义符号型时设置符号列表。\cs{DefineFntSymbols} 命令用于设置符号列表,\cs{setfntsymbol} 命令用于选择已定义的符号列表。默认的脚注符号列表是空的,定义新列表时应注意 \meta{符号列表} 的写法和命令顺序: \begin{ctexexam} - \DefineFntSymbols{myfnsymb}{2}{{1}{*}{2}{@}} - \setfntsymbol{myfnsymb} + \DefineFntSymbols{fancy}{2}{{1}{*}{2}{@}} + \setfntsymbol{fancy} \ebhdrset{fnmark-num = s} \end{ctexexam} \end{commands} @@ -885,36 +890,22 @@ \subsection{目录样式} \label{subsec:catalog style} -模块 \module*{tocset} 将使用 \pkg*{titletoc} 宏包处理目录样式。模块或扩展包括了 \module*{part}、\module*{chapter}、\module*{section}、\module*{subsection}、\module*{figure}、\module*{table} 和 \module*{lstlisting} 二级路径,而使用 \module*{list} 路径可以统一设置图片、表格和代码目录的样式。选项前带有 \ding{73} 符号表示支持所有相应\textbf{条目级别}的路径,其它选项则处于 \module*{tocset} 路径下。目前支持标准的论文目录样式,更复杂的样式可以查看 \pkg*{titletoc} 的相关用法。 +模块 \module*{tocset} 将使用 \pkg*{titletoc} 宏包处理目录样式。模块或扩展包括了 \module*{part}、\module*{chapter}、\module*{section}、\module*{subsection}、\module*{figure}、\module*{table} 和 \module*{lstlisting} 二级路径,而使用 \module*{list} 路径可以统一设置图片、表格和代码目录的样式。选项前带有 \ding{73} 符号表示支持所有相应\textbf{条目名}的路径,其它选项则处于 \module*{tocset} 路径下。目前支持标准的论文目录样式,更复杂的样式可以查看 \pkg*{titletoc} 的相关用法。 \begin{options} \keyval{tocformat}{条目格式}\dtag\smodule{tocset}% 目录中各级别条目的格式。可以设置条目字体和加入垂直间距等,垂直间距最好使用防止垂直间距重合的 \cs*{addvspace} 命令。 \keyval{tocformat+}{条目格式}\dtag 与选项 \option{tocformat} 用法一样,只是在已有的格式命令后附加代码。 \keyval{tocindent}{刚性长度}\dtag - 目录条目左边的缩进距离,通常条目级别越低缩进越大。 + 目录条目左边的缩进距离,通常标题级别越低缩进越大。 \keyval{tocrule}{引导线命令}\dtag 引导线选项 \option{tocrule} 中一般可以使用基于 \cs*{xleaders} 命令的 \cs{tocrule} 绘制引导线。 \keyval{tocafter}{距离命令}\dtag\Default{\cs*{hspace}\Marg{1em}} 目录条目编号与标题间的代码,默认为插入 \code{1em} 横向距离。 \keyval{tocbelow}{距离命令}\dtag\newtag% 在目录条目下方执行的代码,可以插入垂直距离等命令。 - \keyval{tocline}{条目定义}\dtag + \keyval{tocline}{条目定义}\dtag[\textcolor{red}{\ding{73}}] 这个选项扩展了图片、表格或代码题注在目录文件中的定义。选项中参数 \code{\#1} 代表相应题注编号 \cs*{the}\meta{计数器} 的值,参数 \code{\#2} 代表相应题注内容。 - \begin{ctexexam}[labelref = exam:list command usage] - \ctexset - { - figure/tocline = \listnumberline{figure}#2, - lstlisting/tocline = \protect\numberline{代码#1\hspace{1em}}#2 - } - \end{ctexexam} -\end{options} - -\begin{commands} - \command{tocrule}[\sarg\harg\oarg{引导点间距}\darg{放大因子}\marg{引导点}\oarg{页码格式}] - 生成目录引导线的命令,需要在引导线选项 \option{tocrule} 中使用。带有星号的命令会使当前级别的目录引导线右端与页码相连而不是对齐。带有 \harg{} 号的命令不添加引导线后的目录页码。\meta{引导点间距} 需带有长度单位,\meta{放大因子} 不带单位,为 \meta{引导点} 的放大倍数,\meta{引导点} 一般为英文句号或 \cs*{cdot} 中心点符号。\meta{页码格式} 的代码位于页码前面,可以设置页码字体和距离等,最后一个命令可以带有一个参数,这个参数为页码编号。 - \command{listnumberline}[\marg{条目级别}] - 在图片、表格或代码目录中插入条目编号的命令,默认包含与题注名相同的标签名。其中 \meta{条目级别} 需要显示指定,即为 \code{figure}、\code{table} 或 \code{lstlisting}。关于命令的用法可见\ref{exam:list command usage}。 \begin{ctexexam} \ctexset { @@ -927,15 +918,35 @@ } } \end{ctexexam} +\end{options} + +\begin{commands} + \command{RegisterTocName}[\marg{条目名}]\newtag% + 给 \meta{条目名} 注册上述设置目录样式的选项,选项前有红色的符号 \textcolor{red}{\ding{73}} 表示目前在注册后不可用。 + \command{contentsuse}[\marg{条目名}\marg{扩展名}] + 激活名为 \meta{条目名} 的目录条目定制功能,它使用的目录文件后缀为 \meta{扩展名}。需要在激活条目后再使用命令 \cs{RegisterTocName} 注册选项。 + \command{tocrule}[\sarg\harg\oarg{引导点间距}\darg{放大因子}\marg{引导点}\oarg{页码格式}] + 生成目录引导线的命令,需要在引导线选项 \option{tocrule} 中使用。带有星号的命令会使当前级别的目录引导线右端与页码相连而不是对齐。带有 \harg{} 号的命令不添加引导线后的目录页码。\meta{引导点间距} 需带有长度单位,\meta{放大因子} 不带单位,为 \meta{引导点} 的放大倍数,\meta{引导点} 一般为英文句号或 \cs*{cdot} 中心点符号。\meta{页码格式} 的代码位于页码前面,可以设置页码字体和距离等,最后一个命令可以带有一个参数为页码编号。 + \command{listnumberline}[\marg{条目名}] + 在图片、表格或代码目录中插入条目编号的命令,默认包含与题注名相同的标签名。其中 \meta{条目名} 需要显示指定,即为 \code{figure}、\code{table} 或 \code{lstlisting}。关于命令的用法可见\ref{exam:list command usage}。 + \begin{ctexexam}[labelref = exam:list command usage] + \ctexset + { + figure/tocline = \listnumberline{figure}#2, + lstlisting/tocline = \protect\numberline{代码#1\hspace{1em}}#2 + } + \end{ctexexam} \end{commands} \begin{options} \keybool{hang}\Default{true} - 悬挂缩进选项 \option{hang} 使目录条目为悬挂缩进形式。缩进距离为条目编号及其与标题间距的长度和。这个选项对所有条目级别有效。 + 悬挂缩进选项 \option{hang} 使目录条目为悬挂缩进形式。缩进距离为条目编号及其与标题间距的长度和。这个选项对所有条目名同时生效。 \keyval{lolskip}{弹性长度}\Default{10pt} 代码目录中每章第一个条目上方增加的垂直距离。与 \CTeX 的表格和图片目录中每章间的条目距离选项 \option*{lotskip} 和 \option*{lofskip} 类似,在 \cls*{article} 模式中此选项失效。 \keyval{between}{代码钩子} 目录标题与内容间的钩子(作用于标题下方间距之后),一般插入负的垂直距离代码用于抵消目录首行额外的垂直间距。一级路径此选项对应文档主目录的钩子,二级路径为 \module*{figure}、\module*{table} 和 \module*{lstlisting},或者用位于 \module*{list} 路径的此选项统一设置相应类型目录的钩子。 + \keyval{bibetween}{代码钩子}\newtag% + 与选项 \option{between} 类似,是位于一级路径的英文文档主目录(如果启用)代码钩子。 \keybool{dotalign}\Default{true} 引导线选项 \option{dotalign} 可以使目录引导线右端对齐并与页码保持一定间距,否则会与页码相连。 \keyval{pagenumwd}{刚性长度}\Default{1.55em} @@ -972,13 +983,14 @@ hline{1,6} = {1pt,solid}, hline{3-5} = {LightBlue,dashed}, vline{1,5} = {3-4}{dotted}, - rows = {1cm,abovesep = 2pt} + rows = {1cm,abovesep = 2pt}, + column{1} = {font = \sffamily,mode = math} } - Alpha & Beta & Gamma & Delta \\ - Epsilon & Zeta & Eta & Theta \\ - Iota & Kappa & \SetCell[r = 2]{h,c,Cyan}Lambda & Mu \\ - Nu & Xi & Omicron & Pi \\ - Rho & Sigma & Tau & Upsilon + Alpha & Beta & Gamma & Delta \\ + Epsilon & Zeta & Eta & Theta \\ + Iota & Kappa & \SetCell[r = 2]{h,c,Cyan}Lambda & Mu \\ + Nu & Xi & Omicron & Pi \\ + Rho & Sigma & Tau & Upsilon \end{tblr} \end{ctexexam} \end{environments} @@ -1064,7 +1076,7 @@ \command{addtotcbstyle}[\marg{盒子风格}\marg{键值列表}] 修改已存在的 \pkg*{tcolorbox} 宏包盒子风格。这个命令可以调整以下即将介绍的预置盒子风格,对于预置盒子来说参数 \meta{盒子风格} 即为它们对应的环境或命令名。 \begin{ctexexam} - \deftcbstyle{mytcb} % 新建一个盒子风格mytcb + \deftcbstyle{fancy} % 新建一个盒子风格fancy { colback = Snow,colframe = LimeGreen,coltext = Coral, fontupper = \bfseries,arc = 6pt, @@ -1135,7 +1147,6 @@ \newcommand{\theoremhead}[1]{定理\counteruse[chapter]{theorem}\hspace{1em}#1} \theoremhead{定理内容}\label{thm:theorem} \end{ctexexam} - \command{counterwithin}[\sarg\oarg{格式}\marg{计数器}\marg{父计数器}] 对计数器进行绑定的命令。将 \meta{计数器} 绑定于 \meta{父计数器},即 \meta{父计数器} 的值递增时 \meta{计数器} 的值会归零,输出格式 \cs*{the}\meta{计数器} 被改为 \cs*{the}\meta{父计数器}\code{.}\meta{格式}\marg{计数器}。\meta{格式} 应当为接受计数器值并改变编号形式的命令,默认为 \cs*{arabic}。带有星号参数的命令仅进行绑定不更改输出格式。 \command{counterwithout}[\sarg\oarg{格式}\marg{计数器}\marg{父计数器}] @@ -1242,13 +1253,13 @@ \subsection{插入文档} \begin{commands} \command*{includepdf}[\oarg{键值列表}\marg{文档名}] - 该命令由文档宏包 \pkg*{pdfpages} 提供,可以将其它 \code{pdf} 文档插入当前文档,比如插入其它软件制作的封面。\meta{键值列表} 可以指定插入页数、逻辑页和横向页面等,详情查看宏包文档。 + 该命令由文档宏包 \pkg*{pdfpages} 提供。可以将其它 \code{pdf} 文档插入当前文档,比如插入其它软件制作的封面。\meta{键值列表} 可以指定插入页数、逻辑页和横向页面等,详情查看宏包文档。 \end{commands} \subsection{指定行距的段落} \begin{environments} \environment*{spacing}[\marg{浮点数}] - 该环境由行距宏包 \pkg*{setspace} 提供,可以指定环境内段落的行距,使用 \meta{浮点数} 控制行距倍数。 + 该环境由行距宏包 \pkg*{setspace} 提供。可以指定环境内段落的行距,使用 \meta{浮点数} 控制行距倍数。 \end{environments} \subsection{下划线} @@ -1282,6 +1293,12 @@ \changed \item 目录改用标题级别选项 \option{level} 设定标题命令,不输出标题则使用星号参数。 \end{version} + \begin{version}[v = 1.636,date = 2022/03/03] + \added + \item \cs*{tableofcontents} 命令增加输出方案选项 \option{plan},不再使用 \parg{} 参数输出英文目录。 + \item 增加英文主文档目录钩子选项 \option{bibetween}。 + \end{version} + \shortversion{v = 1.638,date = 2022/03/04,changes = 增加目录条目样式选项注册命令 \cs{RegisterTocName}。} \end{changelog} \nocite{*} diff --git a/macros/latex/contrib/hvpygmentex/Changes b/macros/latex/contrib/hvpygmentex/Changes new file mode 100644 index 0000000000..63758cdc8d --- /dev/null +++ b/macros/latex/contrib/hvpygmentex/Changes @@ -0,0 +1 @@ +0.01 2022-03-03 - first CTAN version diff --git a/macros/latex/contrib/hvpygmentex/README.md b/macros/latex/contrib/hvpygmentex/README.md new file mode 100644 index 0000000000..3755469e29 --- /dev/null +++ b/macros/latex/contrib/hvpygmentex/README.md @@ -0,0 +1,18 @@ +# hvpygmentex.sty + +Formatting source code of programming languages. + +The package is based on pygmentex but provides an automatic +run from within the document itself, with the option "--shell-escape". +It do not needs the additional action by the user to run the external +program pygmentize to create the code snippets. + +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% 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. + +hvoss@tug.org
\ No newline at end of file diff --git a/macros/latex/contrib/hvpygmentex/doc/hvpygmentex.pdf b/macros/latex/contrib/hvpygmentex/doc/hvpygmentex.pdf Binary files differnew file mode 100644 index 0000000000..b28a7c357d --- /dev/null +++ b/macros/latex/contrib/hvpygmentex/doc/hvpygmentex.pdf diff --git a/macros/latex/contrib/hvpygmentex/doc/hvpygmentex.tex b/macros/latex/contrib/hvpygmentex/doc/hvpygmentex.tex new file mode 100644 index 0000000000..6850c477a7 --- /dev/null +++ b/macros/latex/contrib/hvpygmentex/doc/hvpygmentex.tex @@ -0,0 +1,67 @@ +\errorcontextlines=100 +\documentclass[DIV=12]{scrartcl} + +\usepackage{libertinus-otf} +\usepackage[force]{hvpygmentex} +\usepackage{url} +\title{Typeset highlited sourcecode} +\author{Herbert Voß} +\begin{document} +\maketitle + +\section{Introduction} +This package is fully compatible to package \texttt{pygmentex}. Read +the package documentation (\url{http://ctan.org/pkg/pygmentex}) for the +supported languages a.s.o. + +\begin{verbatim} +usepackage[options]{hvpygmentex} +\end{verbatim} + + + +With \texttt{hvpygmentex} one do not needs the external Python run to +create the formatted tex snippets which are inserted into the document. +With the optional argument \texttt{--shell-escape} for the \LaTeX\ run +\TeX\ is allowed to run the external program \texttt{pygmentize} from within the document and +no additional action by the user is required. + +This package itself has an additional option \texttt{force} which is +preset to \texttt{true}. Without using it the external +formatted \TeX\ snippets for the listings will not be recreated by following \LaTeX\ runs. This +may speed up the \LaTeX\ runs and, of course, makes only sense, if you are sure that there +are no changes in the source code listings. + + +\section{Example} + +\begin{pygmented}[lang=tex,font=\ttfamily\small] +\bgroup +\initcatcodetable1 +\aftergroup{\global\catcode`¡=12}% +\catcode`\_=12 \catcode`\^=12 \catcode`\$=12 \catcode`\%=12 \catcode`\#=12 +\catcode`\&=12 \catcode`\{=12 \catcode`\}=12 \catcode`\~=12 \catcode`¡=0 +\catcode`\\=12 +¡savecatcodetable1 +¡egroup +\end{pygmented} + + +This document was run with + +\begin{verbatim} +lualatex --shell-escape hvpygmentex.tex +\end{verbatim} + +In the terminal output you'll find something like + +\begin{verbatim} +[...] +>>>> running pygmentex (option force=true) ... +>>>> ... done. +[...] +\end{verbatim} + + + +\end{document} diff --git a/macros/latex/contrib/hvpygmentex/latex/hvpygmentex.sty b/macros/latex/contrib/hvpygmentex/latex/hvpygmentex.sty new file mode 100644 index 0000000000..b9e7df6f22 --- /dev/null +++ b/macros/latex/contrib/hvpygmentex/latex/hvpygmentex.sty @@ -0,0 +1,412 @@ +%% $Id: hvpygmentex.sty 465 2022-03-03 20:26:42Z herbert $ +%% +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.3 or, at your option, any later version. +%% +% Copyright 2022 Herbert Voss hvoss@tug.org +%% +\ProvidesPackage{hvpygmentex}[% + 2022/03/03 v.0.01 (Herbert Voss) format source code with Pygments (hv)] +%% +%% Based on the package pygmentex, all of my own enhancements are marked with hv +%% +\NeedsTeXFormat{LaTeX2e} +\newif\ifpygmented@opt@force \pygmented@opt@forcefalse %% hv +\DeclareOption{force}{\pygmented@opt@forcetrue} %% hv +\ProcessOptions %% hv + +\RequirePackage{fancyvrb} +\RequirePackage{color} +\RequirePackage{ifthen} +%\RequirePackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption} +\RequirePackage{caption} +\RequirePackage{shellesc} %% hv +\RequirePackage{pgfkeys} +\RequirePackage{efbox} +\RequirePackage[framemethod=tikz]{mdframed} + +%\DeclareCaptionType[within=chapter]{pygcode}[Listagem][Lista de listagens] +\DeclareCaptionType{pygcode}[Listings][List of Listings] +\captionsetup[pygcode]{position=top} + +% ========================================================= +% Auxiliary: +% finding the widest string in a comma +% separated list of strings delimited by parenthesis +% ========================================================= + +% arguments: +% #1) text: a comma separeted list of strings +% #2) formatter: a macro to format each string +% #3) dimension: will hold the result + +\def\widest(#1)#2#3{% + \begingroup + \def\widest@end{\widest@end}% + \def\widest@helper##1,{% + \ifx\widest@end##1\relax + \else + \settowidth\dimen@{#2{##1}}% + \ifdim#3<\dimen@ + \global#3=\dimen@ + \else + \fi + \expandafter\widest@helper + \fi + }% + \widest@helper#1,\widest@end,% + \endgroup +} + +% ========================================================= +% fancyvrb new commands to append to a file +% ========================================================= + +% See http://tex.stackexchange.com/questions/47462/inputenc-error-with-unicode-chars-and-verbatim +\long\def\unexpanded@write#1#2{\write#1{\unexpanded{#2}}} + +\def\VerbatimOutAppend{\FV@Environment{}{VerbatimOutAppend}} + +\def\FVB@VerbatimOutAppend#1{% + \@bsphack + \begingroup + \FV@UseKeyValues + \FV@DefineWhiteSpace + \def\FV@Space{\space}% + \FV@DefineTabOut + \def\FV@ProcessLine{\immediate\unexpanded@write#1}% + \let\FV@FontScanPrep\relax + \let\@noligs\relax + \FV@Scan +} + +\def\FVE@VerbatimOutAppend{% + \endgroup + \@esphack +} + +\DefineVerbatimEnvironment{VerbatimOutAppend}{VerbatimOutAppend}{} + +% ========================================================= +% Main options +% ========================================================= + +\newif\ifpygmented@opt@texcomments +\newif\ifpygmented@opt@mathescape +\newif\ifpygmented@opt@linenos +\newif\ifpygmented@left +\newif\ifpygmented@right + +% some settings used by fancyvrb: +% * for line numbering: +% numbers, numbersep, firstnumber, stepnumber, numberblanklines +% * for selection of lines to print: +% firstline, lastline, + +\pgfkeys{% + /pygmented/.cd, + % + boxing method/.store in = \pygmented@opt@boxing@method, + inline method/.store in = \pygmented@opt@inline@method, + % + lang/.store in = \pygmented@opt@lang, + sty/.store in = \pygmented@opt@style, + escapeinside/.store in = \pygmented@opt@escapeinside, + texcomments/.is if = pygmented@opt@texcomments, + mathescape/.is if = pygmented@opt@mathescape, + % + label/.store in = \pygmented@opt@label, + caption/.store in = \pygmented@opt@caption, + % + gobble/.store in = \pygmented@opt@gobble, + tabsize/.store in = \pygmented@opt@tabsize, + % + linenos/.is if = pygmented@opt@linenos, + linenostart/.store in = \pygmented@opt@linenostart, + linenostep/.store in = \pygmented@opt@linenostep, + linenosep/.store in = \pygmented@opt@linenosep, + % + colback/.store in = \pygmented@opt@colback, + font/.store in = \pygmented@opt@font, + % + force/.default = false, + texcomments/.default = true, + mathescape/.default = true, + linenos/.default = true, +} + +\pgfqkeys{/pygmented}{ + boxing method = mdframed, + inline method = efbox, + sty = default, + linenos = false, + linenosep = 2pt, + font = \ttfamily, + tabsize = 0, +} + +% ========================================================= +% pygmented commands and environments +% ========================================================= + +\newwrite\pygmented@outfile + +\newcount\pygmented@counter + +\newcommand\pygmented@process@options[1]{% + \pgfkeys{% + /pgf/key filters/defined/.install key filter,% + /pgf/key filter handlers/append filtered to/.install key filter handler=\remainingglobaloptions + }% + \def\remainingglobaloptions{}% + \pgfkeysalsofilteredfrom{\pygmented@global@options}% + \pgfkeysalso{% + /pgf/key filter handlers/append filtered to/.install key filter handler=\remaininguseroptions + }% + \def\remaininguseroptions{}% + \pgfqkeysfiltered{/pygmented}{#1}% + % %%%%%%% DEBUGING + % \typeout{}% + % \typeout{\string\pygmented@global@options:}\typeout{\meaning\pygmented@global@options}% + % \typeout{\string\remainingglobaloptions:}\typeout{\meaning\remainingglobaloptions}% + % \typeout{\string\remaininguseroptions:}\typeout{\meaning\remaininguseroptions}% + % + \fvset{gobble=0,tabsize=0}% +} + +\newcommand\pygmented@process@adicional@options[1]{% + \pgfkeysalso{% + /pgf/key filters/false/.install key filter,% + /pgf/key filter handlers/append filtered to/.install key filter handler=\remainingoptions + }% + \def\remainingoptions{}% + \pgfkeysalsofilteredfrom{\remainingglobaloptions}% + \edef\pygmented@saved@{% + \ifcsname pygmented@#1@additional@options\endcsname + \csname pygmented@#1@additional@options\endcsname,% + \fi + }% + \pgfkeysalsofilteredfrom{\pygmented@saved@}% + \pgfkeysalsofilteredfrom{\remaininguseroptions}% + % %%%%%%% DEBUGING + % \typeout{}% + % \typeout{\string\remainingoptions:}% + % \typeout{\meaning\remainingoptions}% +} + +\newcommand\inputpygmented[2][]{% + \begingroup + \pygmented@process@options{#1}% + \immediate\write\pygmented@outfile{<@@pygmented@input@\the\pygmented@counter}% + \immediate\write\pygmented@outfile{\detokenize\expandafter{\pygmented@global@options},\detokenize{#1}}% + \immediate\write\pygmented@outfile{#2}% + \immediate\write\pygmented@outfile{>@@pygmented@input@\the\pygmented@counter}% + % + \csname pygmented@snippet@\the\pygmented@counter\endcsname + \global\advance\pygmented@counter by 1\relax + \endgroup +} + +\newenvironment{pygmented}[1][]{% + \pygmented@process@options{#1}% + \immediate\write\pygmented@outfile{<@@pygmented@display@\the\pygmented@counter}% + \immediate\write\pygmented@outfile{\detokenize\expandafter{\pygmented@global@options},\detokenize{#1}}% + \VerbatimEnvironment + \begin{VerbatimOutAppend}{\pygmented@outfile}% +}{% + \end{VerbatimOutAppend}% + \immediate\write\pygmented@outfile{>@@pygmented@display@\the\pygmented@counter}% + \csname pygmented@snippet@\the\pygmented@counter\endcsname + \global\advance\pygmented@counter by 1\relax +} + +\newcommand\pyginline[2][]{% + \begingroup + \pygmented@process@options{#1}% + \immediate\write\pygmented@outfile{<@@pygmented@inline@\the\pygmented@counter}% + \immediate\write\pygmented@outfile{\detokenize\expandafter{\pygmented@global@options},\detokenize{#1}}% + \DefineShortVerb{#2}% + \SaveVerb + [aftersave={% + \UndefineShortVerb{#2}% + \immediate\write\pygmented@outfile{\FV@SV@pygmented@verb}% + \immediate\write\pygmented@outfile{>@@pygmented@inline@\the\pygmented@counter}% + % + \csname pygmented@snippet@\the\pygmented@counter\endcsname + \global\advance\pygmented@counter by 1\relax + \endgroup + }]% + {pygmented@verb}#2% +} + + +\newcommand\pygmented@snippet@inlined[1]{% + \begingroup + \csname PYstyle\pygmented@opt@style\endcsname + \pygmented@opt@font + \pygmented@process@adicional@options{\pygmented@opt@inline@method}% + \expandafter\expandafter\csname \pygmented@opt@inline@method \endcsname\expandafter[\remainingoptions]{#1}% + \endgroup +} + +\newenvironment{pygmented@snippet@framed}{% + \begingroup + \pygmented@leftmargin\z@ + \ifpygmented@opt@linenos + \expandafter\widest\pygmented@alllinenos{\FormatLineNumber}{\pygmented@leftmargin}% + \advance\pygmented@leftmargin\pygmented@opt@linenosep + \fi + % + \ifdefined\pygmented@opt@label + \def\pygmented@title{% + \captionof{pygcode}{\label{\pygmented@opt@label}\pygmented@opt@caption}% + % \nopagebreak + \vskip -0.7\baselineskip + }% + \else + \ifdefined\pygmented@opt@caption + \def\pygmented@title{% + \captionof{pygcode}{\pygmented@opt@caption}% + % \nopagebreak + \vskip -0.7\baselineskip + }% + \fi + \fi + \ifdefined\pygmented@title + % \nopagebreak[0]% + \pygmented@title + % \nopagebreak + \fi + % + \pygmented@process@adicional@options{\pygmented@opt@boxing@method}% + \expandafter\begin\expandafter{\expandafter\pygmented@opt@boxing@method\expandafter}\expandafter[% + \remainingoptions + ]% + \csname PYstyle\pygmented@opt@style\endcsname + \pygmented@opt@font + % + \noindent + }{% + \end{\pygmented@opt@boxing@method}% + \endgroup +} + +\newcommand\pygmented@inlined[1]{% + \expandafter\efbox\expandafter[\remainingoptions]{#1}% +} + +\def\FormatLineNumber#1{{\rmfamily\tiny#1}} + +\newdimen\pygmented@leftmargin +\newdimen\pygmented@linenosep + +\def\pygmented@lineno@do#1{% + \pygmented@linenosep 0pt% + \csname pygmented@\pygmented@opt@boxing@method @margin\endcsname + \advance \pygmented@linenosep \pygmented@opt@linenosep + \makebox[0pt][r]{% + \FormatLineNumber{#1}% + \hspace*{\pygmented@linenosep}}% +} + +\newcommand\pygmented@tcbox@additional@options{% + nobeforeafter,% + tcbox raise base,% + left=0mm,% + right=0mm,% + top=0mm,% + bottom=0mm,% + boxsep=2pt,% + arc=1pt,% + boxrule=0pt,% + \ifcsname pygmented@opt@colback\endcsname + colback=\pygmented@opt@colback,% + \fi +} + +\newcommand\pygmented@efbox@additional@options{% + \ifcsname pygmented@opt@colback\endcsname + backgroundcolor=\pygmented@opt@colback,% + \fi +} + +\newcommand\pygmented@mdframed@additional@options{% + leftmargin=\pygmented@leftmargin,% + frametitlerule=true,% + \ifcsname pygmented@opt@colback\endcsname + backgroundcolor=\pygmented@opt@colback,% + \fi +} + +\newcommand\pygmented@tcolorbox@additional@options{% + grow to left by=-\pygmented@leftmargin,% + \ifcsname pygmented@opt@colback\endcsname + colback=\pygmented@opt@colback,% + \fi +} + +\newcommand\pygmented@boite@additional@options{% + leftmargin=\pygmented@leftmargin,% + \ifcsname pygmented@opt@colback\endcsname + colback=\pygmented@opt@colback,% + \fi +} + + +\newcommand\pygmented@mdframed@margin{% + \advance \pygmented@linenosep \mdflength{outerlinewidth}% + \advance \pygmented@linenosep \mdflength{middlelinewidth}% + \advance \pygmented@linenosep \mdflength{innerlinewidth}% + \advance \pygmented@linenosep \mdflength{innerleftmargin}% +} + +\newcommand\pygmented@tcolorbox@margin{% + \advance \pygmented@linenosep \kvtcb@left@rule + \advance \pygmented@linenosep \kvtcb@leftupper + \advance \pygmented@linenosep \kvtcb@boxsep +} + +\newcommand\pygmented@boite@margin{% + \advance \pygmented@linenosep \boite@leftrule + \advance \pygmented@linenosep \boite@boxsep +} + +\def\pygmented@global@options{} + +\newcommand\setpygmented[1]{% + \def\pygmented@global@options{/pygmented/.cd,#1}% +} + + +% ========================================================= +% final actions +% ========================================================= + +\AtEndOfPackage{% + \IfFileExists{\jobname.pygmented}{% + \input{\jobname.pygmented}% + }{% + \PackageWarning{pygmentex}{File `\jobname.pygmented' not found.}% + }% + \immediate\openout\pygmented@outfile\jobname.snippets% +} + +%% ------------------------------ hv begin --------------------------- +\AtEndDocument{% + \immediate\closeout\pygmented@outfile% + \ifpygmented@opt@force + \typeout{>>>> running pygmentex (option force=true) ...}% + \ShellEscape{pygmentex \jobname.snippets}% + \typeout{>>>> ... done.}% + \else + \IfFileExists{\jobname.pygmented}% + {\typeout{>>>> file \jobname.pygmented exists, not running pygmentex}}% + {\typeout{>>>> no file \jobname.pygmented, running pygmentex ...}% + \ShellEscape{pygmentex \jobname.snippets}% + \typeout{>>>> ... done.}}% + \fi +} +%% ------------------------------ hv end --------------------------- + +\endinput diff --git a/macros/latex/contrib/msu-thesis/README.md b/macros/latex/contrib/msu-thesis/README.md index 37e6fc2f2e..1f4d7cf16a 100644 --- a/macros/latex/contrib/msu-thesis/README.md +++ b/macros/latex/contrib/msu-thesis/README.md @@ -1,17 +1,17 @@ -# MSU Thesis Class Version 3.0 2021/06/10 +# MSU Thesis Class Version 3.1 2022/03/03 -Copyright 2011-2021 by Alan Munn <amunn@msu.edu> +Copyright 2011-2022 by Alan Munn <amunn@msu.edu> This is a class file for producing dissertations and theses according to the Michigan State University Graduate School Guidelines for Electronic Submission of Master's Theses and Dissertations (March 2020). -The class is based on the memoir document class, and thefore inherits +The class is based on the `memoir` document class, and therefore inherits all of the functionality of that class. ## Installation: -The msu-thesis class is part of both TeXLive and MikTeX, so you should either already have it or should be able to install it with your package manager. +The `msu-thesis` class is part of both TeXLive and MikTeX, so you should either already have it or should be able to install it with your package manager. If you wish to install it locally, follow the directions below: diff --git a/macros/latex/contrib/msu-thesis/msu-thesis.cls b/macros/latex/contrib/msu-thesis/msu-thesis.cls index 8fc9939364..9d6c314e6f 100644 --- a/macros/latex/contrib/msu-thesis/msu-thesis.cls +++ b/macros/latex/contrib/msu-thesis/msu-thesis.cls @@ -155,11 +155,13 @@ % Added global chapter counter for proper hyperrefs to appendices % Added a formatting hook for appendix numbering. We'll see how this works in practice. % Added spacing hooks for bibliographies to make users' lives a little easier +% Version 3.0b 2021/07/14 Added msu@hchap counter for hyperref targets in appendices (unreleased) +% Version 3.1 2022/03/03 Added support for List of Algorithms plus fixes for algorithm2e and algorithmicx etc % % Report bugs/problems/questions to <amunn@msu.edu> % -\def\msu@version{3.0} -\def\msu@date{2021/06/10} +\def\msu@version{3.1} +\def\msu@date{2022/03/03} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{msu-thesis}[\msu@date\space Michigan State University Thesis Class version \msu@version] \newif\ifmsu@dissertation\msu@dissertationtrue % added v2.7 boolean for \msu@thesistype @@ -256,6 +258,8 @@ \newcommand*{\msu@fieldseparator}{\textendash} % this is between the degree name and field of study \newcounter{msu@hchap} % global counter for chapters used by hyperref +% This may also be solved by using \hypersetup{hypertexnames=false} +% hard to tell whether this is a better solution. % make title 2in from top of page @@ -332,6 +336,21 @@ \def\msu@chapfont{\bfseries} \fi +% Support for algorithm packages added v3.1 +% If using the algorithm2e package, you must load it with the algo2e package option +% If you are using algorithmicx or its related versions you should not load +% the algorithm package, but instead load the float package and then style +% your algorithms accordingly using \floatstyle +% Importantly you MUST load float after defining any new lists since it clobbers +% the memoir float methods + + +\newlistof{listofalgorithms}{loa}{List of Algorithms} +\newfloat[chapter]{algorithm}{loa}{Algorithm} +\newlistentry{algorithm}{loa}{0} +\renewcommand*{\cftalgorithmname}{Algorithm\space} +\renewcommand*{\cftalgorithmaftersnum}{\msucaptiondelim} + % % This code technique from http://tex.stackexchange.com/q/232121/ % Makes appendices formatted as sections not chapters in the TOC @@ -663,6 +682,7 @@ \let\msucaptiondelim\@contdelim % Moved to AtBeginDocument to override apacite \@ifpackageloaded{apacite}{\@tocbibfalse}{} % added 6/22/17 +\@ifpackageloaded{algorithm2e}{\let\@chapter=\algocf@original@chapter}{}% undoes algorithm2e redefinition of chapter added v3.1 % Make bibliography spacing more automatic for biblatex and natbib users 2021/06/10 % This should cover most cases. Otherwise just set single spacing \@ifpackageloaded{biblatex} @@ -695,7 +715,7 @@ \l@chapapp{\MakeLinkUppercase #1}{#2}{\cftchaptername}} % Format chapter names \renewcommand*{\l@appendix}[2]{% \l@chapapp{\MakeLinkUppercase #1}{#2}{\cftappendixname}} % Format appendix names (changed 13/12/17) -\apptocmd{\@resets@pp}{\gdef\theHchapter{\Alph{msu@hchap}}}{}{} % get hypertargets in appendices right (added v3.0) +\apptocmd{\@resets@pp}{\gdef\theHchapter{\arabic{msu@hchap}}}{}{} % get hypertargets in appendices right (added v3.0; fixed v3.0b) } % if no hyperref {\relax} diff --git a/macros/latex/contrib/msu-thesis/msu-thesis.pdf b/macros/latex/contrib/msu-thesis/msu-thesis.pdf Binary files differindex 96496dc77b..dac5e635b8 100644 --- a/macros/latex/contrib/msu-thesis/msu-thesis.pdf +++ b/macros/latex/contrib/msu-thesis/msu-thesis.pdf diff --git a/macros/latex/contrib/msu-thesis/msu-thesis.tex b/macros/latex/contrib/msu-thesis/msu-thesis.tex index 5afea970ad..518060fe70 100644 --- a/macros/latex/contrib/msu-thesis/msu-thesis.tex +++ b/macros/latex/contrib/msu-thesis/msu-thesis.tex @@ -2,8 +2,8 @@ \documentclass[11pt]{article} -\def\msuversion{3.0} -\def\msudate{2021/06/10} +\def\msuversion{3.1} +\def\msudate{2022/03/03} \title{\textbf{Using the MSU Thesis Class}} \author{\textbf{Alan Munn}\\Department of Linguistics and Languages\\\texttt{\href{mailto:amunn@msu.edu}{amunn@msu.edu}}} \date{Version \msuversion\\\msudate} @@ -181,7 +181,7 @@ The \pkg{memoir} class replicates the functionality of many independent packages \subsubsection{Caption delimiter} Because the thesis office doesn't understand anything about punctuation it requires the colon that would appear in a caption to also appear in the contents lists. Since they don't care about the colon itself, but just consistency I've removed colons from the captions entirely, since leaving it in makes the contents lists look really stupid. But in case you or your advisor want the colon in captions, you can add the colon back in by using the Memoir command |\captiondelim{:\space}| and the class will make sure the Lists of Tables and Figures match in formatting. \subsubsection{New lists} -If you are using other kinds of floats such as listings, you should use the Memoir |\newlistof| command to make the relevant list. The class provides a macro |\msucaptiondelim| which can be used to make sure the formatting of the captions in the list-of-X match the setting you have for Figures and Tables. Here is an example of how you would add a listings list. The following code goes in your preamble: +If you are using other kinds of floats such as listings, you should use the Memoir |\newlistof| command to make the relevant list. The class provides a macro |\msucaptiondelim| which can be used to make sure the formatting of the captions in the list-of-X match the setting you have for Figures and Tables. Here is an example of how you would add a listings list. For lists of algorithms, see section \ref{algorithms} below. The following code goes in your preamble: \begin{quote} \begin{lstlisting} \newlistof{listoflistings}{lol}{List of Listings} @@ -213,6 +213,25 @@ Another common kind of list is a List of Abbreviations. The thesis office seems Your list of abbreviations here. \end{lstlisting} \end{quote} + +\subsection{Algorithm packages\label{algorithms}} +Because the various algorithm formatting packages such as \pkg{algorithm2e} and \pkg{algorithmicx} (or its related packages) sometimes create incompatibilities with the \pkg{memoir} float methods, the class provides you with floating |{algorithm}| environment and the corresponding list of algorithms, so you do not have to create your own list of algorithms. Here are some specific important points about using \pkg{algorithm2e} and \pkg{algorithmicx}. +\begin{itemize}[label=\textbullet] +\item Do \emph{not} load the \pkg{algorithm} package. +\item If you use the \pkg{algorithm2e} package you \emph{must} load it with the |[algo2e]| option (along with any other options you need). +\end{itemize} +\subsubsection{\pkg{algorithmicx} package} If you are using the \pkg{algorithmicx} package, any of its related packages (including its older predecessor \pkg{algorithmic}) which suggest that you use the \pkg{algorithm} package to create floating algorithms, you can load the \pkg{float} package to use the its float styling capabilities instead of loading the \pkg{algorithm} package. You should \emph{not} however use the \pkg{float} package to create new floating environments. You must use the \pkg{memoir} methods to create new floating environments and only then load the \pkg{float} package. + +If you would normally load the \pkg{algorithm} package to create floating algorithms do the following instead. If you are creating any other new floating environments (like listings as described above) you \emph{must} create these environments first \emph{before} loading the \pkg{float} package otherwise your document will not compile. +\begin{quote} +\begin{lstlisting} +% This code should only appear AFTER you have created any other new lists +\usepackage{float} +\floatstyle{ruled}% or any of the predefined float styles +\restylefloat{algorithm} +\end{lstlisting} +\end{quote} + \subsection{The \pkg{microtype} package and contents lists} If you use the \pkg{microtype} package with |protrusion| set, it’s best to turn it off before your contents lists. You can do this by using |\microtypesetup{protrusion=false}| before the contents lists and |\microtypesetup{protrusion=true}| afterwards. Schematically: @@ -276,10 +295,11 @@ Appendix text goes here \end{quote} \subsubsection{Appendices per chapter} -If you need to add an appendix or appendices to a chapter, you must use the \pkg{[chapterapp]} class option. The code for the appendices themselves is exactly as described above. +If you need to add an appendix or appendices to a chapter, you must use the \pkg{[chapterapp]} class option. The code for the appendices themselves is exactly as described above. Note that per-chapter appendices should \emph{not} be preceded by the |\backmatter| command, which should only precede the global bibliography or appendices. \subsection{Bibliographies} -The class places no constraints on how you do your bibliography. If you have per-chapter bibliographies, you must use the |[chapterbib]| class option. Before any bibliography (whether global or per-chapter) you should use the |\makebibliographypage| command. +The class places no constraints on how you do your bibliography. If you have per-chapter bibliographies, you must use the |[chapterbib]| class option. Before any bibliography (whether global or per-chapter) you should use the |\makebibliographypage| command. Note that per-chapter bibliographies should \emph{not} be preceded by the |\backmatter| command, which should only precede the global bibliography or appendices. + \subsubsection{Bibliography spacing}\label{bibspacing} Please note that although bibliography entries must be single spaced, there must be a space between each entry. This parameter is set by your bibliography package and not by the class itself. If you are using \pkg{natbib} or \pkg{biblatex} these spacing parameters are set for you by the class. If you are using another package for your bibliography you are responsible for adjusting the relevant spacing parameters. @@ -311,9 +331,9 @@ The latest copy of \pkg{msu-thesis} will always be available on \href{https://c \subsection{Archiving your thesis for the future} Since the current version of the \pkg{msu-thesis} class satisfies the Graduate School requirements at any one time, as these requirements change, you may find that if you need to recompile your thesis after you have graduated that the formatting changes. To avoid this, I would recommend saving an archived version of the \pkg{msu-thesis.cls} file in the same folder as your thesis file. You only need to do this once you have completely finished your thesis however; there's no need to do it during the writing process. \subsection{Version history} -Previous versions of \pkg{msu-thesis} (versions 1.0--1.4b) were created for non-electronic submission and should not be used. Versions 1.5--1.6 (the first electronic submission versions) contained a |\makeabstract| command and a separate |msuabstract| environment. These have been removed as of version 1.7. Users who are upgrading from earlier versions to version 1.7 do not need to change these commands however but their use will trigger a warning.) Version 2.0 implemented landscape pages; version 2.1 added support for \pkg{hyperref}. Versions 2.2--2.5 mainly accommodated to the ever changing whims of the MSU Graduate School. Version 2.6 fixed some appendix bugs introduced by the previous whim accommodation. Version 2.7 fixed various small spacing issues, fixed a bug which prevented a new chapter page to be a landscape page, added support for the \pkg{apacite} package, and updated degree options. Version 2.8 fixed some spacing and capitalization issues and added support for the public abstract. Version 2.9 removed subscript/superscript size restrictions, added font size options and made small spacing changes to appease the thesis office. Version 3.0 added full support for per-chapter bibliographies and appendices, and automated bibliography spacing for |natbib| and |biblatex| produced bibliographies. +Previous versions of \pkg{msu-thesis} (versions 1.0--1.4b) were created for non-electronic submission and should not be used. Versions 1.5--1.6 (the first electronic submission versions) contained a |\makeabstract| command and a separate |msuabstract| environment. These have been removed as of version 1.7. Users who are upgrading from earlier versions to version 1.7 do not need to change these commands however but their use will trigger a warning.) Version 2.0 implemented landscape pages; version 2.1 added support for \pkg{hyperref}. Versions 2.2--2.5 mainly accommodated to the ever changing whims of the MSU Graduate School. Version 2.6 fixed some appendix bugs introduced by the previous whim accommodation. Version 2.7 fixed various small spacing issues, fixed a bug which prevented a new chapter page to be a landscape page, added support for the \pkg{apacite} package, and updated degree options. Version 2.8 fixed some spacing and capitalization issues and added support for the public abstract. Version 2.9 removed subscript/superscript size restrictions, added font size options and made small spacing changes to appease the thesis office. Version 3.0 added full support for per-chapter bibliographies and appendices, and automated bibliography spacing for |natbib| and |biblatex| produced bibliographies. Version 3.1 added support for an |{algorithm}| environment and a list of algorithms to combat incompatibilities with the \pkg{algorithm} and \pkg{algorithm2e} packages. \section{Acknowledgements} -Thanks to Lars Madsen, Ulrike Fischer and Peter Wilson for help with setting up parts of the memoir code for versions 1.0--1.4 (now eliminated due to changed requirements). Thanks to Wolfgang Sternefeld for supplying the \pkg{linguex} spacing fix code, Leo Liu for the landscape page numbering code, which greatly simplified my original version, and Florent Chervet for the \pkg{hyperref} code. Thanks also to the following students who have reported problems over the years: Irina Agafonova, Ali Al-jiboory, Dmitriy Bryndin, Greg Christian, Kyle Crayne, Matt Husband, Changkuk Jung, Adam Liter, William Muir, Alicia Parrish, Neil ver Planck, Adam Soliman, Erik Stitt, Michael Wojcik, Eremey Valetov, Matthew Vincent and Yisu Zhou. A special thank you to Non Thongprong who graciously provided a copy of his entire thesis which allowed me to debug some especially subtle spacing inconsistencies. +Thanks to Lars Madsen, Ulrike Fischer and Peter Wilson for help with setting up parts of the memoir code for versions 1.0--1.4 (now eliminated due to changed requirements). Thanks to Wolfgang Sternefeld for supplying the \pkg{linguex} spacing fix code, Leo Liu for the landscape page numbering code, which greatly simplified my original version, and Florent Chervet for the \pkg{hyperref} code. Thanks also to the following students who have reported problems over the years: Irina Agafonova, Ali Al-jiboory, Julian Blank, Dmitriy Bryndin, Greg Christian, Kyle Crayne, Ciaron Hamilton, Matt Husband, Changkuk Jung, Adam Liter, William Muir, Alicia Parrish, Neil ver Planck, Adam Soliman, Erik Stitt, Michael Wojcik, Eremey Valetov, Matthew Vincent and Yisu Zhou. A special thank you to Non Thongprong who graciously provided a copy of his entire thesis which allowed me to debug some especially subtle spacing inconsistencies. \appendix \renewcommand{\thesection}{Appendix \Alph{section}} diff --git a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-template.tex b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-template.tex index c82f6e0020..198c170a03 100644 --- a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-template.tex +++ b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-template.tex @@ -1,5 +1,5 @@ % This is a template for use with the MSU Thesis class -% Vesion 3.0 2021/06/10 +% Version 3.1 2022/03/03 % % Class options: %[PhD] Doctor of Philosophy (default) @@ -107,7 +107,11 @@ Your acknowledgements here. \listoffigures % comment this out if you have no figures % % If you have a list of abbreviations/symbols it would go here preceded by a \clearpage -% See the class documentation and the Memoir manual for how to create other lists +% See the class documentation and the Memoir manual for how to create other lists +% +% If you are using an algorithm formatting package (e.g. algorithmicx or algorithm2e) +% please read the class documentation carefully on how to use these packages with the class +% The class provides an {algorithm} environment and a \listofalgorithms by default % \mainmatter % @@ -115,6 +119,9 @@ Your acknowledgements here. % May violate thesis office rules %\addtocontents{toc}{\protect\renewcommand{\protect\cftchapterdotsep} {\cftnodots}} +% ALL documents using this class must have \chapter divisions +% If you are using it for an MA/MS thesis you still need to have chapters, even if they are very small. + \chapter{Your first chapter} % % If you have pages that must appear in landscape mode, use the [lscape] documentclass option @@ -143,7 +150,9 @@ Your acknowledgements here. % % If each chapter has its own set of appendices, then load the class with the [chapterapp] option % and put your {appendix} or {appendices} environments at the end of each chapter. -% +% You should not use the \backmatter command before per-chapter material +% +% There should only be ONE \backmatter command in your document, and it should separate only the thesis from the bibliography \backmatter % The next lines add the dots back into the References/Bibliography heading % of the TOC. Only uncomment this if you need to put the dots back in having removed them for Chapter headings. @@ -166,6 +175,7 @@ Your acknowledgements here. % If you need per-chapter bibliographies, you need to use the [chapterbib] % class option and you would use \makebibliographypage before each % chapter level bibliography and then the relevant bibliography command +% You should not use the \backmatter command before per-chapter material % \end{document} diff --git a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf Binary files differindex 1370069e3f..d19cfa3677 100644 --- a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf +++ b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf diff --git a/macros/latex/contrib/njustthesis/README.md b/macros/latex/contrib/njustthesis/README.md new file mode 100644 index 0000000000..7026370d43 --- /dev/null +++ b/macros/latex/contrib/njustthesis/README.md @@ -0,0 +1,134 @@ +# njustthesis + +Thesis template for [NJUST](https://njust.edu.cn). + +## Dependent + +### Required + +- A `LaTex` distribution. Such as + [texlive](https://github.com/TeX-Live/texlive-source). +- [cnlogo](https://github.com/yuxtech/cnlogo/) provides the logos of many + Chinese Universities. + +## Install + +### Use Package Manager + +```shell +tlmgr install njustthesis +``` + +### Install From Source Code + +```shell +l3build install +``` + +## Customize + +Default values: + +```latex +\njustsetup{ + logo = \njustwhole[njust][0.5], % depend on cnlogo + cover-title = 毕业设计说明书, + author = 佚名, + id = 916101630000, + department = 电子工程与光电技术学院, + discipline = 电子工程与光电技术, + title = , + subtitle = , + supervisor = 张三, + associate-supervisor = 李四, + judge = 王五, + supervisor-title = 教授, + associate-supervisor-title = 教授, + judge-title = 教授, + year = \the\year, % the time of paper + month = \the\month, + day = \the\day, + abstract-prefix = 毕业论文, + signature = , + signature* = , % star means english + abstract-prefix = 毕业论文, + title* = , + subtitle* = , + header-title = 本科毕业设计说明书, +} +``` + +**Note**: Add `{}` around the string which contain ' ','=', and','. + +Example: + +```latex +\documentclass{njustthesis} +\njustsetup{% + author = 张不三, + id = 916101630000, + discipline = 电子信息工程, + title = {论文名字带逗号,或空格 }, + subtitle = 所以加花括弧括起来, + title* = {English name}, + supervisor = , + supervisor-title = 教授, + judge = , + % signature = \includegraphics{signature.pdf}, + judge-title = 教授, +} +\usepackage{subfiles} +\begin{document} + +\maketitle + +\frontmatter +\tableofcontents +\listoffigures +\listoftables + +\mainmatter% +% \subfile{subfiles/chapter1.tex} + +\backmatter% +% \bibliography{refs/main.bib} + +\appendix +% \subfile{subfiles/appendix1.tex} + +\end{document} +``` + +See more [examples](https://github.com/Freed-Wu?tab=repositories&q=njust&language=tex). + +## Tips + +```shell +texdoc njusthesis +``` + +## Todo + +- [pandoc](https://github.com/jgm/pandoc) template for user can + write markdown then convert it to latex. +- Change format from `ctexbook` to `ctexart` in order to use + `beamerarticle.sty` more conveniently. + +## FAQ + +Q: Why another wheel? + +A: Because former wheels cannot satisfy me. Some even only provide a +`*.tex` not `*.cls`. So crude. + +Q: 100% compatible with official `docx` template? + +A: If you find something unreasonable, welcome to pull request! + +More questions see [issues](https://github.com/Freed-Wu/njustthesis/issues). + +## Reference + +- [thuthesis](https://github.com/tuna/thuthesis) May be the best thesis + template among all Chinese theses. Any one can learn something from it. Such + as literate programming, separation of content and presentation, etc. diff --git a/macros/latex/contrib/njustthesis/njustthesis.dtx b/macros/latex/contrib/njustthesis/njustthesis.dtx new file mode 100644 index 0000000000..1a7180ec0f --- /dev/null +++ b/macros/latex/contrib/njustthesis/njustthesis.dtx @@ -0,0 +1,635 @@ +% \iffalse +%<*driver> +\ProvidesFile{njustthesis.dtx}[2022-03-04 0.0.1] +\documentclass{ltxdoc} +\usepackage{hypdoc} +\usepackage[scheme=plain]{ctex} +\usepackage[citations, definitionLists, fencedCode, footnotes, hashEnumerators, +html, inlineFootnotes, pipeTables, tableCaptions]{markdown} +\EnableCrossrefs% +\CodelineIndex% +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% \title{njustthesis 0.0.1} +% \author{wzy} +% \maketitle +% \tableofcontents +% \IfFileExists{./README.md}{\markdownInput{README.md}}{} +% \IndexPrologue{\section{\indexname}} +% \StopEventually{\PrintIndex} +% \appendix +% \section{Implement}% +% \label{sec:Implement} +% \begin{macrocode} +%<*cls|sty> +% Fakechapter information +\@ifundefined{NeedsTeXFormat}{% 2.09 version +%<cls> \def\filename{njustthesis.cls} +%<sty> \def\filename{njustthesis.sty} + \def\filedate{2022-03-04} + \def\fileversion{0.0.1} + \typeout{Package: `\filename' \fileversion<\filedate>} +}{% 2e version + \NeedsTeXFormat{LaTeX2e}[1994/12/01] + \ProvidesClass{njustthesis}[2022-03-04 0.0.1] +} + +% Fakechapter kvset +\RequirePackage{kvdefinekeys} +\RequirePackage{kvsetkeys} +\RequirePackage{kvoptions} +\SetupKeyvalOptions{% + family = njust, + prefix = njust@, + setkeys = \kvsetkeys, +} +\newcommand\njustsetup{% + \kvsetkeys{njust} +} +\newcommand\njust@define@key[1]{% + \kvsetkeys{njust@key}{#1} +} +\newcommand\njust@error[1]{% +%<cls> \ClassError{njustthesis}{#1}{} +} +\kv@set@family@handler{njust@key}{% + \@namedef{njust@#1@@name}{#1} + \def\njust@@default{} + \def\njust@@choices{} + \kv@define@key{njust@value}{name}{% + \@namedef{njust@#1@@name}{##1} + } + \kv@define@key{njust@value}{code}{% + \@namedef{njust@#1@@code}{##1} + } + \@namedef{njust@#1@@check}{} + \@namedef{njust@#1@@code}{} + \@namedef{njust@#1@@hook}{% + \expandafter + \ifx\csname\@currname.\@currext-h@@k\endcsname\relax + \@nameuse{njust@#1@@code} + \else + \AtEndOfClass{% + \@nameuse{njust@#1@@code} + } + \fi + } + \kv@define@key{njust@value}{choices}{% + \def\njust@@choices{##1} + \@namedef{njust@#1@@reset}{} + \@namedef{njust@#1@@check}{% + \@ifundefined{% + ifnjust@\@nameuse{njust@#1@@name}@\@nameuse{njust@\@nameuse{njust@#1@@name}} + }{% + \njust@error{Invalid value ``#1 = \@nameuse{njust@\@nameuse{njust@#1@@name}}''} + } + \@nameuse{njust@#1@@reset} + \@nameuse{njust@\@nameuse{njust@#1@@name}@\@nameuse{njust@\@nameuse{njust@#1@@name}}true} + } + } + \kv@define@key{njust@value}{default}{% + \def\njust@@default{##1} + } + \kvsetkeys{njust@value}{#2} + \@namedef{njust@\@nameuse{njust@#1@@name}}{} + \kv@set@family@handler{njust@choice}{% + \ifx\njust@@default\@empty + \def\njust@@default{##1} + \fi + \expandafter\newif\csname ifnjust@\@nameuse{njust@#1@@name}@##1\endcsname + \expandafter\g@addto@macro\csname njust@#1@@reset\endcsname{% + \@nameuse{njust@\@nameuse{njust@#1@@name}@##1false} + } + } + \kvsetkeys@expandafter{njust@choice}{\njust@@choices} + \expandafter\let\csname njust@\@nameuse{njust@#1@@name}\endcsname\njust@@default + \expandafter + \ifx\csname njust@\@nameuse{njust@#1@@name}\endcsname\@empty + \else + \@nameuse{njust@#1@@check} + \@nameuse{njust@#1@@hook} + \fi + \kv@define@key{njust}{#1}{% + \@namedef{njust@\@nameuse{njust@#1@@name}}{##1} + \@nameuse{njust@#1@@check} + \@nameuse{njust@#1@@hook} + } +} +\newcommand\njust@addto[2]{% + \expandafter\g@addto@macro\csname njust@#1@@code\endcsname{#2} +} + +% Fakechapter default +\njust@define@key{% + logo = {% + default = \njustwhole[njust][0.5], + }, + cover-title = {% + name = cover@title, + default = {毕业设计说明书}, + }, + author = {% + default = {佚名}, + }, + id = {% + default = {916101630000}, + }, + department = {% + default = {电子工程与光电技术学院}, + }, + discipline = {% + default = {电子工程与光电技术}, + }, + title = {% + }, + subtitle = {% + }, + supervisor = {% + default = {张三}, + }, + associate-supervisor = {% + name = associate@supervisor, + }, + judge = {% + default = {王五}, + }, + supervisor-title = {% + name = supervisor@title, + default = {教授}, + }, + associate-supervisor-title = {% + name = associate@supervisor@title, + }, + judge-title = {% + name = judge@title, + default = {教授}, + }, + year = {% + default = \the\year, + }, + month = {% + default = \the\month, + }, + day = {% + default = \the\day, + }, + signature = {% + default = \makebox[4em]{}, + }, + signature* = {% + name = signature@teacher, + default = \makebox[4em]{}, + }, + abstract-prefix = {% + name = abstract@prefix, + default = {毕业论文}, + }, + title* = {% + name = title@en, + }, + subtitle* = {% + name = subtitle@en, + }, + header-title = {% + name = header@title, + default = {本科毕业设计说明书}, + }, +} +%</cls|sty> + +%<*cls> +% Fakechapter class +\ProcessKeyvalOptions* +\LoadClass[ + twoside, + openright, + UTF8, + heading = true, + scheme = plain, + zihao = -4, + sub4section, +]{ctexbook} +\ctexset{% + today = small, + chapter = {% + name = {}, + number = \arabic{chapter}, + aftername = \hspace{1\ccwd}, + format = \ifthenelse{\value{chapter}=0}{\centering}{} + \zihao{3}\heiti\bfseries, + beforeskip = 0.5\ccwd, + afterskip = 0.5\ccwd, + }, + section = {% + aftername = \hspace{1\ccwd}, + format = \ifthenelse{\value{chapter}=0}{\centering}{} + \zihao{-3}\heiti\bfseries, + beforeskip = 0.5\ccwd, + afterskip = 0.5\ccwd, + }, + subsection = {% + format = \zihao{4}\heiti\bfseries, + }, + appendixname = 附录, + contentsname = {目\hspace{\ccwd}次}, + listfigurename = 插图索引, + listtablename = 表格索引, + figurename = 图, + tablename = 表, + bibname = 参考文献, + indexname = 索引, +} +\counterwithout{figure}{chapter} +\counterwithout{table}{chapter} +\counterwithout{equation}{chapter} + +% Fakechapter package +% Fakesection text +% Fakesubsection punctuation +\RequirePackage{csquotes} +% Fakesubsubsection 中文引号 +\DeclareQuoteStyle{zh} +{\symbol{"201C}}%“ +{\symbol{"201D}}%” +{\symbol{"2018}}%‘ +{\symbol{"2019}}%’ +\setquotestyle{zh} +% Fakesubsubsection 日文引号 +\DeclareQuoteStyle{ja} +{\symbol{"300E}}%『 +{\symbol{"300F}}%』 +{\symbol{"300C}}%「 +{\symbol{"300D}}%」 +% Fakesubsubsection 书名号 +\DeclareQuoteStyle{book} +{\symbol{"300A}}%《 +{\symbol{"300B}}%》 +{\symbol{"3008}}%〈 +{\symbol{"3009}}%〉 +% Fakesubsection indent +\RequirePackage{indentfirst} +% Fakesubsection space +\RequirePackage{setspace} + +% Fakesection style +% Fakesubsection toc +\RequirePackage{titletoc} +\titlecontents{chapter}[0pt]{\filright}{\contentspush{\thecontentslabel}}{} +{\titlerule*{.}\contentspage} +\RequirePackage[nottoc]{tocbibind} +% Fakesubsection header +\RequirePackage{fancyhdr} +\fancypagestyle{njust@fancy}{% + \renewcommand{\headrulewidth}{0.4pt} + \fancyhead[OC, EC]{\zihao{-2}\njust@header@title} + \fancyhead[EL, OR]{\zihao{5}第\thepage~页} + \fancyhead[ER, OL]{} + \fancyfoot[EC, OC]{} +} +\fancypagestyle{plain}{% + \pagestyle{njust@fancy} +} +\pagestyle{njust@fancy} + +% Fakesubsection footnote +\RequirePackage{pifont} +\RequirePackage[ + perpage, + symbol* +]{footmisc} +\DefineFNsymbols{circled}{% + {\ding{192}} + {\ding{193}} + {\ding{194}} + {\ding{195}} + {\ding{196}} + {\ding{197}} + {\ding{198}} + {\ding{199}} + {\ding{200}} + {\ding{201}} +} +\setfnsymbol{circled} +% Fakesubsection reference +\RequirePackage[ + square, comma, numbers, super, sort&compress, longnamesfirst, sectionbib, + nonamebreak +]{natbib} +\bibliographystyle{gbt7714-plain} + +% Fakesection figure +\RequirePackage{graphicx} +\graphicspath{% + {fig/} + {fig/\arabic{chapter}/} + {figures/} + {figures/\arabic{chapter}/} + {images/} +} +\RequirePackage[njust]{cnlogo} + +% Fakesection formula + +% Fakesection table +\RequirePackage{tabu} +\RequirePackage{multicol} + +% Fakesubsection math +\RequirePackage{newtxmath} +\setlength{\abovedisplayskip}{0.5em} +\setlength{\belowdisplayskip}{0.5em} +% Fakesubsection exercise +\RequirePackage{exercise} +\renewcommand{\ExerciseName}{问题} +\renewcommand{\AnswerName}{回答} +\renewcommand{\listexercisename}{问题} + +% Fakesection item +\RequirePackage{enumitem} +\setlist[enumerate, 1]{% + fullwidth, + label = (\arabic*), + font = \textup, + itemindent = 2em, +} +\setlist[enumerate, 2]{% + fullwidth, + label = (\alph*), + font = \textup, + itemindent = 4em, +} + +% Fakesection other +\RequirePackage{boxedminipage} + +\title{\njust@title} +\author{\njust@author} + +% Fakechapter command +\renewcommand\maketitle{% + \thispagestyle{empty} + \begin{titlepage} + \centering + \begin{spacing}{1} + \zihao{4} + \vspace{0.5\ccwd} + + \vspace{1\ccwd} + + \fontsize{30pt}{30pt}\selectfont\kaishu% + \njust@logo + + \vspace{0.2\ccwd} + + \fontsize{45pt}{45pt}\selectfont\heiti% + \njust@cover@title + + \zihao{-1} + \vspace{1\ccwd} + \end{spacing} + + \begin{spacing}{1.5} + \zihao{3} + \begin{tabu} + {@{}X[r, 5cm]@{}X[l, 3cm] + X[r, 4cm]@{}X[l, 4cm]@{}} + \textbf{作 者:} & + \underline{\makebox[3cm][c]{\kaishu\njust@author}} & + \textbf{学 号:} & + \underline{\makebox[4cm][c]{\kaishu\njust@id}} \\ + \textbf{学 院:} & + \multicolumn{3}{c}{\underline{\makebox[11cm][c] + {\kaishu\njust@department}}} \\ + \textbf{专业(方向):} & + \multicolumn{3}{c}{ + \underline{\makebox[11cm][c]{\kaishu\njust@discipline}}} \\ + \textbf{题 目:} & + \multicolumn{3}{c}{ + \underline{\makebox[11cm][c]{\kaishu\njust@title}}} \\ + \textbf{} & + \multicolumn{3}{c}{ + \underline{\makebox[11cm][c]{\kaishu\njust@subtitle}}} + \end{tabu} + \vspace{0em} + \end{spacing} + + \begin{spacing}{1} + \zihao{3} + \vspace{1\ccwd} + + \zihao{-3} + \textbf{指导者:}\underline{\makebox[15.5\ccwd][c]{\njust@supervisor\hspace{1em}\njust@supervisor@title}} + + \hspace{5em} + + \phantom{指导者:}\underline{\makebox[15.5\ccwd][c]{\njust@associate@supervisor\hspace{1em}\njust@associate@supervisor@title}} + + \hspace{5em} + + \textbf{评阅者:}\underline{\makebox[15.5\ccwd][c]{\njust@judge\hspace{1em}\njust@judge@title}} + + \hspace{5em} + + \zihao{-2} + \njust@year 年\njust@month 月 + \end{spacing} + \vspace{0em} + \end{titlepage} +} + +\newcommand\copyrightpage{% + \newpage + \thispagestyle{empty} + \begin{center} + \heiti\zihao{3}声\hspace{2\ccwd}明 + \end{center} + + \begin{spacing}{1.5} + \zihao{4} + + 我声明,本\njust@abstract@prefix 及其研究工作和所取得的成果是本人在导师的指导 + 下独立完成的。研究过程中利用的所有资料均已在参考文献中列出,其他人员或机 + 构对本\njust@abstract@prefix 工作做出的贡献也已在致谢部分说明。 + + 本\njust@abstract@prefix 不涉及任何秘密,南京理工大学有权保存其电子和纸质文档 + ,可以借阅或网上公布其部分或全部内容,可以向有关部门或机构送交并授权保存 + 、借阅或网上公布其部分或全部内容。 + + \vspace{2\ccwd} + + \begin{flushright} + 学生签名:\njust@signature + + \vspace{1\ccwd} + + \njust@year 年\njust@month 月\njust@day 日 + + \vspace{2\ccwd} + + 指导教师签名:\njust@signature@teacher + + \vspace{1\ccwd} + + \njust@year 年\njust@month 月\njust@day 日 + \end{flushright} + \end{spacing} + \clearpage +} + +\newcommand\reviewpage{% + \begin{tabu}to.75\linewidth{@{}|X[l]|X[l]|@{}} + \hline + 论文选题符合课程考核要求,具有一定的理论意义和实用价值,作者阅读较广泛,参考文献较充足。 +& +\begin{tabu}{@{}X[l]@{}} + 很好$ \square $ 较好$ \square $ + + 一般$ \square $ 尚可$ \square $ + + 差$ \square $ +\end{tabu} + +\hline +论文观点正确,结构较合理,层次较清晰,逻辑性强,论述较全面,工作量较充实,结论具有一定的现实指导意义。 +& +\begin{tabu}{@{}X[l]@{}} + 很好$ \square $ 较好$ \square $ + + 一般$ \square $ 尚可$ \square $ + + 差$ \square $ +\end{tabu} + +\hline +该生平时学习较认真,善于思考,到课率高,不迟到早退。文章语言表达较好,格 +式符合规范要求,体现了较好的学风。 +& +\begin{tabu}{@{}X[l]@{}} + 很好$ \square $ 较好$ \square $ + + 一般$ \square $ 尚可$ \square $ + + 差$ \square $ +\end{tabu} + +\hline +\begin{tabu}{@{}X[l]@{}} + 教师签名: + + 年~月~日 +\end{tabu} +& + +\hline + \end{tabu} + + \begin{flushleft} + \makebox[5\ccwd][c]{}注:请将该封面与论文装订成册(论文双面打印)。 + \end{flushleft}$0 + + \begin{boxedminipage}{\linewidth} + \zihao{4} + + 任课老师评语: + + \vspace{40mm} + + \begin{flushright} + 签名: \underline{\makebox[6\ccwd][c]{}} + + 年\makebox[2\ccwd][c]{}月\makebox[2\ccwd][c]{}日 + \end{flushright} + + \vspace{20mm} + + \end{boxedminipage} + \clearpage +} + +% Fakechapter environment +\newenvironment{abstract}{% + \newpage + \thispagestyle{empty} + \centering + \zihao{3}{\ziju{0.5}\heiti\njust@abstract@prefix + 中文摘要} + + \vspace{0.3em} + + \begin{boxedminipage}[][18cm]{\linewidth} + \begin{spacing}{1.5} + \zihao{-4} + + \vspace{1\ccwd} + +}{% + \end{spacing} + \end{boxedminipage} +} + +\newenvironment{abstract*}{% + \newpage + \thispagestyle{empty} + \centering + \zihao{3}\ziju{0.5}\heiti\njust@abstract@prefix + 英文摘要 + + \vspace{0.3em} + + \begin{boxedminipage}[][18cm]{\linewidth} + \begin{spacing}{1} + \zihao{4} + + \vspace{1em} + + \begin{tabu} to \linewidth{@{}X[l]@{}X[l, 8]@{}} + \textbf{Title} & + \hspace{2em}\underline{ + \makebox[15em][c]{\zihao{4}\njust@title@en}} \\ + \phantom{Title} & + \hspace{2em}\underline{ + \makebox[15em][c]{\zihao{4}\njust@subtitle@en}} \\ + \end{tabu} + + \textbf{Abstract} + + \zihao{-4} + + \vspace{2em} + +}{% + \end{spacing} + \end{boxedminipage} +} + +\newenvironment{keyword}{% + \vspace{1em} + \noindent\textbf{关键词}\hspace{1\ccwd} +}{% +} + +\newenvironment{keyword*}{% + \vspace{1em} + \noindent\textbf{Keywords}\hspace{1em} +}{% +} + +\newenvironment{acknowledgement}{% + \newpage + \begin{center} + \zihao{3}致谢 + \end{center} + +}{% +} +%</cls> + +%<*cls|sty> +\endinput +%</cls|sty> +% \end{macrocode} +% \IfFileExists{./CHANGELOG.md}{\markdownInput{CHANGELOG.md}}{} +% \Finale diff --git a/macros/latex/contrib/njustthesis/njustthesis.ins b/macros/latex/contrib/njustthesis/njustthesis.ins new file mode 100644 index 0000000000..6e4f6ea6e9 --- /dev/null +++ b/macros/latex/contrib/njustthesis/njustthesis.ins @@ -0,0 +1,11 @@ +\input docstrip +\usedir{tex/latex/\jobname} +\preamble% +Copyright (C) 2022-\the\year\ by wzy <wuzy01@qq.com> + +This work may be distributed and/or modified under the conditions of GPLv3+. +\endpreamble% +\generate{% + \file{\jobname.cls}{\from{\jobname.dtx}{cls}} +} +\endbatchfile% diff --git a/macros/latex/contrib/njustthesis/njustthesis.pdf b/macros/latex/contrib/njustthesis/njustthesis.pdf Binary files differnew file mode 100644 index 0000000000..9af23f7d75 --- /dev/null +++ b/macros/latex/contrib/njustthesis/njustthesis.pdf diff --git a/macros/latex/contrib/shtthesis/CHANGELOG.md b/macros/latex/contrib/shtthesis/CHANGELOG.md index 73356830a7..f9973d5e87 100644 --- a/macros/latex/contrib/shtthesis/CHANGELOG.md +++ b/macros/latex/contrib/shtthesis/CHANGELOG.md @@ -2,6 +2,13 @@ `sht-thesis` 项目派生于 `ucasthesis`,一个在 GPLv3 License 下分发的项目。根据该许可证条款,`sht-thesis` 项目列出基于 `ucasthesis` (commit `faad94b` 之后) 的所有修改条目: +## 2022-03-03 +> Release: v0.3.3 + +1. Issue [#4](https://github.com/lirundong/shtthesis/issues/4): 增加三级标题(subsubsection)格式定义; +2. Issue [#5](https://github.com/lirundong/shtthesis/issues/5): 确保引用排版顺序与源文档顺序一致; +3. 修正「申请或已获得的专利」章节对应的环境及匿名环境名称为 `patents` 及 `patents*`(学渣捂脸); + ## 2021-02-14 > Release: v0.3.2 diff --git a/macros/latex/contrib/shtthesis/DEPENDS.txt b/macros/latex/contrib/shtthesis/DEPENDS.txt new file mode 100644 index 0000000000..f20ebe7390 --- /dev/null +++ b/macros/latex/contrib/shtthesis/DEPENDS.txt @@ -0,0 +1,26 @@ +alphalph +biber +biblatex +biblatex-gb7714-2015 +booktabs +caption +colortbl +ctex +datetime +enumitem +fancyhdr +fmtcount +lastpage +latexmk +listings +lua-alt-getopt +lualatex-math +mathtools +ntheorem +tex-gyre +tocvsec2 +transparent +undolabl +unicode-math +xits +xstring diff --git a/macros/latex/contrib/shtthesis/LICENSE b/macros/latex/contrib/shtthesis/LICENSE index 633be1564f..da54465f8e 100644 --- a/macros/latex/contrib/shtthesis/LICENSE +++ b/macros/latex/contrib/shtthesis/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. shtthesis, an unofficial LaTeX thesis template for ShanghaiTech University. - Copyright (C) 2021 Li Rundong <rundong.001@gmail.com> + Copyright (C) 2022 Li Rundong <rundong.001@gmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - shtthesis Copyright (C) 2021 Li Rundong <rundong.001@gmail.com> + shtthesis Copyright (C) 2022 Li Rundong <rundong.001@gmail.com> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/macros/latex/contrib/shtthesis/README.md b/macros/latex/contrib/shtthesis/README.md index 48ef2f9c5f..9035aa3878 100644 --- a/macros/latex/contrib/shtthesis/README.md +++ b/macros/latex/contrib/shtthesis/README.md @@ -1,5 +1,5 @@ # ShangHaiTech university THESIS (shtthesis) -[![Action status](https://github.com/lirundong/sht-thesis/workflows/build/badge.svg)](https://github.com/lirundong/shtthesis/actions) +[![Action status](https://github.com/lirundong/shtthesis/workflows/build/badge.svg?branch=v0.3)](https://github.com/lirundong/shtthesis/actions) [![GitHub release](https://img.shields.io/github/v/release/lirundong/shtthesis?style=flat&logo=GitHub)](https://github.com/lirundong/shtthesis/releases/latest) [![CTAN version](https://img.shields.io/ctan/v/shtthesis?style=flat&logo=LaTeX)](https://ctan.org/pkg/shtthesis) [![Overleaf](https://img.shields.io/badge/overleaf-shtthesis-green?style=flat&logo=Overleaf&color=1C890F)](https://www.overleaf.com/latex/templates/shanghaitech-university-thesis-template/mskbxkmfxqpt) @@ -22,24 +22,24 @@ ## Get the Template - Stable version: Install or download with any of following methods - - CTAN (**strongly recommended**): [`shtthesis`](https://ctan.org/pkg/shtthesis) package on CTAN can be installed via `tlmgr` for TeX Live and MacTeX users: + - CTAN (**highly recommended**): [`shtthesis`](https://ctan.org/pkg/shtthesis) package on CTAN can be installed via `tlmgr` for TeX Live and MacTeX users: ```bash tlmgr install shtthesis ``` - If your distribution has already installed `shtthesis`, please update it to the latest version: + If your distribution already contains `shtthesis`, please update it to the latest version: ```bash tlmgr update shtthesis ``` - **Note**: `shtthesis` package on CTAN does not include the university logo file. Please download [`shanghaitech-emblem.pdf`](https://github.com/lirundong/shtthesis/raw/master/shanghaitech-emblem.pdf) from this repository and put it in the root of your project directory. + **Note**: `shtthesis` package on CTAN does not include the university logo file. Please download [`shanghaitech-emblem.pdf`](https://github.com/lirundong/shtthesis/raw/v0.3/shanghaitech-emblem.pdf) from this repository and put it in the root of your project directory. - [Overleaf](https://www.overleaf.com/latex/templates/shanghaitech-university-thesis-template/mskbxkmfxqpt): Please compile with XeLaTeX. Since compilation time for Overleaf free-plan is limited to *1 minute*, you might encounter with timeout issue if compiling with LuaLaTeX - - GitHub Release: Please refer to the [release](https://github.com/lirundong/sht-thesis/releases) page and download required files based on release information + - GitHub Release: Please refer to the [release](https://github.com/lirundong/shtthesis/releases) page and download required files based on release information - Develop version: Directly clone the GitHub repo ```bash git clone https://github.com/lirundong/shtthesis.git ``` -Please, read through [the user's guide](shtthesis-user-guide.pdf) before continuing. +Please, read through [the user's guide](http://mirrors.ctan.org/macros/latex/contrib/shtthesis/shtthesis-user-guide.pdf) before continuing. ## Get Started After cloning or downloading this template, please diff --git a/macros/latex/contrib/shtthesis/shtthesis-user-guide.pdf b/macros/latex/contrib/shtthesis/shtthesis-user-guide.pdf Binary files differindex 5a51b6aa2d..9dd88189ca 100644 --- a/macros/latex/contrib/shtthesis/shtthesis-user-guide.pdf +++ b/macros/latex/contrib/shtthesis/shtthesis-user-guide.pdf diff --git a/macros/latex/contrib/shtthesis/shtthesis-user-guide.tex b/macros/latex/contrib/shtthesis/shtthesis-user-guide.tex index ae0ff1d4c0..8f145aaa0d 100644 --- a/macros/latex/contrib/shtthesis/shtthesis-user-guide.tex +++ b/macros/latex/contrib/shtthesis/shtthesis-user-guide.tex @@ -1,5 +1,5 @@ % shtthesis, an unofficial LaTeX thesis template for ShanghaiTech University. -% Copyright (C) 2021 Li Rundong <rundong.001@gmail.com> +% Copyright (C) 2022 Li Rundong <rundong.001@gmail.com> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -293,7 +293,7 @@ `\prompt' tlmgr update shtthesis \end{shell} -为避免版权问题,上传至 CTAN 的 \shtthesis{} 并不包含校徽文件,需要至项目主页下载 shanghaitech-emblem.pdf\footnote{\url{https://github.com/lirundong/shtthesis/raw/master/shanghaitech-emblem.pdf}}。假设用户的论文文档为 thesis.tex,参考文献数据库为 reference.bib (本文档的 bib 数据库由 \jobname.tex 自动生成),则需要将下载的校徽文件与它们放在同一目录下,下文称为\emph{工作目录}。工作目录中必要的文件包括: +为避免版权问题,上传至 CTAN 的 \shtthesis{} 并不包含校徽文件,需要至项目主页下载 shanghaitech-emblem.pdf\footnote{\url{https://github.com/lirundong/shtthesis/raw/v0.3/shanghaitech-emblem.pdf}}。假设用户的论文文档为 thesis.tex,参考文献数据库为 reference.bib (本文档的 bib 数据库由 \jobname.tex 自动生成),则需要将下载的校徽文件与它们放在同一目录下,下文称为\emph{工作目录}。工作目录中必要的文件包括: \begin{center} \begin{tabular}{ll} \toprule @@ -762,7 +762,7 @@ P(A|B) &= \frac{P(A)P(B|A)}{P(B)} \label{eq::bayesian} % ... \end{latex} -《规范》要求在文末依此列出致谢、作者简历、攻读学位期间发表的论文与研究成果。用户可使用 \shtthesis{} 提供的相应环境 acknowledgement、resume、publications、patterns 和 projects 进行排版。同时为了生成符合盲审要求的论文,\shtthesis{} 也提供了对应的\emph{匿名环境} publications*、patterns* 和 projects*。在打开 \verb|anonymous| 选项(第~\ref{sec::option_anonymous} 节)后,论文中不出现“致谢”一节,作者简历内容替换为匿名字符串,其他小节使用匿名环境内容排版。注意在第一次使用任一上述环境前,需要使用 \verb|\backmatter| 切换至后记模式。 +《规范》要求在文末依此列出致谢、作者简历、攻读学位期间发表的论文与研究成果。用户可使用 \shtthesis{} 提供的相应环境 acknowledgement、resume、publications、patents 和 projects 进行排版。同时为了生成符合盲审要求的论文,\shtthesis{} 也提供了对应的\emph{匿名环境} publications*、patents* 和 projects*。在打开 \verb|anonymous| 选项(第~\ref{sec::option_anonymous} 节)后,论文中不出现“致谢”一节,作者简历内容替换为匿名字符串,其他小节使用匿名环境内容排版。注意在第一次使用任一上述环境前,需要使用 \verb|\backmatter| 切换至后记模式。 \subsection{致谢} 在 acknowledgement 环境内书写致谢,致谢内容在匿名模式下不显示。 @@ -773,7 +773,7 @@ P(A|B) &= \frac{P(A)P(B|A)}{P(B)} \label{eq::bayesian} \end{latex} \subsection{简历及科研成果} -此部分需要依此书写个人简历(resume 环境)、已发表(或正式接受)的学术论文(publications 和 publications* 环境)、申请或已获得的专利(patterns 和 patterns* 环境)、参加的研究项目及获奖情况(projects 和 projects*)。根据是否匿名分别显示非匿名环境内容和匿名环境内容。 +此部分需要依此书写个人简历(resume 环境)、已发表(或正式接受)的学术论文(publications 和 publications* 环境)、申请或已获得的专利(patents 和 patents* 环境)、参加的研究项目及获奖情况(projects 和 projects*)。根据是否匿名分别显示非匿名环境内容和匿名环境内容。 \begin{latex} \begin{resume} 个人简历…… (仅非匿名环境显示) @@ -856,13 +856,13 @@ P(A|B) &= \frac{P(A)P(B|A)}{P(B)} \label{eq::bayesian} 论文发表…… (匿名环境) \end{publications*} -\begin{patterns} +\begin{patents} 专利申请或授权记录…… (非匿名环境) -\end{patterns} +\end{patents} -\begin{patterns*} +\begin{patents*} 专利申请或授权记录…… (匿名环境) -\end{patterns*} +\end{patents*} \begin{projects} 个人参与的科研项目、获奖情况…… (仅非匿名环境显示) diff --git a/macros/latex/contrib/shtthesis/shtthesis.cls b/macros/latex/contrib/shtthesis/shtthesis.cls index d1bcc8fcdc..566c383999 100644 --- a/macros/latex/contrib/shtthesis/shtthesis.cls +++ b/macros/latex/contrib/shtthesis/shtthesis.cls @@ -1,5 +1,5 @@ % shtthesis, an unofficial LaTeX thesis template for ShanghaiTech University. -% Copyright (C) 2021 Li Rundong <rundong.001@gmail.com> +% Copyright (C) 2022 Li Rundong <rundong.001@gmail.com> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -17,8 +17,8 @@ % Identification % ============================================================================== \NeedsTeXFormat{LaTeX2e} -\newcommand\version{0.3.2} -\newcommand\versiondate{2021/01/23} +\newcommand\version{0.3.3} +\newcommand\versiondate{2022/03/03} \ProvidesClass{shtthesis}[% \versiondate\space% v\version\space% @@ -299,6 +299,7 @@ backend = biber, gbpub = false, gbcitelocal = chinese, + sortcites = false, }{biblatex} \LoadClass{ctexbook} \RequirePackage{expl3} @@ -372,7 +373,7 @@ \def\figurename{图} \definecolor{ShtRed}{RGB}{146,46,23} \def\school@logo@missing{% - 校徽文件缺失,请至\href{https://github.com/lirundong/shtthesis/raw/master/% + 校徽文件缺失,请至\href{https://github.com/lirundong/shtthesis/raw/v0.3/% shanghaitech-emblem.pdf}{项目主页}下载!% } % ------------------------------------------------------------------------------ @@ -980,6 +981,15 @@ beforeskip = {12pt}, afterskip = {6pt}, }, + subsubsection = { + format = \heiti\normalsize\linespread{1.0}\raggedright, + nameformat = {}, + numberformat = \rmfamily, + titleformat = {}, + aftername = \hspace{0.75\ccwd}, + beforeskip = {12pt}, + afterskip = {6pt}, + }, paragraph = { indent = 2\ccwd, beforeskip = {0pt}, @@ -1018,6 +1028,11 @@ format = \sht@subsection@fmt, numberformat = {}, indent = \sht@section@indent, + }, + subsubsection = { + format = \sht@subsection@fmt, + numberformat = {}, + indent = \sht@section@indent, } } \fi @@ -1741,7 +1756,7 @@ \endcomment }{} } -\renewenvironment{patterns}{% +\newenvironment{patents}{% \sht@check@resume@title \ifsht@anonymous \comment @@ -1752,7 +1767,7 @@ \endcomment \fi } -\newenvironment{patterns*}{% +\newenvironment{patents*}{% \sht@check@resume@title \ifthenelse{\not \boolean{sht@anonymous}}{ \comment diff --git a/macros/latex/contrib/spbmark/spbmark.pdf b/macros/latex/contrib/spbmark/spbmark.pdf Binary files differindex 6be14eef41..93f58f43bd 100644 --- a/macros/latex/contrib/spbmark/spbmark.pdf +++ b/macros/latex/contrib/spbmark/spbmark.pdf diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty index dd9dac296d..e78f1db659 100644 --- a/macros/latex/contrib/spbmark/spbmark.sty +++ b/macros/latex/contrib/spbmark/spbmark.sty @@ -9,12 +9,13 @@ % https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2018/12/31] \RequirePackage{xparse,l3keys2e} -\ProvidesExplPackage{spbmark}{2022/03/02}{1.38} +\ProvidesExplPackage{spbmark}{2022/03/04}{1.39} {Customize superscripts and subscripts} \cs_generate_variant:Nn \box_set_ht:Nn { cv } \cs_generate_variant:Nn \box_set_dp:Nn { cv } \cs_generate_variant:Nn \dim_max:nn { VV } +\cs_generate_variant:Nn \dim_gset:Nn { Nv } \cs_generate_variant:Nn \dim_compare:nNnTF { V } \cs_generate_variant:Nn \msg_warning:nnn { nnV } \cs_generate_variant:Nn \str_case:nn { x } @@ -227,6 +228,9 @@ \box_new:N \l__sub_i_box \box_new:N \l__super_ii_box \box_new:N \l__sub_ii_box +\dim_new:N \llastwd +\dim_new:N \clastwd +\dim_new:N \rlastwd \tl_set:Nn \l__spb_box_super_wd_i_tl { \box_wd:N \l__super_i_box } \tl_set:Nn \l__spb_box_sub_wd_i_tl { \box_wd:N \l__sub_i_box } \tl_set:Nn \l__spb_box_super_wd_ii_tl { \box_wd:N \l__super_ii_box } @@ -243,6 +247,7 @@ { \tl_use:c { l__spb_#1_cmd_i_tl }{#2} } } } + \dim_gset:Nv \rlastwd { l__spb_box_#1_wd_i_tl } } \cs_new:Npn \spb_text_print_store_i:nn #1#2 { @@ -251,6 +256,7 @@ \use:c { spb@text#1script@save } { \tl_use:c { l__spb_#1_cmd_i_tl }{#2} } } + \dim_gset:Nv \rlastwd { l__spb_box_#1_wd_i_tl } } \cs_new:Npn \spb_math_print_store_ii:nn #1#2 { @@ -303,6 +309,7 @@ \exp_args:Nc \NewDocumentCommand {#1}{O{}mO{}} { \group_begin: + \mode_leave_vertical: \tl_gset:Nn \g__spb_mark_case_init_tl {#1} \spb_define:n { unknown .undefine: } \spb_set:n { ##1,##3 } @@ -315,6 +322,7 @@ } \cs_new_protected:Npn \spb_content_hbox_set:n #1 { + \dim_gset:Nn \clastwd { (\llastwd + \rlastwd)/2 } \hbox_set:cn { l__#1_i_box } { \dim_compare:nNnTF { \tl_use:c { l__spb_#1_hmove_tl } } < { 0pt } @@ -323,7 +331,7 @@ { \hbox_overlap_right:n { \spb_box_vmove_i:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } } - \skip_horizontal:n { -\tl_use:c { l__spb_#1_hmove_tl } } + \skip_horizontal:n { \dim_abs:n { \tl_use:c { l__spb_#1_hmove_tl } } } } } { @@ -332,6 +340,8 @@ { \hss\spb_box_vmove_i:nn {#1} { \tl_use:c { l__spb_#1_vmove_tl } } } } } + \dim_gset:Nn \llastwd + { \tl_use:c { l__spb_box_#1_wd_i_tl } - \tl_use:c { l__spb_#1_hmove_tl } } } \clist_map_inline:nn { super,sub } { \spb_both_newcmd_map:n {#1} } @@ -340,6 +350,7 @@ \NewDocumentCommand{\supersub}{O{}mmO{}} { \group_begin: + \mode_leave_vertical: \tl_gset:Nn \g__spb_mark_case_init_tl { supersub } \spb_define:n { unknown .undefine: } \spb_set:n {#1,#4} @@ -361,7 +372,7 @@ \hbox_overlap_left:n { \spb_hbox_overlap_vmove_ii:n { right } - \skip_horizontal:n { -\l__spb_supersub_hmove_tl } + \skip_horizontal:n { \dim_abs:n { \l__spb_supersub_hmove_tl } } } } { @@ -379,7 +390,8 @@ \hbox_overlap_left:n { \spb_hbox_overlap_vmove_ii:n { center } - \skip_horizontal:n { -\l__spb_supersub_hmove_tl - \l__spb_box_max_wd_tl/2 } + \skip_horizontal:n + { \dim_abs:n { \l__spb_supersub_hmove_tl + \l__spb_box_max_wd_tl/2 } } } } { @@ -397,7 +409,8 @@ \hbox_overlap_left:n { \spb_hbox_overlap_vmove_ii:n { left } - \skip_horizontal:n { -\l__spb_supersub_hmove_tl - \l__spb_box_max_wd_tl } + \skip_horizontal:n + { \dim_abs:n { \l__spb_supersub_hmove_tl + \l__spb_box_max_wd_tl } } } } { diff --git a/macros/latex/contrib/spbmark/spbmark.tex b/macros/latex/contrib/spbmark/spbmark.tex index c1d428cd16..7cdd0b2bfd 100644 --- a/macros/latex/contrib/spbmark/spbmark.tex +++ b/macros/latex/contrib/spbmark/spbmark.tex @@ -1,13 +1,13 @@ \documentclass[load-preamble+]{cnltx-doc} -\usepackage{spbmark,siunitx,pifont} +\usepackage{spbmark,siunitx,pifont,hologo} \usepackage[noto]{newtxmath} \setcnltx { package = spbmark, title = the spbmark package, - version = v1.38, - date = 2022/03/02, + version = v1.39, + date = 2022/03/04, authors = Qu Yi, info = Customize superscript and subscript, email = q1jx@foxmail.com, @@ -20,7 +20,9 @@ title-format = \huge\bfseries\scshape, add-frame-options = {innerleftmargin = 2em}, listings-options = {numbers = none,gobble = 2}, - pre-output = {\parindent = 0em} + pre-output = {\parindent = 0em}, + before-skip = \smallskipamount, + after-skip = \smallskipamount } \makeatletter @@ -39,6 +41,7 @@ \newsplitarg{\splitmarg}{\{}{\}} \newsplitarg{\splitdarg}{(}{)} \newnote{\newtag}[1][New]{\textcolor{red}{\ding{73}\ #1}} +\renewcommand{\emph}[1]{\textcolor{red}{#1}} \makeatother \begin{document} @@ -76,6 +79,23 @@ There are currently three commands to set superscript and subscript. Their forma Defines the style of the superscript or subscript used for the \option{style} option. \command{spbifmath}[\marg{math code}\marg{text code}] In some cases, \code{math} or \code{text} output modes require different code for format or move. This command can be used when using the \code{match} option or changing the output mode locally, whitch should be used in the move or format options. It can switch the corresponding code according to different output modes. + + When the horizontal movement distance of the marker is \emph{non-negative}, since the \cs{super} and \cs{sub} commands put the marker in a horizontal box, the horizontal position is staggered when using superscript and subscript \emph{consecutively}, which is a different mechanism than the sequential use of \code{\^{}} and \code{\_} symbols in math mode. The following three commands save the width of the previous marker, use it for negative move of the \option{hmove} option of the next marker, and provide the corresponding alignment. + + It should be noted that the following commands should save the longer width of the marker, that is, the longer width of the marker in the front, the shorter width of the marker in the back. This is due to the fact that horizontal movement uses a negative distance to leave the marker in a zero-width box state. + \command{llastwd}\newtag% + Save the width of the previous marker and provide left alignment. + \command{clastwd}\newtag% + Save the width of the previous marker and provide center alignment. + \command{rlastwd}\newtag% + Save the width of the previous marker and provide right alignment. + \begin{example} + A\super{bcd}\sub{e}B \\ + A\super{bcd}\sub[hmove=-\llastwd]{e}B \\ + A\sub{e}\super{bcd}[hmove=-\llastwd]B \\ + A\super{bcd}\sub[hmove=-\clastwd]{e}B \\ + A\super{bcd}\sub[hmove=-\rlastwd]{e}B \\ + \end{example} \command{spbshortkv}[\marg{short opt}\marg{key value}]\newtag% Converts any existing key-value pair to a shorthand option. The value of key \code{\#1} indicates that the shorthand option needs to be assigned a value. \begin{example} @@ -87,20 +107,22 @@ There are currently three commands to set superscript and subscript. Their forma \end{example} \end{commands} -Since the \cs{super} and \cs{sub} commands enclose the scripts in a horizontal box, the horizontal positions are staggered when using both superscript and subscript, which is different from the simultaneous use of \code{\^{}} and \code{\_} symbols in math mode. In this case, you need to adjust the horizontal offset of the latter command or use the \cs{supersub} command. - The options common to \meta{kv list} of the three commands are as follows. They can also be used in \meta {key-value list} of the \cs{spbset} command. In this situation, in addition to \option{style} and \option{mode}, they will be set according to the type of the previous most recent command. \begin{options} \keyval{vmove}{fixed length}\Default{0pt} Vertical move of superscript or subscript. Represents the extra vertical distance \option{vsep} between superscript and subscript in the superscript and subscript commands. \keyval{hmove}{fixed length}\Default{0pt} - Horizontal move of superscript or subscript. Represents the common move in the superscript and subscript commands. + Horizontal move of superscript or subscript. Represents the common move in the superscript and subscript commands. Moved values can be expressed mathematically: + \begin{example} + A\super{b}[vmove=0.4ex+4pt/2,hmove=2pt*3-11.5pt] \\ + A\supersub[vsep={3pt,6pt-2bp}]{examsuper}{sub} + \end{example} \keyval{cmd}{format cmds} The format commands of superscript or subscript. The last command can take a parameter, which accepts superscript or subscript. Represents the format of superscript and subscript in the superscript and subscript commands. \keyval{cmd+}{format cmds} Add code to the previous global superscript or subscript format commands. \keyval{height}{fixed length} - The distance between the superscript or subscript baseline and the previous line. + The distance between the superscript or subscript baseline and the previous line. It is recommended that the superscript adjusts the height and the subscript adjusts the depth. \keyval{depth}{fixed length} The distance between the superscript or subscript baseline and the next line. \keyval{style}{style name} @@ -116,7 +138,7 @@ The options common to \meta{kv list} of the three commands are as follows. They \pkg*{spbmark} uses the \cs{spbset} command to control the global default format of superscript and subscript. These options also apply to \meta{kv list} of the above commands. The values set by it will be overwritten by the optional parameters of the superscript and other commands. \end{commands} -The following list of keys control the format both of superscript \textcolor{red}{or} subscript. +The following list of keys control the format both of superscript \emph{or} subscript. \begin{options} \keyval{spvmove}{fixed length}\Default{0pt} Extra vertical move of the superscript. @@ -150,7 +172,7 @@ The following list of keys control the format both of superscript \textcolor{red If \option{sphmove} is positive, the superscript or subscript moves to the right, conversely it moves to the left. The positive direction of vertical offset of subscript and superscript is opposite. For superscript, if \option{spvmove} is positive, the superscript moves up, conversely it moves down. For subscript, if \option{spvmove} is positive, the subscript moves down, conversely it moves up. -The following list of keys control the format of superscript \textcolor{red}{and} subscript. +The following list of keys control the format of superscript \emph{and} subscript. \begin{options} \keyval{spbhmove}{fixed length}\Default{0pt} Extra vertical move of the superscript and the subscript. diff --git a/macros/latex/contrib/srdp-mathematik/README.txt b/macros/latex/contrib/srdp-mathematik/README.txt index 553c175e9a..5ebd2ac109 100644 --- a/macros/latex/contrib/srdp-mathematik/README.txt +++ b/macros/latex/contrib/srdp-mathematik/README.txt @@ -2,9 +2,9 @@ __________________________________ The srdp-mathematik package - v1.9.4 + v1.9.5 - 2022/01/02 + 2022/03/04 ___________________________________ Maintainer: Christoph Weberndorfer diff --git a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf Binary files differindex c4b743bcac..c2dff7ff86 100644 --- a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf +++ b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf diff --git a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty index b0b716daa8..4209fa9c14 100644 --- a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty +++ b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty @@ -10,7 +10,7 @@ % \NeedsTeXFormat{LaTeX2e}[1996/12/26] -\ProvidesPackage{srdp-mathematik}[2022/01/02 v1.9.4 Standard-Schularbeitsformate] +\ProvidesPackage{srdp-mathematik}[2022/03/04 v1.9.5 Standard-Schularbeitsformate] \usepackage{color} @@ -115,13 +115,37 @@ \ProcessOptions\relax + +\NewDocumentCommand{\variation}{ m m O{#1} O{#2} O{#1} O{#2} O{#1} O{#2} O{#1}}{% +\ifthenelse{\theZufall=0}{#1}{% +\ifthenelse{\theZufall=1}{#2}{% +\ifthenelse{\theZufall=2}{#3}{% +\ifthenelse{\theZufall=3}{#4}{% +\ifthenelse{\theZufall=4}{#5}{% +\ifthenelse{\theZufall=5}{#6}{% +\ifthenelse{\theZufall=6}{#7}{% +\ifthenelse{\theZufall=7}{#8}{% +\ifthenelse{\theZufall=8}{#9}{#1}% +}}}}}}}}} + + \newcommand{\antwort}[2][]{\ifthenelse{\theAntworten=1}{{\color[rgb]{1,0,0}#2}}{#1}} \newcommand{\info}[2][]{\ifthenelse{\theinfo=1}{ {\color[rgb]{0,0,1}#2} }{#1}} +\newif\ifswitch +\let\switchon\switchtrue +\let\switchoff\switchfalse +\ifthenelse{\theAntworten=1}{\switchon}{} + +\def\antwortzeile #1\\{% +\ifswitch% +{\color[rgb]{1,0,0}#1}\\ +\fi% +} \newcounter{A1} \newcounter{A2} diff --git a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex index f6ab329c45..ece0c2195a 100644 --- a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex +++ b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex @@ -55,7 +55,7 @@ hidelinks \vfill -\Huge The \textit{srdp-mathematik} package v1.9.4\\[1cm] +\Huge The \textit{srdp-mathematik} package v1.9.5\\[1cm] Documentation \\ [1cm] @@ -335,6 +335,23 @@ Durch das Ersetzen der Zahl "`0"' durch die Zahlen $1, 2, 3, \ldots$ (und anschl Die Erstellung der Gruppen ist dabei reproduzierbar. Die Reihenfolge der Antwortmöglichkeiten einer Gruppe bleibt daher immer gleich. Mithilfe des Befehls \texttt{\textbackslash Gruppe} kann die Gruppennummer innerhalb der \texttt{PDF}-Datei (z.B. am Deckblatt) angezeigt werden. (verwendeter counter: \texttt{Zufall=0, 1, 2, \ldots}) +\subsubsection{Gruppenvariation von offenen Aufgabenformaten} +Da es bei offenen Antwortformaten keine Vertauschung der Antwortmöglichkeiten gibt, bietet das \texttt{srdp-mathematik}-Paket die Möglichkeit eine individuelle Gruppenvariation einzugeben. Mithilfe des Befehls \texttt{variation\{\ldots\}\{\}} können unterschiedliche Anzeigen -- abhängig von der ausgewählten Gruppe -- erstellt werden. + +\textsc{Eingabe:} +\begin{verbatim} +\variation{Anzeige bei Gruppe A}{bei Gruppe B sichtbar} +\end{verbatim} + +\textsc{Ausgabe:} + +\texttt{[random=0]}: Anzeige bei Gruppe A + +\texttt{[random=1]}: bei Gruppe B sichtbar + + + + \subsection{Paketoption -- Informationseingabe: \texttt{[info\_on/off]}} Es ist darüber hinaus möglich zusätzliche Informationen (Erläuterungen, Hilfestellungen, \ldots) hinzuzufügen und einzublenden. Dazu kann die Option \texttt{info\_on/off} im \texttt{srdp-mathematik}-Paket eingebunden werden. Die Infos werden in \textcolor[rgb]{0,0,1}{blau} angegeben und nur dann angezeigt, wenn die Option \texttt{info\_on} gewählt wurde (verwendeter counter: \texttt{info=0,1}). Also: |