diff options
Diffstat (limited to 'macros')
32 files changed, 538 insertions, 329 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md index f2c49838eb..a616bdf993 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md @@ -1,4 +1,4 @@ -<b>Date of last change: 2022-04-03 to version v1.1g</b> +<b>Date of last change: 2022-04-16 to version v1.1h</b> # biblatex-gb7714-2015: a biblatex style package @@ -1588,6 +1588,7 @@ please see the file 'biblatex-gb7714-2015.pdf' for further information! * 2022/03/07 v1.1e,ctan,github * 2022/03/13 v1.1f,ctan,github * 2022/04/03 v1.1g,ctan,github +* 2022/04/16 v1.1h,ctan,github --------------------------------------------------------- ## Update history: diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex index d3a20e962a..cdfafd74dd 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex @@ -276,18 +276,18 @@ showstringspaces=false}% no special string spaces \newcommand{\bibliofmt}[1]{\medskip\textcolor{gbforestgreen}{\heiti#1}} %序号如果带章节的话可以改为比如:\thesection.\arabic{myprop} -\tcbmaketheorem{property}{方法} +\newtcbtheorem{property}{方法} {enhanced jigsaw,breakable,pad at break*=1mm,left=2em,boxsep=0pt, %colback=gray!5,colframe=gbforestgreen, colback=gray!5,boxrule=0pt,frame hidden,coltitle=gborange, borderline west={1.5mm}{-2mm}{gbforestgreen}, theorem style=plain,fonttitle=\bfseries\heiti,arc=0mm, %separator sign={\ $\blacktriangleright$},breakable, -%theorem style=plain,fonttitle=\bfseries\upshape, fontupper=\slshape,boxrule=0mm,arc=0mm, % +%theorem style=plain,fonttitle=\bfseries\upshape, fontupper=\slshape,boxrule=0mm,arc=0mm, %coltitle=black,colback=green!50!yellow!15!white,colframe=blue!50,% %description delimiters={}{}, %terminator sign={\ } -}{myprop}{pp} +}{pp} %最后一个必须参数是prefix用来做label比如这里是pp:加上给出的标签名 \newtcbtheorem[]{refentry}{条目类型} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf Binary files differindex 8773a3f6f6..1c844149fe 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex index 3dee09197a..bff9dfe0bd 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex @@ -250,8 +250,8 @@ GB/T 7714标准的理解和解释(\ref{sec:gbt:std}节)、 \addbibresource[location=local]{example.bib} \begin{document}%正文区开始: %正文内容,引用参考文献 -详见文献\cite{Peebles2001-100-100}\parencite{Babu2014--} -另见文献\cite[49]{于潇2012-1518-1523}\parencite[106]{Babu2014--} +详见文献\cite{Peebles2001-100-100}\parencite{Babu2014a} +另见文献\cite[49]{于潇2012-1518-1523}\parencite[106]{Babu2014a} %打印参考文献表 \printbibliography[heading=bibliography,title=参考文献] \end{document} @@ -289,8 +289,8 @@ latexmk -xelatex jobname.tex %\deflength{\textparwd}{\linewidth-1.5cm} %\begin{minipage}{\textparwd} %\fbox{\parbox{\textparwd}{%\raggedright -%详见文献\cite{Peebles2001-100-100}\parencite{Babu2014--} -%另见文献\cite[49]{于潇2012-1518-1523}\parencite[106]{Babu2014--} +%详见文献\cite{Peebles2001-100-100}\parencite{Babu2014a} +%另见文献\cite[49]{于潇2012-1518-1523}\parencite[106]{Babu2014a} %\renewcommand{\bibfont}{\zihao{-5}} %{ %\hyphenation{conference} @@ -739,6 +739,17 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] \item gblocal=chinese,强制设置所有的本地化字符串使用中文。 \item gblocal=english,强制设置所有的本地化字符串使用英文。 \end{itemize} + 当使用gb7714-2015时,本质上是使用如下的本地化字符串,如果有更多的修改需求,可以直接修改它们: + \begin{texlist} + \DefineBibliographyStrings{english}{ + andincite = {和}, + andincitecn = {和}, + andothersincitecn = {等}, + andothersincite = {等{\adddot}},%adddot才能避开标点追踪 + } + \end{texlist} + + 测试文件见: \href{run:egfigure/egcontentfmtc.tex}{egcontentfmtc.tex}。 效果示例如图\ref{fig:eg:optgblocal}所示。 @@ -1380,25 +1391,28 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] \end{texlist} \end{example} -文献表的水平缩进控制,两种编制方式下是不同的。对于著者-出版年制文献表,bibitemindent表示 +文献表的水平缩进控制,两种编制方式下是不同的。对于\emph{著者-出版年}制文献表,bibitemindent表示 \emph{一条文献中第一行相对后面各行的缩进},bibhang 表示\emph{页边到文献各行起始位置的距离}。因此要调整缩进就是要设置这两尺寸。 -对于顺序编码制文献表,由于存在数字标签,且其宽度与参考文献数量相关,所以这个宽度是动态变的,无能提前设定的,而是在文献表生成时给出,所以调整缩进需要在文献表输出环境中调整。由于顺序编码样式使用了两类输出环境,所以需要根据设定的选项区分处理: +对于\emph{顺序编码}制文献表,由于存在数字标签,且其宽度与参考文献数量相关,所以这个宽度是动态变的,无能提前设定的,而是在文献表生成时给出,所以调整缩进需要在文献表输出环境中调整。由于顺序编码样式使用了两类输出环境,所以需要根据设定的选项区分处理: -一是采用list环境的文献表,即设置gbalign=left、right、center时(即顺序编码标签是左对齐、右对齐和居中对齐的情况),在重定义的文献表环境中,调整bibitemindent和bibhang两个尺寸,默认情况下bibhang+labelnumberwidth的长度是页边到各行起始位置的距离。当采用某些字体导致计算计算的标签宽度不足时,可以设置biblabelextend尺寸,来增加labelnumberwidth的宽度,避免缩进格式产生问题,默认情况下biblabelextend尺寸为0pt。 +一是采用list环境的文献表,即设置gbalign=left、right、center时(即顺序编码标签是左对齐、右对齐和居中对齐的情况),在重定义的文献表环境中,调整bibitemindent和biblabelsep两个尺寸,默认情况下bibhang=biblabelsep+labelnumberwidth的长度是页边到各行起始位置的距离。当采用某些字体导致计算计算的标签宽度不足时,可以设置biblabelextend尺寸,来增加labelnumberwidth的宽度,避免缩进格式产生问题,默认情况下biblabelextend尺寸为0pt。 二是采用正常段落环境的文献表,即设置gbalign=gb7714-2015时(即项对齐情况,就是各条文献是自身对齐的情况),在重定义的命令中通过调整lengthid尺寸来设置\emph{每条参考文献第二行开始的缩进距离}。 调整方法见例\ref{eg:biblist:hspace}。 -除了使用这种段落形式的文献表外,也有需求是要把文献表放到一个表格里面这样的需求,要求每一条文献占据表格的一行,这也是能实现的,但本宏包就不去实现了,具体有需求的用户可以在github 的biblatex下搜索tabular或者在tex.stackexchange上搜索biblatex tabular,已经有具体的实现了,这里不再赘述。 +除了使用这种段落形式的文献表外,也有生成\emph{表格文献表}的需求,即把文献表放到一个表格里面,要求每一条文献占据表格的一行。这也是能实现的,具体参考我的博客文章 +\href{https://blog.csdn.net/xenonhu/article/details/121696116}{latex中生成表格形式的参考文献表}。 \begin{example}{文献表水平缩进控制}{eg:biblist:hspace} \begin{texlist} -% 著者-出版年制文献表缩进控制 +% +% 【著者-出版年制】文献表缩进控制 \setlength{\bibitemindent}{0em} % bibitemindent表示一条文献中第一行相对后面各行的缩进 \setlength{\bibhang}{0pt} % 著者-出版年制中 bibhang 表示的各行起始位置到页边的距离 -% 顺序编码制文献表缩进控制 +% +% 【顺序编码制】文献表缩进控制 % 调整顺序标签与文献内容的间距 \setlength{\biblabelsep}{2mm} @@ -1409,7 +1423,10 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] {\printtext[labelnumberwidth]{% \printfield{labelprefix}% \printfield{labelnumber}}} -{% +{%默认设置 + \setlength{\bibhang}{\biblabelsep}% + \addtolength{\bibhang}{\labelnumberwidth}% + % %这里是所做的调整,通过设置\bibitemindent,\bibhang调整缩进 \addtolength{\bibitemindent}{\labelnumberwidth}% \addtolength{\bibitemindent}{\biblabelsep}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib index 3c01beddc8..c52b279ccb 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib @@ -2729,9 +2729,9 @@ Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 20 } @Article{Saito2006-169-176, - Title = {jadeite-bearing metagabbro in serpentinite m\'elange of the ``kurosegawa belt" in Izumi Town,Yatsushiro city, kumamoto prefecture, central kyushu}, + Title = {Jadeite-bearing metagabbro in serpentinite m\'elange of the ``kurosegawa belt" in Izumi Town,Yatsushiro city, kumamoto prefecture, central kyushu}, Author = {Saito, M. and Miyazaki, k.}, - Journal = {bulletin of geological survey of japan}, + Journal = {Bulletin of geological survey of japan}, Number = {5/6}, Pages = {169-176}, Volume = {57}, @@ -2949,7 +2949,7 @@ Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 20 } @Article{Park2010-696-715, - Title = {metadata quality Control in Digital repositories and collections: criteria, semantics, and mechanisms}, + Title = {Metadata quality Control in Digital repositories and collections: criteria, semantics, and mechanisms}, Author = {Park, J R and tosaka, Y.}, Journal = {Cataloging \& classification quarterly}, Number = {8}, @@ -3097,14 +3097,14 @@ Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 20 } @Report{Calkin2011-8-9, - Title = {a comparative risk assessment framework for wildland fire management: the 2010 cohesive strategy Science report: RMRS-GTR-262}, + Title = {A comparative risk assessment framework for wildland fire management: the 2010 cohesive strategy Science report: RMRS-GTR-262}, Author = {Calkin, D and Ager, a. and Thompson, m.}, Pages = {8-9}, Year = {2011} } @Book{Praetzellis2011-13-13, - Title = {death by theory : a tale of mystery and archaeological theory}, + Title = {Death by theory : a tale of mystery and archaeological theory}, Author = {Praetzellis, A.}, Edition = {Rev. ed.}, Pages = {13}, @@ -3352,7 +3352,7 @@ Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 20 } @Article{Walls2013-399-418, - Title = {drought, deluge and declines: the impact of precipition extremes on amphibians in a changing climate}, + Title = {Drought, deluge and declines: the impact of precipition extremes on amphibians in a changing climate}, Author = {Walls, S C and barichivich, W. J. and BROWN, m. e.}, Journal = {Biology}, Number = {1}, @@ -3550,6 +3550,14 @@ Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 20 Editor = {Babu, B. V. and NAGAR, A. K. AND DEEP, K. and others} } +@Proceedings{Babu2014a, + Title = {$P_a$ Proceedings of the second international conference on soft computing for problem solving, December 28-30, 2012}, + Address = {New Delhi}, + Publisher = {Springer}, + Year = {2014}, + Editor = {Babu, B. V. and NAGAR, A. K. AND DEEP, K. and others} +} + @Book{同济大学数学系2014--, Title = {高等数学}, Address = {北京}, diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx index 5860bd87a9..496fe5d98b 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx @@ -11,7 +11,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2022/04/03 v1.1g} +\def\versionofgbtstyle{2022/04/16 v1.1h} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015.bbx}[\versionofgbtstyle biblatex bibliography style] %\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 @@ -2090,29 +2090,36 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 %===================================================================== % 参考文献表环境 %===================================================================== +\AtBeginBibliography{% +\hyphenpenalty=100 %断词阈值,值越大越不容易出现断词 +\tolerance=8000 %丑度, 10000为最大无溢出盒子,参考the texbook 第6章 +\hbadness=5000 %如果丑度超过hbadness这一阀值,那么就会发出警告 +\interlinepenalty=100\relax% +\widowpenalty=100\relax% +\clubpenalty=100\relax% +} %设置断行阈值,避免行溢出 % % 列表格式 % % 增加一个\bibitemindent尺寸用于控制list环境的itemindent % v1.0l,20180615,hzz % v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 -\setlength{\bibhang}{\biblabelsep}% \newlength{\bibitemindent} \setlength{\bibitemindent}{0pt} \newlength{\biblabelextend} \setlength{\biblabelextend}{0pt} - \defbibenvironment{bibliography} {\list {\printtext[labelnumberwidth]{% \printfield{labelprefix}% \printfield{labelnumber}}} {\addtolength{\labelnumberwidth}{\biblabelextend}% - \setlength{\labelwidth}{\labelnumberwidth}% + \setlength{\labelwidth}{\labelnumberwidth}% \setlength{\labelsep}{\biblabelsep}% + \setlength{\bibhang}{\biblabelsep}% + \addtolength{\bibhang}{\labelnumberwidth}% \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% \setlength{\itemindent}{\bibitemindent}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% @@ -2240,14 +2247,14 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% }% {\ifentrytype{online}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% }}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% } % @@ -2257,11 +2264,11 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% }% - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\allowbreak\printtext{[}\nobreak N\printtext{]}\nobreak}% } % @@ -2271,11 +2278,11 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% }% - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\allowbreak\printtext{[}\nobreak S\printtext{]}\nobreak}% } % @@ -2531,32 +2538,30 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 % 重设title的输出 % % 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen +% 20220416,v1.1g,增加book类卷的输出 % 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 % 利用toggle做标识符是否输出的判断 \renewbibmacro*{title}{% - \ifboolexpr{% +\ifboolexpr{% test{\iffieldundef{title}}% and - test{\iffieldundef{subtitle}}% - }% + test{\iffieldundef{subtitle}}}% {}% {\printtext[title]{\bibtitlefont%增加字体控制命令 \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \iftoggle{bbx:gbtype}{% - \iffieldundef{entrysubtype}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 - {\iffieldequalstr{entrysubtype}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 - {\iffieldequalstr{entrysubtype}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 - {\printfield[gbtypeflag]{usera}}}%其它 - }}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit -}% -}} + \ifboolexpr{test {\iffieldundef{subtitle}}}%增加了对子标题的判断 + {}{\setunit{\subtitlepunct}\printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}{\setunit{\subtitlepunct}\printfield{titleaddon}}%判断一下titleaddon + \ifboolexpr{test{\ifentrytype{book}} and (not test{\iffieldundef{volume}})}%判断一下book类有没有volume + {\setunit{\subtitlepunct}\printfield{volume}}{}% + \iftoggle{bbx:gbtype}% + {\iffieldundef{entrysubtype}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 + {\iffieldequalstr{entrysubtype}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 + {\iffieldequalstr{entrysubtype}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 + {\printfield[gbtypeflag]{usera}}}}}{}%%其它 + }% + }% +} % % 作者信息的输出格式 diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx index 3ef25f0a4c..deee0fd76f 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx @@ -10,7 +10,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2022/04/03 v1.1g} +\def\versionofgbtstyle{2022/04/16 v1.1h} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style] %\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 @@ -1935,7 +1935,14 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 %===================================================================== %参考文献表环境 %===================================================================== - +\AtBeginBibliography{% +\hyphenpenalty=100 %断词阈值,值越大越不容易出现断词 +\tolerance=8000 %丑度, 10000为最大无溢出盒子,参考the texbook 第6章 +\hbadness=5000 %如果丑度超过hbadness这一阀值,那么就会发出警告 +\interlinepenalty=100\relax% +\widowpenalty=100\relax% +\clubpenalty=100\relax% +} %设置断行阈值,避免行溢出 % % 列表格式 % @@ -1962,8 +1969,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \newlength{\biblabelextend} \def\setaligngbnumeric{% \defbibenvironment{bibliography} - {\setlength{\bibhang}{\biblabelsep}% - \setlength{\labelnumberwidth}{2em}% + {\setlength{\labelnumberwidth}{2em}% \setlength{\bibitemindent}{0pt}% \setlength{\biblabelextend}{0pt}% \setlength{\biblabelextend}{0pt}% @@ -1973,8 +1979,9 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \addtolength{\labelnumberwidth}{\biblabelextend}% \setlength{\labelwidth}{\labelnumberwidth}% \setlength{\labelsep}{\biblabelsep}% + \setlength{\bibhang}{\biblabelsep}% + \addtolength{\bibhang}{\labelnumberwidth}% \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% \setlength{\itemindent}{\bibitemindent}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% @@ -1984,8 +1991,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 } \defbibenvironment{numerical}%作者年制中数字标签的文献表环境 - {\setlength{\bibhang}{\biblabelsep}% - \setlength{\labelnumberwidth}{2em}% + {\setlength{\labelnumberwidth}{2em}% \setlength{\bibitemindent}{0pt}% \setlength{\biblabelextend}{0pt}% \setlength{\biblabelextend}{0pt}% @@ -1995,8 +2001,9 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \addtolength{\labelnumberwidth}{\biblabelextend}% \setlength{\labelwidth}{\labelnumberwidth}% \setlength{\labelsep}{\biblabelsep}% + \setlength{\bibhang}{\biblabelsep}% + \addtolength{\bibhang}{\labelnumberwidth}% \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% \setlength{\itemindent}{\bibitemindent}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% @@ -2095,14 +2102,14 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% }% {\ifentrytype{online}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% }}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% } % @@ -2112,11 +2119,11 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% }% - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\allowbreak\printtext{[}\nobreak N\printtext{]}\nobreak}% } % @@ -2126,11 +2133,11 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% }% - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\allowbreak\printtext{[}\nobreak S\printtext{]}\nobreak}% } % @@ -2384,32 +2391,30 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 % 重设title的输出 % % 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen +% 20220416,v1.1g,增加book类卷的输出 % 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 % 利用toggle做标识符是否输出的判断 \renewbibmacro*{title}{% - \ifboolexpr{% +\ifboolexpr{% test{\iffieldundef{title}}% and - test{\iffieldundef{subtitle}}% - }% + test{\iffieldundef{subtitle}}}% {}% {\printtext[title]{\bibtitlefont%增加字体控制命令 \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \iftoggle{bbx:gbtype}{% - \iffieldundef{entrysubtype}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 - {\iffieldequalstr{entrysubtype}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 - {\iffieldequalstr{entrysubtype}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 - {\printfield[gbtypeflag]{usera}}}%其它 - }}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit - }% -}} + \ifboolexpr{test {\iffieldundef{subtitle}}}%增加了对子标题的判断 + {}{\setunit{\subtitlepunct}\printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}{\setunit{\subtitlepunct}\printfield{titleaddon}}%判断一下titleaddon + \ifboolexpr{test{\ifentrytype{book}} and (not test{\iffieldundef{volume}})}%判断一下book类有没有volume + {\setunit{\subtitlepunct}\printfield{volume}}{}% + \iftoggle{bbx:gbtype}% + {\iffieldundef{entrysubtype}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 + {\iffieldequalstr{entrysubtype}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 + {\iffieldequalstr{entrysubtype}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 + {\printfield[gbtypeflag]{usera}}}}}{}%%其它 + }% + }% +} % diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx index c23aa3c1a2..b5587607bd 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx @@ -11,7 +11,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2022/04/03 v1.1g} +\def\versionofgbtstyle{2022/04/16 v1.1h} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style] %\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 @@ -1249,13 +1249,20 @@ %===================================================================== % 参考文献表环境 %===================================================================== +\AtBeginBibliography{% +\hyphenpenalty=100 %断词阈值,值越大越不容易出现断词 +\tolerance=8000 %丑度, 10000为最大无溢出盒子,参考the texbook 第6章 +\hbadness=5000 %如果丑度超过hbadness这一阀值,那么就会发出警告 +\interlinepenalty=100\relax% +\widowpenalty=100\relax% +\clubpenalty=100\relax% +} %设置断行阈值,避免行溢出 % % 列表格式 % % 增加一个\bibitemindent尺寸用于控制list环境的itemindent % v1.0l,20180615,hzz % v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 -\setlength{\bibhang}{\biblabelsep}% \newlength{\bibitemindent} \setlength{\bibitemindent}{0pt} \newlength{\biblabelextend} @@ -1270,8 +1277,9 @@ {\addtolength{\labelnumberwidth}{\biblabelextend}% \setlength{\labelwidth}{\labelnumberwidth}% \setlength{\labelsep}{\biblabelsep}% + \setlength{\bibhang}{\biblabelsep}% + \addtolength{\bibhang}{\labelnumberwidth}% \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% \setlength{\itemindent}{\bibitemindent}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% @@ -1401,14 +1409,14 @@ \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% }% {\ifentrytype{online}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% }}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% } % @@ -1418,11 +1426,11 @@ \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% }% - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\allowbreak\printtext{[}\nobreak N\printtext{]}\nobreak}% } % @@ -1432,11 +1440,11 @@ \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% }% - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\allowbreak\printtext{[}\nobreak S\printtext{]}\nobreak}% } % @@ -2023,32 +2031,30 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}% % 重设title的输出 % % 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen +% 20220416,v1.1g,增加book类卷的输出 % 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 % 利用toggle做标识符是否输出的判断 \renewbibmacro*{title}{% - \ifboolexpr{% +\ifboolexpr{% test{\iffieldundef{title}}% and - test{\iffieldundef{subtitle}}% - }% + test{\iffieldundef{subtitle}}}% {}% {\printtext[title]{\bibtitlefont%增加字体控制命令 \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \iftoggle{bbx:gbtype}{% - \iffieldundef{entrysubtype}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 - {\iffieldequalstr{entrysubtype}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 - {\iffieldequalstr{entrysubtype}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 - {\printfield[gbtypeflag]{usera}}}%其它 - }}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit + \ifboolexpr{test {\iffieldundef{subtitle}}}%增加了对子标题的判断 + {}{\setunit{\subtitlepunct}\printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}{\setunit{\subtitlepunct}\printfield{titleaddon}}%判断一下titleaddon + \ifboolexpr{test{\ifentrytype{book}} and (not test{\iffieldundef{volume}})}%判断一下book类有没有volume + {\setunit{\subtitlepunct}\printfield{volume}}{}% + \iftoggle{bbx:gbtype}% + {\iffieldundef{entrysubtype}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 + {\iffieldequalstr{entrysubtype}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 + {\iffieldequalstr{entrysubtype}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 + {\printfield[gbtypeflag]{usera}}}}}{}%%其它 + }% + }% }% -}}% % % 日期信息的输出格式,针对biblatex<3.7版本 % diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx index 54515d1671..4879b4221d 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx @@ -11,7 +11,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2022/04/03 v1.1g} +\def\versionofgbtstyle{2022/04/16 v1.1h} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015mx.bbx}[\versionofgbtstyle biblatex bibliography style] %\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 @@ -1538,13 +1538,20 @@ %===================================================================== % 参考文献表环境 %===================================================================== +\AtBeginBibliography{% +\hyphenpenalty=100 %断词阈值,值越大越不容易出现断词 +\tolerance=8000 %丑度, 10000为最大无溢出盒子,参考the texbook 第6章 +\hbadness=5000 %如果丑度超过hbadness这一阀值,那么就会发出警告 +\interlinepenalty=100\relax% +\widowpenalty=100\relax% +\clubpenalty=100\relax% +} %设置断行阈值,避免行溢出 % % 列表格式 % % 增加一个\bibitemindent尺寸用于控制list环境的itemindent % v1.0l,20180615,hzz % v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 -\setlength{\bibhang}{\biblabelsep}% \newlength{\bibitemindent} \setlength{\bibitemindent}{0pt} \newlength{\biblabelextend} @@ -1559,8 +1566,9 @@ {\addtolength{\labelnumberwidth}{\biblabelextend}% \setlength{\labelwidth}{\labelnumberwidth}% \setlength{\labelsep}{\biblabelsep}% + \setlength{\bibhang}{\biblabelsep}% + \addtolength{\bibhang}{\labelnumberwidth}% \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% \setlength{\itemindent}{\bibitemindent}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% @@ -1659,8 +1667,7 @@ } \defbibenvironment{numerical}%作者年制中数字标签的文献表环境 - {\setlength{\bibhang}{\biblabelsep}% - \setlength{\labelnumberwidth}{2em}% + {\setlength{\labelnumberwidth}{2em}% \setlength{\bibitemindent}{0pt}% \setlength{\biblabelextend}{0pt}% \setlength{\biblabelextend}{0pt}% @@ -1670,8 +1677,9 @@ \addtolength{\labelnumberwidth}{\biblabelextend}% \setlength{\labelwidth}{\labelnumberwidth}% \setlength{\labelsep}{\biblabelsep}% + \setlength{\bibhang}{\biblabelsep}% + \addtolength{\bibhang}{\labelnumberwidth}% \setlength{\leftmargin}{\bibhang}% - \addtolength{\leftmargin}{\labelnumberwidth}% \setlength{\itemindent}{\bibitemindent}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% @@ -1709,14 +1717,14 @@ \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% }% {\ifentrytype{online}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% }}% - {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% + {\allowbreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% } % @@ -1726,11 +1734,11 @@ \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% }% - {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% + {\allowbreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\allowbreak\printtext{[}\nobreak N\printtext{]}\nobreak}% } % @@ -1740,11 +1748,11 @@ \iftoggle{bbx:gbmedium}% {\iftoggle{bbx:url}% {\iffieldundef{url}%当存在url时,增加一个OL标识符 - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% - {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% }% - {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% -}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% + {\allowbreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% +}{\allowbreak\printtext{[}\nobreak S\printtext{]}\nobreak}% } % @@ -1995,32 +2003,30 @@ % 重设title的输出 % % 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen +% 20220416,v1.1g,增加book类卷的输出 % 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 % 利用toggle做标识符是否输出的判断 \renewbibmacro*{title}{% - \ifboolexpr{% +\ifboolexpr{% test{\iffieldundef{title}}% and - test{\iffieldundef{subtitle}}% - }% + test{\iffieldundef{subtitle}}}% {}% {\printtext[title]{\bibtitlefont%增加字体控制命令 \printfield[titlecase]{title}% - \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 - {}{\setunit{\subtitlepunct}% - \printfield[titlecase]{subtitle}}% - \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 - {\setunit{\subtitlepunct}\printfield{titleaddon}}% - \iftoggle{bbx:gbtype}{% - \iffieldundef{entrysubtype}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 - {\iffieldequalstr{entrysubtype}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 - {\iffieldequalstr{entrysubtype}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 - {\printfield[gbtypeflag]{usera}}}%其它 - }}{}% - %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 - %\newunit -}% -}} + \ifboolexpr{test {\iffieldundef{subtitle}}}%增加了对子标题的判断 + {}{\setunit{\subtitlepunct}\printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}{\setunit{\subtitlepunct}\printfield{titleaddon}}%判断一下titleaddon + \ifboolexpr{test{\ifentrytype{book}} and (not test{\iffieldundef{volume}})}%判断一下book类有没有volume + {\setunit{\subtitlepunct}\printfield{volume}}{}% + \iftoggle{bbx:gbtype}% + {\iffieldundef{entrysubtype}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 + {\iffieldequalstr{entrysubtype}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 + {\iffieldequalstr{entrysubtype}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 + {\printfield[gbtypeflag]{usera}}}}}{}%%其它 + }% + }% +} % % 作者信息的输出格式 diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-NWAFU.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-NWAFU.bbx index 6a93f21b39..124751c3d6 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-NWAFU.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-NWAFU.bbx @@ -20,6 +20,7 @@ %================================================== \ExecuteBibliographyOptions{ sortlocale=zh__pinyin, + gbpub=false, gbtype=false, maxbibnames=99,% 著录所有作者 minbibnames=1, @@ -41,7 +42,7 @@ %\def\bibrangedash{$\sim$}% 表示范围的波浪线符号 \DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{$\sim$}} %\newcommand\nwafubibfont{\linespread{1.0}\zihao{-5}}% 字体 -\newcommand\nwafubibfont{\zihao{-5}}% 字体 +\newcommand\nwafubibfont{\zihao{5}}% 字体 \renewcommand{\bibfont}{\nwafubibfont}% 全局字体设置 \setlength{\bibitemsep}{2pt}%0ex diff --git a/macros/latex/contrib/create-theorem/create-theorem-doc.pdf b/macros/latex/contrib/create-theorem/create-theorem-doc.pdf Binary files differindex 58aaba6d86..0d2a1a19bb 100644 --- a/macros/latex/contrib/create-theorem/create-theorem-doc.pdf +++ b/macros/latex/contrib/create-theorem/create-theorem-doc.pdf diff --git a/macros/latex/contrib/create-theorem/create-theorem-doc.tex b/macros/latex/contrib/create-theorem/create-theorem-doc.tex index cefc160ade..e6f8b84538 100644 --- a/macros/latex/contrib/create-theorem/create-theorem-doc.tex +++ b/macros/latex/contrib/create-theorem/create-theorem-doc.tex @@ -97,7 +97,7 @@ \begin{document} -\def\PackageVersion{2022/04/02} +\def\PackageVersion{2022/04/16} \title{\createtheorempackage{}\\\smallskip\itshape Initializing theorem-like environments with multilingual support} \author{Jinwen XU} @@ -122,7 +122,7 @@ First, you need a backend to provide the command \lstinline|\newtheorem| with the usual behaviour, for example, \textsf{amsthm}. After that, you can simply load the current package with: \begin{code} -\usepackage{create-theorem} +\usepackage[(*\meta{options}*)]{create-theorem} \end{code} \begin{tip} @@ -207,7 +207,7 @@ Supported keys are: \end{itemize} \item \commandoption{crefname style}\lstinline| = |\meta{style} \begin{itemize} - \item The style of the ``crefname'', you can specify the font, text style, color, etc. + \item The style of the \textquote{crefname}, you can specify the font, text style, color, etc. \item Synonymous names: \commandoption{crefname-style} \,$|$\, \commandoption{crefnamestyle} \end{itemize} \item \commandoption{Crefname} @@ -217,7 +217,7 @@ Supported keys are: \end{itemize} \item \commandoption{Crefname style}\lstinline| = |\meta{style} \begin{itemize} - \item The style of the ``Crefname'', you can specify the font, text style, color, etc. + \item The style of the \textquote{Crefname}, you can specify the font, text style, color, etc. \item Synonymous names: \commandoption{Crefname-style} \,$|$\, \commandoption{Crefnamestyle} \end{itemize} \item \commandoption{numbering style}\lstinline| = |\meta{style} @@ -225,6 +225,11 @@ Supported keys are: \item The style of numbering in the reference, you can specify the font, text style, color, etc. \item Synonymous names: \commandoption{numbering-style} \,$|$\, \commandoption{numberingstyle} \end{itemize} + \item \commandoption{use name}\lstinline| = |\meta{list of existed environment(s) separated with semicolon \textquote{ ; }} + \begin{itemize} + \item Use the name(s) and style(s) of given environment(s). If there are multiple ones specified, the result would be a string combining the names, separated with \textquote{\texttt{-}}. + \item Synonymous names: \commandoption{combined} \,$|$\, \commandoption{use-name} \,$|$\, \commandoption{usename} + \end{itemize} \end{itemize} \vspace{-.3\baselineskip} @@ -243,14 +248,15 @@ The syntax of \lstinline|\CreateTheorem| is as follows: Supported keys are: \vspace{-.2\baselineskip} \begin{itemize}[label=,leftmargin=1.25em,itemindent=-1.25em] - \item \commandoption{name}\lstinline| = |\meta{configuration} + \item \commandoption{name}\lstinline| = |\meta{configuration} \quad or \quad \commandoption{name style}\lstinline| = |\meta{configuration} \begin{itemize} \item Setting the names. Same as \lstinline|\NameTheorem{|\meta{name of environment}\lstinline|}{|\meta{configuration}\lstinline|}|. + \item Synonymous names: \commandoption{name-style} \,$|$\, \commandoption{namestyle} \end{itemize} - \item \commandoption{name style}\lstinline| = |\meta{configuration} + \item \commandoption{use name}\lstinline| = |\meta{list of existed environment(s) separated with semicolon \textquote{ ; }} \begin{itemize} - \item Setting the style of names. Same as using \lstinline|\NameTheorem|. - \item Synonymous names: \commandoption{name-style} \,$|$\, \commandoption{namestyle} + \item Using existed name(s). Same as in \lstinline|\NameTheorem|. + \item Synonymous names: \commandoption{combined} \,$|$\, \commandoption{use-name} \,$|$\, \commandoption{usename} \end{itemize} \item \commandoption{style}\lstinline| = |\meta{theorem style} \begin{itemize} @@ -289,7 +295,7 @@ Supported keys are: \end{itemize} \begin{tip} - The names for the following environments have been preset: \texttt{assertion}, \texttt{assumption}, \texttt{axiom}, \texttt{conclusion}, \texttt{conjecture}, \texttt{convention}, \texttt{corollary}, \texttt{definition}, \texttt{definition-proposition}, \texttt{definition-theorem}, \texttt{example}, \texttt{exercise}, \texttt{fact}, \texttt{hypothesis}, \texttt{lemma}, \texttt{notation}, \texttt{observation}, \texttt{postulate}, \texttt{problem}, \texttt{property}, \texttt{proposition}, \texttt{question}, \texttt{remark} and \texttt{theorem}. If you are fine with the preset names, then you don't need to specify the key ``\commandoption{name}'' while creating them, otherwise you shall have to use the package option ``\packageoption{no preset names}'' to disable the presets and then define your own ones. + The names for the following environments have been preset: \texttt{application}, \texttt{assertion}, \texttt{assumption}, \texttt{axiom}, \texttt{conclusion}, \texttt{conjecture}, \texttt{convention}, \texttt{corollary}, \texttt{definition}, \texttt{example}, \texttt{exercise}, \texttt{fact}, \texttt{hypothesis}, \texttt{lemma}, \texttt{notation}, \texttt{observation}, \texttt{postulate}, \texttt{problem}, \texttt{property}, \texttt{proposition}, \texttt{question}, \texttt{remark} and \texttt{theorem}. If you are fine with the preset names, then there is no need to specify the key \textquote{\commandoption{name}} while creating them, otherwise you shall have to use the package option \textquote{\packageoption{no preset names}} to disable the presets and then define your own ones. \end{tip} \medskip @@ -385,7 +391,7 @@ This is not exciting at all. Now, let's say we are writing a bilingual note in E } \end{code} -With this, if you use \lstinline|\selectlanguage{french}|, the \texttt{idea} environment shall be automatically displayed as ``Idée''. And if you \lstinline|\crefthe| it, the definite article and the name showed up properly just as expected. +With this, if you use \lstinline|\selectlanguage{french}|, the \texttt{idea} environment shall be automatically displayed as \textquote{Idée}. And if you \lstinline|\crefthe| it, the definite article and the name showed up properly just as expected. \medskip Next we shall deal with the numbering problem. Let's continue to use this environment \texttt{idea} for demonstration -- suppose that we have set the names up with \lstinline|\NameTheorem|. diff --git a/macros/latex/contrib/create-theorem/create-theorem.sty b/macros/latex/contrib/create-theorem/create-theorem.sty index 2156f23ecd..73d9302416 100644 --- a/macros/latex/contrib/create-theorem/create-theorem.sty +++ b/macros/latex/contrib/create-theorem/create-theorem.sty @@ -13,7 +13,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {create-theorem} - {2022/04/02} {} + {2022/04/16} {} {Initializing theorem-like environments with multilingual support} \keys_define:nn { create-theorem } @@ -112,6 +112,14 @@ , numbering-style .value_required:n = true , numbering style .meta:n = { numbering~style = { #1 } } , numbering style .value_required:n = true + , use~name .code:n = { \crthm_set_name_with_existed_names:en { \l__crthm_current_env_tl } { #1 } } + , use~name .value_required:n = true + , use-name .meta:n = { use~name = { #1 } } + , use-name .value_required:n = true + , use name .meta:n = { use~name = { #1 } } + , use name .value_required:n = true + , combined .meta:n = { use~name = { #1 } } + , combined .value_required:n = true , unknown .code:n = {} } @@ -199,10 +207,15 @@ { \tl_if_blank:eTF { #3 } { - \tl_gset:cn { g_crthm_name_ #7 ref_article_singular_ #1 _ #2 _tl } { \crefthemark{ \skip_horizontal:n { -.5ex } } } - \tl_gset:cn { g_crthm_name_ #7 ref_article_plural_ #1 _ #2 _tl } { \crefthemark{ \skip_horizontal:n { -.5ex } } } + %% The spacing here is rather strange, but I haven't came up with a better method yet + \tl_gset:cn { g_crthm_core_name_ #7 ref_article_singular_ #1 _ #2 _tl } { \skip_horizontal:n { -.75ex } } + \tl_gset:cn { g_crthm_core_name_ #7 ref_article_plural_ #1 _ #2 _tl } { \skip_horizontal:n { -.75ex } } + \tl_gset:cn { g_crthm_name_ #7 ref_article_singular_ #1 _ #2 _tl } { \crefthemark { \skip_horizontal:n { -.5ex } } } + \tl_gset:cn { g_crthm_name_ #7 ref_article_plural_ #1 _ #2 _tl } { \crefthemark { \skip_horizontal:n { -.5ex } } } } { + \tl_gset:cn { g_crthm_core_name_ #7 ref_article_singular_ #1 _ #2 _tl } { #3 } + \tl_gset:cn { g_crthm_core_name_ #7 ref_article_plural_ #1 _ #2 _tl } { #5 } \tl_gset:cn { g_crthm_name_ #7 ref_article_singular_ #1 _ #2 _tl } { \crefthemark { #3 } } \tl_gset:cn { g_crthm_name_ #7 ref_article_plural_ #1 _ #2 _tl } { \crefthemark { #5 } } } @@ -503,6 +516,67 @@ } +\tl_new:N \g_crthm_combined_name_sep_tl +\tl_gset:Nn \g_crthm_combined_name_sep_tl { - } + +\cs_new:Nn \crthm_set_name_with_existed_names:nn + % #1 = env name + % #2 = list of existed environments + { + \clist_map_inline:Nn \g_crthm_supported_language_clist + { % ##1 = language name + \seq_gclear_new:c { g_crthm_name_heading_ #1 _ ##1 _seq } + \seq_gclear_new:c { g_crthm_name_cref_article_singular_ #1 _ ##1 _seq } + \seq_gclear_new:c { g_crthm_name_cref_article_plural_ #1 _ ##1 _seq } + \seq_gclear_new:c { g_crthm_name_cref_singular_ #1 _ ##1 _seq } + \seq_gclear_new:c { g_crthm_name_cref_plural_ #1 _ ##1 _seq } + \seq_gclear_new:c { g_crthm_name_Cref_article_singular_ #1 _ ##1 _seq } + \seq_gclear_new:c { g_crthm_name_Cref_article_plural_ #1 _ ##1 _seq } + \seq_gclear_new:c { g_crthm_name_Cref_singular_ #1 _ ##1 _seq } + \seq_gclear_new:c { g_crthm_name_Cref_plural_ #1 _ ##1 _seq } + \bool_set_true:N \l_tmpa_bool + \regex_split:nnN { \s* ; \s* } { #2 } { \l_tmpa_seq } + \seq_map_inline:Nn \l_tmpa_seq + { % ####1 = existed environments + \bool_if:NT \l_tmpa_bool + { % use the first environment's definite article as that of the combined environment + \tl_gset:cn { g_crthm_saved_name_cref_article_singular_ #1 _ ##1 _tl } { \tl_use:c { g_crthm_core_name_cref_article_singular_ ####1 _ ##1 _tl } } + \tl_gset:cn { g_crthm_saved_name_cref_article_plural_ #1 _ ##1 _tl } { \tl_use:c { g_crthm_core_name_cref_article_plural_ ####1 _ ##1 _tl } } + \tl_gset:cn { g_crthm_saved_name_Cref_article_singular_ #1 _ ##1 _tl } { \tl_use:c { g_crthm_core_name_Cref_article_singular_ ####1 _ ##1 _tl } } + \tl_gset:cn { g_crthm_saved_name_Cref_article_plural_ #1 _ ##1 _tl } { \tl_use:c { g_crthm_core_name_Cref_article_plural_ ####1 _ ##1 _tl } } + \bool_set_false:N \l_tmpa_bool + } + \seq_gput_right:cn { g_crthm_name_heading_ #1 _ ##1 _seq } { \tl_use:c { g_crthm_name_heading_ ####1 _ ##1 _tl } } + \seq_gput_right:cn { g_crthm_name_cref_singular_ #1 _ ##1 _seq } { \tl_use:c { g_crthm_name_cref_singular_ ####1 _ ##1 _tl } } + \seq_gput_right:cn { g_crthm_name_cref_plural_ #1 _ ##1 _seq } { \tl_use:c { g_crthm_name_cref_plural_ ####1 _ ##1 _tl } } + \seq_gput_right:cn { g_crthm_name_Cref_singular_ #1 _ ##1 _seq } { \tl_use:c { g_crthm_name_Cref_singular_ ####1 _ ##1 _tl } } + \seq_gput_right:cn { g_crthm_name_Cref_plural_ #1 _ ##1 _seq } { \tl_use:c { g_crthm_name_Cref_plural_ ####1 _ ##1 _tl } } + % set the numbering style to be the same as the last environment + \tl_gset:cn { g_crthm_number_style_ #1 _tl } { \tl_use:c { g_crthm_number_style_ ####1 _tl } } + } + % set heading name for the combined environment + \tl_gset:cn { g_crthm_name_heading_ #1 _ ##1 _tl } { \seq_use:cn { g_crthm_name_heading_ #1 _ ##1 _seq } { \g_crthm_combined_name_sep_tl } } + % set crefname for the combined environment + \__crthm_set_name_crefname:nnn { #1 } { ##1 } + { + [ \tl_use:c { g_crthm_saved_name_cref_article_singular_ #1 _ ##1 _tl } ] + { \seq_use:cn { g_crthm_name_cref_singular_ #1 _ ##1 _seq } { \g_crthm_combined_name_sep_tl } } + [ \tl_use:c { g_crthm_saved_name_cref_article_plural_ #1 _ ##1 _tl } ] + { \seq_use:cn { g_crthm_name_cref_plural_ #1 _ ##1 _seq } { \g_crthm_combined_name_sep_tl } } + } + % set Crefname for the combined environment + \__crthm_set_name_Crefname:nnn { #1 } { ##1 } + { + [ \tl_use:c { g_crthm_saved_name_Cref_article_singular_ #1 _ ##1 _tl } ] + { \seq_use:cn { g_crthm_name_Cref_singular_ #1 _ ##1 _seq } { \g_crthm_combined_name_sep_tl } } + [ \tl_use:c { g_crthm_saved_name_Cref_article_plural_ #1 _ ##1 _tl } ] + { \seq_use:cn { g_crthm_name_Cref_plural_ #1 _ ##1 _seq } { \g_crthm_combined_name_sep_tl } } + } + } + } +\cs_generate_variant:Nn \crthm_set_name_with_existed_names:nn { en } + + \NewDocumentCommand \NameTheorem { m m } { \crthm_name_theorem:nn { #1 } { #2 } @@ -535,6 +609,14 @@ , name-style .value_required:n = true , name style .meta:n = { name~style = { #1 } } , name style .value_required:n = true + , use~name .code:n = { \exp_args:Ne \NameTheorem { \l__crthm_current_env_tl } { use~name = #1 } } + , use~name .value_required:n = true + , use-name .meta:n = { use~name = { #1 } } + , use-name .value_required:n = true + , use name .meta:n = { use~name = { #1 } } + , use name .value_required:n = true + , combined .meta:n = { use~name = { #1 } } + , combined .value_required:n = true , style .code:n = { \bool_set_true:N \l__crthm_creating_apply_style_bool \tl_set:Nn \l__crthm_creating_apply_style_tl { #1 } } , style .value_required:n = true @@ -659,7 +741,7 @@ % In "regionalref" mode, the counter received by the referencing system is "#1 _crthm_regional" % while in "originalref" mode, the counter received is "#1 _crthm_original_\languagename" { - \tl_if_blank:eTF { ##1 } + \tl_if_blank:nTF { ##1 } { \begin{ #1 _crthm_regional } } @@ -764,6 +846,49 @@ % --- Preset Names --- %============================= +\NameTheorem { application } + { + , heading = { + , english = Application + , french = Application + , ngerman = Anwendung + , italian = Applicazione + , portuguese = Aplicação + , brazilian = Aplicação + , spanish = Aplicación + , schinese = 应用 + , tchinese = 應用 + , japanese = 応用 + , russian = Применение + } + , crefname = { + , english = {application}{applications} + , french = [l']{application}[les]{applications} + , ngerman = {Anwendung}{Anwendungen} + , italian = [l']{applicazione}[le]{applicazioni} + , portuguese = [a]{aplicação}[as]{aplicações} + , brazilian = [a]{aplicação}[as]{aplicações} + , spanish = [la]{aplicación}[las]{aplicaciones} + , schinese = {应用}{应用} + , tchinese = {應用}{應用} + , japanese = {応用}{応用} + , russian = {применение}{приложения} + } + , Crefname = { + , english = {Application}{Applications} + , french = [L']{application}[Les]{applications} + , ngerman = {Anwendung}{Anwendungen} + , italian = [L']{applicazione}[Le]{applicazioni} + , portuguese = [A]{aplicação}[As]{aplicações} + , brazilian = [A]{aplicação}[As]{aplicações} + , spanish = [La]{aplicación}[Las]{aplicaciones} + , schinese = {应用}{应用} + , tchinese = {應用}{應用} + , japanese = {応用}{応用} + , russian = {Применение}{Приложения} + } + } + \NameTheorem { assertion } { , heading = { @@ -1710,91 +1835,11 @@ } } -\NameTheorem { definition-proposition } - { - , heading = { - , english = Definition-Proposition - , french = Définition-Proposition - , ngerman = Definition-Proposition - , italian = Definizione-Proposizione - , portuguese = Definição-Proposição - , brazilian = Definição-Proposição - , spanish = Definición-Proposición - , schinese = 定义-命题 - , tchinese = 定義-命題 - , japanese = 定義-命題 - , russian = Определение-Предложение - } - , crefname = { - , english = {definition-proposition}{definition-propositions} - , french = [la]{définition-proposition}[les]{définition-propositions} - , ngerman = {Definition-Proposition}{Definitionen-Propositionen} - , italian = [la]{definizione-proposizione}[le]{definizioni-proposte} - , portuguese = [a]{definição-proposição}[as]{definições-proposições} - , brazilian = [a]{definição-proposição}[as]{definições-proposições} - , spanish = [la]{definición-proposición}[las]{definiciones-proposiciones} - , schinese = {定义-命题}{定义-命题} - , tchinese = {定義-命題}{定義-命題} - , japanese = {定義-命題}{定義-命題} - , russian = {определение-предложение}{определения-предложения} - } - , Crefname = { - , english = {Definition-proposition}{Definition-propositions} - , french = [La]{définition-proposition}[Les]{définition-propositions} - , ngerman = {Definition-Proposition}{Definitionen-Propositionen} - , italian = [La]{definizione-proposizione}[Le]{definizioni-proposte} - , portuguese = [A]{definição-proposição}[As]{definições-proposições} - , brazilian = [A]{definição-proposição}[As]{definições-proposições} - , spanish = [La]{definición-proposición}[Las]{definiciones-proposiciones} - , schinese = {定义-命题}{定义-命题} - , tchinese = {定義-命題}{定義-命題} - , japanese = {定義-命題}{定義-命題} - , russian = {Определение-предложение}{Определения-предложения} - } - } +\NameTheorem { definition-proposition } { combined = { definition ; proposition } } +\NameTheorem { definition-theorem } { combined = { definition ; theorem } } -\NameTheorem { definition-theorem } - { - , heading = { - , english = Definition-Theorem - , french = Définition-Théorème - , ngerman = Definition-Satz - , italian = Definizione-Teorema - , portuguese = Definição-Teorema - , brazilian = Definição-Teorema - , spanish = Definición-Teorema - , schinese = 定义-定理 - , tchinese = 定義-定理 - , japanese = 定義-定理 - , russian = Определение-Теорема - } - , crefname = { - , english = {definition-theorem}{definition-theorems} - , french = [la]{définition-théorème}[les]{définition-théorèmes} - , ngerman = {Definition-Satz}{Definitionen-Sätze} - , italian = [la]{definizione-teorema}[le]{definizioni-teoremi} - , portuguese = [a]{definição-teorema}[as]{definições-teoremas} - , brazilian = [a]{definição-teorema}[as]{definições-teoremas} - , spanish = [la]{definición-teorema}[las]{definiciones-teoremas} - , schinese = {定义-定理}{定义-定理} - , tchinese = {定義-定理}{定義-定理} - , japanese = {定義-定理}{定義-定理} - , russian = {определение-теорема}{определения-теоремы} - } - , Crefname = { - , english = {Definition-theorem}{Definition-theorems} - , french = [La]{définition-théorème}[Les]{définition-théorèmes} - , ngerman = {Definition-Satz}{Definitionen-Sätze} - , italian = [La]{definizione-teorema}[Le]{definizioni-teoremi} - , portuguese = [A]{definição-teorema}[As]{definições-teoremas} - , brazilian = [A]{definição-teorema}[As]{definições-teoremas} - , spanish = [La]{definición-teorema}[Las]{definiciones-teoremas} - , schinese = {定义-定理}{定义-定理} - , tchinese = {定義-定理}{定義-定理} - , japanese = {定義-定理}{定義-定理} - , russian = {Определение-теорема}{Определения-теоремы} - } - } +\NameTheorem { proposition-definition } { combined = { proposition ; definition } } +\NameTheorem { theorem-definition } { combined = { theorem ; definition } } \endinput %% diff --git a/macros/latex/contrib/graphics-def/README.md b/macros/latex/contrib/graphics-def/README.md index 03c905bc88..5ab6b8adee 100644 --- a/macros/latex/contrib/graphics-def/README.md +++ b/macros/latex/contrib/graphics-def/README.md @@ -1,7 +1,7 @@ LaTeX support for color and graphics ==================================== -Release 2022-04-12 +Release 2022-04-16 This bundle contains the 'engine-dependent' part of support for color and graphics in LaTeX2e (the code here will also function diff --git a/macros/latex/contrib/graphics-def/dvipdfmx.def b/macros/latex/contrib/graphics-def/dvipdfmx.def index f8a984cb5a..1d82661b11 100644 --- a/macros/latex/contrib/graphics-def/dvipdfmx.def +++ b/macros/latex/contrib/graphics-def/dvipdfmx.def @@ -17,7 +17,7 @@ %% https://github.com/latex3/graphics-def/issues %% \ProvidesFile{dvipdfmx.def} - [2022/04/12 v5.0k Graphics/color driver for dvipdfmx] + [2022/04/16 v5.0l Graphics/color driver for dvipdfmx] \def\GPT@space{ } \def\c@lor@arg#1{% \dimen@#1\p@ @@ -329,6 +329,7 @@ } \fi \fi +\endinput % Conversion functions so the internal representation stays unchanged \let\init@current@color\current@color \def\convert@color#1{% diff --git a/macros/latex/contrib/graphics-def/xetex.def b/macros/latex/contrib/graphics-def/xetex.def index 0ddde80f15..7293379311 100644 --- a/macros/latex/contrib/graphics-def/xetex.def +++ b/macros/latex/contrib/graphics-def/xetex.def @@ -17,7 +17,7 @@ %% https://github.com/latex3/graphics-def/issues %% \ProvidesFile{xetex.def} - [2022/04/12 v5.0l Graphics/color driver for xetex] + [2022/04/16 v5.0m Graphics/color driver for xetex] \def\GPT@space{ } \def\c@lor@arg#1{% \dimen@#1\p@ @@ -428,6 +428,7 @@ } \fi \fi +\endinput % Conversion functions so the internal representation stays unchanged \let\init@current@color\current@color \def\convert@color#1{% diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.lua b/macros/luatex/generic/lutabulartools/lutabulartools.lua index 30165f89a9..fd783332a9 100644 --- a/macros/luatex/generic/lutabulartools/lutabulartools.lua +++ b/macros/luatex/generic/lutabulartools/lutabulartools.lua @@ -1,5 +1,5 @@ --% Kale Ewasiuk (kalekje@gmail.com) ---% 2022-02-27 +--% 2022-04-16 --% Copyright (C) 2021-2022 Kale Ewasiuk --% --% Permission is hereby granted, free of charge, to any person obtaining a copy @@ -22,8 +22,23 @@ --% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE --% OR OTHER DEALINGS IN THE SOFTWARE. + +local pl = _G['penlight'] or _G['pl'] -- penlight for this namespace is pl +if (__PL_EXTRAS__ == nil) or (__PENLIGHT__ == nil) then + tex.sprint('\\PackageError{yamlvars}{penlight package with extras (or extrasnoglobals) option must be loaded before this package}{}') +end + local ltt = {} + +ltt.debug = false +function ltt.debugtalk(s, ss) + ss = ss or '' + if ltt.debug then + pl.tex.help_wrt(s, ss..' (lutabulartools)') + end +end + ltt.col_spec1 = {} -- column spec if one column wide (since makcell nests a tabular, preserve col_spec below) ltt.col_spec = {} -- tab column spec if above 1 ltt.col = '' -- current column spec, single char, only applies to tabular with more than 1 column @@ -55,6 +70,7 @@ function ltt.set_col_num() ltt.col_num = 1 end ltt.col = ltt.col_spec[ltt.col_num] + ltt.debugtalk('col_num='..ltt.col_num..'; col_spec='..ltt.col,'set_col_num') end @@ -74,6 +90,7 @@ function ltt.set_col_spec(zz) else ltt.col_spec1 = _col_spec end + ltt.debugtalk(ltt.col_spec,'set_col_spec') end @@ -88,7 +105,7 @@ function ltt.MagicCell(s0,spec,mcspec,pre,content) ltt.set_col_num() -- register current column number and column spec local STR = '' - reset_bkt_cnt() + pl.tex.reset_bkt_cnt() local v, h, r, c, mrowsym, skipmakecell = ltt.parse_MagicCell_spec(spec) -- get v/h align, number rows/columns @@ -96,21 +113,23 @@ function ltt.MagicCell(s0,spec,mcspec,pre,content) h, mcspec, c = ltt.get_HColSpec(h, mcspec, c) -- infer horizontal alignment, num columns + ltt.debugtalk(pl.List{v, h, r, c, mcspec}:join'; ','v, h, r, c, mcspec') + --help_wrt(_CurTabColAbv,'current column') if s0 == _xTrue or (pl.List(ltt.SI_cols):contains(ltt.col) -- special columns for SI and c == '') then -- multicolumn cannot have {} around it STR = STR .. '{' -- multirow and makcell must have {} around it S column is used - add_bkt_cnt() + pl.tex.add_bkt_cnt() end if c ~= '' then STR = STR .. "\\multicolumn{"..c.."}{"..mcspec.."}{" - add_bkt_cnt() + pl.tex.add_bkt_cnt() end if r ~= '' then STR = STR .."\\multirow["..v.."]{"..r.."}{"..mrowsym.."}{" -- optional arg here - add_bkt_cnt() + pl.tex.add_bkt_cnt() end if not skipmakecell then @@ -119,14 +138,15 @@ function ltt.MagicCell(s0,spec,mcspec,pre,content) end STR = STR.."\\makecell[{"..v.."}{"..h.."}]{" - add_bkt_cnt() + pl.tex.add_bkt_cnt() else content = content:gsub('\\\\', '\\newline') end - STR = STR..content..close_bkt_cnt() + STR = STR..content..pl.tex.close_bkt_cnt() --Troubleshooting --help_wrt(STR..' <<< magic cell string') + ltt.debugtalk(STR,'MagicCell') tex.sprint(STR)--tex print the STR end @@ -252,6 +272,8 @@ function ltt.make1cmidrule(s, r, c, cmd) -- s=square r=round c=curly c = ltt.get_midrule_col(t[1])..'-'..ltt.get_midrule_col(t[2]) cmd = cmd..'{'..c..'}' --help_wrt(cmd) + + ltt.debugtalk(cmd,'make1cmidrule') tex.print(cmd) end diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.pdf b/macros/luatex/generic/lutabulartools/lutabulartools.pdf Binary files differindex 770fb8045b..bf53cad818 100644 --- a/macros/luatex/generic/lutabulartools/lutabulartools.pdf +++ b/macros/luatex/generic/lutabulartools/lutabulartools.pdf diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.sty b/macros/luatex/generic/lutabulartools/lutabulartools.sty index bb72b660a8..abeb1afdef 100644 --- a/macros/luatex/generic/lutabulartools/lutabulartools.sty +++ b/macros/luatex/generic/lutabulartools/lutabulartools.sty @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2022-02-27 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -23,7 +23,7 @@ % OR OTHER DEALINGS IN THE SOFTWARE. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lutabulartools}[2022-02-27] +\ProvidesPackage{lutabulartools}[2022-04-16] \RequirePackage{booktabs} \RequirePackage{multirow} @@ -33,10 +33,12 @@ \RequirePackage{xcolor} \RequirePackage{colortbl} \RequirePackage{luacode} -\RequirePackage[pl,extras]{penlight} % NEEDED +\RequirePackage{penlight} % NEEDED, extras option must be used so penlight should be loaded before this... \luadirect{lutabt = require('lutabulartools')} +\newcommand{\lttdebugON}{\luadirect{lutabt.debug = true}} +\newcommand{\lttdebugOFF}{\luadirect{lutabt.debug = true}} \newcolumntype{\ltt@ltrim}{@{}} \newcolumntype{\ltt@rtrim}{@{}} diff --git a/macros/luatex/generic/lutabulartools/lutabulartools.tex b/macros/luatex/generic/lutabulartools/lutabulartools.tex index 54af32f78d..8a2b5f8569 100644 --- a/macros/luatex/generic/lutabulartools/lutabulartools.tex +++ b/macros/luatex/generic/lutabulartools/lutabulartools.tex @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2022-02-27 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -57,6 +57,9 @@ \newcommand{\tMC}{\cmd{\\MC}} +\usepackage[pl,extrasnoglobals]{penlight} + + \RequirePackage{lutabulartools} \title{lutabulartools} \subtitle{some useful tabular tools (LuaLaTeX-based)} @@ -64,6 +67,8 @@ \usepackage{tabularx} \usepackage{siunitx} +\lttdebugON + \begin{document} % todo: can improve naming... set col spec to a table instead of a string @@ -99,6 +104,14 @@ you can manually fix it in a \cmd{tabular} with \cmd{!{}} like so: Xyz\\\bottomrule \end{tabular} \end{LTXexample} +\subsection{Debugging} +You can toggle log output debugging with \cmd{\lttdebugON} and \cmd{\lttdebugOFF}. +The messages will be printed in a format like so: +\begin{verbatim} +vvvvv msg1 (lutabulartools) +msg2 +^^^^^ +\end{verbatim} \section{\texttt{\textbackslash MC} -- Magic Cell} \texttt{\textbackslash MC} (magic cell) combines the facilities of diff --git a/macros/luatex/generic/penlight/penlight.pdf b/macros/luatex/generic/penlight/penlight.pdf Binary files differindex 3fcd22c54e..55eda4b6fe 100644 --- a/macros/luatex/generic/penlight/penlight.pdf +++ b/macros/luatex/generic/penlight/penlight.pdf diff --git a/macros/luatex/generic/penlight/penlight.sty b/macros/luatex/generic/penlight/penlight.sty index a73948af29..04cb66a482 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-03-15 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -22,7 +22,7 @@ % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE % OR OTHER DEALINGS IN THE SOFTWARE. -\ProvidesPackage{penlight}[2022-03-15] +\ProvidesPackage{penlight}[2022-04-16] \RequirePackage{luacode} @@ -65,7 +65,7 @@ end }}{ \luadirect{ __PDFmetadata__ = __PDFmetadata__ or {} - table.update(__PDFmetadata__, luakeys.parse(\luastring{#2}) + table.update(__PDFmetadata__, luakeys.parse(\luastring{#2})) writePDFmetadata() }} } diff --git a/macros/luatex/generic/penlight/penlight.tex b/macros/luatex/generic/penlight/penlight.tex index d70fc258f3..f1c07a00cb 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-03-15 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/macros/luatex/generic/penlight/penlightextras.lua b/macros/luatex/generic/penlight/penlightextras.lua index e021567c13..253527cc52 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-03-15 +--% 2022-04-16 --% Copyright (C) 2021-2022 Kale Ewasiuk --% --% Permission is hereby granted, free of charge, to any person obtaining a copy @@ -30,6 +30,7 @@ __PL_EXTRAS__ = 1 -- requires penlight local pl = _G['penlight'] or _G['pl'] -- penlight for this namespace is pl +luakeys = require'luakeys' -- some bonus string operations, % text operator, and functional programming pl.stringx.import() diff --git a/macros/luatex/latex/autopuncitems/autopuncitems.lua b/macros/luatex/latex/autopuncitems/autopuncitems.lua index 07b68e3ed4..4eabc5868d 100644 --- a/macros/luatex/latex/autopuncitems/autopuncitems.lua +++ b/macros/luatex/latex/autopuncitems/autopuncitems.lua @@ -1,5 +1,5 @@ --% Kale Ewasiuk (kalekje@gmail.com) ---% 2022-01-30 +--% 2022-04-16 --% Copyright (C) 2021-2022 Kale Ewasiuk --% --% Permission is hereby granted, free of charge, to any person obtaining a copy @@ -110,4 +110,17 @@ function ap.go(s) return s end +function ap.gotab(s) + -- very simple, does not work if \\ in tabular, doesn't factor in header or footer + local s, c = s:gsub('%s*\\\\', '\0') + if c > 2 then + s = s:gsub('\0', ap.punc[0]..'\\\\', c-2) + end + if c > 1 then + s = s:gsub('\0', ap.punc[2]..'\\\\', 1) + end + s = s:gsub('\0', ap.punc[1]..'\\\\', 1) + return s +end + return ap
\ No newline at end of file diff --git a/macros/luatex/latex/autopuncitems/autopuncitems.pdf b/macros/luatex/latex/autopuncitems/autopuncitems.pdf Binary files differindex c377b41f50..29b5f6d627 100644 --- a/macros/luatex/latex/autopuncitems/autopuncitems.pdf +++ b/macros/luatex/latex/autopuncitems/autopuncitems.pdf diff --git a/macros/luatex/latex/autopuncitems/autopuncitems.sty b/macros/luatex/latex/autopuncitems/autopuncitems.sty index 11a4c66f69..e444adf0d5 100644 --- a/macros/luatex/latex/autopuncitems/autopuncitems.sty +++ b/macros/luatex/latex/autopuncitems/autopuncitems.sty @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2022-01-30 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -23,7 +23,7 @@ % OR OTHER DEALINGS IN THE SOFTWARE. -\ProvidesPackage{autopuncitems}[2022-01-30] +\ProvidesPackage{autopuncitems}[2022-04-16] \RequirePackage{luacode} \RequirePackage{etoolbox} @@ -68,3 +68,6 @@ after=\endAutoPuncItemsE, } } + +\NewDocumentEnvironment{AutoPuncTabular}{ +b }{\luadirect{tex.print(autopuncitems.gotab(\luastringN{#1}))}}{} % does not expand + diff --git a/macros/luatex/latex/autopuncitems/autopuncitems.tex b/macros/luatex/latex/autopuncitems/autopuncitems.tex index e30c85e26f..89552c0db5 100644 --- a/macros/luatex/latex/autopuncitems/autopuncitems.tex +++ b/macros/luatex/latex/autopuncitems/autopuncitems.tex @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2022-01-30 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -208,24 +208,36 @@ If you disable auto-pass nested lists, and don't use \cmd{\APpass}, here is what \end{itemize} \end{LTXexample} -You may want to use the \cmd{AutoPuncItems} environment outside a list environment instead, -say perhaps if you're using the \cmd{beamer}. -Note that nested lists are normally not punctuated, and since the first-level list is inside the environment, it's considered nested. -If you would like to disable the prevention of auto-punctuating all nested lists, use the \cmd{\disableAPprotectnest}. -Note that nested lists will cause an error to occur. - +\subsection{Expanding list contents} \begin{LTXexample} -\disableAPprotectnest -\begin{AutoPuncItems} -\begin{itemize} +\def\listexample{ \item one \item two \item three \item four +} +--will work fine (expand once) +\begin{itemize}[autopuncO] + \listexample \end{itemize} -\end{AutoPuncItems} + +--will throw error + (author to fix this) +%\begin{itemize}[autopuncE] +% \listexample +%\end{itemize} + +--does not give desired result + (no items found) +\begin{itemize}[autopunc] + \listexample +\end{itemize} + \end{LTXexample} + +\subsection{Using the environment} + The normal way to use the environment should be inside the first list, like so. \begin{LTXexample} @@ -240,6 +252,27 @@ The normal way to use the environment should be inside the first list, like so. \end{itemize} \end{LTXexample} +You may want to use the \cmd{AutoPuncItems} environment outside a list environment instead, +say perhaps if you're using the \cmd{beamer}. +Note that nested lists are normally not punctuated, and since the first-level list is inside the environment, it's considered nested. +If you would like to disable the prevention of auto-punctuating all nested lists, use the \cmd{\disableAPprotectnest}. +Note that nested lists will cause an error to occur. + +\begin{LTXexample} +\disableAPprotectnest +\begin{AutoPuncItems} +\begin{itemize} + \item one + \item two + \item three + \item four +\end{itemize} +\end{AutoPuncItems} +\end{LTXexample} + + + + \end{document} diff --git a/macros/luatex/latex/yamlvars/yamlvars.lua b/macros/luatex/latex/yamlvars/yamlvars.lua index b485236d10..a46b47e725 100644 --- a/macros/luatex/latex/yamlvars/yamlvars.lua +++ b/macros/luatex/latex/yamlvars/yamlvars.lua @@ -1,5 +1,5 @@ --% Kale Ewasiuk (kalekje@gmail.com) ---% 2022-03-15 +--% 2022-04-16 --% Copyright (C) 2021-2022 Kale Ewasiuk --% --% Permission is hereby granted, free of charge, to any person obtaining a copy @@ -92,6 +92,24 @@ function YAMLvars.pkgerr(m) end + + +-- todo need distinction beyyween table and penlight list ??? + --val = pl.array2d.map_slice1(_1..'\\\\', val, 1,-2) + --return val:join('') + --return pl.tablex.reduce(_1.._2, val, '') + +function YAMLvars.xfm.markdown(var, val) + --return '\\begin{markdown} '..val..'\n \\end{markdown}' + pl.tex.help_wrt(val, md) + return [[begin markdown ..val.. + + par end markdown]] +end + + + + -- xfm functions (transforms) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- function YAMLvars.xfm.addxspace(var, val) return val .. '\\xspace' @@ -106,15 +124,14 @@ function YAMLvars.xfm.arrsort2ZA(var, val) end function YAMLvars.xfm.addrule2arr(var, val) - return pl.array2d.map_slice2(_1..'\\\\\\'.. YAMLvars.tabmidrule..' ', val, 1,-1,-2,-1) -- todo make gmidrule + return pl.array2d.map_slice2(_1..'\\\\\\'.. YAMLvars.tabmidrule..' ', val, 1,-1,-2,-1) end function YAMLvars.xfm.arr2tabular(var, val) return pl.array2d.toTeX(val)..'\\\\' end - -function YAMLvars.xfm.list2items(var, val) -- todo should be list2item +function YAMLvars.xfm.list2items(var, val) return pl.List(val):map('\\item '.._1):join(' ') end YAMLvars.xfm.arr2itemize = YAMLvars.xfm.list2items @@ -140,7 +157,6 @@ function YAMLvars.xfm.arrsortlastnameAZ(var, val) return val end --- todo need distinction beyyween table and penlight list ??? function YAMLvars.xfm.list2nl(var, val) if type(val) == 'string' then return val @@ -155,29 +171,25 @@ function YAMLvars.xfm.list2and(var, val) -- for doc vars like author, publisher return pl.List(val):join('\\and ') end - --val = pl.array2d.map_slice1(_1..'\\\\', val, 1,-2) - --return val:join('') - --return pl.tablex.reduce(_1.._2, val, '') - -function YAMLvars.xfm.lb2nl(var, val) --linebreak in text 2 new line +function YAMLvars.xfm.lb2nl(var, val) --linebreak in text 2 newline \\ val, _ = val:gsub('\n','\\\\ ') return val end -function YAMLvars.xfm.lowercase(var, val) - return val:lower() +function YAMLvars.xfm.lb2newline(var, val) --linebreak in text 2 newline \\ + val, _ = val:gsub('\n','\\newline ') + return val end - -function YAMLvars.xfm.markdown(var, val) - --return '\\begin{markdown} '..val..'\n \\end{markdown}' - pl.tex.help_wrt(val, md) - return [[begin markdown ..val.. - - par end markdown]] +function YAMLvars.xfm.lb2par(var, val) --linebreak in text 2 new l + val, _ = val:gsub('\n%s*\n','\\par ') + return val end +function YAMLvars.xfm.lowercase(var, val) + return val:lower() +end -- dec laration functions, -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- @@ -211,7 +223,6 @@ function YAMLvars.prc.gdef(var, val) end function YAMLvars.prc.yvdef(var, val) - --token.set_macro('yv--'..var, val, 'global') -- todo fix with csname hack? pl.tex.defmacro('yv--'..var, val) YAMLvars.debugtalk('yv--'..var..' = '..val, 'prc yvdef') end @@ -236,13 +247,11 @@ end - function YAMLvars.prc.setATvar(var, val) -- set a @var directly: eg \gdef\@title{val} pl.tex.defcmdAT('@'..var, val) end - function YAMLvars.prc.setdocvar(var, val) -- call a document var \var{val} = \title{val} -- YAML syntax options -- k: v -> \k{v} @@ -264,10 +273,9 @@ function YAMLvars.prc.setdocvar(var, val) -- call a document var \var{val} = \ti end - function YAMLvars.prc.setPDFdata(var, val) - --update pdf metat data table - -- requires a table + --update pdf meta data table (via penlight), uses pdfx xmpdata + -- requires a table input for k, v in pairs(val) do if type(v) == 'table' then v = pl.List(v):join('\\sep ') @@ -276,9 +284,6 @@ function YAMLvars.prc.setPDFdata(var, val) end end - - - -- with hyperref package function YAMLvars.prc.PDFtitle(var, val) tex.print('\\hypersetup{pdftitle={'..val..'}}') @@ -288,6 +293,13 @@ function YAMLvars.prc.PDFauthor(var, val) tex.print('\\hypersetup{pdfauthor={'..val..'}}') end +-- -- + + +-- ?? +--token.set_macro('yv--'..var, val, 'global') -- todo fix with csname hack? + + -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/macros/luatex/latex/yamlvars/yamlvars.pdf b/macros/luatex/latex/yamlvars/yamlvars.pdf Binary files differindex 6fc0c5ce7e..58f7899f5f 100644 --- a/macros/luatex/latex/yamlvars/yamlvars.pdf +++ b/macros/luatex/latex/yamlvars/yamlvars.pdf diff --git a/macros/luatex/latex/yamlvars/yamlvars.sty b/macros/luatex/latex/yamlvars/yamlvars.sty index 852b0de8cc..92d5fbef2e 100644 --- a/macros/luatex/latex/yamlvars/yamlvars.sty +++ b/macros/luatex/latex/yamlvars/yamlvars.sty @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2022-03-15 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -25,7 +25,7 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{YAMLvars}[2022-03-15] +\ProvidesPackage{YAMLvars}[2022-04-16] \IfFileExists{markdown-tinyyaml.lua}{}{\PackageError{YAMLvars}{This package requires installation of the 'markdown' package, please install it and try again}{}} diff --git a/macros/luatex/latex/yamlvars/yamlvars.tex b/macros/luatex/latex/yamlvars/yamlvars.tex index 344185dd5f..f6aa0893fb 100644 --- a/macros/luatex/latex/yamlvars/yamlvars.tex +++ b/macros/luatex/latex/yamlvars/yamlvars.tex @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2022-03-15 +% 2022-04-16 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -385,5 +385,13 @@ Items: Sunscreen: 5 Hat: 12 \end{verbatim} + + + +\clearpage +\section{xfm, dec, prc functions (from yamlvars.lua)} + +\lstinputlisting[linerange=113-296]{yamlvars.lua} + \end{document} |