summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/easybook/README.md2
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx34
-rw-r--r--macros/latex/contrib/easybook/easybook.pdfbin591334 -> 588865 bytes
-rw-r--r--macros/latex/contrib/easybook/easybook.tex121
-rw-r--r--macros/latex/contrib/iexec/iexec.dtx61
-rw-r--r--macros/latex/contrib/iexec/iexec.pdfbin293663 -> 293865 bytes
-rw-r--r--macros/latex/contrib/spbmark/README.md2
-rw-r--r--macros/latex/contrib/spbmark/spbmark.pdfbin84970 -> 84938 bytes
-rw-r--r--macros/latex/contrib/spbmark/spbmark.sty2
-rw-r--r--macros/latex/contrib/spbmark/spbmark.tex6
-rw-r--r--macros/luatex/generic/penlight/penlight.pdfbin38483 -> 42045 bytes
-rw-r--r--macros/luatex/generic/penlight/penlight.sty26
-rw-r--r--macros/luatex/generic/penlight/penlight.tex52
-rw-r--r--macros/luatex/generic/penlight/penlightextras.lua75
14 files changed, 258 insertions, 123 deletions
diff --git a/macros/latex/contrib/easybook/README.md b/macros/latex/contrib/easybook/README.md
index 6534037fd7..a25e5c1761 100644
--- a/macros/latex/contrib/easybook/README.md
+++ b/macros/latex/contrib/easybook/README.md
@@ -8,4 +8,4 @@ This work may be distributed and/or modified under the conditions of the LPPL-1.
## Website
-| [Gitee](https://gitee.com/texl3/easybook) | [Github](https://github.com/texl3/easybook) | [CTAN](https://ctan.org/pkg/easybook) | \ No newline at end of file
+| [Gitee](https://gitee.com/texno3/easybook) | [Github](https://github.com/texno3/easybook) | [CTAN](https://ctan.org/pkg/easybook) | \ No newline at end of file
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index ee55f696dd..fa2ddd5abe 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -15,7 +15,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2022/08/12}{1.70}
+\ProvidesExplClass{easybook}{2022/10/15}{1.71}
{Easily typesetting Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -303,7 +303,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2022/08/12}{1.70}
+\ProvidesExplPackage{easybase}{2022/10/15}{1.71}
{Easily typesetting Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -2333,7 +2333,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2022/08/12}{1.70}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2022/10/15}{1.71}
{Customization of tcolorbox for easybook}
\cs_set_protected:Npn \addtotcbstyle #1#2
@@ -2343,7 +2343,7 @@
\cs_new_protected:Npn \tcbappstyle
{ \@ifstar{\deftcbstyle}{\addtotcbstyle} }
-\deftcbstyle{tc-easybox}
+\deftcbstyle{tc-easyboxi}
{
enhanced~jigsaw,
center~title,
@@ -2355,7 +2355,7 @@
titlerule = 0pt,
beforeafter~skip = 0.5\baselineskip
}
-\deftcbstyle{tc-ebparbox}
+\deftcbstyle{tc-easyboxii}
{
enhanced~jigsaw,
frame~hidden,boxrule = 0pt,
@@ -2363,8 +2363,8 @@
middle = 0.5\baselineskip,bottomtitle = 0.5\baselineskip,
beforeafter~skip = 0.5\baselineskip
}
-\deftcbstyle{tc-ebemph}{on~line,blank}
-\deftcbstyle{tc-ebfbox}
+\deftcbstyle{tc-eboxi}{on~line,blank}
+\deftcbstyle{tc-eboxii}
{
standard~jigsaw,on~line,
top = 3pt,bottom = 3pt,left = 3pt,right = 3pt,
@@ -2381,14 +2381,14 @@
boxrule = 0.5pt
}
-\DeclareTColorBox{easybox}{sO{LemonChiffon}d()O{}}
+\DeclareTColorBox{easyboxi}{sO{LemonChiffon}d()O{}}
{
IfBooleanF = {#1}{frame~hidden,boxrule = 0pt},
IfValueT = {#3}{title = #3},
colback = #2,colbacktitle = #2,
- tc-easybox,#4
+ tc-easyboxi,#4
}
-\DeclareTColorBox{ebparbox}{sO{RoyalBlue}D(){}O{}}
+\DeclareTColorBox{easyboxii}{sO{RoyalBlue}D(){}O{}}
{
borderline~west = {3pt}{0pt}{#2},
IfBooleanTF = {#1}
@@ -2405,16 +2405,16 @@
right = 8pt
},
title = #3,coltitle = #2,
- tc-ebparbox,#4
+ tc-easyboxii,#4
}
-\DeclareTotalTCBox{\ebfbox}{O{Green}mO{}}
+\DeclareTotalTCBox{\eboxi}{O{Yellow}mO{}}
{
- colback = #1,colframe = #1,
- tc-ebfbox,#3
+ fuzzy~halo = 2pt~with~#1,
+ tc-eboxi,#3
}{#2}
-\DeclareTotalTCBox{\ebemph}{O{Yellow}mO{}}
+\DeclareTotalTCBox{\eboxii}{O{Green}mO{}}
{
- fuzzy~halo = 2pt~with~#1,
- tc-ebemph,#3
+ colback = #1,colframe = #1,
+ tc-eboxii,#3
}{#2}
%</tcolorbox> \ No newline at end of file
diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf
index c5fece6af0..127c268d2a 100644
--- a/macros/latex/contrib/easybook/easybook.pdf
+++ b/macros/latex/contrib/easybook/easybook.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex
index e20dc7f0ab..e40bd1ed4c 100644
--- a/macros/latex/contrib/easybook/easybook.tex
+++ b/macros/latex/contrib/easybook/easybook.tex
@@ -9,49 +9,50 @@
}
\definecolorscheme{blue}
{
- cs => Plum,
- option => PineGreen,
- cnltx => Blue,
- link => OrangeRed,
- module => Brown,
- meta => black
+ cs => Plum,
+ option => PineGreen,
+ cnltx => RoyalBlue,
+ link => OrangeRed,
+ module => YellowOrange,
+ meta => black,
+ versionnote => black
}
\setcnltx
{
name = easybook,
color-scheme = blue,
title = EASYBOOK使用手册,
- version = v1.70,
- date = 2022/08/12,
+ version = v1.71,
+ date = 2022/10/15,
authors = 瞿毅,
info = 简便地排版中文学位论文或书籍,
email = toquyi@163.com,
- url = https://gitee.com/texl3/easybook,
+ url = https://gitee.com/texno3/easybook,
abstract =
{
\cls*{easybook} 是基于 \cls*{ctexbook} 书籍文档类创建的纯净学术模板,同时兼具 \cls*{book} 与 \cls*{article} 文档类的功能。结合中国许多高校学位论文的通用框架设计,提供多个命令和接口可以使用户简便地定制论文模板。它的基础宏包 \pkg*{easybase} 还可以搭配 \CTeX 和标准文档类使用。
},
- arg-format = \normalfont\small\itshape,
+ arg-format = \normalfont\small\itshape\xeCJKVerbAddon,
abstract-format = \small,
module-sep = \,\raisebox{-1pt}{\ding{224}}\,,
title-format = \huge\sffamily
}
-\KOMAoptions{headsepline = 0.5pt,numbers = noenddot}
+\KOMAoptions{numbers = noenddot}
\setfootnoterule[0.5pt]{0.4\columnwidth}
-\addtokomafont{headsepline}{\color{Blue}}
-\addtokomafont{footnoterule}{\color{Blue}}
+\addtokomafont{headsepline}{\color{RoyalBlue}}
+\addtokomafont{footnoterule}{\color{RoyalBlue}}
\addtokomafont{section}{\normalfont\sffamily}
\addtokomafont{subsection}{\normalfont\sffamily}
\addtokomafont{subsubsection}{\normalfont\sffamily}
\DeclareTOCStyleEntry[entryformat = \sffamily]{default}{section}
\DeclareFieldFormat[book]{title}{\textsf{#1}}
-\geometry{margin = 1in,marginparwidth = 0.65in}
-\SetEnumitemValue{label}{smallbullet}{\small\color{Blue}\textbullet}
+\geometry{margin = 1in,marginparwidth = 0.6in}
+\SetEnumitemValue{label}{smallbullet}{\small\color{RoyalBlue}\textbullet}
\setlist{nosep,topsep = \smallskipamount,labelsep = 0.5em}
\setlist[1]{labelindent = \parindent}
\setlist[itemize,1]{label = smallbullet,leftmargin = *}
\setcounter{tocdepth}{2}
-\SetTblrInner{hline{1,Z} = {0.8pt,Blue}}
+\SetTblrInner{hline{1,Z} = {0.8pt,RoyalBlue}}
\ExplSyntaxOn\makeatletter
% * Do not add entries to the index
@@ -104,9 +105,9 @@
\endgroup
\IfBooleanF{#1}{\cnltx@checkdefault{\hfill\newline}}
}
-\newnote{\newtag}[1][New]{\textcolor{red}{\fbox{#1}}}
+\newnote{\newtag}[1][New]{\fbox{#1}}
% Use a separate module margin marker to prevent overlap
-\newcommand{\smodule}{\cnltx@module@text{}}
+\newcommand{\smodule}[1]{\cnltx@module@text*{\normalsize #1}}
\newcommand{\noitemsep}{\setlength{\itemsep}{0ex}}
\newcommand{\insertblr}[2]
{
@@ -138,7 +139,7 @@
baselinestretch = 1.2,
gobble = 2,
fontsize = \small,
- rulecolor = \color{Blue},
+ rulecolor = \color{RoyalBlue},
framerule = 0.5pt,
frame = single,
framesep = 10pt
@@ -286,7 +287,7 @@
\insertblr
{
colspec = @{}*{4}{c}@{},
- hline{2} = {0.5pt,Blue},
+ hline{2} = {0.5pt,RoyalBlue},
row{1} = {font = \sffamily},
column{1} = {cmd = \code}
}{
@@ -323,7 +324,7 @@
\insertblr
{
colspec = @{}*{5}{c}@{},
- hline{3} = {0.5pt,Blue},
+ hline{3} = {0.5pt,RoyalBlue},
row{1,3} = {font = \sffamily,belowsep = 0pt},
row{2,4} = {cmd = \module*}
}{
@@ -350,13 +351,13 @@
文档类有三种选项:布尔型 \boolkey*{key},选项的值为真 \code{true} 或假 \code{false},如果不指定默认为真。键值型 \key*{key}{value} 需要为选项指定值,后面 \code{=} 号不能省略。选择型 \choicekey*{key}{one,\default{two},three} 根据提供的可选值进行设定。
\end{commands}
-\subsection{风格}
+\subsection[风格]{风格\smodule{style}}
\label{subsec:style}
\begin{options}
- \keychoice{color}{none,seaside,energy,cyberpunk}\Module{style}\Default{none}
+ \keychoice{color}{none,seaside,energy,cyberpunk}\Default{none}
预置了四种颜色主题,默认主题 \code{none} 为黑白页面,颜色主题不包括超链接。
\begin{commands}
- \command{DeclareThemeColor}[\splitmarg{风格名称,ctex@frame,ctex@emph,ctex@verb}]
+ \command{DeclareThemeColor}[\splitmarg{风格名称,颜色1,颜色2,颜色3}]
声明新的颜色主题命令。它的参数以英文逗号分隔,第一部分为颜色风格名称,后面三部分为 \code{HTML} 颜色代码,构成主题颜色列表。类似地更改超链接颜色见\ref{subsec:hyperlinks}。
\end{commands}
\keyval{color-every}{HTML颜色代码}
@@ -422,16 +423,16 @@
上下标命令 \cs{supersub} 对应的上下标水平对齐方式,有左 \code{l}、居中 \code{c} 和右 \code{r} 三种对齐方式。
\end{options}
-\subsection{超链接}
+\subsection[超链接]{超链接\smodule{refset}}
\label{subsec:hyperlinks}
模块 \module*{refset} 将超链接选项交给 \pkg*{hyperref} 宏包处理。除了一些超链接颜色的选项失效,其它由宏包全局和接口命令 \cs*{hypersetup} 支持的多数选项可用。
\begin{options}
- \keychoice{linktype}{edge,colors,none}\Module{refset}\Default{edge}
+ \keychoice{linktype}{edge,colors,none}\Default{edge}
超链接类型。\code{edge} 使超链接形式为边框,\code{colors} 使超链接字体为彩色,\code{none} 关闭超链接边框与颜色,此时 \option{linkcolor} 选项无效。
\keychoice{linkcolor}{fresh,cutepink,navyblue,crimson}\Default{navyblue}
超链接颜色样式。预置了四种超链接颜色风格。为使相关颜色能够正确显示,选项 \option{linkcolor} 应当在 \option{linktype} 前使用。
\begin{commands}
- \command{DeclareLinkColor}[\splitmarg{风格名称,ctex@link,ctex@url,ctex@cite}]
+ \command{DeclareLinkColor}[\splitmarg{风格名称,颜色1,颜色2,颜色3}]
声明新的超链接颜色样式命令。它的参数以英文逗号分隔,第一部分为颜色风格名称,后面三部分为 \code{HTML} 颜色代码,构成超链接颜色列表。
\end{commands}
\keyval{linkcolor-every}{HTML颜色代码}
@@ -440,11 +441,11 @@
将目录中的超链接取消、置于标题上、置于页码上或置于标题和页码上。
\end{options}
-\subsection{行距}
+\subsection[行距]{行距\smodule{spread}}
\label{subsec:spacing}
行距因子用于设置各种行距倍数,\meta{数值} 是不带有长度单位的浮点数。各类行距既可以在导言区全局设置,也可以在正文中设置对后面生效。
\begin{options}
- \keyval{line}{数值}\Module{spread}
+ \keyval{line}{数值}
正文行距因子。行距因子初始值为 \code{1.354}(相当于 \textsf{Word} 的1.25倍行距),如果设置了文类或 \pkg*{ctex} 宏包的全局行距选项 \option*{linespread} 则初始值设为它的值。
\keyval{table}{数值}\Default{1.354}
表格内容行距因子。对传统表格 \env*{tabular} 和 \env*{tabularx} 等环境以及 \pkg*{tabularray} 宏包的 \env{tblr} 环境生效,同时 \env{tblr} 也自带有 \option*{stretch} 选项设置行距系数。
@@ -468,10 +469,10 @@
统一设置上述所有的行距因子。
\end{options}
-\subsection{其它字体}
+\subsection[其它字体]{其它字体\smodule{subfont}}
\label{subsec:other font}
\begin{options}
- \keyval{caption-table}{字体命令}\Module{subfont}\Default{\cs*{sffamily}\cs*{small}}
+ \keyval{caption-table}{字体命令}\Default{\cs*{sffamily}\cs*{small}}
设置表格题注的字体,包括字体族、字体系列、字体尺寸和字体形状命令。
\keyval{caption-figure}{字体命令}\Default{\cs*{sffamily}\cs*{small}}
设置图片题注的字体,包括字体族、字体系列、字体尺寸和字体形状命令。
@@ -494,10 +495,10 @@
\end{ctexexam}
\end{commands}
-\subsection{参考文献}
+\subsection[参考文献]{参考文献\smodule{bibset}}
\label{subsec:reference}
\begin{options}
- \keychoice{backend}{bibtex,biblatex}\Module{bibset}\Default{bibtex}
+ \keychoice{backend}{bibtex,biblatex}\Default{bibtex}
参考文献处理后端。默认用传统的 \hologo{BibTeX} 处理参考文献\footnote{使用 \hologo{BibTeX} 引擎时加载 \pkg*{natbib} 宏包,使用 \hologo{biber} 时将加载 \pkg*{biblatex} 宏包。}。
\keychoice{bibstyle}{numerical,authoryear,other sty}\Default{numerical}
参考文献格式使用中国参考文献推荐标准GB/T 7714-2015,对应顺序编码制和著者—出版年制两种风格。若使用其它格式,使用 \hologo{BibTeX} 处理时需确保正确的 \code{bst} 文件,使用 \hologo{biber} 处理可使用 \pkg*{biblatex} 宏包支持的参考文献风格名称。
@@ -537,11 +538,11 @@
\end{ctexexam}
\end{options}
-\subsection{定理样式}
+\subsection[定理样式]{定理样式\smodule{thmset}}
\label{subsec:theorem of style}
模块 \module*{thmset} 由 \pkg*{thmtools} 宏包提供支持,主要提供了定理声明和样式声明两个命令。定理声明命令使用的定理样式由样式声明命令提供,文档类预置了一个定理样式 \code{fancy}。
\begin{commands}
- \command{declaretheorem}[\oarg{键值列表1}\marg{环境名}\oarg{键值列表2}]\Module{thmset}
+ \command{declaretheorem}[\oarg{键值列表1}\marg{环境名}\oarg{键值列表2}]
定理环境声明命令。可选参数的 \meta{键值列表1} 与 \meta{键值列表2} 等效,其中常用的选项如下:
\begin{options}
\keyval*{name}{定理名}
@@ -555,11 +556,11 @@
\keyval*{style}{定理样式}
选项的值为使用 \cs{declaretheoremstyle} 命令新定义的定理样式。
- 使用 \cs{declaretheorem} 命令以\ref{exam:new theorem sty} 中的定理样式 \code{fancy} 新建一个定理环境猜想,然后用一个基于 \pkg*{tcolorbox} 宏包的预置彩色盒子 \env{easybox} 增加背景:
+ 使用 \cs{declaretheorem} 命令以\ref{exam:new theorem sty} 中的定理样式 \code{fancy} 新建一个定理环境猜想,然后用一个基于 \pkg*{tcolorbox} 宏包的预置彩色盒子 \env{easyboxi} 增加背景:
\begin{ctexexam}[labelref = exam:new theorem env]
\declaretheorem[style = fancy,name = 猜想]{caixiang}
- \addtotcbstyle{tc-easybox}{colback = GreenYellow}
- \tcolorboxenvironment{caixiang}{tc-easybox}
+ \addtotcbstyle{tc-easyboxi}{colback = GreenYellow}
+ \tcolorboxenvironment{caixiang}{tc-easyboxi}
\end{ctexexam}
\end{options}
\command{declaretheoremstyle}[\oarg{键值列表1}\marg{定理样式}\oarg{键值列表2}]
@@ -603,11 +604,11 @@
\end{ctexexam}
\end{commands}
-\subsection{页面尺寸}
+\subsection[页面尺寸]{页面尺寸\smodule{geoset}}
\label{subsec:page margins}
模块 \module*{geoset} 会将除了前两个附加的选项交给页面尺寸宏包 \pkg*{geometry} 处理,并且支持它的键值列表,预置的页面尺寸与 \textsf{Word} 的默认值接近。下面列举几种代表性选项,其它选项可查阅宏包帮助文档。当在此设置纸张规格时,会覆盖文类选项 \option{paper} 的设置。
\begin{options}\noitemsep
- \keyval{headruleskip}{页眉线间距}\Module{geoset}\Default*{0pt}
+ \keyval{headruleskip}{页眉线间距}\Default*{0pt}
\keyval{footruleskip}{页脚线间距}\Default*{3.5pt}
\kvsplit*{hdivide}{左边距,页面文本宽度,右边距}\default{}
\kvsplit*{hmargin}{左边距,右边距}\default{}
@@ -624,11 +625,11 @@
\end{ctexexam}
\end{options}
-\subsection{页眉页脚}
+\subsection[页眉页脚]{页眉页脚\smodule{hdrset}}
\label{subsec:header and footer}
模块 \module*{hdrset} 设置的命令由 \pkg*{fancyhdr} 宏包提供支持。标题标记由标签和标题组成,选项中参数 \code{\#1} 代表当前章、节或小节的标题。在 \cls*{book} 模式时使用标题标记选项 \option{chap-mark} 和 \option{sec-mark},在 \cls*{article} 模式时使用 \option{sec-mark} 和 \option{subsec-mark} 选项,这与标准文档类的行为一致。重新设置标题标记选项时标记大小写选项 \option{uppercase} 会失效。
\begin{options}
- \keyval{chap-mark}{标题标记}\Module{hdrset}
+ \keyval{chap-mark}{标题标记}
标题标记命令 \cs*{chaptermark} 的内容,包括了标签选项 \option{chap-label} 的内容。
\keyval{sec-mark}{标题标记}
标题标记命令 \cs*{sectionmark} 的内容,包括了标签选项 \option{sec-label} 的内容。
@@ -683,10 +684,10 @@
\end{ctexexam}
\end{commands}
-\subsection{脚注格式}
+\subsection[脚注格式]{脚注格式\smodule{hdrset}}
模块 \module*{hdrset} 还可以灵活调整脚注编号和内容的格式。格式主要包括脚注标记的编号类型、字体、附加符号和对齐方式等,以及脚注内容的首行缩进、行距和字体等。基本思想是默认脚注和自定义编号脚注标记的格式分离,两种类型脚注各自正文和内容的标记又共享格式,默认脚注中正文和内容标记的编号类型分离。目前脚注模块基本兼容 \pkg*{footmisc} 宏包。
\begin{options}
- \keychoice{footnotetype}{plain,hang,flush,bottom}\Module{hdrset}\Default{hang}
+ \keychoice{footnotetype}{plain,hang,flush,bottom}\Default{hang}
脚注的类型。悬挂缩进 \code{hang} 是默认值,\code{plain} 是原始的类型,\code{flush} 使脚注内容标记位于脚注首行边缘外侧并右对齐。当存在浮动环境排版时,脚注可能位于页面中间,\code{bottom} 使脚注始终位于页面底端。其中 \code{bottom} 是复合选项,可以与前三种类型重复或复合使用:
\begin{ctexexam}
\ebhdrset{footnotetype = plain,footnotetype = bottom}
@@ -785,11 +786,11 @@
\end{ctexexam}
\end{options}
-\subsection{目录样式}
+\subsection[目录样式]{目录样式\smodule{tocset}}
\label{subsec:catalog style}
模块 \module*{tocset} 将使用 \pkg*{titletoc} 宏包处理目录样式。默认包括 \module*{part}、\module*{chapter}、\module*{section}、\module*{subsection}、\module*{figure}、\module*{table} 和 \module*{lstlisting} 二级路径,而使用 \module*{float} 路径可以统一设置图片、表格和代码目录的样式。选项前带有 \ding{73} 符号表示支持所有相应\textbf{条目名}的路径,其它选项则处于 \module*{tocset} 一级路径下。目前支持标准的论文目录样式,更复杂的样式可以查看 \pkg*{titletoc} 的相关用法。
\begin{options}
- \keyval{tocformat}{条目格式}\dtag\smodule{tocset}%
+ \keyval{tocformat}{条目格式}\dtag
目录中各级别条目的格式。可以设置条目字体和加入垂直间距等,垂直间距最好使用防止垂直间距重合的 \cs*{addvspace} 命令。
\keyval{tocformat+}{条目格式}\dtag
与选项 \option{tocformat} 用法一样,只是在已有的格式命令后附加代码。
@@ -926,7 +927,7 @@
\end{options}
\end{commands}
-\subsection{双语标题}
+\subsection[双语标题]{双语标题\smodule{chapter}}
双语目录标题命令目前设置了常用的三个级别,它们将中文标题正常输出,并使中英文标题加入双语目录。类似于标准文档类,这三个标题命令分别具有独立的计数器\footnote{默认情况下与普通标题命令共享使用计数器。},并对应 \cs*{the}\meta{计数器} 的值,可以用于 \option{binumber} 选项更改英文目录中的编号。这个功能是为国内一些高校的学位论文模板的要求设计,在一般情况和英文模式下\textbf{不需要使用}。
\begin{commands}
\command{bichapter}[\sarg\oarg{目录中文标题}\marg{中文标题}\marg{目录英文标题}]
@@ -938,7 +939,7 @@
它们的星号变体命令使文中标题不编号,但是仍然加入双语目录,若英文标题参数空置那么仅加入中文目录而不加入英文目录,这一特点与 \cs*{chapter}\sarg{} 等命令的行为不太一样,在一些情况下会用到。可选参数是目录中的中文标题,默认与中文标题一致,正文标题过长时可用它设置在目录中显示的标题。默认情况下双语目录的格式是一致的,共享使用 \module*{tocset} 模块的设置,英文目录的章级别标题名及编号的修改方式如下:
\begin{options}
- \kvsplit{biname}{英文目录前名字,英文目录后名字}\Module{chapter}\Default{Chapter\cs*{space}}
+ \kvsplit{biname}{英文目录前名字,英文目录后名字}\Default{Chapter\cs*{space}}
更改英文目录 \code{chapter} 级别的标题编号前后名字,类似于 \CTeX 的 \option*{name} 选项。
\keyval{binmuber}{英文目录数字输出命令}\Default{\cs*{arabic}\Marg{chapter}}
更改英文目录 \code{chapter} 级别的标题编号输出格式,类似于 \CTeX 的 \option*{number} 选项。
@@ -952,7 +953,7 @@
作用于局部范围的英文目录钩子,可以插入标题或目录设置的命令改变英文目录中标题的显示格式,也可以覆盖上述的目录前后名字和编号等设置,带有星号的命令会重置之前的代码,放置在导言区或 \cs{bichapter} 等命令前生效。
\end{commands}
-\subsection{上标和下标}
+\subsection[上标和下标]{上标和下标\smodule{style}}
上标和下标的功能来自 \pkg*{spbmark} 宏包,下面有三个命令可以用于输出上标和下标。可以使用键值列表的形式对上下标格式进行局部或全局设置,下面命令中两个可选参数的键值列表是等效的。全局设置的详情见\ref{subsubsec:super-sub-script}。
\begin{commands}
\command{super}[\sarg\oarg{键值列表1}\marg{内容}\oarg{键值列表2}]
@@ -1114,25 +1115,25 @@
\end{commands}
\begin{environments}
- \environment{easybox}[\sarg\oarg{颜色名}\darg{段落标题}\oarg{配置选项}]
- 行间环境 \env{easybox} 创建一个带有三个可选参数的扁平盒子。使用星号参数时给盒子添加边框,\meta{颜色名} 选项设置背景颜色,\meta{段落标题} 选项可以设置标题,默认标题为空。
+ \environment{easyboxi}[\sarg\oarg{颜色名}\darg{段落标题}\oarg{配置选项}]
+ 行间环境 \env{easyboxi} 创建一个带有三个可选参数的扁平盒子。使用星号参数时给盒子添加边框,\meta{颜色名} 选项设置背景颜色,\meta{段落标题} 选项可以设置标题,默认标题为空。
\begin{ctexexam}
- \addtotcbstyle{tc-easybox}{arc = 6pt}
- \begin{easybox}*[DarkCyan](段落标题)
+ \addtotcbstyle{tc-easyboxi}{arc = 6pt}
+ \begin{easyboxi}*[DarkCyan](段落标题)
上半盒子内容
\tcblower % 盒子上下部分分界线
下半盒子内容
- \end{easybox}
+ \end{easyboxi}
\end{ctexexam}
- \environment{ebparbox}[\sarg\oarg{颜色名}\darg{段落标题}\oarg{配置选项}]
- 环境 \env{ebparbox} 用法与 \env{easybox} 类似,同样带有三个可选参数。盒子的左边带有一条粗竖线,背景颜色为竖线颜色的浅色。\meta{颜色名} 选项可以设置竖线的颜色。使用星号参数则盒子无背景颜色。
+ \environment{easyboxii}[\sarg\oarg{颜色名}\darg{段落标题}\oarg{配置选项}]
+ 环境 \env{easyboxii} 用法与 \env{easyboxi} 类似,同样带有三个可选参数。盒子的左边带有一条粗竖线,背景颜色为竖线颜色的浅色。\meta{颜色名} 选项可以设置竖线的颜色。使用星号参数则盒子无背景颜色。
\end{environments}
\begin{commands}
- \command{ebemph}[\oarg{颜色名}\marg{内容}\oarg{配置选项}]
- 行内盒子命令 \cs{ebemph} 具有模糊边缘类似高亮的效果。
- \command{ebfbox}[\oarg{颜色名}\marg{内容}\oarg{配置选项}]
- 行内盒子命令 \cs{ebfbox} 则有直角边缘和四周框线,效果类似带颜色的 \cs*{fbox} 盒子。
+ \command{eboxi}[\oarg{颜色名}\marg{内容}\oarg{配置选项}]
+ 行内盒子命令 \cs{eboxi} 具有模糊边缘类似高亮的效果。
+ \command{eboxii}[\oarg{颜色名}\marg{内容}\oarg{配置选项}]
+ 行内盒子命令 \cs{eboxii} 则有直角边缘和四周框线,效果类似带颜色的 \cs*{fbox} 盒子。
\end{commands}
\section{扩展功能}
diff --git a/macros/latex/contrib/iexec/iexec.dtx b/macros/latex/contrib/iexec/iexec.dtx
index 82182ba085..ff627551a5 100644
--- a/macros/latex/contrib/iexec/iexec.dtx
+++ b/macros/latex/contrib/iexec/iexec.dtx
@@ -50,7 +50,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{iexec}
%<*package>
-[2022-10-12 0.9.0 Inputable Shell Executions]
+[2022-10-15 0.9.1 Inputable Shell Executions]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -105,8 +105,7 @@ Today is
% Today is \iexec[log]{date +\%e-\%b-\%Y}
% \end{multicols}
-% \DescribeMacro{\iexec}
-% The only command provided by this package is |\iexec| \oarg{options} \marg{cmd}.
+% \DescribeMacro{\iexec} The only command provided by this package is |\iexec| \oarg{options} \marg{cmd}.
% Its only mandatory argument \meta{cmd} is the command to be executed
% through the terminal shell (bash, or whatever is set as the default one
% on your user console).
@@ -118,8 +117,7 @@ Today is
% \section{Options}
-% \DescribeMacro{quiet}
-% If you don't want the output to be visible,
+% \DescribeMacro{quiet} If you don't want the output to be visible,
% use |\phantom\{\iexec{...}}|.
% Otherwise, you can use |quiet| option:
%\iffalse
@@ -139,8 +137,7 @@ I just want to delete some file:
% In this case, whatever the shell command produces will not be included
% into the document.
-% \DescribeMacro{stdout}
-% The output of your code is saved into the file provided as an
+% \DescribeMacro{stdout} The output of your code is saved into the file provided as an
% optional argument of |\iexec| (the default value is |iexec.tmp|):
%\iffalse
%<*verb>
@@ -157,8 +154,7 @@ Today is \iexec[stdout=date.txt]{date +\%e-\%b-\%Y | tr -d '\\n'}.
%\fi
% The tailing part of the command here removes all ends-of-line.
-% \DescribeMacro{stderr}
-% The error output of the code is saved into the file provided as an
+% \DescribeMacro{stderr} The error output of the code is saved into the file provided as an
% optional argument of |\iexec| (by default the error output
% is streamed into |stdout|):
%\iffalse
@@ -175,8 +171,7 @@ Today is \iexec[stderr=my.txt]{broken-command}.
%</verb>
%\fi
-% \DescribeMacro{trace}
-% The file specified will be deleted right after its usage. If you don't
+% \DescribeMacro{trace} The file specified will be deleted right after its usage. If you don't
% want this to happen, use |trace| package option: all files will remain
% in the directory where they were created.
% It's possible to turn tracing on globbaly, for the entire document, using
@@ -195,8 +190,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
%</verb>
%\fi
-% \DescribeMacro{append}
-% The stdout produced will be appended to the file specified:
+% \DescribeMacro{append} The stdout produced will be appended to the file specified:
%\iffalse
%<*verb>
%\fi
@@ -213,8 +207,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
%</verb>
%\fi
-% \DescribeMacro{log}
-% The stdout produced will be printed in \TeX{} log:
+% \DescribeMacro{log} The stdout produced will be printed in \TeX{} log:
%\iffalse
%<*verb>
%\fi
@@ -229,8 +222,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
%</verb>
%\fi
-% \DescribeMacro{null}
-% The stdout of the command will be sent to |/dev/null|:
+% \DescribeMacro{null} The stdout of the command will be sent to |/dev/null|:
%\iffalse
%<*verb>
%\fi
@@ -258,30 +250,36 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \changes{v0.8.0}{2022/10/11}{Bug fixes}
% \changes{v0.9.0}{2022/10/12}{Additional option 'stderr'}
-% First, we include a few packages:
+% First, we include \href{https://ctan.org/pkg/shellesc}{shellesc} package, which
+% we use to execute shell commands:
% \begin{macrocode}
\RequirePackage{shellesc}
-\RequirePackage{pgfkeys}
-\RequirePackage{expl3}
% \end{macrocode}
% Then, we parse package options:
% \begin{macrocode}
\RequirePackage{xkeyval}
-\makeatletter\newif\ifiexec@trace
+\makeatletter
+\newif\ifiexec@trace
\DeclareOptionX{trace}{\iexec@tracetrue}
-\ProcessOptionsX\relax\makeatother
+\ProcessOptionsX\relax
+\makeatother
+% \end{macrocode}
+
+% Then, we prepare to parse the options of |\iexec| command:
+% \begin{macrocode}
+\RequirePackage{pgfkeys}
\makeatletter\pgfkeys{
/iexec/.is family,
/iexec,
- stdout/.estore in = \iexec@stdout,
+ stdout/.store in = \iexec@stdout,
stdout/.default = iexec.tmp,
- stderr/.estore in = \iexec@stderr,
- trace/.estore in = \iexec@traceit,
- append/.estore in = \iexec@append,
- log/.estore in = \iexec@log,
- null/.estore in = \iexec@null,
- quiet/.estore in = \iexec@quiet,
+ stderr/.store in = \iexec@stderr,
+ trace/.store in = \iexec@traceit,
+ append/.store in = \iexec@append,
+ log/.store in = \iexec@log,
+ null/.store in = \iexec@null,
+ quiet/.store in = \iexec@quiet,
stdout
}\makeatother
% \end{macrocode}
@@ -290,6 +288,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% Then, we define an internal command |\iexec@typeout| for printing the content of a file,
% as suggested \href{https://tex.stackexchange.com/questions/660808}{here}:
% \begin{macrocode}
+\RequirePackage{expl3}
\makeatletter\ExplSyntaxOn
\NewDocumentCommand{\iexec@typeout}{m}{
\iexec_typeout_file:n { #1 }}
@@ -316,10 +315,10 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% First, we verify that |latex| is running with |--shell-escape| option, since without
% it nothing will work; so, it's better to throw an error earlier than later:
% \begin{macrocode}
- \ifdefined\pdfshellescape\ifnum\pdfshellescape=1\else%
+ \ifnum\ShellEscapeStatus=1\else%
\PackageError{iexec}{You must run TeX processor with
--shell-escape option}{}%
- \fi\fi%
+ \fi%
\begingroup%
% \end{macrocode}
% Then, start the log from a clean line:
diff --git a/macros/latex/contrib/iexec/iexec.pdf b/macros/latex/contrib/iexec/iexec.pdf
index 9bab38749a..3b14fd32d0 100644
--- a/macros/latex/contrib/iexec/iexec.pdf
+++ b/macros/latex/contrib/iexec/iexec.pdf
Binary files differ
diff --git a/macros/latex/contrib/spbmark/README.md b/macros/latex/contrib/spbmark/README.md
index 93032ca368..fb09a7b7a9 100644
--- a/macros/latex/contrib/spbmark/README.md
+++ b/macros/latex/contrib/spbmark/README.md
@@ -8,4 +8,4 @@ This work may be distributed and/or modified under the conditions of the CC-BY 4
## Website
-| [Gitee](https://gitee.com/texl3/spbmark) | [Github](https://github.com/texl3/spbmark) | [CTAN](https://ctan.org/pkg/spbmark) | \ No newline at end of file
+| [Gitee](https://gitee.com/texno3/spbmark) | [Github](https://github.com/texno3/spbmark) | [CTAN](https://ctan.org/pkg/spbmark) | \ No newline at end of file
diff --git a/macros/latex/contrib/spbmark/spbmark.pdf b/macros/latex/contrib/spbmark/spbmark.pdf
index 8737f0e9b2..799e84a323 100644
--- a/macros/latex/contrib/spbmark/spbmark.pdf
+++ b/macros/latex/contrib/spbmark/spbmark.pdf
Binary files differ
diff --git a/macros/latex/contrib/spbmark/spbmark.sty b/macros/latex/contrib/spbmark/spbmark.sty
index e6989d3ada..3529829d7e 100644
--- a/macros/latex/contrib/spbmark/spbmark.sty
+++ b/macros/latex/contrib/spbmark/spbmark.sty
@@ -9,7 +9,7 @@
% https://creativecommons.org/licenses/by/4.0/legalcode
\NeedsTeXFormat{LaTeX2e}[2018/12/31]
\RequirePackage{xparse,l3keys2e}
-\ProvidesExplPackage{spbmark}{2022/04/21}{1.41}
+\ProvidesExplPackage{spbmark}{2022/10/15}{1.42}
{Customize superscripts and subscripts}
\cs_generate_variant:Nn \box_set_ht:Nn { cv }
diff --git a/macros/latex/contrib/spbmark/spbmark.tex b/macros/latex/contrib/spbmark/spbmark.tex
index 5892473fd9..a2f0e7e5a0 100644
--- a/macros/latex/contrib/spbmark/spbmark.tex
+++ b/macros/latex/contrib/spbmark/spbmark.tex
@@ -6,12 +6,12 @@
{
package = spbmark,
title = the spbmark package,
- version = v1.41,
- date = 2022/04/21,
+ version = v1.42,
+ date = 2022/10/15,
authors = Qu Yi,
info = Customize superscript and subscript,
email = toquyi@163.com,
- url = https://github.com/texl3/spbmark,
+ url = https://github.com/texno3/spbmark,
abstract =
{
\pkg*{spbmark} provides three commands \cs{super}, \cs{sub} and \cs{supersub} to improve the layout of superscript and subscript which can be adjusted the relative position and format, and can be used in text and math mode.
diff --git a/macros/luatex/generic/penlight/penlight.pdf b/macros/luatex/generic/penlight/penlight.pdf
index 55eda4b6fe..b0b89352b2 100644
--- a/macros/luatex/generic/penlight/penlight.pdf
+++ b/macros/luatex/generic/penlight/penlight.pdf
Binary files differ
diff --git a/macros/luatex/generic/penlight/penlight.sty b/macros/luatex/generic/penlight/penlight.sty
index 04cb66a482..d796f1e1c8 100644
--- a/macros/luatex/generic/penlight/penlight.sty
+++ b/macros/luatex/generic/penlight/penlight.sty
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2022-04-16
+% 2022-10-15
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -22,10 +22,13 @@
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
% OR OTHER DEALINGS IN THE SOFTWARE.
-\ProvidesPackage{penlight}[2022-04-16]
+\ProvidesPackage{penlight}[2022-10-15]
\RequirePackage{luacode}
+\IfFileExists{luakeys.lua}{}{\PackageError{penlight}{This package requires that luakeys be installed}{help text}}
+
+
\DeclareOption{pl}{\luadirect{
pl = require('penlight')
__PENLIGHT__ = 'pl'
@@ -69,3 +72,22 @@ end
writePDFmetadata()
}}
}
+
+
+\def\luastringT#1{\luastring{\unexpanded\expandafter\expandafter\expandafter{#1}}}
+\let\luastringF\luastring % fully expanded luastring
+
+% allow control over expansion of arguments to a latex function
+\NewDocumentCommand{\MakeluastringCommands}{O{} m }{% #1 the desired commands #2 defaults
+ \luadirect{_G[__PENLIGHT__].tex.aliasluastring(\luastring{#2},\luastring{#1})}%
+}
+
+\NewDocumentCommand{\splitToComma}{ O{nn} m m }{%
+ \MakeluastringCommands[nn]{#1}%
+ \luadirect{_G[__PENLIGHT__].tex.split2comma(\plluastringA{#2},\plluastringB{#3})}%
+}
+
+\NewDocumentCommand{\splitToItems}{ O{NN} m m }{%
+ \MakeluastringCommands[nn]{#1}%
+ \luadirect{_G[__PENLIGHT__].tex.split2items(\plluastringA{#2},\plluastringB{#3})}%
+} \ No newline at end of file
diff --git a/macros/luatex/generic/penlight/penlight.tex b/macros/luatex/generic/penlight/penlight.tex
index f1c07a00cb..869fda37ed 100644
--- a/macros/luatex/generic/penlight/penlight.tex
+++ b/macros/luatex/generic/penlight/penlight.tex
@@ -1,5 +1,5 @@
% Kale Ewasiuk (kalekje@gmail.com)
-% 2022-04-16
+% 2022-10-15
% Copyright (C) 2021-2022 Kale Ewasiuk
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -76,12 +76,13 @@ If you want to use Penlight (and extras) with the \texttt{texlua} intrepreter (n
you can access it by setting \cmd{__SKIP_TEX__ = true} and adding the package to path. For example:
\begin{verbatim}
package.path = package.path .. ';'..'path/to/texmf/tex/latex/penlight/?.lua'
-penlight = require('penlight')
+penlight = require'penlight'
-- below is optional
__SKIP_TEX__ = true --only required if you want to use
--penlightextras without a LaTeX run
-- __PL_NO_GLOBALS__ = true -- optional, skip global definitions
-require('penlightextras')
+__SKIP_LUAKEYS__ = true -- luakeys is laoded in penlightextras be default, you may skip it with this
+require'penlightextras'
\end{verbatim}
\pagebreak
@@ -118,8 +119,13 @@ If \cmd{extras} is used, the following Lua globals will be defined:\\
\llcmd{COMP'xyz'()} Python-like comprehensions:\\\url{https://lunarmodules.github.io/Penlight/libraries/pl.comprehension.html}\\
\llcmd{math.mod(n,d)}, \cmd{math.mod2(n)} math modulous\\
\llcmd{string.}\cmd{totable(s)} string a table of characters\\
+\llcmd{string.}\cmd{delspace(s)} clear spaces from string\\
+\llcmd{pl.}\cmd{char(n)} return letter corresponding to 1=a, 2=b, etc.\\
+\llcmd{pl.}\cmd{Char(n)} return letter corresponding to 1=A, 2=B, etc.\\
\llcmd{kpairs(t), }\cmd{npairs(t)} iterate over keys only, or include nil value from table ipairs\\
+{\Large todo document all string helper functions}
+
\llcmd{pl.utils.}\cmd{filterfiles}\cmd{(dir,filt,rec)} Get files from dir and apply glob-like filters. Set rec to \cmd{true} to include sub directories\\
\pagebreak
@@ -148,7 +154,47 @@ If \cmd{extras} is used, the following Lua globals will be defined:\\
to a package warning saying \cmd{'cs' was declared and used in document, but never set}. If \cmd{overwrite}
is true, it will overwrite an existing command (using \cmd{defcmd}), otherwise, it will throw error like \cmd{newcmd}.\\
+\subsection{Split stuff}
+splitToComma:
+-\splitToComma{ j doe }{\and}-\\
+-\splitToComma{ j doe \and s else }{\and}-\\
+-\splitToComma{ j doe \and s else \and a per }{\and}-\\
+-\splitToComma{ j doe \and s else \and a per \and f guy}{\and}-
+
+\def\authors{j doe \and s else \and a per \and f guy}
+\splitToComma[o]{\authors}{\and}
+
+
+spliToItems:
+\begin{itemize}
+ \splitToItems{kale\and john}{\and}
+ \splitToItems{kale -john -someone else}{-}
+\end{itemize}
+
+\subsection{Macro helpers}
+\cmd{\MakeluastringCommands[def]{spec}} will let \cmd{\plluastring(A|B|C..)} be \cmd{\luastring(N|O|T|F)}
+based on the letters that \cmd{spec} is set to (or \cmd{def} if nothing is provided)
+This is useful if you want to write a command with flexibility on argument expansion.
+The user can specify \cmd{n}, \cmd{o}, \cmd{t}, and \cmd{f} (case insensitve) if they want
+no, once, twice, or full expansion.
+
+
+\def\NOTexp{\ONEexp}
+\def\ONEexp{\TWOexp}
+\def\TWOexp{\TREexp}
+\def\TREexp{Fully expanded}
+
+\NewDocumentCommand{\luastringExpTest}{m m}{
+ \MakeluastringCommands{#1}
+ \luadirect{texio.write_nl('VVVVVVVVVVVVVVVVVVVVVVVVVVVVV')}
+ \luadirect{texio.write_nl(\plluastringA{#2}..' | Not')}
+ \luadirect{texio.write_nl(\plluastringB{#2}..' | Once')}
+ \luadirect{texio.write_nl(\plluastringC{#2}..' | Twice')}
+ \luadirect{texio.write_nl(\plluastringD{#2}..' | Full')}
+ \luadirect{texio.write_nl('VVVVVVVVVVVVVVVVVVVVVVVVVVVVV')}
+}
+\luastringExpTest{ n o t f }{\NOTexp}
\subsubsection*{global extras}
If \cmd{extras} is used and NOT \cmd{extrasnoglobals}, then some globals are set.\\
diff --git a/macros/luatex/generic/penlight/penlightextras.lua b/macros/luatex/generic/penlight/penlightextras.lua
index 253527cc52..9ce0903f1c 100644
--- a/macros/luatex/generic/penlight/penlightextras.lua
+++ b/macros/luatex/generic/penlight/penlightextras.lua
@@ -1,5 +1,5 @@
--% Kale Ewasiuk (kalekje@gmail.com)
---% 2022-04-16
+--% 2022-10-15
--% Copyright (C) 2021-2022 Kale Ewasiuk
--%
--% Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -24,13 +24,16 @@
__SKIP_TEX__ = __SKIP_TEX__ or false --if declared true before here, it will use regular print functions
-- (for troubleshooting with texlua instead of actual use in lua latex)
+__SKIP_LUAKEYS__ = __SKIP_LUAKEYS__ or false
__PL_NO_GLOBALS__ = __PL_NO_GLOBALS__ or false
__PL_EXTRAS__ = 1
-- requires penlight
local pl = _G['penlight'] or _G['pl'] -- penlight for this namespace is pl
-luakeys = require'luakeys'
+if not __SKIP_LUAKEYS__ then
+ luakeys = require'luakeys'
+end
-- some bonus string operations, % text operator, and functional programming
pl.stringx.import()
@@ -278,6 +281,25 @@ end
+function pl.tex.aliasluastring(s, d)
+ s = s:delspace():upper():tolist()
+ d = d:delspace():upper():tolist()
+ for i, S in pl.seq.enum(d:slice_assign(1,#s,s)) do
+ if (S == 'E') or (S == 'F') then S = '' end -- E or F is fully expanded
+ pl.tex.prtn('\\let\\plluastring'..pl.Char(i)..'\\luastring'..S)
+ end
+end
+
+
+
+function pl.tex.get_ref_info(l)
+ local r = token.get_macro('r@'..l)
+ if r == nil then
+ return 0, 0
+ end
+ local sec, page = r:match("{([^}]*)}{([^}]*)}")
+ return sec, page
+end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@@ -314,6 +336,17 @@ local number = P{"number",
}
+
+
+function pl.char(num)
+ return string.char(string.byte("a")+num-1)
+end
+
+function pl.Char(num)
+ return string.char(string.byte("A")+num-1)
+end
+
+
local str_mt = getmetatable("") -- register functions with str
function str_mt.__index.gnum(s)
@@ -374,11 +407,19 @@ function str_mt.__index.totable(str)
return t
end
+function str_mt.__index.tolist(str)
+ return pl.List(str)
+end
+
function str_mt.__index.upfirst(str)
return str:gsub('%a', function(x) return x:upper() end, 1)
end
+function str_mt.__index.delspace(str)
+ return str:gsub('%s','')
+end
+
-- -- -- -- function stuff
@@ -658,7 +699,7 @@ function pl.tex.makePDFvarstr(s)
s = s:gsub('%s*\\sep%s+','\0'):gsub('%s*\\and%s+','\0') -- turn \and into \sep
s = pl.tex.clear_cmds_str(s)
s = s:gsub('\0','\\sep ')
- pl.tex.help_wrt(s,'PDF var string')
+ --pl.tex.help_wrt(s,'PDF var string')
return s
end
@@ -674,10 +715,36 @@ function pl.tex.makeInTextstr(s)
s = s:gsub('\0',', ', c_and - 1)
s = s:gsub('\0',', and ')
end
- pl.tex.help_wrt(s,'in text var string')
+ --pl.tex.help_wrt(s,'in text var string')
+ return s
+end
+
+--todo decide on above or below
+
+function pl.tex.list2comma(t)
+ local s = ''
+ if #t == 1 then
+ s = t[1]
+ elseif #t == 2 then
+ s = t:join(' and ')
+ elseif #t >= 3 then
+ s = t:slice(1,#t-1):join(', ')..', and '..t[#t]
+ end
return s
end
+function pl.tex.split2comma(s, d)
+ local t = pl.List(s:split(d)):map(string.strip)
+ pl.tex.prt(pl.tex.list2comma(t))
+end
+
+function pl.tex.split2items(s, d)
+ local t = pl.List(s:split(d)):map(string.strip)
+ for n, v in ipairs(t) do
+ pl.tex.prtn('\\item '..v)
+ end
+end
+