summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/q-and-a
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-11-20 03:04:02 +0000
committerNorbert Preining <norbert@preining.info>2023-11-20 03:04:02 +0000
commit682900f29e7ea9d31046e9541be14fd749b2eb17 (patch)
tree34d06fa9d427e231373629b5cc44517c583c84de /macros/latex/contrib/q-and-a
parentaa94b613f51dfa2b65c607585727b66875e765d8 (diff)
CTAN sync 202311200304
Diffstat (limited to 'macros/latex/contrib/q-and-a')
-rw-r--r--macros/latex/contrib/q-and-a/Q-and-A.cls198
-rw-r--r--macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex2
-rw-r--r--macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdfbin29394 -> 29542 bytes
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-content.tex81
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-dark.pdfbin0 -> 45378 bytes
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-light.pdfbin0 -> 45343 bytes
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical.tex51
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/code/Q-and-A-demo-ChatGPT-classical-code-1.py (renamed from macros/latex/contrib/q-and-a/demo/theme-ChatGPT/code/Q-and-A-example-code-1.py)0
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/images/Q-and-A-demo-ChatGPT-classical-logo-ChatGPT.pdf (renamed from macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-logo-ChatGPT.pdf)bin2703 -> 2703 bytes
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/images/Q-and-A-demo-ChatGPT-classical-logo-User.pdf (renamed from macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-logo-User.pdf)bin1444 -> 1444 bytes
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-content.tex6
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-dark.pdfbin45683 -> 111664 bytes
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-light.pdfbin45654 -> 111646 bytes
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT.tex42
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT/code/Q-and-A-demo-ChatGPT-code-1.py25
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-ChatGPT-logo-ChatGPT.pdfbin0 -> 2703 bytes
-rw-r--r--macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-ChatGPT-logo-User.pdfbin0 -> 1444 bytes
-rw-r--r--macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdfbin108248 -> 110412 bytes
-rw-r--r--macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex34
19 files changed, 383 insertions, 56 deletions
diff --git a/macros/latex/contrib/q-and-a/Q-and-A.cls b/macros/latex/contrib/q-and-a/Q-and-A.cls
index c865647b68..ee0edba93b 100644
--- a/macros/latex/contrib/q-and-a/Q-and-A.cls
+++ b/macros/latex/contrib/q-and-a/Q-and-A.cls
@@ -12,7 +12,7 @@
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplClass
{Q-and-A}
- {2023/11/17a} {}
+ {2023/11/19} {}
{Document class for typesetting Q&A conversation}
\keys_define:nn { Q-and-A }
@@ -40,6 +40,15 @@
, ChatGPT-dark .meta:n = { theme = ChatGPT-dark }
, ChatGPT~dark .meta:n = { theme = ChatGPT-dark }
, ChatGPT dark .meta:n = { theme = ChatGPT-dark }
+ , ChatGPT-classical .meta:n = { theme = ChatGPT-classical-light }
+ , ChatGPT-classical-light .meta:n = { theme = ChatGPT-classical-light }
+ , ChatGPT-classical~light .meta:n = { theme = ChatGPT-classical-light }
+ , ChatGPT~classical~light .meta:n = { theme = ChatGPT-classical-light }
+ , ChatGPT classical light .meta:n = { theme = ChatGPT-classical-light }
+ , ChatGPT-classical-dark .meta:n = { theme = ChatGPT-classical-dark }
+ , ChatGPT-classical~dark .meta:n = { theme = ChatGPT-classical-dark }
+ , ChatGPT~classical~dark .meta:n = { theme = ChatGPT-classical-dark }
+ , ChatGPT classical dark .meta:n = { theme = ChatGPT-classical-dark }
, numbered-question .bool_set:N = \l__QA_numbered_question_bool
, numbered-question .initial:n = { false }
@@ -132,6 +141,36 @@
\definecolor{QA-Q-back}{RGB}{ 52, 53, 65}
\definecolor{QA-Q-text}{RGB}{236,236,241}
\definecolor{QA-Q-emph}{RGB}{255,255,255}
+ \colorlet{QA-A-back}{QA-Q-back}
+ \colorlet{QA-A-text}{QA-Q-text}
+ \colorlet{QA-A-emph}{QA-Q-emph}
+ \colorlet{QA-N-back}{QA-Q-back}
+ \colorlet{QA-N-text}{QA-Q-text}
+ \colorlet{paper}{QA-Q-back}
+ \colorlet{main-text}{QA-Q-text}
+ \colorlet{emph-text}{QA-Q-text}
+ }
+
+\str_if_eq:onT { \l__QA_theme_str } { ChatGPT-light }
+ {
+ \definecolor{QA-Q-back}{RGB}{255,255,255}
+ \definecolor{QA-Q-text}{RGB}{ 52, 53, 65}
+ \definecolor{QA-Q-emph}{RGB}{ 0, 0, 0}
+ \colorlet{QA-A-back}{QA-Q-back}
+ \colorlet{QA-A-text}{QA-Q-text}
+ \colorlet{QA-A-emph}{QA-Q-emph}
+ \colorlet{QA-N-back}{QA-Q-back}
+ \colorlet{QA-N-text}{QA-Q-text}
+ \colorlet{paper}{QA-Q-back}
+ \colorlet{main-text}{QA-Q-text}
+ \colorlet{emph-text}{QA-Q-text}
+ }
+
+\str_if_eq:onT { \l__QA_theme_str } { ChatGPT-classical-dark }
+ {
+ \definecolor{QA-Q-back}{RGB}{ 52, 53, 65}
+ \definecolor{QA-Q-text}{RGB}{236,236,241}
+ \definecolor{QA-Q-emph}{RGB}{255,255,255}
\definecolor{QA-A-back}{RGB}{ 68, 70, 84}
\definecolor{QA-A-text}{RGB}{209,213,219}
\definecolor{QA-A-emph}{RGB}{255,255,255}
@@ -142,7 +181,7 @@
\colorlet{emph-text}{QA-Q-text}
}
-\str_if_eq:onT { \l__QA_theme_str } { ChatGPT-light }
+\str_if_eq:onT { \l__QA_theme_str } { ChatGPT-classical-light }
{
\definecolor{QA-Q-back}{RGB}{255,255,255}
\definecolor{QA-Q-text}{RGB}{ 52, 53, 65}
@@ -184,7 +223,7 @@
\dim_new:N \l_QA_list_labelsep_dim
\dim_set:Nn \l_QA_list_labelsep_dim { 1em }
-\exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+\str_if_in:NnT \l__QA_theme_str { ChatGPT }
{
\dim_set:Nn \l_QA_item_indentation_dim { .33em }
\dim_set:Nn \l_QA_list_indentation_dim { 4.5em + \l__QA_extra_left_margin_dim }
@@ -290,7 +329,17 @@
\tcbset{QA-additional/.style={}}
% ChatGPT style
-\exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+\str_if_in:NnT \l__QA_theme_str { ChatGPT }
+ {
+ \tcbset{QA-additional/.style={
+ fontupper=\sffamily,
+ code={\onehalfspacing},
+ top=1.5em,
+ bottom=1.5em,
+ }
+ }
+ }
+\str_if_in:NnT \l__QA_theme_str { ChatGPT-classical }
{
\tcbset{QA-additional/.style={
fontupper=\sffamily,
@@ -533,6 +582,25 @@
\dim_gset:Nn \labelsep { \l_tmpa_dim }
}
+\NewDocumentCommand \QASection { m }
+ {
+ \par\medskip\smallskip
+ \textbf{\larger[1.5]#1}
+ \par\smallskip
+ }
+\NewDocumentCommand \QASubSection { m }
+ {
+ \par\medskip
+ \textbf{\larger#1}
+ \par\smallskip
+ }
+\NewDocumentCommand \QASubSubSection { m }
+ {
+ \par\smallskip
+ \textbf{#1}
+ \par\smallskip
+ }
+
\newenvironment{QACompactCenter}
{\parskip=0pt\par\nopagebreak\centering}
{\par\noindent\ignorespacesafterend}
@@ -625,7 +693,7 @@
% \textcolor{emph-text}{\texttt{#1}}
\QACodebox{\vphantom{Äpgjy}#1}
}
-\exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+\str_if_in:NnT \l__QA_theme_str { ChatGPT }
{
\RenewDocumentCommand \QACode { m }
{
@@ -652,8 +720,14 @@
}
\NewDocumentEnvironment { QA_void } { } { } { }
+
+\str_new:N \g__QA_Q_name_str
\NewDocumentEnvironment { QA_Q } { D<>{} }
{
+ \str_if_empty:nF { #1 }
+ {
+ \str_gset:Nn \g__QA_Q_name_str { #1 }
+ }
\colorlet{paper}{QA-Q-back}
\colorlet{main-text}{QA-Q-text}
\colorlet{emph-text}{QA-Q-emph}
@@ -665,21 +739,38 @@
colback={QA-Q-back},
colupper={QA-Q-text},
]
- \exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+ \str_if_in:NnT \l__QA_theme_str { ChatGPT }
{ \vspace{-.5\parskip} }
\vspace{-.5\parskip} % due to "parbox=false"
\vspace{-\parskip}
\begin{QA-entry}
- \exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+ \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]
+ \str_case:NnT \l__QA_theme_str
+ {
+ { ChatGPT-dark } {}
+ { ChatGPT-light } {}
+ }
+ {
+ \str_if_empty:NF \g__QA_Q_name_str
+ {
+ \textbf{ \g__QA_Q_name_str }\\
+ }
+ }
}
{
\end{QA-entry}
\end{tcolorbox}
}
+
+\str_new:N \g__QA_A_name_str
\NewDocumentEnvironment { QA_A } { D<>{} }
{
+ \str_if_empty:nF { #1 }
+ {
+ \str_gset:Nn \g__QA_A_name_str { #1 }
+ }
\colorlet{paper}{QA-A-back}
\colorlet{main-text}{QA-A-text}
\colorlet{emph-text}{QA-A-emph}
@@ -691,14 +782,25 @@
colback={QA-A-back},
colupper={QA-A-text},
]
- \exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+ \str_if_in:NnT \l__QA_theme_str { ChatGPT }
{ \vspace{-.5\parskip} }
\vspace{-.5\parskip} % due to "parbox=false"
\vspace{-\parskip}
\begin{QA-entry}
- \exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+ \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]
+ \str_case:NnT \l__QA_theme_str
+ {
+ { ChatGPT-dark } {}
+ { ChatGPT-light } {}
+ }
+ {
+ \str_if_empty:NF \g__QA_A_name_str
+ {
+ \textbf{ \g__QA_A_name_str }\\
+ }
+ }
}
{
\end{QA-entry}
@@ -709,7 +811,7 @@
\colorlet{paper}{QA-N-back}
\colorlet{main-text}{QA-N-text}
\colorlet{emph-text}{QA-N-emph}
- \exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+ \str_if_in:NnT \l__QA_theme_str { ChatGPT }
{
\colorlet{QA-code-title-back}{QA-A-back}
\colorlet{QA-code-title-text}{QA-A-text}
@@ -742,26 +844,46 @@
\RenewDocumentEnvironment { QA_A } { D<>{} }
{
+ \str_if_empty:nF { #1 }
+ {
+ \str_gset:Nn \g__QA_A_name_str { #1 }
+ }
\color{QA-A-text}
\vspace{1em}
- \exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+ \str_if_in:NnT \l__QA_theme_str { ChatGPT }
+ { \vspace{.5em} }
+ \str_if_in:NnT \l__QA_theme_str { ChatGPT-classical }
+ { \vspace{.5em} }
+ \str_if_in:NnT \l__QA_theme_str { ChatGPT }
{
- \vspace{1em}
\sffamily
\onehalfspacing
\vspace{-.5\parskip}
}
\vspace{-.5\parskip}
\begin{QA-entry}[leftmargin=.5mm, itemindent=0pt, labelsep=\l_QA_list_labelsep_dim, labelwidth=3em]
- \exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
+ \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]
+ \str_case:NnT \l__QA_theme_str
+ {
+ { ChatGPT-dark } {}
+ { ChatGPT-light } {}
+ }
+ {
+ \str_if_empty:NF \g__QA_A_name_str
+ {
+ \textbf{ \g__QA_A_name_str }\\
+ }
+ }
}
{
\end{QA-entry}
\vspace{1em}
- \exp_args:No \str_if_in:nnT { \l__QA_theme_str } { ChatGPT }
- { \vspace{1em} }
+ \str_if_in:NnT \l__QA_theme_str { ChatGPT }
+ { \vspace{.5em} }
+ \str_if_in:NnT \l__QA_theme_str { ChatGPT-classical }
+ { \vspace{.5em} }
}
}
@@ -818,6 +940,10 @@
\bool_gset_false:N \g__QA_Q_multiple_counter_already_enabled_bool
\NewDocumentCommand \EnableMultipleQuestion { }
{
+ \hook_gput_next_code:nn { env/QA_Q/before } { \__QA_Q_multiple_enable_core: }
+ }
+\cs_new:Nn \__QA_Q_multiple_enable_core:
+ {
\bool_if:NF \g__QA_Q_multiple_counter_already_enabled_bool
{
\setcounter{QA_Q_aux}{\value{QA_Q}} % set the outer counter
@@ -841,6 +967,10 @@
}
\NewDocumentCommand \DisableMultipleQuestion { }
{
+ \hook_gput_next_code:nn { env/QA_Q/before } { \__QA_Q_multiple_disable_core: }
+ }
+\cs_new:Nn \__QA_Q_multiple_disable_core:
+ {
\bool_if:NT \g__QA_Q_multiple_counter_already_enabled_bool
{
\counterwithout{QA_Q}{QA_Q_aux}
@@ -857,10 +987,14 @@
\bool_gset_false:N \g__QA_A_multiple_counter_already_enabled_bool
\NewDocumentCommand \EnableMultipleAnswer { }
{
+ \hook_gput_next_code:nn { env/QA_A/before } { \__QA_A_multiple_enable_core: }
+ }
+\cs_new:Nn \__QA_A_multiple_enable_core:
+ {
\bool_if:NF \g__QA_A_multiple_counter_already_enabled_bool
{
\setcounter{QA_A_aux}{\value{QA_A}} % set the outer counter
- % \addtocounter{QA_A_aux}{1}
+ \addtocounter{QA_A_aux}{1}
\setcounter{QA_A}{0} % reset the inner counter
\counterwithin{QA_A}{QA_A_aux}
\hook_gput_code:nnn { env/QA_A/begin } { Q-and-A-multi-A }
@@ -880,11 +1014,15 @@
}
\NewDocumentCommand \DisableMultipleAnswer { }
{
+ \hook_gput_next_code:nn { env/QA_A/before } { \__QA_A_multiple_disable_core: }
+ }
+\cs_new:Nn \__QA_A_multiple_disable_core:
+ {
\bool_if:NT \g__QA_A_multiple_counter_already_enabled_bool
{
\counterwithout{QA_A}{QA_A_aux}
\setcounter{QA_A}{\value{QA_A_aux}} % set the outer counter
- % \addtocounter{QA_A}{-1}
+ \addtocounter{QA_A}{-1}
\hook_gremove_code:nn { env/QA_A/begin } { Q-and-A-multi-A }
\hook_gremove_code:nn { env/QA_Q/begin } { Q-and-A-multi-A }
}
@@ -1118,17 +1256,29 @@
{ ⚛ \c{section} }
\l_QA_tmp_tl
\regex_replace_all:nnN
- { \#\#\#\# }
+ { \#\#\#\#\- }
{ ⚛ \c{subsubsection}\* }
\l_QA_tmp_tl
\regex_replace_all:nnN
- { \#\#\# }
+ { \#\#\#\- }
{ ⚛ \c{subsection}\* }
\l_QA_tmp_tl
\regex_replace_all:nnN
- { \#\# }
+ { \#\#\- }
{ ⚛ \c{section}\* }
\l_QA_tmp_tl
+ \regex_replace_all:nnN
+ { \#\#\#\# }
+ { \c{QASubSubSection} }
+ \l_QA_tmp_tl
+ \regex_replace_all:nnN
+ { \#\#\# }
+ { \c{QASubSection} }
+ \l_QA_tmp_tl
+ \regex_replace_all:nnN
+ { \#\# }
+ { \c{QASection} }
+ \l_QA_tmp_tl
\regex_replace_all:nnN
{ \`\` }
@@ -1358,6 +1508,14 @@
{
\end { Q-and-A }
\vspace{-1mm}
+ \str_case:NnT \l__QA_theme_str
+ {
+ { ChatGPT-dark } {}
+ { ChatGPT-light } {}
+ }
+ {
+ \vspace{1em}
+ }
\egroup
\dimen0=\dp0
\pdfpageheight=\dimexpr\ht0\relax
diff --git a/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex
index a7ee5787ed..9dabdc5dc7 100644
--- a/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex
+++ b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple-content.tex
@@ -28,7 +28,7 @@
Answer.
"
- Now stop the **multiple question** mode, and start the **multiple answer** mode.
+ Now stop the multiple question mode, and start the **multiple answer** mode.
\DisableMultipleQuestion
diff --git a/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdf b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdf
index 8c7b209882..620746bd50 100644
--- a/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdf
+++ b/macros/latex/contrib/q-and-a/demo/mode-multiple/Q-and-A-demo-multiple.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-content.tex b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-content.tex
new file mode 100644
index 0000000000..68e24d871e
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-content.tex
@@ -0,0 +1,81 @@
+"
+ The following conversation is generated by ChatGPT (with GPT-3.5) on \TheDate{2023-11-01}.
+
+? <You>
+ What is artificial intelligence (AI)?
+
+: <ChatGPT>
+ Artificial intelligence, or AI, refers to the development of computer systems that can perform tasks that typically require human intelligence, such as learning, reasoning, problem-solving, and decision-making. AI technologies aim to simulate human cognitive functions in machines, enabling them to understand and respond to data, make predictions, and adapt to changing circumstances.
+
+?
+ What are some common applications of AI?
+
+:
+ AI has a wide range of applications, including:
+
+ [Natural Language Processing (NLP)]
+ [*] Chatbots
+ [*] Language translation
+ [*] Sentiment analysis
+
+ [Computer Vision]
+ [*] Image and video analysis
+ [*] Facial recognition
+ [*] Autonomous vehicles
+
+ [Machine Learning]
+ [*] Predictive analytics
+ [*] Recommendation systems
+ [*] Fraud detection
+
+ [Robotics]
+ [*] Automation in manufacturing
+ [*] Healthcare assistance
+ [*] Service industries
+
+ [Healthcare]
+ [*] Disease diagnosis
+ [*] Drug discovery
+ [*] Personalized treatment plans
+
+ [Finance]
+ [*] Algorithmic trading
+ [*] Risk assessment
+ [*] Customer support
+
+?
+ How does machine learning relate to AI?
+
+:
+ Machine learning is a subfield of AI that focuses on developing algorithms and models that allow computers to learn from and make predictions or decisions based on data. It's a crucial component of AI because it enables systems to improve their performance over time by learning from past experiences.
+
+?
+ Are there different types of machine learning?
+
+:
+ Yes, there are three main types of machine learning:
+
+ [Supervised Learning]
+ In this type, the model is trained on labeled data, making predictions based on known examples.
+
+ [Unsupervised Learning]
+ Unsupervised learning involves finding patterns or structures in unlabeled data without specific guidance.
+
+ [Reinforcement Learning]
+ Reinforcement learning is about training agents to make sequences of decisions to maximize a reward in an environment.
+
+?
+ Can you provide an example of Python code for a simple machine learning model?
+
+:
+ Certainly! Here's a basic Python code example for training a linear regression model using the popular scikit-learn library:
+
+ == [python] {code/Q-and-A-demo-ChatGPT-classical-code-1.py}
+
+ This code demonstrates a simple linear regression model for predicting housing prices. You can use scikit-learn to create and evaluate various machine learning models in Python.
+
+?
+ What are some ethical considerations in AI and machine learning?
+
+:
+ Ethical concerns in AI and machine learning include issues like bias in algorithms, data privacy, job displacement due to automation, and the responsible use of AI in areas like healthcare and law enforcement. It's important to address these concerns to ensure that AI benefits society as a whole.
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-dark.pdf b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-dark.pdf
new file mode 100644
index 0000000000..f01abba240
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-dark.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-light.pdf b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-light.pdf
new file mode 100644
index 0000000000..049998b187
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical-light.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical.tex b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical.tex
new file mode 100644
index 0000000000..2b93876f38
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/Q-and-A-demo-ChatGPT-classical.tex
@@ -0,0 +1,51 @@
+\documentclass[%11pt,
+ use theme = ChatGPT-classical-light,
+ % use theme = ChatGPT-classical-dark,
+ scroll,
+]{Q-and-A}
+
+% The User Logo
+\SetLogoCode[Q]{%
+ \smash{\raisebox{-.65\baselineskip}{%
+ \begin{tikzpicture}
+ \node [inner sep=0pt] at (0,0) {\includegraphics[height=1.5\baselineskip]{Q-and-A-demo-ChatGPT-classical-logo-User}};
+ \draw [QA-Q-back, rounded corners=.15\baselineskip, line width=.2\baselineskip]
+ (current bounding box.north west) --
+ (current bounding box.north east) --
+ (current bounding box.south east) --
+ (current bounding box.south west) -- cycle;
+ \end{tikzpicture}%
+ }\hspace{-.25em}%
+ }}
+% The ChatGPT Logo
+\SetLogoCode[A]{%
+ \smash{\raisebox{-.65\baselineskip}{%
+ \begin{tikzpicture}
+ \node [inner sep=0pt] at (0,0) {\includegraphics[height=1.5\baselineskip]{Q-and-A-demo-ChatGPT-classical-logo-ChatGPT}};
+ \draw [QA-A-back, rounded corners=.15\baselineskip, line width=.2\baselineskip]
+ (current bounding box.north west) --
+ (current bounding box.north east) --
+ (current bounding box.south east) --
+ (current bounding box.south west) -- cycle;
+ \end{tikzpicture}%
+ }\hspace{-.25em}%
+ }}
+
+
+\begin{document}
+
+
+:: {Q-and-A-demo-ChatGPT-classical-content}
+
+"
+ Below is the code of this conversation.
+
+ == {Q-and-A-demo-ChatGPT-classical-content}
+
+"
+ Below is the code of the main document.
+
+ == [latex] {\jobname}
+
+
+\end{document}
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/code/Q-and-A-example-code-1.py b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/code/Q-and-A-demo-ChatGPT-classical-code-1.py
index ac8e3e09c0..ac8e3e09c0 100644
--- a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/code/Q-and-A-example-code-1.py
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/code/Q-and-A-demo-ChatGPT-classical-code-1.py
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-logo-ChatGPT.pdf b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/images/Q-and-A-demo-ChatGPT-classical-logo-ChatGPT.pdf
index bd89da4131..bd89da4131 100644
--- a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-logo-ChatGPT.pdf
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/images/Q-and-A-demo-ChatGPT-classical-logo-ChatGPT.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-logo-User.pdf b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/images/Q-and-A-demo-ChatGPT-classical-logo-User.pdf
index fc3a741085..fc3a741085 100644
--- a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-logo-User.pdf
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT-classical/images/Q-and-A-demo-ChatGPT-classical-logo-User.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-content.tex b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-content.tex
index 8db7a03a33..1d6d4cc0ab 100644
--- a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-content.tex
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-content.tex
@@ -1,10 +1,10 @@
"
The following conversation is generated by ChatGPT (with GPT-3.5) on \TheDate{2023-11-01}.
-?
+? <You>
What is artificial intelligence (AI)?
-:
+: <ChatGPT>
Artificial intelligence, or AI, refers to the development of computer systems that can perform tasks that typically require human intelligence, such as learning, reasoning, problem-solving, and decision-making. AI technologies aim to simulate human cognitive functions in machines, enabling them to understand and respond to data, make predictions, and adapt to changing circumstances.
?
@@ -70,7 +70,7 @@
:
Certainly! Here's a basic Python code example for training a linear regression model using the popular scikit-learn library:
- == [python] {code/Q-and-A-example-code-1.py}
+ == [python] {code/Q-and-A-demo-ChatGPT-code-1.py}
This code demonstrates a simple linear regression model for predicting housing prices. You can use scikit-learn to create and evaluate various machine learning models in Python.
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-dark.pdf b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-dark.pdf
index 9ccbae5242..6f06282c23 100644
--- a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-dark.pdf
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-dark.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-light.pdf b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-light.pdf
index 82349a5414..d0929037aa 100644
--- a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-light.pdf
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT-light.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT.tex b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT.tex
index fb5be3e4ce..bcbbdc5496 100644
--- a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT.tex
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/Q-and-A-demo-ChatGPT.tex
@@ -6,37 +6,29 @@
% The User Logo
\SetLogoCode[Q]{%
- \smash{\raisebox{-.65\baselineskip}{%
+ \smash{\raisebox{-.35\baselineskip}{%
\begin{tikzpicture}
- \node [inner sep=0pt] at (0,0) {\includegraphics[height=1.5\baselineskip]{Q-and-A-demo-logo-User}};
- \draw [QA-Q-back, rounded corners=.15\baselineskip, line width=.2\baselineskip]
- (current bounding box.north west) --
- (current bounding box.north east) --
- (current bounding box.south east) --
- (current bounding box.south west) -- cycle;
- \clip (current bounding box.north west) --
- (current bounding box.north east) --
- (current bounding box.south east) --
- (current bounding box.south west) -- cycle;
+ \clip (0,0) circle (.54\baselineskip);
+ \draw [QA-A-emph, line width=.04\baselineskip]
+ (0,0) circle (.52\baselineskip);
+ \node [inner sep=0pt, opacity=.7] at (0,0) {\includegraphics[height=1.2\baselineskip]{Q-and-A-demo-ChatGPT-logo-User}};
+ \clip (0,0) circle (.5\baselineskip);
+ \node [inner sep=0pt] at (0,0) {\includegraphics[height=1.2\baselineskip]{Q-and-A-demo-ChatGPT-logo-User}};
\end{tikzpicture}%
- }\hspace{-.25em}%
+ }\hspace{-.75em}%
}}
% The ChatGPT Logo
\SetLogoCode[A]{%
- \smash{\raisebox{-.65\baselineskip}{%
+ \smash{\raisebox{-.35\baselineskip}{%
\begin{tikzpicture}
- \node [inner sep=0pt] at (0,0) {\includegraphics[height=1.5\baselineskip]{Q-and-A-demo-logo-ChatGPT}};
- \draw [QA-A-back, rounded corners=.15\baselineskip, line width=.2\baselineskip]
- (current bounding box.north west) --
- (current bounding box.north east) --
- (current bounding box.south east) --
- (current bounding box.south west) -- cycle;
- \clip (current bounding box.north west) --
- (current bounding box.north east) --
- (current bounding box.south east) --
- (current bounding box.south west) -- cycle;
+ \clip (0,0) circle (.54\baselineskip);
+ \draw [QA-A-emph, line width=.04\baselineskip]
+ (0,0) circle (.52\baselineskip);
+ \node [inner sep=0pt, opacity=.7] at (0,0) {\includegraphics[height=1.2\baselineskip]{Q-and-A-demo-ChatGPT-logo-ChatGPT}};
+ \clip (0,0) circle (.5\baselineskip);
+ \node [inner sep=0pt] at (0,0) {\includegraphics[height=1.2\baselineskip]{Q-and-A-demo-ChatGPT-logo-ChatGPT}};
\end{tikzpicture}%
- }\hspace{-.25em}%
+ }\hspace{-.75em}%
}}
@@ -45,6 +37,8 @@
:: {Q-and-A-demo-ChatGPT-content}
+---
+
"
Below is the code of this conversation.
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/code/Q-and-A-demo-ChatGPT-code-1.py b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/code/Q-and-A-demo-ChatGPT-code-1.py
new file mode 100644
index 0000000000..ac8e3e09c0
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/code/Q-and-A-demo-ChatGPT-code-1.py
@@ -0,0 +1,25 @@
+# Import the necessary libraries
+from sklearn import datasets
+from sklearn.model_selection import train_test_split
+from sklearn.linear_model import LinearRegression
+from sklearn.metrics import mean_squared_error
+
+# Load a sample dataset (e.g., the Boston Housing dataset)
+data = datasets.load_boston()
+X, y = data.data, data.target
+
+# Split the dataset into training and testing sets
+X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
+
+# Create a linear regression model
+model = LinearRegression()
+
+# Train the model on the training data
+model.fit(X_train, y_train)
+
+# Make predictions on the test data
+y_pred = model.predict(X_test)
+
+# Calculate the mean squared error to evaluate the model
+mse = mean_squared_error(y_test, y_pred)
+print(f"Mean Squared Error: {mse}") \ No newline at end of file
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-ChatGPT-logo-ChatGPT.pdf b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-ChatGPT-logo-ChatGPT.pdf
new file mode 100644
index 0000000000..bd89da4131
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-ChatGPT-logo-ChatGPT.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-ChatGPT-logo-User.pdf b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-ChatGPT-logo-User.pdf
new file mode 100644
index 0000000000..fc3a741085
--- /dev/null
+++ b/macros/latex/contrib/q-and-a/demo/theme-ChatGPT/images/Q-and-A-demo-ChatGPT-logo-User.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdf b/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdf
index f810f598d1..aaf9b6c812 100644
--- a/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdf
+++ b/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex b/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex
index 369b6efd90..ef442a2259 100644
--- a/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex
+++ b/macros/latex/contrib/q-and-a/doc/Q-and-A-doc.tex
@@ -5,8 +5,8 @@
scroll,
]{Q-and-A}
-\def\PackageVersion{2023/11/17}
-\def\PackageSubVersion{a}
+\def\PackageVersion{2023/11/19}
+\def\PackageSubVersion{}
\newcommand{\QApackage}{{\normalfont\textsf{Q-and-A}}}
@@ -72,10 +72,19 @@
\begin{itemize}
\item Font size options such as `11pt`, `12pt`.
\item `scroll`: turn the scroll mode on, which generates a single-page pdf similar to a long screenshot. It is recommended to use this option if your document contains some large piece of code.
- \item `use theme = \meta{theme}`: use the selected theme, available choices include: `default` (like the current document), `ChatGPT-light` and `ChatGPT-dark` (see the demo documents).
+ \item `use theme = \meta{theme}`: use the selected theme, available choices include:
+ \begin{itemize}
+ \item `default` (like the current document);
+ \item `ChatGPT-light` and `ChatGPT-dark` (see the demo documents);
+ \item `ChatGPT-classical-light` and `ChatGPT-classical-dark` (see the demo documents).
+ \end{itemize}
\item `numbered question`, or `question number`: enable the numbering of questions.
\item `numbered answer`, or `answer number`: enable the numbering of answers.
- \item `multiple question` and `multiple answer`: enable subcounter for questions and answers. This can also be enabled/disabled manually in the middle of the document, via `\textbackslash EnableMultipleQuestion` / `\textbackslash DisableMultipleQuestion` and `\textbackslash EnableMultipleAnswer` / `\textbackslash DisableMultipleAnswer`.
+ \item `multiple question` and `multiple answer`: enable subcounter for questions and answers. This can also be enabled/disabled manually in the middle of the document, via:
+ \begin{itemize}
+ \item `\textbackslash EnableMultipleQuestion` / `\textbackslash DisableMultipleQuestion` and
+ \item `\textbackslash EnableMultipleAnswer` / `\textbackslash DisableMultipleAnswer`.
+ \end{itemize}
\item `smaller subcounter`: when `multiple question` (and/or `multiple answer`) is enabled, use this option to show the subcounter in a smaller size.
\item `enlarge left margin by = \meta{length}`, or `increase left margin by = \meta{length}`: enlarge the left margin by the amount of `\meta{length}`. This would be useful if there are so many questions/answers that the numbering becomes too long to fit in the margin.
\QANote{Here `\meta{length}` should be specified with absolute unit like `pt`, `cm`, `mm`, `in`, etc., but not with unit like `ex` or `em`.}
@@ -94,7 +103,7 @@
\item An answer begins with the prefix `A:` or `:`.
\item A narration begins with the prefix `N:` or `"`.
\end{itemize}
- >>> Note that this depends on the current language. The prefixes `?`, `:` and `"` being universal, yet~—
+ \QANote{Note that this depends on the current language. The prefixes `?`, `:` and `"` being universal, yet~—
\begin{itemize}
\item for French, it is Q\&R\&N, thus the alphabetical prefixes become `Q:`, `R:` and `N:`;
\item for German, it is F\&A\&E, thus the alphabetical prefixes become `F:`, `A:` and `E:`;
@@ -104,7 +113,9 @@
\item for Spanish, it is P\&R\&N, thus the alphabetical prefixes become `P:`, `R:` and `N:`;
\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}
+ \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.}
[Emphasize and Bold]
\begin{itemize}
@@ -151,14 +162,19 @@
[Sections]
\begin{itemize}
- \item You may start a new (*unnumbered*) ---
+ \item Inside questions/answers, you may start a new (*unnumbered*) ---
\begin{itemize}
\item section, via `\textsharp\textsharp{} \{\meta{section title}\}`;
\item subsection, via `\textsharp\textsharp\textsharp{} \{\meta{subsection title}\}`;
\item subsubsection, via `\textsharp\textsharp\textsharp\textsharp{} \{\meta{subsubsection title}\}`;
\end{itemize}
- \item If you wish to use the *numbered* version, write `\textsharp\textsharp+`, `\textsharp\textsharp\textsharp+` and `\textsharp\textsharp\textsharp\textsharp+` instead.
+ \item To start a section outside questions/answers:
+ \begin{itemize}
+ \item For the *unnumbered* version, write `\textsharp\textsharp-`, `\textsharp\textsharp\textsharp-` and `\textsharp\textsharp\textsharp\textsharp-` instead.
+ \item For the *numbered* version, write `\textsharp\textsharp+`, `\textsharp\textsharp\textsharp+` and `\textsharp\textsharp\textsharp\textsharp+` instead.
+ \end{itemize}
\end{itemize}
+ \QANote{Note that, *numbered* sections inside questions/answers are not provided, since they do not seem to be quite useful (for example, Markdown doesn't provide numbered sections) and, on the other hand, one could simply use emphasized enumerate.}
[Input/Include Files]
\begin{itemize}
@@ -273,6 +289,8 @@
%% 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 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}