From 275a181f003d2af5b7d9ca34f2b15f6511b3ea29 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 12 Feb 2024 03:02:04 +0000 Subject: CTAN sync 202402120302 --- macros/xetex/latex/exam-zh/CHANGELOG.md | 31 ++ .../latex/exam-zh/doc/back/main-changelog.tex | 1 + macros/xetex/latex/exam-zh/doc/body/usage.tex | 143 ++++++- .../xetex/latex/exam-zh/doc/exam-zh-doc-setup.tex | 6 +- macros/xetex/latex/exam-zh/doc/exam-zh-doc.pdf | Bin 1595273 -> 1607182 bytes macros/xetex/latex/exam-zh/doc/exam-zh-doc.tex | 47 +-- .../latex/exam-zh/examples/example-multiple.pdf | Bin 160210 -> 160276 bytes .../latex/exam-zh/examples/example-single.pdf | Bin 134928 -> 148041 bytes .../latex/exam-zh/examples/example-single.tex | 16 +- .../latex/exam-zh/tex/exam-zh-chinese-english.sty | 2 +- macros/xetex/latex/exam-zh/tex/exam-zh-choices.sty | 2 +- macros/xetex/latex/exam-zh/tex/exam-zh-font.sty | 2 +- macros/xetex/latex/exam-zh/tex/exam-zh-math.sty | 427 +++++++++++++++++++++ .../xetex/latex/exam-zh/tex/exam-zh-question.sty | 141 ++++++- macros/xetex/latex/exam-zh/tex/exam-zh-symbols.sty | 2 +- .../xetex/latex/exam-zh/tex/exam-zh-textfigure.sty | 22 +- macros/xetex/latex/exam-zh/tex/exam-zh.cls | 5 +- 17 files changed, 769 insertions(+), 78 deletions(-) create mode 100644 macros/xetex/latex/exam-zh/tex/exam-zh-math.sty (limited to 'macros/xetex') diff --git a/macros/xetex/latex/exam-zh/CHANGELOG.md b/macros/xetex/latex/exam-zh/CHANGELOG.md index 9fba646315..cd4627352f 100644 --- a/macros/xetex/latex/exam-zh/CHANGELOG.md +++ b/macros/xetex/latex/exam-zh/CHANGELOG.md @@ -5,6 +5,37 @@ 格式参照 [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 并且此项目遵守 [Semantic Versioning](https://semver.org/spec/v2.0.0.html)。 +## [0.2.1] - 2024-02-11 + +### Added + +- 增加答案控制功能 +- 增加计算题排版环境 `calculations` + +### Fixed + +- 修复 `section` 的超链接问题 + + +## [0.1.29] - 2024-02-07 + +### Added + +- 增加 `fig-pos` 的同义选项 `pos` + +### Changed + +- 修改 `textfigure` 的选项的一些默认值 + + + +## [0.1.28] - 2023-07-14 + +### Changed + +- 修改 `\paren` 的宽度细节 + + ## [0.1.27] - 2023-06-27 ### Added diff --git a/macros/xetex/latex/exam-zh/doc/back/main-changelog.tex b/macros/xetex/latex/exam-zh/doc/back/main-changelog.tex index f3a51e79e1..1b339b2a64 100644 --- a/macros/xetex/latex/exam-zh/doc/back/main-changelog.tex +++ b/macros/xetex/latex/exam-zh/doc/back/main-changelog.tex @@ -8,4 +8,5 @@ \item 2022.6 开发密封线、草稿纸、评分框 \item 2022.7 增加语文英语题型 \item 2022.8 开发图文排版模版 + \item 2024.2 发布答案控制功能、计算题排版功能 \end{itemize} \ No newline at end of file diff --git a/macros/xetex/latex/exam-zh/doc/body/usage.tex b/macros/xetex/latex/exam-zh/doc/body/usage.tex index 9d1191f76b..85566213f4 100644 --- a/macros/xetex/latex/exam-zh/doc/body/usage.tex +++ b/macros/xetex/latex/exam-zh/doc/body/usage.tex @@ -20,6 +20,9 @@ 按照~\ref{subsec:编译方式} 小节中的方式编译,您应当得到一篇 1 页的文档。 +注意,如果您要在 Overleaf 或者 TeXPage 等在线编辑器上使用 \cls{exam-zh},请在 \verb|\documentclass{exam-zh}| 前加一行代码:\verb|\let\stop\empty|. + + \subsection{编译方式} \label{subsec:编译方式} 本模板不支持 \pdfTeX{} 引擎,仅支持使用 \XeLaTeX{} 。为了生成正确的目录、脚注以及交叉引用,您至少需要连续编译两次。 @@ -570,11 +573,11 @@ 下面所有和 \env{solution} 有关的示例都默认加载了 \begin{latexcode} - \examsetup{solution/show-solution = true} + \examsetup{solution/show-solution = show-stay} \end{latexcode} \examsetup{ - solution/show-solution=true + solution/show-solution=show-stay } @@ -854,7 +857,7 @@ \geometry{showframe} ]{ page/size=a3paper, - solution/show-solution=true, + solution/show-solution=show-stay, paren/show-paren=true, paren/show-answer=true } @@ -1006,6 +1009,40 @@ \end{latexcode} 将用户设置放在 \cls{exam-zh} 的默认设置后从而使其产生作用。 + +\subsubsection{数学-计算题排版} + +\begin{function}[added = 2024-02-11]{calculations 环境} + \begin{ccnusyntax}[emph={[2]calculations}] + \begin{calculations}(*\oarg{键值列表}*) + \item (*\meta{内容1}*) + \item (*\meta{内容2}*) + ... + \end{calculations} + \end{ccnusyntax} + 计算题排版环境。用户可根据效果实现更多应用。\oarg{键值列表} 见~\ref{subsubsec:参数-计算题排版} 节。 +\end{function} + +\begin{latexexample}{\env{calculations} 环境示例} + \begin{calculations}[ + % index = 3, % 从 3 开始编号 + label = \arabic*., % 样式,和 question 环境的一样 + columns = 2, % 每行多少项 + hsep = 0pt, % 两列之间的间距 + vsep = 4cm % 两行之间的间距 + ] + \item + $(-10) + \dfrac{1}{3} - (-3)$ + \item(5分) + $(-10) + 5 - (-3)$ + \item + $(-10) + 5 - (-3)$ + \item(5分) + $(-10) + 5 - (-3)$ + \end{calculations} +\end{latexexample} + + \subsection{参数设置} \begin{function}{\examsetup} @@ -1195,9 +1232,9 @@ \end{ccnusyntax} 页脚内容设置。 \begin{itemize} - \item 若\meta{页脚格式} 中不含西文分号 |;|,则页脚内容为 \meta{页脚格式} 直接输出; - \item 若\meta{页脚格式} 中含一个西文分号 |;|,如 |foo;bar|,则页脚为 |foobar|,即西文分号代替了页码的位置; - \item 若\meta{页脚格式} 中含两个西文分号 |;|,如 |foo;bar;baz|,则页脚为 |foobarbaz|,即第一个西文分号代替了页码的位置,第二个代替了总页码。 + \item 若 \meta{页脚格式} 中不含西文分号 |;|,则页脚内容为 \meta{页脚格式} 直接输出; + \item 若 \meta{页脚格式} 中含一个西文分号 |;|,如 |foo;bar|,则页脚为 |foobar|,即西文分号代替了页码的位置; + \item 若 \meta{页脚格式} 中含两个西文分号 |;|,如 |foo;bar;baz|,则页脚为 \\|foobarbaz|,即第一个西文分号代替了页码的位置,第二个代替了总页码。 \end{itemize} \end{function} @@ -2193,9 +2230,9 @@ \fillin[width-type = normal, width = 1.1\linewidth][答案] 测试 \end{latexexample} -\begin{function}[added = 2022-07-15]{fillin/color} +\begin{function}[added = 2022-07-15, updated = 2023-07-03]{fillin/box-color} \begin{ccnusyntax}[emph={[1]color}] - color = (*\meta{color}*) + box-color = (*\meta{color}*) \end{ccnusyntax} 设置 \kvopt{fillin/type}{circle/rectangle} 类型的 \tn{fillin} 的边框颜色。 \end{function} @@ -2228,12 +2265,11 @@ \end{function} -\begin{function}[added = 2022-07-01,updated = 2022-08-17]{solution/show-solution,solution/show-answer} - \begin{ccnusyntax}[emph={[1]show-solution,show-answer}] - show-solution = (*\TTF*) - show-answer = (*\TTF*) +\begin{function}[added = 2022-07-01,updated = 2024-02-11]{solution/show-solution} + \begin{ccnusyntax}[emph={[1]show-solution}] + show-solution = (*<(show-hide)|show-stay|show-move>*) \end{ccnusyntax} - 是否显示解答环境 \env{solution} 的内容。\opt{show-solution} 和 \opt{show-answer} 两者等效。 + 是否显示或移动解答环境 \env{solution} 的内容。\opt{show-hide} 表示隐藏,\opt{show-stay} 表示显示在原处,\opt{show-move} 表示显示在章节最后。 \end{function} \begin{function}[added = 2022-07-20]{solution/parbreak} @@ -2983,4 +3019,85 @@ parindent = (*\meta{dimension}*) \end{ccnusyntax} 文本部分的缩进长度,默认为 |2em|。 +\end{function} + + +\subsubsection{数学-计算题排版环境} \label{subsubsec:参数-计算题排版} + +\begin{function}[updated = 2024-02-11]{calculations} + \begin{ccnusyntax}[emph={[1]calculations}] + calculations = (*\marg{键值列表}*) + calculations/(*\meta{key}*) = (*\meta{value}*) + \end{ccnusyntax} + 该选项包含多个子项目。用于设置 \env{calculations} 环境。可以在 \tn{examsetup} 中使用,也可以在 \env{calculations} 环境的可选参数中使用。 +\end{function} + +\begin{function}[added = 2024-02-11]{calculations/index} + \begin{ccnusyntax}[emph={[1]index}] + index = (*\meta{integer}*) + \end{ccnusyntax} + 第一个题干的序号。默认为 |1|。 +\end{function} + +\begin{function}[added = 2024-02-11]{calculations/columns} + \begin{ccnusyntax}[emph={[1]columns}] + columns = (*\meta{integer}*) + \end{ccnusyntax} + 每行多少项。默认为 |2|。 +\end{function} + +\begin{function}[added = 2024-02-11]{calculations/fig-pos} + \begin{ccnusyntax}[emph={[1]fig-pos}] + fig-pos = (**) + \end{ccnusyntax} + 题干相对于标签的位置。\opt{top} 和 \opt{above} 同义、\opt{bottom} 和 \opt{below} 同义。 +\end{function} + +\begin{function}[added = 2024-02-11]{calculations/top-sep} + \begin{ccnusyntax}[emph={[1]top-sep}] + top-sep = (*\meta{dimension}*) + \end{ccnusyntax} + \env{calculations} 环境上方额外弹性间距。默认为 |1ex plus .5ex minus .5ex|。 +\end{function} + +\begin{function}[added = 2024-02-11]{calculations/bottom-sep} + \begin{ccnusyntax}[emph={[1]bottom-sep}] + bottom-sep = (*\meta{dimension}*) + \end{ccnusyntax} + \env{calculations} 环境下方额外弹性间距。默认为 |0pt|。 +\end{function} + +\begin{function}[added = 2024-02-11]{calculations/hsep,calculations/vsep} + \begin{ccnusyntax}[emph={[1]hsep,vsep}] + hsep = (*\meta{dimension}*) + vsep = (*\meta{dimension}*) + \end{ccnusyntax} + \opt{hsep} 表示题干之间的水平间距,\opt{vsep} 表示题干之间的垂直间距。\opt{hsep} 默认为 |2em|,\opt{vsep} 默认为 |0em|。 +\end{function} + +\begin{function}[added = 2024-02-11]{calculations/align} + \begin{ccnusyntax}[emph={[1]align}] + align = (*<(t)|m|b>*) + \end{ccnusyntax} + 题干和标签的整体对齐方式。\opt{t} 表示顶部对齐、\opt{m} 表示居中对齐、\opt{b} 表示底部对齐。 +\end{function} + +\begin{function}[added = 2024-02-11]{calculations/xshift,calculations/hshift,calculations/yshift,calculations/vshift} + \begin{ccnusyntax}[emph={[1]xshift,hshift,yshift,vshift}] + xshift = (*\meta{dimension}*) + hshift = (*\meta{dimension}*) + yshift = (*\meta{dimension}*) + vshift = (*\meta{dimension}*) + \end{ccnusyntax} + 题干和标签整体的水平和垂直的偏移量。\opt{xshift} 和 \opt{hshift} 同义,表示水平;\opt{yshift} 和 \opt{vshift} 同义,表示垂直。 +\end{function} + +\begin{function}[added = 2024-02-11]{calculations/label-xshift,calculations/label-hshift,calculations/label-yshift,calculations/label-vshift} + \begin{ccnusyntax}[emph={[1]xshift,hshift,yshift,vshift}] + label-xshift = (*\meta{dimension}*) + label-hshift = (*\meta{dimension}*) + label-yshift = (*\meta{dimension}*) + label-vshift = (*\meta{dimension}*) + \end{ccnusyntax} + 标签相对题干的水平和垂直的偏移量。\opt{label-xshift} 和 \opt{label-hshift} 同义,表示水平;\opt{label-yshift} 和 \opt{label-vshift} 同义,表示垂直。 \end{function} \ No newline at end of file diff --git a/macros/xetex/latex/exam-zh/doc/exam-zh-doc-setup.tex b/macros/xetex/latex/exam-zh/doc/exam-zh-doc-setup.tex index 9a1f2a6844..d67b599cee 100644 --- a/macros/xetex/latex/exam-zh/doc/exam-zh-doc-setup.tex +++ b/macros/xetex/latex/exam-zh/doc/exam-zh-doc-setup.tex @@ -7,6 +7,7 @@ \usepackage{../exam-zh-symbols} \usepackage{../exam-zh-chinese-english} \usepackage{../exam-zh-textfigure} +\usepackage{../exam-zh-math} \ExplSyntaxOn \NewDocumentCommand \examsetup { m } @@ -32,7 +33,10 @@ \title{\textcolor{MaterialIndigo800}{% \textbf{exam-zh: 中国试卷 \LaTeX \xpinyin[font=\sffamily,format=\color{MaterialIndigo800}]{模}{mu2}板}}} -\author{李泽平,夏康玮,郭李军} +\author{% + 夏康玮\thanks{% + 李泽平构建了 \cls{exam-zh} 的最初的基本框架;郭李军开发了连线题环境} +} \date{\DocDate\quad \DocVersion% \thanks{% \url{https://gitee.com/xkwxdyy/exam-zh} \\ diff --git a/macros/xetex/latex/exam-zh/doc/exam-zh-doc.pdf b/macros/xetex/latex/exam-zh/doc/exam-zh-doc.pdf index 513f8d06a0..734be0a38f 100644 Binary files a/macros/xetex/latex/exam-zh/doc/exam-zh-doc.pdf and b/macros/xetex/latex/exam-zh/doc/exam-zh-doc.pdf differ diff --git a/macros/xetex/latex/exam-zh/doc/exam-zh-doc.tex b/macros/xetex/latex/exam-zh/doc/exam-zh-doc.tex index b8eb07a3a6..6beca867a6 100644 --- a/macros/xetex/latex/exam-zh/doc/exam-zh-doc.tex +++ b/macros/xetex/latex/exam-zh/doc/exam-zh-doc.tex @@ -1,7 +1,7 @@ \documentclass{xdyydoc} -\newcommand{\DocDate}{2022-10-4} -\newcommand{\DocVersion}{v0.1.27} +\newcommand{\DocDate}{2024-02-11} +\newcommand{\DocVersion}{v0.2.1} \input{exam-zh-doc-setup.tex} \usepackage{amssymb} @@ -61,28 +61,28 @@ \begin{itemize} % \item 增加试卷范例(语文,英语) - \item 答案控制 - \begin{itemize} - \item 选择题 - \begin{itemize} - \item 题目下方 - \item 括号内 - \item 最后:列表形式、表格形式 - \end{itemize} - \item 填空题 - \begin{itemize} - \item 题目下方 - \item 划线内 - \item 最后 - \end{itemize} - \item 解答题 - \begin{itemize} - \item 题目下方 - \item 移动到最后 - \end{itemize} - \end{itemize} + % \item 答案控制 + % \begin{itemize} + % \item 选择题 + % \begin{itemize} + % \item 题目下方 + % \item 括号内 + % \item 最后:列表形式、表格形式 + % \end{itemize} + % \item 填空题 + % \begin{itemize} + % \item 题目下方 + % \item 划线内 + % \item 最后 + % \end{itemize} + % \item 解答题 + % \begin{itemize} + % \item 题目下方 + % \item 移动到最后 + % \end{itemize} + % \end{itemize} \item 选择题答案标记 - \item \env{choices} 环境“均分”效果 + % \item \env{choices} 环境“均分”效果 % \item 图文排版(参考 xkwxdyy 的 \pkg{text-figure} 宏包和 qinglee 的 \pkg{wrapstuff} 宏包) \item 测试兼容性 \item \env{question} 环境的引用 @@ -95,6 +95,7 @@ \item 通过 \tn{CJKunderline} 的 \meta{hidden} 键实现 \tn{fillin} 的无答案的时候,长度是答案的长度 \item \env{poem} 环境的引用字体不是斜体 \item 用 meta 优化键值,比如统一的 show-answer + \item 设置 \tn{vec} 命令的定制开关。 \end{itemize} diff --git a/macros/xetex/latex/exam-zh/examples/example-multiple.pdf b/macros/xetex/latex/exam-zh/examples/example-multiple.pdf index e6b4c80c25..29b1dc4883 100644 Binary files a/macros/xetex/latex/exam-zh/examples/example-multiple.pdf and b/macros/xetex/latex/exam-zh/examples/example-multiple.pdf differ diff --git a/macros/xetex/latex/exam-zh/examples/example-single.pdf b/macros/xetex/latex/exam-zh/examples/example-single.pdf index 66c7da9b6e..1ecd7749c5 100644 Binary files a/macros/xetex/latex/exam-zh/examples/example-single.pdf and b/macros/xetex/latex/exam-zh/examples/example-single.pdf differ diff --git a/macros/xetex/latex/exam-zh/examples/example-single.tex b/macros/xetex/latex/exam-zh/examples/example-single.tex index 4a9e7e3033..d2f1506c26 100644 --- a/macros/xetex/latex/exam-zh/examples/example-single.tex +++ b/macros/xetex/latex/exam-zh/examples/example-single.tex @@ -6,15 +6,7 @@ paren/show-paren=true, paren/show-answer=true, fillin/show-answer=false, - solution/show-solution=false -} - -\ExamPrintAnswerSet{ - sealline/show=true, - page/size=a3paper, - paren/show-answer=false, - fillin/show-answer=false, - solution/show-solution=false, + solution/show-solution=show-move } @@ -60,7 +52,7 @@ % 1. \begin{question}[points = 2] - 设集合 $A = \{x \mid -1 < x < 4\}$,$B = \{2, 3, 4, 5\}$,则 $A \cap B = $ \paren[B] + 设集合 $A = \{x \mid -1 < x < 4\}$,$B = \{2, 3, 4, 5\}$,则 $A \cap B = $ \paren[A] \begin{choices} \item $\{2\}$ @@ -222,6 +214,10 @@ 已知函数 $f(x) = x^3 (a \cdot 2^x - 2^{-x})$ 是偶函数,则 $a = $ \fillin[$1$] 。 \end{question} +\begin{solution} + 由 $f(x) = f(-x)$,得 $a = 1$。 +\end{solution} + % 14. \begin{question} 已知 $O$ 为坐标原点,抛物线 $C \colon y^2 = 2px$($p > 0$)的焦点为 $F$, diff --git a/macros/xetex/latex/exam-zh/tex/exam-zh-chinese-english.sty b/macros/xetex/latex/exam-zh/tex/exam-zh-chinese-english.sty index 5099c6ca11..845eabfca1 100644 --- a/macros/xetex/latex/exam-zh/tex/exam-zh-chinese-english.sty +++ b/macros/xetex/latex/exam-zh/tex/exam-zh-chinese-english.sty @@ -8,7 +8,7 @@ \RequirePackage{expl3} -\ProvidesExplPackage {exam-zh-chinese-english} {2023-06-28} {v0.1.27} +\ProvidesExplPackage {exam-zh-chinese-english} {2024-02-11} {v0.2.1} {exam-zh chinese and english module} \PassOptionsToPackage { tcolorbox } { most } diff --git a/macros/xetex/latex/exam-zh/tex/exam-zh-choices.sty b/macros/xetex/latex/exam-zh/tex/exam-zh-choices.sty index 47cbd287bc..b66f974d2b 100644 --- a/macros/xetex/latex/exam-zh/tex/exam-zh-choices.sty +++ b/macros/xetex/latex/exam-zh/tex/exam-zh-choices.sty @@ -9,7 +9,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} -\ProvidesExplPackage {exam-zh-choices} {2023-06-28} {v0.1.27} +\ProvidesExplPackage {exam-zh-choices} {2024-02-11} {v0.2.1} {exam-zh choices module} \dim_new:N \l__examzh_choices_column_sep_dim diff --git a/macros/xetex/latex/exam-zh/tex/exam-zh-font.sty b/macros/xetex/latex/exam-zh/tex/exam-zh-font.sty index 9f0bb0171f..85f7bb1782 100644 --- a/macros/xetex/latex/exam-zh/tex/exam-zh-font.sty +++ b/macros/xetex/latex/exam-zh/tex/exam-zh-font.sty @@ -9,7 +9,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} -\ProvidesExplPackage {exam-zh-font} {2023-06-28} {v0.1.27} +\ProvidesExplPackage {exam-zh-font} {2024-02-11} {v0.2.1} {exam-zh font module} \RequirePackage { unicode-math } diff --git a/macros/xetex/latex/exam-zh/tex/exam-zh-math.sty b/macros/xetex/latex/exam-zh/tex/exam-zh-math.sty new file mode 100644 index 0000000000..e11281f077 --- /dev/null +++ b/macros/xetex/latex/exam-zh/tex/exam-zh-math.sty @@ -0,0 +1,427 @@ +% +% Copyright (c) 2022 Kangwei Xia +% Released under the LaTeX Project Public License v1.3c License. +% Repository: https://gitee.com/xkwxdyy/exam-zh +% + +\NeedsTeXFormat{LaTeX2e} + +\RequirePackage{expl3} + +\ProvidesExplPackage {exam-zh-math} {2024-02-11} {v0.2.1} + {exam-zh math module} + +\RequirePackage { tabularray } +\RequirePackage { varwidth } +\RequirePackage { graphicx } +\RequirePackage { filehook } +\file_if_exist:nT { wrapstuff.sty } + { + \RequirePackage { wrapstuff } + \AtEndOfPackageFile* { exam-zh-choices } + { + \AddToHook { env / choices / before } + { \wrapstuffclear } + } + } + + +\keys_define:nn { exam-zh } + { calculations .meta:nn = { exam-zh / calculations } {#1} } + +%% calculations 环境 %% + + +% 图片相对于 label 的方位 +\str_new:N \l__examzh_calculations_figure_position_str +% coffin type 的对齐方式 +\str_new:N \l__examzh_calculations_coffin_align_str + + +\keys_define:nn { exam-zh / calculations } + { + % calculations 环境的 label 从几开始(但是其实是 index + seq 函数的 ##1 才是最终的 index) + index .int_set:N = \l__examzh_calculations_label_index_shift_int, + % 每行多少个(等价于有多少列) + columns .int_set:N = \l__examzh_calculations_column_int, + % 图片相对于文字的位置(上下左右) + fig-pos .choices:nn = + { top, above, bottom, below, left, right, left-top } + { \str_set:Nx \l__examzh_calculations_figure_position_str { \l_keys_choice_tl } }, + % 环境上方的额外距离 + top-sep .skip_set:N = \l__examzh_calculations_top_sep_skip, + % 环境下方的额外距离 + bottom-sep .skip_set:N = \l__examzh_calculations_bottom_sep_skip, + % 两列之间的水平间距 + hsep .skip_set:N = \l__examzh_calculations_hsep_skip, + % 两行之间的垂直间距 + vsep .skip_set:N = \l__examzh_calculations_vsep_skip, + % 整体的偏移量 + xshift .dim_set:N = \l__examzh_calculations_xshift_dim, + hshift .dim_set:N = \l__examzh_calculations_xshift_dim, + yshift .dim_set:N = \l__examzh_calculations_yshift_dim, + vshift .dim_set:N = \l__examzh_calculations_yshift_dim, + % label 的偏移量 + label-xshift .dim_set:N = \l__examzh_calculations_label_xshift_dim, + label-hshift .dim_set:N = \l__examzh_calculations_label_xshift_dim, + label-yshift .dim_set:N = \l__examzh_calculations_label_yshift_dim, + label-vshift .dim_set:N = \l__examzh_calculations_label_yshift_dim, + % 对齐方式 + align .choices:nn = + { t, m, b } + { \str_set:Nx \l__examzh_calculations_coffin_align_str { \l_keys_choice_tl } } + } +\keys_set:nn { exam-zh / calculations } + { + index = 0, + columns = 2, + fig-pos = left-top, + xshift = 2em, + hsep = 2em, + vsep = 0pt, + label-xshift = 0pt, + align = t, + top-sep = 1ex plus .5ex minus .5ex, + bottom-sep = 0pt, + } + +% item 的 index 指标(即第几个 item) +\int_new:N \l__examzh_calculations_item_index_int +% 将拼接后的 coffin 存到 seq 里 +\seq_new:N \l__examzh_calculations_store_seq +% 上面的 seq 的 item 数 +\int_new:N \l__examzh_calculations_store_seq_item_int +% 最终放在 tblr 里的内容 +\tl_new:N \l__examzh_calculations_tblr_content_tl + + + +% #1: 设置 calculations +% #2: 设置里面的 tblr +\NewDocumentEnvironment { calculations } { O{ } +O{ } } + { + \group_begin: + \RenewDocumentCommand \item { O{ } } + { \__examzh_calculations_item:n {##1} } + \int_set:Nn \l__examzh_calculations_item_index_int {0} + \seq_clear:N \l__examzh_calculations_store_seq + \tl_clear:N \l__examzh_calculations_tblr_content_tl + \keys_set:nn { exam-zh / calculations } {#1} + } + { + % 结束收集 + \unskip + \end{varwidth} + % \end{minipage} + \hcoffin_set_end: + % 拼接 label 和 figure + \__examzh_calculations_coffin_join: + % 输出 + \__examzh_calculations_coffin_typeset:n {#2} + % \par \int_use:N \l__examzh_calculations_item_index_int + \group_end: + } +% 拼接 label 和 figure +\cs_new:Npn \__examzh_calculations_coffin_join: + { + \int_step_inline:nn { \l__examzh_calculations_item_index_int } + { + \__examzh_calculations_coffin_join_position_set:n {##1} + \seq_gput_right:Nn \l__examzh_calculations_store_seq + { + \__examzh_calculations_coffin_align_set:n {##1} + \kern\l__examzh_calculations_hsep_skip + } + } + } +\cs_new:Npn \__examzh_calculations_coffin_align_set:n #1 + { + \str_case:Vn \l__examzh_calculations_coffin_align_str + { + {t} { \__examzh_calculations_coffin_align_set_t:n {#1} } + {m} { \__examzh_calculations_coffin_align_set_m:n {#1} } + {b} { \__examzh_calculations_coffin_align_set_b:n {#1} } + } + } +\cs_new:Npn \__examzh_calculations_coffin_align_set_t:n #1 + { + \coffin_typeset:cnnnn + { l__examzh_calculations_figure_ \int_to_roman:n { #1 } _coffin } + { l } { t } % align = t + { \l__examzh_calculations_xshift_dim } { \l__examzh_calculations_yshift_dim + 1em } + } +\cs_new:Npn \__examzh_calculations_coffin_align_set_m:n #1 + { + \coffin_typeset:cnnnn + { l__examzh_calculations_figure_ \int_to_roman:n { #1 } _coffin } + { l } { vc } % align = m + { \l__examzh_calculations_xshift_dim } { \l__examzh_calculations_yshift_dim } + } +\cs_new:Npn \__examzh_calculations_coffin_align_set_b:n #1 + { + \coffin_typeset:cnnnn + { l__examzh_calculations_figure_ \int_to_roman:n { #1 } _coffin } + { l } { b } % align = b + { \l__examzh_calculations_xshift_dim } { \l__examzh_calculations_yshift_dim } + } +\cs_new:Npn \__examzh_calculations_coffin_join_position_set:n #1 + { + \use:c { __examzh_calculations_coffin_join_position_set_ \l__examzh_calculations_figure_position_str :n } {#1} + } +\cs_new:cpn { __examzh_calculations_coffin_join_position_set_left-top :n } #1 + { + \coffin_join:cnncnnnn + { l__examzh_calculations_figure_ \int_to_roman:n {#1} _ coffin } + { l } { t } + { l__examzh_calculations_label_ \int_to_roman:n {#1} _ coffin } + { r } { b } + { \l__examzh_calculations_label_xshift_dim } + { \l__examzh_calculations_label_yshift_dim -10.6pt} + } +\cs_new:Npn \__examzh_calculations_coffin_join_position_set_top:n #1 + { + \coffin_join:cnncnnnn + { l__examzh_calculations_figure_ \int_to_roman:n {#1} _ coffin } + { hc } { b } + { l__examzh_calculations_label_ \int_to_roman:n {#1} _ coffin } + { hc } { t } + { \l__examzh_calculations_label_xshift_dim } + { \l__examzh_calculations_label_yshift_dim - 6pt } + } +\cs_set_eq:NN + \__examzh_calculations_coffin_join_position_set_above:n + \__examzh_calculations_coffin_join_position_set_top:n +\cs_new:Npn \__examzh_calculations_coffin_join_position_set_bottom:n #1 + { + \coffin_join:cnncnnnn + { l__examzh_calculations_figure_ \int_to_roman:n {#1} _ coffin } + { hc } { t } + { l__examzh_calculations_label_ \int_to_roman:n {#1} _ coffin } + { hc } { b } + { \l__examzh_calculations_label_xshift_dim } + { \l__examzh_calculations_label_yshift_dim + 6pt } + } +\cs_set_eq:NN + \__examzh_calculations_coffin_join_position_set_below:n + \__examzh_calculations_coffin_join_position_set_bottom:n +\cs_new:Npn \__examzh_calculations_coffin_join_position_set_left:n #1 + { + \coffin_join:cnncnnnn + { l__examzh_calculations_figure_ \int_to_roman:n {#1} _ coffin } + { l } { vc } + { l__examzh_calculations_label_ \int_to_roman:n {#1} _ coffin } + { r } { vc } + { \l__examzh_calculations_label_xshift_dim - 6pt } + { \l__examzh_calculations_label_yshift_dim } + } +\cs_new:Npn \__examzh_calculations_coffin_join_position_set_right:n #1 + { + \coffin_join:cnncnnnn + { l__examzh_calculations_figure_ \int_to_roman:n {#1} _ coffin } + { r } { vc } + { l__examzh_calculations_label_ \int_to_roman:n {#1} _ coffin } + { l } { vc } + { \l__examzh_calculations_label_xshift_dim + 2pt } + { \l__examzh_calculations_label_yshift_dim } + } +\cs_new:Npn \__examzh_calculations_coffin_typeset:n #1 + { + \__examzh_calculations_coffin_typeset_count: + \seq_map_indexed_inline:Nn \l__examzh_calculations_store_seq + % ##1: index + % ##2: content + { + \int_compare:nNnTF { \int_mod:nn {##1} { \l__examzh_calculations_column_int } } = {0} + { + \tl_gput_right:Nn \l__examzh_calculations_tblr_content_tl + { ##2 \\[\l__examzh_calculations_vsep_skip] } + } + { + \tl_gput_right:Nn \l__examzh_calculations_tblr_content_tl + { ##2 & } + } + } + % 如果 seq 的 item 比 column 多且不整除 column 的话,要补 & + \int_compare:nNnT { \l__examzh_calculations_store_seq_item_int } > { \l__examzh_calculations_column_int } + { + \int_compare:nNnF { \l__examzh_calculations_item_num_mod_column_left_int } = { 0 } + { + \tl_gput_right:Nx \l__examzh_calculations_tblr_content_tl + { + \prg_replicate:nn { \l__examzh_calculations_item_num_mod_column_left_int -1 } {&} + } + % \int_use:N \l__examzh_calculations_item_num_mod_column_left_int + } + } + \par + \vspace*{ \l__examzh_calculations_top_sep_skip } + \noindent + % \centering + % \SetTblrInner + % { + % rowsep = 4pt, + % % colsep = 0pt + % } + \begin{tblr} + [ expand = \l__examzh_calculations_tblr_content_tl ] + { + width = \linewidth, + columns = + { + l, + leftsep = 0em, + rightsep = 0pt, + }, + rows = + { + m, + ht=\baselineskip, + abovesep = 0pt, + belowsep = 0pt, + }, + stretch=0, + #1 + } + \l__examzh_calculations_tblr_content_tl + \end{tblr} + \vspace*{ \l__examzh_calculations_bottom_sep_skip } + \par + } +\int_new:N \l__examzh_calculations_item_num_mod_column_left_int +\cs_new:Npn \__examzh_calculations_coffin_typeset_count: + { + % 计算 seq 有多少项 + \int_set:Nn \l__examzh_calculations_store_seq_item_int + { \seq_count:N \l__examzh_calculations_store_seq } + % seq 项数小于 column 的话,column 设置为 seq 项数 + \int_compare:nNnTF { \l__examzh_calculations_store_seq_item_int } < { \l__examzh_calculations_column_int } + { \int_set_eq:NN \l__examzh_calculations_column_int \l__examzh_calculations_store_seq_item_int } + { + % 计算 \l__examzh_calculations_store_seq_item_int mod \l__examzh_calculations_column_int 的余数,用于补 & + \int_set:Nn \l__examzh_calculations_item_num_mod_column_left_int { \int_mod:nn { \l__examzh_calculations_store_seq_item_int } { \l__examzh_calculations_column_int } } + } + } + +\cs_new:Npn \__examzh_calculations_item:n #1 + { + % 增加指标(g 是关键) + \int_gincr:N \l__examzh_calculations_item_index_int + % 新建 coffin + \__examzh_calculations_item_new_coffin: + % 储存 label(一直出不来的原因是因为没改成 gset) + \hcoffin_gset:cn + { l__examzh_calculations_label_ \int_to_roman:n { \l__examzh_calculations_item_index_int } _coffin } + { + % 加上 index 键值设置的偏移量才是最终的 index + % (\int_eval:n { \l__examzh_calculations_item_index_int + \l__examzh_calculations_label_index_shift_int - 1} ) + % 如果 \item 的[] 中没内容,则需要把 label 升高 + % \tl_if_blank:nTF {#1} + % { + % \box_move_up:nn { 2.7pt } { \hbox{\__examzh_calculations_the_label:} } + % \space + % #1 + % } + % { + % \__examzh_calculations_the_label: #1 + % } + % \IfBooleanTF{#1}{#1 yes}{#1 no} + % \IfNoValueTF{#1} + % { + % \dim_set:Nn \l__examzh_calculations_label_yshift_dim { 4pt } + % }{#1 yes} + } + % 储存 figure + \int_compare:nNnF { \l__examzh_calculations_item_index_int } = {1} + { + \unskip + \end{varwidth} + % \end{minipage} + % 结束上一个 item 的收集 + \hcoffin_set_end: + } + % 收集 + \hcoffin_set:cw { l__examzh_calculations_figure_ \int_to_roman:n { \l__examzh_calculations_item_index_int } _coffin } + % \begin{varwidth}{\hsize} + % 根据 columns 个数设置宽度 + \__examzh_calculations_item_varwidth_width_set: + \begin{varwidth}{\l__examzh_calculations_item_varwidth_width_dim} + % \begin{minipage}{8cm} + \ignorespaces + \makebox[0em]{\rule{0pt}{\baselineskip}} + \__examzh_calculations_the_label: + } +\dim_new:N \l__examzh_calculations_item_varwidth_width_dim +\cs_new:Npn \__examzh_calculations_item_varwidth_width_set: + { + \int_case:nnF { \l__examzh_calculations_column_int } + { + {1} { \dim_set:Nn \l__examzh_calculations_item_varwidth_width_dim {0.8 \textwidth} } + {2} { \dim_set:Nn \l__examzh_calculations_item_varwidth_width_dim {0.3 \textwidth} } + {3} { \dim_set:Nn \l__examzh_calculations_item_varwidth_width_dim {0.3 \textwidth} } + {4} { \dim_set:Nn \l__examzh_calculations_item_varwidth_width_dim {0.2 \textwidth} } + } + { \dim_set:Nn \l__examzh_calculations_item_varwidth_width_dim { \hsize } } + } + +% 新建 coffin +\cs_new:Npn \__examzh_calculations_item_new_coffin: + { + % 放图片的 coffin + \coffin_if_exist:cF { l__examzh_calculations_figure_ \int_to_roman:n { \l__examzh_calculations_item_index_int } _coffin } + { \coffin_new:c { l__examzh_calculations_figure_ \int_to_roman:n { \l__examzh_calculations_item_index_int } _coffin } } + % 放 label 的 coffin + \coffin_if_exist:cF { l__examzh_calculations_label_ \int_to_roman:n { \l__examzh_calculations_item_index_int } _coffin } + { \coffin_new:c { l__examzh_calculations_label_ \int_to_roman:n { \l__examzh_calculations_item_index_int } _coffin } } + } + +\tl_new:N \l__examzh_calculations_counters_commands_set_tl + +\keys_define:nn { exam-zh / calculations } + { + label .tl_set:N = \l__examzh_calculations_label_tl + } +\keys_set:nn { exam-zh / calculations } + { + label = \arabic* + } + +\cs_new:Npn \__examzh_calculations_the_label: + { + \group_begin: + % 定义计数器相关的命令函数 + \l__examzh_calculations_counters_commands_set_tl + % 输出处理后的 label + \l__examzh_calculations_label_tl + \group_end: + } + +\NewDocumentCommand \AddCalculationsCounter { m m } + { + % 生成用户层命令 + \tl_put_right:Nn \l__examzh_calculations_counters_commands_set_tl + { \__examzh_process_counter:NNn #1 #2 { calculations } } + % 把核心函数存起来 + \cs_set_eq:cN { __examzh_calculations_save_ \cs_to_str:N #1 : } #2 + \cs_set_eq:cN { __examzh_calculations_save_ \cs_to_str:N #2 : } #2 + } + +\AddCalculationsCounter \arabic \@arabic +\AddCalculationsCounter \alph \@alph +\AddCalculationsCounter \Alph \@Alph +\AddCalculationsCounter \roman \@roman +\AddCalculationsCounter \Roman \@Roman + +\cs_new:Npn \__examzh_calculations_process_counter_aux:Nn #1#2 + { + \tl_if_eq:nnTF {#2} { * } + { + % \Alph* + \use:c { __examzh_calculations_save_ \cs_to_str:N #1 : } + { \int_eval:n { \l__examzh_calculations_item_index_int + \l__examzh_calculations_label_index_shift_int } } + } + { + % \Alph{...} + \use:c { __examzh_calculations_save_ \cs_to_str:N #1 : } + {#2} + } + } \ No newline at end of file diff --git a/macros/xetex/latex/exam-zh/tex/exam-zh-question.sty b/macros/xetex/latex/exam-zh/tex/exam-zh-question.sty index f1de989e6e..8fae81e43e 100644 --- a/macros/xetex/latex/exam-zh/tex/exam-zh-question.sty +++ b/macros/xetex/latex/exam-zh/tex/exam-zh-question.sty @@ -9,7 +9,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} -\ProvidesExplPackage {exam-zh-question} {2023-06-28} {v0.1.27} +\ProvidesExplPackage {exam-zh-question} {2024-02-11} {v0.2.1} {exam-zh question module} @@ -205,7 +205,7 @@ index = 1, points = 0 , show-points = auto , - points-separate-par = true , + points-separate-par = false , show-answer = false , top-sep = .25em plus .25em minus .1em , bottom-sep = .25em plus .25em minus .1em , @@ -229,6 +229,20 @@ \group_end: } {} +% \NewDocumentEnvironment { question } { O { } } +% { +% % \bool_set_false:N \l__examzh_question_problem_style_bool +% \group_begin: +% \group_begin: +% \tcbverbatimwrite { \jobname-tempfile.exam } +% } +% { +% \endtcbverbatimwrite +% \group_end: +% \__examzh_question_begin:nn {#1} { \input{\jobname-tempfile.exam} } +% \__examzh_question_end:nn {#1} { \input{\jobname-tempfile.exam} } +% \group_end: +% } % 解答题 \NewDocumentEnvironment { problem } { O { } +b } @@ -1003,7 +1017,9 @@ } \keys_define:nn { exam-zh } { paren .meta:nn = { exam-zh / paren } {#1} } -\NewDocumentCommand \paren { O { } } + +% TODO:在 paren 里面增加键值控制 +\NewDocumentCommand \paren { s O { } } { % 如果开了 show answer 就默认 show paren \bool_if:NT \l__examzh_question_show_paren_answer_bool @@ -1026,11 +1042,25 @@ \hbox:n { ( - \hbox_to_wd:nn { 3em } - { - \bool_if:NT \l__examzh_question_show_paren_answer_bool - { \hfill \__examzh_paren_print_answer:n {#1} \hfill } - } + % \hbox_to_wd:nn { 2em } + % { + \bool_if:NTF \l__examzh_question_show_paren_answer_bool + % { \hfill \__examzh_paren_print_answer:n {#1} \hfill } + { + \IfBlankTF{#2} + { + % 显示答案,但是 \paren 里没有输入答案 + \kern 2em + } + { + \kern0.7em \__examzh_paren_print_answer:n {#2} \kern0.7em + } + } + { + % \paren* 表示不显示答案时是长宽度,\paren 表示不显示答案时是短宽度 + \IfBooleanTF{#1}{ \kern 3em }{ \kern 2em } + } + % } ) \kern -.4em } } @@ -1085,7 +1115,7 @@ { \bool_set_true:N \l__examzh_fillin_width_fill_bool }, width-type / normal .code:n = { \bool_set_false:N \l__examzh_fillin_width_fill_bool }, - color .tl_set:N = \l__examzh_fillin_color_tl, + box-color .tl_set:N = \l__examzh_fillin_box_color_tl, text-color .tl_set:N = \l__examzh_fillin_text_color_tl, no-answer-type .choices:nn = { blacktriangle, counter, none, hidden } @@ -1104,7 +1134,7 @@ type = line, show-answer = false, width = 3em, - color = black, + box-color = black, text-color = black, no-answer-type = blacktriangle, no-answer-counter-index = 1, @@ -1514,7 +1544,7 @@ { rounded~rectangle~west~arc = convex, draw, rounded~rectangle, - color = \l__examzh_fillin_color_tl, text = \l__examzh_fillin_text_color_tl + color = \l__examzh_fillin_box_color_tl, text = \l__examzh_fillin_text_color_tl } } \cs_new:Npn \__examzh_fillin_circle_T: @@ -1541,7 +1571,7 @@ { \hspace* { .5em minus .5em } \begin{tikzpicture}[baseline = -3pt] - \node[draw, color = \l__examzh_fillin_color_tl, text = \l__examzh_fillin_text_color_tl] + \node[draw, color = \l__examzh_fillin_box_color_tl, text = \l__examzh_fillin_text_color_tl] { \box_use_drop:N \l_tmpa_box }; \end{tikzpicture} \hspace* { .5em minus .5em } @@ -1550,7 +1580,7 @@ { \hspace* { 0.5em plus .5em minus .5em } \begin{tikzpicture}[baseline = -3pt] - \node[draw, color = \l__examzh_fillin_color_tl, text = \l__examzh_fillin_text_color_tl] + \node[draw, color = \l__examzh_fillin_box_color_tl, text = \l__examzh_fillin_text_color_tl] { \phantom{a} }; \end{tikzpicture} \hspace* { 0.5em plus .5em minus .5em } @@ -1641,10 +1671,27 @@ } \str_new:N \l__examzh_solution_blank_type_str +\bool_new:N \g__examzh_solution_show_bool +\bool_new:N \g__examzh_solution_show_move_bool \keys_define:nn { exam-zh / solution } { - show-solution .bool_set:N = \l__examzh_solution_show_bool, - show-answer .bool_set:N = \l__examzh_solution_show_bool, + % show-solution .bool_set:N = \g__examzh_solution_show_bool, + show-solution .choice:, + show-solution / hide .code:n = + { + \bool_gset_false:N \g__examzh_solution_show_bool + }, + show-solution / show-stay .code:n = + { + \bool_gset_true:N \g__examzh_solution_show_bool + \bool_gset_false:N \g__examzh_solution_show_move_bool + }, + show-solution / show-move .code:n = + { + \bool_gset_true:N \g__examzh_solution_show_bool + \bool_gset_true:N \g__examzh_solution_show_move_bool + }, + % show-answer .bool_set:N = \g__examzh_solution_show_bool, show-qed .bool_set:N = \l__examzh_solution_show_qed_bool, qedsymbol .tl_set:N = \l__examzh_solution_qedsymbol_tl, label-content .tl_set:N = \l__examzh_solution_label_content_tl, @@ -1666,7 +1713,7 @@ } \keys_set:nn { exam-zh / solution } { - show-solution = false, + show-solution = hide, show-qed = true, qedsymbol = $\square$, label-content = {解答}, @@ -1685,18 +1732,45 @@ \keys_define:nn { exam-zh } { solution .meta:nn = { exam-zh / solution } {#1} } % 解答题环境 +\iow_new:N \g__write_soltion_to_auxfile +% 生成变体函数 +\cs_generate_variant:Nn \iow_open:Nn { Nx } +\int_new:N \g__examzh_solution_aux_index_int \NewDocumentEnvironment { solution } { O{ } +b } { % \addvspace { \l__examzh_solution_top_sep_skip } \keys_set:nn { exam-zh / solution } {#1} % 放在这是使得 \examsetup 设置 qedsymbol 可以放在正文区 \cs_set_eq:NN \qedsymbol \l__examzh_solution_qedsymbol_tl - \bool_if:NTF \l__examzh_solution_show_bool + \bool_if:NTF \g__examzh_solution_show_bool { - \vspace { \l__examzh_solution_top_sep_skip } - \__examzh_solution_print_answer:n {#2} - \par - \vspace { \l__examzh_solution_bottom_sep_skip } + \bool_if:NTF \g__examzh_solution_show_move_bool + { + % 这个方法成功 + \iow_open:Nn \g__write_soltion_to_auxfile {examzh \int_use:N \g__examzh_question_index_int .solution} + \iow_now:Nx \g__write_soltion_to_auxfile + { + \par \noindent + \int_eval:n { \g__examzh_question_index_int - 1 }. 【解析】 + \exp_not:n {#2} + \par \exp_not:n { \vspace*{1ex} } + } + \iow_close:N \g__write_soltion_to_auxfile + + % 下面的方法失败 + % \group_begin: + % \tl_set:Nn \tcb@verbatim@begin@hook + % { \iow_now:Nx \tcb@out { \int_use:N \g__examzh_question_index_int } } + % \tcbverbatimwrite {examzh \int_use:N \g__examzh_question_index_int .solution} #2 + % \endtcbverbatimwrite + % \group_end: + } + { + \vspace { \l__examzh_solution_top_sep_skip } + \__examzh_solution_print_answer:n {#2} + \par + \vspace { \l__examzh_solution_bottom_sep_skip } + } } { \str_case:VnF \l__examzh_solution_blank_type_str @@ -1712,6 +1786,31 @@ % \addvspace { \l__examzh_solution_bottom_sep_skip } } {} + +\AtEndDocument + { + \bool_if:NT \g__examzh_solution_show_move_bool + { + \newpage + \begin{center} + \zihao{-2} \heiti \makebox[5em][s]{参考答案} + \end{center} + \vspace*{3ex} + + \kaishu + \int_compare:nNnT { \g__examzh_question_index_int } > { 0 } + { + \int_step_inline:nn { \g__examzh_question_index_int } + { + \file_if_exist:nT { examzh #1 .solution } + { \file_input:n { examzh #1 .solution } } + } + } + } + } + + + \cs_new:Npn \__examzh_solution_simply_hide_solution:n #1 { \begin{tcolorbox} diff --git a/macros/xetex/latex/exam-zh/tex/exam-zh-symbols.sty b/macros/xetex/latex/exam-zh/tex/exam-zh-symbols.sty index 3dc3c57c2a..cce55928f6 100644 --- a/macros/xetex/latex/exam-zh/tex/exam-zh-symbols.sty +++ b/macros/xetex/latex/exam-zh/tex/exam-zh-symbols.sty @@ -8,7 +8,7 @@ \RequirePackage{expl3} -\ProvidesExplPackage {exam-zh-symbols} {2023-06-28} {v0.1.27} +\ProvidesExplPackage {exam-zh-symbols} {2024-02-11} {v0.2.1} {exam-zh symbols module} \RequirePackage { tikz } diff --git a/macros/xetex/latex/exam-zh/tex/exam-zh-textfigure.sty b/macros/xetex/latex/exam-zh/tex/exam-zh-textfigure.sty index bbc4bedac2..656617da98 100644 --- a/macros/xetex/latex/exam-zh/tex/exam-zh-textfigure.sty +++ b/macros/xetex/latex/exam-zh/tex/exam-zh-textfigure.sty @@ -7,7 +7,7 @@ \RequirePackage{expl3} -\ProvidesExplPackage {exam-zh-textfigure} {2023-06-28} {v0.1.27} +\ProvidesExplPackage {exam-zh-textfigure} {2024-02-11} {v0.2.1} {exam-zh text with figure module} @@ -345,6 +345,18 @@ { \str_set:NV \l__examzh_textfigure_current_figure_position_str \l_keys_choice_tl }, + pos .choices:nn = + { + left , right , top , bottom , + top-left , top-right , top-center , + top-flushright , bottom-flushright , + bottom-left , bottom-right , bottom-center , + right-top , right-bottom , right-center , + left-top , left-bottom , left-center + } + { + \str_set:NV \l__examzh_textfigure_current_figure_position_str \l_keys_choice_tl + }, % figure-yshift:调整图片的垂直额外偏移量 figure-yshift .dim_set:N = \l__examzh_textfigure_figure_yshift_dim, figure-vshift .dim_set:N = \l__examzh_textfigure_figure_yshift_dim, @@ -375,15 +387,15 @@ \keys_set:nn { exam-zh / textfigure } { - fig-pos = right, + fig-pos = bottom-right, yshift = .5\baselineskip, - text-width = \columnwidth, + text-width = \textwidth, figure-width = \columnwidth, - text-ratio = 0.95, + text-ratio = 1, top-sep = 0pt, bottom-sep = 1.5ex plus .5ex minus 0.5ex, top = 0, - parindent = 2em + parindent = 0em } diff --git a/macros/xetex/latex/exam-zh/tex/exam-zh.cls b/macros/xetex/latex/exam-zh/tex/exam-zh.cls index e75c5f4d32..e4ba177bec 100644 --- a/macros/xetex/latex/exam-zh/tex/exam-zh.cls +++ b/macros/xetex/latex/exam-zh/tex/exam-zh.cls @@ -6,7 +6,7 @@ \NeedsTeXFormat{LaTeX2e}[2017/04/15] \RequirePackage{expl3} -\ProvidesExplClass {exam-zh} {2023-06-28} {v0.1.27} {LaTeX template for Chinese exam} +\ProvidesExplClass {exam-zh} {2024-02-11} {v0.2.1} {LaTeX template for Chinese exam} % 检查 LaTeX2e kernel 版本 \msg_new:nnn { exam-zh } { latex-too-old } @@ -87,6 +87,7 @@ \RequirePackage { exam-zh-symbols } \RequirePackage { exam-zh-chinese-english } \RequirePackage { exam-zh-textfigure } +\RequirePackage { exam-zh-math } \AtEndPreamble { @@ -418,6 +419,8 @@ } \clearpage } + % 修复 section 的超链接跳转问题 + \int_gincr:N \c@chapter } % 纸张和页面布局 -- cgit v1.2.3