texlive[68928] Master/texmf-dist: q-and-a (21nov23)

commits+karl at tug.org commits+karl at tug.org
Tue Nov 21 22:30:29 CET 2023


Revision: 68928
          https://tug.org/svn/texlive?view=revision&revision=68928
Author:   karl
Date:     2023-11-21 22:30:29 +0100 (Tue, 21 Nov 2023)
Log Message:
-----------
q-and-a (21nov23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/q-and-a/README.md
    trunk/Master/texmf-dist/doc/latex/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex
    trunk/Master/texmf-dist/doc/latex/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdf
    trunk/Master/texmf-dist/doc/latex/q-and-a/doc/Q-and-A-doc.pdf
    trunk/Master/texmf-dist/doc/latex/q-and-a/doc/Q-and-A-doc.tex
    trunk/Master/texmf-dist/tex/latex/q-and-a/Q-and-A.cls

Modified: trunk/Master/texmf-dist/doc/latex/q-and-a/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/q-and-a/README.md	2023-11-21 21:30:14 UTC (rev 68927)
+++ trunk/Master/texmf-dist/doc/latex/q-and-a/README.md	2023-11-21 21:30:29 UTC (rev 68928)
@@ -8,6 +8,33 @@
 
 Notably, it features two themes, `ChatGPT-light` and `ChatGPT-dark`, enabling you to format your Q&A dialog in a way that closely resembles the interface of ChatGPT.
 
+### Screenshots
+
+<!-- ![image](https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-default.png) -->
+<div align=center><img width="400" src="https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-default.png"/></div>
+
+> From [the documentation](https://github.com/Jinwen-XU/Q-and-A/blob/main/doc/Q-and-A-doc.pdf).
+
+<!-- ![image](https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-ChatGPT-1.png) -->
+<div align=center><img width="750" src="https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-ChatGPT-1.png"/></div>
+
+> From [the demo document for theme "ChatGPT-dark"](https://github.com/Jinwen-XU/Q-and-A/blob/main/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-dark.pdf).
+
+<!-- ![image](https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-ChatGPT-classical-1.png) -->
+<div align=center><img width="750" src="https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-ChatGPT-classical-1.png"/></div>
+
+> From [the demo document for theme "ChatGPT-classical-dark"](https://github.com/Jinwen-XU/Q-and-A/blob/main/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-dark.pdf).
+
+<!-- ![image](https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-default-1.png) -->
+<div align=center><img width="750" src="https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-default-1.png"/></div>
+
+> From [the English demo document](https://github.com/Jinwen-XU/Q-and-A/blob/main/demo/lang-en/Q-and-A-demo-en.pdf).
+
+<!-- ![image](https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-multiple-1.png) -->
+<div align=center><img width="750" src="https://github.com/Jinwen-XU/Q-and-A/raw/main/screenshots/screenshot-multiple-1.png"/></div>
+
+> From [the demo document for multiple questions/answers](https://github.com/Jinwen-XU/Q-and-A/blob/main/demo/mode-multiple/Q-and-A-demo-multiple.pdf).
+
 ## Installation and preparation
 
 ### How to install this package
@@ -16,6 +43,9 @@
 
 Otherwise, you need to check for package update to see if you can receive it. In case not, you can always go to [the CTAN page](https://ctan.org/pkg/Q-and-A) to download the `.zip` file with all related files included.
 
+> **Attention:**
+> For this document class to function properly, the LaTeX2e kernel must be at least as new as `2023/11/01`.
+
 ## Usage
 
 Please refer to [the documentation](https://github.com/Jinwen-XU/Q-and-A/blob/main/doc/Q-and-A-doc.pdf) for detailed usage.
@@ -43,17 +73,19 @@
 
 These are necessary if you wish to write your document in Chinese (either simplified or traditional) or Japanese. Also, without these fonts installed, the compilation speed might be much slower — the compilation would still pass, but the system shall spend (quite) some time verifying that the fonts are indeed missing before switching to the fallback fonts.
 
-### Functionality
+### Some aspects
+
+#### On the functionality
 The main features are achieved with the power of LaTeX3's regex functionality. It scans the content paragraph by paragraph and converts recognized patterns into corresponding TeX commands.
 However, this comes with a price: in order to scan the content, it is firstly stored in a macro, and that means that you cannot use commands like `\verb` in your main text.
 Also, synctex won't work properly.
 
-### Language and date format
+#### Language and date format
 Language and date format can both be set in two ways: as class option or with corresponding commands.
 - The user-level command for setting language is `\UseLanguage`, provided by `projlib-language`; the one for setting date format is `\SetDatetimeInputFormat`, provided by `projlib-date`.
 - When you set the language, it is not exactly the same using class option or using command: when you select a language via class option, only the setting for this language would be loaded; however, with `\UseLanguage`, it would load *all* the language settings and then switch to your selected one. Sometimes the page breaking behavior differs slightly. Personally I prefer the `\UseLanguage` approach, for this would allow you to switch language in the middle of your document.
 
-### Scroll mode
+#### Scroll mode
 The scroll mode is achieved by directly accessing `\pdfpageheight` (pdfTeX and XeTeX) or `\pageheight` (LuaTeX). <!-- The minimal page height is set to be `10in`. --> It is worth noting that in order to calculate the height needed, the entire content are put into a single box, which puts a limitation on the length of your document (but this usually wouldn't be a problem).
 
 # License

Modified: trunk/Master/texmf-dist/doc/latex/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex	2023-11-21 21:30:14 UTC (rev 68927)
+++ trunk/Master/texmf-dist/doc/latex/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex	2023-11-21 21:30:29 UTC (rev 68928)
@@ -1,17 +1,17 @@
 "
   We start with the **normal** mode.
 
-?
+? \QALabel{Q:normal-1}
   Question.
 
 :
-  Answer.
+  Answer to \QARef{Q:normal-1}.
 
-?
+? \QALabel{Q:normal-2}
   Question.
 
 :
-  Answer.
+  Answer to \QARef{Q:normal-2}.
 
 "
   Now start the **multiple question** mode.
@@ -18,14 +18,14 @@
 
 \EnableMultipleQuestion
 
-?
-  Question.
+? \QALabel{Q:multi-1}
+  First question.
 
-?
-  Question.
+? \QALabel{Q:multi-2}
+  Second question.
 
 :
-  Answer.
+  Answer to \QARef{Q:multi-1} and \QARef{Q:multi-2}.
 
 "
   Now stop the multiple question mode, and start the **multiple answer** mode.
@@ -34,14 +34,14 @@
 
 \EnableMultipleAnswer
 
-?
-  Question.
+? \QALabel{Q:normal-multi}
+  Question with two answers \QARef{A:multi-1} and \QARef{A:multi-2}.
 
-:
-  Answer.
+: \QALabel{A:multi-1}
+  First answer to \QARef{Q:normal-multi}.
 
-:
-  Answer.
+: \QALabel{A:multi-2}
+  Second answer to \QARef{Q:normal-multi}.
 
 "
   Now start both the **multiple question** mode and the **multiple answer** mode.
@@ -50,20 +50,20 @@
 
 \EnableMultipleAnswer
 
-?
+? \QALabel{Q:multi-1'}
   Question.
 
-?
+? \QALabel{Q:multi-2'}
   Question.
 
 :
-  Answer.
+  First answer to \QARef{Q:multi-1'} and \QARef{Q:multi-2'}.
 
 :
-  Answer.
+  Second answer to \QARef{Q:multi-1'} and \QARef{Q:multi-2'}.
 
 :
-  Answer.
+  Third answer to \QARef{Q:multi-1'} and \QARef{Q:multi-2'}.
 
 "
   Back to the **normal** mode.
@@ -72,14 +72,14 @@
 
 \DisableMultipleAnswer
 
-?
+? \QALabel{Q:normal-1'}
   Question.
 
 :
-  Answer.
+  Answer to \QARef{Q:normal-1'}.
 
-?
+? \QALabel{Q:normal-2'}
   Question.
 
 :
-  Answer.
+  Answer \QARef{Q:normal-2'}.

Modified: trunk/Master/texmf-dist/doc/latex/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/q-and-a/doc/Q-and-A-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/q-and-a/doc/Q-and-A-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/q-and-a/doc/Q-and-A-doc.tex	2023-11-21 21:30:14 UTC (rev 68927)
+++ trunk/Master/texmf-dist/doc/latex/q-and-a/doc/Q-and-A-doc.tex	2023-11-21 21:30:29 UTC (rev 68928)
@@ -5,7 +5,7 @@
   scroll,
 ]{Q-and-A}
 
-\def\PackageVersion{2023/11/19}
+\def\PackageVersion{2023/11/21}
 \def\PackageSubVersion{}
 
 \newcommand{\QApackage}{{\normalfont\textsf{Q-and-A}}}
@@ -57,7 +57,11 @@
 
   Otherwise, you need to check for package update to see if you can receive it. In case not, you can always go to \href{https://ctan.org/pkg/Q-and-A}{the CTAN page} to download the `.zip` file with all related files included.
 
+"
+  **Attention:**\\
+  For this document class to function properly, the \LaTeX2e kernel must be at least as new as `2023/11/01`.
 
+
 ##+ {Usage}
 
 ?
@@ -114,8 +118,11 @@
     \item for simplified Chinese, it is also possible to use the prefix `问:` for questions, `答:` for answers, and `注:` for narrations; similarly for traditional Chinese;
     \item for Chinese or Japanese, it is also possible to use the prefix `?` for questions, `:` for answers, and `“`, `”` or `「` for narrations.
   \end{itemize}}
-  You may specify the identity of the current speaker by placing `<\meta{name}>` after the prefix (there could be some spaces in between). For example, `? <You>` would set the questioner's name to `You`. How this name is disposed of depends on your current selected theme.
-  \QANote{The identity for the current type would be recorded, so unless you wish to change it, you only need to write it once.}
+  \begin{itemize}
+    \item You may specify the identity of the current speaker by placing `<\meta{name}>` after the prefix (there could be some spaces in between). For example, `? <You>` would set the questioner's name to `You`. How this name is disposed of depends on your current selected theme.
+    \QANote{The identity for the current type would be recorded, so unless you wish to change it, you only need to write it once.}
+    \item To reference a question/answer, use the commands `\textbackslash QALabel\{\meta{label}\}` and `\textbackslash QARef\{\meta{label}\}` (of course, for this to work, you first need to turn on the numbering via the class options `numbered question` and `numbered answer`).
+  \end{itemize}
 
   [Emphasize and Bold]
   \begin{itemize}
@@ -150,7 +157,8 @@
   \begin{itemize}
     \item For centered image, the caption can be written via `\textgreater\textgreater{} \meta{caption text}`.
   \end{itemize}
-  % \QANote{Currently, the `\meta{caption text}` shall be directly printed in the center. You may wish to add a pair of parentheses around it.}
+  \QANote{By default, the `\meta{caption text}` shall be directly printed in the center. To redefine its style, you may use the command `\textbackslash QASetCaptionStyle\{\meta{settings}\}`, where `\meta{settings}` is some code containing `\textsharp 1`, which refers to `\meta{caption text}`.\\
+  For example, `\textbackslash QASetCaptionStyle\{\textbackslash textcolor\{.!50\}\{(\textsharp 1)\}\}` adds a pair of parentheses around the \meta{caption text} and sets it to half transparent.}
 
   [Code]
   Due to the current implementation of this document class, it is unfortunate that you cannot directly insert source code in your document. There are some workarounds, though.
@@ -251,7 +259,7 @@
     \item Use `\textbackslash QASetLogoCode\{A\}\{\meta{logo code}\}` to set the labels for answers.
   \end{itemize}
   Here, \meta{logo code} is the actual code for displaying the corresponding label. For example, the default label for (unnumbered) questions is preset via `\textbackslash QASetLogoCode\{Q\}\{\textbackslash textbf\{Q\textbackslash,:\}\}`.
-  \QANote{In the demo document, you can find an example on how to use this command to specify a logo for each role in the conversation.}
+  \QANote{In the demo documents, you may find examples on how to use this command to specify a logo for each role in the conversation.}
   If you wish to include the question number or answer number, you may use the command `\textbackslash QAShowCounter`:
   \begin{itemize}
     \item Use `\textbackslash QAShowCounter\{Q\}` to step the counter of question and print it.
@@ -289,6 +297,12 @@
     %% 2023-11-05, solved with the new option "answer outside the box".
     \item Due to the current implementation, though it is already possible to automatically adopt the identifiers and labels for supported languages, you still need to use the identifiers `Q`, `A` and `N` when setting them.
     \item Currently, for typesetting questions and answers, the text is in fact being put into some sort of `description` list (upon reflection, why did I do this? I could have simply put the label into margin...). As a result, the level of lists might be slightly messed up, which could sometimes lead to issues with the list labels.
+    % \item It is not yet possible to cite the questions/answers.
+    %% 2023-11-19, solved with new commands \QALabel and \QARef.
+    % \item Referencing of questions/answers doesn't have hyperlinks.
+    %% 2023-11-20, solved by using the `target` property.
+    \item Referencing of questions/answers doesn't work for all themes.
+    \item If you decide to change the language in the middle of the text, referencing text wouldn't be shown in the original language, but would be shown according to the language of the context where the referencing command is being specified.
     \item Some vertical and horizontal spacing still needs to be fine-tuned.
     \item The code for all those themes is currently mixed up, which poses difficulties for maintenance and expandability.
   \end{itemize}

Modified: trunk/Master/texmf-dist/tex/latex/q-and-a/Q-and-A.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/q-and-a/Q-and-A.cls	2023-11-21 21:30:14 UTC (rev 68927)
+++ trunk/Master/texmf-dist/tex/latex/q-and-a/Q-and-A.cls	2023-11-21 21:30:29 UTC (rev 68928)
@@ -9,10 +9,10 @@
 %%
 %%    http://www.latex-project.org/lppl.txt
 %%
-\NeedsTeXFormat{LaTeX2e}[2022-06-01]
+\NeedsTeXFormat{LaTeX2e}[2023/11/01]
 \ProvidesExplClass
   {Q-and-A}
-  {2023/11/19} {}
+  {2023/11/21} {}
   {Document class for typesetting Q&A conversation}
 
 \keys_define:nn { Q-and-A }
@@ -231,7 +231,7 @@
   }
 
 \newlist { QA-entry } { description } { 1 }
-\setlist [ QA-entry ] { font = \normalfont\sffamily, leftmargin = \l_QA_list_indentation_dim, labelsep = \l_QA_list_labelsep_dim, labelwidth=4em, itemindent=0pt, parsep=\parskip }
+\setlist [ QA-entry ] { font = \normalfont\sffamily, leftmargin = \l_QA_list_indentation_dim, labelsep = \l_QA_list_labelsep_dim, labelwidth=10em, itemindent=0pt, parsep=\parskip }
 \renewcommand{\descriptionlabel}[1]{#1}
 
 \bool_new:N \l__QA_inside_list_bool
@@ -440,6 +440,7 @@
     EnableMultipleAnswer,
     DisableMultipleQuestion,
     DisableMultipleAnswer,
+    QALabel, QARef,
   }
   {% LaTeX3 commands
   }
@@ -582,6 +583,47 @@
     \dim_gset:Nn \labelsep { \l_tmpa_dim }
   }
 
+\property_new:nnnn { Q-and-A/type } { now } { void } { \l__QA_current_type_tl }
+\NewDocumentCommand \QALabel { m }
+  {
+    \group_begin:
+    \exp_args:No \addtocounter { QA_ \l__QA_current_type_tl } { -1 }
+    \exp_args:No \refstepcounter { QA_ \l__QA_current_type_tl }
+    \property_record:nn { #1 } { label, target, Q-and-A/type }
+    \group_end:
+  }
+
+\tl_new:N \l_QA_Q_ref_style_tl
+\tl_new:N \l_QA_A_ref_style_tl
+\NewDocumentCommand \QASetRefStyle { O{void} m }
+  {
+    \tl_set:cn { l_QA_ #1 _ref_style_tl } { #2 }
+  }
+\NewCommandCopy \SetRefStyle \QASetRefStyle
+
+\QASetRefStyle[Q]
+  {
+    \sffamily\bfseries
+    \color{QA-Q-text!33!QA-Q-back}
+  }
+\QASetRefStyle[A]
+  {
+    \sffamily\bfseries
+    \color{QA-A-text!33!QA-A-back}
+  }
+
+\NewDocumentCommand \QARef { m }
+  {
+    \group_begin:
+    \hyperlink { \property_ref:nn { #1 } { target } }
+      {
+        \cs_if_exist_use:c { l_QA_ \property_ref:nn { #1 } { Q-and-A/type } _ref_style_tl }
+        \cs_if_exist_use:c { l_QA_ \property_ref:nn { #1 } { Q-and-A/type } _label_text_tl }
+        \QA_show_subcounter_with_style:n { \property_ref:nn { #1 } { label } }
+      }
+    \group_end:
+  }
+
 \NewDocumentCommand \QASection { m }
   {
     \par\medskip\smallskip
@@ -613,12 +655,20 @@
 \newenvironment{QARight}
   {\parskip=0pt\par\medskip\nopagebreak\raggedleft}
   {\par\noindent\ignorespacesafterend}
-\NewDocumentCommand \QACompactCenterText { m }
+
+\NewDocumentCommand \QACaption { m } { }
+\NewDocumentCommand \QASetCaptionStyle { m }
   {
-    \begin{QACompactCenter}
-      #1
-    \end{QACompactCenter}
+    \RenewDocumentCommand \QACaption { m }
+      {
+        \begin{QACompactCenter}
+          #1
+        \end{QACompactCenter}
+      }
   }
+\NewCommandCopy \SetCaptionStyle \QASetCaptionStyle
+\QASetCaptionStyle { #1 }
+
 \NewDocumentCommand \QAShowImageCenter { D<>{*} m D<>{*} }
   {
     \str_if_eq:nnTF { #1 } { * }
@@ -724,6 +774,7 @@
 \str_new:N \g__QA_Q_name_str
 \NewDocumentEnvironment { QA_Q } { D<>{} }
   {
+    \tl_set:Nn \l__QA_current_type_tl { Q }
     \str_if_empty:nF { #1 }
       {
         \str_gset:Nn \g__QA_Q_name_str { #1 }
@@ -746,7 +797,7 @@
       \begin{QA-entry}
         \str_if_in:NnT \l__QA_theme_str { ChatGPT }
           { \parskip=2\parskip }
-        \item[\hfill\color{QA-Q-text!33!QA-Q-back}\l_QA_logo_code_Q_tl]
+        \item[\hfill\color{QA-Q-text!33!QA-Q-back}\l_QA_Q_logo_code_tl]
         \str_case:NnT \l__QA_theme_str
           {
             { ChatGPT-dark  } {}
@@ -767,6 +818,7 @@
 \str_new:N \g__QA_A_name_str
 \NewDocumentEnvironment { QA_A } { D<>{} }
   {
+    \tl_set:Nn \l__QA_current_type_tl { A }
     \str_if_empty:nF { #1 }
       {
         \str_gset:Nn \g__QA_A_name_str { #1 }
@@ -789,7 +841,7 @@
       \begin{QA-entry}
         \str_if_in:NnT \l__QA_theme_str { ChatGPT }
           { \parskip=2\parskip }
-        \item[\hfill\color{QA-A-text!33!QA-A-back}\l_QA_logo_code_A_tl]
+        \item[\hfill\color{QA-A-text!33!QA-A-back}\l_QA_A_logo_code_tl]
         \str_case:NnT \l__QA_theme_str
           {
             { ChatGPT-dark  } {}
@@ -808,6 +860,7 @@
   }
 \NewDocumentEnvironment { QA_N } { D<>{} }
   {
+    \tl_set:Nn \l__QA_current_type_tl { N }
     \colorlet{paper}{QA-N-back}
     \colorlet{main-text}{QA-N-text}
     \colorlet{emph-text}{QA-N-emph}
@@ -844,12 +897,13 @@
 
     \RenewDocumentEnvironment { QA_A } { D<>{} }
       {
+        \tl_set:Nn \l__QA_current_type_tl { A }
         \str_if_empty:nF { #1 }
           {
             \str_gset:Nn \g__QA_A_name_str { #1 }
           }
         \color{QA-A-text}
-        \vspace{1em}
+        \vspace*{1em}
         \str_if_in:NnT \l__QA_theme_str { ChatGPT }
           { \vspace{.5em} }
         \str_if_in:NnT \l__QA_theme_str { ChatGPT-classical }
@@ -864,7 +918,7 @@
         \begin{QA-entry}[leftmargin=.5mm, itemindent=0pt, labelsep=\l_QA_list_labelsep_dim, labelwidth=3em]
           \str_if_in:NnT \l__QA_theme_str { ChatGPT }
             { \parskip=2\parskip }
-          \item[\hfill\color{QA-A-text!33!QA-A-back}\l_QA_logo_code_A_tl]
+          \item[\hfill\color{QA-A-text!33!QA-A-back}\l_QA_A_logo_code_tl]
           \str_case:NnT \l__QA_theme_str
             {
               { ChatGPT-dark  } {}
@@ -889,13 +943,13 @@
 
 \NewDocumentCommand \QASetLogoCode { O{void} m }
   {
-    \tl_set:cn { l_QA_logo_code_ #1 _tl } { #2 }
+    \tl_set:cn { l_QA_ #1 _logo_code_tl } { #2 }
   }
 \NewCommandCopy \SetLogoCode \QASetLogoCode
 
 % Set default logo code
-\SetLogoCode[Q]{\textbf{\l_QA_label_Q_tl}}
-\SetLogoCode[A]{\textbf{\l_QA_label_R_tl}}
+\SetLogoCode[Q]{\textbf{\l_QA_Q_label_tl}}
+\SetLogoCode[A]{\textbf{\l_QA_A_label_tl}}
 
 \newcounter{QA_Q}
 \newcounter{QA_A}
@@ -928,8 +982,8 @@
   }
 \NewDocumentCommand \QAShowCounter { m }
   {
-    \stepcounter{QA_#1}
-    \QA_show_subcounter_with_style:n { \tl_use:c {theQA_#1} }
+    \refstepcounter{QA_#1}
+    \QA_show_subcounter_with_style:n { \cs_if_exist_use:c {theQA_#1} }
   }
 
 \newcounter{QA_Q_aux}
@@ -1032,70 +1086,98 @@
 \bool_if:NT \l__QA_multiple_question_bool { \EnableMultipleQuestion }
 \bool_if:NT \l__QA_multiple_answer_bool   { \EnableMultipleAnswer   }
 
+\projlib_langauge_define_multilingual_text:Nn \l_QA_Q_label_text_tl
+  {
+    , EN = { Q }
+    , FR = { Q }
+    , DE = { F }
+    , IT = { D }
+    , PT = { P }
+    , BR = { P }
+    , ES = { P }
+    , CN = { 问 }
+    , TC = { 問 }
+    , JP = { Q }
+    , RU = { B }
+  }
 \bool_if:NTF \l__QA_numbered_question_bool
   {
-    \projlib_langauge_define_multilingual_text:Nn \l_QA_label_Q_tl
+    \projlib_langauge_define_multilingual_text:Nn \l_QA_Q_label_tl
       {
-        , EN = { Q \QAShowCounter{Q} \,: }
-        , FR = { Q \QAShowCounter{Q} :   }
-        , DE = { F \QAShowCounter{Q} \,: }
-        , IT = { D \QAShowCounter{Q} \,: }
-        , PT = { P \QAShowCounter{Q} \,: }
-        , BR = { P \QAShowCounter{Q} \,: }
-        , ES = { P \QAShowCounter{Q} \,: }
-        , CN = { 问 \QAShowCounter{Q} \,:\hspace{-.5em} }
-        , TC = { 問 \QAShowCounter{Q} \,:\hspace{-.5em} }
-        , JP = { Q \QAShowCounter{Q} \,: }
-        , RU = { B \QAShowCounter{Q} \,: }
+        , EN = { \l_QA_Q_label_text_tl \QAShowCounter{Q} \,: }
+        , FR = { \l_QA_Q_label_text_tl \QAShowCounter{Q} :   }
+        , DE = { \l_QA_Q_label_text_tl \QAShowCounter{Q} \,: }
+        , IT = { \l_QA_Q_label_text_tl \QAShowCounter{Q} \,: }
+        , PT = { \l_QA_Q_label_text_tl \QAShowCounter{Q} \,: }
+        , BR = { \l_QA_Q_label_text_tl \QAShowCounter{Q} \,: }
+        , ES = { \l_QA_Q_label_text_tl \QAShowCounter{Q} \,: }
+        , CN = { \l_QA_Q_label_text_tl \, \QAShowCounter{Q} \,:\hspace{-.5em} }
+        , TC = { \l_QA_Q_label_text_tl \, \QAShowCounter{Q} \,:\hspace{-.5em} }
+        , JP = { \l_QA_Q_label_text_tl \QAShowCounter{Q} \,: }
+        , RU = { \l_QA_Q_label_text_tl \QAShowCounter{Q} \,: }
       }
   }
   {
-    \projlib_langauge_define_multilingual_text:Nn \l_QA_label_Q_tl
+    \projlib_langauge_define_multilingual_text:Nn \l_QA_Q_label_tl
       {
-        , EN = { Q\,: }
-        , FR = { Q:   }
-        , DE = { F\,: }
-        , IT = { D\,: }
-        , PT = { P\,: }
-        , BR = { P\,: }
-        , ES = { P\,: }
-        , CN = { 问\,:\hspace{-.33em} }
-        , TC = { 問\,:\hspace{-.33em} }
-        , JP = { Q\,: }
-        , RU = { B\,: }
+        , EN = { \l_QA_Q_label_text_tl \,: }
+        , FR = { \l_QA_Q_label_text_tl :   }
+        , DE = { \l_QA_Q_label_text_tl \,: }
+        , IT = { \l_QA_Q_label_text_tl \,: }
+        , PT = { \l_QA_Q_label_text_tl \,: }
+        , BR = { \l_QA_Q_label_text_tl \,: }
+        , ES = { \l_QA_Q_label_text_tl \,: }
+        , CN = { \l_QA_Q_label_text_tl \,:\hspace{-.33em} }
+        , TC = { \l_QA_Q_label_text_tl \,:\hspace{-.33em} }
+        , JP = { \l_QA_Q_label_text_tl \,: }
+        , RU = { \l_QA_Q_label_text_tl \,: }
       }
   }
+\projlib_langauge_define_multilingual_text:Nn \l_QA_A_label_text_tl
+  {
+    , EN = { A }
+    , FR = { R }
+    , DE = { A }
+    , IT = { R }
+    , PT = { R }
+    , BR = { R }
+    , ES = { R }
+    , CN = { 答 }
+    , TC = { 答 }
+    , JP = { A }
+    , RU = { O }
+  }
 \bool_if:NTF \l__QA_numbered_answer_bool
   {
-    \projlib_langauge_define_multilingual_text:Nn \l_QA_label_R_tl
+    \projlib_langauge_define_multilingual_text:Nn \l_QA_A_label_tl
       {
-        , EN = { A \QAShowCounter{A} \,: }
-        , FR = { R \QAShowCounter{A} :   }
-        , DE = { A \QAShowCounter{A} \,: }
-        , IT = { R \QAShowCounter{A} \,: }
-        , PT = { R \QAShowCounter{A} \,: }
-        , BR = { R \QAShowCounter{A} \,: }
-        , ES = { R \QAShowCounter{A} \,: }
-        , CN = { 答 \QAShowCounter{A} \,:\hspace{-.5em} }
-        , TC = { 答 \QAShowCounter{A} \,:\hspace{-.5em} }
-        , JP = { A \QAShowCounter{A} \,: }
-        , RU = { O \QAShowCounter{A} \,: }
+        , EN = { \l_QA_A_label_text_tl \QAShowCounter{A} \,: }
+        , FR = { \l_QA_A_label_text_tl \QAShowCounter{A} :   }
+        , DE = { \l_QA_A_label_text_tl \QAShowCounter{A} \,: }
+        , IT = { \l_QA_A_label_text_tl \QAShowCounter{A} \,: }
+        , PT = { \l_QA_A_label_text_tl \QAShowCounter{A} \,: }
+        , BR = { \l_QA_A_label_text_tl \QAShowCounter{A} \,: }
+        , ES = { \l_QA_A_label_text_tl \QAShowCounter{A} \,: }
+        , CN = { \l_QA_A_label_text_tl \, \QAShowCounter{A} \,:\hspace{-.5em} }
+        , TC = { \l_QA_A_label_text_tl \, \QAShowCounter{A} \,:\hspace{-.5em} }
+        , JP = { \l_QA_A_label_text_tl \QAShowCounter{A} \,: }
+        , RU = { \l_QA_A_label_text_tl \QAShowCounter{A} \,: }
       }
   }
   {
-    \projlib_langauge_define_multilingual_text:Nn \l_QA_label_R_tl
+    \projlib_langauge_define_multilingual_text:Nn \l_QA_A_label_tl
       {
-        , EN = { A\,: }
-        , FR = { R:   }
-        , DE = { A\,: }
-        , IT = { R\,: }
-        , PT = { R\,: }
-        , BR = { R\,: }
-        , ES = { R\,: }
-        , CN = { 答\,:\hspace{-.33em} }
-        , TC = { 答\,:\hspace{-.33em} }
-        , JP = { A\,: }
-        , RU = { O\,: }
+        , EN = { \l_QA_A_label_text_tl \,: }
+        , FR = { \l_QA_A_label_text_tl :   }
+        , DE = { \l_QA_A_label_text_tl \,: }
+        , IT = { \l_QA_A_label_text_tl \,: }
+        , PT = { \l_QA_A_label_text_tl \,: }
+        , BR = { \l_QA_A_label_text_tl \,: }
+        , ES = { \l_QA_A_label_text_tl \,: }
+        , CN = { \l_QA_A_label_text_tl \,:\hspace{-.33em} }
+        , TC = { \l_QA_A_label_text_tl \,:\hspace{-.33em} }
+        , JP = { \l_QA_A_label_text_tl \,: }
+        , RU = { \l_QA_A_label_text_tl \,: }
       }
   }
 
@@ -1308,7 +1390,7 @@
         \seq_map_inline:Nn \l_tmpa_seq
           {
             \tl_put_right:Nn \l_QA_tmp_tl
-              { \QACompactCenterText { ####1 } }
+              { \QACaption { ####1 } }
           }
 
         \regex_replace_all:nnN
@@ -1382,10 +1464,6 @@
               }
           }
 
-        % \regex_replace_once:nnN
-        %   { ❄️ \ *? \[\*(.*?)\] (.*) }
-        %   { \c{QAItem} {\1} {\2} }
-        %   \l_QA_tmp_tl
         %% Process the first and wrap the others inside
         \regex_replace_once:nnN
           { ❄️ \ *? \[\*(.*?)\] (.*) }
@@ -1412,40 +1490,10 @@
           { \c{QAItem} {\1} {\2} }
           \l_QA_tmp_tl
 
-        %% Process the first and wrap the others inside
         \regex_replace_once:nnN
-          { ❄️ \ *? 【\*(.*?)】 (.*) }
-          { \c{QAItem} {\1} {\2} }
-          \l_QA_tmp_tl
-        %% Process the middle ones
-        \bool_set_false:N \l_QA_regex_no_more_match_bool
-        \bool_do_until:nn \l_QA_regex_no_more_match_bool
-          {
-            \regex_match:nVTF { 【\*(.*?)】 (.*?) 【\* } \l_QA_tmp_tl
-              {
-                \regex_replace_once:nnN
-                  { 【\*(.*?)】 (.*?) 【\* }
-                  { \c{QAItem} {\1} {\2} \c{QAadjustitem} 【\* }
-                  \l_QA_tmp_tl
-              }
-              {
-                \bool_set_true:N \l_QA_regex_no_more_match_bool
-              }
-          }
-        %% Process the last one
-        \regex_replace_once:nnN
-          { 【\*(.*?)】 (.*) }
-          { \c{QAItem} {\1} {\2} }
-          \l_QA_tmp_tl
-
-        \regex_replace_once:nnN
           { ❄️ \ *? \[(.*?)\] (\*?) (.*) }
           { \c{QAEnum} \2 {\1} {\3} }
           \l_QA_tmp_tl
-        \regex_replace_once:nnN
-          { ❄️ \ *? 【(.*?)】 (\*?) (.*) }
-          { \c{QAEnum} \2 {\1} {\3} }
-          \l_QA_tmp_tl
 
         \regex_replace_all:nnN
           { \*\*\* (.*?) \*\*\* }
@@ -1472,7 +1520,6 @@
     \tl_gput_right:Nn #1 { \QAendmark }
   }
 
-\box_new:N \l__QA_tmp_box
 \cs_new:Nn \__QA_put_current_content:n
   {
     \tl_if_empty:NF \g_QA_current_content_tl



More information about the tex-live-commits mailing list.