diff options
author | Norbert Preining <norbert@preining.info> | 2024-02-25 03:01:04 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-02-25 03:01:04 +0000 |
commit | 7520174d338ca031769f8e67d69b9a6a00f1626b (patch) | |
tree | c3ce399ddf764721ad511253a501353457239811 /macros/latex | |
parent | f325bd88d1d4db13f51277bc59c8ff8814e937bc (diff) |
CTAN sync 202402250301
Diffstat (limited to 'macros/latex')
22 files changed, 2505 insertions, 375 deletions
diff --git a/macros/latex/contrib/cleveref-forward/LICENSE b/macros/latex/contrib/cleveref-forward/LICENSE new file mode 100644 index 0000000000..2244313901 --- /dev/null +++ b/macros/latex/contrib/cleveref-forward/LICENSE @@ -0,0 +1,416 @@ +The LaTeX Project Public License +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +LPPL Version 1.3c 2008-05-04 + +Copyright 1999 2002-2008 LaTeX3 Project + Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed. + + +PREAMBLE +======== + +The LaTeX Project Public License (LPPL) is the primary license under +which the LaTeX kernel and the base LaTeX packages are distributed. + +You may use this license for any work of which you hold the copyright +and which you wish to distribute. This license may be particularly +suitable if your work is TeX-related (such as a LaTeX package), but +it is written in such a way that you can use it even if your work is +unrelated to TeX. + +The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', +below, gives instructions, examples, and recommendations for authors +who are considering distributing their works under this license. + +This license gives conditions under which a work may be distributed +and modified, as well as conditions under which modified versions of +that work may be distributed. + +We, the LaTeX3 Project, believe that the conditions below give you +the freedom to make and distribute modified versions of your work +that conform with whatever technical specifications you wish while +maintaining the availability, integrity, and reliability of +that work. If you do not see how to achieve your goal while +meeting these conditions, then read the document `cfgguide.tex' +and `modguide.tex' in the base LaTeX distribution for suggestions. + + +DEFINITIONS +=========== + +In this license document the following terms are used: + + `Work' + Any work being distributed under this License. + + `Derived Work' + Any work that under any applicable law is derived from the Work. + + `Modification' + Any procedure that produces a Derived Work under any applicable + law -- for example, the production of a file containing an + original file associated with the Work or a significant portion of + such a file, either verbatim or with modifications and/or + translated into another language. + + `Modify' + To apply any procedure that produces a Derived Work under any + applicable law. + + `Distribution' + Making copies of the Work available from one person to another, in + whole or in part. Distribution includes (but is not limited to) + making any electronic components of the Work accessible by + file transfer protocols such as FTP or HTTP or by shared file + systems such as Sun's Network File System (NFS). + + `Compiled Work' + A version of the Work that has been processed into a form where it + is directly usable on a computer system. This processing may + include using installation facilities provided by the Work, + transformations of the Work, copying of components of the Work, or + other activities. Note that modification of any installation + facilities provided by the Work constitutes modification of the Work. + + `Current Maintainer' + A person or persons nominated as such within the Work. If there is + no such explicit nomination then it is the `Copyright Holder' under + any applicable law. + + `Base Interpreter' + A program or process that is normally needed for running or + interpreting a part or the whole of the Work. + + A Base Interpreter may depend on external components but these + are not considered part of the Base Interpreter provided that each + external component clearly identifies itself whenever it is used + interactively. Unless explicitly specified when applying the + license to the Work, the only applicable Base Interpreter is a + `LaTeX-Format' or in the case of files belonging to the + `LaTeX-format' a program implementing the `TeX language'. + + + +CONDITIONS ON DISTRIBUTION AND MODIFICATION +=========================================== + +1. Activities other than distribution and/or modification of the Work +are not covered by this license; they are outside its scope. In +particular, the act of running the Work is not restricted and no +requirements are made concerning any offers of support for the Work. + +2. You may distribute a complete, unmodified copy of the Work as you +received it. Distribution of only part of the Work is considered +modification of the Work, and no right to distribute such a Derived +Work may be assumed under the terms of this clause. + +3. You may distribute a Compiled Work that has been generated from a +complete, unmodified copy of the Work as distributed under Clause 2 +above, as long as that Compiled Work is distributed in such a way that +the recipients may install the Compiled Work on their system exactly +as it would have been installed if they generated a Compiled Work +directly from the Work. + +4. If you are the Current Maintainer of the Work, you may, without +restriction, modify the Work, thus creating a Derived Work. You may +also distribute the Derived Work without restriction, including +Compiled Works generated from the Derived Work. Derived Works +distributed in this manner by the Current Maintainer are considered to +be updated versions of the Work. + +5. If you are not the Current Maintainer of the Work, you may modify +your copy of the Work, thus creating a Derived Work based on the Work, +and compile this Derived Work, thus creating a Compiled Work based on +the Derived Work. + +6. If you are not the Current Maintainer of the Work, you may +distribute a Derived Work provided the following conditions are met +for every component of the Work unless that component clearly states +in the copyright notice that it is exempt from that condition. Only +the Current Maintainer is allowed to add such statements of exemption +to a component of the Work. + + a. If a component of this Derived Work can be a direct replacement + for a component of the Work when that component is used with the + Base Interpreter, then, wherever this component of the Work + identifies itself to the user when used interactively with that + Base Interpreter, the replacement component of this Derived Work + clearly and unambiguously identifies itself as a modified version + of this component to the user when used interactively with that + Base Interpreter. + + b. Every component of the Derived Work contains prominent notices + detailing the nature of the changes to that component, or a + prominent reference to another file that is distributed as part + of the Derived Work and that contains a complete and accurate log + of the changes. + + c. No information in the Derived Work implies that any persons, + including (but not limited to) the authors of the original version + of the Work, provide any support, including (but not limited to) + the reporting and handling of errors, to recipients of the + Derived Work unless those persons have stated explicitly that + they do provide such support for the Derived Work. + + d. You distribute at least one of the following with the Derived Work: + + 1. A complete, unmodified copy of the Work; + if your distribution of a modified component is made by + offering access to copy the modified component from a + designated place, then offering equivalent access to copy + the Work from the same or some similar place meets this + condition, even though third parties are not compelled to + copy the Work along with the modified component; + + 2. Information that is sufficient to obtain a complete, + unmodified copy of the Work. + +7. If you are not the Current Maintainer of the Work, you may +distribute a Compiled Work generated from a Derived Work, as long as +the Derived Work is distributed to all recipients of the Compiled +Work, and as long as the conditions of Clause 6, above, are met with +regard to the Derived Work. + +8. The conditions above are not intended to prohibit, and hence do not +apply to, the modification, by any method, of any component so that it +becomes identical to an updated version of that component of the Work as +it is distributed by the Current Maintainer under Clause 4, above. + +9. Distribution of the Work or any Derived Work in an alternative +format, where the Work or that Derived Work (in whole or in part) is +then produced by applying some process to that format, does not relax or +nullify any sections of this license as they pertain to the results of +applying that process. + +10. a. A Derived Work may be distributed under a different license + provided that license itself honors the conditions listed in + Clause 6 above, in regard to the Work, though it does not have + to honor the rest of the conditions in this license. + + b. If a Derived Work is distributed under a different license, that + Derived Work must provide sufficient documentation as part of + itself to allow each recipient of that Derived Work to honor the + restrictions in Clause 6 above, concerning changes from the Work. + +11. This license places no restrictions on works that are unrelated to +the Work, nor does this license place any restrictions on aggregating +such works with the Work by any means. + +12. Nothing in this license is intended to, or may be used to, prevent +complete compliance by all parties with all applicable laws. + + +NO WARRANTY +=========== + +There is no warranty for the Work. Except when otherwise stated in +writing, the Copyright Holder provides the Work `as is', without +warranty of any kind, either expressed or implied, including, but not +limited to, the implied warranties of merchantability and fitness for a +particular purpose. The entire risk as to the quality and performance +of the Work is with you. Should the Work prove defective, you assume +the cost of all necessary servicing, repair, or correction. + +In no event unless required by applicable law or agreed to in writing +will The Copyright Holder, or any author named in the components of the +Work, or any other party who may distribute and/or modify the Work as +permitted above, be liable to you for damages, including any general, +special, incidental or consequential damages arising out of any use of +the Work or out of inability to use the Work (including, but not limited +to, loss of data, data being rendered inaccurate, or losses sustained by +anyone as a result of any failure of the Work to operate with any other +programs), even if the Copyright Holder or said author or said other +party has been advised of the possibility of such damages. + + +MAINTENANCE OF THE WORK +======================= + +The Work has the status `author-maintained' if the Copyright Holder +explicitly and prominently states near the primary copyright notice in +the Work that the Work can only be maintained by the Copyright Holder +or simply that it is `author-maintained'. + +The Work has the status `maintained' if there is a Current Maintainer +who has indicated in the Work that they are willing to receive error +reports for the Work (for example, by supplying a valid e-mail +address). It is not required for the Current Maintainer to acknowledge +or act upon these error reports. + +The Work changes from status `maintained' to `unmaintained' if there +is no Current Maintainer, or the person stated to be Current +Maintainer of the work cannot be reached through the indicated means +of communication for a period of six months, and there are no other +significant signs of active maintenance. + +You can become the Current Maintainer of the Work by agreement with +any existing Current Maintainer to take over this role. + +If the Work is unmaintained, you can become the Current Maintainer of +the Work through the following steps: + + 1. Make a reasonable attempt to trace the Current Maintainer (and + the Copyright Holder, if the two differ) through the means of + an Internet or similar search. + + 2. If this search is successful, then enquire whether the Work + is still maintained. + + a. If it is being maintained, then ask the Current Maintainer + to update their communication data within one month. + + b. If the search is unsuccessful or no action to resume active + maintenance is taken by the Current Maintainer, then announce + within the pertinent community your intention to take over + maintenance. (If the Work is a LaTeX work, this could be + done, for example, by posting to comp.text.tex.) + + 3a. If the Current Maintainer is reachable and agrees to pass + maintenance of the Work to you, then this takes effect + immediately upon announcement. + + b. If the Current Maintainer is not reachable and the Copyright + Holder agrees that maintenance of the Work be passed to you, + then this takes effect immediately upon announcement. + + 4. If you make an `intention announcement' as described in 2b. above + and after three months your intention is challenged neither by + the Current Maintainer nor by the Copyright Holder nor by other + people, then you may arrange for the Work to be changed so as + to name you as the (new) Current Maintainer. + + 5. If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change completed + under the terms of 3b) or 4), then that Current Maintainer must + become or remain the Current Maintainer upon request provided + they then update their communication data within one month. + +A change in the Current Maintainer does not, of itself, alter the fact +that the Work is distributed under the LPPL license. + +If you become the Current Maintainer of the Work, you should +immediately provide, within the Work, a prominent and unambiguous +statement of your status as Current Maintainer. You should also +announce your new status to the same pertinent community as +in 2b) above. + + +WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE +====================================================== + +This section contains important instructions, examples, and +recommendations for authors who are considering distributing their +works under this license. These authors are addressed as `you' in +this section. + +Choosing This License or Another License +---------------------------------------- + +If for any part of your work you want or need to use *distribution* +conditions that differ significantly from those in this license, then +do not refer to this license anywhere in your work but, instead, +distribute your work under a different license. You may use the text +of this license as a model for your own license, but your license +should not refer to the LPPL or otherwise give the impression that +your work is distributed under the LPPL. + +The document `modguide.tex' in the base LaTeX distribution explains +the motivation behind the conditions of this license. It explains, +for example, why distributing LaTeX under the GNU General Public +License (GPL) was considered inappropriate. Even if your work is +unrelated to LaTeX, the discussion in `modguide.tex' may still be +relevant, and authors intending to distribute their works under any +license are encouraged to read it. + +A Recommendation on Modification Without Distribution +----------------------------------------------------- + +It is wise never to modify a component of the Work, even for your own +personal use, without also meeting the above conditions for +distributing the modified component. While you might intend that such +modifications will never be distributed, often this will happen by +accident -- you may forget that you have modified that component; or +it may not occur to you when allowing others to access the modified +version that you are thus distributing it and violating the conditions +of this license in ways that could have legal implications and, worse, +cause problems for the community. It is therefore usually in your +best interest to keep your copy of the Work identical with the public +one. Many works provide ways to control the behavior of that work +without altering any of its licensed components. + +How to Use This License +----------------------- + +To use this license, place in each of the components of your work both +an explicit copyright notice including your name and the year the work +was authored and/or last substantially modified. Include also a +statement that the distribution and/or modification of that +component is constrained by the conditions in this license. + +Here is an example of such a notice and statement: + + %% pig.dtx + %% Copyright 2005 M. Y. Name + % + % This work may be distributed and/or modified under the + % conditions of the LaTeX Project Public License, either version 1.3 + % of this license or (at your option) any later version. + % The latest version of this license is in + % http://www.latex-project.org/lppl.txt + % and version 1.3 or later is part of all distributions of LaTeX + % version 2005/12/01 or later. + % + % This work has the LPPL maintenance status `maintained'. + % + % The Current Maintainer of this work is M. Y. Name. + % + % This work consists of the files pig.dtx and pig.ins + % and the derived file pig.sty. + +Given such a notice and statement in a file, the conditions +given in this license document would apply, with the `Work' referring +to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being +generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' +referring to any `LaTeX-Format', and both `Copyright Holder' and +`Current Maintainer' referring to the person `M. Y. Name'. + +If you do not want the Maintenance section of LPPL to apply to your +Work, change `maintained' above into `author-maintained'. +However, we recommend that you use `maintained', as the Maintenance +section was added in order to ensure that your Work remains useful to +the community even when you can no longer maintain and support it +yourself. + +Derived Works That Are Not Replacements +--------------------------------------- + +Several clauses of the LPPL specify means to provide reliability and +stability for the user community. They therefore concern themselves +with the case that a Derived Work is intended to be used as a +(compatible or incompatible) replacement of the original Work. If +this is not the case (e.g., if a few lines of code are reused for a +completely different task), then clauses 6b and 6d shall not apply. + + +Important Recommendations +------------------------- + + Defining What Constitutes the Work + + The LPPL requires that distributions of the Work contain all the + files of the Work. It is therefore important that you provide a + way for the licensee to determine which files constitute the Work. + This could, for example, be achieved by explicitly listing all the + files of the Work near the copyright notice of each file or by + using a line such as: + + % This work consists of all files listed in manifest.txt. + + in that place. In the absence of an unequivocal list it might be + impossible for the licensee to determine what is considered by you + to comprise the Work and, in such a case, the licensee would be + entitled to make reasonable conjectures as to which files comprise + the Work. + diff --git a/macros/latex/contrib/cleveref-forward/README.md b/macros/latex/contrib/cleveref-forward/README.md new file mode 100644 index 0000000000..4a67b0cdd3 --- /dev/null +++ b/macros/latex/contrib/cleveref-forward/README.md @@ -0,0 +1,34 @@ +<!-- Copyright (C) 2023-2024 by Jinwen XU --> + +# `cleveref-forward` — Forward-referencing functionality for cleveref + +`cleveref-forward` aims at providing the forward-referencing functionality to `cleveref`. + +This package is derived from the package [`cleveref-usedon`](https://ctan.org/pkg/cleveref-usedon), with several fixes and enhancements. + +## Regarding the usage + +It might be a good idea to start with the [demo documents](https://github.com/Jinwen-XU/cleveref-forward/tree/main/demo). + +> The documentation and examples written by Sven Pistre for the original package [`cleveref-usedon`](https://ctan.org/pkg/cleveref-usedon) are also very inspiring (but be aware that the usage has changed a lot, so some of the code there may no longer work here). + +## Known issues / what to do next + +- The multilingual support is not yet perfect. +- The code is somewhat messy for now, and the naming of many macros should be made better. +- The support for displayed maths is still not perfect. +- Not all configuration yields nice result, more examples are needed. + +The original package [`cleveref-usedon`](https://ctan.org/pkg/cleveref-usedon) is better in terms of documentation, while the current package is slightly more advanced in terms of code. It is hoped that one day they can be combined into a better version. + + +## Acknowledgement + +The author would like to thank: + +- Sven Pistre, for originally developing the nice package [`cleveref-usedon`](https://ctan.org/pkg/cleveref-usedon), and for the friendly discussions with him that inspired many of the modifications later. +- Ulrich Diez, for his help in a key step of the new configuration command. + +## License + +This work is released under the LaTeX Project Public License, v1.3c or later. diff --git a/macros/latex/contrib/cleveref-forward/cleveref-forward.sty b/macros/latex/contrib/cleveref-forward/cleveref-forward.sty new file mode 100644 index 0000000000..b40f53fd44 --- /dev/null +++ b/macros/latex/contrib/cleveref-forward/cleveref-forward.sty @@ -0,0 +1,936 @@ +%% +%% Copyright (C) 2023-2024 by Jinwen XU +%% ------------------------------------ +%% +%% This package is derived from the package ``cleveref-usedon''. +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3c of this license +%% or (at your option) any later version. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +\NeedsTeXFormat{LaTeX2e}[2022-06-01] +\ProvidesExplPackage{cleveref-forward} + {2024/02/24} {} + {Forward-referencing functionality for cleveref} + +\keys_define:nn { cleveref-forward } + { + , default .tl_set:N = \l__crfwd_default_package_option_tl + , default .initial:n = { } + , default .value_required:n = true + , Used-On .meta:n = { default = UsedOn } + , Used~On .meta:n = { default = UsedOn } + , Used On .meta:n = { default = UsedOn } + , used-on .meta:n = { default = UsedOn } + , used~on .meta:n = { default = UsedOn } + , used on .meta:n = { default = UsedOn } + , uo .meta:n = { default = UsedOn } + , Used-By .meta:n = { default = UsedBy } + , Used~By .meta:n = { default = UsedBy } + , Used By .meta:n = { default = UsedBy } + , used-by .meta:n = { default = UsedBy } + , used~by .meta:n = { default = UsedBy } + , used by .meta:n = { default = UsedBy } + , ub .meta:n = { default = UsedBy } + , Used-By-And-On .meta:n = { default = UsedByAndOn } + , Used~By~And~On .meta:n = { default = UsedByAndOn } + , Used By And On .meta:n = { default = UsedByAndOn } + , used-by-and-on .meta:n = { default = UsedByAndOn } + , used~by~and~on .meta:n = { default = UsedByAndOn } + , used by and on .meta:n = { default = UsedByAndOn } + , ubao .meta:n = { default = UsedByAndOn } + , ubo .meta:n = { default = UsedByAndOn } + + , crefthe .bool_set:N = \l__crfwd_crefthe_enabled_bool + , crefthe .initial:n = { false } + + , unknown .code:n = { } + } +\ProcessKeyOptions [ cleveref-forward ] + +\RequirePackage { cleveref } +\bool_if:NT \l__crfwd_crefthe_enabled_bool + { + \RequirePackage { crefthe } + } + +\newcommand*{\@setcpagerefrange}[3]{% + \@@setcpagerefrange{#1}{#2}{cref}{#3}} +\newcommand*{\@setCpagerefrange}[3]{% + \@@setcpagerefrange{#1}{#2}{Cref}{#3}} +\newcommand*{\@setlabelcpagerefrange}[3]{% + \@@setcpagerefrange{#1}{#2}{labelcref}{#3}} + +% Temporary fix for cleveref in order to work with xr-hyper +% See https://tex.stackexchange.com/a/708445 +\def\cref@getref#1#2{% + \expandafter\let\expandafter#2\csname r@#1@cref\endcsname% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter#2% + \expandafter\expandafter\expandafter{% + \expandafter\@firstoffive#2}}% <-------- five +\def\cpageref@getref#1#2{% + \expandafter\let\expandafter#2\csname r@#1@cref\endcsname% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter#2% + \expandafter\expandafter\expandafter{% + \expandafter\@secondoffive#2}}% <----------- five +\AtBeginDocument{% + \def\label@noarg#1{% + \cref@old@label{#1}% + \@bsphack% + \edef\@tempa{{page}{\the\c@page}}% + \setcounter{page}{1}% + \edef\@tempb{\thepage}% + \expandafter\setcounter\@tempa% + \cref@constructprefix{page}{\cref@result}% + \protected@write\@auxout{}% + {\string\newlabel{#1@cref}{{\cref@currentlabel}% + {[\@tempb][\arabic{page}][\cref@result]\thepage}{}{}{}}}% <----- five + \@esphack}% + \def\label@optarg[#1]#2{% + \cref@old@label{#2}% + \@bsphack% + \edef\@tempa{{page}{\the\c@page}}% + \setcounter{page}{1}% + \edef\@tempb{\thepage}% + \expandafter\setcounter\@tempa% + \cref@constructprefix{page}{\cref@result}% + \protected@edef\cref@currentlabel{% + \expandafter\cref@override@label@type% + \cref@currentlabel\@nil{#1}}% + \protected@write\@auxout{}% + {\string\newlabel{#2@cref}{{\cref@currentlabel}% + {[\@tempb][\arabic{page}][\cref@result]\thepage}{}{}{}}}% <------- five + \@esphack}% +} + +\prg_generate_conditional_variant:Nnn \str_case:nn { x } { T, TF } +\cs_generate_variant:Nn \str_case:nn { x } + +\seq_new:N \g__crfwd_k_seq +\prop_new:N \g__crfwd_kv_prop +\clist_new:N \g__crfwd_options_clist +\clist_set:Nn \g__crfwd_options_clist { UsedOn, UsedBy, UsedByAndOn } + +\cs_new:Nn \__crfwd_usedon_message_text:n { } +\cs_new:Nn \__crfwd_usedby_message_text:n { } +\cs_new:Nn \__crfwd_usedbyandon_message_text:nn { } +\NewDocumentCommand \UsedOnMessageText { m } { \__crfwd_usedon_message_text:n { #1 } } +\NewDocumentCommand \UsedByMessageText { m } { \__crfwd_usedby_message_text:n { #1 } } +\NewDocumentCommand \UsedByAndOnMessageText { m m } { \__crfwd_usedbyandon_message_text:nn { #1 } { #2 } } +% Alternative names +\NewDocumentCommand \UsedOnMessageContent { m } { \__crfwd_usedon_message_text:n { #1 } } +\NewDocumentCommand \UsedByMessageContent { m } { \__crfwd_usedby_message_text:n { #1 } } +\NewDocumentCommand \UsedByAndOnMessageContent { m m } { \__crfwd_usedbyandon_message_text:nn { #1 } { #2 } } + +\NewDocumentCommand \SetUsedOnMessageText { m } + { + \cs_set:Nn \__crfwd_usedon_message_text:n { #1 } + } +\NewDocumentCommand \SetUsedByMessageText { m } + { + \cs_set:Nn \__crfwd_usedby_message_text:n { #1 } + } +\NewDocumentCommand \SetUsedByAndOnMessageText { m } + { + \cs_set:Nn \__crfwd_usedbyandon_message_text:nn { #1 } + } +% Alternative names +\NewDocumentCommand \SetUsedOnMessageContent { m } + { + \cs_set:Nn \__crfwd_usedon_message_text:n { #1 } + } +\NewDocumentCommand \SetUsedByMessageContent { m } + { + \cs_set:Nn \__crfwd_usedby_message_text:n { #1 } + } +\NewDocumentCommand \SetUsedByAndOnMessageContent { m } + { + \cs_set:Nn \__crfwd_usedbyandon_message_text:nn { #1 } + } + +\RequirePackage { iflang } + +% The default text +\SetUsedOnMessageText { (Used~on~#1.) } +\SetUsedByMessageText { (Used~by~#1.) } +\SetUsedByAndOnMessageText { (Used~by~#1~on~#2.) } + +\cs_new:Nn \__crfwd_usedon_message:n { } +\NewDocumentCommand \UsedOnMessage { m } { \__crfwd_usedon_message:n { #1 } } +\cs_new:Nn \__crfwd_usedby_message:n { } +\NewDocumentCommand \UsedByMessage { m } { \__crfwd_usedby_message:n { #1 } } +\cs_new:Nn \__crfwd_usedbyandon_message:nn { } +\NewDocumentCommand \UsedByAndOnMessage { m m } { \__crfwd_usedbyandon_message:nn { #1 } { #2 } } + +\cs_new:Nn \__crfwd_usedon_message_math:n { } +\NewCommandCopy \UsedOnMessageMath \__crfwd_usedon_message_math:n +\cs_new:Nn \__crfwd_usedby_message_math:n { } +\NewCommandCopy \UsedByMessageMath \__crfwd_usedby_message_math:n +\cs_new:Nn \__crfwd_usedbyandon_message_math:nn { } +\NewCommandCopy \UsedByAndOnMessageMath \__crfwd_usedbyandon_message_math:nn +\cs_new:Nn \__crfwd_usedon_message_inside_math:n { } +\NewDocumentCommand \UsedOnMessageInsideMath { m } { \__crfwd_usedon_message_inside_math:n { #1 } } +\cs_new:Nn \__crfwd_usedby_message_inside_math:n { } +\NewDocumentCommand \UsedByMessageInsideMath { m } { \__crfwd_usedby_message_inside_math:n { #1 } } +\cs_new:Nn \__crfwd_usedbyandon_message_inside_math:nn { } +\NewDocumentCommand \UsedByAndOnMessageInsideMath { m m } { \__crfwd_usedbyandon_message_inside_math:nn { #1 } { #2 } } +\cs_new:Nn \__crfwd_usedon_message_outside_math:n { } +\NewDocumentCommand \UsedOnMessageOutsideMath { m } { \__crfwd_usedon_message_outside_math:n { #1 } } +\cs_new:Nn \__crfwd_usedby_message_outside_math:n { } +\NewDocumentCommand \UsedByMessageOutsideMath { m } { \__crfwd_usedby_message_outside_math:n { #1 } } +\cs_new:Nn \__crfwd_usedbyandon_message_outside_math:nn { } +\NewDocumentCommand \UsedByAndOnMessageOutsideMath { m m } { \__crfwd_usedbyandon_message_outside_math:nn { #1 } { #2 } } + +\tl_new:N \g__crfwd_tmpa_tl +\NewDocumentCommand \SetUsedOnMessageStyle { m } + { + % \cs_set:Nn \__crfwd_usedon_message:n { #1 } + \cs_set:Npn \__crfwd_usedon_message:n ##1 { \cs_set:Nn \__crfwd_usedon_message:n { #1 } } + \__crfwd_usedon_message:n { \UsedOnMessageText{##1} } + } +\NewDocumentCommand \SetUsedByMessageStyle { m } + { + \cs_set:Npn \__crfwd_usedby_message:n ##1 { \cs_set:Nn \__crfwd_usedby_message:n { #1 } } + \__crfwd_usedby_message:n { \UsedByMessageText{##1} } + } +\NewDocumentCommand \SetUsedByAndOnMessageStyle { m } + { + \cs_set:Npn \__crfwd_usedbyandon_message:nn ##1 { \cs_set:Nn \__crfwd_usedbyandon_message:nn { #1 } } + \__crfwd_usedbyandon_message:nn { \UsedByAndOnMessageText{##1}{##2} } + } +\bool_new:N \g__crfwd_inside_math_bool +\NewDocumentCommand \SetUsedOnMessageStyleInsideMath { m } + { + \bool_set_true:N \g__crfwd_inside_math_bool + \cs_set:Npn \__crfwd_usedon_message_inside_math:n ##1 { \cs_set:Nn \__crfwd_usedon_message_inside_math:n { #1 } } + \__crfwd_usedon_message_inside_math:n { \UsedOnMessageText{##1} } + } +\NewDocumentCommand \SetUsedByMessageStyleInsideMath { m } + { + \bool_set_true:N \g__crfwd_inside_math_bool + \cs_set:Npn \__crfwd_usedby_message_inside_math:n ##1 { \cs_set:Nn \__crfwd_usedby_message_inside_math:n { #1 } } + \__crfwd_usedby_message_inside_math:n { \UsedByMessageText{##1} } + } +\NewDocumentCommand \SetUsedByAndOnMessageStyleInsideMath { m } + { + \bool_set_true:N \g__crfwd_inside_math_bool + \cs_set:Npn \__crfwd_usedbyandon_message_inside_math:nn ##1 { \cs_set:Nn \__crfwd_usedbyandon_message_inside_math:nn { #1 } } + \__crfwd_usedbyandon_message_inside_math:nn { \UsedByAndOnMessageText{##1}{##2} } + } + +\clist_new:N \l__crfwd_supported_equation_env_clist +\clist_set:Nn \l__crfwd_supported_equation_env_clist + { + equation, + align, flalign, alignat, + gather, + multline, + dmath, + } +\cs_new:Nn \__crfwd_message_outsidemath_hook_gremove_code:nn + { + \clist_map_inline:Nn \l__crfwd_supported_equation_env_clist + { + \hook_gremove_code:nn { env/##1/#1 } { cleveref-forward- #2 -message-outsidemath } + } + } +\cs_new:Nn \__crfwd_message_outsidemath_hook_gput_code:nnn + { + \clist_map_inline:Nn \l__crfwd_supported_equation_env_clist + { + \hook_gput_code:nnn { env/##1/#1 } { cleveref-forward- #2 -message-outsidemath } { #3 } + } + } +\cs_new:Nn \__crfwd_message_outsidemath_hook_gset_rule:nnnn + { + \clist_map_inline:Nn \l__crfwd_supported_equation_env_clist + { + \hook_gset_rule:nnnn { env/##1/#1 } { cleveref-forward- #2 -message-outsidemath } { #3 } { cleveref-forward- #4 -message-outsidemath } + } + } +\__crfwd_message_outsidemath_hook_gput_code:nnn { before } { UsedOn } { } +\__crfwd_message_outsidemath_hook_gput_code:nnn { before } { UsedBy } { } +\__crfwd_message_outsidemath_hook_gput_code:nnn { before } { UsedByAndOn } { } +\__crfwd_message_outsidemath_hook_gput_code:nnn { after } { UsedOn } { } +\__crfwd_message_outsidemath_hook_gput_code:nnn { after } { UsedBy } { } +\__crfwd_message_outsidemath_hook_gput_code:nnn { after } { UsedByAndOn } { } +\NewDocumentCommand \SetUsedOnMessageStyleOutsideMath { m } + { + \bool_set_false:N \g__crfwd_inside_math_bool + \RenewDocumentCommand \UsedOnMessageOutsideMath { m } + { + \__crfwd_message_outsidemath_hook_gset_rule:nnnn { after } { UsedOn } { voids } { UsedBy } + \__crfwd_message_outsidemath_hook_gset_rule:nnnn { after } { UsedOn } { voids } { UsedByAndOn } + \tl_gset:Ne \g__crfwd_tmpa_tl { ##1 } + } + \cs_set:Npn \__crfwd_usedon_message_outside_math:n ##1 + { + \cs_set:Nn \__crfwd_usedon_message_outside_math:n + { + \bool_if:NF \g__crfwd_label_no_use_bool + { + \tl_if_empty:NF \g__crfwd_tmpa_tl + { + #1 + } + } + } + } + \__crfwd_usedon_message_outside_math:n { \UsedOnMessageText{##1} } + \__crfwd_message_outsidemath_hook_gremove_code:nn { before } { UsedOn } + \__crfwd_message_outsidemath_hook_gput_code:nnn { before } { UsedOn } + { + \tl_gclear:N \g__crfwd_tmpa_tl + } + \__crfwd_message_outsidemath_hook_gremove_code:nn { after } { UsedOn } + \__crfwd_message_outsidemath_hook_gput_code:nnn { after } { UsedOn } + { + \__crfwd_usedon_message_outside_math:n { \tl_use:N \g__crfwd_tmpa_tl } + } + } +\NewDocumentCommand \SetUsedByMessageStyleOutsideMath { m } + { + \bool_set_false:N \g__crfwd_inside_math_bool + \RenewDocumentCommand \UsedByMessageOutsideMath { m } + { + \__crfwd_message_outsidemath_hook_gset_rule:nnnn { after } { UsedBy } { voids } { UsedOn } + \__crfwd_message_outsidemath_hook_gset_rule:nnnn { after } { UsedBy } { voids } { UsedByAndOn } + \tl_gset:Ne \g__crfwd_tmpa_tl { ##1 } + } + \cs_set:Npn \__crfwd_usedby_message_outside_math:n ##1 + { + \cs_set:Nn \__crfwd_usedby_message_outside_math:n + { + \bool_if:NF \g__crfwd_label_no_use_bool + { + \tl_if_empty:NF \g__crfwd_tmpa_tl + { + #1 + } + } + } + } + \__crfwd_usedby_message_outside_math:n { \UsedByMessageText{##1} } + \__crfwd_message_outsidemath_hook_gremove_code:nn { before } { UsedBy } + \__crfwd_message_outsidemath_hook_gput_code:nnn { before } { UsedBy } + { + \tl_gclear:N \g__crfwd_tmpa_tl + } + \__crfwd_message_outsidemath_hook_gremove_code:nn { after } { UsedBy } + \__crfwd_message_outsidemath_hook_gput_code:nnn { after } { UsedBy } + { + \__crfwd_usedby_message_outside_math:n { \tl_use:N \g__crfwd_tmpa_tl } + } + } +\NewDocumentCommand \SetUsedByAndOnMessageStyleOutsideMath { m } + { + \bool_set_false:N \g__crfwd_inside_math_bool + \RenewDocumentCommand \UsedByAndOnMessageOutsideMath { m m } + { + \__crfwd_message_outsidemath_hook_gset_rule:nnnn { after } { UsedByAndOn } { voids } { UsedOn } + \__crfwd_message_outsidemath_hook_gset_rule:nnnn { after } { UsedByAndOn } { voids } { UsedBy } + \tl_gset:Ne \g__crfwd_tmpa_tl { ##1 } + \tl_gset:Ne \g__crfwd_tmpb_tl { ##2 } + } + \cs_set:Npn \__crfwd_usedbyandon_message_outside_math:nn ##1 + { + \cs_set:Nn \__crfwd_usedbyandon_message_outside_math:nn + { + \bool_if:NF \g__crfwd_label_no_use_bool + { + \tl_if_empty:NF \g__crfwd_tmpa_tl + { + #1 + } + } + } + } + \__crfwd_usedbyandon_message_outside_math:nn { \UsedByAndOnMessageText{##1}{##2} } + \__crfwd_message_outsidemath_hook_gremove_code:nn { before } { UsedByAndOn } + \__crfwd_message_outsidemath_hook_gput_code:nnn { before } { UsedByAndOn } + { + \tl_gclear:N \g__crfwd_tmpa_tl + \tl_gclear:N \g__crfwd_tmpb_tl + } + \__crfwd_message_outsidemath_hook_gremove_code:nn { after } { UsedByAndOn } + \__crfwd_message_outsidemath_hook_gput_code:nnn { after } { UsedByAndOn } + { + \__crfwd_usedbyandon_message_outside_math:nn { \tl_use:N \g__crfwd_tmpa_tl } { \tl_use:N \g__crfwd_tmpb_tl } + } + } + +\NewDocumentCommand \SetForwardReferenceStyle { m } + { + \SetUsedOnMessageStyle { #1 } + \SetUsedByMessageStyle { #1 } + \SetUsedByAndOnMessageStyle { #1 } + } +\NewDocumentCommand \SetForwardReferenceStyleInsideMath { m } + { + \SetUsedOnMessageStyleInsideMath { #1 } + \SetUsedByMessageStyleInsideMath { #1 } + \SetUsedByAndOnMessageStyleInsideMath { #1 } + } +\NewDocumentCommand \SetForwardReferenceStyleOutsideMath { m } + { + \SetUsedOnMessageStyleOutsideMath { #1 } + \SetUsedByMessageStyleOutsideMath { #1 } + \SetUsedByAndOnMessageStyleOutsideMath { #1 } + } + +% The default style +\SetForwardReferenceStyle + { + \emph{#1} \\[.3\baselineskip] + } +\SetForwardReferenceStyleOutsideMath + { + \begin{flushright} + \emph{#1} + \end{flushright} + \vspace{.15\baselineskip} + } + +\cs_new:Nn \__crfwd_cref_adjusted:n { \cref{#1} } +\cs_new:Nn \__crfwd_cpageref_adjusted:n { \cpageref{#1} } +\cs_new:Npn \__crfwd_adjust_cref_user: { } +\cs_new:Npn \__crfwd_adjust_cpageref_user: { } +\NewDocumentCommand \SetForwardReferenceRefForm { m } + { + % \cs_set:Npn \__crfwd_cref_adjusted:n ##1 { #1{##1} } + \cs_set:Npn \__crfwd_adjust_cref_user: + { + \cs_set:Npn \__crfwd_cref_adjusted:n ####1 { #1{####1} } + } + } +\NewDocumentCommand \SetForwardReferencePagerefForm { m } + { + % \cs_set:Npn \__crfwd_cpageref_adjusted:n ##1 { #1{##1} } + \cs_set:Npn \__crfwd_adjust_cpageref_user: + { + \cs_set:Npn \__crfwd_cpageref_adjusted:n ####1 { #1{####1} } + } + } +\bool_if:NTF \l__crfwd_crefthe_enabled_bool + { + \AtBeginDocument + { + \addto\extrasfrench{\crefthename{page}[le]{page}[les]{pages}} + \addto\extrasspanish{\crefthename{page}[la]{página}[las]{páginas}} + } + \SetUsedOnMessageText + { + \IfLanguageName{english} + { (Used~on~#1.) } {} + \IfLanguageName{french} + { (Apparaît~en~#1.) } {} + \IfLanguageName{ngerman} + { (Wird~auf~#1.) } {} + \IfLanguageName{italian} + { (Appare~a~#1.) } {} + \IfLanguageName{spanish} + { (Aparece~en~#1.) } {} + } + \SetUsedByMessageText + { + \IfLanguageName{english} + { (Used~by~#1.) } {} + \IfLanguageName{french} + { (Apparaît~dans~#1.) } {} + \IfLanguageName{ngerman} + { (Wird~#1.) } {} + \IfLanguageName{italian} + { (Appare~#1.) } {} + \IfLanguageName{spanish} + { (Aparece~en~#1.) } {} + } + \SetUsedByAndOnMessageText + { + \IfLanguageName{english} + { (Used~by~#1~on~#2.) } {} + \IfLanguageName{french} + { (Apparaît~dans~#1~en~#2.) } {} + \IfLanguageName{ngerman} + { (Wird~#1~auf~#2.) } {} + \IfLanguageName{italian} + { (Appare~#1~a~#2.) } {} + \IfLanguageName{spanish} + { (Aparece~en~#1~en~#2.) } {} + } + \cs_new:Nn \__crfwd_adjust_cref_commands: + { + \IfLanguageName{english} + { + \cs_set:Npn \__crfwd_cref_adjusted:n ##1 { \cref{##1} } + \cs_set:Npn \__crfwd_cpageref_adjusted:n ##1 { \cpageref{##1} } + } {} + \IfLanguageName{french} + { + \cs_set:Npn \__crfwd_cref_adjusted:n ##1 { \crefthe{##1} } + \cs_set:Npn \__crfwd_cpageref_adjusted:n ##1 { \cpagerefthe[noun]{##1} } + } {} + \IfLanguageName{ngerman} + { + \cs_set:Npn \__crfwd_cref_adjusted:n ##1 { \crefthe[von,dat.]{##1} } + \cs_set:Npn \__crfwd_cpageref_adjusted:n ##1 { \cpagerefthe[noun]{##1} } + } {} + \IfLanguageName{italian} + { + \cs_set:Npn \__crfwd_cref_adjusted:n ##1 { \crefthe[in]{##1} } + \cs_set:Npn \__crfwd_cpageref_adjusted:n ##1 { \cpagerefthe[noun]{##1} } + } {} + \IfLanguageName{spanish} + { + \cs_set:Npn \__crfwd_cref_adjusted:n ##1 { \crefthe{##1} } + \cs_set:Npn \__crfwd_cpageref_adjusted:n ##1 { \cpagerefthe{##1} } + } {} + \__crfwd_adjust_cref_user: + \__crfwd_adjust_cpageref_user: + } + } + { + \cs_new:Nn \__crfwd_adjust_cref_commands: + { + \cs_set:Npn \__crfwd_cref_adjusted:n ##1 { \cref{##1} } + \cs_set:Npn \__crfwd_cpageref_adjusted:n ##1 { \cpageref{##1} } + \__crfwd_adjust_cref_user: + \__crfwd_adjust_cpageref_user: + } + } + +\cs_new:Nn \__crfwd_printer_generic:nnn + { + % Check if the reference #1@<LabelName>@1 exists + % Here the @1 means that <LabelName> has been referenced + % with option #1 at least once where #1 is + % 'UsedOn', 'UsedBy' or 'UsedByAndOn' + \cs_if_exist:cT {r@#1@#2@1} + { + % In a tmp clist we store all the references of the form + % `<Option>@<LabelName>@<Number>` + % where Number between 1 and \value{LastRun@UsedOn@<LabelName>} + % if the latter exists, otherwise until 1 + % Should/will normally need two consecutive runs of pdflatex + \cs_if_free:cTF {c@LastRun@#1@#2} + { \int_set:Nn \l_tmpa_int { 1 } } + { \int_set:Nn \l_tmpa_int { \value{LastRun@#1@#2} } } + \int_set:Nn \l_tmpb_int { 1 } + \int_while_do:nn { \l_tmpb_int <= \l_tmpa_int } + { + \clist_put_right:Nx \l_tmpa_clist { #1@#2@\int_use:N \l_tmpb_int } + \int_incr:N \l_tmpb_int + } + #3 + } + } +\cs_new:Nn \__crfwd_printer:nn + { + \__crfwd_adjust_cref_commands: + \__crfwd_printer_generic:nnn { #1 } { #2 } + { + % Print `UsedOn` message by calling \cpageref with the parameter clist above + % Uncomment the next two lines for debugging to see the contents of \l_tmpa_clist + %% Arguments~of~cpageref/cref~are: + %% \par\clist_use:Nn \l_tmpa_clist {\par}\par + \str_case:xn { \str_foldcase:n { #1 } } + { + {used-on} { \UsedOnMessage { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used~on} { \UsedOnMessage { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used on} { \UsedOnMessage { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {uo} { \UsedOnMessage { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used-by} { \UsedByMessage { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } } + {used~by} { \UsedByMessage { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } } + {used by} { \UsedByMessage { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } } + {ub} { \UsedByMessage { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } } + {used-by-and-on} { \UsedByAndOnMessage { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used~by~and~on} { \UsedByAndOnMessage { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used by and on} { \UsedByAndOnMessage { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {ubao} { \UsedByAndOnMessage { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {ubo} { \UsedByAndOnMessage { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + } + } + } +\cs_new:Nn \__crfwd_printer_math:nn + { + \__crfwd_adjust_cref_commands: + \__crfwd_printer_generic:nnn { #1 } { #2 } + { + % Print `UsedOn` message by calling \cpageref with the parameter clist above + % Uncomment the next two lines for debugging to see the contents of \l_tmpa_clist + %% Arguments~of~cpageref/cref~are: + %% \par\clist_use:Nn \l_tmpa_clist {\par}\par + \bool_if:NTF \g__crfwd_inside_math_bool + { + \RenewCommandCopy \UsedOnMessageMath \UsedOnMessageInsideMath + \RenewCommandCopy \UsedByMessageMath \UsedByMessageInsideMath + \RenewCommandCopy \UsedByAndOnMessageMath \UsedByAndOnMessageInsideMath + } + { + \RenewCommandCopy \UsedOnMessageMath \UsedOnMessageOutsideMath + \RenewCommandCopy \UsedByMessageMath \UsedByMessageOutsideMath + \RenewCommandCopy \UsedByAndOnMessageMath \UsedByAndOnMessageOutsideMath + } + \str_case:xn { \str_foldcase:n { #1 } } + { + {used-on} { \UsedOnMessageMath { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used~on} { \UsedOnMessageMath { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used on} { \UsedOnMessageMath { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {uo} { \UsedOnMessageMath { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used-by} { \UsedByMessageMath { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } } + {used~by} { \UsedByMessageMath { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } } + {used by} { \UsedByMessageMath { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } } + {ub} { \UsedByMessageMath { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } } + {used-by-and-on} { \UsedByAndOnMessageMath { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used~by~and~on} { \UsedByAndOnMessageMath { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {used by and on} { \UsedByAndOnMessageMath { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {ubao} { \UsedByAndOnMessageMath { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + {ubo} { \UsedByAndOnMessageMath { \__crfwd_cref_adjusted:n { \l_tmpa_clist } } { \__crfwd_cpageref_adjusted:n { \l_tmpa_clist } } } + } + } + } + +\cs_new:Nn \__crfwd_print_message:n + { + \clist_map_inline:Nn \g__crfwd_options_clist + { + \__crfwd_printer:nn { ##1 } { #1 } + } + } +\cs_new:Nn \__crfwd_print_message_math:n + { + \clist_map_inline:Nn \g__crfwd_options_clist + { + \__crfwd_printer_math:nn { ##1 } { #1 } + } + } + +\str_new:N \l__crfwd_option_str +\msg_new:nnn {cleveref-forward} { unrecognised-option } + { + Unrecognised~option~`#1'. + } +\NewDocumentCommand \__crfwd_processor:w { o m } + { + \IfValueT { #1 } + { + \str_case:xnTF { \str_foldcase:n { #1 } } + { + % check if options 'UsedOn', 'UsedBy' or 'UsedByAndOn' + % (case-insensitive) were used in one of the following forms + {used-on} { \str_set:Nn \l__crfwd_option_str {UsedOn} } + {used~on} { \str_set:Nn \l__crfwd_option_str {UsedOn} } + {used on} { \str_set:Nn \l__crfwd_option_str {UsedOn} } + {uo} { \str_set:Nn \l__crfwd_option_str {UsedOn} } + {used-by} { \str_set:Nn \l__crfwd_option_str {UsedBy} } + {used~by} { \str_set:Nn \l__crfwd_option_str {UsedBy} } + {used by} { \str_set:Nn \l__crfwd_option_str {UsedBy} } + {ub} { \str_set:Nn \l__crfwd_option_str {UsedBy} } + {used-by-and-on} { \str_set:Nn \l__crfwd_option_str {UsedByAndOn} } + {used~by~and~on} { \str_set:Nn \l__crfwd_option_str {UsedByAndOn} } + {used by and on} { \str_set:Nn \l__crfwd_option_str {UsedByAndOn} } + {ubao} { \str_set:Nn \l__crfwd_option_str {UsedByAndOn} } + {ubo} { \str_set:Nn \l__crfwd_option_str {UsedByAndOn} } + } + { + { + % Loop through (potential) label list in arg of \cref (or \Cref) + \seq_set_from_clist:Nn \l_tmpa_seq { #2 } + \seq_map_inline:Nn \l_tmpa_seq + { + % if the label has not been referenced yet, + % create a counter for the current and last run and save the label in the + % global container \g_@@_k_seq + \seq_if_in:NxF \g__crfwd_k_seq { \l__crfwd_option_str @##1 } + { + \newcounter{ ThisRun@ \l__crfwd_option_str @##1 } + \cs_if_free:cT {c@LastRun@ \l__crfwd_option_str @##1} + { + \newcounter{LastRun@ \l__crfwd_option_str @##1} + } + \seq_gput_right:Nx \g__crfwd_k_seq + { \l__crfwd_option_str @##1} + } + % increase the counters and compare with max counter + \stepcounter{ThisRun@ \l__crfwd_option_str @##1} + \setcounter{LastRun@ \l__crfwd_option_str @##1} + { + \fp_eval:n + { + max( + \value{ThisRun@ \l__crfwd_option_str @##1} , + \value{LastRun@ \l__crfwd_option_str @##1} + ) + } + } + % store the value in global key-value property list + \prop_gput:Nxx \g__crfwd_kv_prop + { \l__crfwd_option_str @##1} + {\arabic{LastRun@ \l__crfwd_option_str @##1}} + % create a label for the UsedOn reference and number this label + \__crfwd_orig_label:w + { + \l__crfwd_option_str @##1@ + \arabic{ThisRun@ \l__crfwd_option_str @##1} + } + } + } + } + { + \msg_warning:nnn { cleveref-forward } { unrecognised-option } { #1 } + } + } + } +\bool_new:N \g__crfwd_ref_no_use_bool +\bool_new:N \l__crfwd_option_has_been_chosen_bool +\clist_new:N \l__crfwd_local_options_clist +\cs_new:Nn \__crfwd_define_from_orig_:NN + { + \NewDocumentCommand #1 { s o m } + { + \IfValueTF { ##2 } + { + \bool_set_false:N \l__crfwd_option_has_been_chosen_bool + \bool_set_false:N \g__crfwd_ref_no_use_bool + \clist_set:Nn \l__crfwd_local_options_clist { ##2 } + \clist_put_right:No \l__crfwd_local_options_clist { \l__crfwd_default_package_option_tl } + \clist_map_inline:Nn \l__crfwd_local_options_clist + { + \str_case:xnT { \str_foldcase:n { ####1 } } + { + {no-use} {} + {no~use} {} + {no use} {} + {not-use} {} + {not~use} {} + {not use} {} + } + { + \clist_remove_all:Nn \l__crfwd_local_options_clist { ####1 } + \bool_gset_true:N \g__crfwd_ref_no_use_bool + } + } + \clist_map_inline:Nn \l__crfwd_local_options_clist + { + \str_case:xnT { \str_foldcase:n { ####1 } } + { + {used-on} {} + {used~on} {} + {used on} {} + {uo} {} + {used-by} {} + {used~by} {} + {used by} {} + {ub} {} + {used-by-and-on} {} + {used~by~and~on} {} + {used by and on} {} + {ubao} {} + {ubo} {} + } + { + \clist_remove_all:Nn \l__crfwd_local_options_clist { ####1 } + \bool_if:NF \l__crfwd_option_has_been_chosen_bool + { + \bool_if:NF \g__crfwd_ref_no_use_bool + { + \__crfwd_processor:w [ ####1 ] { ##3 } + } + } + \bool_set_true:N \l__crfwd_option_has_been_chosen_bool + } + } + \clist_if_empty:NTF \l__crfwd_local_options_clist + { + \IfBooleanTF { ##1 } { #2*{##3} } { #2{##3} } + } + { + \IfBooleanTF { ##1 } { #2*[\l__crfwd_local_options_clist]{##3} } { #2[\l__crfwd_local_options_clist]{##3} } + } + } + { + \tl_if_blank:VF \l__crfwd_default_package_option_tl + { + \clist_clear:N \l__crfwd_local_options_clist + \clist_put_right:No \l__crfwd_local_options_clist { \l__crfwd_default_package_option_tl } + \clist_map_inline:Nn \l__crfwd_local_options_clist + { + \__crfwd_processor:w [ ####1 ] { ##3 } + } + } + \IfBooleanTF { ##1 } { #2*{##3} } { #2{##3} } + } + } + } +\__crfwd_define_from_orig_:NN \__crfwd_cref:w \__crfwd_orig_cref:w +\__crfwd_define_from_orig_:NN \__crfwd_Cref:w \__crfwd_orig_Cref:w +\__crfwd_define_from_orig_:NN \__crfwd_labelcref:w \__crfwd_orig_labelcref:w +\cs_new:Npn \__crfwd_read_from_aux: + { + \prop_map_inline:Nn \g__crfwd_kv_prop + { + \newcounter{LastRun@##1} + \setcounter{LastRun@##1}{##2} + } + } +\cs_new:Npn \__crfwd_write_to_aux: + { + % First, we clear the global key-value prop list \cs{g_@@_kv_prop} and + % then we rebuild it with the information from the current run. + \prop_clear:N \g__crfwd_kv_prop + \seq_map_inline:Nn \g__crfwd_k_seq + { \prop_gput:Nxx \g__crfwd_kv_prop {##1}{\arabic{ThisRun@##1}} } + % Turn on |expl3| functionality in .aux file. + \iow_now:cx { @auxout } + { \token_to_str:N \ExplSyntaxOn } + % Loop through the key-val |proplist| and write contents to .aux file. + \prop_map_inline:Nn \g__crfwd_kv_prop + { + \tl_set:Nn \l_tmpa_tl { ##1 } + \tl_replace_all:Nnn \l_tmpa_tl { ~ } { \c_tilde_str } + \iow_now:cx { @auxout } + { + \prop_gput_from_keyval:Nn \token_to_str:N \g__crfwd_kv_prop + { {\l_tmpa_tl} = ##2 } + } + } + % Turn off |expl3| functionality in .aux file. + \iow_now:cx { @auxout } + { \token_to_str:N \ExplSyntaxOff } +}% + +\RequirePackage { regexpatch } +\@namedef{ver@xpatch.sty}{} + +\hook_gput_code:nnn { begindocument/end } { cleveref-forward } + { + \__crfwd_read_from_aux: + \cs_if_exist:NF \label@in@display { \NewCommandCopy \label@in@display \label } + \NewCommandCopy \__crfwd_orig_label_in_display:w \label@in@display + \NewCommandCopy \__crfwd_orig_label:w \label + \NewCommandCopy \__crfwd_orig_cref:w \cref + \NewCommandCopy \__crfwd_orig_Cref:w \Cref + \NewCommandCopy \__crfwd_orig_labelcref:w \labelcref + \bool_new:N \g__crfwd_label_no_use_bool + \prop_new:N \g__crfwd_label_prop + \cs_new:Nn \__crfwd_label_generic:nnn + % #1 = optional argument of \label + % #2 = mandatory argument of \label + % #3 = the varying part + { + \bool_gset_false:N \g__crfwd_label_no_use_bool + \prop_gput:Nno \g__crfwd_label_prop { #2 } { \cref@currentlabel } + \clist_clear:N \l__crfwd_local_options_clist + \IfValueT { #1 } + { + \clist_set:Nn \l__crfwd_local_options_clist { #1 } + } + \clist_map_inline:Nn \l__crfwd_local_options_clist + { + \str_case:xnT { \str_foldcase:n { ##1 } } + { + {no-use} {} + {no~use} {} + {no use} {} + {not-use} {} + {not~use} {} + {not use} {} + } + { + \clist_remove_all:Nn \l__crfwd_local_options_clist { ##1 } + \bool_gset_true:N \g__crfwd_label_no_use_bool + } + } + #3 + } + \RenewDocumentCommand \label { o m } + { + \__crfwd_label_generic:nnn { #1 } { #2 } + { + \if_mode_math: % this is for environments that do not use \label@in@display + \clist_if_empty:NTF \l__crfwd_local_options_clist + { + \__crfwd_orig_label_in_display:w { #2 } + } + { + \__crfwd_orig_label_in_display:w [ \l__crfwd_local_options_clist ] { #2 } + } + \bool_if:NF \g__crfwd_label_no_use_bool + { + \__crfwd_print_message:n { #2 } + } + \else: + \clist_if_empty:NTF \l__crfwd_local_options_clist + { + \__crfwd_orig_label:w { #2 } + } + { + \__crfwd_orig_label:w [ \l__crfwd_local_options_clist ] { #2 } + } + \bool_if:NF \g__crfwd_label_no_use_bool + { + \__crfwd_print_message:n { #2 } + } + \fi: + } + } + \RenewDocumentCommand \label@in@display { o m } + { + \__crfwd_label_generic:nnn { #1 } { #2 } + { + \clist_if_empty:NTF \l__crfwd_local_options_clist + { + \__crfwd_orig_label_in_display:w { #2 } + } + { + \__crfwd_orig_label_in_display:w [ \l__crfwd_local_options_clist ] { #2 } + } + \bool_if:NF \g__crfwd_label_no_use_bool + { + \__crfwd_print_message_math:n { #2 } + } + } + } + \NewDocumentCommand \label@gobble { o m } + { + \__crfwd_label_generic:nnn { #1 } { #2 } + { + \bool_if:NF \g__crfwd_label_no_use_bool + { + \__crfwd_print_message_math:n { #2 } + } + } + } + \makeatletter + \xpatchcmd{\multline@}{\let\label\cref@gobble@optarg}{\let\label\label@gobble}{}{} + \makeatother + \NewDocumentCommand \restorelabel { m } + { + \prop_if_in:NnTF \g__crfwd_label_prop { #1 } + { + \prop_get:NnN \g__crfwd_label_prop { #1 } \l_tmpa_tl + \RenewCommandCopy \cref@currentlabel \l_tmpa_tl + } + { + \msg_new:nnn {cleveref-forward} { label-not-exist } + { + The~label~`##1'~does~not~exist. + } + \msg_fatal:nnn { cleveref-forward } { label-not-exist } { #1 } + } + } + \RenewCommandCopy \cref \__crfwd_cref:w + \RenewCommandCopy \Cref \__crfwd_Cref:w + \RenewCommandCopy \labelcref \__crfwd_labelcref:w + } +\hook_gput_code:nnn { enddocument } { cleveref-forward } + { + \__crfwd_write_to_aux: + } +\endinput +%% +%% End of file `cleveref-forward.sty'. diff --git a/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.pdf b/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.pdf Binary files differnew file mode 100644 index 0000000000..1c7bfaedba --- /dev/null +++ b/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.pdf diff --git a/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.tex b/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.tex new file mode 100644 index 0000000000..8c3595ce26 --- /dev/null +++ b/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.tex @@ -0,0 +1,504 @@ +\documentclass[ + use style = plain, + title in boldface, + % title in sffamily, + emphasize theorems, + simple name, % not suitable for French, German, etc. + name in link, +]{einfart} +\usepackage{ProjLib} + +\usepackage[crefthe]{cleveref-forward} +\usepackage{changepage,todonotes,marginnote} + +%%================================ +%% For typesetting code +%%================================ +\usepackage{listings} +\usepackage{xcolor} +\usepackage{setspace} +\definecolor{code-main}{RGB}{70,130,180} +\definecolor{code-expl3}{RGB}{240,50,60} +\definecolor{code-option}{RGB}{40,110,20} +\definecolor{code-keys}{RGB}{100,130,150} +\definecolor{code-comment}{RGB}{20,120,80} +\definecolor{code-background}{gray}{0.99} +\lstset{ + language = [LaTeX]TeX, + basicstyle = \ttfamily, + keywordstyle = \color{code-main}, + commentstyle = \color{code-comment}, + showstringspaces = false, + breaklines = true, + frame = lines, + backgroundcolor = \color{code-background}, + flexiblecolumns = true, + escapeinside = {(*}{*)}, + alsoletter = {_,:}, + % numbers = left, + % firstnumber = last, + numberstyle = \scriptsize\ttfamily, + stepnumber = 1, + numbersep = 5pt, +} +\newcommand{\meta}[1]{$\langle${\normalfont\itshape#1}$\rangle$} +\lstset{% LaTeX2 commands + classoffset = 0, + texcsstyle =* \color{code-main}, + moretexcs = + { + ExplSyntaxOn,ExplSyntaxOff, + NewDocumentCommand,NewDocumentEnvironment, + cref,Cref, + crefthe,Crefthe, + cpageref, + cpagerefthe, + namecref,nameCref, + labelcref,labelCref, + restorelabel, + SetUsedOnMessageText, + SetUsedByMessageText, + SetUsedByAndOnMessageText, + SetForwardReferenceStyle, + SetForwardReferenceStyleInsideMath, + SetForwardReferenceStyleOutsideMath, + SetForwardReferenceRefForm, + SetForwardReferencePagerefForm, + todo, + marginnote, + } +} +\lstset{% LaTeX3 commands + classoffset = 1, + texcsstyle =* \color{code-expl3}, + moretexcs = + { + tl_new:N, + tl_set:Nn, + cs_undefine:c, + } +} +\lstnewenvironment{code}{\setstretch{1.05}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}} +\lstnewenvironment{code*}{\setstretch{1.05}\lstset{numbers=left}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}} + +\newcommand{\packageoption}[1]{\texttt{\textcolor{code-option}{#1}}} +\newcommand{\commandoption}[1]{\texttt{\textcolor{code-keys}{#1}}} + +%%================================ +%% tip +%%================================ +\usepackage[many]{tcolorbox} +\newenvironment{tip}[1][Tip] + {% + \LocallyStopLineNumbers% + \begin{tcolorbox}[breakable, + enhanced, + width = \textwidth, + colback = paper, colbacktitle = paper, + colframe = gray!50, boxrule=0.2mm, + coltitle = black, + fonttitle = \sffamily, + attach boxed title to top left = {yshift=-\tcboxedtitleheight/2, xshift=.5cm}, + boxed title style = {boxrule=0pt, colframe=paper}, + before skip = 3mm, + after skip = 3mm, + top = 2.5mm, + bottom = 1.5mm, + title={\scshape\sffamily #1}]% + } + {% + \end{tcolorbox}% + \ResumeLineNumbers% + } + + +\title{Demonstration on the usage and configuration of \textquote{\textsf{cleveref-forward}}} +\author{} +\date{\today[only-year-month]} + +\begin{document} + +\maketitle + +\section{With the default configuration} + +\subsection{Theorem-like environments} + +\begin{lemma}\label{lem:result} + Some preliminary result (see the equation \labelcref[used by]{eq:1}). +\end{lemma} + +\begin{theorem}\label{thm:test} + Text. +\end{theorem} +\begin{proof}\restorelabel{thm:test} % Notice the use of \restorelabel here + Some proof that involves the \cref[used by]{lem:result} and the equations \labelcref[used by and on]{eq:Euler}, \labelcref[used by]{eq:1,eq:2} in the next section. Here, \lstinline|\restorelabel| makes sure that this \texttt{proof} environment is being recognized as the theorem itself. +\end{proof} + +\subsection{Equations} + +By default, the forward referencing infomation is placed immediately after the equation. + +\begin{equation}\label{eq:Euler} + \mathrm{e}^{\mathrm{i}\pi} + 1 = 0. +\end{equation} + +However, with this method, for multilined equations with multiple references, only the last reference will be shown: +\begin{align} + 1 &= 0 + 1 \label{eq:1}\\ + 2 &= 1 + 1 \label{eq:2} +\end{align} + +This can be overcome if you are willing to place the text message in the margin, see the section on customization. + +\subsection{Other types} + +It can also be used for some other types, such as items in \texttt{enumerate} list, as long as \textsf{cleveref} is properly configured for that type. + +\section{Specify a default option} + +If you wish to apply the mode \commandoption{used on}, or \commandoption{used by}, or \commandoption{used by and on} to all \lstinline|\cref| (and \lstinline|\labelcref|, etc.), you can use the package option \packageoption{default = }\meta{mode}. Then you don't need to write it everywhere. And if you wish to manually change this \meta{mode} somewhere, you can still specify it as the command option; and if you don't want the message to display for some references, you may also use the option \commandoption{no use} on the corresponding \lstinline|\label| to disable the related messages. + + +\section{Customizations} + +\begingroup + +Here is how you change the appearing text: + +\begin{code} +\SetUsedOnMessageText{Appears on~#1.} +\SetUsedByMessageText{Appears in~#1.} +\SetUsedByAndOnMessageText{Appears in~#1 on~#2.} +\end{code} + +\SetUsedOnMessageText{Appears on~#1.} +\SetUsedByMessageText{Appears in~#1.} +\SetUsedByAndOnMessageText{Appears in~#1 on~#2.} + +\bigskip +And here is an example of setting the message style with \textsf{todonotes}: + +\begin{code} +\SetForwardReferenceStyle + {% + \todo[% + inline, + size=\scriptsize, + color=blue!40, + backgroundcolor=white, + textcolor=blue!50!cyan, + bordercolor=blue!50!cyan, + noprepend]{% + \textup{#1}% + }% + } +\SetForwardReferenceStyleOutsideMath + {% + \todo[% + inline, + size=\scriptsize, + caption={}, % <-- needed, otherwise there would be errors + color=blue!40, + backgroundcolor=white, + textcolor=blue!50!cyan, + bordercolor=blue!50!cyan, + noprepend]{% + \textup{#1}% + }% + } +\end{code} + +\SetForwardReferenceStyle + {% + \todo[% + inline, + size=\scriptsize, + color=blue!40, + backgroundcolor=white, + textcolor=blue!50!cyan, + bordercolor=blue!50!cyan, + noprepend]{% + \textup{#1}% + }% + } +\SetForwardReferenceStyleOutsideMath + {% + \todo[% + inline, + size=\scriptsize, + caption={}, % <-- needed, otherwise there would be errors + color=blue!40, + backgroundcolor=white, + textcolor=blue!50!cyan, + bordercolor=blue!50!cyan, + noprepend]{% + \textup{#1}% + }% + } + +\bigskip +We use the same example: + +\begin{lemma}\label{lem:result'} + Some preliminary result (see the equation \labelcref[used by]{eq:1'}). +\end{lemma} + +\begin{theorem}\label{thm:test'} + Text. +\end{theorem} +\begin{proof}\restorelabel{thm:test'} % Notice the use of \restorelabel here + Some proof that involves the \cref[used by]{lem:result'} and the equations \labelcref[used by and on]{eq:Euler'}, \labelcref[used by]{eq:1',eq:2'}. +\end{proof} + +\begin{equation}\label{eq:Euler'} + \mathrm{e}^{\mathrm{i}\pi} + 1 = 0. +\end{equation} +\vspace{-\baselineskip} +\begin{align} + 1 &= 0 + 1 \label{eq:1'}\\ + 2 &= 1 + 1 \label{eq:2'} +\end{align} + +\bigskip +As you might have noticed, \lstinline|\SetForwardReferenceStyleOutsideMath| is for setting the style of those messages that appear outside the equations. + +There is also a \lstinline|\SetForwardReferenceStyleInsideMath|, which triggers the message immediately at where you placed the label. This way it is only plausible to put the message inside the margin. For example, you may configure: + +\begin{code} +\SetForwardReferenceStyle + {% + \marginnote{\normalfont#1}% + } +\SetForwardReferenceStyleInsideMath + {% + \marginnote{\normalfont#1}% + } +\end{code} + +\SetForwardReferenceStyle + {% + \marginnote{\normalfont#1}% + } +\SetForwardReferenceStyleInsideMath + {% + \marginnote{\normalfont#1}% + } + +\bigskip +The result would be somewhat like the following (assuming that your document has margins set wide enough): + +\vspace{-\baselineskip} +\setlength{\marginparwidth}{20em} +\setlength{\marginparsep}{-15em} +\begin{adjustwidth}{}{16em} + \begin{lemma}\label{lem:result''} + Some preliminary result (see the equation \labelcref[used by]{eq:1''}). + \end{lemma} + + \begin{theorem}\label{thm:test''} + Text. + \end{theorem} + \begin{proof}\restorelabel{thm:test''} % Notice the use of \restorelabel here + Some proof that involves the \cref[used by]{lem:result''} and the equations \labelcref[used by and on]{eq:Euler''}, \labelcref[used by]{eq:1'',eq:2''}. + \end{proof} + + \begin{equation}\label{eq:Euler''} + \mathrm{e}^{\mathrm{i}\pi} + 1 = 0. + \end{equation} + \begin{align} + 1 &= 0 + 1 \label{eq:1''}\\ + 2 &= 1 + 1 \label{eq:2''} + \end{align} +\end{adjustwidth} + +\bigskip +\begin{tip}[Attention] + Please pay attention to the usage of \lstinline|#1| and \lstinline|#2| in the configurations. +\end{tip} + +\clearpage +By the way, here is the default setting for the style: + +\begin{code} +\SetForwardReferenceStyle + {% + \emph{#1} \\[.3\baselineskip]% + } +\SetForwardReferenceStyleOutsideMath + {% + \begin{flushright}% + \emph{#1}% + \end{flushright}% + \vspace{.15\baselineskip}% + } +\end{code} + +\endgroup + +\SetForwardReferenceStyle + {% + \marginnote{\normalfont#1}% + } +\SetForwardReferenceStyleInsideMath + {% + \marginnote{\normalfont#1}% + } + +%% You can safely ignore the code between \ExplSyntaxOn and \ExplSyntaxOff +%% They are just for resetting the theorem referencing style for the rest of the document +\ExplSyntaxOn +\input{create-theorem-preset-names} % simple-name mode is not suitable for French, German, etc. +\exp_args:No \SetTheorem { \c_projlib_theorem_supported_clist, theorem-with-name } % remove the text style in the references + { + name style = { + , crefname style = { } + , Crefname style = { } + , numbering style = { } + } + } +\ExplSyntaxOff + + +\section{Besides writing in English} + +When writing in some European languages, it is possible to specify the definite article and/or declension in the optional argument of \lstinline|\cref| to ensure that the grammar is correct, provided that you have enabled the package option \packageoption{crefthe}. + +\subsection{Example in French} + +\UseLanguage{French} + +\vspace{-1.5\baselineskip} +\setlength{\marginparwidth}{24em} +\setlength{\marginparsep}{-18em} +\begin{adjustwidth}{}{20em} + \begin{lemma}\label{lem:result_fr} + Quelques résultats préliminaires (voir l'équation \labelcref[used by]{eq:1_fr}). + \end{lemma} + + \begin{theorem}\label{thm:test_fr} + Texte. + \end{theorem} + \begin{proof}\restorelabel{thm:test_fr} + % Notice the use of \cref[de,...] + Quelques lignes de preuves résultant \cref[de, used by]{lem:result_fr} et des équations \labelcref[used by and on]{eq:Euler_fr}, \labelcref[used by]{eq:1_fr,eq:2_fr}. + \end{proof} + + \begin{equation}\label{eq:Euler_fr} + \mathrm{e}^{\mathrm{i}\pi} + 1 = 0. + \end{equation} + \begin{align} + 1 &= 0 + 1 \label{eq:1_fr}\\ + 2 &= 1 + 1 \label{eq:2_fr} + \end{align} +\end{adjustwidth} + +\subsection{Example in German} + +\UseLanguage{German} + +% \SetUsedOnMessageText{Erscheint auf~#1.} +% \SetUsedByMessageText{Erscheint #1.} +% \SetUsedByAndOnMessageText{Erscheint #1 auf~#2.} +% \SetForwardReferenceRefForm{\crefthe[in,dat.]} +% \SetForwardReferencePagerefForm{\cpagerefthe[noun]} + +\vspace{-1.5\baselineskip} +\setlength{\marginparwidth}{24em} +\setlength{\marginparsep}{-18em} +\begin{adjustwidth}{}{20em} + \begin{lemma}\label{lem:result_de} + Einige vorläufige Ergebnisse (siehe Gleichung \labelcref[used by]{eq:1_de}). + \end{lemma} + + \begin{theorem}\label{thm:test_de} + Text. + \end{theorem} + \begin{proof}\restorelabel{thm:test_de} + % Notice the use of \cref[die, akk.,...] + Einige Beweise, \cref[die, akk., used by]{lem:result_de} und die Gleichungen \labelcref[used by and on]{eq:Euler_de}, \labelcref[used by]{eq:1_de,eq:2_de}. + \end{proof} + + \begin{equation}\label{eq:Euler_de} + \mathrm{e}^{\mathrm{i}\pi} + 1 = 0. + \end{equation} + \begin{align} + 1 &= 0 + 1 \label{eq:1_de}\\ + 2 &= 1 + 1 \label{eq:2_de} + \end{align} +\end{adjustwidth} + +\subsection{Example in Italian} + +\UseLanguage{Italian} + +\vspace{-1.5\baselineskip} +\setlength{\marginparwidth}{24em} +\setlength{\marginparsep}{-18em} +\begin{adjustwidth}{}{20em} + \begin{lemma}\label{lem:result_it} + Alcuni risultati preliminari (vedi l'equazione \labelcref[used by]{eq:1_it}). + \end{lemma} + + \begin{theorem}\label{thm:test_it} + Testo. + \end{theorem} + \begin{proof}\restorelabel{thm:test_it} + % Notice the use of \cref[da,...] + Alcune linee di prova derivanti \cref[da, used by]{lem:result_it} e dalle equazioni \labelcref[used by and on]{eq:Euler_it}, \labelcref[used by]{eq:1_it,eq:2_it}. + \end{proof} + + \begin{equation}\label{eq:Euler_it} + \mathrm{e}^{\mathrm{i}\pi} + 1 = 0. + \end{equation} + \begin{align} + 1 &= 0 + 1 \label{eq:1_it}\\ + 2 &= 1 + 1 \label{eq:2_it} + \end{align} +\end{adjustwidth} + +\subsection{Example in Spanish} + +\UseLanguage{Spanish} + +\vspace{-1.5\baselineskip} +\setlength{\marginparwidth}{24em} +\setlength{\marginparsep}{-18em} +\begin{adjustwidth}{}{20em} + \begin{lemma}\label{lem:result_es} + Algunos resultados preliminares (véase la ecuación \labelcref[used by]{eq:1_es}). + \end{lemma} + + \begin{theorem}\label{thm:test_es} + Texto. + \end{theorem} + \begin{proof}\restorelabel{thm:test_es} + % Notice the use of \cref[de,...] + Algunas líneas de demostración resultantes \cref[de, used by]{lem:result_es} y las ecuaciones \labelcref[used by and on]{eq:Euler_es}, \labelcref[used by]{eq:1_es,eq:2_es}. + \end{proof} + + \begin{equation}\label{eq:Euler_es} + \mathrm{e}^{\mathrm{i}\pi} + 1 = 0. + \end{equation} + \begin{align} + 1 &= 0 + 1 \label{eq:1_es}\\ + 2 &= 1 + 1 \label{eq:2_es} + \end{align} +\end{adjustwidth} + +\UseLanguage{English} + +\subsection{Regarding the customization} + +If you wish to change the content of the messages in such cases, you might need to be careful about the definite article and declension involved. For example, in German, if you wish to change the text to \textquote{Erscheint in ... auf ...} (\emph{Appears in ... on ...}), you need to write: +\begin{code} +\SetUsedOnMessageText{Erscheint auf~#1.} +\SetUsedByMessageText{Erscheint #1.} +\SetUsedByAndOnMessageText{Erscheint #1 auf~#2.} +\SetForwardReferenceRefForm{\crefthe[in,dat.]} +\SetForwardReferencePagerefForm{\cpagerefthe[noun]} +\end{code} +which set the \lstinline|\cref| command to use the definite article \textquote{in} and the declension \textquote{Dativ}, and hide the definite article when using \lstinline|\cpageref|. + + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/crefthe/README.md b/macros/latex/contrib/crefthe/README.md index e46658f1d6..745432cfbc 100644 --- a/macros/latex/contrib/crefthe/README.md +++ b/macros/latex/contrib/crefthe/README.md @@ -1,4 +1,4 @@ -<!-- Copyright (C) 2021-2023 by Jinwen XU --> +<!-- Copyright (C) 2021-2024 by Jinwen XU --> # crefthe - cross referencing with proper definite articles diff --git a/macros/latex/contrib/crefthe/crefthe-doc.pdf b/macros/latex/contrib/crefthe/crefthe-doc.pdf Binary files differindex 664da1ba34..be4864d533 100644 --- a/macros/latex/contrib/crefthe/crefthe-doc.pdf +++ b/macros/latex/contrib/crefthe/crefthe-doc.pdf diff --git a/macros/latex/contrib/crefthe/crefthe-doc.tex b/macros/latex/contrib/crefthe/crefthe-doc.tex index a6d2dae2b7..81a11edab9 100644 --- a/macros/latex/contrib/crefthe/crefthe-doc.tex +++ b/macros/latex/contrib/crefthe/crefthe-doc.tex @@ -120,8 +120,8 @@ \begin{document} -\def\PackageVersion{2023/11/11} -\def\PackageSubVersion{a} +\def\PackageVersion{2024/02/24} +\def\PackageSubVersion{} \title{\crefthepackage{}\\\smallskip\itshape Cross referencing with proper definite articles} \author{Jinwen XU} diff --git a/macros/latex/contrib/crefthe/crefthe.sty b/macros/latex/contrib/crefthe/crefthe.sty index 3dd1c8e027..ad4f89ac32 100644 --- a/macros/latex/contrib/crefthe/crefthe.sty +++ b/macros/latex/contrib/crefthe/crefthe.sty @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2021-2023 by Jinwen XU +%% Copyright (C) 2021-2024 by Jinwen XU %% ------------------------------------ %% %% This file may be distributed and/or modified under the conditions of @@ -12,7 +12,7 @@ \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesExplPackage {crefthe} - {2023/11/11a} {} + {2024/02/24} {} {Cross referencing with proper definite articles} \keys_define:nn { crefthe } @@ -67,43 +67,43 @@ \NewDocumentCommand \crefthe { s t- t+ O{} m } { \bool_gset_false:N \g__crefthe_uppercase_bool - \__crefthe_cref_general:NNNnnN #1 #2 #3 { #4 } { #5 } \crefthe_cref_original:w + \__crefthe_cref_general:NNNxxN #1 #2 #3 { #4 } { #5 } \crefthe_cref_original:w } \NewDocumentCommand \Crefthe { s t- t+ O{} m } { \bool_gset_true:N \g__crefthe_uppercase_bool - \__crefthe_cref_general:NNNnnN #1 #2 #3 { #4 } { #5 } \crefthe_Cref_original:w + \__crefthe_cref_general:NNNxxN #1 #2 #3 { #4 } { #5 } \crefthe_Cref_original:w } \NewDocumentCommand \namecrefthe { t- t+ O{} m } { \bool_gset_false:N \g__crefthe_uppercase_bool - \__crefthe_cref_general:NNNnnN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_namecref_original:w + \__crefthe_cref_general:NNNxxN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_namecref_original:w } \NewDocumentCommand \nameCrefthe { t- t+ O{} m } { \bool_gset_true:N \g__crefthe_uppercase_bool - \__crefthe_cref_general:NNNnnN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_nameCref_original:w + \__crefthe_cref_general:NNNxxN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_nameCref_original:w } \NewDocumentCommand \namecrefsthe { t- t+ O{} m } { \bool_gset_false:N \g__crefthe_uppercase_bool - \__crefthe_cref_general:NNNnnN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_namecrefs_original:w + \__crefthe_cref_general:NNNxxN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_namecrefs_original:w } \NewDocumentCommand \nameCrefsthe { t- t+ O{} m } { \bool_gset_true:N \g__crefthe_uppercase_bool - \__crefthe_cref_general:NNNnnN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_nameCrefs_original:w + \__crefthe_cref_general:NNNxxN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_nameCrefs_original:w } \NewDocumentCommand \cpagerefthe { t- t+ O{} m } { \bool_gset_false:N \g__crefthe_uppercase_bool - \__crefthe_cref_general:NNNnnN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_cpageref_original:w + \__crefthe_cref_general:NNNxxN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_cpageref_original:w } \NewDocumentCommand \Cpagerefthe { t- t+ O{} m } { \bool_gset_true:N \g__crefthe_uppercase_bool - \__crefthe_cref_general:NNNnnN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_Cpageref_original:w + \__crefthe_cref_general:NNNxxN \c_false_bool #1 #2 { #3 } { #4 } \crefthe_Cpageref_original:w } \keys_define:nn { crefthe-command } @@ -200,6 +200,7 @@ \group_end: } +\cs_generate_variant:Nn \__crefthe_cref_general:NNNnnN { NNNxx } % \__crefthe_prep_mode: defines the default mode for supported languages \cs_new:Nn \__crefthe_prep_mode: diff --git a/macros/latex/contrib/litetable/doc/litetable-cn.pdf b/macros/latex/contrib/litetable/doc/litetable-cn.pdf Binary files differindex 335b8be062..0ef5ca2aab 100644 --- a/macros/latex/contrib/litetable/doc/litetable-cn.pdf +++ b/macros/latex/contrib/litetable/doc/litetable-cn.pdf diff --git a/macros/latex/contrib/litetable/doc/litetable-cn.tex b/macros/latex/contrib/litetable/doc/litetable-cn.tex index 8093dd8a92..b67605e03f 100644 --- a/macros/latex/contrib/litetable/doc/litetable-cn.tex +++ b/macros/latex/contrib/litetable/doc/litetable-cn.tex @@ -6,54 +6,35 @@ %% * version. * %% ****************************************************** \PassOptionsToPackage{quiet}{xeCJK} -\PassOptionsToPackage{quiet}{fontspec} -\PassOptionsToPackage{no-math}{fontspec} +\PassOptionsToPackage{quiet, no-math}{fontspec} \documentclass[11pt]{article} -\usepackage{geometry} -\usepackage{pdfpages} +\usepackage{geometry,pdfpages,caption,indentfirst,setspace} +\captionsetup[table]{name={\textsc{Table}},labelsep=period} \usepackage[level]{datetime} -\usepackage{unicode-math,xeCJK} -\usepackage{authblk} -\usepackage{indentfirst,setspace} +\usepackage{unicode-math,xeCJK,verbatim} +\usepackage{authblk,xltxtra} +\usepackage{booktabs,diagbox,ragged2e,tabularx} +\renewcommand\tabularxcolumn[1]{>{\Centering}m{#1}} \usepackage[toc]{multitoc} -\setstretch{1.25} -\setmainfont{Libertinus Serif} -\setsansfont{Libertinus Sans} +\usepackage[mono=false]{libertine} +\linespread{1.15} \setCJKmainfont{Chiron Sung HK} -[ - BoldFont=Chiron Sung HK Bold, - ItalicFont=Kaiti SC -] -\makeatletter -\usepackage{listings,dirtree} -\lstdefinestyle{TeX}{ - language = [LaTeX]TeX, - texcsstyle = *\color{H7}, - numbers = none, - basicstyle = {\scriptsize\color{H6}\tt}, - mathescape = false, - breaklines = true, - columns = fixed, - keywordstyle = \color{H3}, - commentstyle = \color{darkgray}, - tabsize = 2, - keywords = {mail,flyleaf,sticker,logo,notebook,chapter,newnote,newnotesss,newnotessss,emptynote,newhdunote, - makeframe,course,more} -} -\usepackage{hyperref,xcolor,verbatim} +[BoldFont=Chiron Sung HK Bold, + ItalicFont=Kaiti SC] +\usepackage{hyperref,cprotect,xcolor,verbatim,tikz} \definecolor{pkgcolor}{Hsb}{103,.8,.5} \definecolor{moducolor}{Hsb}{290,.8,.5} \definecolor{cmdcolor}{Hsb}{188,.8,.5} \definecolor{filecolor}{Hsb}{207,.6,.7} -\definecolor{H1}{Hsb}{349,.8,.8}% 海棠紅 (Hangzhou MTR L 1 ) -\definecolor{H2}{Hsb}{23, .8,.8}% 丹桂橙 (Hangzhou Metro 2 ) -\definecolor{H3}{Hsb}{48, .8,.8}% 柠檬黄 (Hangzhou Metro 3 ) -\definecolor{H4}{Hsb}{103,.8,.8}% 香樟绿 (Hangzhou Metro 4 ) -\definecolor{H5}{Hsb}{188,.8,.8}% 青藍色 (Hangzhou MTR L 5 ) -\definecolor{H6}{Hsb}{207,.8,.8}% 海洋蓝 (Hangzhou Metro 6 ) -\definecolor{H7}{Hsb}{290,.8,.8}% 浪漫紫 (Hangzhou Metro 7 ) -\hypersetup{colorlinks,urlcolor=H1,linkcolor=H2,filecolor=filecolor,pdfstartview=FitH,pdfview=FitH,pdfcreator=XeTeX output} +\definecolor{H1}{Hsb}{349,.8,.8} % 海棠紅 (Hangzhou MTR L 1 ) +\definecolor{H2}{Hsb}{23, .8,.8} % 丹桂橙 (Hangzhou Metro 2 ) +\definecolor{H3}{Hsb}{48, .8,.8} % 柠檬黄 (Hangzhou Metro 3 ) +\definecolor{H4}{Hsb}{103,.8,.8} % 香樟绿 (Hangzhou Metro 4 ) +\definecolor{H5}{Hsb}{188,.8,.8} % 青藍色 (Hangzhou MTR L 5 ) +\definecolor{H6}{Hsb}{207,.8,.8} % 海洋蓝 (Hangzhou Metro 6 ) +\definecolor{H7}{Hsb}{290,.8,.8} % 浪漫紫 (Hangzhou Metro 7 ) +\hypersetup{colorlinks,urlcolor=H6,linkcolor=H2,filecolor=filecolor,pdfstartview=FitH,pdfview=FitH,pdfcreator=XeTeX output} \def\pkg#1{\texorpdfstring{\textcolor{pkgcolor}{\textsf{#1}}}{“#1”}} \def\mode#1{\texorpdfstring{\textcolor{moducolor}{\textsf{#1}}}{“#1”}} @@ -63,11 +44,11 @@ \noindent\makebox[0pt][r]{\makebox[-3em][r]{\small\textbf{\textcolor{H7}{#1}}}\;\;}{\sffamily Update: \ignorespaces#2}} \makeatother -\title{The \pkg{LiteTable} Template} -\author[1]{Xia Mingyu, \href{https://www.hdu.edu.cn}{Hangzhou Dianzi University}} +\title{\bfseries\pkg{LiteTable} -- 多彩的课程表\textsf{\LaTeX} 模板} +\author{\href{https://www.hdu.edu.cn}{杭州电子科技大学}, 夏明宇} \yyyymmdddate \date{\today} -\affil[1]{\href{mailto:xiamyphys@gmail.com}{\texttt{xiamyphys@gmail.com}}} +\affil{\href{mailto:xiamyphys@gmail.com}{\texttt{xiamyphys@gmail.com}}} \date{\today\quad Version 2.3a\thanks{% \url{https://github.com/xiamyphys/litetable}}} \begin{document} @@ -75,11 +56,12 @@ \vspace{-2em} \begin{abstract} -\pkg{LiteTable} 模板提供了一个多彩的课程表设计,本文档为\pkg{LiteTable} 模板的说明文档. - +\pkg{LiteTable} 模板提供了一个多彩的课程表设计,本文档为 \pkg{LiteTable} 模板的说明文档. \end{abstract} -\tableofcontents\clearpage +\tableofcontents + +\clearpage \section{Introduction} @@ -91,28 +73,28 @@ 同样,你也可以加入我的\textsf\LaTeX{} 技術交流群 \href{https://qm.qq.com/q/OnHzbNvVAG}{QQ Group: 760570712} 与我交流,来获取模板的内测版本. \subsection{所需宏集} -本模板基于 \pkg{standalone} 文档类开发. 其需要 \pkg{tikz} 宏集去绘制图形,\pkg{kvoptions} 和 \pkg{etoolbox} 宏集用于提供全局模式,\pkg{expl3} 宏基用于支持数组,\pkg{ctex}宏集用于支持中文语言,\pkg{fontawesome5} 宏集提供一系列精美的图标. +本模板基于 \pkg{standalone} 文档类开发. 其需要 \pkg{tikz} 宏集去绘制图形,\pkg{kvoptions} 和 \pkg{etoolbox} 宏集用于提供全局模式,\pkg{expl3} 宏集用于支持数组,\pkg{ctex}宏集用于支持中文语言,\pkg{fontawesome5} 宏集提供一系列精美的图标. + +\subsection{安装并载入 \pkg{LiteTable} 模板} +免安装使用方法如下,从 \href{https://github.com/xiamyphys/LiteTable}{GitHub} 或 \href{https://ctan.org/pkg/litetable}{CTAN} 下载最新的 \verb|litetable.cls| 文件并将它保存至你的项目根目录. 这种安装方式是最便捷的,但是当模板更新后,你需要手动替换 \verb|.cls| 文件. -我强烈建议您使用终端机去执行以下命令,以将所有宏集更新到最新版本 +然而我强烈建议您使用终端机去执行以下命令,以将所有宏集更新到最新版本,并安装此模板 \begin{verbatim} - tlmgr update --self - tlmgr update --all + sudo tlmgr update --self + sudo tlmgr update --all \end{verbatim} -如果您所在的地区存在网路封锁(如GFW干扰),你可以选择合适的镜像网站或其他方法\footnote{请遵守当地的网路条例.}. 欲详细了解,请前往 \href{https://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my TEX distribution?} +如果您所在的地区存在网路封锁(如 GFW 干扰),你可以选择合适的镜像网站或其他方法\footnote{请遵守当地的网路条例.}. 欲详细了解,请前往 \href{https://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my TEX distribution?} -\subsection{载入 \pkg{LiteTable} 和其选项} -将文件 \verb|litetable.cls| 保存至你的项目根目录,然后创立一个 \verb|.tex| 文件,只需在第一行输入命令 \verb|\documentclass{litetable}| 即可. +本模板提供了三个选项:\mode{style},\mode{direction} 和 \mode{font}. 只需将你要使用的选项模式分别添加在你的 \verb|.tex| 文件中命令 \verb|\documentclass[ ]{litetable}| 的方括号中即可. -本模板提供了三个选项:\mode{date},\mode{style},\mode{direction} 和 \mode{font}. 只需将你要使用的选项模式分别添加在你的 \verb|.tex| 文件中命令 \verb|\documentclass[options]{litetable}| 的方括号中即可. +\subsection{兼容性} +所使用的测试环境为 macOS + MacTeX 2023 / Overleaf,都可在 \XeLaTeX{} 编译方式下顺利运行, Windows, Linux 和 Unix 平台兼容性未知. -\newpage \section{\pkg{LiteTable} 的全局选项} \begin{verbatim} \documentclass[options]{litetable} \end{verbatim} -\subsection{\mode{date} 选项} -此选项有两个模式,\mode{en} 和 \mode{cn},可分别使工作日以英文或大陆简体显示,默认为英文. \subsection{\mode{style} 选项} 此选项有两个模式,\mode{round} 和 \mode{sharp},可分别使课程块圆角或直角显示,默认为直角. @@ -121,76 +103,144 @@ 此选项有两个模式,\mode{portrait} 和 \mode{landscape}, 可分别使课程表以纵向或横向显示. \subsection{\mode{font} 选项} -此选项有两个模式,\mode{times} 和 \mode{libertinus},可分别使字体为 ``Times New Roman'' 或 ``Libertinus'',默认为 ``Times New Roman''.\footnote{在使用 ``Libertinus'' 模式前请确保电脑中已安装该字体.} +此选项有两个模式,\mode{times} 和 \mode{libertinus},可分别使字体为 ``Times New Roman'' 或 ``Libertinus'',默认为 ``Times New Roman''\footnote{在使用 ``Libertinus'' 模式前请确保电脑中已安装该字体.}. \section{\pkg{LiteTable} 的命令} \subsection{\cmd{makeframe} 命令} \begin{verbatim} - \makeframe{Timetable -- Semester 5} + \makeframe{Timetable -- Semester 5} \end{verbatim} 此命令可建立一个标题为 ``Timetable -- Semester 5'' 的空白课程表. -\subsection{The \cmd{timelist} command} +\subsection{\cmd{weeklist} 命令} +\begin{verbatim} + \weeklist{ + \bfseries\textcolor{W1}{\faIcon{moon}~星期一}, + \bfseries\textcolor{W2}{\faIcon{fire}~星期二}, + \bfseries\textcolor{W3}{\faIcon{water}~星期三}, + \bfseries\textcolor{W4}{\faIcon{tree}~星期四}, + \bfseries\textcolor{W5}{\faIcon{coins}~星期六} + } +\end{verbatim} + +此命令可在课程表顶部添加工作日,你可以自由决定工作日的显示样式,如名称,颜色甚至是前面的 logo\footnote{由 \pkg{fontawesome5} 宏集支持.}. + +课程表可根据你输入的时间组数自动生成相应的列数. 如上方代码共有 5 个工作日,就会生成 5 列的课程表. + +\subsection{\cmd{timelist} \cmd{classnum} 命令} \begin{verbatim} \timelist{ 8:05,8:55,10:00,10:50,11:40,13:30,14:20,15:15,16:05,18:30,19:20,20:10; 8:50,9:40,10:45,11:35,12:25,14:15,15:05,16:00,16:50,19:15,20:05,20:55 } + + \classnum{14} \end{verbatim} -此命令可将时间添加至课程表的左侧,内容的第一行是每节课程开始时间,第二行是每节课程的结束时间,时间之间用逗号(\verb|,|)分隔,第一行与第二行之间用分号(\verb|;|)分隔. +命令 \cmd{timelist} 可将时间添加至课程表的左侧,内容的第一行是每节课程开始时间,第二行是每节课程的结束时间,时间之间用逗号(\verb|,|)分隔,第一行与第二行之间用分号(\verb|;|)分隔. + +课程表可根据你输入的时间组数自动生成相应的行数. 如上方代码共有 12 组时间,就会生成 12 行的课程表. -课程表可根据你输入的时间组数自动生成相应的行数. 如上方代码共有12组时间,就会生成12行的课程表. +命令 \cmd{classnum} 可直接指定课程表上你想要生成的行数并不会在课程表左侧添加时间,左侧只会有一列\emph{在每行竖直居中}的序号. + +下面的表格整理了两个命令不同使用情况下的不同效果. +\begin{table}[!ht] +\centering +\caption{命令 \cmd{timelist} and \cmd{classnum} 的使用情况.} + +\begin{tabularx}{\textwidth}{c >{\raggedright\arraybackslash}X >{\raggedright\arraybackslash}X} + \toprule + \diagbox{\cmd{classnum}}{\cmd{timelist}} & \multicolumn{1}{c}{使用} & \multicolumn{1}{c}{不使用}\\ + \midrule + 使用 & + 效果和命令 \cmd{timelist} 描述相同\newline 但生成行数由 \cmd{classnum} 决定 & + 效果和命令 \cmd{classnum} 描述相同\\ + \midrule + 不使用 & + 效果和命令 \cmd{timelist} 描述相同 & + 效果和命令 \cmd{timelist} 描述相同\newline\emph{并默认生成 12 行}.\\ + \bottomrule +\end{tabularx} +\end{table} + +\begin{itemize} + \item 若命令 \cmd{timelist} 中有 12 组时间,命令 \cmd{classnum} 传递的数值为 14,那么课程表的左侧会只有 1 -- 12 行有时间标注,最后两行没有时间标注但最后两行的标号仍然偏上方,并不会竖直对齐. + \item 若命令 \cmd{timelist} 中有 14 组时间,命令 \cmd{classnum} 传递的数值为 12,那么只会生成 12 行的课程表并且左侧均有时间标注,也就是在命令 \cmd{timelist} 中输入的最后两组时间无效. +\end{itemize} + +\subsection{\cmd{weeks} 命令} +\begin{verbatim} + \weeks{Week 1 -- 16} +\end{verbatim} + +此命令可指定命令 \cmd{course} 第 7 个参数的默认值. \subsection{\cmd{course} 命令} \begin{verbatim} - \course{H5}{3}{5}{AQM}{Building 6·225}{Yuan Li \& Mn Chen}{Week 1 -- 18} + \course[H1]{8}{9}{群论}{第6教研楼 · 中211}{Li Ge}[Week 1 -- 16] \end{verbatim} -此命令共有7个变量. +此命令共有7个参数. \begin{itemize} - \item 第一个为你想选择的课程块颜色,从 ``H1'' 到 ``H9'' 可选. - \item 第二个和第三个为课程的起始节数和结束节数. - \item 第四个为课程的名称. - \item 第五个为课程的地址. - \item 第六个为教师的名字. - \item 第七个为课程的起始周和结束周. + \item 第 1 个为课程块的颜色,从 ``H1'' 到 ``H9'' 供选择,此参数是可选参数,默认为 ``H1''. + \item 第 2 个和第 3 个为课程的起始节数和结束节数. + \item 第 4, 5, 6 个分别为课程的名称,地址和教师的名字. + \item 第 7 个为课程的首末周,此参数是可选参数,默认值由命令 \cmd{weeks} 指定,若未指定则默认值为 ``Week 1 -- 12''. \end{itemize} + + \subsection{\cmd{newday} 命令} 此命令可切换当前日到第二天,此时课程块会右移一格. \subsection{\cmd{more} 命令} \begin{verbatim} - \more{·School Start: 04 / 03 / 2024 ·Summer Vacation: 05 / 07 / 2024} + \more{ · School Start: 04 / 03 / 2024 · Summer Vacation: 05 / 07 / 2024} \end{verbatim} - 此命令可在课程表末尾添加备注信息. \subsection{\cmd{sticker} 命令} \begin{verbatim} \sticker{favicon} \end{verbatim} - 在使用此命令后页面的右下方会添加一张贴纸. +\subsection{The \cmd{(re)rotatepage} command} +\cmd{rotatepage}命令可临时更改课程表的方向,\cmd{rerotatepage} 命令可恢复课程表原来的方向. + +\section{已知问题:分辨率溢出} +\begin{verbatim} + Dimension too large. <recently read> \pgfmath@x +\end{verbatim} + +当启用 \mode{landscape} 模式并添加 7 个及以上的工作日 (?虽然 `添加7 个以上工作日' 一般碳基生物做不出来这种事),便会给出该报错. + +这主要是因为 \emph{\textsf{\TeX} 没有内置的浮点数表示} (Reference: \cprotect{\href{https://tex.stackexchange.com/a/545416/299948}}{How to solve the error `Dimension too large. <recently read> \verb|\pgfmath@x|' while doing the calculations in the table}). + +如果你能通过优化算法或其他方式解决该问题,欢迎通过 GitHub: \url{https://github.com/xiamyphys/litetable} 提交你的代码,或通过邮件 \href{mail:xiamyphys@gmail.com}{\ttfamily xiamyphys@gmail.com} 联络我. + \section{版本历史} 课程表的设计源于杭电助手(\href{https://www.hdu.edu.cn}{杭州电子科技大学})学生课表页面(仅本校师生可访问). 页面排版十分精美,于是本人使用\LaTeX{} 复刻出了课程表样式,并制作成模板分享给大家. \textsf{\bfseries Version 1.0} 于01/09/2023完成开发,并发布在\href{https://www.latexstudio.net/index/details/index/mid/3625.html}{\LaTeX{}工作室} (杭州萧山)和\href{http://xhslink.com/od7Ycw}{小红书}上,赢得了许多人的喜爱. -\textsf{\bfseries Version 2.0a}于01/11/2023完成开发,并发布在\href{https://www.latexstudio.net/index/details/index/mid/3636.html}{\LaTeX{}工作室} (杭州萧山)和\href{http://xhslink.com/od7Ycw}{小红书}上. 此版本使用 \verb|.cls| 文件,使 \verb|main.tex| 文件更简洁. 同时,此版本添加了全局模式,可设置 ``课程块" 显示为圆角或直角. 此版本也支持一个 \verb|.tex| 文件中生成多张课表. +\textsf{\bfseries Version 2.0a}于01/11/2023完成开发,并发布在\href{https://www.latexstudio.net/index/details/index/mid/3636.html}{\LaTeX{}工作室} (杭州萧山)和\href{http://xhslink.com/od7Ycw}{小红书}上. 此版本使用 \verb|.cls| 文件,使 \verb|main.tex| 文件更简洁. 同时,此版本添加了全局模式,可设置 ``课程块'' 显示为圆角或直角. 此版本也支持一个 \verb|.tex| 文件中生成多张课表. \textsf{\bfseries Version 2.1a} 于05/11/2023完成开发. 支持 libertinus 字体. -\textsf{\bfseries Version 2.2a} 于31/01/2024完成开发. 此版本修复了分辨率超出的bug,更改纸张类型为美国信纸并支持自定义课程起始和结束时间. +\textsf{\bfseries Version 2.2a} 于31/01/2024完成开发. 此版本修复了分辨率超出的 bug,更改纸张类型为美国信纸并支持自定义课程起始和结束时间. \textsf{\bfseries Version 2.3a} 于02/02/2024完成开发. 此版本支持根据所输入的时间组数自动生成相应的行数,并支持课程表以纵向或横向显示. -\setstretch{1} +\textsf{\bfseries Version 2.3b} 于03/02/2024完成开发. 此版本优化坐标计算,提升编译速度. + +\textsf{\bfseries Version 2.4a} 于24/02/2024完成开发. 元宵节快乐! 此版本支持自定义工作日显示样式,支持隐藏时间并仅显示竖直对齐课程序号,支持设置默认首末周. + +\clearpage + \datechange{01/09/2023}{Version 2.0a} \begin{itemize} \item 支持课程块显示为圆角或直角. @@ -204,25 +254,38 @@ \datechange{31/01/2024}{Version 2.2a} \begin{itemize} - \item 修复了分辨率超出的bug. + \item 修复了分辨率超出的 bug. \item 更改纸张类型为美国信纸. \item 支持自定义课程起始和结束时间. \item 支持在页面右下角添加一个你喜欢的小贴纸. \item 提供简体中文说明文档. \end{itemize} - +\setstretch{1} \datechange{2024/02/02}{Version 2.3a} \begin{itemize} \item 支持根据所输入的时间组数自动生成相应的行数. \item 课程表可纵向或横向显示. \end{itemize} +\datechange{2024/02/03}{Version 2.3b} +\begin{itemize} + \item 优化坐标计算,提升编译速度. +\end{itemize} + +\datechange{\today}{Version 2.4a} +\begin{itemize} + \item 支持自定义工作日显示样式. + \item 支持隐藏时间,仅显示竖直对齐课程序号. + \item 支持设置默认首末周. +\end{itemize} -\newpage\setstretch{1.5} \appendix -\section{代码示例} -\lstinputlisting[style=TeX]{litetable-demo2.tex} -\includepdf[pages=-]{litetable-demo2.pdf} -\includepdf[pages=-,nup=1x2]{litetable-demo1.pdf} +\includepdf[pages={2,4},nup=1x2,pagecommand={ + \tikz[remember picture, overlay] + \node [rotate=90,below,yshift=-1em] at (current page.west) {\bfseries\LARGE Document Example: \texttt{litetable-demo.tex}}; + } +]{litetable-demo.pdf} +\includepdf[pages={1,3}]{litetable-demo.pdf} + \end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/litetable/doc/litetable-demo.pdf b/macros/latex/contrib/litetable/doc/litetable-demo.pdf Binary files differnew file mode 100644 index 0000000000..e2c8cf648c --- /dev/null +++ b/macros/latex/contrib/litetable/doc/litetable-demo.pdf diff --git a/macros/latex/contrib/litetable/doc/litetable-demo.tex b/macros/latex/contrib/litetable/doc/litetable-demo.tex new file mode 100644 index 0000000000..3423e6787c --- /dev/null +++ b/macros/latex/contrib/litetable/doc/litetable-demo.tex @@ -0,0 +1,166 @@ +\documentclass[times,sharp]{litetable} + +\begin{document} +\timelist{ + 8:05,8:55,10:00,10:50,11:40,13:30,14:20,15:15,16:05,18:30,19:20,20:10; + 8:50,9:40,10:45,11:35,12:25,14:15,15:05,16:00,16:50,19:15,20:05,20:55 +} +% \classnum{14} +\weeklist{ + \heiti\bfseries\textcolor{W1}{\faIcon{moon}~星期一}, + \heiti\bfseries\textcolor{W2}{\faIcon{fire}~星期二}, + \heiti\bfseries\textcolor{W3}{\faIcon{water}~星期三}, + \heiti\bfseries\textcolor{W4}{\faIcon{tree}~星期四}, + \heiti\bfseries\textcolor{W5}{\faIcon{coins}~星期五}, + \heiti\bfseries\textcolor{W6}{\faIcon{mountain}~星期六}, +} +\weeks{Week 1 -- 18} + +\sticker{favicon} + +\begin{tikzpicture} + \makeframe{Axia\!\texttt{'}\!s Timetable -- Semester 5} % make title & background + % Mon. + \course[H1]{1}{2}{羽毛球}{羽毛球场}{Ys Yu} + \course[H7]{3}{5}{光学镜头设计实验}{第6教研楼 · 南402}{Hao Ying}[Week 5 -- 15] + \newday % Tue. + \course[H9]{3}{5}{马克思主义原理}{第6教研楼 · 北320}{Yang Wang} + \course[H8]{6}{8}{光电检测技术}{第6教研楼 · 北320}{Xf Huang} + \newday % Wed. + \course[H7]{3}{4}{激光原理}{第6教研楼 · 中301}{Hd Mao} + \course[H9]{6}{7}{就业3 | 形策5}{6教中301 | 6教北208}{MJH | QXR}[Week 5 -- 14] + \course[H5]{8}{9}{计算物理}{第6教研楼 · 中215}{Wj Rao} + \course[H1]{10}{11}{论文写作指导}{第6教研楼 · 北416}{Yq Shi} + \newday % Thu. + \course[H6]{1}{2}{智能传感系统}{第6教研楼 · 北110}{Bx Cai} + \course[H5]{3}{5}{高等量子力学}{第6教研楼 · 中225}{Mn Chen \& Yuan Li} + \course[H3]{6}{8}{近代物理实验2}{第6教研楼 · 南}{Xx Chen}[Week 5 -- 16] + \course[H8]{10}{12}{光电信息技术实验}{第6教研楼 · 南302}{Yu Zhou}[Week 5 -- 15] + \newday % Fri. + \course[H7]{1}{2}{光学镜头设计}{第6教研楼 · 北422}{Hao Ying} + \course[H5]{3}{5}{光电子学}{第6教研楼 · 北202}{Rx Li \& Yuan Li} + \course[H8]{6}{7}{光电创新实践4}{第6教研楼 · 南302}{Ql Huang}[Week 5 -- 16] + \course[H5]{8}{9}{研究生组会}{第6教研楼 · 中}{Yuan Li} + \more{ · Hangzhou Asian Games: 23 / 09 / 2023 -- 08 / 10 / 2023 · School Starts: 11 / 09 / 2023 + · Winter Vacation: 26 / 01 / 2024} +\end{tikzpicture} + +\rotatepage + +\weeklist{ + \bfseries\textcolor{W1}{\faIcon{moon}~Monday}, + \bfseries\textcolor{W2}{\faIcon{fire}~Tuesday}, + \bfseries\textcolor{W3}{\faIcon{water}~Wednesday}, + \bfseries\textcolor{W4}{\faIcon{tree}~Thursday}, + \bfseries\textcolor{W5}{\faIcon{coins}~Friday}, + \bfseries\textcolor{W6}{\faIcon{mountain}~Saturday}, +} + +\begin{tikzpicture} + \makeframe{Axia\!\texttt{'}\!s Timetable -- Semester 5} % make title + % Mon. + \course[H1]{1}{2}{Badminton}{Badminton Court}{Ys Yu} + \course[H7]{3}{5}{Lens Design Expt.}{Building 6 · South 402}{Hao Ying}[Week 5 -- 15] + \newday % Tue. + \course[H9]{3}{5}{Marx's Principles}{Building 6 · North 320}{Yang Wang} + \course[H8]{6}{8}{OE Detection Tech.}{Building 6 · North 320}{Xf Huang} + \newday % Wed. + \course[H7]{3}{4}{Laster Principle}{Building 6 Middle · 301}{Hd Mao} + \course[H9]{6}{7}{Empl Guide | Situ Policy}{Build 6 · 301 | Build 6 · 208}{MJH | QXR}[Week 5 -- 14] + \course[H5]{8}{9}{Computational Phys}{Building 6 · Middle 215}{Wj Rao} + \course[H1]{10}{11}{Essay Writing}{Building 6 · North 416}{Yq Shi} + \newday % Thu. + \course[H6]{1}{2}{Sensing System}{Building 6 · North 110}{Bx Cai} + \course[H5]{3}{5}{Quantum Mechanics$^\dagger$}{Building 6 · Middle 225}{Mn Chen \& Yuan Li} + \course[H3]{6}{8}{Modern Phys Expt. 2}{Building 6 · South}{Xx Chen}[Week 5 -- 16] + \course[H8]{10}{12}{OE Info Experiment}{Building 6 · South 302}{Yu Zhou}[Week 5 -- 15] + \newday % Fri. + \course[H7]{1}{2}{Optical Lens Design}{Building 6 · North 422}{Hao Ying} + \course[H5]{3}{5}{Optoelectronics}{Building 6 · North 202}{Rx Li \& Yuan Li} + \course[H8]{6}{7}{Innovative Practice 4}{Building 6 · South 302}{Ql Huang}[Week 5 -- 16] + \course[H5]{8}{9}{Group Meeting}{Building 6 · Middle}{Yuan Li} + \more{ · Hangzhou Asian Games: 23 / 09 / 2023 -- 08 / 10 / 2023 + · School Starts: 11 / 09 / 2023 · Winter Vacation: 26 / 01 / 2024 } +\end{tikzpicture} + +\rerotatepage + +\timelist{ + 8:05,8:55,10:00,10:50,11:40,13:30,14:20,15:15,16:05,18:30,19:20; + 8:50,9:40,10:45,11:35,12:25,14:15,15:05,16:00,16:50,19:15,20:05, +} +\classnum{11} +\weeklist{ + \heiti\bfseries\textcolor{W1}{\faIcon{moon}~星期一}, + \heiti\bfseries\textcolor{W2}{\faIcon{fire}~星期二}, + \heiti\bfseries\textcolor{W3}{\faIcon{water}~星期三}, + \heiti\bfseries\textcolor{W4}{\faIcon{tree}~星期四}, + \heiti\bfseries\textcolor{W5}{\faIcon{coins}~星期五}, +} +\weeks{Week 1 -- 16} + +\begin{tikzpicture} + \makeframe{Axia\!\texttt{'}\!s Timetable -- Semester 6} + + % Mon. + \course[H5]{7}{8}{凝聚态物理导论}{第6教研楼 · 中225}{Mn Chen} + + \newday % Tue. + \course[H1]{8}{9}{群论}{第6教研楼 · 中211}{Li Ge} + \course[H5]{10}{11}{介观物理}{第6教研楼 · 中211}{Yuan Li \& Mn Chen} + + \newday % Wed. + \course[H6]{1}{2}{工程制图}{第7教研楼 · 中3012}{Hc Wang} + \course[H9]{8}{9}{形势与政策6}{第6教研楼 · 北302}{Xr Qi}[Double Week 10 -- 16] + \course[H9]{10}{11}{高级创业运营仿真}{第4教研楼 · 411 -- 413}{Li Zhang}[Week 1 -- 8] + + \newday % Thu. + \course[H4]{1}{2}{跨文化交际}{第3教研楼 · 422}{Cl Zuo} + \course[H2]{3}{4}{无线电测向}{东边田径场}{Ys Yu} + \course[H5]{6}{8}{固体物理}{第6教研楼 · 北408}{Kw Sun} + + \newday % Fri. + \course[H8]{1}{2}{光电显示技术}{第7教研楼 · 中3012}{Wt Su} + \course[H3]{6}{8}{研究生组会}{第6教研楼 · 中}{Yuan Li} + + \more{ · School Start: 04 / 03 / 2024 · Summer Vacation: 05 / 07 / 2024} +\end{tikzpicture} + +\rotatepage + +\weeklist{ + \bfseries\textcolor{W1}{\faIcon{moon}~Monday}, + \bfseries\textcolor{W2}{\faIcon{fire}~Tuesday}, + \bfseries\textcolor{W3}{\faIcon{water}~Wednesday}, + \bfseries\textcolor{W4}{\faIcon{tree}~Thursday}, + \bfseries\textcolor{W5}{\faIcon{coins}~Friday}, +} + +\begin{tikzpicture} + \makeframe{Axia\!\texttt{'}\!s Timetable -- Semester 6} + + % Mon. + \course[H5]{7}{8}{Introduction to Cond.}{Building 6 · Middle 225}{Mn Chen} + + \newday % Tue. + \course[H1]{8}{9}{Group Theory}{Building 6 · Middle 211}{Li Ge} + \course[H5]{10}{11}{Mesoscopic Physics}{Building 6 · Middle 211}{Yuan Li \& Mn Chen} + + \newday % Wed. + \course[H6]{1}{2}{Engineering Drawing}{Building 7 · North 3012}{Hc Wang} + \course[H9]{8}{9}{Situation \& Policy 6}{Building 6 · North 302}{Xr Qi}[Double Week 10 -- 16] + \course[H9]{10}{11}{Operational Simu.}{Building 4 · 411 -- 413}{Li Zhang}[Week 1 -- 8] + + \newday % Thu. + \course[H4]{1}{2}{Intercultural Comm.}{Building 3 · 422}{Cl Zuo} + \course[H2]{3}{4}{Radio Direction}{Athletic Field}{Ys Yu} + \course[H5]{6}{8}{Solid State Physics}{Building 6 · North 408}{Kw Sun} + + \newday % Fri. + \course[H8]{1}{2}{OE. Display}{Building 7 · North 3012}{Wt Su} + \course[H3]{6}{8}{Group Meeting}{Building 6 · Middle}{Yuan Li} + + \more{ · School Start: 04 / 03 / 2024 · Summer Vacation: 05 / 07 / 2024} +\end{tikzpicture} + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/litetable/doc/litetable-demo1.pdf b/macros/latex/contrib/litetable/doc/litetable-demo1.pdf Binary files differdeleted file mode 100644 index 0a479ed801..0000000000 --- a/macros/latex/contrib/litetable/doc/litetable-demo1.pdf +++ /dev/null diff --git a/macros/latex/contrib/litetable/doc/litetable-demo1.tex b/macros/latex/contrib/litetable/doc/litetable-demo1.tex deleted file mode 100644 index 8488c6453f..0000000000 --- a/macros/latex/contrib/litetable/doc/litetable-demo1.tex +++ /dev/null @@ -1,66 +0,0 @@ -\documentclass[libertinus,en,sharp,landscape]{litetable} - - -\begin{document} - -\timelist{ - 8:05,8:55,10:00,10:50,11:40,13:30,14:20,15:15,16:05,18:30,19:20,20:10; - 8:50,9:40,10:45,11:35,12:25,14:15,15:05,16:00,16:50,19:15,20:05,20:55 -} -\sticker{favicon} - -\begin{tikzpicture} - \makeframe{Axia\!\texttt{'}\!s Timetable -- Semester 5} % make title - % Mon. - \course{H1}{1}{2}{Badminton}{Badminton Court}{Yongsheng Yu}{Week 1 -- 18} - \course{H7}{3}{5}{Lens Design Experiment}{Building 6·South 402}{Hao Ying}{Week 5 -- 15} - \newday % Tue. - \course{H9}{3}{5}{Marx's Principles}{Building 6·320}{Yang Wang}{Week 1 -- 18} - \course{H8}{6}{8}{OE Detection Technology}{Building 6·320}{Xuefeng Huang}{Week 1 -- 18} - \newday % Wed. - \course{H7}{3}{4}{Laster Principle}{Building 6·301}{Haidan Mao}{Week 1 -- 18} - \course{H9}{6}{7}{Empl Guide 3 | Situ Policy 5}{Building 6·301 | Building 6·208}{MJH | QXR}{Week 5 -- 14} - \course{H5}{8}{9}{Computational Phys}{Building 6·215}{Wenjia Rao}{Week 1 -- 18} - \course{H1}{10}{11}{Essay Writing}{Building 6·416}{Yueqin Shi}{Week 1 -- 18} - \newday % Thu. - \course{H6}{1}{2}{Sensing System}{Building 6·110}{Benxiao Cai}{Week 1 -- 18} - \course{H5}{3}{5}{Quantum Mechanics$^\dagger$}{Building 6·225}{Mengnan Chen \& Yuan Li}{Week 1 -- 18} - \course{H3}{6}{8}{Modern Phys Experiment 2}{Building 6·South}{Xiangxiang Chen}{Week 5 -- 16} - \course{H8}{10}{12}{OE Info Experiment}{Building 6·South 302}{Yu Zhou}{Week 5 -- 15} - \newday % Fri. - \course{H7}{1}{2}{Optical Lens Design}{Building 6·422}{Hao Ying}{Week 1 -- 18} - \course{H5}{3}{5}{Optoelectronics}{Building 6·202}{Ruixue Li \& Yuan Li}{Week 1 -- 18} - \course{H8}{6}{7}{Innovative Practice 4}{Building 7·216B}{Qinglong Huang}{Week 5 -- 16} - \course{H5}{8}{9}{Group Meeting}{Building 6·Middle}{Yuan Li}{Week 1 -- 18} - \more{·School Starts: 11 / 09 / 2023 ·Winter Vacation: 26 / 01 / 2024 - ·Hangzhou Asian Games: 23 / 09 / 2023 -- 08 / 10 / 2023} -\end{tikzpicture} - -\begin{tikzpicture} - \makeframe{Axia\!\texttt{'}\!s Timetable -- Semester 6} - - % Mon. - \course{H5}{7}{8}{Introduction to Cond.}{Building 6·225}{Mn Chen}{Week 1 -- 16} - - \newday % Tue. - \course{H1}{8}{9}{Group Theory}{Building 6·211}{Li Ge}{Week 1 -- 16} - \course{H5}{10}{11}{Mesoscopic Physics}{Building 6·211}{Yuan Li \& Mn Chen}{Week 1 -- 16} - - \newday % Wed. - \course{H6}{1}{2}{Engineering Drawing}{Building 7·3012}{Hc Wang}{Week 1 -- 16} - \course{H9}{8}{9}{Situation \& Policy 6}{Building 6·302}{Xr Qi}{Double Week 10 -- 16} - \course{H9}{10}{11}{Operational Simu.}{Building 4·411 -- 413}{Li Zhang}{Week 1 -- 8} - - \newday % Thu. - \course{H4}{1}{2}{Intercultural Comm.}{Building 3·422}{Cl Zuo}{Week 1 -- 16} - \course{H2}{3}{4}{Radio Direction}{Athletic Field}{Ys Yu}{Week 1 -- 16} - \course{H5}{6}{8}{Solid State Physics}{Building 6·408}{Kw Sun}{Week 1 -- 16} - - \newday % Fri. - \course{H8}{1}{2}{OE. Display}{Building 7·3012}{Wt Su}{Week 1 -- 16} - \course{H3}{6}{8}{Group Meeting}{Building 6·Middle}{Yuan Li}{Week 1 -- 16} - - \more{·School Start: 04 / 03 / 2024 ·Summer Vacation: 05 / 07 / 2024} -\end{tikzpicture} - -\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/litetable/doc/litetable-demo2.pdf b/macros/latex/contrib/litetable/doc/litetable-demo2.pdf Binary files differdeleted file mode 100644 index 007993c405..0000000000 --- a/macros/latex/contrib/litetable/doc/litetable-demo2.pdf +++ /dev/null diff --git a/macros/latex/contrib/litetable/doc/litetable-demo2.tex b/macros/latex/contrib/litetable/doc/litetable-demo2.tex deleted file mode 100644 index 8194fdbc63..0000000000 --- a/macros/latex/contrib/litetable/doc/litetable-demo2.tex +++ /dev/null @@ -1,64 +0,0 @@ -\documentclass[libertinus,cn,sharp,portiait]{litetable} -\setCJKfamilyfont{zhhei}{Chiron Hei HK}\renewcommand*\heiti{\CJKfamily{zhhei}} - -\begin{document} -\timelist{ - 8:05,8:55,10:00,10:50,11:40,13:30,14:20,15:15,16:05,18:30,19:20,20:10; - 8:50,9:40,10:45,11:35,12:25,14:15,15:05,16:00,16:50,19:15,20:05,20:55 -} -\sticker{favicon} - -\begin{tikzpicture} - \makeframe{Axia\!\texttt{'}\!s Timetable -- Semester 5} % make title & background - % Mon. - \course{H1}{1}{2}{羽毛球}{羽毛球场}{Yongsheng Yu}{Week 1 -- 18} - \course{H7}{3}{5}{镜头设计实验}{第6教研楼南· 402}{Hao Ying}{Week 5 -- 15} - \newday % Tue. - \course{H9}{3}{5}{马克思主义原理}{第6教研楼北·320}{Yang Wang}{Week 1 -- 18} - \course{H8}{6}{8}{光电检测技术}{第6教研楼北·320}{Xuefeng Huang}{Week 1 -- 18} - \newday % Wed. - \course{H7}{3}{4}{激光原理}{第6教研楼中·301}{Haidan Mao}{Week 1 -- 18} - \course{H9}{6}{7}{就业3 | 形策5}{6教中301 | 6教北208}{MJH | QXR}{Week 5 -- 14} - \course{H5}{8}{9}{计算物理}{第6教研楼中·215}{Wenjia Rao}{Week 1 -- 18} - \course{H1}{10}{11}{论文写作指导}{第6教研楼北·416}{Yueqin Shi}{Week 1 -- 18} - \newday % Thu. - \course{H6}{1}{2}{智能传感系统}{第6教研楼北·110}{Benxiao Cai}{Week 1 -- 18} - \course{H5}{3}{5}{高等量子力学}{第6教研楼中·225}{Mengnan Chen \& Yuan Li}{Week 1 -- 18} - \course{H3}{6}{8}{近代物理实验2}{第6教研楼南}{Xiangxiang Chen}{Week 5 -- 16} - \course{H8}{10}{12}{光电信息技术实验}{第6教研楼南·302}{Yu Zhou}{Week 5 -- 15} - \newday % Fri. - \course{H7}{1}{2}{光学镜头设计}{第6教研楼北·422}{Hao Ying}{Week 1 -- 18} - \course{H5}{3}{5}{光电子学}{第6教研楼北·202}{Ruixue Li \& Yuan Li}{Week 1 -- 18} - \course{H8}{6}{7}{光电创新实践4}{第7教研楼北·216B}{Qinglong Huang}{Week 5 -- 16} - \course{H5}{8}{9}{研究生组会}{第6教研楼中}{Yuan Li}{Week 1 -- 18} - \more{·School Starts: 11 / 09 / 2023 ·Winter Vacation: 26 / 01 / 2024 ·Hangzhou Asian Games: 23 / 09 / 2023 -- 08 / 10 / 2023} -\end{tikzpicture} - -\begin{tikzpicture} - \makeframe{Axia\!\texttt{'}\!s Timetable -- Semester 6} - - % Mon. - \course{H5}{7}{8}{凝聚态物理导论}{第6教研楼中·225}{Mn Chen}{Week 1 -- 16} - - \newday % Tue. - \course{H1}{8}{9}{群论}{第6教研楼中·211}{Li Ge}{Week 1 -- 16} - \course{H5}{10}{11}{介观物理}{第6教研楼中·211}{Yuan Li \& Mn Chen}{Week 1 -- 16} - - \newday % Wed. - \course{H6}{1}{2}{工程制图}{第7教研楼中·3012}{Hc Wang}{Week 1 -- 16} - \course{H9}{8}{9}{形势与政策6}{第6教研楼北·302}{Xr Qi}{Double Week 10 -- 16} - \course{H9}{10}{11}{高级创业运营仿真}{第4教研楼·411 -- 413}{Li Zhang}{Week 1 -- 8} - - \newday % Thu. - \course{H4}{1}{2}{跨文化交际}{第3教研楼·422}{Cl Zuo}{Week 1 -- 16} - \course{H2}{3}{4}{无线电测向}{田径场}{Ys Yu}{Week 1 -- 16} - \course{H5}{6}{8}{固体物理}{第6教研楼北·408}{Kw Sun}{Week 1 -- 16} - - \newday % Fri. - \course{H8}{1}{2}{光电显示技术}{第7教研楼中·3012}{Wt Su}{Week 1 -- 16} - \course{H3}{6}{8}{研究生组会}{第6教研楼中}{Yuan Li}{Week 1 -- 16} - - \more{·School Start: 04 / 03 / 2024 ·Summer Vacation: 05 / 07 / 2024} -\end{tikzpicture} - -\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/litetable/doc/litetable-en.pdf b/macros/latex/contrib/litetable/doc/litetable-en.pdf Binary files differindex c8680a6aef..1e72948243 100644 --- a/macros/latex/contrib/litetable/doc/litetable-en.pdf +++ b/macros/latex/contrib/litetable/doc/litetable-en.pdf diff --git a/macros/latex/contrib/litetable/doc/litetable-en.tex b/macros/latex/contrib/litetable/doc/litetable-en.tex index ba989d664f..aa49231318 100644 --- a/macros/latex/contrib/litetable/doc/litetable-en.tex +++ b/macros/latex/contrib/litetable/doc/litetable-en.tex @@ -6,54 +6,35 @@ %% * version. * %% ****************************************************** \PassOptionsToPackage{quiet}{xeCJK} -\PassOptionsToPackage{quiet}{fontspec} -\PassOptionsToPackage{no-math}{fontspec} +\PassOptionsToPackage{quiet, no-math}{fontspec} \documentclass[11pt]{article} -\usepackage{geometry} -\usepackage{pdfpages} +\usepackage{geometry,pdfpages,caption,indentfirst,setspace} +\captionsetup[table]{name={\textsc{Table}},labelsep=period} \usepackage[level]{datetime} \usepackage{unicode-math,xeCJK} -\usepackage{authblk} -\usepackage{indentfirst,setspace} -% \usepackage[toc]{multitoc} +\usepackage{authblk,xltxtra} +\usepackage{booktabs,diagbox,ragged2e,tabularx} +\renewcommand\tabularxcolumn[1]{>{\Centering}m{#1}} +\usepackage[toc]{multitoc} +\usepackage[mono=false]{libertine} % \setstretch{1.25} -\setmainfont{Libertinus Serif} -\setsansfont{Libertinus Sans} \setCJKmainfont{Chiron Sung HK} -[ - BoldFont=Chiron Sung HK Bold, - ItalicFont=Kaiti SC -] -\makeatletter -\usepackage{listings,dirtree} -\lstdefinestyle{TeX}{ - language = [LaTeX]TeX, - texcsstyle = *\color{H7}, - numbers = none, - basicstyle = {\footnotesize\color{H6}\tt}, - mathescape = false, - breaklines = true, - columns = fixed, - keywordstyle = \color{H3}, - commentstyle = \color{darkgray}, - tabsize = 2, - keywords = {mail,flyleaf,sticker,logo,notebook,chapter,newnote,newnotesss,newnotessss,emptynote,newhdunote, - makeframe,course,more} -} -\usepackage{hyperref,xcolor,verbatim} +[BoldFont=Chiron Sung HK Bold, + ItalicFont=Kaiti SC] +\usepackage{hyperref,cprotect,xcolor,verbatim,tikz} \definecolor{pkgcolor}{Hsb}{103,.8,.5} \definecolor{moducolor}{Hsb}{290,.8,.5} \definecolor{cmdcolor}{Hsb}{188,.8,.5} \definecolor{filecolor}{Hsb}{207,.6,.7} -\definecolor{H1}{Hsb}{349,.8,.8}% 海棠紅 (Hangzhou MTR L 1 ) -\definecolor{H2}{Hsb}{23, .8,.8}% 丹桂橙 (Hangzhou Metro 2 ) -\definecolor{H3}{Hsb}{48, .8,.8}% 柠檬黄 (Hangzhou Metro 3 ) -\definecolor{H4}{Hsb}{103,.8,.8}% 香樟绿 (Hangzhou Metro 4 ) -\definecolor{H5}{Hsb}{188,.8,.8}% 青藍色 (Hangzhou MTR L 5 ) -\definecolor{H6}{Hsb}{207,.8,.8}% 海洋蓝 (Hangzhou Metro 6 ) -\definecolor{H7}{Hsb}{290,.8,.8}% 浪漫紫 (Hangzhou Metro 7 ) -\hypersetup{colorlinks,urlcolor=H1,linkcolor=H2,filecolor=filecolor,pdfstartview=FitH,pdfview=FitH,pdfcreator=XeTeX output} +\definecolor{H1}{Hsb}{349,.8,.8} % 海棠紅 (Hangzhou MTR L 1 ) +\definecolor{H2}{Hsb}{23, .8,.8} % 丹桂橙 (Hangzhou Metro 2 ) +\definecolor{H3}{Hsb}{48, .8,.8} % 柠檬黄 (Hangzhou Metro 3 ) +\definecolor{H4}{Hsb}{103,.8,.8} % 香樟绿 (Hangzhou Metro 4 ) +\definecolor{H5}{Hsb}{188,.8,.8} % 青藍色 (Hangzhou MTR L 5 ) +\definecolor{H6}{Hsb}{207,.8,.8} % 海洋蓝 (Hangzhou Metro 6 ) +\definecolor{H7}{Hsb}{290,.8,.8} % 浪漫紫 (Hangzhou Metro 7 ) +\hypersetup{colorlinks,urlcolor=H6,linkcolor=H2,filecolor=filecolor,pdfstartview=FitH,pdfview=FitH,pdfcreator=XeTeX output} \def\pkg#1{\texorpdfstring{\textcolor{pkgcolor}{\textsf{#1}}}{“#1”}} \def\mode#1{\texorpdfstring{\textcolor{moducolor}{\textsf{#1}}}{“#1”}} @@ -63,12 +44,12 @@ \noindent\makebox[0pt][r]{\makebox[-3em][r]{\small\textbf{\textcolor{H7}{#1}}}\;\;}{\sffamily Update: \ignorespaces#2}} \makeatother -\title{The \pkg{LiteTable} Template} -\author[1]{Xia Mingyu, \href{https://www.hdu.edu.cn}{Hangzhou Dianzi University}} +\title{\bfseries The \pkg{LiteTable} Template} +\author{Xia Mingyu, \href{https://www.hdu.edu.cn}{Hangzhou Dianzi University}} \yyyymmdddate \date{\today} -\affil[1]{\href{mailto:xiamyphys@gmail.com}{\texttt{xiamyphys@gmail.com}}} -\date{\today\quad Version 2.3a\thanks{% +\affil{\href{mailto:xiamyphys@gmail.com}{\ttfamily xiamyphys@gmail.com}} +\date{\today\quad Version 2.4a\thanks{% \url{https://github.com/xiamyphys/litetable}}} \begin{document} \maketitle @@ -76,43 +57,44 @@ \vspace{-2em} \begin{abstract} This is the document for \pkg{LiteTable} template, which provides a beautiful design of class schedule with colorful course blocks. - \end{abstract} -\tableofcontents\clearpage +\tableofcontents + +\clearpage \section{Introduction} \subsection{The purpose of this template} This template provides a beautiful design of class schedule with colorful course blocks. -If you meet bugs when using this template, or you have better suggestions or ideas, or you want to participate in the development of the template or other templates by me, welcome to contact via email \href{mailto:xiamyphys@gmail.com}{xiamyphys@gmail.com}. +If you meet bugs when using this template, or you have better suggestions or ideas, or you want to participate in the development of the template or other templates by me, welcome to contact via email \href{mailto:xiamyphys@gmail.com}{\ttfamily xiamyphys@gmail.com}. Also, you can join my \textsf\LaTeX{} Template Discussion \href{https://qm.qq.com/q/OnHzbNvVAG}{QQ Group: 760570712} to communicate with me and get the insider preview edition of the template. \subsection{Packages required} -This template is based on the template \pkg{standalone}. And it requires \pkg{tikz} package to plot some graphics, \pkg{kvoptions} and \pkg{etoolbox} packages to provide global options, \pkg{expl3} package to support \cmd{timelist} array, \pkg{ctex} package to supports the \textbf{Chinese, Simplified} language and \pkg{fontawesome5} package to provides a set of beautiful icons. +This template is based on the template \pkg{standalone}. And it requires \pkg{tikz} package to plot some graphics, \pkg{kvoptions} and \pkg{etoolbox} packages to provide global options, \pkg{expl3} package to support \cmd{timelist} array, \pkg{xeCJK} package to support the \textbf{Chinese, Simplified} language and \pkg{fontawesome5} package to provide a set of beautiful icons. + +\subsection{Installing \pkg{LiteTable} and loading it} +For portable version, simply download latest \verb|litetable.cls| file from \href{https://github.com/xiamyphys/LiteTable}{GitHub} or \href{https://ctan.org/pkg/litetable}{CTAN} and save it under your working directory. This way of installation is simple and convenient, but you have to manually update \verb|.cls| now and then. -I strongly suggest that you should use cmd to implement the commands to update all the packages to the latest version or switch to portable version instead. +However, I strongly suggest that you should use terminal/cmd to implement the commands to update all the packages (and install this package) to the latest version or switch to portable version instead \begin{verbatim} - tlmgr update --self - tlmgr update --all + sudo tlmgr update --self + sudo tlmgr update --all \end{verbatim} -If you are in some areas with awful Internet environment (such as GFWz), you can choose proper mirror source or use other means\footnote{Please comply with local network regulations.}. To learn more, please refer to \href{https://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my \TeX{} distribution?} +If you are in some areas with awful Internet environment (such as GFW), you can choose proper mirror source or use other means\footnote{Please comply with local network regulations.}. To learn more, please refer to \href{https://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my \TeX{} distribution?} -\subsection{Loading \pkg{LiteTable} and its options} -Save the file \verb|litetable.cls| to your project's root directory, and then create a \verb|.tex| file, just input the command \verb|\documentclass{litetable}| on the first line. +The template provides four options, \mode{style}, \mode{direction} and \mode{font}. Just add the modes of the options you want separately in the square bracket of the command \verb|\documentclass[ ]{litetable}| in your \verb|.tex| file. -The template provides four options, \mode{date}, \mode{style}, \mode{direction} and \mode{font}. Just add the modes of the options you want separately in the square bracket of the command \verb|\documentclass[options]{litetable}| in your \verb|.tex| file. +\subsection{Compatibility} +The test environments are macOS + MacTeX 2023 / Overleaf and they all work fine for \XeLaTeX{} compiler, Windows, Linux and Unix platforms compatibility unknown. -\newpage \section{Global Options of \pkg{LiteTable}} \begin{verbatim} \documentclass[options]{litetable} \end{verbatim} -\subsection{The \mode{date} option} -This option has two modes, \mode{en} and \mode{cn}, which can make the weekdays display in English or 大陆简体, and the dafault mode is English. \subsection{The \mode{style} option} This option has two modes, \mode{round} and \mode{sharp}, which can make the course block's corners be round or sharp, and the default mode is sharp. @@ -127,36 +109,87 @@ This option has two modes, \mode{times} and \mode{libertinus}, which can make th \subsection{The \cmd{makeframe} command} \begin{verbatim} - \makeframe{Timetable -- Semester 5} + \makeframe{Timetable -- Semester 5} \end{verbatim} This command can create an empty class schedule with the title ``Timetable -- Semester 5''. -\subsection{The \cmd{timelist} command} +\subsection{The \cmd{weeklist} command} \begin{verbatim} - \timelist{ - 8:05,8:55,10:00,10:50,11:40,13:30,14:20,15:15,16:05,18:30,19:20,20:10; - 8:50,9:40,10:45,11:35,12:25,14:15,15:05,16:00,16:50,19:15,20:05,20:55 - } + \weeklist{ + \bfseries\textcolor{W1}{\faIcon{moon}~Monday}, + \bfseries\textcolor{W2}{\faIcon{fire}~Tuesday}, + \bfseries\textcolor{W3}{\faIcon{water}~Wednesday}, + \bfseries\textcolor{W4}{\faIcon{tree}~Thursday}, + \bfseries\textcolor{W5}{\faIcon{coins}~Friday} + } +\end{verbatim} + +This command can add workdays to the top side of the timetable, and you can also adjust the format that you like, such as name, color and even the logo\footnote{Supports by the \pkg{fontawesome5} package.} before it. + +The timetable can automatically generate the corresponding number of columns based on the number of workdays you enter. For example, the code above has 5 workdays, a 5-column timetable will be generated. + +\subsection{The \cmd{timelist} \cmd{classnum} command} +\begin{verbatim} + \timelist{ + 8:05,8:55,10:00,10:50,11:40,13:30,14:20,15:15,16:05,18:30,19:20,20:10; + 8:50,9:40,10:45,11:35,12:25,14:15,15:05,16:00,16:50,19:15,20:05,20:55 + } + + \classnum{14} \end{verbatim} -This command can add time to the left side of the timetable, and the first line of the content is the start time of the class while the second line of the content is the end time of the class, each time separates with comma (\verb|,|), the first line and the second line separates with semicolon (\verb|;|). +The command \cmd{timelist} can add time to the left side of the timetable, and the first line of the content is the start time of the classes while the second line of the content is the end time of the classes, each time separates with a comma (\verb|,|), the first line and the second line separates with a semicolon (\verb|;|). The timetable can automatically generate the corresponding number of rows based on the number of time groups you enter. For example, the code above has 12 groups of times, a 12-row timetable will be generated. +The command \cmd{classnum} can directly assign the number of rows on the timetable you want without adding time to the left side of the timetable, and there will only be a series of numbers that \emph{aligned vertically to the center of every line}. + +The following table shows the effects brought about by the usage of the two commands. +\begin{table}[!ht] +\centering +\caption{Usage of commands \cmd{timelist} and \cmd{classnum}.} + +\begin{tabularx}{\textwidth}{c >{\raggedright\arraybackslash}X >{\raggedright\arraybackslash}X} + \toprule + \diagbox{\cmd{classnum}}{\cmd{timelist}} & \multicolumn{1}{c}{To use} & \multicolumn{1}{c}{Not to use}\\ + \midrule + To use & + The effect is like the description of command \cmd{timelist}\newline But the number of rows will be assigned by \cmd{classnum} & + The effect is like the description of command \cmd{classnum} before\\ + \midrule + Not to use & + The effect is like the description of command \cmd{timelist} before & + The effect is like the description of command \cmd{timelist} before with \emph{default format of 12 lines}\\ + \bottomrule +\end{tabularx} +\end{table} + +\begin{itemize} + \item Assume that \cmd{timelist} has 12 groups of times, and \cmd{classnum} passed a value of 14, then the left side of the timetable will have only 1 -- 12 rows with time while the last two rows without time the label of them is still upward, not vertically aligned in the center. + \item Assume that \cmd{timelist} has 14 sets of times, and \cmd{classnum} passes a value of 12, then only 12 rows of timetables will be generated with time on the left side of each row, that is, the last two sets of data in \cmd{timelist} will be invalid. +\end{itemize} + +\subsection{The \cmd{weeks} command} +\begin{verbatim} + \weeks{Week 1 -- 16} +\end{verbatim} + +This command can assign the default value of the 7th variable of the command \cmd{course}. + \subsection{The \cmd{course} command} \begin{verbatim} - \course{H5}{3}{5}{AQM}{Building 6·225}{Yuan Li \& Mengnan Chen}{Week 1 -- 18} + \course[H1]{8}{9}{Group Theory}{Building 6 · 211}{Li Ge}[Week 1 -- 16] \end{verbatim} There are 7 variables in this command. \begin{itemize} - \item The 1st one is the color of the class that you want, from ``H1'' to ``H5''. + \item The 1st one is the color of the class that you want, from ``H1'' to ``H9'', it's optional and the default value is ``H1''. \item The 2nd and 3rd ones is the starting number and ending number of the class. \item The 4th one is the name of the class. \item The 5th one is the address of the class. \item The 6th one is the name of the teacher(s). - \item The last one is the start week and end week of the class. + \item The last one is the start week and end week of the timetable, it's optional and the default value is the value that you've adjusted in the command \cmd{weeks} or it will be ``Week 1 -- 12''. \end{itemize} \subsection{The \cmd{newday} command} @@ -164,7 +197,7 @@ This command can switch the current weekday to the next day, then the course wil \subsection{The \cmd{more} command} \begin{verbatim} - \more{·School Start: 04 / 03 / 2024 ·Summer Vacation: 05 / 07 / 2024} + \more{ · School Start: 04 / 03 / 2024 · Summer Vacation: 05 / 07 / 2024} \end{verbatim} This command can add remark at the end of the class schedule. @@ -172,15 +205,29 @@ This command can add remark at the end of the class schedule. \begin{verbatim} \sticker{favicon} \end{verbatim} -There will be a sticker on the southeast of the page after you add,otherwise it won't. +There will be a sticker on the southeast of the page after you add, otherwise it won't. + +\subsection{The \cmd{(re)rotatepage} command} +The \cmd{rotatepage} command can change the direction of the timetable temporarily while the \cmd{rerotatepage} command can restore it. + +\section{Known Issue: Resolution exceed} +\begin{verbatim} + Dimension too large. <recently read> \pgfmath@x +\end{verbatim} + +When you choose the \mode{landscape} mode and you've added 7 workdays or more (?although the `above' occasion will not occur), it will return this error. + +This is mainly caused by the reason that \emph{\textsf{\TeX} has no built-in floating number representation} (Reference: \cprotect{\href{https://tex.stackexchange.com/a/545416/299948}}{How to solve the error `Dimension too large. <recently read> \verb|\pgfmath@x|' while doing the calculations in the table}). + +If one can solve this problem through optimization algorithms or other means, welcome submit your code via GitHub: \url{https://github.com/xiamyphys/litetable}, or contact me via email \href{mail:xiamyphys@gmail.com}{\ttfamily xiamyphys@gmail.com}. \section{Version History} The design of this course schedule originated from the student course schedule web page\footnote{Only those studying at or graduated from Hangzhou Dianzi University can have the permission of access.} of the \href{https://www.hduhelp.cn/}{HDUHelp} in \href{https://www.hdu.edu.cn}{Hangzhou Dianzi University}\footnote{https://en.wikipedia.org/wiki/Hangzhou\_Dianzi\_University}. The layout is very beautiful and then I used \LaTeX{} to imitate that style and made a class schedule template to share with everyone. -\textsf{\bfseries Version 1.0} was finished on 1 September, 2023 and released on \href{https://www.latexstudio.net/index/details/index/mid/3625.html}{\LaTeX{} Studio} (Xiaoshan, Hangzhou) and \href{http://xhslink.com/od7Ycw}{Xiaohongshu}, where won the favor of many people. +\textsf{\bfseries Version 1.0} was finished on 1 September, 2023 and released on \href{https://www.latexstudio.net/index/details/index/mid/3625.html}{\LaTeX{} Studio} (Hangzhou) and \href{http://xhslink.com/od7Ycw}{Xiaohongshu}, where won the favor of many people. -\textsf{\bfseries Version 2.0a} was finished developing on 1 November, 2023 and released on \href{https://www.latexstudio.net/index/details/index/mid/3636.html}{\LaTeX{} Studio} (Xiaoshan, Hangzhou) and \href{http://xhslink.com/od7Ycw}{Xiaohongshu}. This version used \verb|.cls| files to make the \verb|main.tex| file more concise. Also, this version have added a global option to choose whether the corners of the ``course Block" to be round or sharp. And this version support adds multiply class schedules in one \verb|.tex| file. +\textsf{\bfseries Version 2.0a} was finished developing on 1 November, 2023 and released on \href{https://www.latexstudio.net/index/details/index/mid/3636.html}{\LaTeX{} Studio} (Xiaoshan, Hangzhou) and \href{http://xhslink.com/od7Ycw}{Xiaohongshu}. This version used \verb|.cls| files to make the \verb|main.tex| file more concise. Also, this version has added a global option to choose whether the corners of the ``course Block'' to be round or sharp. And this version support adds multiply class schedules in one \verb|.tex| file. \textsf{\bfseries Version 2.1a} was finished developing on 5 November, 2023. Supports the libertinus font. @@ -188,7 +235,12 @@ The design of this course schedule originated from the student course schedule w \textsf{\bfseries Version 2.3a} was finished developing on 2 February, 2024. This version supports automatically generate the corresponding number of rows based on the number of time groups you enter, and in this version, timetable can be displayed horizontally or portrait as you like. -\setstretch{.5} +\textsf{\bfseries Version 2.3b} was finished developing on 3 February, 2024. This version optimized coordinate calculation and improved compilation speed. + +\textsf{\bfseries Version 2.4a} was finished developing on 24 February, 2024. Happy Lantern Festival! This version supports custom workday display style, and supports hiding time and only showing course program number vertically aligned. + +\clearpage + \datechange{2023/09/01}{Version 2.0a} \begin{itemize} \item Supports the course block's corners be round or sharp. @@ -215,11 +267,25 @@ The design of this course schedule originated from the student course schedule w \item Timetable can be displayed portrait or horizontally as you like. \end{itemize} -\newpage\setstretch{1} +\datechange{2024/02/03}{Version 2.3b} +\begin{itemize} + \item Optimized coordinate calculation and improved compilation speed. +\end{itemize} + +\datechange{\today}{Version 2.4a} +\begin{itemize} + \item Supports custom workday display style. + \item Supports hiding time and only showing course program number vertically aligned. + \item Supports setting default first and last week. +\end{itemize} + \appendix -\section{Document Example} -\lstinputlisting[style=TeX]{litetable-demo1.tex} -\includepdf[pages=-,nup=1x2]{litetable-demo1.pdf} -\includepdf[pages=-]{litetable-demo2.pdf} +\includepdf[pages={2,4},nup=1x2,pagecommand={ + \tikz[remember picture, overlay] + \node [rotate=90,below,yshift=-1em] at (current page.west) {\bfseries\LARGE Document Example: \texttt{litetable-demo.tex}}; + } +]{litetable-demo.pdf} +\includepdf[pages={1,3}]{litetable-demo.pdf} + \end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/litetable/tex/litetable.cls b/macros/latex/contrib/litetable/tex/litetable.cls index a1862b985d..10d6882ff4 100644 --- a/macros/latex/contrib/litetable/tex/litetable.cls +++ b/macros/latex/contrib/litetable/tex/litetable.cls @@ -7,14 +7,14 @@ %% * version. * * * ** * * * * * %% ****************************************************** ***** ** * * *** * * * %% start of file `litetable.cls'. * -%% Copyright 2023 LiteLaTeX (xiamyphys@gmail.com) * +%% Copyright 2023-2024 LiteLaTeX (xiamyphys@gmail.com) * %% available at https://github.com/xiamyphys/LiteTable * -%% !Mode:: "TeX:UTF-8" * +% !Mode:: "TeX:UTF-8" * %% ************************************************************************************************************ \NeedsTeXFormat{LaTeX2e} \PassOptionsToPackage{quiet}{xeCJK} \PassOptionsToPackage{no-math}{fontspec} -\ProvidesClass{litetable}[2024/02/02/ v2.3a LiteTable document class] +\ProvidesClass{litetable}[2024/02/24/ v2.4a LiteTable document class] % ---------- 全局选项 ---------- % \RequirePackage{kvoptions} @@ -29,13 +29,9 @@ \DeclareVoidOption{portiait}{\kvsetkeys{LITE}{direction=portiait}} \DeclareVoidOption{landscape}{\kvsetkeys{LITE}{direction=landscape}} -\DeclareStringOption[en]{date} -\DeclareVoidOption{en}{\kvsetkeys{LITE}{date=en}} -\DeclareVoidOption{cn}{\kvsetkeys{LITE}{date=cn}} - \DeclareStringOption[times]{font} -\DeclareVoidOption{times}{\kvsetkeys{LITE}{date=times}} -\DeclareVoidOption{libertinus}{\kvsetkeys{LITE}{date=libertinus}} +\DeclareVoidOption{times}{\kvsetkeys{LITE}{font=times}} +\DeclareVoidOption{libertinus}{\kvsetkeys{LITE}{font=libertinus}} \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{standalone}} \ProcessKeyvalOptions*\relax @@ -45,10 +41,9 @@ % ---- 文本中的数字 & 字母设置 ---- % \RequirePackage{xeCJK} \setCJKfamilyfont{zhhei}{Heiti SC} -\newcommand*\heiti{\CJKfamily{zhhei}} +\newcommand*\heiti{\CJKfamily{zhhei}} \ifdefstring{\LITE@font}{libertinus}{ -\setmainfont{Libertinus Serif} -\setsansfont{Libertinus Sans} +\RequirePackage{libertine} }{\relax} \ifdefstring{\LITE@font}{times}{ \ifXeTeX @@ -78,6 +73,9 @@ \definecolor{darkergray}{HTML}{F1F3F5} % 深色块 \definecolor{lightergray}{HTML}{FCFDFE} % 浅色块 \definecolor{blackgray}{HTML}{1A1D21} % 序号颜色 + +\pagecolor{lightergray} + \definecolor{H1}{HTML}{74A7A2} % 深绿 \definecolor{H1*}{HTML}{E9EEED} \definecolor{H1**}{HTML}{009787} @@ -105,12 +103,14 @@ \definecolor{H9}{HTML}{D09966} % 棕色 \definecolor{H9*}{HTML}{F2E0D0} \definecolor{H9**}{HTML}{C96F1C} -\pagecolor{lightergray} -\definecolor{丹色}{HTML}{E45E32} -\definecolor{紅緋}{HTML}{E83929} -\definecolor{紺碧}{HTML}{007BBB} -\definecolor{青碧}{HTML}{478384} -\definecolor{金色}{HTML}{E6B422} + +\definecolor{W1}{HTML}{CCAD52} +\definecolor{W2}{HTML}{8FCC52} +\definecolor{W3}{HTML}{52CC70} +\definecolor{W4}{HTML}{52CCCC} +\definecolor{W5}{HTML}{5270CC} +\definecolor{W6}{HTML}{8F52CC} +\definecolor{W7}{HTML}{CC52AD} \usetikzlibrary{calc} \ifdefstring{\LITE@direction}{portiait}{ @@ -120,6 +120,10 @@ \def\pagewidth{11 in} \def\pageheight{-8.5 in} } + \def\rerotatepage{ + \def\pagewidth{8.5 in} + \def\pageheight{-11 in} + } }{\relax} \ifdefstring{\LITE@direction}{landscape}{ \def\pagewidth{11 in} @@ -128,17 +132,18 @@ \def\pagewidth{8.5 in} \def\pageheight{-11 in} } + \def\rerotatepage{ + \def\pagewidth{11 in} + \def\pageheight{-8.5 in} + } }{\relax} \ifdefstring{\LITE@style}{round}{\def\corners{rounded corners}}{\relax} \ifdefstring{\LITE@style}{sharp}{\def\corners{}}{\relax} -\ExplSyntaxOn % 二维数组 -\seq_new:N \l_node_row_seq -\seq_new:N \l_node_tmp_seq +\ExplSyntaxOn % 数组 \cs_set:Npn \timelist #1 { - \gdef\@timelist{#1} % 判断\@timelist是否存在 - \gdef\@classnum{\int_div_round:nn {\clist_count:n {#1}}{2}} % 计数模块 + \gdef\@timelist{#1} \seq_set_split:Nnn \l_node_row_seq {;} {#1} \int_step_inline:nn{\seq_count:N \l_node_row_seq} { @@ -175,66 +180,135 @@ } } } + +\cs_set:Npn \weeklist #1 { + \gdef\@weeklist{#1} + \gdef\@weeknum{\clist_count:n {#1}} % 计数模块 + \seq_set_split:Nnn \r_node_row_seq {;} {#1} + \int_step_inline:nn{\seq_count:N \r_node_row_seq} + { + \exp_args:Ncx\seq_set_from_clist:Nn {r_node_row_##1_seq} {\seq_item:Nn \r_node_row_seq{##1}} + } +} + +\cs_set:Npn \PrintWeek [#1] { + \tl_if_empty:nTF {#1} + { + \seq_use:cn {r_node_row_1_seq}{,} + } + { + \seq_item:cn {r_node_row_1_seq}{#1} + } +} \ExplSyntaxOff + +\def\classnum#1{\gdef\@classnum{#1}} +\ifcsname @classnum\endcsname % 判断`\@classnum'由`\timelist'计数赋值还是`\classnum'直接赋值 + \relax + \else + \ifcsname @timelist\endcsname + \gdef\@classnum{\int_div_round:nn {\clist_count:n {\@timelist}}{2}} % 计数模块 + \else + \def\@classnum{12} + \fi +\fi + \RequirePackage{fontawesome5} \newcounter{number} -\def\sticker{\gdef\@sticker} +\def\sticker#1{\gdef\@sticker{#1}} \def\makeframe#1{ - \draw [gray!75] (0,0) rectangle (\pagewidth,\pageheight); + \draw [darkergray] (0,0) rectangle (\pagewidth,\pageheight); \fill [fill=darkergray,\corners] (0,0) rectangle (\pagewidth,{1.5*\pageheight/(2*\@classnum+3.5)});% 顶部深灰色块 \node at (.5*\pagewidth,{.75*\pageheight/(2*\@classnum+3.5)}) {\huge\bfseries\sffamily #1}; % 标题 + \ifodd\@classnum - \foreach \a in {2,4,...,\@classnum,\@classnum+1} - \fill [fill=darkergray,yshift=2.5*\pageheight/(2*\@classnum+3.5)+2*(\a-2)*\pageheight/(2*\@classnum+3.5),\corners] (0,0) rectangle (\pagewidth,{2*\pageheight/(2*\@classnum+3.5)}); % 中间深灰色块(循环) + \foreach \a in {2,4,...,\@classnum,\@classnum+2} + \fill [fill=darkergray,yshift=(2*\a-1.5)*\pageheight/(2*\@classnum+3.5),\corners] (0,0) rectangle (\pagewidth,{2*\pageheight/(2*\@classnum+3.5)}); % 中间深灰色块(循环) \else \foreach \a in {2,4,...,\@classnum} - \fill [fill=darkergray,yshift=2.5*\pageheight/(2*\@classnum+3.5)+2*(\a-2)*\pageheight/(2*\@classnum+3.5),\corners] (0,0) rectangle (\pagewidth,{2*\pageheight/(2*\@classnum+3.5)}); % 中间深灰色块(循环) - \fill [fill=darkergray,yshift=2.5*\pageheight/(2*\@classnum+3.5)+2*\@classnum*\pageheight/(2*\@classnum+3.5),\corners] (0,0) rectangle (\pagewidth,{\pageheight/(2*\@classnum+3.5)}); % 底部深灰色块 + \fill [fill=darkergray,yshift=(2*\a-1.5)*\pageheight/(2*\@classnum+3.5),\corners] (0,0) rectangle (\pagewidth,{2*\pageheight/(2*\@classnum+3.5)}); % 中间深灰色块(循环) + \fill [fill=darkergray,yshift=(2.5+2*\@classnum)*\pageheight/(2*\@classnum+3.5),\corners] (0,0) rectangle (\pagewidth,{\pageheight/(2*\@classnum+3.5)}); % 底部深灰色块 \fi + \foreach \a in {0,1,2,...,\@classnum} - \draw [densely dashed,gray!75,yshift=2.5*\pageheight/(2*\@classnum+3.5)+2*\a*\pageheight/(2*\@classnum+3.5),] (0,0)--(\pagewidth,0); % 分割虚线 + \draw [densely dashed,gray!75,yshift=(2.5+2*\a)*\pageheight/(2*\@classnum+3.5)] (0,0)--(\pagewidth,0); % 分割虚线 + % 时间标注 \setcounter{number}{0} - \foreach \a in {1,2,...,\@classnum} - \node [yshift=2.5*\pageheight/(2*\@classnum+3.5)+2*(\a-.8)*\pageheight/(2*\@classnum+3.5)] at (\pagewidth/32,0) {\bfseries\color{blackgray}\texttt{\refstepcounter{number}\thenumber}}; \ifcsname @timelist\endcsname % 若 `\@timelist == empty', 跳过该函数 - \foreach \x in {1,2,...,\@classnum} - { - \node[yshift=2.5*\pageheight/(2*\@classnum+3.5)+2*(\x-.475)*\pageheight/(2*\@classnum+3.5)] at (\pagewidth/32,0) {\color{darkgray}\texttt{\PrintTime[1][\x]}}; - \node[yshift=2.5*\pageheight/(2*\@classnum+3.5)+2*(\x-.2)*\pageheight/(2*\@classnum+3.5)] at (\pagewidth/32,0) {\color{darkgray}\texttt{\PrintTime[2][\x]}}; - }\fi + \foreach \x in {1,2,...,\@classnum} + { + \node [yshift=(2*\x+.9)*\pageheight/(2*\@classnum+3.5)] at (\pagewidth/32,0) + {\bfseries\color{blackgray}\texttt{\refstepcounter{number}\thenumber}}; + \node[yshift=(2*\x+1.55)*\pageheight/(2*\@classnum+3.5)] at (\pagewidth/32,0) + {\color{darkgray}\texttt{\PrintTime[1][\x]}}; + \node[yshift=(2*\x+2.1)*\pageheight/(2*\@classnum+3.5)] at (\pagewidth/32,0) + {\color{darkgray}\texttt{\PrintTime[2][\x]}}; + } + \else + \foreach \a in {1,2,...,\@classnum} + { + \node [yshift=(1.5+2*\a)*\pageheight/(2*\@classnum+3.5)] at(\pagewidth/32,0) + {\bfseries\large\color{blackgray}\texttt{\refstepcounter{number}\thenumber}}; + } + \fi % 星期标注 - \ifdefstring{\LITE@date}{en}{ - \node [xshift=2.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{丹色}\faIcon{moon}\;\bfseries\heiti{Monday}}; - \node [xshift=5.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{紅緋}\faIcon{fire}\;\bfseries\heiti{Tuesday}}; - \node [xshift=8.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{紺碧}\faIcon{water}\;\bfseries\heiti{Wednesday}}; - \node [xshift=11.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{青碧}\faIcon{tree}\;\bfseries\heiti{Thursday}}; - \node [xshift=14.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{金色}\faIcon{sun}\;\bfseries\heiti{Friday}}; - }{\relax} - \ifdefstring{\LITE@date}{cn}{ - \node [xshift=2.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{丹色}\faIcon{moon}\;\bfseries\heiti{星期一}}; - \node [xshift=5.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{紅緋}\faIcon{fire}\;\bfseries\heiti{星期二}}; - \node [xshift=8.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{紺碧}\faIcon{water}\;\bfseries\heiti{星期三}}; - \node [xshift=11.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{青碧}\faIcon{tree}\;\bfseries\heiti{星期四}}; - \node [xshift=14.5*\pagewidth/16] at (0,{2*\pageheight/(2*\@classnum+3.5)}) {\color{金色}\faIcon{sun}\;\bfseries\heiti{星期五}}; - }{\relax} + \foreach \a in {1,2,...,\@weeknum} + \node [xshift=3*\a*\pagewidth/16] at ({\pagewidth/16-\a*(15*\pagewidth/16*(1/5-1/\@weeknum))-7.5*\pagewidth/(16*\@weeknum)},{2*\pageheight/(2*\@classnum+3.5)}) + {\PrintWeek[\a]}; \ifcsname @sticker\endcsname - \node [opacity=.3,anchor=south east,yshift=1.5*\pageheight/(2*\@classnum+3.5)+2*\@classnum*\pageheight/(2*\@classnum+3.5),inner sep=0pt,scale=3] at (\pagewidth,{\pageheight/(2*\@classnum+3.5)}) {\includegraphics[width=\dimeval{\pagewidth/16}]{\@sticker}};\fi + \node [opacity=.3,above left,yshift=(1.5+2*\@classnum)*\pageheight/(2*\@classnum+3.5),inner sep=0pt,outer sep=auto,scale=15] at (\pagewidth,{\pageheight/(2*\@classnum+3.5)}) {\includegraphics[width=\dimeval{\pagewidth/16/\@weeknum}]{\@sticker}};\fi } \newcounter{weekday} \def\newday{\addtocounter{weekday}{1}} \AtEndEnvironment{tikzpicture}{\setcounter{weekday}{0}} -\newcommand{\course}[7] + +\def\weeks#1{\gdef\@weeks{#1}} +\ifcsname @weeks\endcsname + \relax +\else + \let\@weeks\relax +\fi + +\NewDocumentCommand{\course}{O{H1} m m m m m O{\@weeks}} { - \fill [#1,\corners,yshift=2*(#2-1)*\pageheight/(2*\@classnum+3.5),xshift=3*\theweekday*\pagewidth/16] (\pagewidth/16,{2.5*\pageheight/(2*\@classnum+3.5)}) rectangle (4*\pagewidth/16,{(4.5+2*(#3-#2))*\pageheight/(2*\@classnum+3.5)}); % frame - \fill [#1*,\corners,yshift=(2*(#2-1)+.5)*\pageheight/(2*\@classnum+3.5),xshift=3*\theweekday*\pagewidth/16] (\pagewidth/16,{2.5*\pageheight/(2*\@classnum+3.5)}) rectangle (4*\pagewidth/16,{(4+2*(#3-#2))*\pageheight/(2*\@classnum+3.5)}); % content - \node [#1**,yshift=(#2+#3-1.25)*\pageheight/(2*\@classnum+3.5),xshift=3*\theweekday*\pagewidth/16] at (2.5*\pagewidth/16,{2.5*\pageheight/(2*\@classnum+3.5)}) {\heiti\large\bfseries #4}; % course - \node [#1**,anchor=south,yshift=(#2+#3-.2)*\pageheight/(2*\@classnum+3.5),xshift=3*\theweekday*\pagewidth/16] at (2.5*\pagewidth/16,{2.5*\pageheight/(2*\@classnum+3.5)}) {\heiti\bfseries\small #5}; % location - \node [#1**,anchor=north,yshift=(#2+#3-.2)*\pageheight/(2*\@classnum+3.5),xshift=3*\theweekday*\pagewidth/16] at (2.5*\pagewidth/16,{2.5*\pageheight/(2*\@classnum+3.5)}) {\heiti\bfseries\small #6}; % teacher - \node [#1**,anchor=south east,yshift=2*#3*\pageheight/(2*\@classnum+3.5),xshift=3*\theweekday*\pagewidth/16] at (4*\pagewidth/16,{2.5*\pageheight/(2*\@classnum+3.5)}) {\heiti\footnotesize #7}; % weeks + \fill [#1,\corners, + yshift=(2*(#2-1))*\pageheight/(2*\@classnum+3.5), + xshift=3*\theweekday*\pagewidth/16] + ({\pagewidth/16-\theweekday*(15*\pagewidth/16*(1/5-1/\@weeknum))},{2.5*\pageheight/(2*\@classnum+3.5)}) rectangle ++ + ({15*\pagewidth/(16*\@weeknum)},{(2+2*(#3-#2))*\pageheight/(2*\@classnum+3.5)}); % frame + + \fill [#1*,\corners, + yshift=(2*(#2-1)+.5)*\pageheight/(2*\@classnum+3.5), + xshift=3*\theweekday*\pagewidth/16] + ({\pagewidth/16-\theweekday*(15*\pagewidth/16*(1/5-1/\@weeknum))},{2.5*\pageheight/(2*\@classnum+3.5)}) rectangle ++ + ({15*\pagewidth/(16*\@weeknum)},{(1.5+2*(#3-#2))*\pageheight/(2*\@classnum+3.5)}); % content + + \node [#1**,yshift=(#2+#3-1.25)*\pageheight/(2*\@classnum+3.5), + xshift=3*\theweekday*\pagewidth/16] at + ({\pagewidth/16-\theweekday*(15*\pagewidth/16*(1/5-1/\@weeknum))+7.5*\pagewidth/(16*\@weeknum)},{2.5*\pageheight/(2*\@classnum+3.5)}) + {\heiti\large\bfseries #4}; % course + + \node [#1**,above, + yshift=(#2+#3-.2)*\pageheight/(2*\@classnum+3.5), + xshift=3*\theweekday*\pagewidth/16] at + ({\pagewidth/16-\theweekday*(15*\pagewidth/16*(1/5-1/\@weeknum))+7.5*\pagewidth/(16*\@weeknum)},{2.5*\pageheight/(2*\@classnum+3.5)}) + {\heiti\bfseries\small #5}; % location + + \node [#1**,below, + yshift=(#2+#3-.2)*\pageheight/(2*\@classnum+3.5), + xshift=3*\theweekday*\pagewidth/16] at + ({\pagewidth/16-\theweekday*(15*\pagewidth/16*(1/5-1/\@weeknum))+7.5*\pagewidth/(16*\@weeknum)},{2.5*\pageheight/(2*\@classnum+3.5)}) + {\heiti\bfseries\small #6}; % teacher + + \node [#1**,above left, + yshift=2*#3*\pageheight/(2*\@classnum+3.5), + xshift=3*\theweekday*\pagewidth/16] at + ({\pagewidth/16-\theweekday*(15*\pagewidth/16*(1/5-1/\@weeknum))+15*\pagewidth/(16*\@weeknum)},{2.5*\pageheight/(2*\@classnum+3.5)}) + {\heiti\footnotesize #7}; % weeks } \def\more#1{ - \node [xshift=-1em,yshift=2.5*\pageheight/(2*\@classnum+3.5)+2*\@classnum*\pageheight/(2*\@classnum+3.5),anchor=east] at (\pagewidth,{.5*\pageheight/(2*\@classnum+3.5)}){\small\bfseries\color{darkgray}#1}; + \node [xshift=-1em,yshift=(2.5+2*\@classnum)*\pageheight/(2*\@classnum+3.5),left] at (\pagewidth,{.5*\pageheight/(2*\@classnum+3.5)}){\small\bfseries\color{darkgray}#1}; }
\ No newline at end of file diff --git a/macros/latex/contrib/projlib/ProjLib.dtx b/macros/latex/contrib/projlib/ProjLib.dtx index fbe6d2acd2..d961221c89 100644 --- a/macros/latex/contrib/projlib/ProjLib.dtx +++ b/macros/latex/contrib/projlib/ProjLib.dtx @@ -19,84 +19,84 @@ %<*ProjLib> \ProvidesExplPackage {ProjLib} - {2024/02/22} {} + {2024/02/24} {} {Collective interface of the ProjLib toolkit} %</ProjLib> % %<*projlib-author> \ProvidesExplPackage {projlib-author} - {2024/02/22} {} + {2024/02/24} {} {Enhanced author information block} %</projlib-author> % %<*projlib-datetime> \ProvidesExplPackage {projlib-datetime} - {2024/02/22} {} + {2024/02/24} {} {Convert numeric date-time string to natural language} %</projlib-datetime> % %<*projlib-draft> \ProvidesExplPackage {projlib-draft} - {2024/02/22} {} + {2024/02/24} {} {Useful commands during draft stage} %</projlib-draft> % %<*projlib-font> \ProvidesExplPackage {projlib-font} - {2024/02/22} {} + {2024/02/24} {} {Font selection and configuration} %</projlib-font> % %<*projlib-language> \ProvidesExplPackage {projlib-language} - {2024/02/22} {} + {2024/02/24} {} {Multi-language configuration} %</projlib-language> % %<*projlib-logo> \ProvidesExplPackage {projlib-logo} - {2024/02/22} {} + {2024/02/24} {} {The ProjLib logo} %</projlib-logo> % %<*projlib-math> \ProvidesExplPackage {projlib-math} - {2024/02/22} {} + {2024/02/24} {} {Efficient math setup} %</projlib-math> % %<*projlib-paper> \ProvidesExplPackage {projlib-paper} - {2024/02/22} {} + {2024/02/24} {} {Configuration of the paper style} %</projlib-paper> % %<*projlib-text> \ProvidesExplPackage {projlib-text} - {2024/02/22} {} + {2024/02/24} {} {Text-related commands} %</projlib-text> % %<*projlib-theorem> \ProvidesExplPackage {projlib-theorem} - {2024/02/22} {} + {2024/02/24} {} {Configuration of theorem-like environments} %</projlib-theorem> % %<*projlib-titlepage> \ProvidesExplPackage {projlib-titlepage} - {2024/02/22} {} + {2024/02/24} {} {Interface for title page rendering} %</projlib-titlepage> @@ -229,7 +229,7 @@ % If there is nothing before, the following line does nothing % If there is an affil before, this will backward one line \phantom {A} \\[-\baselineskip] - \tl_if_blank:nTF { #1 } + \projlib_author_if_content_empty:nTF { #1 } { \skip_vertical:n { \g__projlib_author_emptysep_dim } \phantom {} diff --git a/macros/latex/contrib/projlib/README.md b/macros/latex/contrib/projlib/README.md index e5d6b13900..207a68fe12 100644 --- a/macros/latex/contrib/projlib/README.md +++ b/macros/latex/contrib/projlib/README.md @@ -5,7 +5,7 @@ # The `ProjLib` Toolkit -> **This bundle is dated 2024/02/22.** +> **This bundle is dated 2024/02/24.** > **New documentations are still being written. For now, only the core code is included in TeX Live 2024 and MiKTeX (old documentations have been removed from the distribution).** |