texlive[72136] Master: suanpan-l3 (29aug24)

commits+karl at tug.org commits+karl at tug.org
Thu Aug 29 22:38:30 CEST 2024


Revision: 72136
          https://tug.org/svn/texlive?view=revision&revision=72136
Author:   karl
Date:     2024-08-29 22:38:29 +0200 (Thu, 29 Aug 2024)
Log Message:
-----------
suanpan-l3 (29aug24)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-langchinese.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/suanpan-l3/
    trunk/Master/texmf-dist/doc/latex/suanpan-l3/README.md
    trunk/Master/texmf-dist/doc/latex/suanpan-l3/build.sh
    trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.pdf
    trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.tex
    trunk/Master/texmf-dist/tex/latex/suanpan-l3/
    trunk/Master/texmf-dist/tex/latex/suanpan-l3/suanpan-l3.sty
    trunk/Master/tlpkg/tlpsrc/suanpan-l3.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/suanpan-l3/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/suanpan-l3/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/suanpan-l3/README.md	2024-08-29 20:38:29 UTC (rev 72136)
@@ -0,0 +1,58 @@
+The traditional Chinese 7-bids suanpan(abacus) package based on l3draw
+=======
+
+The `suanpan-l3` package is a traditional Chinese 7-bids abacus drawing package that utilizes l3draw and is developed with Expl3. It can effectively manage both upper and lower bids, while also considering bottom bid, top bid, and hanging bid.
+
+The `suanpan-l3` package offers a unique environment for drawing abacuses, denoted as `suanpan`. Within this environment, 7 specialized macros are available for the creation of abacuses. The `\rod` macro is used to lay out a single rod, while the `\rod*` macro draws a counting point on this rod's beam. The `\rods` macro is capable of laying out a set of rods. The `\bid` macro colors the specified bid. The `\bids` macro colors all inner bids that are near the beam, while the `\bids*` macro colors all outer bids that are far from the beam. Lastly, the `\lrframe` macro is used to lay out the left and right frames of an abacus.
+
+At the same time, the `suanpan-l3` package offers customization options for abacus, including line width, draw color, fill color, bid space, rod space, etc. These can be configured through package options, `suanpan` environment options, or `\suanpanset` macro.
+
+For further details and examples, please refer to the manual(in Chinese).
+
+Contributing
+------------
+
+1. gitee repository:
+   (1). repository: [suanpan](https://gitee.com/nwafu_nan/suan-pan)
+   (2). Issues and PR: [issue](https://gitee.com/nwafu_nan/suanpan-/issues) or [pull request](https://gitee.com/nwafu_nan/suan-pan/pulls).
+   
+   基于l3draw的中国传统7珠算盘LaTeX排版宏包
+=======
+
+`suanpan-l3`是一个基于l3draw绘图宏包,用Expl3开发的中国传统7珠圆珠算盘排版宏包,它能够实现普通上珠、下珠和使用底珠、顶珠和悬珠的算盘排版。
+
+`suanpan-l3`宏包提供了唯一的一个`suanpan`排版环境用于绘制需要排版的算盘,在该环境中使用专用命令`\rod`排版一个档位,`\rod*`命令排版带计位点的档位,`\rods`命令排版一组档位,`\bid`命令为指定的算珠进行着色,`\bids`命令为指定档位的内珠进行着色,`\bids*`命令为指定的档位的外珠进行着色,`\lrframe`命令排版算盘左右边框。
+
+同时,`suanpan-l3`宏包还为算盘排版提供线宽、颜色、间距等**外观**设置选项,可以通过宏包选项、环境选项对其进行设置,也可以通过`\suanpanset`命令实现外观属性设置。
+
+可以通过阅读宏包手册以了解该宏包更多的使用细节和使用样例。
+
+##  参与贡献
+---------------------
+
+1. gitee仓库:
+    (1). 仓库地址: [suanpan](https://gitee.com/nwafu_nan/suan-pan)
+    (2). Issues and PR: [issue](https://gitee.com/nwafu_nan/suan-pan/issues) or [pull request](https://gitee.com/nwafu_nan/suan-pan/pulls).
+    
+Copyright and Licence
+---------------------
+
+    Copyright (C) 2020-2022 by Nan Geng <nangeng at nwafu.edu.cn>
+    ----------------------------------------------------------------------
+
+    This work may be distributed and/or modified under the
+    conditions of the LaTeX Project Public License, either
+    version 1.3c of this license or (at your option) any later
+    version. This version of this license is in
+       http://www.latex-project.org/lppl/lppl-1-3c.txt
+    and the latest version of this license is in
+       http://www.latex-project.org/lppl.txt
+    and version 1.3 or later is part of all distributions of
+    LaTeX version 2005/12/01 or later.
+
+    This work has the LPPL maintenance status "maintained".
+
+    The Current Maintainer of this work is Nan Geng.
+
+    This package consists of suanpan-l3.sty, suanpan-l3.tex and README.md(this file),
+                 and the derived files suanpan-l3.pdf with build.sh.


Property changes on: trunk/Master/texmf-dist/doc/latex/suanpan-l3/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/suanpan-l3/build.sh
===================================================================
--- trunk/Master/texmf-dist/doc/latex/suanpan-l3/build.sh	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/suanpan-l3/build.sh	2024-08-29 20:38:29 UTC (rev 72136)
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+xelatex suanpan-l3.tex &&\
+makeindex -s gind.ist -o suanpan-l3.ind suanpan-l3.idx &&\
+makeindex -s gglo.ist -o suanpan-l3.gls suanpan-l3.glo &&\
+xelatex suanpan-l3.tex &&\
+xelatex suanpan-l3.tex &&\
+xelatex suanpan-l3.tex


Property changes on: trunk/Master/texmf-dist/doc/latex/suanpan-l3/build.sh
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.pdf	2024-08-29 20:32:56 UTC (rev 72135)
+++ trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.pdf	2024-08-29 20:38:29 UTC (rev 72136)

Property changes on: trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.tex	2024-08-29 20:38:29 UTC (rev 72136)
@@ -0,0 +1,674 @@
+\documentclass[full]{l3doc}
+\usepackage[scheme=chinese]{ctex}
+\usepackage{geometry}
+\usepackage{fancyvrb-ex}
+\usepackage{ninecolors}
+\usepackage{suanpan-l3}
+
+\IndexPrologue
+  {
+    \section*{索引}
+    \markboth{索引}{索引}
+    \addcontentsline{toc}{section}{索引}
+    斜体数字说明了对应索引内容出现的页码,
+    带有下划线的数据给出了索引内容的定义,
+    其它的数字给出了索引内容引用的位置。
+    % \section*{Index}
+    % \markboth{Index}{Index}
+    % \addcontentsline{toc}{section}{Index}
+    % The~italic~numbers~denote~the~pages~where~the~
+    % corresponding~entry~is~described,~
+    % numbers~underlined~point~to~the~definition,~
+    % all~others~indicate~the~places~where~it~is~used.
+  }
+
+\newcommand\tikzmark[1]{\tikz \coordinate[overlay, remember picture] (#1);}
+
+\geometry{
+  left=4.5cm,
+  right=2cm,
+  top=2cm,
+  bottom=2cm,
+}
+\hypersetup {
+  CJKbookmarks,
+  bookmarksopen,
+  bookmarksopenlevel=3,
+  pdfstartview=FitH,
+  pdfinfo = {
+   Title = 中国传统7珠圆珠算盘排版宏包 ,
+   Subject = A LaTeX3 package ,
+   Author = 耿楠
+ }
+}
+
+\DoNotIndex{\begin, \end}
+\setlength{\parskip}{\medskipamount}
+\DeclareDocumentEnvironment { noteen } { +b } {
+  \par\textbf{\textsf{NOTE:~}}#1\par
+} {}
+\DeclareDocumentEnvironment { notezh } { +b } {
+  \par\textbf{\textsf{注意:~}}#1\par
+} {}
+
+\AtEndDocument{
+  \newgeometry{
+    left=2cm,
+    right=2cm,
+    top=2cm,
+    bottom=2cm
+  }
+  \PrintIndex
+}
+
+\ExplSyntaxOn
+\dim_new:N \l__my_syntax_dim
+\box_new:N \g__my_syntax_box
+\NewDocumentEnvironment { Syntax } { s }
+  {
+    \dim_set:Nn \l__my_syntax_dim
+      { \textwidth }
+    \hbox_gset:Nw \g__my_syntax_box
+      \small \ttfamily
+      \begin{minipage}[t]{\l__my_syntax_dim}
+        \raggedright\obeyspaces\obeylines
+  }
+  {
+      \end{minipage}
+    \hbox_gset_end:
+    \IfValueF { #1 } { \smallskip }
+    \box_use_drop:N \g__my_syntax_box
+    \smallskip
+  }
+
+\DeclareDocumentEnvironment { Description } { o +b } {
+  \hbox_set:Nn \l_tmpa_box { #1 }
+  \dim_set:Nn \l_tmpa_dim { \box_wd:N \l_tmpa_box }
+  \begin{itemize}[labelwidth=\l_tmpa_dim, align=left]
+    #2
+  \end{itemize}
+} {  }
+
+\keys_define:nn { cchess/doc } {
+  opt .tl_set:N = \l_opt_tl,
+  desc .tl_set:N = \l_desc_tl,
+  init .tl_set:N = \l_init_tl,
+  init .initial:n = init-none,
+}
+
+\box_new:N \l__option_box
+\NewDocumentEnvironment { option } { m +b } {
+  \keys_set:nn { cchess/doc } { #1 }
+  \hbox_set:Nw \l__option_box
+    \small \ttfamily
+    \begin{minipage}[t]{\textwidth}
+      \obeyspaces\obeylines
+      \textcolor{red}{
+        \l_opt_tl
+        \exp_args:Nx\SpecialOptionIndex{\l_opt_tl}
+      }
+      {~}\l_desc_tl
+      \hfill(
+      \tl_if_eq:NnTF \l_init_tl { init-none } { no~value }
+        { 初始值:~\texttt{\l_init_tl} }
+      )
+    \end{minipage}
+  \hbox_gset_end:
+  \box_use_drop:N \l__option_box
+  #2
+  % \vspace*{-4ex}
+  \medskip
+} {  }
+
+\DeclareDocumentCommand \opt { O{} m }
+  { \__codedoc_cmd:no {#1} { #2 } }
+\ExplSyntaxOff
+
+\def\vers{\texttt{v1.1.0} }
+
+\begin{document}
+\title{
+  \pkg{suanpan}---算盘(Abacus)排版宏包
+  % \rlap{\makebox[4cm][r]{
+    % \normalsize $\Longrightarrow$ \color{red}
+    % \protect\hyperlink{en}{English Version}
+    % \protect\hypertarget{zh}{}
+  % }}
+}
+\author{\textit{耿楠} \texttt{<nangeng at nwafu.edu.cn>}}
+\date{\the\year 年\the\month 月\the\day 日\qquad \vers
+% \thanks{\url{https://github.com/registor/suanpan}}
+\thanks{\url{https://gitee.com/nwafu_nan/suan-pan}}
+}
+
+\maketitle
+
+\begin{abstract}
+  \pkg{suanpan}是一个基于\pkg{l3draw}绘图宏包,用\pkg{Expl3}%
+  开发的中国传统7珠圆珠算盘排版宏包,它能够实现使用普通上珠、下珠
+  和底珠、顶珠及悬珠的算盘排版。该宏包提供了唯一的一个
+  \env{suanpan}算盘排版环境及仅在该环境中使用的 \tn{rod}、
+  \tn{rods}、\tn{bid}、\tn{bids}和\tn{lrframe}档杆、算珠着色和
+  边框排版命令。同时,该宏包还提供了\tn{suanpanset}命令用于对算盘
+  外观进行设置。
+  \begin{center}
+    \begin{suanpan}[framedraw = brown2, scale = 0.45, bidsep=1.5pt,
+                    roddraw = brown3, rodfill = brown4]
+      % 各档位数字列表
+      \rods{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
+      % 定位点
+      \rod*{4}{3}
+      \rod*{18}{17}
+      % 使用顶珠
+      \bid{12}{9}{azure7}
+      \bid{13}{9}{azure7}
+      \bid{14}{9}{azure7}
+      \bid{15}{9}{azure7}
+      \bid{16}{9}{azure7}
+      % 使用悬珠
+      \bid{17}{11}{red8}
+      \bid{18}{11}{red8}
+      \bid{19}{11}{red8}
+      \bid{20}{11}{red8}
+      \bid{21}{11}{red8}
+      % 使用底珠
+      \bid{11}{3}{olive7}
+      \bid{16}{3}{olive7}
+      \bid{21}{3}{olive7}
+      \lrframe{1}{21}
+    \end{suanpan}
+  \end{center}
+\end{abstract}
+
+{\small
+\tableofcontents
+}
+\newpage
+
+\begin{documentation}
+
+\section{引言}
+
+\pkg{suanpan}宏包是一个基于\pkg{l3draw}绘图宏包,用\pkg{Expl3}%
+开发的中国传统7珠圆珠算盘排版宏包,它利用\pkg{l3draw}的绘图功能,
+利用简单线条实现了算盘的排版。
+
+由于圆珠是通过圆角矩形实现的,因此当算珠数量较多时,绘制耗时较长,
+其编译速度较慢。
+
+\section{用户接口}
+
+\subsection{\env{suanpan}算盘排版环境}
+
+\begin{function}{suanpan}
+  \begin{syntax}
+    \tn{begin}|{suanpan}|\oarg{外观选项}
+    .....
+    \tn{end}|{suanpan}|
+  \end{syntax}
+\end{function}
+
+  按可选项设置的\oarg{外观选项}实现算盘排版。
+
+  在\env{suanpan}环境中,可以通过专用命令\tn{rod}%
+  (排版算盘的一个档位),\tn{rods}(排版一组档位),
+  \tn{bid}(指定算珠颜色),\tn{lrframe}(排版左右边框)
+  按需实现算盘排版。
+
+  在\oarg{外观选项}中可以通过key-value的方式设置线宽、颜色、
+  缩放比例等外观属性。
+
+  通过\oarg{外观选项}设置的外观参数仅对当前命令局部有效,
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+    xrightmargin=.48\linewidth,gobble=2]
+  \centering
+  % 为便排版,进行缩放
+  \suanpanset{scale = 0.65}
+  \begin{suanpan}
+    \rod{1}{0}
+    \rod{2}{3}
+    \rod{3}{0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{\env{suanpan}环境中的专用命令}
+
+\subsubsection{\tn{rod}单一档位排版命令}
+
+\begin{function}{\rod}
+  \begin{syntax}
+    \cs{rod} \marg{档位编号} \marg{档位数字}
+  \end{syntax}
+\end{function}
+
+  用于排版\marg{档位编号}(基于1,从左向右进行编号)参数指定的算盘
+  档位,本档的计数值由\marg{档位数字}参数指定。
+
+  \marg{档位数字}支持[0, 20]内的数字,其中[0, 9]内的
+  数字采用常规4个下珠结合1个上珠的方法进行表示,[10, 15]
+  内的数字则需要额外使用\enquote{底珠}和\enquote{顶珠}进行表示,
+  [16, 20]内的数字则需要再额外使用\enquote{悬珠}进行表示。
+
+  宏包还为\tn{rod}命令同时提供了\tn{rod*}星号命令用于排版在
+  横梁上带有计位点(圆点)的档位。
+
+  \begin{notezh}
+    该命令只能用于\env{suanpan}环境中。
+  \end{notezh}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+    xrightmargin=.48\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65}
+  \begin{suanpan}
+    \rod{1}{1}   % 常规档位
+    \rod{2}{6}
+    \rod*{3}{10} % 计位点,使用底珠
+    \rod{4}{12}  % 使用顶珠
+    \rod{5}{18}  % 使用悬珠
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsubsection{\tn{rods}一组档位排版命令}
+
+\begin{function}{\rods}
+  \begin{syntax}
+    \cs{rods} \marg{数字列表}
+  \end{syntax}
+\end{function}
+
+  用于排版在\marg{数字列表}中用逗号分隔的一组数字指定的档位,
+  各档位编号基于1,从左向右进行自动编号。
+
+  \marg{数字列表}中的各档位数字支持[0, 20]内的数字,其中[0, 9]内的
+  数字采用常规4个下珠结合1个上珠的方法进行表示,[10, 15]
+  内的数字则需要额外使用\enquote{底珠}和\enquote{顶珠}进行表示,
+  [16, 20]内的数字则需要再额外使用\enquote{悬珠}进行表示。
+
+  \begin{notezh}
+    宏包并没有为\tn{rods}命令提供在横梁排版计位点的档位的
+    操作。如果需要,则可以使用\tn{rod*}命令对指定档位进行覆盖绘制。
+
+    同样,该命令只能用于\env{suanpan}环境中。
+  \end{notezh}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+    xrightmargin=.48\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65}
+  \begin{suanpan}
+    \rods{0, 6, 12, 18, 0}
+    \rod*{3}{12}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsubsection{\tn{bid}算珠着色命令}
+
+\begin{function}{\bid}
+  \begin{syntax}
+    \cs{bid} \marg{档位编号}\marg{算珠位置}\marg{算珠颜色}
+  \end{syntax}
+\end{function}
+
+  用于将\marg{档位编号}指定的档位中,用\marg{算珠位置}指定的算珠
+  设置为\marg{算珠颜色}指定的颜色。同时,该命令还将\marg{算珠颜色}%
+  融合40\%黑色后用于算珠绘制颜色。
+
+  一个档位中的\marg{算珠位置}自下向上,按\enquote{$1, 2, \cdots, 11$}%
+  的顺序进行编号。其中下珠占\enquote{$1, 2, \cdots, 7$}的位置,上珠占
+  \enquote{$8, 9, 10$}的位置,悬珠占\enquote{$11$}的位置。
+
+  \begin{notezh}
+    同样,该命令只能用于\env{suanpan}环境中。
+  \end{notezh}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+    xrightmargin=.48\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65}
+  \begin{suanpan}
+    \rods{0, 0, 7, 11, 8, 19}
+    \bid{1}{1}{gray7}
+    \bid{2}{5}{gray7}
+    \bid{3}{6}{red8}
+    \bid{4}{7}{red8}
+    \bid{4}{8}{azure6}
+    \bid{4}{9}{yellow9}
+    \bid{5}{10}{violet5}
+    \bid{6}{11}{teal4}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsubsection{\tn{bids}内珠或外珠着色命令}
+
+\begin{function}{\bids}
+  \begin{syntax}
+    \cs{bids} \marg{档位编号}\marg{档位数字}\marg{算珠颜色}
+  \end{syntax}
+\end{function}
+
+  用于将\marg{档位编号}指定的档位中,所有\marg{档位数字}的内珠
+  设置为\marg{算珠颜色}指定的颜色。同时,该命令还将\marg{算珠颜色}%
+  融合40\%黑色后用于算珠绘制颜色。
+
+  宏包还为\tn{bids}命令同时提供了\tn{bids*}星号命令用于设置该档
+  所有外珠的颜色。
+
+  \begin{notezh}
+    同样,该命令只能用于\env{suanpan}环境中。该命令只能选择
+    内珠或外珠进行着色,不能同时选择内珠和外珠。
+  \end{notezh}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+    xrightmargin=.48\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65}
+  \begin{suanpan}
+    \rods{0, 0, 7, 11, 8, 19}
+    \bids{3}{7}{teal4}
+    \bids*{5}{8}{azure6}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsubsection{\tn{lrframe}左右边框排版命令}
+
+\begin{function}{\lrframe}
+  \begin{syntax}
+    \cs{lrframe} \marg{首档编号}\marg{末档编号}
+  \end{syntax}
+\end{function}
+
+  用于在\marg{首档编号}指定的档位左边和\marg{末档编号}指定的档位
+  右边排版算盘的左右边框。
+
+  \begin{notezh}
+    同样,该命令只能用于\env{suanpan}环境中。另外,其左右边框应该
+    同时按正确第一档和最后一档档位编号绘制,否则会造成结果容器(盒子)
+    尺寸异常的问题。
+  \end{notezh}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+    xrightmargin=.48\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65}
+  \begin{suanpan}
+    \rods{0, 6, 12, 18, 0}
+    \lrframe{1}{5}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{\tn{suanpanset}选项设置命令}
+
+\begin{function}{\suanpanset}
+  \begin{syntax}
+    \cs{suanpanset} \marg{外观选项}
+  \end{syntax}
+\end{function}
+
+  通过\marg{外观选项}的key-value选项设置算盘的算珠、边框等元素的
+  绘制颜色、填充颜色、线条宽度;各档位之间的间距、算珠之间的间距;
+  算盘整体的缩放比例等外观属性。
+
+  通过\cs{suanpan}\marg{外观选项}设置的外观属性对后续所有算盘排版
+  操作有效。
+
+  \begin{notezh}
+    由于\pkg{suanpan}宏包涉及大量绘图操作,因此建议尽量减少在每个
+    \env{suanpan}排版环境的可选项中使用\oarg{外观选项}设置,以
+    节约编译时间。如需要更改算盘外观,可以在引用宏包时,通过为宏包
+    添加选项实现,也可以执行\tn{suanpanset}命令进行必要的
+    全局设置或在一定范围内进行统一设置。
+  \end{notezh}
+
+\section{宏包选项}
+
+在\pkg{suanpan}宏包中,算盘颜色、线条宽度、档位及算珠间距等
+算盘外观属性可以在引入宏包时通过\oarg{宏包选项}进行设置,
+也可以在\env{suanpan}环境的\oarg{外观选项}中进行局部设置,
+还可以通过\cs{suanpanset}命令进行全局或局部设置。
+
+强烈建议在引用宏包时通过\oarg{宏包选项}为一个文档统一全局设置
+算盘外观属性,以节约编译时间。应避免频繁在命令和环境中使用
+\oarg{宏包选项}或使用\cs{suanpanset}命令设置算盘外观属性。
+
+\pkg{suanpan}宏包选项是一个英文逗号分隔的选项列表,其
+选项是\marg{key}|=|\marg{value}形式。部分选项的\marg{value}可以省略。
+对于同一选项,后续设置会覆盖以前设置。
+
+\pkg{suanpan}宏包采用\LaTeX3风格的键值设置,支持不同类型以及多种层次的
+选项设定。键值列表中,``|=|''左右的空格不影响设置。但需注意,参数列表中%
+\textsf{不可以出现空行}。
+
+布尔型的参数\marg{选项}|=true|中的``|=true|''可以省略。
+
+\subsection{草稿选项}
+
+\begin{option}{ opt = draft, desc = {= \meta{草稿选项}}, init=false }
+  设置草稿选项。
+\end{option}
+
+  \oarg{draft}选项会将算珠用矩形表示,取消其圆角效果,从而加快编译速度。
+
+  \begin{notezh}
+    在草稿模式下算盘排版会与期望的排版结果有出入。
+  \end{notezh}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.53\linewidth,gobble=2]
+  % \usepackage[draft]{suanpan}
+  \centering
+  \suanpanset{scale = 0.65}
+  \begin{suanpan}[draft]
+    \rods{0, 6, 12, 18, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{线宽选项}
+
+\begin{option}{ opt = linewd, desc = {= \meta{线宽选项}}, init=2pt }
+  设置算盘绘制中的线宽。
+\end{option}
+
+  \oarg{linewd}选项用于设置算盘边框内线线宽,同时会将
+  边框外线设置为linewd的7.00倍,将档杆和算珠线宽
+  设置为linewd的1.00倍。
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.40\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, linewd = 3pt}
+  \begin{suanpan}
+    \rods{0, 6, 12, 18, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{档位间距}
+
+\begin{option}{ opt = rodsep, desc = {= \meta{档位间距}}, init=3.0pt }
+  设置算盘各档间的间距。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.40\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, rodsep = 15pt}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+  \begin{notezh}
+    修改档位间距会改变算盘排版的宽度。
+  \end{notezh}
+
+\subsection{算珠间距}
+
+\begin{option}{ opt = bidsep, desc = {= \meta{算珠间距}}, init=1.8pt }
+  设置算珠间的间距。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.40\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, bidsep = 4pt}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+  \begin{notezh}
+    修改算珠间距不会改变算盘的尺寸,但算珠高度会发生变化。
+    另外,过小的算珠高度会造成算珠圆角的畸变。
+  \end{notezh}
+
+\subsection{缩放比例}
+
+\begin{option}{ opt = scale, desc = {= \meta{缩放比例}}, init=1.0 }
+  设置算盘输出结果的整体缩放比例。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.40\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 1.20}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{边框颜色}
+
+\begin{option}{ opt = framedraw, desc = {= \meta{边框颜色}}, init=black }
+  设置算盘边框颜色。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.37\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, framedraw = brown3}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+  \begin{notezh}
+    边框颜色包括内外边框和横梁颜色。
+  \end{notezh}
+
+\subsection{档杆绘制颜色}
+
+\begin{option}{ opt = roddraw, desc = {= \meta{档杆绘制颜色}}, init=black }
+  设置档杆绘制颜色。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.37\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, roddraw = brown4}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{档杆填充颜色}
+
+\begin{option}{ opt = rodfill, desc = {= \meta{档杆填充颜色}}, init=white }
+  设置档杆填充颜色。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.37\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, rodfill = brown6}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{外珠绘制颜色}
+
+\begin{option}{ opt = outerdraw, desc = {= \meta{外珠绘制颜色}}, init=black }
+  设置档杆上外珠\footnote{外珠是指离梁不记数的算珠。}绘制颜色。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.37\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, outerdraw = yellow4}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{外珠填充颜色}
+
+\begin{option}{ opt = outerfill, desc = {= \meta{外珠填充颜色}}, init=white }
+  设置外珠填充颜色。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.37\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, outerfill = yellow9}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{内珠绘制颜色}
+
+\begin{option}{ opt = innerdraw, desc = {= \meta{内珠绘制颜色}}, init=black }
+  设置档杆上内珠\footnote{内珠是指靠梁记数的算珠。}绘制颜色。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.37\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, innerdraw = red8}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+\subsection{内珠填充颜色}
+
+\begin{option}{ opt = innerfill, desc = {= \meta{内珠填充颜色}}, init=black}
+  设置内珠填充颜色。
+\end{option}
+
+\begin{SideBySideExample}[frame=single,numbers=left,%
+                xrightmargin=.37\linewidth,gobble=2]
+  \centering
+  \suanpanset{scale = 0.65, innerfill = red9}
+  \begin{suanpan}
+    \rods{0, 6, 0}
+  \end{suanpan}
+\end{SideBySideExample}
+
+%
+% \bigskip
+
+% \bigskip
+
+% \title{
+%   \pkg{suanpan} package for writing Chinese chess
+%   \rlap{\makebox[4cm][r]{
+%     \normalsize $\Longrightarrow$ \color{red}
+%     \protect\hyperlink{zh}{中文版本}
+%     \protect\hypertarget{en}{}
+%   }}
+% }
+% \author{Nan Geng \texttt{<nangeng at nwafu.edu.cn>}}
+% \date{\today\qquad \vers}
+% \maketitle
+%
+% \section{Introduction}
+%
+% \section{Interface}
+%
+% \section{options}
+
+\end{documentation}
+
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/latex/suanpan-l3/suanpan-l3.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/suanpan-l3/suanpan-l3.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/suanpan-l3/suanpan-l3.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/suanpan-l3/suanpan-l3.sty	2024-08-29 20:38:29 UTC (rev 72136)
@@ -0,0 +1,969 @@
+%%% ----------------------------------------------------------------------------
+%%% suanpan: draw suanpan(abacus) with LaTeX3
+%%% Author    : Nan Geng <nangeng at nwafu.edu.cn>
+%%% Repository: https://gitee.com/nwafu_nan/suan-span
+%%% License   : The LaTeX Project Public License 1.3c
+%%% ----------------------------------------------------------------------------
+
+\NeedsTeXFormat{LaTeX2e}[2020/10/01]
+\RequirePackage{expl3}
+% \ProvidesExplPackage{suanpan}{2024-08-20}{v1.0.0} % 初稿
+\ProvidesExplPackage{suanpan-l3}{2024-08-28}{v1.1.0} % 代码优化(统一尺寸计算,添加空白占位)
+  {draw suanpan(abacus) with LaTeX3}
+
+\RequirePackage{l3keys2e}
+\RequirePackage{xparse}
+\RequirePackage{l3draw}
+
+\cs_new:Npn \__suanpan_error:n { \msg_error:nn { suanpan(abacus) } }
+
+% 盒子容器总高度计算函数
+\cs_new_nopar:Npn \__suanpan_coffin_ht_plus_dp:N #1
+  {
+    \coffin_ht:N #1 + \coffin_dp:N #1
+  }
+
+% =============颜色处理函数=============
+% 填充色辅助函数
+\cs_new_nopar:Nn \__suanpan_aux_color_boxfill:
+  { }
+
+% 颜色命名函数
+% #1 颜色名称
+% #2 颜色表达式
+\cs_set_nopar:Npn \__suanpan_color_select:nn #1#2
+  {
+    \color_set:nn {#1} {#2}
+  }
+\cs_generate_variant:Nn \__suanpan_color_select:nn {nx}
+
+% 颜色命名函数
+% #1 颜色名称
+% #2 颜色空间
+% #3 颜色分量值
+\cs_set_nopar:Npn \__suanpan_color_select:nnn #1#2#3
+  {
+    \color_set:nnn {#1} {#2} {#3}
+  }
+\cs_generate_variant:Nn \__suanpan_color_select:nnn {nnx}
+
+% 定义变量
+% 算盘基础尺寸
+\dim_new:N \l__suanpan_bid_h_dim
+\dim_new:N \l__suanpan_bid_d_dim
+\dim_new:N \l__suanpan_bid_sep_dim
+\dim_new:N \l__suanpan_rod_sep_dim
+\dim_new:N \l__suanpan_rod_d_dim
+\dim_new:N \l__suanpan_frame_b_dim
+
+% 算盘基础尺寸初值(参考 QBT1747-1993 算盘标准)
+\dim_set:Nn \l__suanpan_bid_h_dim { 12mm }
+\dim_set:Nn \l__suanpan_bid_d_dim { 23mm }
+\dim_set:Nn \l__suanpan_bid_sep_dim { 1.8pt }
+\dim_set:Nn \l__suanpan_rod_sep_dim { 4pt }
+\dim_set:Nn \l__suanpan_rod_d_dim { 7mm }
+\dim_set:Nn \l__suanpan_frame_b_dim { 11mm }
+
+% 半长度
+\dim_new:N \l__suanpan_bid_h_half_dim
+\dim_new:N \l__suanpan_bid_d_half_dim
+\dim_new:N \l__suanpan_rod_d_half_dim
+\dim_new:N \l__suanpan_frame_b_half_dim
+
+% 上珠偏移
+\dim_new:N \l__suanpan_bid_upper_offset_dim
+% 下珠偏移
+\dim_new:N \l__suanpan_bid_lower_offset_dim
+% 上档杆长度
+\dim_new:N \l__suanpan_rod_upper_h_dim
+% 下档杆长度
+\dim_new:N \l__suanpan_rod_lower_h_dim
+% 上档杆偏移
+\dim_new:N \l__suanpan_rod_upper_offset_dim
+% 下档杆偏移
+\dim_new:N \l__suanpan_rod_lower_offset_dim
+% 上边框内线偏移
+\dim_new:N \l__suanpan_frame_upper_inner_offset_dim
+% 下边框内线偏移
+\dim_new:N \l__suanpan_frame_lower_inner_offset_dim
+% 上边框外线偏移
+\dim_new:N \l__suanpan_frame_upper_outer_offset_dim
+% 下边框外线偏移
+\dim_new:N \l__suanpan_frame_lower_outer_offset_dim
+% 算珠上边缘
+\dim_new:N \l__suanpan_bid_upper_dim
+% 算珠下边缘
+\dim_new:N \l__suanpan_bid_lower_dim
+% 算珠圆角半径
+\dim_new:N \l__suanpan_bid_arc_dim
+% 横梁计位点半径
+\dim_new:N \l__suanpan_frame_unit_r_dim
+% 边框外线半宽度
+\dim_new:N \l__suanpan_frame_outer_half_dim
+% 档杆总成宽度
+\dim_new:N \l__suanpan_support_d_dim
+% 档杆总成半宽度
+\dim_new:N \l__suanpan_support_d_half_dim
+% 上档杆总成高度
+\dim_new:N \l__suanpan_support_upper_dim
+% 下档杆总成高度
+\dim_new:N \l__suanpan_support_lower_dim
+% 档杆总成组装垂直偏移
+\dim_new:N \l__suanpan_support_y_offset_dim
+
+% 上边框外线位置
+\dim_new:N \l__suanpan_frame_outer_upper_dim
+% 下边框外线位置
+\dim_new:N \l__suanpan_frame_outer_lower_dim
+% 上边框内线位置
+\dim_new:N \l__suanpan_frame_inner_upper_dim
+% 下边框内线位置
+\dim_new:N \l__suanpan_frame_inner_lower_dim
+% 左右边框外线偏移
+\dim_new:N \l__suanpan_frame_outer_lr_offset_dim
+% 左右边框外线圆角半径
+\dim_new:N \l__suanpan_frame_outer_arc_dim
+
+\dim_new:N \l__suanpan_frame_inner_linewidth_dim
+\dim_new:N \l__suanpan_frame_outer_linewidth_dim
+\dim_new:N \l__suanpan_rod_linewidth_dim
+\dim_new:N \l__suanpan_bid_linewidth_dim
+
+% 状态变量
+\bool_new:N \l__suanpan_support_frame_bool
+\bool_set_true:N \l__suanpan_support_frame_bool
+\bool_new:N \l__suanpan_support_unit_bool
+\bool_set_false:N \l__suanpan_support_unit_bool
+\bool_new:N \l__suanpan_draft_bool
+
+% 容器(盒子)
+\coffin_new:N \l__suanpan_inner_bid_coffin
+\coffin_new:N \l__suanpan_outer_bid_coffin
+\coffin_new:N \l__suanpan_float_bid_coffin
+\coffin_new:N \l__suanpan_support_coffin
+\coffin_new:N \l__suanpan_empty_support_coffin
+
+% 凭据表(Token)
+\tl_new:N \l__suanpan_bid_draw_color_tl
+\tl_new:N \l__suanpan_bid_fill_color_tl
+\tl_new:N \l__suanpan_scale_tl
+
+% 档位最大值
+\int_new:N \l__suanpan_rod_max_int
+\int_zero:N \l__suanpan_rod_max_int
+
+% 档位算珠位置列表
+\clist_new:N \l__suanpan_bids_pos_clist
+
+% 档位数字与算珠位置对照属性表常量(内珠和外珠)
+% {x, y}==>x: 算珠位置(1-11, 1-7---下珠,8-10---上珠,11---悬珠)
+%          y: 算珠类型(0---外珠,1---内珠)
+\prop_const_from_keyval:Nn \l__suanpan_rods_val_prop
+  {
+    0  = {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {9, 0}, {10, 0}},
+    1  = {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {7, 1}, {9, 0}, {10, 0}},
+    2  = {{1, 0}, {2, 0}, {3, 0}, {6, 1}, {7, 1}, {9, 0}, {10, 0}},
+    3  = {{1, 0}, {2, 0}, {5, 1}, {6, 1}, {7, 1}, {9, 0}, {10, 0}},
+    4  = {{1, 0}, {4, 1}, {5, 1}, {6, 1}, {7, 1}, {9, 0}, {10, 0}},
+    5  = {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {8, 1}, {10, 0}},
+    6  = {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {7, 1}, {8, 1}, {10, 0}},
+    7  = {{1, 0}, {2, 0}, {3, 0}, {6, 1}, {7, 1}, {8, 1}, {10, 0}},
+    8  = {{1, 0}, {2, 0}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {10, 0}},
+    9  = {{1, 0}, {4, 1}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {10, 0}},
+    10 = {{3, 1}, {4, 1}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {10, 0}},
+    11 = {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {7, 1}, {8, 1}, {9 , 1}},
+    12 = {{1, 0}, {2, 0}, {3, 0}, {6, 1}, {7, 1}, {8, 1}, {9 , 1}},
+    13 = {{1, 0}, {2, 0}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {9 , 1}},
+    14 = {{1, 0}, {4, 1}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {9 , 1}},
+    15 = {{3, 1}, {4, 1}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {9 , 1}},
+    16 = {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {7, 1}, {8, 1}, {11, 1}},
+    17 = {{1, 0}, {2, 0}, {3, 0}, {6, 1}, {7, 1}, {8, 1}, {11, 1}},
+    18 = {{1, 0}, {2, 0}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {11, 1}},
+    19 = {{1, 0}, {4, 1}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {11, 1}},
+    20 = {{3, 1}, {4, 1}, {5, 1}, {6, 1}, {7, 1}, {8, 1}, {11, 1}}
+  }
+
+% 尺寸计算函数
+\cs_new:Nn \__suanpan_dim_calc:
+  {
+    % 基础尺寸半长度
+    \dim_set:Nn \l__suanpan_bid_h_half_dim { \l__suanpan_bid_h_dim / 2 }
+    \dim_set:Nn \l__suanpan_bid_d_half_dim { \l__suanpan_bid_d_dim / 2 }
+    \dim_set:Nn \l__suanpan_rod_d_half_dim { \l__suanpan_rod_d_dim / 2 }
+    \dim_set:Nn \l__suanpan_frame_b_half_dim { \l__suanpan_frame_b_dim / 2 }
+    % 上珠偏移(8号算珠)
+    \dim_set:Nn \l__suanpan_bid_upper_offset_dim
+              { \l__suanpan_frame_b_half_dim + \l__suanpan_bid_h_half_dim }
+    % 下珠偏移(1号算珠)
+    \dim_set:Nn \l__suanpan_bid_lower_offset_dim
+             { -\l__suanpan_frame_b_half_dim - \l__suanpan_bid_h_dim * 7 +
+                \l__suanpan_bid_h_half_dim }
+    % 上档杆长度
+    \dim_set:Nn \l__suanpan_rod_upper_h_dim { \l__suanpan_bid_h_dim * 3 }
+    % 下档杆长度
+    \dim_set:Nn \l__suanpan_rod_lower_h_dim { \l__suanpan_bid_h_dim * 7 }
+    % 上档杆偏移
+    \dim_set:Nn \l__suanpan_rod_upper_offset_dim { \l__suanpan_frame_b_half_dim }
+    % 下档杆偏移
+    \dim_set:Nn \l__suanpan_rod_lower_offset_dim
+              { -\l__suanpan_frame_b_half_dim - \l__suanpan_rod_lower_h_dim }
+    % 上边框内线偏移
+    \dim_set:Nn \l__suanpan_frame_upper_inner_offset_dim
+              { \l__suanpan_frame_b_half_dim + \l__suanpan_rod_upper_h_dim }
+    % 下边框内线偏移
+    \dim_set:Nn \l__suanpan_frame_lower_inner_offset_dim
+             { -\l__suanpan_frame_b_half_dim - \l__suanpan_rod_lower_h_dim }
+    % 上边框外线偏移
+    \dim_set:Nn \l__suanpan_frame_upper_outer_offset_dim
+              { \l__suanpan_frame_b_dim + \l__suanpan_frame_b_half_dim +
+                \l__suanpan_rod_upper_h_dim }
+    % 下边框外线偏移
+    \dim_set:Nn \l__suanpan_frame_lower_outer_offset_dim
+             { -\l__suanpan_frame_b_dim - \l__suanpan_frame_b_half_dim -
+                \l__suanpan_rod_lower_h_dim }
+    % 算珠上边缘
+    \dim_set:Nn \l__suanpan_bid_upper_dim
+              { \l__suanpan_bid_h_half_dim - \l__suanpan_bid_sep_dim }
+    % 算珠上边缘
+    \dim_set:Nn \l__suanpan_bid_lower_dim
+             { -\l__suanpan_bid_h_half_dim + \l__suanpan_bid_sep_dim }
+    % 算珠圆角半径
+    \dim_set:Nn \l__suanpan_bid_arc_dim { \l__suanpan_bid_upper_dim - 1pt}
+
+    % 横梁计位点半径
+    \dim_set:Nn \l__suanpan_frame_unit_r_dim { \l__suanpan_frame_b_dim / 4 }
+
+    % 边框外线半宽度
+    \dim_set:Nn \l__suanpan_frame_outer_half_dim
+              { \l__suanpan_frame_outer_linewidth_dim / 2 }
+    % 档杆总成宽度
+    \dim_set:Nn \l__suanpan_support_d_dim
+              { \l__suanpan_bid_d_dim + \l__suanpan_rod_sep_dim }
+    % 档杆总成半宽度
+    \dim_set:Nn \l__suanpan_support_d_half_dim
+              { \l__suanpan_bid_d_half_dim + \l__suanpan_rod_sep_dim / 2 }
+    % 上档杆总成高度
+    \dim_set:Nn \l__suanpan_support_upper_dim
+              { \l__suanpan_frame_upper_outer_offset_dim -
+                \l__suanpan_frame_outer_half_dim }
+    % 下档杆总成高度
+    \dim_set:Nn \l__suanpan_support_lower_dim
+              { \l__suanpan_frame_lower_outer_offset_dim +
+                \l__suanpan_frame_outer_half_dim }
+    % 档杆总成组装垂直偏移
+    \dim_set:Nn \l__suanpan_support_y_offset_dim
+            { ( \l__suanpan_frame_upper_outer_offset_dim -
+                \l__suanpan_frame_lower_outer_offset_dim +
+                \l__suanpan_frame_outer_linewidth_dim ) / 2 -
+                \l__suanpan_frame_upper_outer_offset_dim -
+                \l__suanpan_frame_outer_half_dim
+            }
+
+    % 上边框外线位置
+    \dim_set:Nn \l__suanpan_frame_outer_upper_dim
+              { \l__suanpan_frame_upper_inner_offset_dim +
+                \l__suanpan_frame_b_dim -
+                \l__suanpan_frame_outer_half_dim }
+    % 下边框外线位置
+    \dim_set:Nn \l__suanpan_frame_outer_lower_dim
+              { \l__suanpan_frame_lower_inner_offset_dim -
+                \l__suanpan_frame_b_dim +
+                \l__suanpan_frame_outer_half_dim }
+    % 上边框内线位置
+    \dim_set:Nn \l__suanpan_frame_inner_upper_dim
+              { \l__suanpan_frame_upper_inner_offset_dim +
+                \l__suanpan_frame_inner_linewidth_dim / 2 }
+    % 下边框内线位置
+    \dim_set:Nn \l__suanpan_frame_inner_lower_dim
+              { \l__suanpan_frame_lower_inner_offset_dim -
+                \l__suanpan_frame_inner_linewidth_dim / 2 }
+    % 左右边框外线偏移
+    \dim_set:Nn \l__suanpan_frame_outer_lr_offset_dim
+              { \l__suanpan_support_d_half_dim +
+                \l__suanpan_frame_b_dim -
+                \l__suanpan_frame_outer_half_dim }
+
+    % 左右边框外线圆角半径
+    \dim_set:Nn \l__suanpan_frame_outer_arc_dim
+              { \l__suanpan_frame_outer_linewidth_dim / 3 - 1pt }
+  }
+
+% 选项处理
+% ============宏包选项=================
+\keys_define:nn { suanpan }
+  {
+    draft .choice:,
+    draft / true  .code:n = { \bool_set_true:N  \l__suanpan_draft_bool },
+    draft / false .code:n = { \bool_set_false:N \l__suanpan_draft_bool },
+    draft .default:n = true,
+    draft .initial:n = false,
+
+    unknown .code:n = { \msg_error:nn { suanpan } { unknown-option } }
+  }
+
+% key_value选项设计
+\keys_define:nn { suanpan }
+  {
+    % 绘图线宽
+    linewd .code:n = { % 算盘边框内线线宽
+                       \dim_set:Nn \l__suanpan_frame_inner_linewidth_dim {#1}
+                       % 算盘边框外线线宽
+                       \dim_set:Nn \l__suanpan_frame_outer_linewidth_dim
+                         {
+                           \fp_to_dim:n
+                             {
+                               \fp_eval:n {%
+                                 \l__suanpan_frame_inner_linewidth_dim * 7.0 }
+                             }
+                         }
+                       % 档杆线宽
+                       \dim_set:Nn \l__suanpan_rod_linewidth_dim
+                         {
+                           \fp_to_dim:n
+                             {
+                               \fp_eval:n {%
+                                 \l__suanpan_frame_inner_linewidth_dim * 1.0 }
+                             }
+                         }
+                       % 算珠线宽
+                       \dim_set:Nn \l__suanpan_bid_linewidth_dim
+                         {
+                           \fp_to_dim:n
+                             {
+                               \fp_eval:n {%
+                                 \l__suanpan_frame_inner_linewidth_dim * 1.0 }
+                             }
+                         }
+                       % 计算其它尺寸
+                       \__suanpan_dim_calc:
+                     },
+    linewd .initial:n = 2.0pt,
+
+    % 档间间距
+    rodsep .code:n = {%
+                       \dim_set:Nn \l__suanpan_rod_sep_dim { #1 }
+                       % 计算其它尺寸
+                       \__suanpan_dim_calc:
+                     },
+    rodsep .initial:n = 3.0pt,
+
+    % 算珠间距
+    bidsep .code:n = {%
+                       \dim_set:Nn \l__suanpan_bid_sep_dim { #1 }
+                       % 计算其它尺寸
+                       \__suanpan_dim_calc:
+                     },
+    bidsep .initial:n = 0.0pt,
+
+    % 缩放参数
+    scale .tl_set:N = \l__suanpan_scale_tl,
+    scale .initial:n = 1.0,
+
+    % 边框绘图颜色
+    framedraw  .code:n = { \__suanpan_color_select:nn { framecolor } {#1} },
+    framedraw  .initial:n = black,
+    framedraw* .code:n = { \__suanpan_color_select:nnn { framecolor } #1 },
+
+    % 档杆绘图颜色
+    roddraw  .code:n = { \__suanpan_color_select:nn { roddrawcolor } {#1} },
+    roddraw  .initial:n = black,
+    roddraw* .code:n = { \__suanpan_color_select:nnn { roddrawcolor } #1 },
+    % 档杆填充颜色
+    rodfill  .code:n = { \__suanpan_color_select:nn { rodfillcolor } {#1} },
+    rodfill  .initial:n = white,
+    rodfill* .code:n = { \__suanpan_color_select:nnn { rodfillcolor } #1 },
+
+    % 外珠绘图颜色
+    outerdraw  .code:n = { \__suanpan_color_select:nn { outerdrawcolor } {#1} },
+    outerdraw  .initial:n = black,
+    outerdraw* .code:n = { \__suanpan_color_select:nnn { outerdrawcolor } #1 },
+    % 外珠填充颜色
+    outerfill  .code:n = { \__suanpan_color_select:nn { outerfillcolor } {#1} },
+    outerfill  .initial:n = white,
+    outerfill* .code:n = { \__suanpan_color_select:nnn { outerfillcolor } #1 },
+
+    % 内珠绘图颜色
+    innerdraw  .code:n = { \__suanpan_color_select:nn { innerdrawcolor } {#1} },
+    innerdraw  .initial:n = black,
+    innerdraw* .code:n = { \__suanpan_color_select:nnn { innerdrawcolor } #1 },
+    % 内珠填充颜色
+    innerfill  .code:n = { \__suanpan_color_select:nn { innerfillcolor } {#1} },
+    innerfill  .initial:n = black,
+    innerfill* .code:n = { \__suanpan_color_select:nnn { innerfillcolor } #1 },
+
+    unknown .code:n = { \msg_error:nn { suanpan } { unknown-option } }
+  }
+
+% 出错输出信息
+\msg_new:nnn { suanpan } { unknown-option }
+  { package~ option~ "\l_keys_key_tl"~ is~ unknown. }
+
+% 将文档类选项传给suanpan
+\ProcessKeysOptions { suanpan }
+
+% 选项默认值
+\keys_set:nn { suanpan }
+  {
+    linewd = 2.0pt,
+    rodsep = 3.0pt,
+    bidsep = 1.8pt,
+    scale = 1.0,
+  }
+
+% 构建内珠(靠近横梁,参与计数)容器(盒子)
+\cs_new:Nn \__suanpan_inner_bid_construct:
+  {
+    \group_begin:
+      \hcoffin_gset:Nn \l__suanpan_inner_bid_coffin
+        {
+          \draw_begin:
+            \color_stroke:n { innerdrawcolor }
+            \draw_linewidth:n { \l__suanpan_bid_linewidth_dim }
+            % 圆角矩形绘制较为耗时,draft模式时将绘制直角矩形
+            \bool_if:NF \l__suanpan_draft_bool
+              {
+                  \draw_path_corner_arc:nn{ \l__suanpan_bid_arc_dim }
+                                          { \l__suanpan_bid_arc_dim }
+              }
+            % 绘制算珠
+            \draw_path_rectangle_corners:nn
+              { -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim}
+              {  \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim}
+            \color_fill:n { innerfillcolor }
+            \draw_path_use_clear:n { stroke, fill }
+          \draw_end:
+        }
+    \group_end:
+  }
+
+% 构建外珠(远离横梁,不参与计数)容器(盒子)
+\cs_new:Nn \__suanpan_outer_bid_construct:
+  {
+    \group_begin:
+      \hcoffin_gset:Nn \l__suanpan_outer_bid_coffin
+        {
+          \draw_begin:
+            \color_stroke:n { outerdrawcolor }
+            \draw_linewidth:n { \l__suanpan_bid_linewidth_dim }
+            % 圆角矩形绘制较为耗时,draft模式时将绘制直角矩形
+            \bool_if:NF \l__suanpan_draft_bool
+              {
+                  \draw_path_corner_arc:nn{ \l__suanpan_bid_arc_dim }
+                                          { \l__suanpan_bid_arc_dim }
+              }
+            % 绘制算珠
+            \draw_path_rectangle_corners:nn
+              { -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim}
+              {  \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim}
+            \color_fill:n { outerfillcolor }
+            \draw_path_use_clear:n { stroke, fill }
+          \draw_end:
+        }
+    \group_end:
+  }
+
+% 构建浮珠容器(盒子)
+% 浮珠指可以在算盘中任意布置的算珠
+\cs_new:Npn \__suanpan_float_bid_construct:nn #1#2
+  {
+    \group_begin:
+      \hcoffin_gset:Nn \l__suanpan_float_bid_coffin
+        {
+          \draw_begin:
+            \color_stroke:n { #1 }
+            \draw_linewidth:n { \l__suanpan_bid_linewidth_dim }
+            % 圆角矩形绘制较为耗时,draft模式时将绘制直角矩形
+            \bool_if:NF \l__suanpan_draft_bool
+              {
+                  \draw_path_corner_arc:nn{ \l__suanpan_bid_arc_dim }
+                                          { \l__suanpan_bid_arc_dim }
+              }
+            % 绘制算珠
+            \draw_path_rectangle_corners:nn
+              { -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim}
+              {  \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim}
+            \color_fill:n { #2 }
+            \draw_path_use_clear:n { stroke, fill }
+          \draw_end:
+        }
+    \group_end:
+  }
+
+% 构建档杆容器(盒子)
+\cs_new:Nn \__suanpan_support_construct:
+  {
+    \group_begin:
+      \hcoffin_gset:Nn \l__suanpan_support_coffin
+        {
+          \draw_begin:
+            \draw_scope_begin:
+              \color_stroke:n { roddrawcolor }
+              \draw_linewidth:n { \l__suanpan_rod_linewidth_dim }
+              % 绘制下杆
+              \draw_path_rectangle:nn { -\l__suanpan_rod_d_half_dim,
+                                         \l__suanpan_rod_lower_offset_dim }
+                                      {  \l__suanpan_rod_d_dim,
+                                         \l__suanpan_rod_lower_h_dim }
+              % 绘制上杆
+              \draw_path_rectangle:nn { -\l__suanpan_rod_d_half_dim,
+                                         \l__suanpan_rod_upper_offset_dim }
+                                      {  \l__suanpan_rod_d_dim,
+                                         \l__suanpan_rod_upper_h_dim }
+              \color_fill:n { rodfillcolor }
+              \draw_path_use_clear:n { stroke, fill }
+              % 绘制横梁
+              \color_stroke:n { framecolor }
+              \draw_path_moveto:n { -\l__suanpan_support_d_half_dim,
+                                     \l__suanpan_frame_b_half_dim }
+              \draw_path_lineto:n {  \l__suanpan_support_d_half_dim,
+                                     \l__suanpan_frame_b_half_dim }
+              \draw_path_moveto:n { -\l__suanpan_support_d_half_dim,
+                                    -\l__suanpan_frame_b_half_dim }
+              \draw_path_lineto:n {  \l__suanpan_support_d_half_dim,
+                                    -\l__suanpan_frame_b_half_dim }
+              \draw_path_use_clear:n { stroke}
+            \draw_scope_end:
+
+            % 绘制上下边框
+            \draw_scope_begin:
+              \color_stroke:n { framecolor }
+              \bool_if:NT \l__suanpan_support_frame_bool
+                {
+                  \draw_linewidth:n { \l__suanpan_frame_inner_linewidth_dim }
+                  % 上边框内线
+                  \draw_path_moveto:n { -\l__suanpan_support_d_half_dim,
+                                         \l__suanpan_frame_upper_inner_offset_dim }
+                  \draw_path_lineto:n {  \l__suanpan_support_d_half_dim,
+                                         \l__suanpan_frame_upper_inner_offset_dim }
+                  % 下边框内线
+                  \draw_path_moveto:n { -\l__suanpan_support_d_half_dim,
+                                         \l__suanpan_frame_lower_inner_offset_dim }
+                  \draw_path_lineto:n {  \l__suanpan_support_d_half_dim,
+                                         \l__suanpan_frame_lower_inner_offset_dim }
+                  \draw_path_use_clear:n { stroke}
+                  \draw_linewidth:n { \l__suanpan_frame_outer_linewidth_dim }
+                  % 上边框外线
+                  \draw_path_moveto:n { -\l__suanpan_support_d_half_dim,
+                                         \l__suanpan_support_upper_dim }
+                  \draw_path_lineto:n {  \l__suanpan_support_d_half_dim,
+                                         \l__suanpan_support_upper_dim }
+                  % 下边框外线
+                  \draw_path_moveto:n { -\l__suanpan_support_d_half_dim,
+                                         \l__suanpan_support_lower_dim }
+                  \draw_path_lineto:n {  \l__suanpan_support_d_half_dim,
+                                         \l__suanpan_support_lower_dim }
+                  \draw_path_use_clear:n { stroke}
+                }
+            \draw_scope_end:
+
+            % 绘制计位点(黑色圆点)
+            \bool_if:NT \l__suanpan_support_unit_bool
+              {
+                \draw_scope_begin:
+                  \color_stroke:n { black }
+                  \draw_path_circle:nn { 0pt, 0pt} { \l__suanpan_frame_unit_r_dim }
+                  \bool_if:NTF \l__suanpan_draft_bool
+                    {
+                        \draw_path_use_clear:n { stroke }
+                    }{
+                        \color_fill:n { black }
+                        \draw_path_use_clear:n { stroke, fill }
+                    }
+                \draw_scope_end:
+              }
+          \draw_end:
+        }
+    \group_end:
+  }
+
+% 构建档杆空白容器(盒子),用于占位以避免算盘总成尺寸错误
+\cs_new:Nn \__suanpan_empty_support_construct:
+  {
+    % 测量档杆容器(盒子)总宽度和高度
+    \dim_set:Nn \l_tmpa_dim
+      { \coffin_wd:N \l__suanpan_support_coffin }
+    \dim_set:Nn \l_tmpb_dim
+      { \__suanpan_coffin_ht_plus_dp:N \l__suanpan_support_coffin }
+
+    % 创建一个空容器(盒子)
+    \hcoffin_set:Nn \l__suanpan_empty_support_coffin
+      {
+        \phantom{a}
+      }
+
+    % 调整为档杆宽度和高度
+    \coffin_resize:Nnn \l__suanpan_empty_support_coffin
+      { \l_tmpa_dim } { \l_tmpb_dim }
+  }
+
+% 绘制算珠
+% #1: 算珠位置编号
+%     o o o o o o o | o o o
+%     1 2 3 4 5 6 7   8 9 10
+%                   |    o
+%                        11
+%     其中,11是悬珠位置
+% #2: 算珠类型
+%     0——外珠,1——内珠,2——浮珠
+\cs_new:Npn \__suanpan_dispose_bid:nn #1#2
+  {
+    % 算珠垂直偏移
+    \int_compare:nNnTF { #1 } > { 7 }
+      {
+        \int_compare:nNnTF { #1 } < { 11 }
+          {
+            % 上珠
+            \dim_set:Nn \l_tmpb_dim{ \l__suanpan_bid_upper_offset_dim +
+                                     \l__suanpan_bid_h_dim * (#1 - 8) }
+          }{
+            % 悬珠
+            \dim_set:Nn \l_tmpb_dim{ \l__suanpan_frame_b_half_dim +
+                                     \l__suanpan_bid_h_dim * 2 }
+          }
+      }{
+        % 下珠
+        \dim_set:Nn \l_tmpb_dim{ \l__suanpan_bid_lower_offset_dim +
+                                 \l__suanpan_bid_h_dim * (#1 - 1) }
+      }
+
+    % 绘图算珠
+    \draw_scope_begin:
+      \draw_transform_yshift:n { \l_tmpb_dim }
+      \int_case:nnF { #2 }
+        {
+          { 0 } { \draw_coffin_use:Nnn \l__suanpan_outer_bid_coffin { hc } { vc } }
+          { 1 } { \draw_coffin_use:Nnn \l__suanpan_inner_bid_coffin { hc } { vc } }
+          { 2 } { \draw_coffin_use:Nnn \l__suanpan_float_bid_coffin { hc } { vc } }
+        }{ Bid~Type~Error! }
+    \draw_scope_end:
+  }
+% 函数变体
+\cs_generate_variant:Nn \__suanpan_dispose_bid:nn {xx}
+
+% 组装一个档位
+% #1: 档位编号(基于1,从左向右计数)
+% #2: 档位数字
+\cs_new:Npn \__suanpan_assemble_rod:nn #1#2
+  {
+    % 取得档位数字对应算珠位置及内珠/外珠编号
+    \prop_get:NnN \l__suanpan_rods_val_prop { #2 } \l_tmpa_tl
+    \clist_clear:N \l__suanpan_bids_pos_clist
+    \clist_set:NV \l__suanpan_bids_pos_clist \l_tmpa_tl
+
+    % 绘制
+    \draw_scope_begin:
+      % 水平方向偏移
+      \draw_transform_xshift:n { \l__suanpan_support_d_dim * (#1 - 1) }
+
+      % 档杆
+      \draw_coffin_use:Nnnn \l__suanpan_support_coffin
+        { hc } { vc } { 0pt, -\l__suanpan_support_y_offset_dim }
+
+      % 算珠
+      \clist_map_inline:Nn \l__suanpan_bids_pos_clist
+        {
+          \clist_set:Nn \l_tmpa_clist { ##1 }
+          \__suanpan_dispose_bid:xx { \clist_item:Nn \l_tmpa_clist { 1 } }
+                                   { \clist_item:Nn \l_tmpa_clist { 2 } }
+        }
+    \draw_scope_end:
+  }
+
+% 指定一个档上某个算珠的颜色
+% #1: 档位编号(从左向右)
+% #2: 算珠位置([1, 11])
+\cs_new:Npn \__suanpan_float_bid:nn #1#2
+  {
+    \draw_scope_begin:
+      % 水平偏移
+      \draw_transform_xshift:n { \l__suanpan_support_d_dim * ( #1 - 1 ) }
+
+      % 空白支杆(宽度尺寸占位)
+      \draw_coffin_use:Nnnn \l__suanpan_empty_support_coffin
+        { hc } { vc } { 0pt, -\l__suanpan_support_y_offset_dim }
+
+      % 覆盖绘制
+      \__suanpan_dispose_bid:xx { #2 }{ 2 }
+    \draw_scope_end:
+  }
+
+% 绘制左右边框
+% #1 第一档编号(左)
+% #2 最后一档编号(右)
+\cs_new:Npn \__suanpan_left_right_frame:nn #1#2
+  {
+    % 绘制左边框
+    \draw_scope_begin:
+      \color_stroke:n { framecolor }
+      \draw_linewidth:n { \l__suanpan_frame_inner_linewidth_dim }
+      \draw_transform_xshift:n { \l__suanpan_support_d_dim * (#1 - 1) }
+
+      % 内线
+      \draw_path_moveto:n { -\l__suanpan_support_d_half_dim,
+                             \l__suanpan_frame_inner_upper_dim }
+      \draw_path_lineto:n { -\l__suanpan_support_d_half_dim,
+                             \l__suanpan_frame_inner_lower_dim }
+      \draw_path_use_clear:n { stroke}
+
+      % 外线
+      \draw_linewidth:n { \l__suanpan_frame_outer_linewidth_dim }
+      \draw_path_corner_arc:nn { \l__suanpan_frame_outer_arc_dim }
+                               { \l__suanpan_frame_outer_arc_dim }
+      \draw_path_moveto:n { -\l__suanpan_support_d_half_dim,
+                             \l__suanpan_frame_outer_upper_dim }
+      \draw_path_lineto:n { -\l__suanpan_frame_outer_lr_offset_dim,
+                             \l__suanpan_frame_outer_upper_dim }
+      \draw_path_lineto:n { -\l__suanpan_frame_outer_lr_offset_dim,
+                             \l__suanpan_frame_outer_lower_dim }
+      \draw_path_lineto:n { -\l__suanpan_support_d_half_dim,
+                             \l__suanpan_frame_outer_lower_dim }
+      \draw_path_use_clear:n { stroke}
+    \draw_scope_end:
+
+    % 绘制右边框
+    \draw_scope_begin:
+      \color_stroke:n { framecolor }
+      \draw_linewidth:n { \l__suanpan_frame_inner_linewidth_dim }
+      \draw_transform_xshift:n { \l__suanpan_support_d_dim * (#2 - 1) }
+
+      % 内线
+      \draw_path_moveto:n { \l__suanpan_support_d_half_dim,
+                            \l__suanpan_frame_inner_upper_dim }
+      \draw_path_lineto:n { \l__suanpan_support_d_half_dim,
+                            \l__suanpan_frame_inner_lower_dim }
+      \draw_path_use_clear:n { stroke}
+
+      % 外线
+      \draw_linewidth:n { \l__suanpan_frame_outer_linewidth_dim }
+      \draw_path_corner_arc:nn { \l__suanpan_frame_outer_arc_dim }
+                               { \l__suanpan_frame_outer_arc_dim }
+      \draw_path_moveto:n { \l__suanpan_support_d_half_dim,
+                            \l__suanpan_frame_outer_upper_dim }
+      \draw_path_lineto:n { \l__suanpan_frame_outer_lr_offset_dim,
+                            \l__suanpan_frame_outer_upper_dim }
+      \draw_path_lineto:n { \l__suanpan_frame_outer_lr_offset_dim,
+                            \l__suanpan_frame_outer_lower_dim }
+      \draw_path_lineto:n { \l__suanpan_support_d_half_dim,
+                            \l__suanpan_frame_outer_lower_dim }
+      \draw_path_use_clear:n { stroke}
+    \draw_scope_end:
+  }
+
+% 算盘排版用户接口
+% 算盘排版环境
+% #1 suanpan环境选项
+% #2 suanpan环境内容(!b参数)
+\NewDocumentEnvironment{ suanpan }{ o !b }
+  {
+    \group_begin:
+      % 设置选项
+      \IfNoValueF{ #1 }
+        {
+          \keys_set:nn { suanpan }{ #1 }
+        }
+
+      % 构造基础容器(盒子)
+      \__suanpan_inner_bid_construct:
+      \__suanpan_outer_bid_construct:
+      \__suanpan_support_construct:
+      \__suanpan_empty_support_construct:
+
+      % 删除#2(!b)参数取得的环境内容中的空白
+      \str_set:Nn \l_tmpa_str { #2 }
+      \str_remove_all:Nn \l_tmpa_str {~}
+      % 将str还原为tl
+      \tl_set_rescan:Nno \l_tmpa_tl {}{ \l_tmpa_str }
+
+      % 在容器(盒子)中用#2(!b)参数取得的按环境内容实现绘制
+      \hcoffin_set:Nn \l_tmpa_coffin
+        {
+          \draw_begin:
+            \l_tmpa_tl
+          \draw_end:
+        }
+
+      % TODO: 需要增加组装档位数字标记功能
+      \hcoffin_set:Nn \l_tmpb_coffin
+        {
+          % 将原图缩小50%
+          \coffin_scale:Nnn \l_tmpa_coffin { 0.50 } { 0.50 }
+          \coffin_typeset:Nnnnn \l_tmpa_coffin{ l }{ b }{ 0pt }{ 0pt }
+        }
+  }{
+      % 按用户指定比例缩放
+      \coffin_scale:Nnn \l_tmpb_coffin
+        { \l__suanpan_scale_tl } { \l__suanpan_scale_tl }
+
+      % 设置基字符盒子(排版深度)
+      \hbox_set:Nn \l_tmpa_box { x }
+      % 盒子深度
+      \dim_set:Nn \l_tmpa_dim { \box_dp:N \l_tmpa_box}
+
+      % 输出算盘容器(盒子)
+      \coffin_typeset:Nnnnn \l_tmpb_coffin{ l }{ b }{ 0pt }{ -\l_tmpa_dim }
+      \int_zero:N \l__suanpan_rod_max_int
+    \group_end:
+  }
+
+% 排版算盘一个档位,包括档杆和算珠
+% #1 星号命令,绘制计位点(黑色圆点)
+% #2 档位编号(基于1,从左向右计数)
+% #3 本档数字(0-20,10-15需用到顶珠和底珠,16-20需要用到悬珠)
+% TODO: 会比加了浮珠后的水平尺寸大,未找到原因
+\NewDocumentCommand{ \rod }{ s m m }
+  {
+    % 记录原状态变量
+    \bool_set_eq:NN \l_tmpa_bool \l__suanpan_support_unit_bool
+    % 星号命令,用于在横梁绘制计位点
+    \IfBooleanTF{#1}
+      {
+        \bool_set_true:N \l__suanpan_support_unit_bool
+      }{
+        \bool_set_false:N \l__suanpan_support_unit_bool
+      }
+
+    % 如状态发生改变,则重新绘制档杆单元
+    \bool_if:NTF \l_tmpa_bool
+      {
+        \bool_if:NF \l__suanpan_support_unit_bool
+          {
+            \__suanpan_support_construct:
+          }
+      }{
+        \bool_if:NT \l__suanpan_support_unit_bool
+          {
+            \__suanpan_support_construct:
+          }
+      }
+
+    % 统计档位总数
+    \int_set:Nn \l__suanpan_rod_max_int
+      { \int_max:nn { \l__suanpan_rod_max_int }{ #2 } }
+
+    % 组装一个档位
+    \__suanpan_assemble_rod:nn { #2 }{ #3 }
+  }
+
+% 排版算盘多个档位,包括档杆和算珠
+% #1 本档数字(0-20,10-15需用到顶珠和底珠,16-20需要用到悬珠)
+%    各数字之间需要用逗号分隔。
+\NewDocumentCommand{ \rods }{ m }
+  {
+    % 构造档位数字列表
+    \clist_set:Nn \l_tmpa_clist { #1 }
+    % 初始化档位计数器
+    \int_set:Nn \l_tmpa_int { 0 }
+
+    \clist_map_inline:Nn \l_tmpa_clist
+      {
+        % 档位计数器自增1
+        \int_incr:N \l_tmpa_int
+
+        % 组装当前档位
+        \__suanpan_assemble_rod:nn {\l_tmpa_int }{ ##1 }
+      }
+
+    % 记录档位总数
+    \int_set:Nn \l__suanpan_rod_max_int
+      { \int_max:nn { \l__suanpan_rod_max_int }{ \l_tmpa_int } }
+  }
+
+% 指定某档上某个算珠的颜色
+% #1 档位(基于1,从左向右计数)
+% #2 算珠位置(1--11,11为悬珠位置)
+% #3 算珠填充颜色(绘图颜色将添加40%的黑色)
+\NewDocumentCommand{ \bid }{ m m m }
+  {
+    % 构造浮珠
+    \__suanpan_float_bid_construct:nn { #3!60!black }{ #3 }
+
+    % 绘制浮珠
+    \__suanpan_float_bid:nn { #1 }{ #2 }
+
+    % 如不是最后一个档位,则添加一个额外空白档杆以实现水平尺寸占位
+    \int_compare:nNnT { #1 } < { \l__suanpan_rod_max_int }
+      {
+        \draw_scope_begin:
+          % 水平偏移
+          \draw_transform_xshift:n { \l__suanpan_support_d_dim *
+                                   ( \l__suanpan_rod_max_int - 1 ) }
+
+          % 空白支杆(水平尺寸占位)
+          \draw_coffin_use:Nnnn \l__suanpan_empty_support_coffin
+            { hc } { vc } { 0pt, -\l__suanpan_support_y_offset_dim }
+        \draw_scope_end:
+      }
+  }
+
+% 指定某档上所有内珠或外珠的颜色
+% #1 星号命令,选择内珠或外珠
+% #2 档位(基于1,从左向右计数)
+% #3 该档数字
+% #4 算珠填充颜色(绘图颜色将添加40%的黑色)
+\NewDocumentCommand{ \bids }{ s m m m }
+  {
+    % 构造浮珠
+    \__suanpan_float_bid_construct:nn { #4!60!black }{ #4 }
+
+    % 取得档位数字对应算珠位置及内珠/外珠编号
+    \prop_get:NnN \l__suanpan_rods_val_prop { #3 } \l_tmpa_tl
+    \clist_clear:N \l__suanpan_bids_pos_clist
+    \clist_set:NV \l__suanpan_bids_pos_clist \l_tmpa_tl
+
+    % 星号命令,用于选择外珠着色
+    \IfBooleanTF{#1}
+      {
+        \clist_map_inline:Nn \l__suanpan_bids_pos_clist
+          {
+            \clist_set:Nn \l_tmpa_clist { ##1 }
+            % 选择外珠
+            \int_compare:nNnT { \clist_item:Nn \l_tmpa_clist { 2 }  } = { 0 }
+              {
+                \__suanpan_float_bid:nn { #2 }{ \clist_item:Nn \l_tmpa_clist { 1 } }
+              }
+          }
+      }{
+        \clist_map_inline:Nn \l__suanpan_bids_pos_clist
+          {
+            \clist_set:Nn \l_tmpa_clist { ##1 }
+            % 选择内珠
+            \int_compare:nNnT { \clist_item:Nn \l_tmpa_clist { 2 }  } = { 1 }
+              {
+                \__suanpan_float_bid:nn { #2 }{ \clist_item:Nn \l_tmpa_clist { 1 } }
+              }
+          }
+      }
+
+    % 如不是最后一个档位,则添加一个额外空白档杆以实现水平尺寸占位
+    \int_compare:nNnT { #1 } < { \l__suanpan_rod_max_int }
+      {
+        \draw_scope_begin:
+          % 水平偏移
+          \draw_transform_xshift:n { \l__suanpan_support_d_dim *
+                                   ( \l__suanpan_rod_max_int - 1 ) }
+
+          % 空白支杆(水平尺寸占位)
+          \draw_coffin_use:Nnnn \l__suanpan_empty_support_coffin
+            { hc } { vc } { 0pt, -\l__suanpan_support_y_offset_dim }
+        \draw_scope_end:
+      }
+  }
+
+% 左右边框
+% #1 左边第一个档位(基于1,从左向右计数)
+% #2 右边最后一个档位(基于1,从左向右计数)
+\NewDocumentCommand{ \lrframe }{ m m }
+  {
+    \__suanpan_left_right_frame:nn { #1 }{ #2 }
+  }
+
+% 选项设置用户接口
+\NewDocumentCommand \suanpanset { m }
+  {
+    \IfNoValueF { #1}
+      {
+        \keys_set:nn { suanpan } { #1 }
+      }
+  }
+
+\endinput


Property changes on: trunk/Master/texmf-dist/tex/latex/suanpan-l3/suanpan-l3.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2024-08-29 20:32:56 UTC (rev 72135)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2024-08-29 20:38:29 UTC (rev 72136)
@@ -802,7 +802,7 @@
     stickstoo stix stix2-otf stix2-type1 stmaryrd storebox storecmd
     strands stricttex string-diagrams stringenc stringstrings
     structmech struktex
-    sttools stubs studenthandouts sty2dtx styledcmd suanpan
+    sttools stubs studenthandouts sty2dtx styledcmd suanpan suanpan-l3
     subdocs subdepth subeqn subeqnarray
     subfig subfigmat subfigure subfiles subfloat substances
     substr subsupscripts subtext

Modified: trunk/Master/tlpkg/tlpsrc/collection-langchinese.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-langchinese.tlpsrc	2024-08-29 20:32:56 UTC (rev 72135)
+++ trunk/Master/tlpkg/tlpsrc/collection-langchinese.tlpsrc	2024-08-29 20:38:29 UTC (rev 72136)
@@ -26,6 +26,7 @@
 depend pgfornament-han
 depend qyxf-book
 depend sjtutex
+depend suanpan-l3
 depend texlive-zh-cn
 depend texproposal
 depend tlmgr-intro-zh-cn

Added: trunk/Master/tlpkg/tlpsrc/suanpan-l3.tlpsrc
===================================================================


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