diff options
author | Norbert Preining <norbert@preining.info> | 2023-06-08 03:01:59 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-06-08 03:01:59 +0000 |
commit | 538e6d6e7c75b7cca5470604811205f9dbd55c03 (patch) | |
tree | 4807afb694acc9e4ecff2d466d5e37788127d6fb /macros | |
parent | 5c99135c06494b236cce7fd76e346851cf8c4408 (diff) |
CTAN sync 202306080301
Diffstat (limited to 'macros')
33 files changed, 3536 insertions, 867 deletions
diff --git a/macros/latex/contrib/examz/README.txt b/macros/latex/contrib/examz/README.txt new file mode 100644 index 0000000000..4ef05244e0 --- /dev/null +++ b/macros/latex/contrib/examz/README.txt @@ -0,0 +1,18 @@ + + +---------------------------------------------------------------------- +`examz' --- 2023/06/07 Version 1.0.0 + +Copyright (C) 2023 by Christopher McClain +E-mail: christopher.mcclain@mail.wvu.edu + +Released under the LaTeX Project Public License v1.3c or later +See https://www.latex-project.org/lppl.txt +---------------------------------------------------------------------- + +The `examz' document class builds on the `exam' document class that +was developed by Philip S. Hirschhorn. An author may use the class +exactly as the `exam' class, but there are also additional features. +The document class facilitates the writing of questions with random +elements, the creation of multiple versions of an exam, and the use +of separate files as question banks. diff --git a/macros/latex/contrib/examz/examz.dtx b/macros/latex/contrib/examz/examz.dtx new file mode 100644 index 0000000000..fe0eae0ddd --- /dev/null +++ b/macros/latex/contrib/examz/examz.dtx @@ -0,0 +1,1168 @@ +% \iffalse meta-comment +% +% `examz' --- 2023/06/07 Version 1.0.0 +% +% Copyright (C) 2023 by Christopher McClain +% E-mail: christopher.mcclain@mail.wvu.edu +% ----------------------------------------- +% +% 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 +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2008 or later. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{examz.dtx} +%</driver> +%<class>\NeedsTeXFormat{LaTeX2e} +%<class>\ProvidesClass{examz} +%<*class> + [2023/06/07 v1.0.0 Randomized exams with multiple versions] +%</class> +% +%<*driver> +\documentclass{ltxdoc} +\usepackage[numbered]{hypdoc} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{examz.dtx} +\end{document} +%</driver> +% \fi +% +% \changes{v1.0.0}{2023/06/07}{First public release} +% +% \GetFileInfo{examz.dtx} +% +% \DoNotIndex{\addtocounter,\arabic,\AtBeginDocument,\AtEndDocument,\begin, +% \BODY,\boolfalse,\booltrue,\chk@incompi,\clearcounterprefix, +% \Collect@Body,\counterprefix,\CurrentOption,\DeclareOption, +% \decr@latest@ques,\end,\endcoverpages,\find@latestques,\ifbool, +% \ifnumequal,\ifnumless,\ifnumodd,\ifrandomizectr,\input, +% \inputcountersfile,\LoadClass,\newbool,\newcommand,\newcounter, +% \NewEnviron,\newenvironment,\newpage,\noprintanswers, +% \norandomizectr,\notbool,\null,\opencountersfile,\parts, +% \PassOptionsToClass,\printanswers,\ProcessOptions,\question, +% \questions,\randomizectr,\refto@index,\relax,\renewcommand, +% \RequirePackage,\savecounter,\setcounter,\setcounterprefix, +% \setup@point@toks,\space,\subparts,\subsubparts,\thispagestyle, +% \typein,\typeout,\value,\whileboolexpr,\xpatchcmd, +% \xrandprovidecounter,\xvalue,\hrulefill,\makebox,\EnterResponse, +% \NumberOfVersions,\endinput} +% +% \title{^^A +% The \textsf{examz} class\thanks{^^A +% This file describes version \fileversion, last revised \filedate.^^A +% }^^A +% } +% \author{^^A +% Christopher McClain\thanks{E-mail: christopher.mcclain@mail.wvu.edu}^^A +% } +% +% \date{Released \filedate} +% +% \maketitle +% +%\begin{abstract} +% The \textsf{examz} document class builds on the \textsf{exam} document class +% that was developed by Philip S. Hirschhorn. An author may use the class +% exactly as the \textsf{exam} class, but there are also additional features. +% The document class facilitates the writing of questions with random elements, +% the creation of multiple versions of an exam, and the use of separate files +% as question banks. +%\end{abstract} +% +%\tableofcontents +% +%\section{Introduction} +% +%\subsection{About} +% +% Since 1994, Philip Hirschhorn's \textsf{exam} document class has provided +% authors and educators with a framework for writing exams that is both highly +% customizable and easy to use. The \textsf{examz} document class loads the +% \textsf{exam} class and adds some more features. Most of these new features +% require the \textsf{counterz} package. +% +% First of all, the \textsf{examz} class may be loaded with new options that +% facilitate the use of commands from the \textsf{counterz} package for writing +% questions with random elements. Second, a new \textsf{versions} environment +% allows for the creation of multiple versions of an exam in the same document, +% alternating between exams and solutions, if desired. Third, the command +% \cs{question} may now be replaced by the command \cs{questionfrombank} which +% allows for random selection of questions from a user-defined question bank. +% Finally, a few simple macros make it even easier to modify the customized +% content in headers, footers, and special pages when creating new exams from +% previous documents. +% +% Some commands in \textsf{exam} have been patched in order to distinctly label +% the questions in different exam versions and their solutions (so that \LaTeX{} +% issues no warnings about multiply-defined labels). The optional environment +% \textsf{coverpages} has also been patched for two-sided documents so that the +% subsequent odd arabic numerals always appear on the front pages. +% +%\subsection{License} +% +% Copyright \copyright\ 2023 Christopher McClain. This software may be copied, +% distributed, and/or modified under the %terms of the +% \href{https://www.latex-project.org/lppl/}{LaTeX Project Public License}, +% either version 1.3c of this license or any later version. +% +%\subsection{Installation} +% +% Run \LaTeX{} on examz.ins to generate the file examz.cls, and copy it to +% your local texmf directory. Run (pdf)\LaTeX{} on examz.dtx to generate the +% documentation examz.pdf. Typesetting the documentation requires the package +% \textsf{hypdoc} which is included in \TeX\ distributions and at +% \href{http://www.ctan.org} {The Comprehensive TeX Archive Network}. +% +%\section{User Guide} +% +% To use this document class, begin your document with the following line: +% +%\begin{verbatim} +%\documentclass{examz} +%\end{verbatim} +% +% \noindent +% This document class loads the \textsf{exam} class and admits the options for +% that class. See the documentation for the \textsf{exam} class for details. The +% \textsf{examz} class also admits the additional options \textsf{randomize}, +% \textsf{norandomize}, \textsf{prompt}, and \textsf{complete}, all of which are +% discussed in this guide. This document class requires the \textsf{counterz} +% package, which is available at \href{http://www.ctan.org} +% {The Comprehensive TeX Archive Network}. +% +% In addition to its parent class \textsf{exam} and the \textsf{counterz} +% package, the \textsf{examz} class requires the following packages: +% \textsf{xparse}, \textsf{environ}, \textsf{etoolbox}, and \textsf{makecmds} +% (the latter two via \textsf{counterz}), all of which are included in most +% standard \TeX\ distributions and at \href{http://www.ctan.org}{The +% Comprehensive TeX Archive Network}. +% +%\subsection{Randomized Exams}\label{usr:versions} +% +% The \textsf{examz} class loads the \textsf{counterz} package which provides +% commands for generating, saving, recalling, manipulating, and displaying +% random values for counters. These commands may be incorporated into questions +% to generate random exams. The process of saving and recalling counters may be +% explicitly coded in the document, as described in the \textsf{counterz} +% package documentation, but the \textsf{examz} class may instead be loaded with +% options to automate this process. +% +% Loading the class with the option \textsf{randomize} will execute the commands +% \cs{randomizectr} and \cs{opencountersfile} from the \textsf{counterz} +% package. Loading the class with the option \textsf{norandomize} will execute +% the commands \cs{norandomizectr} and \cs{inputcountersfile}. If neither of +% these options are loaded, the default behavior is that of the option +% \textsf{randomize}. The reason for this is that if the document contains no +% randomly generated counters then this default choice will have no effect +% anyway, and if the document does contain randomly generated counters then the +% first typesetting must generate these counter values. +% +% A third option \textsf{prompt} frees the user from the burden of manually +% changing between \textsf{randomize} and \textsf{nonrandomize} and also +% protects against accidental overwriting of previously generated counter +% values. This option will execute the command \cs{promptrandomexam}, which +% is an instance of the command \cs{promptrandomizectr} from the +% \textsf{counterz} package, followed by one of the commands +% \cs{opencountersfile} or \cs{inputcountersfile} as appropriate. The terminal +% dialogue of \cs{promptrandomexam} can be changed with the use of +% \cs{renewcommand}, if desired. (See Section \ref{imp} for the implementation +% of \cs{promptrandomexam}.) There are additional effects from this option with +% regard to the \textsf{versions} environment, described below. +% +% \DescribeEnv{versions} +% The \textsf{versions} environment uses a loop and a counter \textit{version} +% to generate versions of the exam, incrementing the counter and updating the +% page numbers along the way. The version number may be displayed in headers or +% elsewhere with either \cs{theversion} or \cs{arabic}\{version\}. The +% environment takes an optional argument: the number of desired versions, with +% 1 being the default value. The environment is used as follows: +% +%\begin{verbatim} +%\begin{versions}[<optional number>] +% <exam content here> +%\end{versions} +%\end{verbatim} +% +%\noindent +% where \textit{exam content} refers to the \textsf{questions} environment (as +% defined in the \textsf{exam} package), cover pages, and anything else after +% \cs{begin}\{document\} that is intended to appear in the exam. When the class +% is randomized with the option \textsf{prompt}, the number provided by the +% optional argument is not used, and so there is no reason to include it. +% Instead, a command \cs{promptversions} inputs the number of versions using a +% terminal dialogue. (The dialogue can be changed by using \cs{renewcommand}, +% if desired. See Section \ref{imp:versions} for the implementation of +% \cs{promptversions}.) When the exam is not randomized, the number of versions +% is inputted from the previously generated counters file, and so the prompt +% does not appear. +% +% Recall that the \textsf{examz} class inherits the options \textsf{answers} +% and \textsf{noanswers} from the \textsf{exam} class. The \textsf{examz} class +% also has an additional option called \textsf{complete}. When loaded with this +% option, the document alternately prints without and with solutions. (Note: +% This feature only takes effect when using the \textsf{versions} environment.) +% Moreover, when the class is loaded with the option \textsf{twoside} (inherited +% from its grandparent class \textsf{article}), an extra blank page is inserted +% at the end of each exam when necessary to ensure that the next exam starts on +% a front page. An exam that begins with the line +% +%\begin{verbatim} +%\documentclass{11pt,twoside,addpoints,prompt,complete} +%\end{verbatim} +% +%\noindent +% and uses the \textsf{versions} environment, for example, will ask the user +% whether to randomize, and if so, how many versions to print. Then the typeset +% document will include the requested number of versions, alternating between +% exams and solutions, with correct grade tables and no warnings about +% multiply-defined labels, and an extra blank page whenever an exam has an odd +% number of pages. +% +%\subsection{Question Banks}\label{usr:banks} +% +% Within the \textsf{questions} environment, the \textsf{examz} package offers +% an alternative to the command \cs{question} that allows for the random +% selection of a question from a question bank. The command +% \DescribeMacro{\questionfrombank} +% \cs{questionfrombank}\oarg{points}\marg{filename} has two arguments, the first +% of which is optional. The first (optional) argument is the point value of the +% question, just as with the command \cs{question} from the \textsf{exam} class. +% The second argument is the name of a \TeX{} file (without the .tex extension). +% The second argument may include a path. Suppose, for example, that the +% directory which contains the main exam document \textsf{Test1.tex} also +% contains a subdirectory named \textsf{Problems} containing the files +% \textsf{Solve\_Linear\_Equation.tex} and \textsf{State\_Capitals.tex}. Then +% the code +% +% +%\begin{verbatim} +%\documentclass{examz} +%\begin{document} +%\begin{questions} +% \questionfrombank{Problems/Solve_Linear_Equation} +% \questionfrombank{Problems/State_Capitals} +%\end{questions} +%\end{document} +%\end{verbatim} +% +%\noindent +% generates an exam with two questions, one randomly selected from each of the +% two specified files. +% +% When several files are contained in the same directory, the repetition of the +% \DescribeMacro{\setquestionpath} +% path name can be reduced by the command \cs{setquestionpath}\marg{path name}, +% as illustrated by the following code: +% +%\begin{verbatim} +%\documentclass{examz} +%\begin{document} +% \setquestionpath{Problems/} +%\begin{questions} +% \questionfrombank{Solve_Linear_Equation} +% \questionfrombank{State_Capitals} +%\end{questions} +%\end{document} +%\end{verbatim} +% +% \noindent +% The command \cs{setquestionpath} can be used both inside and outside of the +% \textsf{questions} environment, and can be used to change the path multiple +% times, if desired. +% +% In order for a file to function as a question bank, it must conform to a +% specific (but very simple) structure. First of all, every question bank file +% begins with a command \cs{setnumberofquestions}\marg{number}. Second, all of +% \DescribeMacro{\setnumberofquestions} +% the questions are contained within a \textsf{questionbank} environment. Third, +% each individual question is contained within a \textsf{qbitem} environment. +% This structure is exhibited by the following code, which could be the entire +% contents of a file \textsf{State\_Capitals.tex} inputted by the command \cs{questionfrombank}: +% +%\begin{verbatim} +%\setnumberofquestions{2} +%\begin{questionbank} +%\begin{qbitem}{1} +% What is the capital of Maine? +%\end{qbitem} +%\begin{qbitem}{2} +% What is the capital of Nebraska? +%\end{qbitem} +%\end{questionbank} +%\end{verbatim} +% +% \DescribeEnv{questionbank} +% The \textsf{questionbank} environment randomly generates an integer between 1 +% and the number specified in the preceding command \cs{setnumberofquestions}. +% Each instance of the environment \textsf{qbitem}\marg{item number} compares +% \DescribeEnv{qbitem} +% its numerical argument \meta{item number} to this randomly generated number +% and executes the environment's body of content only if the numbers match. Then +% the \textsf{questionbank} environment ends input so that nothing in the file +% after that environment will be included. Note that neither environment +% includes within its body the \cs{question} command; that command is already +% part of the command \cs{questionfrombank} which inputs the file. Also note +% that \cs{questionfrombank} sets the counter prefix to include the file name +% and exam version number, so authors should use the prefix versions of counters +% commands (e.g. \cs{xprovidecounter}, \cs{xarabic}, etc.) within +% \textsf{qbitem} environments. (See the \textsf{counterz} documentation for +% details.) +% +% The \textsf{qbitem} environment allows for the inclusion of the various +% environments for parts and solutions that are provided by the \textsf{exam} +% class. Recall that each of the six solutions environments admits an argument +% to specify the amount of solution space. (The argument is optional for all +% except \textsf{solutionbox}. See the \textsf{exam} documentation for details.) +% The \textsf{examz} class offers a command \cs{setsolutionspace}\marg{length} +% \DescribeMacro{\setsolutionspace} and six analogous solutions environments +% that pass \meta{length} to their \textsf{exam} counterparts. For example, the +% \DescribeEnv{qbsolution} +% environment \textsf{qbsolution} is equivalent to the environment +% \textsf{solution}\oarg{length}. The advantage of this is that the command +% \cs{setsolutionspace}\marg{length} can be included once in the file, above the +% \textsf{questionbank} environment, for example, and any subsequent adjustment +% of the length can be done for all of the question bank items simultaneously +% with a single edit rather than a comprehensive search and replace. Five other +% environments \textsf{qbsolutionbox}, \textsf{qbsolutionorbox}, +% \DescribeEnv{qbsolutionbox} +% \textsf{qbsolutionorlines}, \textsf{qbsolutionordottedlines}, and finally +% \DescribeEnv{qbsolutionorbox} +% \textsf{qbsolutionorgrid} are similar analogues of the other \textsf{exam} +% class solutions environments. Just as their \textsf{exam} counterparts, these +% \DescribeEnv{qbsolutionorlines} +% environments can also be used within the \textsf{parts} environment. The +% \DescribeEnv{qbsolutionordottedlines} +% command \cs{setsolutionspace} may be used multiple times in the same file, +% \DescribeEnv{qbsolutionorgrid} +% including within the \textsf{questionbank} environment, if necessary. +% +%\subsection{Customization Macros} +% +% The \textsf{exam} document class provides the means for customizing headers, +% footers, special pages, etc. As an exam author makes changes to a document +% between exams, courses, or academic terms, the author may require frequent +% adjustment of certain standard content, such as the name of the exam or course +% in a custom header. The \textsf{examz} document class offers several macros to +% simplify such changes. For example, instead of explicitly including the text +% ``MATH 101'' in a header, an author can use the macro \cs{coursename} which +% can be set (and easily modified) at the beginning of the document. This is +% especially useful when designing for many similar courses a custom +% \textsf{.cls} file that loads the \textsf{examz} class and keeps the layout +% and customizations ``behind the scenes''. We first list and describe these +% macros and then provide an example of usage. +% +% \medskip +% \noindent +% \DescribeMacro{\instructorname} +% The default replacement text for \cs{instructorname} is ``Instructor Name''. +% +% \noindent +% \DescribeMacro{\setinstructorname} +% Use the command \cs{setinstructorname}\marg{text} to change this text. +% +% \medskip +% \noindent +% \DescribeMacro{\coursename} +% The default replacement text for \cs{coursename} is ``Course Name''. +% +% \noindent +% \DescribeMacro{\setcoursename} +% Use the command \cs{setcoursename}\marg{text} to change this text. +% +% \medskip +% \noindent +% \DescribeMacro{\examname} +% The default replacement text for \cs{examname} is ``Exam Name''. +% +% \noindent +% \DescribeMacro{\setexamname} +% Use the command \cs{setexamname}\marg{text} to change this text. +% +% \medskip +% \noindent +% \DescribeMacro{\termname} +% The default replacement text for \cs{termname} is ``Term Name''. +% +% \noindent +% \DescribeMacro{\settermname} +% Use the command \cs{settermname}\marg{text} to change this text. +% +% \medskip +% \noindent +% \DescribeMacro{\namespace} +% The default expansion of \cs{namespace} is +% ``Name:~\makebox[5cm]{\hrulefill}'' which is given by the code +% \texttt{Name:$\sim$\cs{makebox}[5cm]\{\cs{hrulefill}\}}. +% +% \noindent +% \DescribeMacro{\setnamespace} +% Use the command \cs{setnamespace}\marg{format} to change this format. +% +% \medskip +% \noindent +%\DescribeMacro{\instructions} +% The default replacement text for \cs{instructions} is ``Instructions Here''. +% +% \noindent +% \DescribeMacro{\setinstructions} +% Use the command \cs{setinstructions}\marg{text} to change this text, including +% one or more paragraphs as needed. +% +% \medskip +% \noindent +% \DescribeMacro{\covernoanswers} +% The command \cs{covernoanswers} can be used within the \textsf{coverpages} +% environment provided by the \textsf{exam} class or simply as the first page(s) +% of the exam. Its default expansion is empty. +% \DescribeMacro{\setcovernoanswers} +% Use the command \cs{setcovernoanswers}\marg{format} to change this format to +% include special headers and footers, instructions, grade/point tables, an +% instance of \cs{newpage}, etc. +% +% \medskip +% \noindent +% \DescribeMacro{\coveranswers} +% The command \cs{coveranswers} can be used within the \textsf{coverpages} +% environment provided by the \textsf{exam} class or simply as the first page(s) +% of the exam. Its default expansion is \cs{covernoanswers}. +% \DescribeMacro{\setcoveranswers} +% Use the command \cs{setcoveranswers}\marg{format} to change this format to +% include special headers and footers, instructions, grade/point tables, an +% instance of \cs{newpage}, etc. +% +% \medskip +% \noindent +% \DescribeMacro{\printcover}% +% The command \cs{printcover} executes either \cs{coveranswers} or +% \cs{covernoanswers}, depending on the value of the boolean +% \textsf{printanswers}. It can be used within the \textsf{coverpages} +% environment that is provided by the \textsf{exam} class or simply as the first +% page(s) of the exam. +% +% \medskip +% \noindent +%\DescribeMacro{\workspace} +% The command \cs{workspace} is intended to provide additional work space on the +% exam, perhaps at the end of the questions. Its default expansion is empty. Use +% the command \cs{setworkspace}\marg{format} to add a bit of text, \cs{newpage}, +% \DescribeMacro{\setworkspace} +% or a custom header/footer. To include the content of \cs{workspace} only when +% the boolean \textsf{printanswers} is FALSE, use the command +% \DescribeMacro{\printworkspace} +% \cs{printworkspace}. +% +% \medskip +% One method of streamlining the work of developing many exams that use the same +% layout and format is to write a simple \textsf{.cls} file to use as a custom +% instantiation of the \textsf{examz} document class, perhaps even including +% frequently used packages: +% +%\begin{verbatim} +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesClass{MYexamz} +%\DeclareOption*{\PassOptionsToClass{\CurrentOption}{examz}} +%\ProcessOptions\relax +%\LoadClass{examz} +%\RequirePackage{mathtools,amssymb} +%\pagestyle{headandfoot} +%\header{\coursename}{\examname}{termname} +%\setcovernoanswers{% +% \namespace +% +% \bigskip +% \instructions +% +% \bigskip +% \gradetable +% +% \firstpagefooter{Version \arabic{version}}{}{} +% \newpage +%}% +%\setworkspace{% +% \newpage +% \begin{center} Extra Work Space \end{center} +% \newpage +%}% +%\endinput +%\end{verbatim} +% +% \noindent +% Then use the custom document class \textsf{MYexamz} for the exam: +% +%\begin{verbatim} +%\documentclass[addpoints,prompt,complete]{MYexamz} +% +%\setcoursename{MATH 101} +%\setexamname{Test 1} +%\settermname{Spring 2023} +%\setinstructions{% +% Read each problem carefully. Show all work. +%}% +% +%\begin{document} +%\begin{versions} +% \printcover +% \setquestionpath{Problems/} +%\begin{questions} +% \questionfrombank{Solve_Linear_Equation} +% \questionfrombank{State_Capitals} +%\end{questions} +% \printworkspace +%\end{versions} +%\end{document} +%\end{verbatim} +% +% To write a new exam Test 2 in the same course, simply change the argument of +% \cs{setexamname} from \texttt{Test 1} to \texttt{Test 2} and use the +% appropriate question banks. With random counters and well-developed question +% banks, writing exams for the next term may be as simple as changing the +% term name. +% +%\StopEventually{^^A +% \PrintChanges +% \PrintIndex +%} +% +%\section{Implementation}\label{imp} +% +% The \textsf{examz} document class requires the packages \textsf{environ}, \textsf{xpatch}, and \textsf{counterz}, the last of which also loads the +% packages \textsf{etoolbox} and \textsf{makecmds}. +% +% \begin{macrocode} +\RequirePackage{environ} +\RequirePackage{xpatch} +\RequirePackage{counterz} +% \end{macrocode} +% +% This class inherits all of the options available to the \textsf{exam} class, +% including \textsf{answers}, \textsf{noanswers}, \textsf{cancelspace}, +% \textsf{nocancelspace}, and \textsf{addpoints}. The class also admits +% several additional options, the first of which is called \textsf{complete}. +% This option takes effect only when using the \textsf{versions} environment +% (see Section \ref{imp:versions}) and will otherwise be ignored. With this +% option selected, the document alternately prints each exam version with and +% without its solutions. The default value of the associated boolean variable +% is FALSE. Loading the option \textsf{complete} will change this value to TRUE. +% This option is intended to take the place of the options \textsf{answers} and +% \textsf{noanswers} and will override these two options if engaged. +% +% \begin{macrocode} +\newbool{@examz@complete} +\boolfalse{@examz@complete} +\DeclareOption{complete}{\booltrue{@examz@complete}} +% \end{macrocode} +% +% Additional options are based on features of the \textsf{counterz} package. The +% option \textsf{randomize} will cause the command \cs{randprovidecounter} (and +% its derivative commands) to generate new random values whereas the option +% \textsf{norandomize} will cause these commands to input their values from a +% file. Because this file may not exist before a first typesetting, the default +% option is \textsf{randomize}. +% +% \begin{macrocode} +\randomizectr +\DeclareOption{randomize}{\randomizectr} +\DeclareOption{norandomize}{\norandomizectr} +% \end{macrocode} +% +% +% Finally, the class may be loaded with an option called \textsf{prompt}. +% Because the manual change of the option \textsf{randomize} may be forgotten, +% resulting in the loss of counter values, the option \textsf{prompt} offers a +% terminal-based dialogue through which randomization can be decided. This +% action, which is executed at the beginning of the document (see below) is +% based on the command \cs{promptranomizectr} from the \textsf{counterz} +% package. +% +% \begin{macrocode} +\newbool{@examz@prompt} +\boolfalse{@examz@prompt} +\DeclareOption{prompt}{\booltrue{@examz@prompt}} +\newcommand{\promptrandomexam}{% + \promptrandomizectr[\EnterResponse]{% + ^^J Enter 1 to randomize document. + ^^J Enter 2 to update without new randomization. + }{% + 1% + }% +}% +% \end{macrocode} +% +% We now load the \textsf{exam} document class with all of these options. +% +% \begin{macrocode} +\DeclareOption*{% + \PassOptionsToClass{\CurrentOption}{exam} +}% +\ProcessOptions\relax +\LoadClass{exam} +% \end{macrocode} +% +% Next, we patch the \textsf{coverpages} environment. If the document is loaded +% with the option \textsf{twoside} (passed from the \textsf{article} class) and +% the \textsf{coverpages} environment produces an odd number of pages, then an +% extra blank page is inserted so that the odd arabic page numerals appear on +% the right page (i.e. front of the page). +% +% \begin{macrocode} +\xpatchcmd{\endcoverpages}{\setcounter{num@coverpages}{\value{page}}}{% + \ifbool{@twoside}{% + \ifnumodd{\value{page}}{% + % Do Nothing + }{% + \newpage + \null + \newpage + }% + }{% + % Do nothing + }% + \setcounter{num@coverpages}{\value{page}}% +}{}{}% +% \end{macrocode} +% If the class is loaded with the option \textsf{prompt} then we execute the +% command \cs{promptrandomexam}. If the user elects to not randomize the +% document, either by terminal input via \cs{promptrandomexam} or by instead +% loading the \textsf{norandomize} option, then we execute the command +% \cs{inputcountersfile}. (Note that this will produce an error if no counters +% file exists, so this option should not be used for a first typesetting.) If +% the user does elect to randomize the document, by terminal input or by loading +% the class with the option \textsf{randomize} or by loading the class with none +% of the options \textsf{randomize}, \textsf{norandomize}, or \textsf{prompt}, +% then we execute the command \cs{opencountersfile}. +% +% \begin{macrocode} +\AtBeginDocument{% + \ifbool{@examz@prompt}{% + \promptrandomexam + }{% + }% + \ifrandomizectr{% + \opencountersfile + }{% + \inputcountersfile + }% +}% +% \end{macrocode} +% +%\subsection{Randomized Exams}\label{imp:versions} +% +% The counter \textit{numversions} determines how many versions of the exam will +% be generated. The default value of \textit{numversions} is 1. +% +% \begin{macrocode} +\newcounter{numversions} +\setcounter{numversions}{1} +% \end{macrocode} +% +%\begin{macro}{\promptversions} +% +% The following command is used by the \textsf{versions} environment (described +% below) whenever the class is loaded with the \textsf{prompt} option. Note that +% the counter is saved to the counters file. (See the documentation for the +% \textsf{counterz} package.) +% +% \begin{macrocode} +\newcommand{\promptversions}{% + \typein[\NumberOfVersions]{% + ^^J How many versions? + }% + \setcounter{numversions}{\NumberOfVersions} + \savecounter{numversions} +}% +% \end{macrocode} +% +%\end{macro} +% +% The counter \textit{version} keeps track of the exam version when printing. +% The value of \textit{version} is initialized as 1. +% +% \begin{macrocode} +\newcounter{version} +\setcounter{version}{1} +% \end{macrocode} +% +% We now patch the parent class \textsf{exam} so that corresponding questions in +% different versions will not be assigned the same question label. To accomplish +% this, we append to the question labels the value of \textit{version}. We also +% append an \textit{S} if the boolean \textit{answers} (from the \textsf{exam} +% class) is TRUE, to distinguish between versions with and without solutions +% when the class is loaded with the option \textsf{complete}. +% +% \begin{macrocode} +\xpatchcmd{\find@latestques} + {@\arabic{question}} + {@\arabic{version}\ifbool{printanswers}{S}{}@\arabic{question}} + {}{} +\xpatchcmd{\decr@latest@ques} + {question@} + {question@\arabic{version}\ifbool{printanswers}{S}{}@} + {}{} +\xpatchcmd{\chk@incompi} + {question@} + {question@\arabic{version}\ifbool{printanswers}{S}{}@} + {}{} +\xpatchcmd{\questions} + {@\arabic{question}} + {@\arabic{version}\ifbool{printanswers}{S}{}@\arabic{question}} + {}{} +\xpatchcmd{\parts} + {@\arabic{question}} + {@\arabic{version}\ifbool{printanswers}{S}{}@\arabic{question}} + {}{} +\xpatchcmd{\subparts} + {@\arabic{question}} + {@\arabic{version}\ifbool{printanswers}{S}{}@\arabic{question}} + {}{} +\xpatchcmd{\subsubparts} + {@\arabic{question}} + {@\arabic{version}\ifbool{printanswers}{S}{}@\arabic{question}} + {}{} +\xpatchcmd{\setup@point@toks} + {@\arabic{question}} + {@\arabic{version}\ifbool{printanswers}{S}{}@\arabic{question}} + {}{} +\xpatchcmd{\refto@index} + {question@} + {question@\arabic{version}\ifbool{printanswers}{S}{}@} + {}{} +% \end{macrocode} +% +%\begin{macro}{\@examz@versions} +% +% The \textsf{versions} environment is defined via command \cs{@examz@versions}. +% The single argument of this command represents the user-provided exam content, +% including the \textsf{questions} environment and any pages before or after. If +% the class is loaded with the option \textsf{prompt} and the exam is randomized +% then the command first executes \cs{promptversions} to attain and save the +% value of the counter \textit{numversions}. The main action of the command is +% to use a while loop to generate versions of the exam, updating the version +% and page numbers along the way. When the class is loaded with the option +% \textsf{complete}, the document alternately prints without and with solutions, +% updating the version only after both printings. When the class is loaded with +% the option \textsf{twoside}, an extra blank page is inserted at the end of +% each version when necessary to ensure that the next version starts on a front +% page. +% +% \begin{macrocode} +\newcommand{\@examz@versions}[1]{% + \ifrandomizectr{% + \ifbool{@examz@prompt}{% + \promptversions + }{% + % Do Nothing + }% + }{% + % Do Nothing + }% + \ifbool{@examz@complete}{% + \noprintanswers + }{% + % Do Nothing + }% + \whileboolexpr{% + test{\ifnumless{\value{version}}{1+\value{numversions}}} + }{% + \ifbool{@twoside}{% + \ifnumodd{\value{page}}{% + % Do Nothing + }{% + \newpage + \null + \thispagestyle{empty} + \newpage + }% + }{% + % Do Nothing + }% + \setcounter{page}{1} + \setcounter{numquestions}{0} + \setcounter{numparts}{0} + \setcounter{numsubparts}{0} + \setcounter{numsubsubparts}{0} + \setcounter{numpoints}{0} + \setcounter{numbonuspoints}{0} + #1 + \newpage + \notbool{@examz@complete}{% + \addtocounter{version}{1} + }{% + \notbool{printanswers}{% + \printanswers + }{% + \noprintanswers + \addtocounter{version}{1} + }% + }% + }% +}% +% \end{macrocode} +% +%\end{macro} +% +%\begin{environment}{versions} +% +% The \textsf{versions} environment is now defined using the previous command +% and the command \cs{Collect@Body}. The environment has an optional argument +% with which the user may specify the number of versions. If the exam is not +% randomized then the argument is ignored under the assumption that the needed +% value has been inputted from the counters file after a previous randomization. +% (If there is never any randomization, then there is no need for different +% versions, and the environment will execute with the default number of versions +% being one.) If the class is loaded with the option \textsf{prompt}, then this +% optional argument will be overridden by the number provided by the user via +% terminal prompt. +% +% \begin{macrocode} +\newenvironment{versions}[1][1]{% + \ifrandomizectr{% + \setcounter{numversions}{#1} + \savecounter{numversions} + }{% + % Do Nothing + }% + \Collect@Body\@examz@versions +}{% + % Empty +}% +% \end{macrocode} +% +%\end{environment} +% +% The \textsf{exam} document class exam prints in the console and log file some +% data that includes the number of questions, total points, etc. Here we add to +% that data the number of versions of the exam and whether the solutions were +% printed. +% +% \begin{macrocode} +\AtEndDocument{% + \typeout{% + This document contains \thenumversions\space + version\ifnumequal{\value{numversions}}{1}{}{s} of the exam + \ifbool{@examz@complete}{% + with and without solutions. + }{% + \ifbool{printanswers}{% + with solutions. + }{% + without solutions. + }% + }% + }% +}% +% \end{macrocode} +% +%\subsection{Question Banks}\label{imp:banks} +% +%\begin{macro}{\@examz@questionpath} +%\begin{macro}{\setquestionpath} +% The default value of \cs{@examz@questionpath} is empty, but authors may use +% the command \cs{setquestionpath}\marg{pathname} to change this. +% +% \begin{macrocode} +\newcommand{\@examz@questionpath}{} +\newcommand{\setquestionpath}[1]{% + \renewcommand{\@examz@questionpath}{#1} +}% +% \end{macrocode} +% +%\end{macro} +%\end{macro} +% +%\begin{macro}{\questionfrombank} +% The command \cs{questionfrombank}\oarg{points}\marg{filename} uses the +% command \cs{question} from the \textsf{exam} class. The first (optional) +% argument is the point value of the question, and the second argument is the +% name of the question bank file (without the .tex extension). The input uses +% \cs{\@examz@questionpath}. In order to avoid a conflict between question banks +% that use the same counter names, \cs{counterprefix} is temporarily set to +% include both the name of the file and the number of the version. (See the +% \textsf{counterz} package for more information about \cs{setcounterprefix}.) +% +% \begin{macrocode} +\newcommand{\questionfrombank}[2][]{% + \question[#1] + \setcounterprefix{#2_Version_\arabic{version}_} + \input{\@examz@questionpath #2} + \clearcounterprefix +}% +% \end{macrocode} +% +%\end{macro} +% +%\begin{macro}{\setnumberofquestions} +% +% The counter \textit{@examz@qbsize} is an internal counter to represent the +% number of questions in a question bank. The command +% \cs{setnumberofquestions}\marg{number} is used to set this value. +% +% \begin{macrocode} +\newcounter{@examz@qbsize} +\newcommand{\setnumberofquestions}[1]{% + \setcounter{@examz@qbsize}{#1} +}% +% \end{macrocode} +% +%\end{macro} +% +%\begin{environment}{questionbank} +% +% The \textsf{questionbank} environment begins by creating a random counter that +% is used to determine which question will be selected and ends with the command +% \cs{endinput} so that nothing after the environment appears in the question. +% \begin{macrocode} +\newenvironment{questionbank}{% + \xrandprovidecounter{Random_Question}{1}{\value{@examz@qbsize}} +}{% + \endinput +} +% \end{macrocode} +% +%\end{environment} +% +%\begin{environment}{qbitem} +% +% The environment \textsf{qbitem} is a wrapper for each option in a +% \textsf{questionbank} environment. The argument is an integer value that is +% compared to the random counter value generated by \textsf{questionbank}. The +% body of the environment is the content of the question. Additional counters +% that are created and manipulated within \textsf{qbitem} should be handled by +% the commands provided in the \textsf{counterz} package in order to use the +% counter prefix that is created by the command \cs{questionfrombank}. +% +% \begin{macrocode} +\NewEnviron{qbitem}[1]{% + \ifnumequal{\xvalue{Random_Question}}{#1}{% + \BODY + }{% + } +} +% \end{macrocode} +% +%\end{environment} +% +%\begin{macro}{\setsolutionspace} +% +% The command \cs{@examz@solutionspace} represents the amount of space allotted +% to solutions, per the various solutions environments that are defined by the +% \textsf{exam} document class. \cs{setsolutionspace}\marg{length} is used to +% set this value. +% +% \begin{macrocode} +\newcommand{\@examz@solutionspace}{1cm} +\newcommand{\setsolutionspace}[1]{% + \renewcommand{\@examz@solutionspace}{#1} +}% +% \end{macrocode} +% +%\end{macro} +% +% \noindent +% For each of the six solutions environments provided by the \textsf{exam} class +% there is an analogous solutions environment that automatically loads the value +% of \cs{SolutionSpace} for the argument. +% +%\begin{environment}{qbsolution} +% +% \textsf{qbsolution} is equivalent to +% \textsf{solution}[\cs{@examz@solutionspace}]. +% +% \begin{macrocode} +\NewEnviron{qbsolution}{% + \begin{solution}[\@examz@solutionspace] + \BODY + \end{solution} +}% +% \end{macrocode} +% +%\end{environment} +% +%\begin{environment}{qbsolutionbox} +% +% \textsf{qbsolutionbox} is equivalent to +% \textsf{solutionbox}\{\cs{@examz@solutionspace}\}. +% +% \begin{macrocode} +\NewEnviron{qbsolutionbox}{% + \begin{solutionbox}{\@examz@solutionspace} + \BODY + \end{solutionbox} +}% +% \end{macrocode} +% +%\end{environment} +% +%\begin{environment}{qbsolutionorbox} +% +% \textsf{qbsolutionorbox} is equivalent to +% \textsf{solutionorbox}[\cs{@examz@solutionspace}]. +% +% \begin{macrocode} +\NewEnviron{qbsolutionorbox}{% + \begin{solutionorbox}[\@examz@solutionspace] + \BODY + \end{solutionorbox} +}% +% \end{macrocode} +% +%\end{environment} +% +%\begin{environment}{qbsolutionorlines} +% +% \textsf{qbsolutionorlines} is equivalent to +% \textsf{solutionorlines}[\cs{@examz@solutionspace}]. +% +% \begin{macrocode} +\NewEnviron{qbsolutionorlines}{% + \begin{solutionorlines}[\@examz@solutionspace] + \BODY + \end{solutionorlines} +}% +% \end{macrocode} +% +%\end{environment} +% +%\begin{environment}{qbsolutionordottedlines} +% +% \textsf{qbsolutionordottedlines} is equal to +% \textsf{solutionordottedlines}[\cs{@examz@solutionspace}]. +% +% \begin{macrocode} +\NewEnviron{qbsolutionordottedlines}{% + \begin{solutionordottedlines}[\@examz@solutionspace] + \BODY + \end{solutionordottedlines} +}% +% \end{macrocode} +% +%\end{environment} +% +%\begin{environment}{qbsolutionorgrid} +% +% \textsf{qbsolutionorgrid} is equivalent to +% \textsf{solutionorgrid}[\cs{@examz@solutionspace}]. +% +% \begin{macrocode} +\NewEnviron{qbsolutionorgrid}{% + \begin{solutionorgrid}[\@examz@solutionspace] + \BODY + \end{solutionorgrid} +}% +% \end{macrocode} +% +%\end{environment} +% +%\subsection{Customization Macros} +% +%\begin{macro}{\instructorname} +%\begin{macro}{\coursename} +%\begin{macro}{\examname} +%\begin{macro}{\termname} +%\begin{macro}{\namespace} +%\begin{macro}{\instructions} +%\begin{macro}{\covernoanswers} +%\begin{macro}{\coveranswers} +%\begin{macro}{\workspace} +% +% The following commands define macros, with default values, for use in +% formatting headers, footers, and special pages. \cs{covernoanswers} and +% \cs{workspace} are empty by default, and \cs{coveranswers} is equal to +% \cs{covernoanswers} by default. +% +% \begin{macrocode} +\newcommand{\instructorname}{Instructor Name} +\newcommand{\coursename}{Course Name} +\newcommand{\examname}{Exam Name} +\newcommand{\termname}{Term Name} +\newcommand{\namespace}{Name:~\makebox[5cm]{\hrulefill}} +\newcommand{\instructions}{Instructions Here} +\newcommand{\covernoanswers}{} +\newcommand{\coveranswers}{\covernoanswers} +\newcommand{\workspace}{} +% \end{macrocode} +% +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% +%\begin{macro}{\setinstructorname} +%\begin{macro}{\setcoursename} +%\begin{macro}{\setexamname} +%\begin{macro}{\settermname} +%\begin{macro}{\setnamespace} +%\begin{macro}{\setinstructions} +%\begin{macro}{\setcoveranswers} +%\begin{macro}{\setcovernoanswers} +%\begin{macro}{\setworkspace} +% +% The following commands allow a user to redefine the above macros. +% \begin{macrocode} +\newcommand{\setinstructorname}[1]{\renewcommand{\instructorname}{#1}} +\newcommand{\setcoursename}[1]{\renewcommand{\coursename}{#1}} +\newcommand{\setexamname}[1]{\renewcommand{\examname}{#1}} +\newcommand{\settermname}[1]{\renewcommand{\termname}{#1}} +\newcommand{\setnamespace}[1]{\renewcommand{\namespace}{#1}} +\newcommand{\setinstructions}[1]{\renewcommand{\instructions}{#1}} +\newcommand{\setcovernoanswers}[1]{\renewcommand{\covernoanswers}{#1}} +\newcommand{\setcoveranswers}[1]{\renewcommand{\coveranswers}{#1}} +\newcommand{\setworkspace}[1]{\renewcommand{\workspace}{#1}} +% \end{macrocode} +% +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% +%\begin{macro}{\printcover} +% +% The command \cs{printcover} executes either \cs{coveranswers} or +% \cs{covernoanswers}, depending on the value of the boolean +% \textsf{printanswers}. +% +% \begin{macrocode} +\newcommand{\printcover}{% + \ifbool{printanswers}{\coveranswers}{\covernoanswers} +}% +% \end{macrocode} +% +%\end{macro} +% +%\begin{macro}{\printworkspace} +% +% The command \cs{printcover} executes \cs{workspace} when the boolean +% \textsf{printanswers} is false and otherwise does nothing. +% +% \begin{macrocode} +\newcommand{\printworkspace}{% + \ifbool{printanswers}{}{\workspace} +}% +% \end{macrocode} +% +%\end{macro} +% +% \Finale +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/examz/examz.ins b/macros/latex/contrib/examz/examz.ins new file mode 100644 index 0000000000..4d52e93772 --- /dev/null +++ b/macros/latex/contrib/examz/examz.ins @@ -0,0 +1,59 @@ +%% +%% `examz' --- 2023/05/30 Version 1.0.0 +%% +%% Copyright (C) 2023 by Christopher McClain +%% E-mail: christopher.mcclain@mail.wvu.edu +%% +%% 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 +%% +%% and version 1.3c or later is part of all distributions of +%% LaTeX version 2008 or later. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/examz} + +\preamble + +This is a generated file. + +`examz' --- 2023/05/30 Version 1.0.0 + +Copyright (C) 2023 by Christopher McClain +E-mail: christopher.mcclain@mail.wvu.edu + +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 + +and version 1.3c or later is part of all distributions of +LaTeX version 2008 or later. + +\endpreamble + +\generate{\file{examz.cls}{\from{examz.dtx}{class}}} + +\Msg{*********************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the} +\Msg{* following file into a directory searched by TeX:} +\Msg{*} +\Msg{* \space\space examz.cls} +\Msg{*} +\Msg{* To produce the documentation run the file examz.dtx} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*********************************************************} + +\endbatchfile
\ No newline at end of file diff --git a/macros/latex/contrib/examz/examz.pdf b/macros/latex/contrib/examz/examz.pdf Binary files differnew file mode 100644 index 0000000000..357b153e4c --- /dev/null +++ b/macros/latex/contrib/examz/examz.pdf diff --git a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf Binary files differindex d4451abc83..5e9fff73df 100644 --- a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf +++ b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf diff --git a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex index 9f4bb4a337..e07a5b02c1 100644 --- a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex +++ b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex @@ -69,8 +69,8 @@ \setlength{\parindent}{0pt} \definecolor{LightGray}{gray}{0.9} -\def\TPversion{0.2.4} -\def\TPdate{18 Mars 2023} +\def\TPversion{0.2.5} +\def\TPdate{06 juin 2023} \usepackage[most]{tcolorbox} \usepackage[outputdir=build]{minted} @@ -209,6 +209,8 @@ Une commande pour des cartes en version \og miniatures \fg{} (individuelle, main \part{Historique} +{\small \bverb|v0.2.5|~:~~~~Compatibilité des \textit{Mini}-Cartes avec les cartes avec nom anglais. + {\small \bverb|v0.2.4|~:~~~~Ajout du style carte Poker \textsf{fr} + style Bicycle \textsf{bicycl} + ajout d'une clé \textsf{<StyleJeu>} {\small \bverb|v0.2.3|~:~~~~Ajout d'une clé \textsf{<inverse>} + dos Uno + style \textsf{v5} pour le Poker @@ -684,7 +686,7 @@ Ces \textit{mini-}cartes sont des figures \TikZ, alignées verticalement sur leu \begin{codetex}[] Si on met du texte sur la ligne du dessus, on peut voir le résultat.\\ Voilà des exemples de mini-cartes, \AffMiniCarteJeu{7.K}\AffMiniCarteJeu{1.AT}\AffMiniCarteJeu{V.K}\AffMiniCarteJeu{10.C}, intégrables dans un paragraphe.\\ -Si on met du texte sur la ligne du dessous, on peut voir le résultat. +Si on met du texte sur la ligne du dessous, on peut voir le résultat, avec ici des mini-cartes anglaises \AffMiniCarteJeu{K.T}\AffMiniCarteJeu{JO.R}\AffMiniCarteJeu{Q.C}\AffMiniCarteJeu{J.P}. \end{codetex} \subsection{Noms des \textit{mini-}cartes} @@ -693,11 +695,11 @@ Si on met du texte sur la ligne du dessous, on peut voir le résultat. Pour des raisons internes au code, les cartes doivent être saisies suivant la nomenclature (noter l'utilisation du \ctex{.} pour séparer la hauteur de la couleur !) : \begin{itemize} - \item \texttt{2.C}, \texttt{3.C}, \ldots, \texttt{C.C}, \texttt{D.C}, \texttt{R.C}, \texttt{A.C}\dotfill\Cle{Cœur} - \item \texttt{2.P}, \texttt{3.P}, \ldots, \texttt{C.P}, \texttt{D.P}, \texttt{R.P}, \texttt{A.P}\dotfill\Cle{Pique} - \item \texttt{2.K}, \texttt{3.K}, \ldots, \texttt{C.K}, \texttt{D.K}, \texttt{R.K}, \texttt{A.K}\dotfill\Cle{Carreau} - \item \texttt{2.T}, \texttt{3.T}, \ldots, \texttt{K.T}, \texttt{D.T}, \texttt{R.T}, \texttt{A.T}\dotfill\Cle{Trèfle} - \item \texttt{J.N}, \texttt{J.R}\dotfill\Cle{Joker} + \item \texttt{2.C}, \texttt{3.C}, \ldots, \texttt{C.C}, \texttt{D.C}, \texttt{R.C}, \texttt{A.C}, \texttt{J.C}, \texttt{Q.C}, \texttt{K.C}\dotfill\Cle{Cœur} + \item \texttt{2.P}, \texttt{3.P}, \ldots, \texttt{C.P}, \texttt{D.P}, \texttt{R.P}, \texttt{A.P}, \texttt{J.P}, \texttt{Q.P}, \texttt{K.P}\dotfill\Cle{Pique} + \item \texttt{2.K}, \texttt{3.K}, \ldots, \texttt{C.K}, \texttt{D.K}, \texttt{R.K}, \texttt{A.K}, \texttt{J.K}, \texttt{Q.K}, \texttt{K.K}\dotfill\Cle{Carreau} + \item \texttt{2.T}, \texttt{3.T}, \ldots, \texttt{K.T}, \texttt{D.T}, \texttt{R.T}, \texttt{A.T}, \texttt{J.T}, \texttt{Q.T}, \texttt{K.T}\dotfill\Cle{Trèfle} + \item \cmaj{0.2.5} \texttt{JO.N}, \texttt{JO.R}\dotfill\Cle{Joker} \item \texttt{Exc}, \texttt{1.AT}, \texttt{2.AT}, \ldots, \texttt{20.T}, \texttt{21.AT}\dotfill\Cle{Atouts} \end{itemize} @@ -721,6 +723,7 @@ Quelques \Cle{options} pour les \textit{mini-}cartes : \begin{codetex}[] \foreach \EECARTE in {2,3,4,5,6,7,8,9,10,V,C,D,R,A}{\AffMiniCarteJeu[Largeur=0.75cm]{\EECARTE.K}}\\ +\foreach \EECARTE in {2,3,4,5,6,7,8,9,10,J,Q,K,A}{\AffMiniCarteJeu[Largeur=0.75cm]{\EECARTE.P}}\\ \AffMiniCarteJeu[FondAtout=cyan,Largeur=0.75cm]{Exc}% \foreach \EECARTE in {1,2,...,21}{\AffMiniCarteJeu[FondAtout=cyan,Largeur=0.75cm]{\EECARTE.AT}} \end{codetex} @@ -738,24 +741,31 @@ Comme pour les cartes \textit{classiques}, il existe deux commandes pour des \te \end{codetex} \begin{codecles} -Les \Cle{Clés} sont les mêmes que pour la commande individuelle, avec en plus : - +Les \Cle{Clés} sont les mêmes que pour la commande individuelle, avec en plus la clé \Cle{TypeJeu} parmi : \begin{itemize} - \item la clé \Cle{TypeJeu} (parmi \Cle{Poker} ou \Cle{Tarot} ou \Cle{Belote} ou \Cle{Bataille} ou \Cle{Rami}). \hfill{}défaut \Cle{Poker} + \item \Cle{Poker} ou \Cle{Tarot} ou \Cle{Belote} ou \Cle{Bataille} ou \Cle{Rami} pour les cartes [fr] ; + \item \cmaj{0.2.5} \Cle{PokerEN} ou \Cle{BeloteEN} ou \Cle{BatailleEN} ou \Cle{RamiEN} pour les cartes [en] ; \end{itemize} +\hfill{}défaut \Cle{Poker} \end{codecles} \begin{codetex}[] \textbf{\large Saisie de mains : }\\ -\MainMiniCartesJeu{7.K § A.P § D.T § V.K § 10.C § C.T} et~ +\MainMiniCartesJeu{7.K § A.P § D.T § V.K § 10.C § C.T § JO.N} et~ \MainMiniCartesJeu{Exc § 1.AT § C.C § 8.T § 2.K § 5.AT § 2.AT § D.P § 7.T § 10.C § 19.AT § V.P}\\ \textbf{\large Poker : }\\ \MainMiniCartesJeuAleatoire{5} ou \MainMiniCartesJeuAleatoire{5} ou \MainMiniCartesJeuAleatoire{5} ou \MainMiniCartesJeuAleatoire{5}.\\ +\textbf{\large Poker [en] : }\\ +\MainMiniCartesJeuAleatoire[TypeJeu=PokerEN]{5} ou \MainMiniCartesJeuAleatoire[TypeJeu=PokerEN]{5} ou \MainMiniCartesJeuAleatoire[TypeJeu=PokerEN]{5} ou \MainMiniCartesJeuAleatoire[TypeJeu=PokerEN]{5}.\\ + \textbf{\large Belote :}\\ \MainMiniCartesJeuAleatoire[TypeJeu=Belote]{8} ou \MainMiniCartesJeuAleatoire[TypeJeu=Belote]{8} ou \MainMiniCartesJeuAleatoire[TypeJeu=Belote]{8}.\\ +\textbf{\large Belote [en] :}\\ +\MainMiniCartesJeuAleatoire[TypeJeu=BeloteEN]{8} ou \MainMiniCartesJeuAleatoire[TypeJeu=BeloteEN]{8} ou \MainMiniCartesJeuAleatoire[TypeJeu=BeloteEN]{8}.\\ + \textbf{\large Bataille : }\\ \MainMiniCartesJeuAleatoire[TypeJeu=Bataille]{12} ou \MainMiniCartesJeuAleatoire[TypeJeu=Bataille]{12}.\\ @@ -763,7 +773,12 @@ Les \Cle{Clés} sont les mêmes que pour la commande individuelle, avec en plus \MainMiniCartesJeuAleatoire[TypeJeu=Tarot]{10} ou \MainMiniCartesJeuAleatoire[TypeJeu=Tarot]{10}.\\ \textbf{\large Rami : }\\ -\MainMiniCartesJeuAleatoire[TypeJeu=Rami]{15} ou \MainMiniCartesJeuAleatoire[TypeJeu=Rami]{14}. +\MainMiniCartesJeuAleatoire[TypeJeu=Rami]{15} ou\\ +\MainMiniCartesJeuAleatoire[TypeJeu=Rami]{14}.\\ + +\textbf{\large Rami [en] : }\\ +\MainMiniCartesJeuAleatoire[TypeJeu=RamiEN]{15} ou\\ +\MainMiniCartesJeuAleatoire[TypeJeu=RamiEN]{14}. \end{codetex} \pagebreak @@ -925,15 +940,15 @@ Dos disponibles : \texttt{DosBleu} ou \texttt{DosRouge} \subsection{MiniCartes} -\xintFor #1 in {2,3,4,5,6,7,8,9,10,V,C,D,R,A}\do{\AffMiniCarteJeu{#1.P}} +\xintFor #1 in {2,3,4,5,6,7,8,9,10,V,C,D,R,A}\do{\AffMiniCarteJeu{#1.P}} et \xintFor #1 in {J,Q,K}\do{\AffMiniCarteJeu{#1.P}} -\xintFor #1 in {2,3,4,5,6,7,8,9,10,V,C,D,R,A}\do{\AffMiniCarteJeu{#1.C}} +\xintFor #1 in {2,3,4,5,6,7,8,9,10,V,C,D,R,A}\do{\AffMiniCarteJeu{#1.C}} et \xintFor #1 in {J,Q,K}\do{\AffMiniCarteJeu{#1.C}} -\xintFor #1 in {2,3,4,5,6,7,8,9,10,V,C,D,R,A}\do{\AffMiniCarteJeu{#1.K}} +\xintFor #1 in {2,3,4,5,6,7,8,9,10,V,C,D,R,A}\do{\AffMiniCarteJeu{#1.K}} et \xintFor #1 in {J,Q,K}\do{\AffMiniCarteJeu{#1.K}} -\xintFor #1 in {2,3,4,5,6,7,8,9,10,V,C,D,R,A}\do{\AffMiniCarteJeu{#1.T}} +\xintFor #1 in {2,3,4,5,6,7,8,9,10,V,C,D,R,A}\do{\AffMiniCarteJeu{#1.T}} et \xintFor #1 in {J,Q,K}\do{\AffMiniCarteJeu{#1.T}} -\AffMiniCarteJeu{J.N}\AffMiniCarteJeu{J.R} +\AffMiniCarteJeu{JO.N}\AffMiniCarteJeu{JO.R} \medskip diff --git a/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty b/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty index b0579a4086..ce50d3361f 100644 --- a/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty +++ b/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty @@ -11,8 +11,9 @@ % Uno v1 cards Image's Licence.: MIT License https://eperezcosano.github.io/uno-part1/ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{JeuxCartes}[2023/03/18 v0.2.4 Jeux de cartes] -% 0.2.4 Style <fr> avec carte française + <bicycl> + modification des clés avec l'ajout de <StyleJeu> + Suppression xcolor +\ProvidesPackage{JeuxCartes}[2023/06/06 v0.2.5 Jeux de cartes] +% 0.2.5 Correction d'un dysfonctionnement avec le J qui peut désormais être utilisé en MiniCarte avec le Joker [en] + MiniMains [en] +% 0.2.4 Style <fr> avec cartes françaises + <bicycl> + modification des clés avec l'ajout de <StyleJeu> + Suppression xcolor % 0.2.3 Ajout d'une option pour présenter une main "inversée" + style <v5> % 0.2.2 Correction de 2 cartes de pokerv4 % 0.2.2 Ajout d'un style <v4> pour le poker @@ -376,6 +377,10 @@ \end{tikzpicture}% } +%------commande pour remonter le Q ttfamily +\DeclareRobustCommand*{\RaiseBoxByDepth}{% + \raisebox{\depth}% +} %------commande mini-cartes \defKV[AffMiniCartes]{% Largeur=\def\MiniCarteLargeur{#1},% @@ -409,11 +414,13 @@ \IfStrEq{\csVal}{21}{\def\csVal{\scalebox{0.5}[1]{21}}}{}% %le cas de Excuse \IfStrEq{#2}{Exc}% - {\def\csSymb{\ding{168}}\def\csCoul{blue}% - \def\csVal{\scalebox{0.33}[1]{EXC}}}{}% + {\def\csSymb{\ding{168}}\def\csCoul{blue}\def\csVal{\scalebox{0.33}[1]{EXC}}}{}% %le cas du Joker - \IfStrEq{\csVal}{J}% + \IfStrEq{\csVal}{JO}% {\def\csSymb{\ding{166}}\def\csVal{\scalebox{0.5}[1]{JO}}}{}% + %le cas de la dame [en] Q + \IfStrEq{\csVal}{Q}% + {\def\csVal{\RaiseBoxByDepth{\scalebox{1}[0.8]{Q}}}}{}% %si c'est un coeur \IfStrEq{\csCplt}{C}% {\def\csSymb{\ding{170}}\def\csCoul{red}}{}% @@ -433,7 +440,7 @@ \IfStrEq{\csCplt}{R}% {\def\csCoul{red}}{}% %minicarte - \tikz[baseline=(char.base)]\node[anchor=north west,line width=0.7pt,draw=gray,rectangle,rounded corners,inner sep=1.6pt,fill=\csFond,text=\csCoul,font=\ttfamily,minimum width=\MiniCarteLargeur](char){\csVal\scalebox{0.75}[0.75]{\csSymb}};% + \tikz[baseline=(char.base)]\node[anchor=north west,line width=0.7pt,draw=gray,rectangle,rounded corners=3pt,inner sep=1.5pt,fill=\csFond,text=\csCoul,font=\ttfamily,minimum width=\MiniCarteLargeur](char){\vphantom{A}\csVal\scalebox{0.75}[0.75]{\csSymb}};% } %------commande mini-main-cartes @@ -470,10 +477,14 @@ } \xdef\MiniCartesJeuPoker{2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,V.P,D.P,R.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,V.T,D.T,R.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,V.C,D.C,R.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,V.K,D.K,R.K,A.K}% +\xdef\MiniCartesJeuPokerEN{2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,J.P,Q.P,K.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,J.T,Q.T,K.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,J.C,Q.C,K.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,J.K,Q.K,K.K,A.K}% \xdef\MiniCartesJeuBelote{7.P,8.P,9.P,10.P,V.P,D.P,R.P,A.P,7.T,8.T,9.T,10.T,V.T,D.T,R.T,A.T,7.C,8.C,9.C,10.C,V.C,D.C,R.C,A.C,7.K,8.K,9.K,10.K,V.K,D.K,R.K,A.K}% -\xdef\MiniCartesJeuBataille{2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,V.P,D.P,R.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,V.T,D.T,R.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,V.C,D.C,R.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,V.K,D.K,R.K,A.K,J.N,J.R}% +\xdef\MiniCartesJeuBeloteEN{7.P,8.P,9.P,10.P,J.P,Q.P,K.P,A.P,7.T,8.T,9.T,10.T,J.T,Q.T,K.T,A.T,7.C,8.C,9.C,10.C,J.C,Q.C,K.C,A.C,7.K,8.K,9.K,10.K,J.K,Q.K,K.K,A.K}% +\xdef\MiniCartesJeuBataille{2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,V.P,D.P,R.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,V.T,D.T,R.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,V.C,D.C,R.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,V.K,D.K,R.K,A.K,JO.N,JO.R}% +\xdef\MiniCartesJeuBatailleEN{2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,J.P,Q.P,K.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,J.T,Q.T,K.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,J.C,Q.C,K.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,J.K,Q.K,K.K,A.K,JO.N,JO.R}% \xdef\MiniCartesJeuTarot{2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,V.P,C.P,D.P,R.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,V.T,C.T,D.T,R.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,V.C,C.C,D.C,R.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,V.K,C.K,D.K,R.K,A.K,1.AT,2.AT,3.AT,4.AT,5.AT,6.AT,7.AT,8.AT,9.AT,10.AT,11.AT,12.AT,13.AT,14.AT,15.AT,16.AT,17.AT,18.AT,19.AT,20.AT,21.AT,Exc}% -\xdef\MiniCartesJeuRami{2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,V.P,D.P,R.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,V.T,D.T,R.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,V.C,D.C,R.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,V.K,D.K,R.K,A.K,J.N,J.R,2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,V.P,D.P,R.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,V.T,D.T,R.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,V.C,D.C,R.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,V.K,D.K,R.K,A.K,J.N,J.R}% +\xdef\MiniCartesJeuRami{2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,V.P,D.P,R.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,V.T,D.T,R.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,V.C,D.C,R.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,V.K,D.K,R.K,A.K,JO.N,JO.R,2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,V.P,D.P,R.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,V.T,D.T,R.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,V.C,D.C,R.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,V.K,D.K,R.K,A.K,JO.N,JO.R}% +\xdef\MiniCartesJeuRamiEN{2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,J.P,Q.P,K.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,J.T,Q.T,K.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,J.C,Q.C,K.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,J.K,Q.K,K.K,A.K,JO.N,JO.R,2.P,3.P,4.P,5.P,6.P,7.P,8.P,9.P,10.P,J.P,Q.P,K.P,A.P,2.T,3.T,4.T,5.T,6.T,7.T,8.T,9.T,10.T,J.T,Q.T,K.T,A.T,2.C,3.C,4.C,5.C,6.C,7.C,8.C,9.C,10.C,J.C,Q.C,K.C,A.C,2.K,3.K,4.K,5.K,6.K,7.K,8.K,9.K,10.K,J.K,Q.K,K.K,A.K,JO.N,JO.R}% \NewList{MiniCartesJeuMelange} \NewDocumentCommand\MainMiniCartesJeuAleatoire{ O{} m }{%1=options,2=nbcartes @@ -481,6 +492,7 @@ \setKV[MiniMainAleaCartes]{#1}% %melange du jeu \ClearList{MiniCartesJeuMelange}% + %Cartes [fr] \IfStrEq{\MiniMainAleaType}{Poker}%si c'est le poker {% \xintFor* ##1 in {\xintCSVtoList{\MiniCartesJeuPoker}}% @@ -511,6 +523,31 @@ \do{\InsertRandomItem{MiniCartesJeuMelange}{##1}}% }% {}% + %Cartes [en] + \IfStrEq{\MiniMainAleaType}{PokerEN}%si c'est le poker + {% + \xintFor* ##1 in {\xintCSVtoList{\MiniCartesJeuPokerEN}}% + \do{\InsertRandomItem{MiniCartesJeuMelange}{##1}}% + }% + {}% + \IfStrEq{\MiniMainAleaType}{BatailleEN}%si c'est la bataille + {% + \xintFor* ##1 in {\xintCSVtoList{\MiniCartesJeuBatailleEN}}% + \do{\InsertRandomItem{MiniCartesJeuMelange}{##1}}% + }% + {}% + \IfStrEq{\MiniMainAleaType}{BeloteEN}%si c'est le belote + {% + \xintFor* ##1 in {\xintCSVtoList{\MiniCartesJeuBeloteEN}}% + \do{\InsertRandomItem{MiniCartesJeuMelange}{##1}}% + }% + {}% + \IfStrEq{\MiniMainAleaType}{RamiEN}%si c'est le rami + {% + \xintFor* ##1 in {\xintCSVtoList{\MiniCartesJeuRamiEN}}% + \do{\InsertRandomItem{MiniCartesJeuMelange}{##1}}% + }% + {}% %création de la main \foreach \i in {1,2,...,#2}{% \GetItem{MiniCartesJeuMelange}{\inteval{\i-1}}{MiniCarteMainChoisie}% diff --git a/macros/latex/contrib/postit/README.md b/macros/latex/contrib/postit/README.md index 23ae2d9f15..8cdc5fec2f 100644 --- a/macros/latex/contrib/postit/README.md +++ b/macros/latex/contrib/postit/README.md @@ -1,7 +1,7 @@ -postit is a package to work with post-it. --------------------------------------------------- -positi est un package pour travailler des post-it. --------------------------------------------------- +postit is a package to work with post-it with [fr] or [en] syntax. +--------------------------------------------------------------------------------- +postit est un package pour travailler des post-it avec commandes en [fr] ou [en]. +--------------------------------------------------------------------------------- Author : Cédric Pierquet email : cpierquet@outlook.fr Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
\ No newline at end of file diff --git a/macros/latex/contrib/postit/doc/postit-doc-en.pdf b/macros/latex/contrib/postit/doc/postit-doc-en.pdf Binary files differnew file mode 100644 index 0000000000..808e152c71 --- /dev/null +++ b/macros/latex/contrib/postit/doc/postit-doc-en.pdf diff --git a/macros/latex/contrib/postit/doc/postit-doc-en.tex b/macros/latex/contrib/postit/doc/postit-doc-en.tex new file mode 100644 index 0000000000..933ecc8390 --- /dev/null +++ b/macros/latex/contrib/postit/doc/postit-doc-en.tex @@ -0,0 +1,629 @@ +% !TeX TXS-program:compile = txs:///arara +% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} +% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') + +\documentclass[english,a4paper,11pt]{article} +\usepackage[margin=2cm,includefoot]{geometry} +\def\TPversion{0.1.2} +\def\TPdate{06/06/2023} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{amsmath,amssymb} +\usepackage{postit} +\usepackage{awesomebox} +\usepackage{fontawesome5} +\usepackage{footnote} +\makesavenoteenv{tabular} +\usepackage{enumitem} +\usepackage{tabularray} +\usepackage{wrapstuff} +\usepackage{lipsum} +\usepackage{fancyvrb} +\usepackage{fancyhdr} +\fancyhf{} +\renewcommand{\headrulewidth}{0pt} +\lfoot{\sffamily\small [postit]} +\cfoot{\sffamily\small - \thepage{} -} +\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}} + +%\usepackage{hvlogos} +\usepackage{hologo} +\usepackage{xspace} +\providecommand\tikzlogo{Ti\textit{k}Z} +\providecommand\TeXLive{\TeX{}Live\xspace} +\providecommand\PSTricks{\textsf{PSTricks}\xspace} +\let\pstricks\PSTricks +\let\TikZ\tikzlogo +\newcommand\TableauDocumentation{% + \begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}} + {\LARGE \LaTeX} & & & & &\\ + & {\LARGE \hologo{pdfLaTeX}} & & & & \\ + & & {\LARGE \hologo{LuaLaTeX}} & & & \\ + & & & {\LARGE \TikZ} & & \\ + & & & & {\LARGE \TeXLive} & \\ + & & & & & {\LARGE \hologo{MiKTeX}} \\ + \end{tblr} +} + +\usepackage{hyperref} +\urlstyle{same} +\hypersetup{pdfborder=0 0 0} +\setlength{\parindent}{0pt} +\definecolor{LightGray}{gray}{0.9} + +\usepackage{babel} +%\AddThinSpaceBeforeFootnotes +%\FrenchFootnotes + +\usepackage{listings} + +\usepackage{newverbs} +\newverbcommand{\motcletex}{\color{cyan!75!black}}{} +\newverbcommand{\packagetex}{\color{violet!75!black}}{} + +\tcbuselibrary{listingsutf8} +\newtcblisting{DemoCode}[1][]{% + enhanced,width=0.95\linewidth,center,% + bicolor,size=title,% + colback=cyan!2!white,% + colbacklower=cyan!1!white,% + colframe=cyan!75!black,% + listing options={% + breaklines=true,% + breakatwhitespace=true,% + style=tcblatex,basicstyle=\small\ttfamily,% + tabsize=4,% + commentstyle={\itshape\color{gray}}, + keywordstyle={\color{blue}},% + classoffset=0,% + keywords={},% + alsoletter={-},% + keywordstyle={\color{blue}},% + classoffset=1,% + alsoletter={-},% + morekeywords={center,right,justify,left,\lipsum},% + keywordstyle={\color{violet}},% + classoffset=2,% + alsoletter={-},% + morekeywords={PostItNote,\MiniPostIt},% + keywordstyle={\color{green!50!black}},% + classoffset=3,% + morekeywords={Color,PinColor,Pin,Width,Hieght,Rotate,Shadow,Corner,PinShift,AlignH,AlignV,AlignPostIt,Border,ExtraRightMargin,Render,Title,FontTitle},% + keywordstyle={\color{orange}} + },% + #1 +} + +\tcbset{vignettes/.style={% + nobeforeafter,box align=base,boxsep=0pt,enhanced,sharp corners=all,rounded corners=southeast,% + boxrule=0.75pt,left=7pt,right=1pt,top=0pt,bottom=0.25pt,% + } +} + +\tcbset{vignetteMaJ/.style={% + fontupper={\vphantom{pf}\footnotesize\ttfamily}, + vignettes,colframe=purple!50!black,coltitle=white,colback=purple!10,% + overlay={\begin{tcbclipinterior}% + \fill[fill=purple!75]($(interior.south west)$) rectangle node[rotate=90]{\tiny \sffamily{\textcolor{black}{\scalebox{0.66}[0.66]{\textbf{MàJ}}}}} ($(interior.north west)+(5pt,0pt)$);% + \end{tcbclipinterior}} + } +} + +\newcommand\Cle[1]{{\small\sffamily\textlangle \textcolor{orange}{#1}\textrangle}} +\newcommand\cmaj[1]{\tcbox[vignetteMaJ]{#1}\xspace} + +\begin{document} + +\setlength{\aweboxleftmargin}{0.07\linewidth} +\setlength{\aweboxcontentwidth}{0.93\linewidth} +\setlength{\aweboxvskip}{8pt} + +\pagestyle{fancy} + +\thispagestyle{empty} + +\vspace{2cm} + +\begin{center} + \begin{minipage}{0.75\linewidth} + \begin{tcolorbox}[colframe=yellow,colback=yellow!15] + \begin{center} + \begin{tabular}{c} + {\Huge \texttt{postit} [en]}\\ + \\ + {\LARGE Small Post-It notes,} \\ + \\ + {\LARGE with \textsf{tcolorbox} or \textsf{Ti\textit{k}Z}.} \\ + \end{tabular} + + \bigskip + + {\small \texttt{Version \TPversion{} -- \TPdate}} + \end{center} + \end{tcolorbox} +\end{minipage} +\end{center} + +\begin{center} + \begin{tabular}{c} + \texttt{Cédric Pierquet}\\ + {\ttfamily c pierquet -- at -- outlook . fr}\\ + \texttt{\url{https://github.com/cpierquet/postit}} +\end{tabular} +\end{center} + +\vspace{0.25cm} + +{$\blacktriangleright$~~Display and customize Post-It or \textit{mini-}Post-It.} + +\vspace{0.25cm} + +{$\blacktriangleright$~~Custom width, height, rotation, decoration\ldots} + +\vspace{1cm} + +\begin{PostItNote}<center> + This is a small Post-It ! For example \[(a+b)^2=a^2+2ab+b^2.\] +\end{PostItNote} + +\begin{PostItNote}[Render=tikz,Width=8cm,Color=orange,Pin=Paperclip,PinColor=blue,Rotate=-5,AlignPostIt=center,Title={- With a title -},FontTitle={\color{blue!50!black}\bfseries\small\sffamily}] +\lipsum[1][1-4] +\end{PostItNote} +\hfill +\begin{PostItNote}[Height=6cm,AlignV=center,Color=pink,Pin=Scotch,Rotate=15,Corner,AlignPostIt=center,] +\lipsum[1][1-4] +\end{PostItNote} + +\vspace{0.5cm} + +%\hfill{}\textit{Merci à Denis Bitouzé et à Gilles Le Bourhis pour leurs retours et idées !} + +\smallskip + +\vfill + +\hrule + +\medskip + +\TableauDocumentation + +\medskip + +\hrule + +\medskip + +\newpage + +\phantomsection +\hypertarget{matoc}{} + +\tableofcontents + +\vfill + +\section{History} + +\verb|v0.1.2|~:~~~~English version. + +\verb|v0.1.1|~:~~~~\motcletex!\vphantom! for \textit{mini-}Post-It + Bugfixes + \TikZ{} rendering + optional title . + +\verb|v0.1.0|~:~~~~Initial version. + +\newpage + +\section{The package postit} + +\subsection{Introduction} + +\begin{noteblock} +The package proposes small Post-It notes, in a \textsf{tex} doc, created with \packagetex!tcolorbox! or \packagetex!tikz!, with option(s) in order to : + +\begin{itemize} + \item change dimensions orcolor ; + \item use pin deocration like Paperclip, Pushpin or Scotch ; + \item customize border and/or corner. +\end{itemize} + +The package propose a command to display \textit{mini-}Post-It (created with \motcletex!tcbox!), with color and shadow customization. +\end{noteblock} + +\subsection{Loading of the package, and option} + +\begin{importantblock} +The package Scrabble loads within the preamble. + +There's no option, and \packagetex!xcolor! isn't loaded. +\end{importantblock} + +\begin{DemoCode}[listing only] +\documentclass{article} +\usepackage{postit} + +\end{DemoCode} + +\begin{noteblock} +\packagetex!postit! loads the following packages and libraries : + +\begin{itemize} + \item \packagetex!tcolorbox! with library \packagetex!tcbox.skins! ; + \item \packagetex!tikz! libraries : + \begin{itemize} + \item \packagetex!tikz.calc! ; + \item \packagetex!tikz.decorations! ; + \item \packagetex!tikz.decorations.pathmorphing! ; + \end{itemize} + \item \packagetex!settobox!, \packagetex!xstring! and \packagetex!simplekv!. +\end{itemize} + +It’s mostly compatible with \textsf{latex}, \textsf{pdflatex}, \textsf{lualatex} or \textsf{xelatex} compilation ! +\end{noteblock} + +\subsection{Compatibility} + +\begin{cautionblock} +If an other package loads \packagetex!tcolorbox!, with \Cle{[most]} option, it's better to load \packagetex!postit! after, to avoid \motcletex!option clash error...!. +\end{cautionblock} + +\begin{DemoCode}[listing only] +\documentclass{article} +\usepackage[<librairies>]{tcolorbox} +\usepackage{postit} +... + +\end{DemoCode} + +\vfill~ + +\pagebreak + +\section{Post-It Environment} + +\subsection{Environment} + +\begin{cautionblock} +The environment to display a Post-It note is \packagetex!PostItNote!. + +It works with keys, between \texttt{[...]} and, with \texttt{<...>}, it's possible to parse options to the \motcletex!tcbox! (not necessary with \motcletex!tikz!) ! +\end{cautionblock} + +\begin{DemoCode}[listing only] +\begin{PostIt}[keys]<options tcbox> +... +... +\end{PostIt} +\end{DemoCode} + +\begin{noteblock} +As mentionned in the introduction, the Post-It note is create with a \motcletex!tcbox! or a \motcletex!tikzpicture!. + +Most of the \motcletex!tcbox!/\motcletex!tikzpicture! parameters are fixed by the code, but some of them are configurable ! +\end{noteblock} + +\begin{DemoCode}[] +%default rendering (tcbox), with lipsum paragraph +\begin{PostItNote} +\lipsum[1][1-2] +\end{PostItNote} +\end{DemoCode} + +\begin{DemoCode}[] +%tikz rendering, with lipsum paragraph +\begin{PostItNote}[Render=tikz] +\lipsum[1][1-2] +\end{PostItNote} +%tikzv2 rendering, with lipsum paragraph +\begin{PostItNote}[Render=tikzv2] +\lipsum[1][1-2] +\end{PostItNote} +\end{DemoCode} + +\begin{tipblock} +The colors must be used as \textit{single}, without \textit{mixes} (with \motcletex|CouleurA!...!CouleurB|) proposed by \packagetex!xcolor!. + + +However, every predefined color can be used within the Post-It. +\end{tipblock} + +\begin{tipblock} +The Post-It can be used with a \motcletex!minipage! or a \motcletex!wrapstuff! if needed. + +For horizontal alignement, \motcletex!\hfill! or \motcletex!flush...! can be used. +\end{tipblock} + +\begin{warningblock} +With a overlapping pin and the \textsf{tcbox} rendering, a vertical spacing before can be necessary, like \motcletex!\vspace! or \motcletex!\bigskip!\ldots +\end{warningblock} + +\subsection{Clés et options} + +\begin{tipblock} +The first argument, mandatory and between \texttt{[...]}, proposes the following \Cle{keys} : + +\begin{itemize} + \item \Cle{Width} : width (in cm) of the Post-It ; \hfill{}default : \Cle{6cm} + \item \Cle{Color} : color of the Post-It (border is a bit darker) ; \hfill{}default : \Cle{yellow} + \item \Cle{Height} : hieght (in cm, if needed) of the Post-It (\textit{automatic} by default) ; + + \hfill{}default : \Cle{auto} + \item \cmaj{0.1.1} \Cle{Render} : engine, within \Cle{tcbox / tikz / tikv2} ; \hfill{}default : \Cle{tcbox} + \item \Cle{Rotation} : rotation of the Post-It ; \hfill{}default : \Cle{0} + \item \Cle{Shadow} : boolean for shadow ; \hfill{}default : \Cle{true} + \item \Cle{Border} : boolean for a thin border ; \hfill{}default : \Cle{true} + \item \Cle{Corner} : boolean to the corner decoration (\motcletex!tcbox!) ; \hfill{}default : \Cle{false} + \item \Cle{Pin} : decoration, within \Cle{Paperclip / Pushpin / None / Scotch} ; + + \hfill{}default : \Cle{Pushpin} + \item \Cle{PinColor} : color of the pin ; \hfill{}default : \Cle{red} + \item \Cle{PinsShift} : horizontal shift (without unity, but in cm) of the orginal position of the pin \hfill{}default : \Cle{0} + \item \cmaj{0.1.1} \Cle{Title} : add a title (1st line and/or under the pin) ; \hfill{}default : \Cle{empty} + \item \cmaj{0.1.1} \Cle{Fonttitle} : font of the titel ; \hfill{}default : \Cle{\textbackslash normalfont\textbackslash normalfont} + \item \cmaj{0.1.1} \Cle{ExtraRightMargin} : add (with \packagetex!tikz! rendering, and in cm) à right margin ; + + \hfill{}default : \Cle{0cm} + \item \Cle{AlignV} : vertical alignement in the Post-It (within \Cle{top/center/bottom}) ; + + \hfill{}default : \Cle{top} + \item \Cle{AlignH} : horizontal alignment in the Post-It (within \Cle{left/center/right/justify}) ; + + \hfill{}default : \Cle{justify} + \item \Cle{AlignPostIt} : vertical alignemnt of the Post-It (within \Cle{top/center/bottom}). + + \hfill{}default : \Cle{bottom} +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{tipblock} +The second argument, optional and between \texttt{<...>} is used to parse options to the \motcletex!tcolorbox!. + +They can be used to modify locally options not present in the keys. +\end{tipblock} + +\begin{DemoCode}[] +\begin{PostItNote}%tcbox rendering + [Color=cyan,Pin=Paperclip,Width=10cm,Rotate=10]<center,right=1.5cm> +\lipsum[1][1-3] +\end{PostItNote} +\end{DemoCode} + +\begin{DemoCode}[] +\hfill\begin{PostItNote}%tikz rendering + [Render=tikz,Color=violet,Width=9cm,Rotate=-10,Pin=Paperclip, + PinColor=black,ExtraRightMargin=1cm,Title={Small title}, + FontTitle={\color{white}\bfseries\small\sffamily}] +\lipsum[1][1-3] +\end{PostItNote}\hfill~ +\end{DemoCode} + +\begin{DemoCode}[] +\hfill\begin{PostItNote}%tikzv2 rendering + [Render=tikzv2,Color=orange,Width=9cm,rotate=-10,Pin=Scotch, Title={Try}, + FontTitle={\color{blue!50!black}\bfseries\itshape\small\ttfamily}] +\lipsum[1][1-3] +\end{PostItNote}\hfill~ +\end{DemoCode} + +\pagebreak + +\subsection{Examples} + +\begin{DemoCode}[] +%usepackage{wrapstuff} +\begin{wrapstuff}[r,top=1] +\begin{PostItNote}[Rotate=5,Corner,Color=pink,PinkColor=blue,Border=false] +\lipsum[1][1-2] +\end{PostItNote} +\end{wrapstuff} + +\lipsum[1] +\end{DemoCode} + +\begin{DemoCode}[] +%usepackage{wrapstuff} +\begin{wrapstuff}[r,top=1] +\begin{PostItNote}[Rotate=5,Render=tikz,Color=pink, PinkColor=blue,Border=false] +\lipsum[1][1-2] +\end{PostItNote} +\end{wrapstuff} + +\lipsum[1] +\end{DemoCode} + +\begin{DemoCode}[] +%usepackage{wrapstuff} +\begin{wrapstuff}[r,top=1] +\begin{PostItNote}[Rotate=5,Render=tikzv2,Pin=Scotch,Color=pink] +\lipsum[1][1-2] +\end{PostItNote} +\end{wrapstuff} + +\lipsum[1] +\end{DemoCode} + +\begin{DemoCode}[] +A small Post-It, and vertically aligned : +% +\hfill\begin{PostItNote}[Rotate=-10,Color=orange,Width=5cm,Height=5cm, AlignV=center,Corner,PinColor=yellow, PinShift=-1,AlignPostIt=center] + +\textsf{\small\lipsum[1][1-2]} +\[\mathsf{\displaystyle\sum_{k=1}^{n} k = \dfrac{n(n+1)}{2}}\] +\end{PostItNote} +\end{DemoCode} + +\pagebreak + +\section{Simple inline Post-It Note} + +\subsection{Command} + +\begin{cautionblock} +The inline \textit{mini-}Post-It note is \motcletex!MiniPostIt!. + +The only optional paramater for the \motcletex!tcbox! Post-It is the color + +\smallskip + +Dimensions can't be changed, a \motcletex!\vphantom! is insered at beginning to prevent different heights. +\end{cautionblock} + +\begin{DemoCode}[listing only] +\MiniPostIt(*)[color]{text} +\end{DemoCode} + +\subsection{Arguments} + +\begin{noteblock} +The starred version show the shadow og the \textit{mini-}Post-It. + +The color (\Cle{yellow}), is the only optional argument, between \texttt{[...]}. +\end{noteblock} + +\subsection{Examples} + +\begin{DemoCode}[] +To solve Diophantine equations, we can use \MiniPostIt*[orange]{Bezout's thorem}, and \MiniPostIt{Gauss' theorem}, with the \MiniPostIt*[cyan]{reciprocal}. + +It's classic and good to know ! +\end{DemoCode} + +\pagebreak + +\section{Gallery of styles} + +\subsection{Render by tcbox} + +\begin{DemoCode}[text only] +\hfill\begin{PostItNote} +\texttt{Shadow/PushPin/Border} +\end{PostItNote} +\begin{PostIt}[Shadow=false] +\texttt{Pin/Border} +\end{PostIt}\hfill~ + +\medskip + +\hfill\begin{PostItNote}[Border=false] +\texttt{Shadow/Pushpin} +\end{PostItNote} +\begin{PostItNote}[Border=false,Shadow=false] +\texttt{Pushpin} +\end{PostItNote}\hfill~ + +\medskip + +\hfill\begin{PostItNote}[Pin=Paperclip] +\texttt{Shadow/Paperclip/Border}\\ +~ +\end{PostItNote} +\begin{PostItNote}[Pin=Scotch] +\texttt{Shadow/Scotch/Border}\\ +~ +\end{PostItNote}\hfill~ + +\medskip + +\hfill\begin{PostItNote}[Pin=None] +\texttt{Shadow/Border} +\end{PostItNote} +\begin{PostItNote}[Corner,Pin=None] +\texttt{Shadow/Border/Corner} +\end{PostItNote}\hfill~ + +\vspace{1cm} + +\hfill\begin{PostItNote}[Title={Lipsum[1][1-4]},FontTitle={\large\sffamily},Rotate=5,Color=pink,Height=6cm,Pin=Scotch,AlignV=center,Corner] +\lipsum[1][1-4] +\end{PostItNote}\hfill~ +\end{DemoCode} + +\pagebreak + +\subsection{Render by tikz} + +\begin{DemoCode}[text only] +\hfill\begin{PostItNote}[Render=tikz] +\texttt{Shadow/Pushpin/Border} +\end{PostItNote} +\begin{PostItNote}[Shadow=false,Render=tikz] +\texttt{Pushpin/Border} +\end{PostItNote}\hfill~ + +\medskip + +\hfill\begin{PostItNote}[Border=false,Render=tikz] +\texttt{Shadow/Pushpin} +\end{PostItNote} +\begin{PostItNote}[Border=false,Shadow=false,Render=tikz] +\texttt{Pushpin} +\end{PostItNote}\hfill~ + +\medskip + +\hfill\begin{PostItNote}[Pin=Paperclip,Render=tikz] +\texttt{Shadow/Paperclip/Border}\\ +~ +\end{PostItNote} +\begin{PostItNote}[Pin=Scotch,Render=tikz] +\texttt{Shadow/Scotch/Border}\\ +~ +\end{PostItNote}\hfill~ + +\medskip + +\hfill\begin{PostItNote}[Pin=None,Render=tikz] +\texttt{Shadow/Border} +\end{PostItNote}\hfill~ + +\vspace{1cm} + +\hfill\begin{PostItNote}[Render=tikz,Title={Lipsum[1][1-4]},FontTitle={\large\sffamily},Rotate=5,Color=pink,Height=6cm,Pin=Scotch,AlignV=center,Corner] +\lipsum[1][1-4] +\end{PostItNote}\hfill~ +\end{DemoCode} + +\subsection{Render by tikzv2} + +\begin{DemoCode}[text only] +\hfill\begin{PostItNote}[Render=tikzv2] +\texttt{Shadow/Pushpin/Border} +\end{PostItNote} +\begin{PostItNote}[Shadow=false,Render=tikzv2] +\texttt{Pushpin/Border} +\end{PostItNote}\hfill~ + +\medskip + +\hfill\begin{PostItNote}[Border=false,Render=tikzv2] +\texttt{Shadow/Pushpin} +\end{PostItNote} +\begin{PostItNote}[Border=false,Shadow=false,Render=tikzv2] +\texttt{Pushpin} +\end{PostItNote}\hfill~ + +\medskip + +\hfill\begin{PostItNote}[Pin=Paperclip,Render=tikzv2] +\texttt{Shadow/Paperclip/Border}\\ +~ +\end{PostItNote} +\begin{PostItNote}[Pin=Scotch,Render=tikzv2] +\texttt{Shadow/Scotch/Border}\\ +~ +\end{PostItNote}\hfill~ + +\medskip + +\hfill\begin{PostItNote}[Pin=None,Render=tikzv2] +\texttt{Shadow/Border} +\end{PostItNote}\hfill~ + +\vspace{1cm} + +\hfill\begin{PostItNote}[Render=tikzv2,Title={Lipsum[1][1-4]},FontTitle={\large\sffamily},Rotate=5,Color=pink,Height=6cm,Pin=Scotch,AlignV=center,Corner] +\lipsum[1][1-4] +\end{PostItNote}\hfill~ +\end{DemoCode} + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/postit/doc/postit-doc.pdf b/macros/latex/contrib/postit/doc/postit-doc-fr.pdf Binary files differindex 369fc1219d..cd0466ba1f 100644 --- a/macros/latex/contrib/postit/doc/postit-doc.pdf +++ b/macros/latex/contrib/postit/doc/postit-doc-fr.pdf diff --git a/macros/latex/contrib/postit/doc/postit-doc.tex b/macros/latex/contrib/postit/doc/postit-doc-fr.tex index f9ee072286..9cc78fa4ba 100644 --- a/macros/latex/contrib/postit/doc/postit-doc.tex +++ b/macros/latex/contrib/postit/doc/postit-doc-fr.tex @@ -4,8 +4,8 @@ \documentclass[french,a4paper,11pt]{article} \usepackage[margin=2cm,includefoot]{geometry} -\def\TPversion{0.1.1} -\def\TPdate{5 juin 2023} +\def\TPversion{0.1.2} +\def\TPdate{6 juin 2023} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{amsmath,amssymb} @@ -128,7 +128,7 @@ \begin{tcolorbox}[colframe=yellow,colback=yellow!15] \begin{center} \begin{tabular}{c} - {\Huge \texttt{postit}}\\ + {\Huge \texttt{postit} [fr]}\\ \\ {\LARGE Des petits Post-It,} \\ \\ @@ -169,7 +169,7 @@ \lipsum[1][1-4] \end{PostIt} \hfill -\begin{PostIt}[Hauteur=6cm,AlignementV=center,Couleur=pink,Attache=Non,CouleurAttache=blue,Inclinaison=15,Coin,AlignementPostIt=center,Attache=Scotch] +\begin{PostIt}[Hauteur=6cm,AlignementV=center,Couleur=pink,CouleurAttache=blue,Inclinaison=15,Coin,AlignementPostIt=center,Attache=Scotch] \lipsum[1][1-4] \end{PostIt} @@ -204,6 +204,8 @@ \section{Historique} +\verb|v0.1.2|~:~~~~Ajout des clés en langue anglaise. + \verb|v0.1.1|~:~~~~Ajout d'un \motcletex!\vphantom! pour les \textit{mini-}Post-It (hauteur \textit{uniforme}) + Correction de bugs. \verb| |~:~~~~Moteurs de rendu alternatif en \TikZ{} + Ajout d'un titre éventuel . @@ -350,7 +352,7 @@ Le premier argument, optionnel et entre \texttt{[...]}, propose les \Cle{clés} \item \Cle{Ombre} : booléen pour afficher une ombre portée ; \hfill{}défaut : \Cle{true} \item \Cle{Bordure} : booléen pour afficher une fine bordure ; \hfill{}défaut : \Cle{true} \item \Cle{Coin} : booléen pour afficher un coin corné ; \hfill{}défaut : \Cle{false} - \item \Cle{Attache} : choix de la décoration, parmi \Cle{Trombone / Punaise / Non} ; + \item \cmaj{0.1.1} \Cle{Attache} : choix de la décoration, parmi \Cle{Trombone / Punaise / Non / Scotch} ; \hfill{}défaut : \Cle{Punaise} \item \Cle{CouleurAttache} : couleur de l'attache ; \hfill{}défaut : \Cle{red} @@ -471,7 +473,7 @@ Un petit Post-It aligné à droite, et centré verticalement : \subsection{Commande et fonctionnement global} \begin{cautionblock} -La commande dédiée à la création du \textit{mini-}Post-It est \texttt{MiniPostIt}. +La commande dédiée à la création du \textit{mini-}Post-It est \motcletex!MiniPostIt!. Elle fonctionne sous forme autonome, avec uniquement la couleur en \Cle{option}. diff --git a/macros/latex/contrib/postit/tex/postit.sty b/macros/latex/contrib/postit/tex/postit.sty index 13dbd10ace..eb52909d99 100644 --- a/macros/latex/contrib/postit/tex/postit.sty +++ b/macros/latex/contrib/postit/tex/postit.sty @@ -3,7 +3,8 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{postit}[2023/06/05 0.1.1 Utiliser des post-it] +\ProvidesPackage{postit}[2023/06/06 0.1.2 Display sticky notes in a doc] +%0.1.2 English version (keys & command) %0.1.1 Ajout d'un \vphantom pour les mini-post-it + moteur de rendu tikz en supplément %0.1.0 Version initiale @@ -30,6 +31,45 @@ \def\HauteurScotch{1} \def\PostItBorder{0.1mm} +%======Décorations +%------Gestion du coin +\NewDocumentCommand\CoinPostIt{ }{% + \path[line width=\PostItBorder,fill=\PostItCoul!66] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2); + \path[line width=\PostItBorder,draw=\PostItCoul!50!black,shorten <=-0.05mm,shorten >=-0.05mm,color=\PostItCoul!50!black] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2); +} + +%------Gestion du trombone +\NewDocumentCommand\TrombonePostIt{ }{% + \begin{scope}[shift={([xshift={-1cm+\PostItDeclClip cm}]frame.north east)},rotate=-15,scale={\PostItCoulScaleClip*0.55},line cap=round] + \draw[line width=0.81mm,draw=\PostItCoulClip!66] (0,0) --++ (0,0.0) arc (180:0:3.5mm) --++ (0,-1.75) arc (0:-180:3mm) --++ (0,1.25) ; + \draw[line width=0.27mm,draw=\PostItCoulClip!33] (0,0) --++ (0,0.0) arc (180:0:3.5mm) --++ (0,-1.75) arc (0:-180:3mm) --++ (0,1.25) ; + \end{scope} +} + +%------Gestion du scotch +\NewDocumentCommand\ScotchPostIt{ }{% + \begin{scope}[shift={([xshift=\PostItDeclClip cm]frame.north)},scale={\PostItCoulScaleClip*0.65},line cap=round,rotate=3] + \draw[thin,gray!50,fill=lightgray,fill opacity=0.75] ({-0.5*\LargeurStotch},{-0.5*\HauteurScotch}) to ({0.5*\LargeurStotch},{-0.5*\HauteurScotch}) decorate [decoration={zigzag,segment length=2pt,amplitude=0.5pt}] {to ({0.5*\LargeurStotch},{0.5*\HauteurScotch})} to ({-0.5*\LargeurStotch},{0.5*\HauteurScotch}) decorate [decoration={zigzag,segment length=2pt,amplitude=0.5pt}] {to cycle} ; + \end{scope} +} + +%------Gestion de la punaise +\NewDocumentCommand\EpinglePostIt{ }{% + \begin{scope}[shift={([xshift=\PostItDeclClip cm,yshift=-0.5cm]frame.north)},scale={\PostItCoulScaleClip*0.55},rotate=-40] + \begin{scope}[rotate=-35] + \draw[blue!10!gray,line cap=round,line width=2pt] (0,0) -- ++(90:0.85); + \fill[blue!10!gray,scale=0.5] (90:0.85) ellipse (.65cm and .3cm) ; + \fill[blue!10!gray,scale=0.5] (90:0.85) ++(0,0.4) ellipse (.2 and .4); + \fill[blue!10!gray,scale=0.5] (90:0.85) ++(0,0.8) ellipse (.4 and .3); + \end{scope} + \draw[line cap=round,line width=2pt] (0,0) -- ++(90:0.85); + \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ellipse (.65cm and .3cm) ; + \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ++(0,0.4) ellipse (.2 and .4); + \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ++(0,0.8) ellipse (.4 and .3); + \end{scope} +} + +%======[FR] %------Clés \defKV[postit]{% Largeur=\def\PostItLarg{#1},% @@ -81,43 +121,6 @@ }% } -%------Gestion du coin -\NewDocumentCommand\CoinPostIt{ }{% - \path[line width=\PostItBorder,fill=\PostItCoul!66] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2); - \path[line width=\PostItBorder,draw=\PostItCoul!50!black,shorten <=-0.05mm,shorten >=-0.05mm,color=\PostItCoul!50!black] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2); -} - -%------Gestion du trombone -\NewDocumentCommand\TrombonePostIt{ }{% - \begin{scope}[shift={([xshift={-1cm+\PostItDeclClip cm}]frame.north east)},rotate=-15,scale={\PostItCoulScaleClip*0.55},line cap=round] - \draw[line width=0.81mm,draw=\PostItCoulClip!66] (0,0) --++ (0,0.0) arc (180:0:3.5mm) --++ (0,-1.75) arc (0:-180:3mm) --++ (0,1.25) ; - \draw[line width=0.27mm,draw=\PostItCoulClip!33] (0,0) --++ (0,0.0) arc (180:0:3.5mm) --++ (0,-1.75) arc (0:-180:3mm) --++ (0,1.25) ; - \end{scope} -} - -%------Gestion du scotch -\NewDocumentCommand\ScotchPostIt{ }{% - \begin{scope}[shift={([xshift=\PostItDeclClip cm]frame.north)},scale={\PostItCoulScaleClip*0.65},line cap=round,rotate=3] - \draw[thin,gray!50,fill=lightgray,fill opacity=0.75] ({-0.5*\LargeurStotch},{-0.5*\HauteurScotch}) to ({0.5*\LargeurStotch},{-0.5*\HauteurScotch}) decorate [decoration={zigzag,segment length=2pt,amplitude=0.5pt}] {to ({0.5*\LargeurStotch},{0.5*\HauteurScotch})} to ({-0.5*\LargeurStotch},{0.5*\HauteurScotch}) decorate [decoration={zigzag,segment length=2pt,amplitude=0.5pt}] {to cycle} ; - \end{scope} -} - -%------Gestion de la punaise -\NewDocumentCommand\EpinglePostIt{ }{% - \begin{scope}[shift={([xshift=\PostItDeclClip cm,yshift=-0.5cm]frame.north)},scale={\PostItCoulScaleClip*0.55},rotate=-40] - \begin{scope}[rotate=-35] - \draw[blue!10!gray,line cap=round,line width=2pt] (0,0) -- ++(90:0.85); - \fill[blue!10!gray,scale=0.5] (90:0.85) ellipse (.65cm and .3cm) ; - \fill[blue!10!gray,scale=0.5] (90:0.85) ++(0,0.4) ellipse (.2 and .4); - \fill[blue!10!gray,scale=0.5] (90:0.85) ++(0,0.8) ellipse (.4 and .3); - \end{scope} - \draw[line cap=round,line width=2pt] (0,0) -- ++(90:0.85); - \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ellipse (.65cm and .3cm) ; - \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ++(0,0.4) ellipse (.2 and .4); - \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ++(0,0.8) ellipse (.4 and .3); - \end{scope} -} - %------Environnement principal \NewDocumentEnvironment{PostIt}{ O{} D<>{} +b }% {% @@ -576,4 +579,493 @@ IfBooleanTF={#1}{ombreminipostit}{} } +%======[EN] + +%------Clés +\defKV[postitnote]{% + Width=\def\PostItLarg{#1},% + Color=\def\PostItCoul{#1},% + PinColor=\def\PostItCoulClip{#1},% + PinScale=\def\PostItCoulScaleClip{#1},% + Rotate=\def\PostItIncline{#1},% + Height=\def\PostItHauteur{#1},% + PinShift=\def\PostItDeclClip{#1},% + Pin=\def\PostItDeco{#1},% + AlignV=\def\PostItAlignV{#1},% + AlignH=\def\PostItAlignH{#1},% + AlignPostIt=\def\PostItAlignPostIt{#1},% + Render=\def\PostItRender{#1},% + ExtraRightMargin=\def\PostItExtraMargin{#1},% + Title=\def\PostItTitre{#1},% + FontTitle=\def\PostItPoliceTitre{#1} +} + +\setKVdefault[postitnote]{% + Width=6cm,% + Color=yellow,% + PinColor=red,% + Rotate=0,% + PinScale=1,% + Shadow=true,% + Height=auto,% + PinShift=0,% + Pin=Pushpin,% + AlignV=top,% + AlignH=justify,% + AlignPostIt=bottom,% + Border=true,% + Corner=false,% + Render=tcbox,% + ExtraRightMargin=0cm,% + Title={},% + FontTitle=\normalfont\normalsize +} + +%------Style principal tcolorbox +\tcbset{testpostitnote/.style={% + on line,enhanced,colframe=\PostItCoul!50!black,boxrule=\PostItBorder,width=\PostItLarg,sharp corners,halign=\PostItAlignH,valign=\PostItAlignV,% + %colback=\PostItCoul!50,% + finish={\CommandeDecoration},tikz={rotate=\PostItIncline,transform shape},% + box align=\PostItAlignPostIt,% + interior style={top color=\PostItCoul!50,bottom color=\PostItCoul!33},% + nobeforeafter + }% +} + +%------Environnement principal +\NewDocumentEnvironment{PostItNote}{ O{} D<>{} +b }% +{% + \restoreKV[postitnote]% + \setKV[postitnote]{#1}% + \IfStrEq{\PostItRender}{tcbox}% + {% + %choix de la déco et paramètrage + \def\CommandeDecoration{\EpinglePostIt}% + \def\MarginOffsetV{4mm}% + \IfStrEq{\PostItDeco}{Paperclip}% + {\def\CommandeDecoration{\TrombonePostIt}\def\MarginOffsetV{0mm}}% + {}% + \IfStrEq{\PostItDeco}{Scotch}% + {\def\CommandeDecoration{\ScotchPostIt}\def\MarginOffsetV{1mm}}% + {}% + \IfStrEq{\PostItDeco}{None}% + {\def\CommandeDecoration{}\def\MarginOffsetV{0mm}}% + {}% + %cas de la bordure + \ifboolKV[postitnote]{Border}% + {% + \def\PostItBorder{0.1mm}% + \tcbset{bordure/.style={}}% + }% + {% + \def\PostItBorder{0mm}% + \tcbset{bordure/.style={frame hidden}}% + }% + %cas du coin + \ifboolKV[postitnote]{Corner}% + {% + \tcbset{coincoin/.style={rounded corners=southeast,arc is angular,arc=3mm,underlay={\CoinPostIt}}}% + }% + {% + \tcbset{coincoin/.style={}}% + }% + %en fonction de hauteur auto ou non + \IfStrEq{\PostItHauteur}{auto}% + {% + \ifboolKV[postitnote]{Shadow}% + {\begin{tcolorbox}[testpostitnote,#2,bordure,coincoin,drop fuzzy shadow,top={2mm+\MarginOffsetV}]}% + {\begin{tcolorbox}[testpostitnote,#2,bordure,coincoin,top={2mm+\MarginOffsetV}]}% + }% + {% + \ifboolKV[postitnote]{Shadow}% + {\begin{tcolorbox}[testpostitnote,#2,bordure,coincoin,drop fuzzy shadow,height=\PostItHauteur,top={2mm+\MarginOffsetV}]}% + {\begin{tcolorbox}[testpostitnote,#2,bordure,coincoin,height=\PostItHauteur,top={2mm+\MarginOffsetV}]}% + }% + \IfStrEq{\PostItTitre}{}% + {}% + {% + \hfill{}{\PostItPoliceTitre\PostItTitre}\hfill~\\% + }% + #3% + \end{tcolorbox}% + }{}% + \IfStrEq{\PostItRender}{tikz}% + {% + \StrDel{\PostItLarg}{cm}[\PostItLarg]% + \StrDel{\PostItExtraMargin}{cm}[\PostItExtraMargin]% + \def\LargeurTextePostIt{\fpeval{\PostItLarg-\MarginHGPostIt-\MarginHDPostIt}}% + \def\TextePostIt{% + \IfStrEq{\PostItTitre}{}{}{\hfill{}{\PostItPoliceTitre\PostItTitre}\hfill~\\}% + #3% + }% + \IfStrEq{\PostItHauteur}{auto}% + {% + \sbox{\maboitepostit}{\parbox{\LargeurTextePostIt cm}{\TextePostIt}}% + \settoboxtotalheight{\HauteurEssaiTexte}{\maboitepostit}% + \addtolength\HauteurEssaiTexte{\MarginVHPostIt}\addtolength\HauteurEssaiTexte{\MarginVBPostIt}% + \IfStrEq{\PostItDeco}{Scotch}% + {\addtolength\HauteurEssaiTexte{0.4cm}}% + {}% + \IfStrEq{\PostItDeco}{Paperclip}% + {\addtolength\HauteurEssaiTexte{0.2cm}}% + {}% + \IfStrEq{\PostItDeco}{Pushpin}% + {\addtolength\HauteurEssaiTexte{0.6cm}}% + {}% + \IfStrEq{\PostItDeco}{None}% + {\addtolength\HauteurEssaiTexte{0.2cm}}% + {}% + \def\hauteur{\the\HauteurEssaiTexte}% + }% + {% + \def\hauteur{\PostItHauteur}% + }% + \def\OptionTikzPostIt{current bounding box.south}% + \IfStrEq{\PostItAlignPostIt}{center}% + {\def\OptionTikzPostIt{current bounding box.center}}{}% + \IfStrEq{\PostItAlignPostIt}{top}% + {\def\OptionTikzPostIt{current bounding box.north}}{}% + \begin{tikzpicture}[baseline=(\OptionTikzPostIt),rotate=\PostItIncline,line join=bevel,line cap=round] + %tracé + %ombre1/2/3 + \ifboolKV[postitnote]{Shadow}% + {% + \draw[draw=none,fill=gray,semithick,fill=gray,fill opacity=0.5] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=104] ++ ($({0.15},{-\hauteur+0.15})+(\OffsetOmbreA,-\OffsetOmbreA)$) + to[out=182,in=-2] ++ ({-0.15-\PostItLarg-\PostItExtraMargin},{0.13}) + -- cycle ; + \draw[draw=none,fill=gray!50!black,semithick,fill=gray!50!black,fill opacity=0.5] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=104] ++ ($({0.15},{-\hauteur+0.15})+(\OffsetOmbreB,-\OffsetOmbreB)$) + to[out=182,in=-2] ++ ({-0.15-\PostItLarg-\PostItExtraMargin},{0.13}) + -- cycle ; + \draw[draw=none,fill=black,semithick,fill=black,fill opacity=0.5] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=104] ++ ($({0.15},{-\hauteur+0.15})+(\OffsetOmbreC,-\OffsetOmbreC)$) + to[out=182,in=-2] ++ ({-0.15-\PostItLarg-\PostItExtraMargin},{0.13}) + -- cycle ; + }% + {}% + %postit + \ifboolKV[postitnote]{Shadow} + {% + \shadedraw[draw=\PostItCoul!50!black,line width=0.1mm,top color=\PostItCoul!50,bottom color=\PostItCoul!33] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=104] ++ ({0.15},{-\hauteur+0.15}) + to[out=182,in=-2] ++ ({-0.15-\PostItLarg-\PostItExtraMargin},{0.13}) + -- cycle ; + }% + {% + \shadedraw[draw=none,top color=\PostItCoul!50,bottom color=\PostItCoul!33] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=104] ++ ({0.15},{-\hauteur+0.15}) + to[out=182,in=-2] ++ ({-0.15-\PostItLarg-\PostItExtraMargin},{0.13}) + -- cycle ; + }% + \IfStrEq{\PostItHauteur}{auto}% + {% + \IfStrEq{\PostItDeco}{Pushpin}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt-0.4cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{None}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Paperclip}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Scotch}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt-0.2cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + }% + {% + \IfStrEq{\PostItAlignV}{top} + {% + \IfStrEq{\PostItDeco}{Pushpin}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt-0.4cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{None}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Paperclip}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Scotch}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt-0.2cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + }% + {}% + \IfStrEq{\PostItAlignV}{center} + {% + \IfStrEq{\PostItDeco}{Pushpin}% + {% + \draw ({0.5*\PostItLarg},{-0.5*\hauteur-\MarginVHPostIt-0.2cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{None}% + {% + \draw ({0.5*\PostItLarg},{-0.5*\hauteur}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Paperclip}% + {% + \draw ({0.5*\PostItLarg},{-0.5*\hauteur}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Scotch}% + {% + \draw ({0.5*\PostItLarg},{-0.5*\hauteur}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + }% + {}% + \IfStrEq{\PostItAlignV}{bottom} + {% + \draw ({0.5*\PostItLarg},{-\hauteur}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,above=0.6cm,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + }% + %affichage de la punaise + \IfStrEq{\PostItDeco}{Pushpin}% + {% + \begin{scope}[shift={(0.5*\PostItLarg+0.5*\PostItExtraMargin+\PostItDeclClip,-0.49)},scale={0.55},rotate=-40] + \begin{scope}[rotate=-35] + \draw[blue!10!gray,line cap=round,line width=2pt] (0,0) -- ++(90:0.85); + \fill[blue!10!gray,scale=0.5] (90:0.85) ellipse (.65cm and .3cm) ; + \fill[blue!10!gray,scale=0.5] (90:0.85) ++(0,0.4) ellipse (.2 and .4); + \fill[blue!10!gray,scale=0.5] (90:0.85) ++(0,0.8) ellipse (.4 and .3); + \end{scope} + \draw[line cap=round,line width=2pt] (0,0) -- ++(90:0.85); + \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ellipse (.65cm and .3cm) ; + \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ++(0,0.4) ellipse (.2 and .4); + \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ++(0,0.8) ellipse (.4 and .3); + \end{scope} + }% + {}% + %affichage du trombone + \IfStrEq{\PostItDeco}{Paperclip}% + {% + \begin{scope}[shift={(\PostItLarg+\PostItExtraMargin-1+\PostItDeclClip,0)},rotate=-15,scale={\PostItCoulScaleClip*0.55},line cap=round] + \draw[line width=0.81mm,draw=\PostItCoulClip!66] (0,0) --++ (0,0.0) arc (180:0:3.5mm) --++ (0,-1.75) arc (0:-180:3mm) --++ (0,1.25) ; + \draw[line width=0.27mm,draw=\PostItCoulClip!33] (0,0) --++ (0,0.0) arc (180:0:3.5mm) --++ (0,-1.75) arc (0:-180:3mm) --++ (0,1.25) ; + \end{scope} + }% + {}% + %affichage du scotch + \IfStrEq{\PostItDeco}{Scotch}% + {% + \begin{scope}[shift={(0.5*\PostItLarg+0.5*\PostItExtraMargin+\PostItDeclClip,0)},scale={0.65},rotate=3,line cap=round] + \draw[thin,gray!50,fill=lightgray,fill opacity=0.75] ({-0.5*\LargeurStotch},{-0.5*\HauteurScotch}) to ({0.5*\LargeurStotch},{-0.5*\HauteurScotch}) decorate [decoration={zigzag,segment length=2pt,amplitude=0.5pt}] {to ({0.5*\LargeurStotch},{0.5*\HauteurScotch})} to ({-0.5*\LargeurStotch},{0.5*\HauteurScotch}) decorate [decoration={zigzag,segment length=2pt,amplitude=0.5pt}] {to cycle} ; + \end{scope} + }% + {}% + \end{tikzpicture}% + }{}% + \IfStrEq{\PostItRender}{tikzv2}% + {% + \StrDel{\PostItLarg}{cm}[\PostItLarg]% + \StrDel{\PostItExtraMargin}{cm}[\PostItExtraMargin]% + \def\LargeurTextePostIt{\fpeval{\PostItLarg-\MarginHGPostIt-\MarginHDPostIt}}% + \def\TextePostIt{% + \IfStrEq{\PostItTitre}{}{}{\hfill{}{\PostItPoliceTitre\PostItTitre}\hfill~\\}% + #3% + }% + \IfStrEq{\PostItHauteur}{auto}% + {% + \sbox{\maboitepostit}{\parbox{\LargeurTextePostIt cm}{\TextePostIt}}% + \settoboxtotalheight{\HauteurEssaiTexte}{\maboitepostit}% + \addtolength\HauteurEssaiTexte{\MarginVHPostIt}\addtolength\HauteurEssaiTexte{\MarginVBPostIt}% + \IfStrEq{\PostItDeco}{Scotch}% + {\addtolength\HauteurEssaiTexte{0.4cm}}% + {}% + \IfStrEq{\PostItDeco}{Paperclip}% + {\addtolength\HauteurEssaiTexte{0.2cm}}% + {}% + \IfStrEq{\PostItDeco}{Pushpin}% + {\addtolength\HauteurEssaiTexte{0.6cm}}% + {}% + \IfStrEq{\PostItDeco}{None}% + {\addtolength\HauteurEssaiTexte{0.2cm}}% + {}% + \def\hauteur{\the\HauteurEssaiTexte}% + }% + {% + \def\hauteur{\PostItHauteur}% + }% + \def\OptionTikzPostIt{current bounding box.south}% + \IfStrEq{\PostItAlignPostIt}{center}% + {\def\OptionTikzPostIt{current bounding box.center}}{}% + \IfStrEq{\PostItAlignPostIt}{top}% + {\def\OptionTikzPostIt{current bounding box.north}}{}% + \begin{tikzpicture}[baseline=(\OptionTikzPostIt),rotate=\PostItIncline,line join=bevel,line cap=round] + %tracé + %ombre1/2/3 + \ifboolKV[postitnote]{Shadow}% + {% + \draw[draw=none,fill=gray,semithick,fill=gray,fill opacity=0.5] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=91] ++ ($({0.05},{-\hauteur-0.05})+(2pt,-2pt)$) + --++ ($({-\PostItLarg-\PostItExtraMargin-0.1},{0})+(-4pt,0)$) + to[out=89,in=-90] (0,0) ; + \draw[draw=none,fill=gray!50!black,semithick,fill=gray!50!black,fill opacity=0.5] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=91] ++ ($({0.05},{-\hauteur-0.05})+(1.25pt,-1.25pt)$) + --++ ($({-\PostItLarg-\PostItExtraMargin-0.1},{0})+(-2.5pt,0)$) + to[out=89,in=-90] (0,0) ; + \draw[draw=none,fill=black,semithick,fill=black,fill opacity=0.5] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=91] ++ ($({0.05},{-\hauteur-0.05})+(0.5pt,-0.5pt)$) + --++ ($({-\PostItLarg-\PostItExtraMargin-0.1},{0})+(-1pt,0)$) + to[out=89,in=-90] (0,0) ; + }% + {}% + %postit + \ifboolKV[postitnote]{Border} + {% + \shadedraw[draw=\PostItCoul!50!black,line width=0.1mm,top color=\PostItCoul!50,bottom color=\PostItCoul!33] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=91] ++ ({0.05},{-\hauteur-0.05}) + --++ ({-\PostItLarg-\PostItExtraMargin-0.1},{0}) + to[out=89,in=-90] (0,0) ; + }% + {% + \shadedraw[draw=none,top color=\PostItCoul!50,bottom color=\PostItCoul!33] + (0,0) --++ ({\PostItLarg+\PostItExtraMargin},0) + to[out=-90,in=91] ++ ({0.05},{-\hauteur-0.05}) + --++ ({-\PostItLarg-\PostItExtraMargin-0.1},{0}) + to[out=89,in=-90] (0,0) ; + }% + \IfStrEq{\PostItHauteur}{auto}% + {% + \IfStrEq{\PostItDeco}{Pushpin}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt-0.4cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{None}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Paperclip}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Scotch}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt-0.2cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + }% + {% + \IfStrEq{\PostItAlignV}{top} + {% + \IfStrEq{\PostItDeco}{Pushpin}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt-0.4cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{None}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Paperclip}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Scotch}% + {% + \draw ({0.5*\PostItLarg},{-\MarginVHPostIt-0.2cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,below,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + }% + {}% + \IfStrEq{\PostItAlignV}{center} + {% + \IfStrEq{\PostItDeco}{Pushpin}% + {% + \draw ({0.5*\PostItLarg},{-0.5*\hauteur-\MarginVHPostIt-0.2cm}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{None}% + {% + \draw ({0.5*\PostItLarg},{-0.5*\hauteur}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Paperclip}% + {% + \draw ({0.5*\PostItLarg},{-0.5*\hauteur}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + \IfStrEq{\PostItDeco}{Scotch}% + {% + \draw ({0.5*\PostItLarg},{-0.5*\hauteur}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + }% + {}% + \IfStrEq{\PostItAlignV}{bottom} + {% + \draw ({0.5*\PostItLarg},{-\hauteur}) node[text width=\LargeurTextePostIt cm,rotate=\PostItIncline,above=0.6cm,align=\PostItAlignH,inner sep=0pt] {\TextePostIt} ; + }% + {}% + }% + %affichage de la punaise + \IfStrEq{\PostItDeco}{Pushpin}% + {% + \begin{scope}[shift={(0.5*\PostItLarg+0.5*\PostItExtraMargin+\PostItDeclClip,-0.49)},scale={0.55},rotate=-40] + \begin{scope}[rotate=-35] + \draw[blue!10!gray,line cap=round,line width=2pt] (0,0) -- ++(90:0.85); + \fill[blue!10!gray,scale=0.5] (90:0.85) ellipse (.65cm and .3cm) ; + \fill[blue!10!gray,scale=0.5] (90:0.85) ++(0,0.4) ellipse (.2 and .4); + \fill[blue!10!gray,scale=0.5] (90:0.85) ++(0,0.8) ellipse (.4 and .3); + \end{scope} + \draw[line cap=round,line width=2pt] (0,0) -- ++(90:0.85); + \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ellipse (.65cm and .3cm) ; + \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ++(0,0.4) ellipse (.2 and .4); + \fill[ball color=\PostItCoulClip!66,scale=0.5] (90:0.85) ++(0,0.8) ellipse (.4 and .3); + \end{scope} + }% + {}% + %affichage du trombone + \IfStrEq{\PostItDeco}{Paperclip}% + {% + \begin{scope}[shift={(\PostItLarg+\PostItExtraMargin-1+\PostItDeclClip,0)},rotate=-15,scale={\PostItCoulScaleClip*0.55},line cap=round] + \draw[line width=0.81mm,draw=\PostItCoulClip!66] (0,0) --++ (0,0.0) arc (180:0:3.5mm) --++ (0,-1.75) arc (0:-180:3mm) --++ (0,1.25) ; + \draw[line width=0.27mm,draw=\PostItCoulClip!33] (0,0) --++ (0,0.0) arc (180:0:3.5mm) --++ (0,-1.75) arc (0:-180:3mm) --++ (0,1.25) ; + \end{scope} + }% + {}% + %affichage du scotch + \IfStrEq{\PostItDeco}{Scotch}% + {% + \begin{scope}[shift={(0.5*\PostItLarg+0.5*\PostItExtraMargin+\PostItDeclClip,0)},scale={0.65},rotate=3,line cap=round] + \draw[thin,gray!50,fill=lightgray,fill opacity=0.75] ({-0.5*\LargeurStotch},{-0.5*\HauteurScotch}) to ({0.5*\LargeurStotch},{-0.5*\HauteurScotch}) decorate [decoration={zigzag,segment length=2pt,amplitude=0.5pt}] {to ({0.5*\LargeurStotch},{0.5*\HauteurScotch})} to ({-0.5*\LargeurStotch},{0.5*\HauteurScotch}) decorate [decoration={zigzag,segment length=2pt,amplitude=0.5pt}] {to cycle} ; + \end{scope} + }% + {}% + \end{tikzpicture}% + }{}% +}% +{}% + \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tagpdf/README.md b/macros/latex/contrib/tagpdf/README.md index 52a80b7f48..5b4a1b211f 100644 --- a/macros/latex/contrib/tagpdf/README.md +++ b/macros/latex/contrib/tagpdf/README.md @@ -1,6 +1,6 @@ #tagpdf — A package to create tagged pdf -Packageversion: 0.98g -Packagedate: 2023/05/16 +Packageversion: 0.98h +Packagedate: 2023/06/06 Author: Ulrike Fischer ## License diff --git a/macros/latex/contrib/tagpdf/tagpdf-backend.dtx b/macros/latex/contrib/tagpdf/tagpdf-backend.dtx index 2f0e0fa8b9..5b6acbf34f 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-backend.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-backend.dtx @@ -47,13 +47,13 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*luatex> -\ProvidesExplFile {tagpdf-luatex.def} {2023-05-16} {0.98g} +\ProvidesExplFile {tagpdf-luatex.def} {2023-06-06} {0.98h} {tagpdf~driver~for~luatex} % \end{macrocode} % \section{Loading the lua} @@ -158,8 +158,8 @@ local ProvidesLuaModule = { name = "tagpdf", - version = "0.98g", --TAGVERSION - date = "2023-05-16", --TAGDATE + version = "0.98h", --TAGVERSION + date = "2023-06-06", --TAGDATE description = "tagpdf lua code", license = "The LATEX Project Public License 1.3c" } diff --git a/macros/latex/contrib/tagpdf/tagpdf-checks.dtx b/macros/latex/contrib/tagpdf/tagpdf-checks.dtx index 830e667b52..39b786ee41 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-checks.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-checks.dtx @@ -48,7 +48,7 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{documentation} % \section{Commands} @@ -151,6 +151,11 @@ % & error % & in struct module % \\ +% |\@@_struct_write_obj:n| +% & |struct-orphan| +% & warning +% & in struct module +% \\ % |\tag_struct_begin:n| % & |struct-faulty-nesting| % & error @@ -295,7 +300,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-checks-code} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-checks-code} {2023-06-06} {0.98h} {part of tagpdf - code related to checks, conditionals, debugging and messages} %</header> % \end{macrocode} @@ -370,6 +375,19 @@ \msg_new:nnn { tag } {struct-no-objnum} { objnum~missing~for~structure~#1 } % \end{macrocode} % \end{macro} +% \begin{macro}{struct-orphan} +% This indicates that there is a structure which has kids but no parent. +% This can happen if a structure is stashed but then not used. +% \begin{macrocode} +\msg_new:nnn { tag } {struct-orphan} + { + Structure~#1~has~#2~kids~but~no~parent.\\ + It~is~turned~into~an~artifact.\\ + Did~you~stashed~a~structure~and~then~didn't~use~it? + } + +% \end{macrocode} +% \end{macro} % \begin{macro}{struct-faulty-nesting} % This indicates that there is somewhere one |\tag_struct_end:| too much. % This should be normally an error. diff --git a/macros/latex/contrib/tagpdf/tagpdf-code.pdf b/macros/latex/contrib/tagpdf/tagpdf-code.pdf Binary files differindex 96903459f9..8fd8bc7541 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-code.pdf +++ b/macros/latex/contrib/tagpdf/tagpdf-code.pdf diff --git a/macros/latex/contrib/tagpdf/tagpdf-data.dtx b/macros/latex/contrib/tagpdf/tagpdf-data.dtx index b2955c8a94..e66712cc7f 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-data.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-data.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{documentation} % This files contains a various data files which are read in @@ -60,7 +60,7 @@ % It lists the new tag, the rolemap and the namespace of the rolemap. % \begin{macrocode} %<*ns-latex> -%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-05-16} {0.98g} +%% \ProvidesExplFile {tagpdf-ns-latex.def} {2023-06-06} {0.98h} %% {latex} {https://www.latex-project.org/ns/dflt/2022}{} title, Title, pdf2, part, Title, pdf2, @@ -92,7 +92,7 @@ text, P, pdf2, % It is bound to change % \begin{macrocode} %<*ns-latex-book> -%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-05-16} {0.98g} +%% \ProvidesExplFile {tagpdf-ns-latex-book.def} {2023-06-06} {0.98h} %% {latex-book} {https://www.latex-project.org/ns/book/2022}{} chapter, H1,pdf2, section, H2,pdf2, @@ -108,7 +108,7 @@ subparagraph, H6,pdf2, % It is bound to change a lot! % \begin{macrocode} %<*ns-latex-inline> -%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-05-16} {0.98g} +%% \ProvidesExplFile {tagpdf-ns-latex-inline.def} {2023-06-06} {0.98h} %% {latex-inline} {https://www.latex-project.org/ns/inline/2022}{} chapter, Span, pdf2, section, Span, pdf2, @@ -122,7 +122,7 @@ P, Span, pdf2, % \section{The pdf namespace data} % \begin{macrocode} %<*ns-pdf> -%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-05-16} {0.98g} +%% \ProvidesExplFile {tagpdf-ns-pdf.def} {2023-06-06} {0.98h} %% {pdf} {http://iso.org/pdf/ssn}{} StructTreeRoot,StructTreeRoot,pdf,D, Document,Document,pdf,D, @@ -190,7 +190,7 @@ Strong,Span,pdf,I, % \section{The pdf 2.0 namespace data} % \begin{macrocode} %<*ns-pdf2> -%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-05-16} {0.98g} +%% \ProvidesExplFile {tagpdf-ns-pdf2.def} {2023-06-06} {0.98h} %% {pdf2} {http://iso.org/pdf2/ssn}{} Document,Document,pdf2,D, Part,Part,pdf2,G, @@ -246,7 +246,7 @@ Strong,Strong,pdf2,I, % \section{The mathml namespace data} % \begin{macrocode} %<*ns-mathml> -%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-05-16} {0.98g} +%% \ProvidesExplFile {tagpdf-ns-mathml.def} {2023-06-06} {0.98h} % {mathml}{http://www.w3.org/1998/Math/MathML}{} abs,abs,mathml, and,and,mathml, @@ -481,7 +481,7 @@ xor,xor,mathml, % This will perhaps change in future. % \begin{macrocode} %<*parent-child> -%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-05-16} {0.98g} +%% \ProvidesExplFile {tagpdf-parent-child.csv} {2023-06-06} {0.98h} ,,,StructTreeRoot,Document,Art,Part,Div,Sect,BlockQuote,NonStruct,TOC,TOCI,Index,Private,Quote,Note,Reference,BibEntry,P,Hn,H,Lbl,Code,Span,Link,Annot,Form,Ruby,RB,RT,RP,Warichu,WT,WP,L,LI,LBody,Table,TR,TH,TD,THead,TBody,TFoot,Caption,Figure,Formula,MC Document,both,document level,1,0..n,∅,‡,‡,∅,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅ Art,1.7,grouping,∅,0..n,∅,‡,‡,0..n,0..n,‡,∅,∅,∅,0..n,∅,0..n,∅,∅,∅,0..1,0..1,∅,∅,∅,0..n,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅,∅,0..n,0..n,∅,∅,∅,0..n,0..n,∅,∅ @@ -536,7 +536,7 @@ MC,both,---,∅,∅,∅,∅,∅,∅,0..n,‡,∅,∅,∅,0..n,0..n,0..n,0..n,0.. % This will perhaps change in future. % \begin{macrocode} %<*parent-child-2> -%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-05-16} {0.98g} +%% \ProvidesExplFile {tagpdf-parent-child-2.csv} {2023-06-06} {0.98h} ,,,StructTreeRoot,Document,DocumentFragment,Art,Part,Div,Sect,Aside,BlockQuote,NonStruct,TOC,TOCI,Index,Private,Title,Sub,Quote,Note,Reference,BibEntry,P,Hn,H,Lbl,Code,Em,Strong,Span,Link,Annot,Form,Ruby,RB,RT,RP,Warichu,WT,WP,FENote,L,LI,LBody,Table,TR,TH,TD,THead,TBody,TFoot,Caption,Figure,Formula,math,mathml,Artifact,MC Document,both,document level,1,0..n,0..n,∅,‡,‡,∅,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,0..n,∅ DocumentFragment,2.0,document level,∅,0..n,0..n,0..n,‡,‡,0..n,0..n,0..n,‡,∅,∅,∅,0..n,∅,∅,∅,∅*,∅,∅,∅,∅,∅,∅,∅*,∅,∅,∅,∅*,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅,∅*,∅,∅,∅,∅,0..n,∅ diff --git a/macros/latex/contrib/tagpdf/tagpdf-mc-generic.dtx b/macros/latex/contrib/tagpdf/tagpdf-mc-generic.dtx index 68479088a5..a82cb68524 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-mc-generic.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-mc-generic.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{documentation} % \end{documentation} @@ -55,11 +55,11 @@ % \begin{macrocode} %<@@=tag> %<*generic> -\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-mc-code-generic} {2023-06-06} {0.98h} {part of tagpdf - code related to marking chunks - generic mode} %</generic> %<*debug> -\ProvidesExplPackage {tagpdf-debug-generic} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-debug-generic} {2023-06-06} {0.98h} {part of tagpdf - debugging code related to marking chunks - generic mode} %</debug> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-mc-luacode.dtx b/macros/latex/contrib/tagpdf/tagpdf-mc-luacode.dtx index a4f61192df..cf70950a28 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-mc-luacode.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-mc-luacode.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{implementation} % The code is splitted into three parts: code shared by all engines, @@ -86,7 +86,7 @@ % \begin{macrocode} %<@@=tag> %<*luamode> -\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-mc-code-lua} {2023-06-06} {0.98h} {tagpdf - mc code only for the luamode } %</luamode> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-mc-shared.dtx b/macros/latex/contrib/tagpdf/tagpdf-mc-shared.dtx index cdc0aaa5a3..2096e11d30 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-mc-shared.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-mc-shared.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -174,7 +174,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-mc-code-shared} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-mc-code-shared} {2023-06-06} {0.98h} {part of tagpdf - code related to marking chunks - code shared by generic and luamode } %</header> diff --git a/macros/latex/contrib/tagpdf/tagpdf-roles.dtx b/macros/latex/contrib/tagpdf/tagpdf-roles.dtx index ce860d71fa..5876c4ba32 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-roles.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-roles.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{documentation} % \begin{function} @@ -98,7 +98,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-roles-code} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-roles-code} {2023-06-06} {0.98h} {part of tagpdf - code related to roles and structure names} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-space.dtx b/macros/latex/contrib/tagpdf/tagpdf-space.dtx index e8c1edfd5c..6e751618ee 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-space.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-space.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{documentation} % \begin{function}{interwordspace (setup-key)} @@ -64,7 +64,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-space-code} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-space-code} {2023-06-06} {0.98h} {part of tagpdf - code related to real space chars} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx index 81211bd445..542671bd15 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-struct.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-struct.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{documentation} % \section{Public Commands} @@ -247,7 +247,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-struct-code} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-struct-code} {2023-06-06} {0.98h} {part of tagpdf - code related to storing structure} %</header> % \end{macrocode} @@ -837,16 +837,35 @@ { \pdf_object_if_exist:nTF { @@/struct/#1 } { +% \end{macrocode} +% It can happen that a structure is not used and so has not parent. +% Simply ignoring it is problematic as it is also recorded in +% the IDTree, so we make an artifact out of it. +% \begin{macrocode} + \prop_get:cnNF { g_@@_struct_#1_prop } {P}\l_@@_tmpb_tl + { + \prop_gput:cnx { g_@@_struct_#1_prop } {P}{\pdf_object_ref:n { @@/struct/0 }} + \prop_gput:cnx { g_@@_struct_#1_prop } {S}{/Artifact} + \seq_if_empty:cF {g_@@_struct_kids_#1_seq} + { + \msg_warning:nnxx + {tag} + {struct-orphan} + { #1 } + {\seq_count:c{g_@@_struct_kids_#1_seq}} + } + } \@@_struct_fill_kid_key:n { #1 } \@@_struct_get_dict_content:nN { #1 } \l_@@_tmpa_tl \exp_args:Nx - \pdf_object_write:nnx - { @@/struct/#1 } - {dict} - { - \l_@@_tmpa_tl\c_space_tl - /ID~\@@_struct_get_id:n{#1} - } + \pdf_object_write:nnx + { @@/struct/#1 } + {dict} + { + \l_@@_tmpa_tl\c_space_tl + /ID~\@@_struct_get_id:n{#1} + } + } { \msg_error:nnn { tag } { struct-no-objnum } { #1} @@ -1470,6 +1489,10 @@ { \tl_gset:Nx \g_@@_struct_tag_tl { \exp_last_unbraced:NV\use_i:nn \l_@@_tmpa_tl } + \prop_get:NVNT\g_@@_role_tags_NS_prop \g_@@_struct_tag_tl\l_@@_tmpa_tl + { + \tl_gset:Nx \g_@@_struct_tag_NS_tl { \l_@@_tmpa_tl } + } } %<debug>\@@_debug_struct_end_insert: } @@ -1703,7 +1726,7 @@ % \section{Attributes and attribute classes} % \begin{macrocode} %<*header> -\ProvidesExplPackage {tagpdf-attr-code} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-attr-code} {2023-06-06} {0.98h} {part of tagpdf - code related to attributes and attribute classes} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-tree.dtx b/macros/latex/contrib/tagpdf/tagpdf-tree.dtx index decc64928f..61f6db544a 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-tree.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-tree.dtx @@ -47,13 +47,13 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{implementation} % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-tree-code} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-tree-code} {2023-06-06} {0.98h} {part of tagpdf - code related to writing trees and dictionaries to the pdf} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf-user.dtx b/macros/latex/contrib/tagpdf/tagpdf-user.dtx index 36da045bba..8ebd1813dd 100644 --- a/macros/latex/contrib/tagpdf/tagpdf-user.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf-user.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Version 0.98g, released 2023-05-16} +% \date{Version 0.98h, released 2023-06-06} % \maketitle % \begin{documentation} % \section{Setup commands} @@ -68,7 +68,7 @@ % \begin{syntax} % \cs{tag_tool:n}\Arg{key val} % \end{syntax} -% The tagging of basic document elements will require a variaty of small commands +% The tagging of basic document elements will require a variety of small commands % to configure and adapt the tagging. This command will collect them under a command % interface. The argument is \emph{one} key-value like string. This is work in progress % and both syntax, known arguments and implementation can change! @@ -250,7 +250,7 @@ % \begin{macrocode} %<@@=tag> %<*header> -\ProvidesExplPackage {tagpdf-user} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-user} {2023-06-06} {0.98h} {tagpdf - user commands} %</header> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf.dtx b/macros/latex/contrib/tagpdf/tagpdf.dtx index e9a394b5d4..b4c9e55090 100644 --- a/macros/latex/contrib/tagpdf/tagpdf.dtx +++ b/macros/latex/contrib/tagpdf/tagpdf.dtx @@ -92,7 +92,7 @@ % \begin{macrocode} %<@@=tag> %<*package> -\ProvidesExplPackage {tagpdf} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf} {2023-06-06} {0.98h} { A package to experiment with pdf tagging } \bool_if:nF @@ -118,7 +118,7 @@ % \end{macrocode} %<*debug> % \begin{macrocode} -\ProvidesExplPackage {tagpdf-debug} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-debug} {2023-06-06} {0.98h} { debug code for tagpdf } \@ifpackageloaded{tagpdf}{}{\PackageWarning{tagpdf-debug}{tagpdf~not~loaded,~quitting}\endinput} % \end{macrocode} @@ -141,7 +141,7 @@ % we define a base package with dummy functions % \begin{macrocode} %<*base> -\ProvidesExplPackage {tagpdf-base} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdf-base} {2023-06-06} {0.98h} {part of tagpdf - provide base, no-op versions of the user commands } %</base> % \end{macrocode} diff --git a/macros/latex/contrib/tagpdf/tagpdf.pdf b/macros/latex/contrib/tagpdf/tagpdf.pdf Binary files differindex f5f890701e..a75c6a78db 100644 --- a/macros/latex/contrib/tagpdf/tagpdf.pdf +++ b/macros/latex/contrib/tagpdf/tagpdf.pdf diff --git a/macros/latex/contrib/tagpdf/tagpdf.tex b/macros/latex/contrib/tagpdf/tagpdf.tex index cc3295488e..27cd1d128d 100644 --- a/macros/latex/contrib/tagpdf/tagpdf.tex +++ b/macros/latex/contrib/tagpdf/tagpdf.tex @@ -10,35 +10,33 @@ \DocumentMetadata { % comment the following line to compile an untagged documentation: - testphase=phase-III,testphase=graphics, + testphase=phase-III, pdfversion=2.0,lang=en-UK,pdfstandard=a-4, + %uncompress } \DebugBlocksOff \makeatletter -\def\UlrikeFischer@package@version{0.98g} -\def\UlrikeFischer@package@date{2023-05-16} +\def\UlrikeFischer@package@version{0.98h} +\def\UlrikeFischer@package@date{2023-06-06} \makeatother -\documentclass[DIV=12,parskip=half-,bibliography=totoc,a4paper]{article} +\documentclass[bibliography=totoc,a4paper]{article} \usepackage{geometry} \usepackage[english]{babel} \usepackage{unicode-math} \setmainfont{Heuristica} \usepackage[nopatch]{microtype} -\makeatletter -% see https://github.com/schlcht/microtype/issues/8 -%\patchcmd{\MT@get@prot}{\noindent}{\RawNoindent}{}{\fail} -\makeatother -%\usepackage{scrlayer-scrpage} \usepackage[autostyle]{csquotes} -\usepackage[style=numeric,hyperref=false]{biblatex} +\usepackage[style=numeric]{biblatex} \addbibresource{tagpdf.bib} \usepackage[noparboxrestore]{marginnote} -\makeatletter \renewcommand*{\mn@parboxrestore}{\tagpdfparaOff}% +\makeatletter +\renewcommand*{\mn@parboxrestore}{\tagpdfparaOff}% +\makeatother \reversemarginpar \usepackage{tcolorbox} @@ -89,11 +87,6 @@ \usepackage{tagpdfdocu-patches} - -%\cfoot*{\pagemark} - -% - \newcommand\PDF{PDF} \title{The \pkg{tagpdf} package, v\csname UlrikeFischer@package@version\endcsname} @@ -128,12 +121,12 @@ This package is not meant for normal document production. It is mainly a tool to tagging. You need a very current \LaTeX{} format. - You need a very current L3 programming layer. - You need the new \LaTeX{} PDF management bundle. +You need a very current L3 programming layer. +You need the new \LaTeX{} PDF management bundle. This package is incomplete, experimental and quite probably contains bugs. It is in parts quite slow as the code prefers readability over speed. - At some time it will disappear when the code has been integrated into the \LaTeX{} format. +At some time it will disappear when the code has been integrated into the \LaTeX{} format. This package can change in an incompatible way. @@ -160,45 +153,47 @@ Issues, comments, suggestions should be added as issues to the github tracker: \section{Introduction} -Since many years the creation of accessible \PDF{}-files with \LaTeX\ which conform to the PDF/UA standard has been on the agenda of \TeX-meetings. Many people agree that this is important and Ross Moore has done quite some work on it. There is also a TUG-mailing list and a webpage \parencite{tugaccess} dedicated to this theme. - -But in my opinion missing were means to \emph{experiment} with tagging and accessibility. Means to try out, how difficult it is to tag some structures, means to try out, how much tagging is really needed (standards and validators don't need to be right \ldots), means to test what else is needed so that a \PDF{} works e.g. with a screen reader. Without such experiments it is imho quite difficult to get a feeling about what has to be done, which kernel changes are needed, how packages should be adapted. +Since many years the creation of accessible, tagged \PDF{}-files with \LaTeX\ which conform to the PDF/UA standard has been on the agenda of \TeX-meetings. Many people agree that this is important and Ross Moore has done quite some work on it. There is also a TUG-mailing list and a web page \parencite{tugaccess} dedicated to this theme. +In my opinion missing were means to \emph{experiment} with tagging and accessibility. Means to try out, how difficult it is to tag some structures, means to try out, how much tagging is really needed (standards and validators don't need to be right \ldots), means to test what else is needed so that a \PDF{} works e.g. with a screen reader, means to try out how core \LaTeX\ commands behave if tagging is used. Without such experiments it is in my opinion +quite difficult to get a feeling about what has to be done, which kernel changes are needed, how packages should be adapted. -This package were developped to close this gap by offering \emph{core} commands to tag a \PDF{}% +This package was developed to close this gap by offering \emph{core} commands to tag a \PDF{}% \footnote{In case you don't know what this means: there will be some explanations later on.}. -My hope was that the knowledge gained by the use of this package will at the end allow to decide if and how code to do tagging should be part of the \LaTeX\ kernel. +My hope was that the knowledge gained by the use of this package will at the end +allow to decide if and how code to do tagging should be part of the \LaTeX\ kernel. -The code has been written with the goal to extend \LaTeX{} itself. -It therefore quite does not patch commands from other packages and is also not an aim of the package to develop such patches. While at the end changes to various commands in many classes and packages will be needed to get tagged \PDF{} files -- and the examples accompanying the package try (or will try) to show various strategies -- these changes should in my opinion be done by the class, package and document writers themselves using a sensible API provided by the kernel and not by some external package that adds patches everywhere and would need constant maintenance -- one only need to look at packages like tex4ht or bidi or hyperref to see how difficult and sometimes fragile this is. - +The code has been written so that it can be added as module to the \LaTeX{} kernel itself if it turns out to be usable. +It therefore avoid to patch commands from other packages and is also not an aim of the package to develop such patches. While at the end changes to various commands in many classes and packages will be needed to get tagged \PDF{} files +these changes should be done by the class, package and document writers themselves using a sensible API provided by the kernel and not by some external package that adds patches everywhere and would need constant maintenance -- one only need to look at packages like tex4ht or bidi or hyperref to see how difficult and sometimes fragile this is. The package is now a part of the Tagged PDF project and triggered already various changes in the LaTeX kernel and the engines: There is a new PDF management, the new para hooks allows to automatically tag paragraphs, after changes in the output routine page breaks and header and footer are handled correctly, the engines support -now structure destinations. +now structure destinations. More changes are in the latex-lab bundle and can be loaded through testphase keys. -I'm sure that it still has bugs. Bugs reports, suggestions and comments can be added to the issue tracker on github. \url{https://github.com/u-fischer/tagpdf}. +I'm sure that tagpdf still has bugs. Bugs reports, suggestions and comments can be added to the issue tracker on github. \url{https://github.com/u-fischer/tagpdf}. -Please also check the github site for new examples and improvements. +Please also check the github site and latex-lab for new examples and improvements. \subsection{Tagging and accessibility} -While the package is named \texttt{tagpdf} the goal is actually \emph{accessible} \PDF{}-files. Tagging is \emph{one} requirement for accessibility but there are others. I will mention some later on in this documentation, and -- if sensible -- I will also try to add code, keys or tips for them. +While the package is named \texttt{tagpdf} the goal is also \emph{accessible} \PDF{}-files. Tagging is \emph{one} (the most difficult) requirement for accessibility but there are others. I will mention some later on in this documentation, and -- if sensible -- I will also try to add code, keys or tips for them. So the name of the package is a bit wrong. As excuse I can only say that it is shorter and easier to pronounce. \subsection{Engines and modes} -The package theoretically with all engines, -But the xelatex and the latex-dvips-route are not much tested and they also don't support -real space glyphs. lualatex is the most powerful and safe modus, but pdflatex works ok too. +The package works theoretically with all engines, +but the xelatex and the latex-dvips-route are basically untested tested and they also don't support +real space glyphs so I don't recommend them. +lualatex is the most powerful and safe modus and should be used for new documents, it is slower than pdflatex but requires less compilations to get tagging. pdflatex works ok and can be used for legacy documents; it needs more compilations to resolve all cross references needed for the tagging. The package has two modes: the \emph{generic mode} which should work in theory with every engine and the \emph{lua mode} which works only with lualatex. -I implemented the generic mode first. Mostly because my tex skills are much better than my lua skills and I wanted to get the tex side right before starting to fight with attributes and node traversing. +I implemented the generic mode first. Mostly because my \TeX\ skills are much better than my lua skills and I wanted to get the \TeX\ side right before starting to fight with attributes and node traversing. While the generic mode is not bad and I spent quite some time to get it working I nevertheless think that the lua mode is the future and the only one that will be usable for larger documents. \PDF{} is a page orientated format and so the ability of luatex to manipulate pages and nodes after the \TeX-processing is really useful here. Also with luatex characters are normally already given as unicode. @@ -208,18 +203,37 @@ at best at least once or twice more often then normal. \subsection{References and target PDF version} -My main reference for the first versions of this package -was the free reference for \PDF{} 1.7. \parencite{pdfreference} and so the package also targetted this version. +My main reference for the first versions of this package was the free +reference for \PDF{} 1.7. \parencite{pdfreference} and so the first versions +of the package implemented only \PDF{} 1.7. + +In 2018 \PDF{} 2.0. has been released. The reference can be bought at no cost +through the PDF association. + +\PDF{} 2.0 has a number of features that are really needed for good tagging: +it knows more structure types, it allows to add associated files to +structures---these are small, embedded files which can for example contain +the mathML or source code of an equation---, it knows structure destinations +which allows to link to a structure. + -In 2018 \PDF{} 2.0. has been released, and since 2020 all engines can set the version to 2.0. So the package will -now target \PDF{} 2.0. This doesn't mean that 2.0 will be required, but that the code and the options will be extended to -support \PDF{} 2.0. One example is the support for associated files, another the support for name spaces in version 0.82. +\PDF{}~2.0 features are currently (mid 2023) not well supported by +\PDF~consumer. No PDF viewer (including Acrobat) for example can handle name +spaces and associated files. PAC~3 even crashes if one tries to load a \PDF{} +2.0 file, and pdftk will create a \PDF{}~1.0 from it. -The package doesn't try to suppress all 2.0 features if an older \PDF{} version is produced. It normally doesn't harm if a \PDF{} contains keys unknown in its version and it makes the code faster and easier to maintain if there aren't too many tests and code pathes; so for example associated files will always be added. But tests could be added in case this leads to incompabilities. +Nevertheless \LaTeX{} targets \PDF{} 2.0, tagpdf has added support for +associated files, for name spaces and other \PDF{} 2.0 features tagpdf and we +recommend to use \PDF{} 2.0 if possible and then to complain to the PDF{} +consumer if something doesn't work. + +The package doesn't try to suppress all 2.0 features if an older \PDF{} +version is produced. It normally doesn't harm if a \PDF{} contains keys +unknown in its version and it makes the code faster and easier to maintain if +there aren't too many tests and code pathes; so for example associated files +will always be added. But tests could be added in case this leads to +incompabilities. -It should be noted that some tools don't like \PDF{}~2.0. PAC~3 for example -simply crashes, and pdftk will create a \PDF{}~1.0 from it. This makes -testing \PDF{}~2.0 files a bit of a challenge. \subsection{Validation} @@ -228,11 +242,14 @@ testing \PDF{}~2.0 files a bit of a challenge. \begin{itemize} \item - One must check that the \PDF{} is \emph{syntactically} correct. It is rather easy to create broken \PDF{}: - e.g. if a chunk is opened on one page but closed on the next page or if the document isn't compiled often enough. + One must check that the \PDF{} is \emph{syntactically} correct. + It is rather easy to create broken \PDF{}: + e.g. if a chunk is opened on one page but closed + on the next page or if the document isn't compiled often enough. -\item -One must check how good the requirements of the PDF/UA standard are followed \emph{formally}. +\item One must check how good the requirements of the PDF/UA standard are + followed \emph{formally}\footnote{The PDF/UA-2 standard for \PDF~2.0 + will hopefully be released in 2023}. \item One must check how good the accessibility is \emph{practically}. @@ -241,26 +258,33 @@ One must check how good the accessibility is \emph{practically}. Syntax validation and formal standard validation can be done with preflight of the (non-free) adobe acrobat. It can also be done also with the free -\PDF{} Accessibility Checker (PAC~3) \parencite{pac3}. There is also the +\PDF{} Accessibility Checker (PAC~2021) \parencite{pac3}. There is also the validator veraPDF \parencite{verapdf}. A rather new and quite useful tool is \enquote{Next Generation PDF} \parencite{ngpdf}, a browser application which converts a tagged PDF to html, allows to inspect its structure and also to edit the structure. -Practical validation is naturally the more complicated part. It needs screen reader, users which actually knows how to handle them, can test documents and can report where a \PDF{} has real accessibility problems. +Practical validation is naturally the more complicated part. +It needs screen reader, users which actually knows how to handle them, +can test documents and can report where a \PDF{} has real accessibility problems. \minisec{Preflight woes} -Sadly validators can not be always trusted. As an example for an reason that I don't understand the adobe preflight don't like the list structure \texttt{L}. -It is also possible that validators contradict: that the one says everything is okay, while the other complains. +Sadly validators can not be always trusted. +As an example for an reason that I don't understand the adobe preflight +don't like the list structure \texttt{L}. +It is also possible that validators contradict: that the one says everything is okay, +while the other complains. \subsection{Examples wanted!} -To make the package usable examples are needed: examples that demonstrate how various structures can be tagged and which patches are needed, examples for the test suite, examples that demonstrates problems. +To make the package usable examples are needed: +examples that demonstrate how various structures can be tagged and which patches are needed, +examples for the test suite, examples that demonstrates problems. \begin{tcolorbox} @@ -269,7 +293,8 @@ Feedback, contribuations and corrections are welcome! All examples should use the \cs{DocumentMetadata} key \PrintKeyName{uncompress} -so that uncompressed \PDF{} are created and the internal objects and structures can be inspected and -- hopefully soon -- be compared by the l3build checks.% +so that uncompressed \PDF{} are created and the internal objects and +structures can be inspected and be compared by the l3build checks.% \section{Changes} @@ -1232,19 +1257,14 @@ This solves the \enquote{interruption} problem, but has its price: Material inse must be properly guarded. For example \begin{taglstlisting} -\RequirePackage{pdfmanagement-testphase} -\DeclareDocumentMetadata{uncompress} +\DocumentMetadata{uncompress} \documentclass{article} -\usepackage{tagpdf} -\tagpdfsetup{activate,interwordspace=true} \pagestyle{headings} \begin{document} -\tagstructbegin{tag=Document} \sectionmark{HEADER} \AddToHook{shipout/background}{\put(5cm,-5cm){BACKGROUND}} \tagmcbegin{tag=P}Page 1\newpage Page 2\tagmcend -\tagstructend \end{document} \end{taglstlisting} @@ -1255,13 +1275,11 @@ like. \includegraphics[alt=Show tags of examples]{global-ex} -It is therefore from now on important to correctly markup such code. Header and footer typically should be -artifacts. The LaTeX kernel hasn't yet suitable hooks around header and footer to allow to automate -this, but a first draft has been added with \pkg{pdfmanagement-testphase}. Starting with version 0.92 -header and footer are marked as (simple) artifacts. -If they contain code which needs a different markup it still must be added explicitly. -With packages like \pkg{fancyhdr} or \pkg{scrlayer-scrpage} it is quite easy to add -the needed code. +It is therefore from now on important to correctly markup such code. Header +and footer are now marked as artifacts (see below). If they contain code +which needs a different markup it still must be added explicitly. With +packages like \pkg{fancyhdr} or \pkg{scrlayer-scrpage} it is quite easy to +add the needed code. \subsubsection{Tips} diff --git a/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty b/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty index 527d7bec01..4f14e73b1a 100644 --- a/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty +++ b/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty @@ -1,25 +1,17 @@ %\RequirePackage[enable-debug]{expl3}[2018/06/14] -\ProvidesExplPackage {tagpdfdocu-patches} {2023-05-16} {0.98g} +\ProvidesExplPackage {tagpdfdocu-patches} {2023-06-06} {0.98h} {patches/commands for the tagpdf documentation} \RequirePackage{etoolbox,xpatch} %Logos - +% only spacing changes: \ExplSyntaxOn \DeclareRobustCommand\TeX{ \leavevmode - \tag_mc_end_push: - \tag_struct_begin:n{tag=Span,actualtext=TeX} - \tagmcbegin{} T\kern-.1667em\lower.5ex\hbox{E}\kern-.05emX\@ %changed from -.125em - \tagmcend - \tag_struct_end: - \tag_mc_begin_pop:n{}} + } \DeclareRobustCommand{\LaTeX}{ \leavevmode - \tag_mc_end_push: - \tag_struct_begin:n{tag=Span,actualtext=LaTeX} - \tagmcbegin{} L\kern-.25em % %changed from -0.36em \sbox\z@ T% \vbox to\ht\z@{\hbox{\check@mathfonts @@ -29,24 +21,7 @@ \vss}% \kern-.1em % %changed from 0.15em T\kern-.1667em\lower.5ex\hbox{E}\kern-.05emX\@ %changed from -0.125 - \tagmcend - \tag_struct_end: - \tag_mc_begin_pop:n{} - } -% textbf - -\AddToHook{cmd/textbf/before} - {\leavevmode\tag_mc_end_push:\tag_struct_begin:n{tag=Strong}\tagmcbegin{}} - -\AddToHook{cmd/textbf/after} - {\tag_mc_end:\tag_struct_end:\tag_mc_begin_pop:n{}} - -% emph -\AddToHook{cmd/emph/before} - {\leavevmode\tag_mc_end_push:\tag_struct_begin:n{tag=Em}\tagmcbegin{}} - -\AddToHook{cmd/emph/after} - {\tag_mc_end:\tag_struct_end:\tag_mc_begin_pop:n{}} + } % minisec, correct tagging is still unclear. \newcommand\minisec[1]{% @@ -173,128 +148,5 @@ %====== floats ======== -\tagpdfsetup{add-new-tag=float/Div} -\makeatletter -\def\@xfloat #1[#2]{% - \@nodocument - \def \@captype {#1}% - \def \@fps {#2}% - \@onelevel@sanitize \@fps - \def \reserved@b {!}% - \ifx \reserved@b \@fps - \@fpsadddefault - \else - \ifx \@fps \@empty - \@fpsadddefault - \fi - \fi - \ifhmode - \@bsphack - \tagmcend%end P - \@floatpenalty -\@Mii - \else - \@floatpenalty-\@Miii - \fi - \ifinner - \@parmoderr\@floatpenalty\z@ - \else - \@next\@currbox\@freelist - {% - \@tempcnta \sixt@@n - \expandafter \@tfor \expandafter \reserved@a - \expandafter :\expandafter =\@fps - \do - {% - \if \reserved@a h% - \ifodd \@tempcnta - \else - \advance \@tempcnta \@ne - \fi - \else\if \reserved@a t% - \@setfpsbit \tw@ - \else\if \reserved@a b% - \@setfpsbit 4% - \else\if \reserved@a p% - \@setfpsbit 8% - \else\if \reserved@a !% - \ifnum \@tempcnta>15 - \advance\@tempcnta -\sixt@@n\relax - \fi - \else - \@latex@error{Unknown float option `\reserved@a'}% - {Option `\reserved@a' ignored and `p' used.}% - \@setfpsbit 8% - \fi\fi\fi\fi\fi - }% - \@tempcntb \csname ftype@\@captype \endcsname - \multiply \@tempcntb \@xxxii - \advance \@tempcnta \@tempcntb - \global \count\@currbox \@tempcnta - }% - \@fltovf - \fi - \tagstructbegin{tag=float}%float - \edef\@current@float@struct{\csname tag_get:n\endcsname{struct_num}}% - \typeout{Float structure: \@current@float@struct} - \global \setbox\@currbox - \color@vbox - \normalcolor - \vbox \bgroup - \hsize\columnwidth - \@parboxrestore - \@floatboxreset -}% - -\def\end@float{% - \@endfloatbox - \tagstructend %end div - \ifnum\@floatpenalty <\z@ - \@largefloatcheck - \@cons\@currlist\@currbox - \ifnum\@floatpenalty <-\@Mii - \penalty -\@Miv - \@tempdima\prevdepth - \vbox{}% - \prevdepth\@tempdima - \penalty\@floatpenalty - \else - \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack - \tagmcbegin{tag=P}%restart P Safe here?? - \fi - \fi -} - -\ExplSyntaxOn -\long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \tagtool{para=false} - \sbox\@tempboxa{#1:~#2}% - \tag_struct_begin:n{tag=Caption} - \ifdim \wd\@tempboxa >\hsize - \tag_struct_begin:n{tag=Lbl} - \tag_mc_begin:n{} - #1:~ - \tag_mc_end: - \tag_struct_end: - \tag_mc_begin:n{} - #2\par - \tag_mc_end: - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil - \tag_struct_begin:n{tag=Lbl} - \tag_mc_begin:n{} - #1:~ - \tag_mc_end: - \tag_struct_end: - \tag_mc_begin:n{} - #2\par - \tag_mc_end:\hfil}% - \fi - \tagstructend %caption - \vskip\belowcaptionskip} -\ExplSyntaxOff - - \endinput diff --git a/macros/unicodetex/latex/njuthesis/njuthesis.dtx b/macros/unicodetex/latex/njuthesis/njuthesis.dtx index 649ca357dd..cf1443a781 100644 --- a/macros/unicodetex/latex/njuthesis/njuthesis.dtx +++ b/macros/unicodetex/latex/njuthesis/njuthesis.dtx @@ -20,6 +20,7 @@ % This work consists of the files njuthesis.dtx, % and the derived files njuthesis.ins, % njuthesis.cls, +% njuthesis-doc.cls, % njuthesis-graduate.def, % njuthesis-postdoctoral.def, % njuthesis-undergraduate.def, @@ -73,6 +74,7 @@ To produce the documentation run the original source files ending with \file{\jobname-undergraduate.def} {\from{\jobname.dtx}{def-u}} \file{\jobname-graduate.def} {\from{\jobname.dtx}{def-g}} \file{\jobname-postdoctoral.def} {\from{\jobname.dtx}{def-p}} + \file{\jobname-doc.cls} {\from{\jobname.dtx}{doc-cls}} %<*internal> \usedir{source/latex/njuthesis} \file{\jobname.ins} {\from{\jobname.dtx}{install}} @@ -88,6 +90,7 @@ To produce the documentation run the original source files ending with \Msg{* The recommended directory is TDS:tex/latex/njuthesis *} \Msg{* *} \Msg{* njuthesis.cls *} +\Msg{* njuthesis-doc.cls *} \Msg{* njuthesis-graduate.def *} \Msg{* njuthesis-postdoctoral.def *} \Msg{* njuthesis-undergraduate.def *} @@ -109,7 +112,7 @@ To produce the documentation run the original source files ending with % %<class>\NeedsTeXFormat{LaTeX2e} %<*!(driver|install)> -%<+!driver>\GetIdInfo $Id: njuthesis.dtx 1.2.1 2023-05-03 13:30:00 +%<+!driver>\GetIdInfo $Id: njuthesis.dtx 1.3.0 2023-06-06 11:30:00 %<+!driver> +0800 NJU LUG <git+nju-lug-email-3104-issue-@yaoge123.cn>$ %<class> {Thesis template for Nanjing University} %<class>\ProvidesExplClass{njuthesis} @@ -121,216 +124,15 @@ To produce the documentation run the original source files ending with % ^^A 南京大学一百二十周年华诞邀您共襄盛举! %<def-p> {Postdoctoral definition file for njuthesis} %<def-p>\ProvidesExplFile{njuthesis-postdoctoral.def} +%<doc-cls> {Documentation style for njuthesis} +%<doc-cls>\ProvidesExplFile{njuthesis-doc.cls} %<!driver> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} %</!(driver|install)> % %<*driver> \ProvidesFile{njuthesis.dtx} -\documentclass[fontset=fandol]{ctxdoc} -\usepackage{listings,njuvisual,tabularray,unicode-math,xeCJKfntef,zhlineskip} -\usepackage[firstpage=true]{background} -\backgroundsetup{ - contents={\njuemblem[white!85!gray]{22cm}{!}}, - scale=1, angle=0, hshift=-4cm -} -\definecolor{tpblue}{HTML}{495A80} -\renewcommand\emph[1]{\CJKunderdot[textformat=\itshape]{#1}} -\newcommand\tpbutton[1]{\textcolor{tpblue}{\bfseries #1}} -\newcommand\tikzlogo{Ti\emph{k}Z} -\newcommand\OPT[1]{\textcolor{njuyellow}{\bfseries#1}} -\hypersetup{ - pdftitle = { - The njuthesis class - - LaTeX thesis template for Nanjing University}, - citecolor = njublue, - linkcolor = njuviolet, - urlcolor = njumagenta} -\UseTblrLibrary{booktabs,siunitx} -\DefTblrTemplate{caption-tag}{default}{表\hspace{0.25em}\thetable} -\SetTblrStyle{caption-tag}{font=\bfseries} -\SetTblrInner{row{1}={font=\bfseries}} -\SetTblrInner[talltblr]{row{1}={font=\bfseries}} -\DefTblrTemplate{caption-sep}{default}{\quad} -\def\TA{\TblrNote{a}} -\def\TB{\TblrNote{b}} -\def\TC{\TblrNote{c}} -\def\TD{\TblrNote{d}} -\def\TE{\TblrNote{e}} -\def\TL{\TeX~Live} -\def\MacTeX{Mac\TeX} -\def\biber{\hologo{biber}} -\def\LaTeXe{\hologo{LaTeX2e}} -\SetTextEnvironmentSinglespace{1.112} -\SetMathEnvironmentSinglespace{1.112} -\setsansfont{LexendDeca} -\setmonofont{Iosevka}[ - UprightFont = Iosevka Light, - ItalicFont = Iosevka Light Italic, - BoldFont = Iosevka Semibold -] -\setCJKmainfont{Source Han Serif SC}[ - UprightFont = Source Han Serif SC SemiBold, - ItalicFont = Source Han Serif SC Bold, - BoldFont = Source Han Serif SC Heavy, - Language = Chinese Simplified -] -\setmathfont{XITSMath-Regular}[ - BoldFont = XITSMath-Bold, - Extension = .otf] -\lstdefinestyle{style@base} - { - basewidth = 0.5 em, - gobble = 3, - lineskip = 3 pt, - frame = l, - framerule = 1 pt, - framesep = 0 pt, - xleftmargin = 2 em, - xrightmargin = 3 em, - escapeinside = {(*}{*)}, - breaklines = true, - basicstyle = \small\ttfamily, - keywordstyle = \bfseries\color{njuviolet}, - commentstyle = \itshape\color{white!50!gray}, - stringstyle = \color{nju-chem-red}, - backgroundcolor = \color{white!95!gray} - } -\lstdefinestyle{style@shell} - { - style = style@base, - rulecolor = \color{njumagenta}, - language = bash, - alsoletter = {-}, - emphstyle = \color{nju-cs-green} - } -\lstdefinestyle{style@latex} - { - style = style@base, - rulecolor = \color{njublue}, - language = [LaTeX]TeX, - alsoletter = {*, -, .}, - texcsstyle = *\color{njuviolet}, - emphstyle = [1]\color{nju-ai-orange}, - emphstyle = [2]\color{nju-cs-green}, - emphstyle = [3]\bfseries\color{njuyellow} - } -\lstnewenvironment{shellexample}[1][]{% - \lstset{style=style@shell, #1}}{} -\lstnewenvironment{latexexample}[1][]{% - \lstset{style=style@latex, #1}}{} -\makeatletter -\ExplSyntaxOn -\colorlet { at@guard } { njuviolet } -\definecolor { angle@guard } { gray } { 0.7 } -\definecolor { star@guard } { rgb } { 0.8 , 0 , 0 } -\definecolor { u@guard } { HTML } { 5463FF } -\definecolor { g@guard } { HTML } { 2B7A0B } -\definecolor { p@guard } { HTML } { FF1818 } -\definecolor { c@guard } { HTML } { FFC300 } -\clist_const:Nn \c__njudoc_module_color_clist - { - { def-u } { u@guard }, - { def-g } { g@guard }, - { def-p } { p@guard }, - { class } { c@guard } - } -\cs_new_protected:Npn \__njudoc_compare_module:nnn #1#2#3 - { \str_if_eq:nnT {#1} {#2} { \color {#3} #1 } } -\cs_new_protected:Npn \__njudoc_set_module_color:n #1 - { - \clist_map_inline:Nn \c__njudoc_module_color_clist - { \__njudoc_compare_module:nnn {#1} ##1 } - } -\cs_new_protected:Npn \__njudoc_module_angle:Nn #1#2 - { - \group_begin: \color { angle@guard } \ttfamily \textlangle \group_end: - \group_begin: \sffamily #2 \group_end: - \group_begin: \color { angle@guard } #1 \ttfamily \textrangle \group_end: - } -\cs_set_protected:Npn \__ctxdoc_module_angle:n #1 - { \__njudoc_module_angle:Nn \c_empty_tl {#1} } -\cs_new_protected:Npn \__njudoc_colored_module_angle:NN #1#2 - { - \seq_clear:N #2 - \seq_map_inline:Nn #1 - { - \seq_gput_right:Nn #2 - { \__njudoc_set_module_color:n {##1} } - } - } -\cs_new_protected:Npn \__njudoc_print_module:n #1 - { - \__njudoc_colored_module_angle:NN \l_tmpa_seq \l_tmpb_seq - \bool_lazy_or:nnTF - { \str_if_empty_p:n { #1 } } - { \int_compare_p:n { \seq_count:N \l_tmpb_seq = 1 } } - { - \str_clear:N \l_tmpa_str - \str_clear:N \l_tmpb_str - } - { - \str_set:Nn \l_tmpa_str { ( } - \str_set:Nn \l_tmpb_str { ) } - } - \__njudoc_module_angle:Nn \l_tmpb_str - { - \color { star@guard } #1 - \color { angle@guard } \l_tmpa_str - \seq_use:Nn \l_tmpb_seq - { \color { angle@guard } \orbar } - } - } -\cs_new_protected_nopar:Npn \__njudoc_split_pm:n #1 - { \seq_set_split:Nnn \l_tmpa_seq { | } {#1} } -\cs_new_protected_nopar:Npn \__njudoc_split_m:n #1 - { - \tl_set:Nn \l_tmpa_str {#1} - \clist_map_inline:nn { *, /, (, ) } - { \str_remove_all:Nn \l_tmpa_str {##1} } - \seq_set_split:NnV \l_tmpa_seq { | } \l_tmpa_str - } -\group_begin: - \char_set_catcode_active:N \> - \cs_gset_protected:Npn \__ctxdoc_module_star:w #1 > #2 \q_stop - { - \__ctxdoc_output_module:nn - { \__njudoc_split_m:n {#1} } - { \__ctxdoc_module_push:n { \__njudoc_print_module:n { * } } } - \__ctxdoc_output_line:n {#2} - \__ctxdoc_star_format: - } - \cs_gset_protected:Npn \__ctxdoc_module_slash:w #1 > #2 \q_stop - { - \__ctxdoc_output_module:nn - { \__njudoc_split_m:n {#1} } - { \__ctxdoc_module_pop:n { \__njudoc_print_module:n { / } } } - \__ctxdoc_output_line:n {#2} - \__ctxdoc_slash_format: - } - \cs_gset_protected:Npn \__ctxdoc_module_pm:w #1 > #2 \q_stop - { - \tex_noindent:D - \hbox_overlap_left:n - { - \__ctxdoc_output_module:nn - { \__njudoc_split_pm:n {#1} } - { \__njudoc_print_module:n { } } - \skip_horizontal:n { \leftskip + \smallskipamount } - } - \group_begin: - \__ctxdoc_pm_format: - \__ctxdoc_output_line:n {#2} - \group_end: - } -\group_end: -\NewDocumentCommand \grd { m } - { \__ctxdoc_module_angle:n { \color { njuviolet } #1 } } -\NewDocumentCommand \sgrd { m } - { \__ctxdoc_module_angle:n { \color { star@guard } * \color{ c@guard } #1 } } -\NewDocumentCommand \pgrd { m } - { \__ctxdoc_module_angle:n { \color { #1 @guard } def- #1 } } -\ExplSyntaxOff -\makeatother +\PassOptionsToClass{codehigh}{njuthesis-doc} +\documentclass{njuthesis-doc} \begin{document} \DocInput{njuthesis.dtx} \PrintChanges @@ -339,6 +141,15 @@ To produce the documentation run the original source files ending with %</driver> % \fi % +% \title{\color{njuviolet}{The \cls{njuthesis} class\\ +% \textbf{南京大学学位论文模板}}} +% +% \author{南京大学 Linux 用户组 +% \thanks{E-mail: \href{mailto:git+nju-lug-email-3104-issue-@yaoge123.cn} +% {git+nju-lug-email-3104-issue-@yaoge123.cn}}} +% +% \date{v1.3.0 \quad 2023-06-06} +% % \changes{v0.1}{2021/09/04}{开始开发。} % \changes{v0.2}{2021/09/07}{初步搭建了可用的模板。} % \changes{v0.3}{2021/09/09}{使用自动构建工具进行测试。} @@ -373,15 +184,6 @@ To produce the documentation run the original source files ending with % \changes{v1.1}{2023/01/05}{适配2023届本科生毕业毕业论文(设计)规范。} % \changes{v1.1}{2023/01/05}{适配新版南大 \LaTeX 在线编辑器。} % -% \title{\color{njuviolet}{The \cls{njuthesis} class\\ -% \textbf{南京大学学位论文模板}}} -% -% \author{南京大学 Linux 用户组 -% \thanks{E-mail: \href{mailto:git+nju-lug-email-3104-issue-@yaoge123.cn} -% {git+nju-lug-email-3104-issue-@yaoge123.cn}}} -% -% \date{v1.2.1 \quad 2023-05-03} -% % \maketitle % % \let\abstractname\relax @@ -1386,12 +1188,15 @@ To produce the documentation run the original source files ending with % 院系。 % \end{function} % -% \begin{function}[updated=2021-10-01]{info/major,info/major*} +% \begin{function}[updated=2023-05-11]{info/major,info/major*} % \begin{syntax} % \OPT{major} = \Arg{专业} +% \OPT{major} = \Arg{专业,专业全称} % \OPT{major*} = \Arg{专业} % \end{syntax} -% 专业。 +% 专业。研究生的专业型学位封面上,“专业学位类别(领域)”一栏默认会补全为 +% “专业硕/博士(\meta{专业})”。如果希望覆盖模板的自动处理, +% 可以填写 \opt{info/major} 第二种写法的“专业全称”字段。 % \end{function} % % \begin{function}[updated=2021-10-01]{info/field,info/field*} @@ -1469,7 +1274,7 @@ To produce the documentation run the original source files ending with % % \begin{function}[updated=2021-10-01]{info/secret-level} % \begin{syntax} -% \OPT{secret-level} = <不涉密|秘密|机密|绝密> +% \OPT{secret-level} = \Arg{密级} % \end{syntax} % 研究生学位论文封面上的密级。 % \end{function} @@ -1489,13 +1294,13 @@ To produce the documentation run the original source files ending with % \end{function} % % \begin{function}[added=2023-04-24]{info/degree,info/degree*} - % \begin{syntax} - % \OPT{degree} = \Arg{中文学位名} - % \OPT{degree*} = \Arg{英文学位名} - % \end{syntax} - % 研究生国家图书馆封面英文封面上的学位名称。默认会由模板通过 \opt{degree} - % 和 \opt{type} 文档类选项生成,也可以由本选项自定义名称。 - % \end{function} +% \begin{syntax} +% \OPT{degree} = \Arg{中文学位名} +% \OPT{degree*} = \Arg{英文学位名} +% \end{syntax} +% 研究生国家图书馆封面英文封面上的学位名称。默认会由模板通过 \opt{degree} +% 和 \opt{type} 文档类选项生成,也可以由本选项自定义名称。 +% \end{function} % % % \subsubsection{输入示范} @@ -1548,6 +1353,11 @@ To produce the documentation run the original source files ending with % supervisor* = {Professor Li Chengdian}, % submit-date = {2021-09-12}, % defend-date = {2022-01-15}, +% clc = {0175.2}, +% udc = {004.72}, +% secret-level = {公开}, +% chairman = {张~教授}, +% reviewer = {王~教授,赵~副教授,李~助理研究员}, % email = {git+nju-lug-email-3104-issue-@yaoge123.cn} % } % \end{latexexample} @@ -1559,12 +1369,7 @@ To produce the documentation run the original source files ending with % \njusetup[info]{ % confer-date = {2022-05-20}, % bottom-date = {2022-05-21}, -% chairman = {张晓山~教授}, -% reviewer = {王瑞希~教授,郭德纲~副教授,华芈库~教授,戴菲菲~教授}, -% clc = {0175.2}, -% secret-level = {限制}, -% udc = {004.72}, -% supervisor-contact = {拉太赫科学与技术学院 枝江市结丘路 19 号 114514} +% supervisor-contact = {化学化工学院 仙林大道 163 号 210046} % } % \end{latexexample} % @@ -1870,16 +1675,24 @@ To produce the documentation run the original source files ending with % 定理计数器范围。 % \end{function} % +% \begin{function}[added=2023-05-07]{theorem/share-counter} +% \begin{syntax} +% \OPT{share-counter} = <\TFF> +% \end{syntax} +% 是否共享计数器。 +% \end{function} +% % 模板的默认设置等效于 % % \begin{latexexample}[moretexcs={\njusetup,\bfseries,\itshape,\mdlgwhtsquare}, % emph={[2]theorem},emph={[3]style,header-font,body-font,qed-symbol,counter}] % \njusetup[theorem]{ -% style = plain, -% header-font = \normalfont \bfseries , -% body-font = \itshape , -% qed-symbol = \ensuremath { \mdlgwhtsquare }, -% counter = chapter +% style = plain, +% header-font = \normalfont \bfseries , +% body-font = \itshape , +% qed-symbol = \ensuremath { \mdlgwhtsquare }, +% counter = chapter, +% share-counter = false % } % \end{latexexample} % @@ -1926,12 +1739,14 @@ To produce the documentation run the original source files ending with % \opt{theorem/type} 保存的列表以及前方的样式设置并创建相应环境。 % 这也就意味着该选项在 \opt{theorem/type} 为空时会报错。 % -% 在下面这个例子中,我们先创建了预置的七种环境,随后将定理内部文字字体改为 +% 在下面这个例子中,我们先创建了预置的七种环境。除了无编号的 +% \env{proof},其余六种共用一个计数器。随后我们将定理内部文字字体改为 % 宋体,定义了 \env{exercise} 和 \env{solution} 两种定理环境,后者没有编号。 % % \begin{latexexample}[moretexcs={\njusetup,\normalfont}, % emph={[2]theorem},emph={[3]define,body-font,type}] % \njusetup[theorem]{ +% share-counter = true , % define , % body-font = \normalfont , % type = { @@ -2923,10 +2738,10 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_@@_today_tl} +% \begin{variable}{\c_@@_name_today_tl} % 编译当天日期,格式为 |yyyy-mm-dd|。 % \begin{macrocode} -\tl_const:Nx \c_@@_today_tl +\tl_const:Nx \c_@@_name_today_tl { \int_to_arabic:n { \c_sys_year_int } - \int_to_arabic:n { \c_sys_month_int } - @@ -3015,11 +2830,11 @@ To produce the documentation run the original source files ending with % 用来定义默认名称的辅助函数。 % \begin{macrocode} \cs_new_protected:Npn \@@_define_name:nn #1#2 - { \tl_const:cn { c_@@_name_ #1 _tl } { #2 } } + { \tl_const:cn { c_@@_name_ #1 _tl } {#2} } \cs_new_protected:Npn \@@_define_name:nnn #1#2#3 { - \tl_const:cn { c_@@_name_ #1 _tl } { #2 } - \tl_const:cn { c_@@_name_ #1 _en_tl } { #3 } + \tl_const:cn { c_@@_name_ #1 _tl } {#2} + \tl_const:cn { c_@@_name_ #1 _en_tl } {#3} } % \end{macrocode} % \end{macro} @@ -3028,7 +2843,7 @@ To produce the documentation run the original source files ending with % 用来定义默认样式的辅助函数。 % \begin{macrocode} \cs_new_protected:Npn \@@_define_fmt:nn #1#2 - { \tl_const:cn { c_@@_fmt_ #1 _tl } { #2 } } + { \tl_const:cn { c_@@_fmt_ #1 _tl } {#2} } % \end{macrocode} % \end{macro} % @@ -3036,9 +2851,9 @@ To produce the documentation run the original source files ending with % 用来定义默认间距的辅助函数。 % \begin{macrocode} \cs_new_protected:Npn \@@_define_dim:nn #1#2 - { \dim_const:cn { c_@@_ #1 _dim } { #2 } } + { \dim_const:cn { c_@@_ #1 _dim } {#2} } \cs_new_protected:Npn \@@_define_skip:nn #1#2 - { \skip_const:cn { c_@@_ #1 _skip } { #2 } } + { \skip_const:cn { c_@@_ #1 _skip } {#2} } % \end{macrocode} % \end{macro} % @@ -3064,9 +2879,9 @@ To produce the documentation run the original source files ending with % \tn{baselineskip},抛弃 \cs{l__ctex_font_size_tl} 中的第二个值。 % \begin{macrocode} \cs_new:Npn \@@_fontsize:nn #1#2 - { \fontsize { #1 } { #2 } \selectfont } + { \fontsize {#1} {#2} \selectfont } \cs_new:Npn \@@_fontsize:nnn #1#2#3 - { \@@_fontsize:nn { #1 } { \fp_to_decimal:n { #3 * #1 } } } + { \@@_fontsize:nn {#1} { \fp_to_decimal:n { #3 * #1 } } } % \end{macrocode} % \end{macro} % @@ -3079,9 +2894,9 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new:Npn \@@_zihao:nn #1#2 { - \prop_get:NnNTF \c__ctex_font_size_prop { #2 } \l__ctex_font_size_tl - { \exp_after:wN \@@_fontsize:nnn \l__ctex_font_size_tl { #1 } } - { \msg_error:nnn { ctex } { fontsize } { #2 } } + \prop_get:NnNTF \c__ctex_font_size_prop {#2} \l__ctex_font_size_tl + { \exp_after:wN \@@_fontsize:nnn \l__ctex_font_size_tl {#1} } + { \msg_error:nnn { ctex } { fontsize } {#2} } } % \end{macrocode} % 默认行距倍数为 1.3。 @@ -3099,8 +2914,8 @@ To produce the documentation run the original source files ending with \cs_new:Npo \@@_set_ccglue:n #1 { \sys_if_engine_xetex:TF - { \skip_set:Nn \l__ctex_ccglue_skip { #1 } } - { \ltjsetparameter { kanjiskip = { #1 } } } + { \skip_set:Nn \l__ctex_ccglue_skip {#1} } + { \ltjsetparameter { kanjiskip = {#1} } } } % \end{macrocode} % \end{macro} @@ -3116,9 +2931,9 @@ To produce the documentation run the original source files ending with \cs_new_protected:Npn \@@_box_ulined:NN #1#2 { \mode_leave_vertical: - \rule [ \c_@@_ruledpi_dim ] { #1 } { \c_@@_rulehti_dim } + \rule [ \c_@@_ruledpi_dim ] {#1} { \c_@@_rulehti_dim } \skip_horizontal:n { -#1 } - \hbox_to_wd:nn { #1 } { \tex_hfil:D #2 \tex_hfil:D } + \hbox_to_wd:nn {#1} { \tex_hfil:D #2 \tex_hfil:D } } \cs_generate_variant:Nn \@@_box_ulined:NN { Nc } % \end{macrocode} @@ -3132,32 +2947,39 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_box_spread:NNn,\@@_box_spread:NNv,\@@_box_spread:NNx} +% \begin{macro}{\@@_box_spread:NNNn} % \changes{v0.19}{2022/05/16}{对超出盒子宽度的文字进行水平压缩。} % 分散对齐的水平盒子,拉伸算法来自 \cls{fduthesis}。 % 在文字宽度小于给定宽度时,在字符中间填补 \tn{hfil} 以增大字距。 % 在文字宽度超出限制时,进行整体水平压缩。 % \begin{arguments} +% \item 临时 |dim| 型变量 % \item 宽度,|dim| 型变量 % \item 格式 % \item 内容,不可带有格式 % \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_box_spread:NNn #1#2#3 +\cs_new_protected:Npn \@@_box_spread:NNNn #1#2#3#4 { \mode_leave_vertical: - \@@_get_width:Nn \l_@@_tmp_skip { #2 #3 } - \hbox_to_wd:nn { #1 } + \@@_get_width:Nn #1 { #3 #4 } + \hbox_to_wd:nn {#2} { - \dim_compare:nTF { \l_@@_tmp_skip > #1 } + \dim_compare:nTF { #1 > #2 } { \tex_hfil:D \scalebox - { \dim_to_decimal_in_unit:nn { #1 } { \l_@@_tmp_skip } } - [ 1.0 ] { #2 #3 } \tex_hfil:D + { \dim_to_decimal_in_unit:nn {#2} {#1} } + [ 1.0 ] { #3 #4 } \tex_hfil:D } - { #2 \tl_map_inline:nn { #3 } { ##1 \tex_hfil:D } \tex_unskip:D } + { #3 \tl_map_inline:nn {#4} { ##1 \tex_hfil:D } \tex_unskip:D } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_box_spread:NNn,\@@_box_spread:NNv,\@@_box_spread:NNx} +% \begin{macrocode} +\cs_new:Npn \@@_box_spread:NNn { \@@_box_spread:NNNn \l_@@_tmp_skip } \cs_generate_variant:Nn \@@_box_spread:NNn { NNv } \cs_generate_variant:Nn \@@_box_spread:NNn { NNx } % \end{macrocode} @@ -3184,32 +3006,37 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_box_multiline:NNNn,\@@_box_multiline:NNn} +% \begin{macro}{\@@_box_multiline:NNNNn} % 多行固定长度的下划线内容。 % \begin{arguments} % \item 用于存储条目数量的 |int| 型变量 +% \item 用于存储条目内容的 |tl| 型变量 % \item 内容,|clist| 型变量 % \item 宽度,|dim| 型变量 % \item 条目数量 % \end{arguments} % 默认绘制 4 条下划线。在评阅者人数超过 4 人时添加额外的条目。 % \begin{macrocode} -\cs_new_protected:Npn \@@_box_multiline:NNNn #1#2#3#4 +\cs_new_protected:Npn \@@_box_multiline:NNNNn #1#2#3#4#5 { - \int_set:Nn #1 { \int_max:nn { \clist_count:N #2 } { #4 } } - \int_step_inline:nn { #1 } + \int_set:Nn #1 { \int_max:nn { \clist_count:N #3 } {#5} } + \int_step_inline:nn {#1} { - \clist_pop:NN #2 \l_@@_tmpa_tl % \end{macrocode} % \changes{v1.1}{2022/11/29}{修复空返回值在国家图书馆封面引发的死循环。} % 防止空的返回值引发死循环。 % \begin{macrocode} - \quark_if_no_value:NT \l__nju_tmpa_tl - { \tl_set_eq:NN \l_@@_tmpa_tl \c_empty_tl } - \@@_box_ulined:NN #3 \l_@@_tmpa_tl \tex_par:D + \clist_pop:NNF #3 #2 { \tl_set_eq:NN #2 \c_empty_tl } + \@@_box_ulined:NN #4 #2 \tex_par:D } } -\cs_new:Npn \@@_box_multiline:NNn { \@@_box_multiline:NNNn \l_@@_tmpa_int } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_box_multiline:NNn} +% \begin{macrocode} +\cs_new:Npn \@@_box_multiline:NNn + { \@@_box_multiline:NNNNn \l_@@_tmpa_int \l_@@_tmpa_tl } % \end{macrocode} % \end{macro} % @@ -3222,7 +3049,7 @@ To produce the documentation run the original source files ending with \cs_new_protected:Npn \@@_uline:n #1 { \mode_leave_vertical: - \rule [ \c_@@_ruledpi_dim ] { #1 } { \c_@@_rulehti_dim } + \rule [ \c_@@_ruledpi_dim ] {#1} { \c_@@_rulehti_dim } \skip_horizontal:n { -#1 } } % \end{macrocode} @@ -3237,9 +3064,9 @@ To produce the documentation run the original source files ending with \cs_new_protected:Npn \@@_uuline:N #1 { \mode_leave_vertical: - \rule [ \c_@@_ruledpii_dim ] { #1 } { \c_@@_rulehtii_dim } + \rule [ \c_@@_ruledpii_dim ] {#1} { \c_@@_rulehtii_dim } \skip_horizontal:n { -#1 } - \rule [ \c_@@_ruledpiii_dim ] { #1 } { \c_@@_rulehtii_dim } + \rule [ \c_@@_ruledpiii_dim ] {#1} { \c_@@_rulehtii_dim } \skip_horizontal:n { -#1 } } % \end{macrocode} @@ -3300,7 +3127,7 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_get_width_print:Nn #1#2 { - \@@_get_width:Nn #1 { #2 } + \@@_get_width:Nn #1 {#2} \dim_set:Nn #1 { \textwidth - #1 } #2 } \cs_generate_variant:Nn \@@_get_width_print:Nn { Nv } @@ -3318,7 +3145,7 @@ To produce the documentation run the original source files ending with \cs_new_protected:Npn \@@_uline_entry:Nn #1#2 { \@@_get_width_print:Nv #1 { c_@@_name_ #2 _tl } - \@@_box_ulined_info:Nn #1 { #2 } + \@@_box_ulined_info:Nn #1 {#2} } % \end{macrocode} % \end{macro} @@ -3334,7 +3161,7 @@ To produce the documentation run the original source files ending with { \@@_get_width_print:Nv #1 { c_@@_name_ #2 _tl } \dim_sub:Nn #1 { \textwidth / 2 } - \@@_box_ulined_info:Nn #1 { #2 } + \@@_box_ulined_info:Nn #1 {#2} } % \end{macrocode} % \end{macro} @@ -3354,40 +3181,29 @@ To produce the documentation run the original source files ending with % 其中,变量类型 |w| 表明参数符合特定语法格式,其参数必须经过完全展开。 % \begin{macrocode} \cs_new:Npn \@@_date:www #1-#2-#3 \q_stop - { \__zhnum_date_aux:nnn { #1 } { #2 } { #3 } } + { \__zhnum_date_aux:nnn {#1} {#2} {#3} } \cs_new:Npn \@@_date_en:www #1-#2-#3 \q_stop - { \clist_item:Nn \c_@@_name_month_en_clist { #2 } ~#3 , ~#1 } + { \clist_item:Nn \c_@@_name_month_en_clist {#2} ~#3 , ~#1 } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_date:n,\@@_date_en:n} -% 从 ISO 格式的日期字符串生成中英文日期文本。 +% \begin{macro}{\@@_date:nn} % \begin{macrocode} -\cs_new_protected:Npn \@@_date:n #1 { \@@_date:nn { #1 } { } } -\cs_new_protected:Npn \@@_date_en:n #1 { \@@_date:nn { #1 } { _en } } +\cs_new:Npn \@@_date:nn { \@@_date:nnn { } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\exp_last_unbraced:cV,\@@_date:nn} +% \begin{macro}{\@@_date:nnn} % \changes{v0.20}{2022/05/24}{可在日期项留空以使用空白的年月日字样。} % 用于日期格式转化的辅助命令。在传入的字符串为空时生成空白字样。 % \begin{macrocode} -\cs_generate_variant:Nn \exp_last_unbraced:NV { cV } -\cs_new_protected:Npn \@@_date:nn #1#2 +\cs_new:Npn \@@_date:nnn #1#2#3 { - \tl_set:Nv \l_@@_tmpa_tl { g_@@_info_ #1 date_raw_tl } - \tl_new:c { g_@@_info_ #1 date #2 _tl } - \tl_set:cx { g_@@_info_ #1 date #2 _tl } + \tl_set:cx { g_@@_info_ #2 date #1 _tl } { - \tl_if_empty:NTF \l_@@_tmpa_tl - { \@@_name:n { blankdate #2 } } -% \end{macrocode} -% |w| 后的参数需要使用非括号包裹的形式完全展开。 -% \begin{macrocode} - { - \exp_last_unbraced:cV { @@_date #2 :www } - \l_@@_tmpa_tl \q_stop - } + \tl_if_empty:nTF {#3} + { \@@_name:n { blankdate #1 } } + { \use:c { @@_date #1 :www } #3 \q_stop } } } % \end{macrocode} @@ -3397,7 +3213,7 @@ To produce the documentation run the original source files ending with % 封装 \LaTeX{} 的钩子管理机制,等效于 \tn{AtBeginDocument}。 % \begin{macrocode} \cs_new_protected:Npn \@@_at_begin_document:n #1 - { \hook_gput_next_code:nn { begin document } { #1 } } + { \hook_gput_next_code:nn { begin document } {#1} } % \end{macrocode} % \end{macro} % @@ -3526,7 +3342,7 @@ To produce the documentation run the original source files ending with % 这里需要存储 \tn{prevdepth} 的值,以使 \tn{parbox} 后行距正确。 % \footnote{\url{https://tex.stackexchange.com/q/34971/}} % \begin{macrocode} - \parbox [ t ] { #3 } + \parbox [ t ] {#3} { \c_@@_fmt_covertitle_tl \@@_uline_title: \dim_gset_eq:NN \l_@@_tmpa_dim \tex_prevdepth:D @@ -3550,8 +3366,8 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_cover_entry:NNNNn #1#2#3#4#5 { - \@@_box_spread_name:NNn #2 #4 { #5 } #1 - \@@_box_ulined_info:Nn #3 { #5 } \tex_par:D + \@@_box_spread_name:NNn #2 #4 {#5} #1 + \@@_box_ulined_info:Nn #3 {#5} \tex_par:D } \cs_new:Npn \@@_cover_entry:NNNn { \@@_cover_entry:NNNNn \@@_hskip: } % \end{macrocode} @@ -3569,10 +3385,10 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_cover_entry:NNNnn #1#2#3#4#5 { - \@@_box_spread_name:NNn #1 #3 { #4 } \@@_hskip: - \@@_box_ulined_info:Nn #2 { #4 } \@@_hskip: - \@@_box_spread_name:NNn #1 #3 { #5 } \@@_hskip: - \@@_box_ulined_info:Nn #2 { #5 } \tex_par:D + \@@_box_spread_name:NNn #1 #3 {#4} \@@_hskip: + \@@_box_ulined_info:Nn #2 {#4} \@@_hskip: + \@@_box_spread_name:NNn #1 #3 {#5} \@@_hskip: + \@@_box_ulined_info:Nn #2 {#5} \tex_par:D } % \end{macrocode} % \end{macro} @@ -3594,7 +3410,7 @@ To produce the documentation run the original source files ending with { \clist_item:cn { g_@@_info_ #4 _clist } { 1 } } \tl_set:Nn \l_@@_tmpb_tl { \clist_item:cn { g_@@_info_ #4 _clist } { 2 } } - \@@_box_spread_name:NNn #1 #3 { #4 } \@@_hskip: + \@@_box_spread_name:NNn #1 #3 {#4} \@@_hskip: \@@_box_ulined:NN #2 \l_@@_tmpa_tl \@@_hskip: \@@_box_spread_name:NNn #1 #3 { supvtitle } \@@_hskip: \@@_box_ulined:NN #2 \l_@@_tmpb_tl \tex_par:D @@ -3607,9 +3423,9 @@ To produce the documentation run the original source files ending with % 此时 \tn{njuemblem}、\tn{njuname} 和相关长度都是没有定义的。 % \begin{macrocode} \cs_new_protected:Npn \@@_emblem:N #1 - { \njuemblem [ \c_@@_fmt_emblemcolor_tl ] { #1 } { ! } } + { \njuemblem [ \c_@@_fmt_emblemcolor_tl ] {#1} { ! } } \cs_new_protected:Npn \@@_name:N #1 - { \njuname [ \c_@@_fmt_namecolor_tl ] { #1 } { ! } } + { \njuname [ \c_@@_fmt_namecolor_tl ] {#1} { ! } } % \end{macrocode} % \end{macro} % @@ -3623,7 +3439,7 @@ To produce the documentation run the original source files ending with { \phantomsection \@@_bookmark:Nnn \g_@@_abs_showentry_bool {#1} {#2} - \@@_chapter_header:n { #1 } + \@@_chapter_header:n {#1} } \cs_generate_variant:Nn \@@_abs_bookmark:nn { Vn } % \end{macrocode} @@ -3659,7 +3475,7 @@ To produce the documentation run the original source files ending with { \vbox_set:Nn \l_@@_tmpa_box { - \@@_get_width:Nn \tex_hangindent:D { #3 } + \@@_get_width:Nn \tex_hangindent:D {#3} \int_set:Nn \tex_hangafter:D { -1 } \skip_set_eq:NN \tex_leftskip:D #2 \skip_set_eq:NN \tex_rightskip:D \tex_leftskip:D @@ -3670,7 +3486,7 @@ To produce the documentation run the original source files ending with \int_gzero:N \l_@@_tmpa_int \@@_breakpar_loop:n { \int_gincr:N \l_@@_tmpa_int } } - \@@_breakpar_print:nn { #3 } + \@@_breakpar_print:nn {#3} { % \end{macrocode} % 在使用自然断行算法后,研究生的摘要标题可选择 \opt{strict} @@ -3900,6 +3716,13 @@ To produce the documentation run the original source files ending with requires~ loading~ the~ class~ with~ "ntheorem"~ option~ set~ to~ "true". } +\@@_msg:nn { missing-symbol } + { + \string\mdwhtsquare\ and~ \string\checkmark\ are~ not~ + contained~ in~ the~ standard~ amsmath~ package.~ You~ + should~ redefine~ them~ with~ other~ packages~ loaded~ + to~ properly~ generate~ the~ declaration~ page. + } \@@_msg:nn { missing-title } { Thesis~ title~ should~ not~ be~ left~ blank.\\ @@ -4117,7 +3940,7 @@ To produce the documentation run the original source files ending with \cs_new_protected:cpn { @@_loadpkg_ #2 : } { \bool_if:cT { g_@@_opt_load_ #2 _bool } - { \RequirePackage { #1 } } + { \RequirePackage {#1} } } \clist_put_right:Nn \g_@@_name_optional_pkg_clist {#1} } @@ -4240,10 +4063,10 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \NewDocumentCommand \njusetup { o m } { - \tl_if_novalue:nTF { #1 } - { \@@_keys_set:nn { nju } { #2 } } + \tl_if_novalue:nTF {#1} + { \@@_keys_set:nn { nju } {#2} } { - \tl_if_in:nnTF { #1 } { / } + \tl_if_in:nnTF {#1} { / } { \@@_keys_set:nn { nju } { #1 = {#2} } } { \@@_keys_set:nn { nju / #1 } {#2} } } @@ -4263,7 +4086,7 @@ To produce the documentation run the original source files ending with % 定义修改默认样式的接口。 % \begin{macrocode} \NewDocumentCommand \njusetformat { m m } - { \tl_gset:cn { c_@@_fmt_ #1 _tl } { #2 } } + { \tl_gset:cn { c_@@_fmt_ #1 _tl } {#2} } % \end{macrocode} % \end{macro} % @@ -4274,9 +4097,9 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \NewDocumentCommand \njusetlength { s m m } { - \bool_if:nTF { #1 } - { \skip_gset:cn { c_@@_ #2 _skip } { #3 } } - { \dim_gset:cn { c_@@_ #2 _dim } { #3 } } + \bool_if:nTF {#1} + { \skip_gset:cn { c_@@_ #2 _skip } {#3} } + { \dim_gset:cn { c_@@_ #2 _dim } {#3} } } % \end{macrocode} % \end{macro} @@ -4305,7 +4128,7 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_set_tokenlist:nnnnn #1#2#3#4#5 { - \bool_if:nTF { #1 } + \bool_if:nTF {#1} { \tl_set_eq:NN \l_@@_tmpb_tl \c_@@_name_suffix_en_tl } { \tl_clear:N \l_@@_tmpb_tl } \tl_gset:cn { c_@@_ #5 _ #2 #3 \l_@@_tmpb_tl _tl } {#4} @@ -4392,7 +4215,15 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \bool_if:NTF \g_@@_opt_load_um_bool { \RequirePackage { unicode-math } } - { \RequirePackage { amsmath } } + { + \RequirePackage { amsmath } + \bool_if:NT \g_@@_opt_decl_bool + { + \msg_warning:nn { njuthesis } { missing-symbol } + \cs_new:Npn \mdwhtsquare { } + \cs_new:Npn \checkmark { } + } + } % \end{macrocode} % % 载入各种宏包。 @@ -4466,7 +4297,7 @@ To produce the documentation run the original source files ending with % 检查宏包版本是否过时。 % \begin{macrocode} %<*class> -\cs_new_protected:Npn \@@_check_pkg_version:nnn #1#2#3 +\cs_new:Npn \@@_check_pkg_version:nnn #1#2#3 { \@ifpackagelater {#1} {#2} { } { \msg_error:nnnn { njuthesis } { package-too-old } {#1} {#3} } @@ -4491,9 +4322,9 @@ To produce the documentation run the original source files ending with % \item 产生冲突的宏包 % \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_check_pkg_conflict:nn #1#2 +\cs_new:Npn \@@_check_pkg_conflict:nn #1#2 { - \ctex_at_begin_package:nn { #2 } + \ctex_at_begin_package:nn {#2} { \msg_warning:nnnn { njuthesis } { package-conflict } {#1} {#2} } } % \end{macrocode} @@ -4508,7 +4339,7 @@ To produce the documentation run the original source files ending with amscd, amsfonts, amssymb, bbm, bm, eucal, eufrak, mathrsfs, newtxmath, upgreek } - { \@@_check_pkg_conflict:nn { unicode-math } { #1 } } + { \@@_check_pkg_conflict:nn { unicode-math } {#1} } } % \end{macrocode} % @@ -4538,8 +4369,8 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \clist_map_inline:Nn \g_@@_config_clist { - \msg_info:nnn { njuthesis } { load-config } { #1 } - \file_input:n { #1 } + \msg_info:nnn { njuthesis } { load-config } {#1} + \file_input:n {#1} } % \end{macrocode} % @@ -4585,18 +4416,33 @@ To produce the documentation run the original source files ending with % \end{macro} % % \begin{macro}{info/department,info/department*, -% info/major,info/major*,info/field,info/field*} +% info/major*,info/field,info/field*} % 院系、专业、方向。 % \begin{macrocode} department .tl_set:N = \g_@@_info_dept_tl , department* .tl_set:N = \g_@@_info_dept_en_tl , - major .tl_set:N = \g_@@_info_major_tl , major* .tl_set:N = \g_@@_info_major_en_tl , field .tl_set:N = \g_@@_info_field_tl , field* .tl_set:N = \g_@@_info_field_en_tl , % \end{macrocode} % \end{macro} % +% \begin{macro}{info/major} +% \changes{v1.3}{2023/05/11}{专业型研究生封面可额外修改专业名称。} +% 专业。 +% \begin{macrocode} + major .code:n = + { + \clist_pop:NN \l_keys_value_tl \g_@@_info_major_tl + \clist_pop:NNF \l_keys_value_tl \g_@@_info_majorc_tl + { + \tl_set:Nn \g_@@_info_majorc_tl + { 工程 \g_@@_info_type_tl( \g_@@_info_major_tl ) } + } + }, +% \end{macrocode} +% \end{macro} +% % \begin{macro}{info/supervisor,info/supervisor*} % \changes{v0.13}{2021/12/11}{修改了导师选项的变量名称。} % \changes{v0.14}{2022/01/12}{精简导师信息选项。} @@ -4615,43 +4461,7 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{info/submit-date} -% \changes{v0.14}{2022/01/14}{精简提交日期选项。} -% 提交日期,初始值为编译当天日期。 -% \begin{macrocode} - submit-date .tl_set:N = \g_@@_info_submitdate_raw_tl , - submit-date .initial:V = \c_@@_today_tl , -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/defend-date} -% \changes{v0.14}{2022/01/14}{精简答辩日期选项。} -% 答辩日期。 -% \begin{macrocode} - defend-date .tl_set:N = \g_@@_info_defenddate_raw_tl , - defend-date .initial:V = \c_@@_today_tl , -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/defend-date} -% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的学位授予日期设置项。} -% 学位授予日期。 -% \begin{macrocode} - confer-date .tl_set:N = \g_@@_info_conferdate_raw_tl , - confer-date .initial:V = \c_@@_today_tl , -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/bottom-date} -% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的底部日期设置项。} -% 底部日期。 -% \begin{macrocode} - bottom-date .tl_set:N = \g_@@_info_bottomdate_raw_tl , - bottom-date .initial:V = \c_@@_today_tl , -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/defend-date,info/chairman,info/reviewer} +% \begin{macro}{info/chairman,info/reviewer} % 答辩委员会信息。 % \begin{macrocode} chairman .tl_set:N = \g_@@_info_chairman_tl , @@ -4703,9 +4513,42 @@ To produce the documentation run the original source files ending with % 覆盖预定义的学位字段。 % \begin{macrocode} degree .tl_set:N = \g_@@_info_degree_tl , - degree* .tl_set:N = \g_@@_info_degree_en_tl + degree* .tl_set:N = \g_@@_info_degree_en_tl , +% \end{macrocode} +% \end{macro} +% +% 提交日期,初始值为编译当天日期。 +% \begin{macrocode} } % \end{macrocode} +% +% \changes{v1.3}{2023/05/18}{日期字段直接在输入键值时处理。} +% +% \begin{macro}{info/submit-date} +% \changes{v0.14}{2022/01/14}{精简提交日期选项。} +% \begin{macro}{info/defend-date} +% \changes{v0.14}{2022/01/14}{精简答辩日期选项。} +% \begin{macro}{info/confer-date} +% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的学位授予日期设置项。} +% \begin{macro}{info/bottom-date} +% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的底部日期设置项。} +% \begin{variable}{\g_@@_info_submitdate_tl,\g_@@_info_defenddate_tl, +% \g_@@_info_bottomdate_tl,\g_@@_info_conferdate_tl} +% 日期。 +% \begin{macrocode} +\clist_map_inline:nn { submit, defend, confer, bottom } + { + \keys_define:nn { nju / info } + { + #1-date .code:n = \@@_date:nn {#1} {##1}, + #1-date .initial:V = \c_@@_name_today_tl + } + } +% \end{macrocode} +% \end{variable} +% \end{macro} +% \end{macro} +% \end{macro} % \end{macro} % % 将指定信息项归入 \opt{anonymous} 组,以在盲审模式下选择性屏蔽。 @@ -4744,49 +4587,23 @@ To produce the documentation run the original source files ending with %</class> % \end{macrocode} % -% \begin{macrocode} -%<*(def-u|def-g|def-p)> -\ctex_at_end_preamble:n - { -% \end{macrocode} -% \begin{variable}{\g_@@_info_submitdate_tl} -% 将 ISO 格式的原始日期字符串格式化为中文日期表示。 -% \begin{macrocode} - \@@_date:n { submit } -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{ -% \g_@@_info_submitdate_en_tl, -% \g_@@_info_defenddate_tl} -% 英文提交日期以及答辩日期仅用于研究生封面。 +% \begin{variable}{\g_@@_info_submitdate_en_tl} +% 研究生封面额外需要英文日期。 % \begin{macrocode} %<*def-g> - \@@_date_en:n { submit } - \@@_date:n { defend } +\cs_set:Npn \@@_date:nn #1#2 + { \@@_date:nnn { } {#1} {#2} \@@_date:nnn { _en } {#1} {#2} } % \end{macrocode} % \end{variable} % -% \begin{variable}{ -% \g_@@_info_bottomdate_tl, -% \g_@@_info_conferdate_tl, -% \g_@@_info_confer_tl} -% 底部日期以及学位授予日期仅用于国家图书馆封面。 +% \begin{variable}{\g_@@_info_confer_tl} % \begin{macrocode} - \bool_if:NT \g_@@_opt_nlcover_bool - { - \@@_date:n { bottom } - \@@_date:n { confer } - \tl_new:N \g_@@_info_confer_tl - \tl_set:Nn \g_@@_info_confer_tl - { - \textbf { \c_@@_name_nju_tl } \hfil - \g_@@_info_conferdate_tl - } - } -%</def-g> +\tl_new:N \g_@@_info_confer_tl +\tl_set:Nn \g_@@_info_confer_tl + { + \textbf { \c_@@_name_nju_tl } \hfil + \g_@@_info_conferdate_tl } -%</(def-u|def-g|def-p)> % \end{macrocode} % \end{variable} % @@ -4796,7 +4613,6 @@ To produce the documentation run the original source files ending with % \begin{variable}{\g_@@_info_type_tl} % 文档类型字样。 % \begin{macrocode} -%<*def-g> \tl_new:N \g_@@_info_type_tl \tl_set:Nx \g_@@_info_type_tl { \clist_item:Nn \c_@@_name_type_clist { \g_@@_info_type_int } } @@ -4867,7 +4683,7 @@ To produce the documentation run the original source files ending with { \__fontspec_main_setmainfont:nn { } { Times~New~Roman } \__fontspec_main_setsansfont:nn { } { Arial } - \__fontspec_main_setmonofont:nn { Scale = MatchLowercase } { #1 } + \__fontspec_main_setmonofont:nn { Scale = MatchLowercase } {#1} } \cs_new_protected:Npn \@@_loadfont_latin_win: { \@@_loadfont_latin:n { Courier~New } } @@ -4929,25 +4745,26 @@ To produce the documentation run the original source files ending with % \begin{macro}{\@@_hide_no_script_msg:} % 隐藏 |does not contain script "CJK"| 警告。 % \begin{macrocode} -\cs_new_protected:Npn \@@_hide_no_script_msg: +\cs_new:Npn \@@_hide_no_script_msg: { \msg_redirect_name:nnn { fontspec } { no-script } { info } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_loadfont_cjk_win:} +% \begin{macro}{\@@_loadfont_cjk_win:N,\@@_loadfont_cjk_win:} % Windows 中文字体。 % \begin{macrocode} -\cs_new_protected:Npn \@@_loadfont_cjk_win: +\cs_new:Npn \@@_loadfont_cjk_win:N #1 { - \setCJKmainfont { SimSun } - [ \c_@@_name_fakebold_tl, ItalicFont = KaiTi ] - \setCJKsansfont { SimHei } [ \c_@@_name_fakebold_tl ] - \setCJKmonofont { FangSong } [ \c_@@_name_fakebold_tl ] - \setCJKfamilyfont { zhsong } { SimSun } [ \c_@@_name_fakebold_tl ] - \setCJKfamilyfont { zhhei } { SimHei } [ \c_@@_name_fakebold_tl ] - \setCJKfamilyfont { zhfs } { FangSong } [ \c_@@_name_fakebold_tl ] - \setCJKfamilyfont { zhkai } { KaiTi } [ \c_@@_name_fakebold_tl ] + \setCJKmainfont { SimSun } [ #1, ItalicFont = KaiTi ] + \setCJKsansfont { SimHei } [#1] + \setCJKmonofont { FangSong } [#1] + \setCJKfamilyfont { zhsong } { SimSun } [#1] + \setCJKfamilyfont { zhhei } { SimHei } [#1] + \setCJKfamilyfont { zhfs } { FangSong } [#1] + \setCJKfamilyfont { zhkai } { KaiTi } [#1] } +\cs_new:Npn \@@_loadfont_cjk_win: + { \@@_loadfont_cjk_win:N \c_@@_name_fakebold_tl } % \end{macrocode} % \end{macro} % @@ -5023,9 +4840,9 @@ To produce the documentation run the original source files ending with % \footnote{\XeTeX 的调整方法来自 \url{https://www.zhihu.com/question/46241367/answer/101660183}。} % \begin{macrocode} \sys_if_engine_xetex:T - { \xeCJKEditPunctStyle {quanjiao} { optimize-kerning = true } } + { \xeCJKEditPunctStyle { quanjiao } { optimize-kerning = true } } \sys_if_engine_luatex:T - { \defaultCJKfontfeatures { JFM = { zh_CN/{quanjiao,fzpr} } } } + { \defaultCJKfontfeatures { JFM = { zh_CN / { quanjiao, fzpr } } } } \setCJKmainfont { FZShuSong-Z01 } [ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ] \setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ] @@ -5107,7 +4924,7 @@ To produce the documentation run the original source files ending with % \changes{v1.2}{2023/04/30}{在研究生模板载入华文中宋。} % 研究生封面额外需要的华文中宋。 % \begin{macrocode} -\cs_new_protected:Npn \@@_loadfont_stzhongs: +\cs_new:Npn \@@_loadfont_stzhongs: { \fontspec_font_if_exist:nTF { 华文中宋 } { @@ -5131,7 +4948,7 @@ To produce the documentation run the original source files ending with \cs_new:Npn \@@_define_math_font:nn #1#2 { \cs_new:cpn { @@_loadfont_math_ #1 : } - { \__um_setmathfont:nn { } { #2 } } + { \__um_setmathfont:nn { } {#2} } } % \end{macrocode} % \end{macro} @@ -5512,7 +5329,7 @@ To produce the documentation run the original source files ending with % 封装 \pkg{hyperref} 的 PDF 书签命令。 % \begin{macrocode} \cs_new:Npn \@@_bookmark_pdf_nosec:nn #1#2 - { \pdfbookmark [0] { #1 } { #2 } } + { \pdfbookmark [0] {#1} {#2} } \cs_new:Npn \@@_bookmark_pdf:nn #1#2 { \phantomsection \@@_bookmark_pdf_nosec:nn {#1} {#2} } % \end{macrocode} @@ -5524,8 +5341,8 @@ To produce the documentation run the original source files ending with \cs_new:Npn \@@_bookmark:Nnn #1#2#3 { \bool_if:NTF #1 - { \_@@_bookmark_toc:n { #2 } } - { \_@@_bookmark_pdf_nosec:nn { #2 } { #3 } } + { \_@@_bookmark_toc:n {#2} } + { \_@@_bookmark_pdf_nosec:nn {#2} {#3} } } % \end{macrocode} % \end{macro} @@ -5535,9 +5352,9 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new:Npn \@@_chapter:Nnn #1#2#3 { - \chapter * { #2 } - \@@_bookmark:Nnn #1 { #2 } { #3 } - \@@_chapter_header:n { #2 } + \chapter * {#2} + \@@_bookmark:Nnn #1 {#2} {#3} + \@@_chapter_header:n {#2} } \cs_new:Npn \@@_chapter:n #1 { \@@_chapter:Nnn \c_true_bool {#1} { } } @@ -5553,7 +5370,7 @@ To produce the documentation run the original source files ending with \cs_new_protected:Npn \@@_chapter_header:n #1 { \bool_if:NTF \g_@@_opt_twoside_bool - { \markboth { #1 } { #1 } } + { \markboth {#1} {#1} } { \markboth { \hfill #1 \hfill } { } } } % \end{macrocode} @@ -5562,7 +5379,7 @@ To produce the documentation run the original source files ending with % \begin{macro}{\njuchapter} % 封装无编号章环境,供用户在正文中使用。 % \begin{macrocode} -\NewDocumentCommand \njuchapter { m } { \@@_chapter:n { #1 } } +\NewDocumentCommand \njuchapter { m } { \@@_chapter:n {#1} } % \end{macrocode} % \end{macro} % @@ -5609,7 +5426,7 @@ To produce the documentation run the original source files ending with { chapter/format = \c_@@_fmt_toctitle_tl } \@@_chapter:cnn { g_@@_ #2 _showentry_bool } {#1} {#2} \group_end: - \@starttoc { #2 } + \@starttoc {#2} } \cs_generate_variant:Nn \@@_make_toc:nn { vn } % \end{macrocode} @@ -5626,8 +5443,8 @@ To produce the documentation run the original source files ending with toc-entry .bool_set:c = { g_@@_ #3 _showentry_bool }, toc-entry .initial:n = true } - \exp_args:Nc \RenewDocumentCommand { #1 } { } - { \@@_make_toc:vn { #2 name } { #3 } } + \exp_args:Nc \RenewDocumentCommand {#1} { } + { \@@_make_toc:vn { #2 name } {#3} } } % \end{macrocode} % \end{macro} @@ -5763,7 +5580,7 @@ To produce the documentation run the original source files ending with \bool_if:NT \g_@@_opt_load_blx_bool { \NewDocumentCommand \addbibresource { m } - { \clist_gput_right:Nn \g_@@_blx_resource_clist { #1 } } + { \clist_gput_right:Nn \g_@@_blx_resource_clist {#1} } } % \end{macrocode} % \end{macro} @@ -5861,7 +5678,7 @@ To produce the documentation run the original source files ending with % \item 标签名 % \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_cref_name:n #1 +\cs_new:Npn \@@_cref_name:n #1 { \crefname {#1} { \@@_name:n {#1} } { \@@_name:n {#1} } } % \end{macrocode} % \end{macro} @@ -5880,7 +5697,7 @@ To produce the documentation run the original source files ending with % 修改 \pkg{cleveref} 的标签名称。 % \begin{macrocode} \clist_map_inline:nn { figure, table, appendix, proof } - { \@@_cref_name:n { #1 } } + { \@@_cref_name:n {#1} } } % \end{macrocode} % @@ -5984,7 +5801,7 @@ To produce the documentation run the original source files ending with { \group_begin: \bool_set_eq:NN \l__circledtext_negative_bool #1 - \__circledtext_handle:Vn \g_@@_fn_ctext_option_clist { #2 } + \__circledtext_handle:Vn \g_@@_fn_ctext_option_clist {#2} \group_end: } \cs_generate_variant:Nn \@@_fn_number_circled:Nn { NV } @@ -6143,6 +5960,13 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % +% \begin{macro}{\l_@@_thm_share_tl} +% 存储共享的计数器名称。 +% \begin{macrocode} +\tl_new:N \l_@@_thm_share_tl +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} \keys_define:nn { nju / theorem } { @@ -6185,6 +6009,15 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % +% \begin{macro}{theorem/share-counter} +% \changes{v1.3}{2023/05/07}{批量创建定理类环境时可以共享计数器。} +% 是否在分组内使用同一计数器。 +% \begin{macrocode} + share-counter .bool_set:N = \l_@@_thm_share_bool, + share-counter .initial:n = false, +% \end{macrocode} +% \end{macro} +% % \begin{macro}{theorem/define} % 创建定理类环境。 % \begin{macrocode} @@ -6193,21 +6026,30 @@ To produce the documentation run the original source files ending with { \clist_if_empty:NT \g_@@_thm_type_clist { \msg_error:nn { njuthesis } { empty-theorem-type } } + \tl_clear:N \l_@@_thm_share_tl \clist_map_inline:Nn \g_@@_thm_type_clist - { \@@_thm_define:nn ##1 } + { \@@_thm_define:Nnn \l_@@_thm_share_tl ##1 } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_thm_define:nn} +% \begin{macro}{\@@_thm_define:Nnn} % 配置定理环境。 % \begin{arguments} +% \item 共享的计数器名称,|tl| 型变量 % \item 环境名与类型标识,|clist| 型变量 % \item 定理头名称 % \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_thm_define:nn #1#2 +\cs_new:Npn \@@_thm_define:Nnn + { \@@_thm_define:NNNNnn \l_@@_tmp_clist \l_@@_tmpa_tl \l_@@_tmpb_tl } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_thm_define:NNNNnn} +% \begin{macrocode} +\cs_new:Npn \@@_thm_define:NNNNnn #1#2#3#4#5#6 { \bool_if:NF \g_@@_opt_load_nthm_bool { \msg_error:nn { njuthesis } { missing-ntheorem } } @@ -6218,19 +6060,30 @@ To produce the documentation run the original source files ending with % 拆分环境名与类型标识。这里是考虑到标识符不一定出现在环境名中, % 典型如 \env{proof} 环境默认无编号但也不含星号。 % \begin{macrocode} - \clist_set:Nn \l_@@_tmp_clist { #1 } - \clist_pop:NN \l_@@_tmp_clist \l_@@_tmpa_tl - \clist_pop:NN \l_@@_tmp_clist \l_@@_tmpb_tl + \clist_set:Nn #1 {#5} + \clist_pop:NN #1 #2 + \clist_pop:NN #1 #3 % \end{macrocode} % 判断是否需要证毕符号或编号。 % \begin{macrocode} - \tl_if_in:NnT \l_@@_tmpb_tl { + } + \tl_if_in:NnT #3 { + } { \exp_args:NV \theoremsymbol \l_@@_thm_qed_symbol_tl } - \tl_if_in:NnTF \l_@@_tmpb_tl { * } - { \@@_thm_new:VVn \l_@@_tmpa_tl \c_novalue_tl {#2} } - { \@@_thm_new:VVn \l_@@_tmpa_tl \l_@@_thm_counter_tl {#2} } + \tl_if_in:NnTF #3 { * } + { \@@_thm_new:VVVn #2 \c_novalue_tl #4 {#6} } + { \@@_thm_new:VVVn #2 \l_@@_thm_counter_tl #4 {#6} } +% \end{macrocode} +% 存储共享的计数器。 +% \begin{macrocode} + \bool_if:NT \l_@@_thm_share_bool + { + \tl_gset_eq:NN #4 #2 + \bool_gset_false:N \l_@@_thm_share_bool + } +% \end{macrocode} +% 设置 \pkg{cleveref} 引用名。 +% \begin{macrocode} \bool_if:NT \g_@@_opt_load_cref_bool - { \crefname { \l_@@_tmpa_tl } {#2} {#2} } + { \exp_args:NV \crefname #2 {#6} {#6} } % \end{macrocode} % 清除保存的证毕符号。 % \begin{macrocode} @@ -6239,7 +6092,7 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_thm_new:nnn,\@@_thm_new:VVn} +% \begin{macro}{\@@_thm_new:nnnn,\@@_thm_new:VVVn} % 包装 \tn{newtheorem} 以便展开输入的变量。根据 \file{interface3.pdf} % 手册 5.3 节最后一段建议的展开顺序,这里将 |V| 型参数放在靠前的位置。 % \begin{arguments} @@ -6250,17 +6103,21 @@ To produce the documentation run the original source files ending with % 根据环境结束命令是否存在可以判断该环境是否有定义, % 相应地可以利用局部定义切换定义和重定义环境的命令。 % \begin{macrocode} -\cs_new_protected:Npn \@@_thm_new:nnn #1#2#3 +\cs_new_protected:Npn \@@_thm_new:nnnn #1#2#3#4 { \group_begin: \cs_if_exist:cT { end #1 } { \cs_set_eq:NN \newtheorem \renewtheorem } \tl_if_novalue:nTF {#2} - { \newtheorem * {#1} {#3} } - { \newtheorem {#1} {#3} [#2] } + { \newtheorem * {#1} {#4} } + { + \tl_if_empty:nTF {#3} + { \newtheorem {#1} {#4} [#2] } + { \newtheorem {#1} [#3] {#4} } + } \group_end: } -\cs_generate_variant:Nn \@@_thm_new:nnn { VVn } +\cs_generate_variant:Nn \@@_thm_new:nnnn { VVVn } % \end{macrocode} % \end{macro} % @@ -6295,8 +6152,8 @@ To produce the documentation run the original source files ending with % 封装 \tn{unimathsetup}。 % \begin{macrocode} \bool_if:NTF \g_@@_opt_load_um_bool - { \cs_new:Npn \@@_um_setup:n #1 { \keys_set:nn { unicode-math } {#1} } } - { \cs_new:Npn \@@_um_setup:n #1 { } } + { \cs_new:Npn \@@_um_setup:n #1 { \keys_set:nn { unicode-math } {#1} } } + { \cs_new_eq:NN \@@_um_setup:n \use_none:n } % \end{macrocode} % \end{macro} % @@ -6451,26 +6308,30 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % +% \changes{v1.3}{2023/05/22}{禁用 \pkg{unicode-math} 时不配置数学字体。} % 在 |\begin{document}| 处载入字体以兼容 \pkg{mathtools}, % 并设置小于等于号和实部符号等的样式。 % \begin{macrocode} -\@@_at_begin_document:n +\bool_if:NT \g_@@_opt_load_um_bool { - \use:c { @@_loadfont_math_ \g_@@_font_math_tl : } - \bool_if:NT \g_@@_opt_math_leq_bool - { - \cs_set_eq:NN \le \leqslant - \cs_set_eq:NN \ge \geqslant - \cs_set_eq:NN \leq \leqslant - \cs_set_eq:NN \geq \geqslant - } - \bool_if:NT \g_@@_opt_math_re_bool + \@@_at_begin_document:n { - \cs_set:Npn \Re { \operatorname { Re } } - \cs_set:Npn \Im { \operatorname { Im } } + \use:c { @@_loadfont_math_ \g_@@_font_math_tl : } + \bool_if:NT \g_@@_opt_math_leq_bool + { + \cs_set_eq:NN \le \leqslant + \cs_set_eq:NN \ge \geqslant + \cs_set_eq:NN \leq \leqslant + \cs_set_eq:NN \geq \geqslant + } + \bool_if:NT \g_@@_opt_math_re_bool + { + \cs_set:Npn \Re { \operatorname { Re } } + \cs_set:Npn \Im { \operatorname { Im } } + } + \bool_if:NT \g_@@_opt_math_vec_bool + { \cs_set_eq:NN \vec \symbf } } - \bool_if:NT \g_@@_opt_math_vec_bool - { \cs_set_eq:NN \vec \symbf } } %</class> % \end{macrocode} @@ -6523,12 +6384,13 @@ To produce the documentation run the original source files ending with % \end{macro} % % \begin{macro}{u/cover/info} +% \changes{v1.3}{2023/05/25}{将本科生封面信息恢复至 v1.1 的宋体格式。} % 本科生封面信息栏实例。 % \begin{macrocode} \@@_declare_element:nn { u / cover / info } { content = \@@_u_cover_info:, - format = \zihao { 3 } \kaishu + format = \zihao { 3 } } % \end{macrocode} % \end{macro} @@ -6564,10 +6426,10 @@ To produce the documentation run the original source files ending with % % \begin{macro}{\@@_u_cover_info:} % \begin{macrocode} -\cs_new_protected:Npn \@@_u_cover_info: +\cs_new:Npn \@@_u_cover_info: { \@@_u_cover_info:NNNN \c_@@_clabelwd_dim \c_@@_crulewd_dim - \c_@@_hsep_dim \c_empty_tl + \c_@@_hsep_dim \kaishu } % \end{macrocode} % \end{macro} @@ -6737,14 +6599,17 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_g_cover_info:NNNN} +% \begin{macro}{\@@_g_cover_info:NNNNN} % 研究生封面中部信息栏。 % \begin{macrocode} -\cs_new_protected:Npn \@@_g_cover_info:NNNN #1#2#3#4 +\cs_new_protected:Npn \@@_g_cover_info:NNNNN #1#2#3#4#5 { - \@@_cover_entry_title:NNNN #1 #2 #3 #4 - \clist_map_inline:nn { author, major, field, supvfull } - { \@@_cover_entry:NNNNn #1 #2 #3 #4 { ##1 } } + \bool_if:NTF \g_@@_opt_academic_bool + { \clist_set:Nn #1 { author, major, field, supvfull } } + { \clist_set:Nn #1 { author, majorc, field, supvfull } } + \@@_cover_entry_title:NNNN #2 #3 #4 #5 + \clist_map_inline:Nn #1 + { \@@_cover_entry:NNNNn #2 #3 #4 #5 { ##1 } } } % \end{macrocode} % \end{macro} @@ -6754,7 +6619,7 @@ To produce the documentation run the original source files ending with \cs_new:Npn \@@_g_cover_info: { \tl_set:Nn \l_@@_tmpa_tl { \skip_horizontal:n { .7 cm } } - \@@_g_cover_info:NNNN \l_@@_tmpa_tl + \@@_g_cover_info:NNNNN \l_@@_tmpa_clist \l_@@_tmpa_tl \c_@@_clabelwd_dim \c_@@_crulewd_dim \c_@@_fmt_coverlabel_tl } % \end{macrocode} @@ -6797,7 +6662,7 @@ To produce the documentation run the original source files ending with \@@_cover_entry:NNNNn \c_empty_tl #1 #2 #3 { chairman } \tex_par:D \@@_box_spread_name:NNn #1 #3 { reviewer } - \parbox [ t ] { #2 } + \parbox [ t ] {#2} { \@@_box_multiline:NNn \g_@@_info_reviewer_clist #2 { 5 } \dim_gset_eq:NN \l_@@_tmpa_dim \tex_prevdepth:D @@ -7159,20 +7024,21 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \@@_declare_element:nn { g / decl / auth / date } { - content = \@@_authdecl_secretlv_g:, + content = \@@_g_decl_auth_secretlv:, format = \zihao { 5 } , align = l } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_degree_checkbox:Nn} +% \begin{macro}{\@@_degree_checkbox:nn} +% \changes{v1.3}{2023/06/04}{修复研究生出版授权书的打勾机制。} % 信息栏的学位复选框。打勾符号对应 |U+2713|。 % \begin{macrocode} -\cs_new_protected:Npn \@@_degree_checkbox:Nn #1#2 +\cs_new_protected:Npn \@@_degree_checkbox:nn #1#2 { \bool_lazy_and:nnTF - { \g_@@_opt_academic_bool && #1 } + { #1 \g_@@_opt_academic_bool } { \int_compare_p:n { \g_@@_info_type_int = #2 } } { \makebox [ 0 pt ] [l] { \ensuremath { \mdwhtsquare } } @@ -7200,13 +7066,13 @@ To produce the documentation run the original source files ending with \c_@@_name_ida_tl & \g_@@_info_id_tl & \c_@@_name_depta_tl & \g_@@_info_dept_tl & \c_@@_name_year_tl & - \tl_range:Nnn \g_@@_info_submitdate_raw_tl {1} {4} \\ + \tl_range:Nnn \g_@@_info_submitdate_tl {1} {4} \\ \c_@@_name_degreea_tl & { - \@@_degree_checkbox:Nn \c_true_bool { 2 } 学术学位硕士 \qquad - \@@_degree_checkbox:Nn \c_false_bool { 2 } 专业学位硕士 \\ - \@@_degree_checkbox:Nn \c_true_bool { 3 } 学术学位博士 \qquad - \@@_degree_checkbox:Nn \c_false_bool { 3 } 专业学位博士 + \@@_degree_checkbox:nn { } { 2 } 学术学位硕士 \qquad + \@@_degree_checkbox:nn { ! } { 2 } 专业学位硕士 \\ + \@@_degree_checkbox:nn { } { 3 } 学术学位博士 \qquad + \@@_degree_checkbox:nn { ! } { 3 } 专业学位博士 } \\ \c_@@_name_email_tl & \g_@@_info_email_tl \\ \c_@@_name_supvb_tl & @@ -7229,10 +7095,10 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_authdecl_secretlv_g:} +% \begin{macro}{\@@_g_decl_auth_secretlv:} % 保密信息内容。 % \begin{macrocode} -\cs_new_protected:Npn \@@_authdecl_secretlv_g: +\cs_new_protected:Npn \@@_g_decl_auth_secretlv: { \c_@@_name_secretstatus_tl \tex_par:D \ensuremath { \mdwhtsquare } \c_@@_name_secretfree_tl \tex_par:D @@ -7485,6 +7351,7 @@ To produce the documentation run the original source files ending with { element = { title, top, middle, emblem-img, bottom }, prefix = g / cover-en /, + format = \linespread { 1.3 }, top-skip = 0 pt plus 1.2 fil } % \end{macrocode} @@ -7569,24 +7436,28 @@ To produce the documentation run the original source files ending with % \end{macro} % % \begin{macro}{\@@_make_cover:} -% 生成本科生或研究生的普通封面。 +% \changes{v1.3}{2023/05/24}{修复非研究生类型时调用 \opt{nl-cover} 选项的错误。} +% 调用实例生成封面。 % \begin{macrocode} %<*(def-u|def-g|def-p)> \cs_new_protected:Npn \@@_make_cover: { %<def-u> \UseInstance { nju } { cover-u } -%<def-g> \clist_map_inline:nn { front, back, en } -%<def-g> { \UseInstance { nju } { cover-g- ##1 } } %<def-p> \UseInstance { nju } { cover-p } - } % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_make_cover_nl:} -% 生成研究生的国家图书馆封面。 +% 如果在研究生模板中选择了 \opt{nlcover},就生成用于申请学位的国家图书馆封面, +% 反之生成普通封面。 % \begin{macrocode} -%<def-g>\cs_new_protected:Npn \@@_make_cover_nl: -%<def-g> { \UseInstance { nju } { cover-nl } } +%<*def-g> +\bool_if:NTF \g_@@_opt_nlcover_bool + { \UseInstance { nju } { cover-nl } } + { + \UseInstance { nju } { cover-g-front } + \UseInstance { nju } { cover-g-back } + \UseInstance { nju } { cover-g-en } + } +%</def-g> + } % \end{macrocode} % \end{macro} % @@ -7636,7 +7507,7 @@ To produce the documentation run the original source files ending with \cs_new_protected:Npn \@@_new_img_cmd:nn #1#2 { \exp_args:Nc \NewDocumentCommand { nju #1 } { o m m } - { \includegraphics [ width = ##2, height = ##3 ] { #2 } } + { \includegraphics [ width = ##2, height = ##3 ] {#2} } } % \end{macrocode} % \end{macro} @@ -7701,13 +7572,7 @@ To produce the documentation run the original source files ending with \bool_if:NF \g_@@_opt_draft_bool { \pagenumbering { gobble } -% \end{macrocode} -% 如果在研究生模板中选择了 \opt{nlcover},就生成用于申请学位的国家图书馆封面, -% 反之生成普通封面。 -% \begin{macrocode} - \bool_if:NTF \g_@@_opt_nlcover_bool - { \@@_make_cover_nl: } - { \@@_make_cover: } + \@@_make_cover: } % \end{macrocode} % 生成封面后清除标题中的换行控制符,便于在摘要中输出。 @@ -7993,7 +7858,7 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \__nju_cs_clear:N \makelabel } - \item \clist_use:cn { g_@@_info_keywords #1 _clist } { #2 } + \item \clist_use:cn { g_@@_info_keywords #1 _clist } {#2} \endlist } %</class> @@ -8168,7 +8033,7 @@ To produce the documentation run the original source files ending with % 自动结束上一个 \env{refsection},与章末参考文献表格式兼容更好。 % \begin{macrocode} \newrefsection - \nocite { #2 } + \nocite {#2} \printbibliography [ heading = subbibliography, title = #1 ] \endrefsection \group_end: @@ -8229,7 +8094,7 @@ To produce the documentation run the original source files ending with \NewDocumentEnvironment { notation } { O { 10 em } O { 5 em } } { \@@_chapter:V \c_@@_name_notation_tl - \@@_make_notation:nn { #1 } { #2 } + \@@_make_notation:nn {#1} {#2} } { \endlist \cleardoublepage } % \end{macrocode} @@ -8241,7 +8106,7 @@ To produce the documentation run the original source files ending with \NewDocumentEnvironment { notation* } { O { 10 em } O { 5 em } } { \chapter * { \c_@@_name_notation_tl } - \@@_make_notation:nn { #1 } { #2 } + \@@_make_notation:nn {#1} {#2} } { \endlist \cleardoublepage } %</class> @@ -8322,6 +8187,10 @@ To produce the documentation run the original source files ending with % 用于国家图书馆封面的专业名称字样 % \begin{macrocode} %<def-g> { major b } { 专业名称 }, +% \end{macrocode} +% 用于专业学位封面的专业名称字样 +% \begin{macrocode} +%<def-g> { major c } { 专业学位类别(领域) }, { notation } { 符号表 }, %<def-u> { orig decl } %<def-u> { 南京大学本科毕业论文(设计) \\ 诚信承诺书 }, @@ -8427,14 +8296,6 @@ To produce the documentation run the original source files ending with { \@@_define_name:nnn #1 } % \end{macrocode} % -% 对专业硕士的封面条目进行临时修改。 -% \begin{macrocode} -%<*def-g> -\bool_if:NF \g_@@_opt_academic_bool - { \tl_set:Nn \c_@@_name_major_tl { 专业学位类别(领域) } } -%</def-g> -% \end{macrocode} -% % \subsubsection{文本} % \label{subsubsec:constant-text} % @@ -8588,19 +8449,32 @@ To produce the documentation run the original source files ending with %<def-g|def-p> { pagestyle } { headings }, { abslabel } { \bfseries }, { abslabel_en } { }, - { cover title } { }, +%<def-u> { cover title } { \bfseries }, +%<def-g> { cover title } { }, %<def-u> { cover label } { \kaishu }, %<def-g> { cover label } { \bfseries }, %<def-p> { cover label } { }, +% \end{macrocode} +% 调用 \pkg{njuvisual} 时的校徽颜色。 +% \begin{macrocode} { emblem color } { black }, { name color } { black }, +% \end{macrocode} +% 各级标题样式。 +% \begin{macrocode} { section } { \bigger \normalfont \sffamily }, { chapter } { \c_@@_fmt_section_tl \centering }, - { chapterintoc } { \c_@@_fmt_section_tl }, { subsection } { \c_@@_fmt_section_tl }, { subsubsection } { \c_@@_fmt_section_tl }, { paragraph } { \c_@@_fmt_section_tl }, { subparagraph } { \c_@@_fmt_section_tl }, +% \end{macrocode} +% 目录中的章标题样式。 +% \begin{macrocode} + { chapterintoc } { \c_@@_fmt_section_tl }, +% \end{macrocode} +% “目录”二字的样式。 +% \begin{macrocode} { toc title } { \centering \zihao { 3 } \bfseries }, { header } { \small \kaishu }, { footer } { \small \rmfamily } @@ -8609,5 +8483,474 @@ To produce the documentation run the original source files ending with %</(def-u|def-g|def-p)> % \end{macrocode} % +% +% \subsection{手册文档类 \cls{njuthesis-doc}} +% \changes{v1.3}{2023/05/12}{将手册样式设置拆分为单独的 \cls{njuthesis-doc} 文档类。} +% +% \begin{macrocode} +%<*doc-cls> +%<@@=njudoc> +% \end{macrocode} +% +% +% \begin{macrocode} +\RequirePackage { l3keys2e } +% \end{macrocode} +% +% \subsubsection{选项} +% +% \begin{macrocode} +\keys_define:nn { njudoc } + { + codehigh .bool_set:N = \g_@@_codehigh_bool, + codehigh .initial:n = false + } +\ProcessKeysOptions { njudoc } +% \end{macrocode} +% +% \subsubsection{载入宏包} +% +% \begin{macrocode} +\PassOptionsToPackage { fontset = fandol } { ctex } +\PassOptionsToPackage { firstpage = true } { background } +% \end{macrocode} +% +% 载入基础文档类。 +% \begin{macrocode} +\LoadClass { ctxdoc } +% \end{macrocode} +% +% 载入宏包。 +% \begin{macrocode} +\RequirePackage + { + background, + codehigh, + listings, + njuvisual, + tabularray, + unicode-math, + zhlineskip + } +\sys_if_engine_xetex:TF + { + \RequirePackage { xeCJKfntef } + \renewcommand\emph[1]{\CJKunderdot[textformat=\itshape]{#1}} + } + { + \RequirePackage { lua-ul } + \NewDocumentCommand \CJKunderline { o m } { \underLine {#1} } + \NewDocumentCommand \CJKunderdot { o m } { \underLine {#1} } + \NewDocumentCommand \CJKsout { o m } + { \textcolor { black!50 } {#1} } + } +% \end{macrocode} +% +% \subsubsection{杂项} +% +% 封面背景图案。 +% \begin{macrocode} +\backgroundsetup{ + contents={\njuemblem[white!85!gray]{22cm}{!}}, + scale=1, angle=0, hshift=-4cm +} +% \end{macrocode} +% +% 文档命令。 +% \begin{macrocode} +\definecolor{tpblue}{HTML}{495A80} +\newcommand\tpbutton[1]{\textcolor{tpblue}{\bfseries #1}} +\newcommand\tikzlogo{Ti\emph{k}Z} +\newcommand\OPT[1]{\textcolor{njuyellow}{\bfseries#1}} +% \end{macrocode} +% +% \pkg{hyperref} 设置。 +% \begin{macrocode} +\hypersetup{ + pdftitle = { + The~ njuthesis~ class~ -~ + LaTeX~ thesis~ template~ for~ Nanjing~ University}, + citecolor = njublue, + linkcolor = njuviolet, + urlcolor = njumagenta} +% \end{macrocode} +% +% \pkg{tabularray} 设置。 +% \begin{macrocode} +\UseTblrLibrary{booktabs,siunitx} +\DefTblrTemplate{caption-tag}{default}{表\hspace{0.25em}\thetable} +\SetTblrStyle{caption-tag}{font=\bfseries} +\SetTblrInner{row{1}={font=\bfseries}} +\SetTblrInner[talltblr]{row{1}={font=\bfseries}} +\DefTblrTemplate{caption-sep}{default}{\quad} +% \end{macrocode} +% +% \pkg{tabularray} 表格标签简写。 +% \begin{macrocode} +\def\TA{\TblrNote{a}} +\def\TB{\TblrNote{b}} +\def\TC{\TblrNote{c}} +\def\TD{\TblrNote{d}} +\def\TE{\TblrNote{e}} +% \end{macrocode} +% +% +% \TeX{} 相关的名称简写。 +% \begin{macrocode} +\def\TL{\TeX~Live} +\def\MacTeX{Mac\TeX} +\def\biber{\hologo{biber}} +\def\LaTeXe{\hologo{LaTeX2e}} +% \end{macrocode} +% +% \pkg{zhlineskip} 设置。 +% \begin{macrocode} +\SetTextEnvironmentSinglespace{1.112} +\SetMathEnvironmentSinglespace{1.112} +% \end{macrocode} +% +% \subsubsection{字体设置} +% +% \begin{macrocode} +\setmainfont { texgyretermes } + [ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic + ] +% \end{macrocode} +% +% 需要 \pkg{lexend}。 +% \begin{macrocode} +\setsansfont{LexendDeca} +% \end{macrocode} +% +% Iosevka。 +% \begin{macrocode} +\fontspec_font_if_exist:nT { Iosevka } + { + \setmonofont { Iosevka } + [ + UprightFont = *~Light, + ItalicFont = *~Light~Italic, + BoldFont = *~Semibold + ] + } +% \end{macrocode} +% +% 思源宋体。 +% \begin{macrocode} +\fontspec_font_if_exist:nT { Source~ Han~ Serif~ SC } + { + \setCJKmainfont{ Source~ Han~ Serif~ SC } + [ + UprightFont = *~SemiBold, + ItalicFont = *~Bold, + BoldFont = *~Heavy, + Language = Chinese~Simplified + ] + } +% \end{macrocode} +% +% \begin{macrocode} +\setCJKsansfont { FandolHei-Regular } + [ + Extension = .otf, + BoldFont = FandolHei-Bold + ] +\setCJKmonofont { FandolFang-Regular } + [ Extension = .otf ] +% \end{macrocode} +% +% XITS。 +% \begin{macrocode} +\setmathfont{XITSMath-Regular}[ + BoldFont = XITSMath-Bold, + Extension = .otf] +% \end{macrocode} +% +% \pkg{listings} 设置。 +% \begin{macrocode} +\lstdefinestyle{style@base} + { + basewidth = 0.5 em, + gobble = 3, + lineskip = 3 pt, + frame = l, + framerule = 1 pt, + framesep = 0 pt, + xleftmargin = 2 em, + xrightmargin = 3 em, + escapeinside = {(*}{*)}, + breaklines = true, + basicstyle = \small\ttfamily, + keywordstyle = \bfseries\color{njuviolet}, + commentstyle = \itshape\color{white!50!gray}, + stringstyle = \color{nju-chem-red}, + backgroundcolor = \color{white!95!gray} + } +\lstdefinestyle{style@shell} + { + style = style@base, + rulecolor = \color{njumagenta}, + language = bash, + alsoletter = {-}, + emphstyle = \color{nju-cs-green} + } +\lstdefinestyle{style@latex} + { + style = style@base, + rulecolor = \color{njublue}, + language = [LaTeX]TeX, + alsoletter = {*, -, .}, + texcsstyle = *\color{njuviolet}, + emphstyle = [1]\color{nju-ai-orange}, + emphstyle = [2]\color{nju-cs-green}, + emphstyle = [3]\bfseries\color{njuyellow} + } +% \end{macrocode} +% +% 代码框环境。 +% \begin{macrocode} +\lstnewenvironment{shellexample}[1][]{% + \lstset{style=style@shell, #1}}{} +\lstnewenvironment{latexexample}[1][]{% + \lstset{style=style@latex, #1}}{} +% \end{macrocode} +% +% +% \subsubsection{标签颜色设置} +% +% 我们对每个 guard 进行特定的颜色标记, +% 而不是 \cls{ctxdoc} 中使用深浅表明嵌套关系。 +% +% \begin{macrocode} +\colorlet { at@guard } { njuviolet } +\definecolor { angle@guard } { gray } { 0.7 } +\definecolor { star@guard } { rgb } { 0.8 , 0 , 0 } +\definecolor { u@guard } { HTML } { 5463FF } +\definecolor { g@guard } { HTML } { 2B7A0B } +\definecolor { p@guard } { HTML } { FF1818 } +\definecolor { c@guard } { HTML } { FFC300 } +% \end{macrocode} +% +% \begin{variable}{\c@@_module_color_prop} +% 存储 guard 名称和对应的颜色。 +% \begin{macrocode} +\prop_const_from_keyval:Nn \c@@_module_color_prop + { + def-u = u@guard, + def-g = g@guard, + def-p = p@guard + } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_set_module_color:n} +% +% \begin{macrocode} +\cs_new:Npn \@@_set_module_color:Nn #1#2 + { + \prop_get:NnNF \c@@_module_color_prop {#2} #1 + { \tl_set:Nn #1 { c@guard } } + \exp_args:NV \color #1 #2 + } +\cs_new:Npn \@@_set_module_color:n + { \@@_set_module_color:Nn \l_tmpa_tl } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_module_angle:Nn} +% 生成完整的带颜色的 guard 标签。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_module_angle:Nn #1#2 + { + \group_begin: \color { angle@guard } \ttfamily \textlangle \group_end: + \group_begin: \sffamily #2 \group_end: + \group_begin: \color { angle@guard } #1 \ttfamily \textrangle \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\__ctxdoc_module_angle:n} +% 补丁。 +% \begin{macrocode} +\cs_set:Npn \__ctxdoc_module_angle:n + { \@@_module_angle:Nn \c_empty_tl } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_colored_module_angle:NN} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_colored_module_angle:NN #1#2 + { + \seq_clear:N #2 + \seq_map_inline:Nn #1 + { + \seq_gput_right:Nn #2 + { \@@_set_module_color:n {##1} } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_print_module:n} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_module:n #1 + { + \@@_colored_module_angle:NN \l_tmpa_seq \l_tmpb_seq + \bool_lazy_or:nnTF + { \str_if_empty_p:n {#1} } + { \int_compare_p:n { \seq_count:N \l_tmpb_seq = 1 } } + { + \str_clear:N \l_tmpa_str + \str_clear:N \l_tmpb_str + } + { + \str_set:Nn \l_tmpa_str { ( } + \str_set:Nn \l_tmpb_str { ) } + } + \@@_module_angle:Nn \l_tmpb_str + { + \color { star@guard } #1 + \color { angle@guard } \l_tmpa_str + \seq_use:Nn \l_tmpb_seq + { \color { angle@guard } \orbar } + } + } +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_split_pm:n,\@@_split_pm:V} +% 通过竖线分割 guard 标签。 +% \begin{macrocode} +\cs_new:Npn \@@_split_pm:n + { \seq_set_split:Nnn \l_tmpa_seq { | } } +\cs_generate_variant:Nn \@@_split_pm:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_split_m:n} +% +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_split_m:n #1 + { + \tl_set:Nn \l_tmpa_str {#1} + \clist_map_inline:nn { *, /, (, ) } + { \str_remove_all:Nn \l_tmpa_str {##1} } + \@@_split_pm:V \l_tmpa_str + } +% \end{macrocode} +% \end{macro} +% +% +% \begin{macrocode} +\group_begin: + \char_set_catcode_active:N \> +% \end{macrocode} +% +% \begin{macro}{\__ctxdoc_module_star:w} +% \begin{macrocode} + \cs_gset_protected:Npn \__ctxdoc_module_star:w #1 > #2 \q_stop + { + \__ctxdoc_output_module:nn + { \@@_split_m:n {#1} } + { \__ctxdoc_module_push:n { \@@_print_module:n { * } } } + \__ctxdoc_output_line:n {#2} + \__ctxdoc_star_format: + } +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\__ctxdoc_module_slash:w} +% \begin{macrocode} + \cs_gset_protected:Npn \__ctxdoc_module_slash:w #1 > #2 \q_stop + { + \__ctxdoc_output_module:nn + { \@@_split_m:n {#1} } + { \__ctxdoc_module_pop:n { \@@_print_module:n { / } } } + \__ctxdoc_output_line:n {#2} + \__ctxdoc_slash_format: + } +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\__ctxdoc_module_pm:w} +% \begin{macrocode} + \cs_gset_protected:Npn \__ctxdoc_module_pm:w #1 > #2 \q_stop + { + \tex_noindent:D + \hbox_overlap_left:n + { + \__ctxdoc_output_module:nn + { \@@_split_pm:n {#1} } + { \@@_print_module:n { } } + \skip_horizontal:n { \leftskip + \smallskipamount } + } + \group_begin: + \__ctxdoc_pm_format: + \__ctxdoc_output_line:n {#2} + \group_end: + } +\group_end: +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\grd,\sgrd,\pgrd} +% 在手册中生成带颜色的 guard 标记。 +% \begin{macrocode} +\NewDocumentCommand \grd { m } + { \__ctxdoc_module_angle:n { \color { njuviolet } #1 } } +\NewDocumentCommand \sgrd { m } + { \__ctxdoc_module_angle:n { \color { star@guard } * \color{ c@guard } #1 } } +\NewDocumentCommand \pgrd { m } + { \__ctxdoc_module_angle:n { \color { #1 @guard } def- #1 } } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{语法高亮} +% +% \begin{macro}{\@@_output_line:} +% \cls{ctxdoc} 将 \file{.dtx} 文件中读取的代码行存储在 +% \cs{l__ctxdoc_verbatim_line_tl},我们使用 \pkg{codehigh} 提供的内部函数 +% 将其转化为带有语法高亮的格式并输出。默认读取的代码行尾带有 |^^M|, +% 直接输入高亮函数会导致代码快尾部有额外空行,需要手动删去。 +% \begin{macrocode} +\cs_generate_variant:Nn \tl_remove_once:Nn { NV } +\cs_set_protected_nopar:Npn \@@_output_line:N #1 + { + \tex_noindent:D + \__ctxdoc_replace_at_at:N #1 + \tl_remove_once:NV #1 \c__ctxdoc_active_cr_tl + \__codehigh_parse_code:nN { latex / latex3 } #1 + \tex_par:D + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\__ctxdoc_output_line:} +% 在 \XeTeX{} 引擎下,\pkg{codehigh} 调用的 \pkg{l3regex} 模块有严重的性能问题。 +% 我们仅仅在需要时启用高亮。 +% \begin{macrocode} +\bool_if:NT \g_@@_codehigh_bool + { + \cs_set:Npn \__ctxdoc_output_line: + { \@@_output_line:N \l__ctxdoc_verbatim_line_tl } + } +% \end{macrocode} +% \end{macro} +% +% +% \begin{macrocode} +%</doc-cls> +% \end{macrocode} +% % \end{implementation} % diff --git a/macros/unicodetex/latex/njuthesis/njuthesis.ins b/macros/unicodetex/latex/njuthesis/njuthesis.ins index aa1be50504..49f6f539ce 100644 --- a/macros/unicodetex/latex/njuthesis/njuthesis.ins +++ b/macros/unicodetex/latex/njuthesis/njuthesis.ins @@ -54,6 +54,7 @@ To produce the documentation run the original source files ending with \file{\jobname-undergraduate.def} {\from{\jobname.dtx}{def-u}} \file{\jobname-graduate.def} {\from{\jobname.dtx}{def-g}} \file{\jobname-postdoctoral.def} {\from{\jobname.dtx}{def-p}} + \file{\jobname-doc.cls} {\from{\jobname.dtx}{doc-cls}} } \obeyspaces @@ -65,6 +66,7 @@ To produce the documentation run the original source files ending with \Msg{* The recommended directory is TDS:tex/latex/njuthesis *} \Msg{* *} \Msg{* njuthesis.cls *} +\Msg{* njuthesis-doc.cls *} \Msg{* njuthesis-graduate.def *} \Msg{* njuthesis-postdoctoral.def *} \Msg{* njuthesis-undergraduate.def *} @@ -78,13 +80,6 @@ To produce the documentation run the original source files ending with \Msg{*************************************************************} \endbatchfile - % \begin{syntax} - % \OPT{degree} = \Arg{中文学位名} - % \OPT{degree*} = \Arg{英文学位名} - % \end{syntax} - % 研究生国家图书馆封面英文封面上的学位名称。默认会由模板通过 \opt{degree} - % 和 \opt{type} 文档类选项生成,也可以由本选项自定义名称。 - % \end{function} \endinput %% diff --git a/macros/unicodetex/latex/njuthesis/njuthesis.pdf b/macros/unicodetex/latex/njuthesis/njuthesis.pdf Binary files differindex 521d6e187b..14ead75879 100644 --- a/macros/unicodetex/latex/njuthesis/njuthesis.pdf +++ b/macros/unicodetex/latex/njuthesis/njuthesis.pdf |