summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-12-26 21:24:12 +0000
committerKarl Berry <karl@freefriends.org>2021-12-26 21:24:12 +0000
commit75d213e27f886527da7f88c613f9aa4860332753 (patch)
treedb543cd6fb662dc5a6fae95a12a74560b3c691cd /Master
parentb21cfe3d39f2f88863c9cb3e0f4c64bb44dc13f1 (diff)
codebox (26dec21)
git-svn-id: svn://tug.org/texlive/trunk@61415 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/codebox/README.md68
-rwxr-xr-xMaster/texmf-dist/doc/latex/codebox/build.sh9
-rw-r--r--Master/texmf-dist/doc/latex/codebox/codebox-doc-en.pdfbin0 -> 69553 bytes
-rw-r--r--Master/texmf-dist/doc/latex/codebox/codebox-doc-en.tex380
-rw-r--r--Master/texmf-dist/doc/latex/codebox/codebox.dtx1157
-rw-r--r--Master/texmf-dist/doc/latex/codebox/codebox.pdfbin0 -> 280271 bytes
-rw-r--r--Master/texmf-dist/doc/latex/codebox/ctxdoc-en.cls883
-rwxr-xr-xMaster/texmf-dist/doc/latex/codebox/hellojava.java5
-rwxr-xr-xMaster/texmf-dist/doc/latex/codebox/hellopy.py32
-rw-r--r--Master/texmf-dist/doc/latex/codebox/test.c9
-rw-r--r--Master/texmf-dist/tex/latex/codebox/codebox.sty393
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds3
-rw-r--r--Master/tlpkg/tlpsrc/codebox.tlpsrc0
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
15 files changed, 2941 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/codebox/README.md b/Master/texmf-dist/doc/latex/codebox/README.md
new file mode 100644
index 00000000000..f5372b8900a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/README.md
@@ -0,0 +1,68 @@
+Create code box and viewer based on tcolorbox and minted/listings
+=======
+
+`codebox` is a LaTeX3 package developed based on tcolorbox and minted/listings, which provides environments `codebox` and `codeview` to typset with environment body, and macros `\codefile` and `\cvfile` to typeset programming source code from a file in a fancy box.
+
+The starred version of all environments and macros are provided at the same time, such as `codebox*`, `codeview*`, `\codefile*` and `\cvfile*` which adds comment at bottom of the fancy box.
+
+You can read the manual (in Chinese/English) for more details and examples.
+
+Contributing
+------------
+
+1. github repository:
+ 1. repository: [codebox](https://github.com/registor/codebox)
+ 2. Issues and pull requests are welcome. [issue](https://github.com/registor/codebox/issues) or [pull request](https://github.com/registor/codebox/pulls).
+
+2. gitee repository:
+ 1. repository: [codebox](https://gitee.com/nwafu_nan/codebox)
+ 2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/codebox/issues) or [pull request](https://gitee.com/nwafu_nan/codebox/pulls).
+
+基于tcolorbox的终端模拟宏包
+=======
+
+`codebox`是一个基于tcolorbox的用LaTeX3开发的终端模拟LaTeX宏包,它提供了用于排版程序源代码盒子的环境和命令。
+
+其中`codebox`和`codeview`环境用于根据环境内容排版代码,`\codefile`和`\cvfile`命令用于根据文件内容排版代码。
+
+`codebox`同时提供了各环境和命令的星号版本,如`codebox*`和`codeview*`,`\codefile*`和`\cvfile*`,用于为代码盒子添加底线注释。
+
+可以通过阅读宏包手册(中文/英文)以也解该宏包更多的使用细节和使用样例。
+
+### 参与贡献
+---------------------
+
+1. github仓库:
+ (1). 仓库地址: [codebox](https://github.com/registor/codebox)
+ (2). Issues和PR: [issue](https://github.com/registor/codebox/issues) or [pull request](https://github.com/registor/codebox/pulls).
+
+2. gitee仓库:
+ (1). 仓库地址: [codebox](https://gitee.com/nwafu_nan/codebox)
+ (2). Issues and PR: [issue](https://gitee.com/nwafu_nan/codebox/issues) or [pull request](https://gitee.com/nwafu_nan/codebox/pulls).
+
+Copyright and Licence
+---------------------
+
+ Copyright (C) 2020-2021 by Nan Geng <nangeng@nwafu.edu.cn>
+ ----------------------------------------------------------------------
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either
+ version 1.3c of this license or (at your option) any later
+ version. This version of this license is in
+ http://www.latex-project.org/lppl/lppl-1-3c.txt
+ and the latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+ and version 1.3 or later is part of all distributions of
+ LaTeX version 2005/12/01 or later.
+
+ This work has the LPPL maintenance status "maintained".
+
+ The Current Maintainer of this work is Nan Geng.
+
+ This package consists of the file codebox.dtx,
+ and the derived files codebox.sty,
+ codebox.pdf,
+ codebox.ins,
+ README.md (this file).
+
diff --git a/Master/texmf-dist/doc/latex/codebox/build.sh b/Master/texmf-dist/doc/latex/codebox/build.sh
new file mode 100755
index 00000000000..433e777e390
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/build.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+xetex codebox.dtx &&\
+xelatex -shell-escape codebox.dtx &&\
+makeindex -s gind.ist -o codebox.ind codebox.idx &&\
+makeindex -s gglo.ist -o codebox.gls codebox.glo &&\
+xelatex -shell-escape codebox.dtx &&\
+xelatex -shell-escape codebox.dtx &&\
+xelatex -shell-escape codebox.dtx
diff --git a/Master/texmf-dist/doc/latex/codebox/codebox-doc-en.pdf b/Master/texmf-dist/doc/latex/codebox/codebox-doc-en.pdf
new file mode 100644
index 00000000000..50fca38b0a7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/codebox-doc-en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/codebox/codebox-doc-en.tex b/Master/texmf-dist/doc/latex/codebox/codebox-doc-en.tex
new file mode 100644
index 00000000000..cf4232e0880
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/codebox-doc-en.tex
@@ -0,0 +1,380 @@
+\documentclass{ctxdoc-en}
+\usepackage{minted}
+\usepackage{listings}
+\usepackage{xcolor}
+\usepackage{xcolor-material}
+\usepackage{codebox}
+
+\renewcommand{\thecodecounter}{\thesection.\arabic{codecounter}}
+\NewDocumentCommand{\init}{+v}{\hspace{\fill}Init~=~\textcolor{blue}{\bfseries#1}}
+\DeclareDocumentCommand\opt{m}{\texttt{#1}}
+\DeclareDocumentCommand\kvopt{mm}
+ {\texttt{#1\breakablethinspace=\breakablethinspace#2}}
+\def\breakablethinspace{\hskip 0.16667em\relax}
+
+\title{\bfseries\pkg{codebox}:programming code box}
+\author{Nan Geng\\ \url{nangeng@nwafu.edu.cn}}
+\date{2021/12/26\qquad v1.0.0\thanks{\url{https://github.com/registor/codebox}}
+\thanks{\url{https://gitee.com/nwafu_nan/codebox}}}
+
+\begin{document}
+
+\maketitle
+
+\begin{abstract}
+
+\pkg{codebox} is a \pkg{tcolorbox}-based package developed with \LaTeX3,
+which provides environments \env{codebox} and \env{codeview}, and macros
+\tn{codefile} and \tn{cvfile} for typsetting programming source code box.
+
+The environments create codebox with it's body and
+macros is used to read in the source code file and output is in the codebox.
+
+The starred environments and macros are also provided
+to get codebox with comments at the bottom of box.
+
+All codebox style can be setted by \tn{codeset} macro
+or environment's and macro's key-value \oarg{options}.
+
+\end{abstract}
+
+\tableofcontents
+
+\section{introduction}
+
+\pkg{codebox} is a \LaTeX3 package for typesetting programming source code box.
+
+Both \env{codebox} and \env{codeview} environment are provided with enironment body.
+At the same time, both \tn{codefile} and \tn{cvfile} macros are created
+for reading source code file.
+
+The starred environments(\env{codebox*} and \env{codeview*}) and
+macros(\tn{codefile*} and \tn{cvfile*}) are also provided
+to get codebox with comments at the bottom of box.
+
+\section{interface}
+
+\subsection{\env{codebox} and \env{codebox*} environments}
+
+\begin{function}[added=2021-12-25,updated=2021-12-25]{codebox,codebox*}
+ \begin{syntax}
+ \tn{begin}\{codebox\}\oarg{options}\Arg{codebox title}
+ .....
+ \tn{end}\{codebox\}
+ \tn{begin}\{codebox*\}\oarg{options}\Arg{codebox title}
+ .....
+ \tn{end}\{codebox*\}
+ \end{syntax}
+ Typesetting codebox with environment body.
+ You can set the title of the codebox with \Arg{codebox title}.
+
+ The appearance of the codebox is set by key-value in \oarg{options}.
+
+ The starred environment \env{codebox*} is used to add comments at the bottom of the codebox,
+ note that this needs to be done with \kvopt{\meta{comments}}{\meta{texts}} in \oarg{options}.
+
+ Of course the key-value \oarg{options} can alse be set
+ via the comma-separated key-value list of the \tn{codeset} macro.
+\end{function}
+
+\begin{Verbatim}[frame=none,numbers=left,gobble=2]
+ \centering
+ \begin{codebox}{CodeBox Title}
+ #include <stdio.h>
+ #include <stdlib.h>
+
+ int main(void)
+ {
+ printf("Hello World!\n");
+
+ return 0;
+ }
+ \end{codebox}
+\end{Verbatim}
+
+\begin{center}
+ \begin{minipage}{0.85\textwidth}
+ \begin{codebox}{CodeBox Title}
+ #include <stdio.h>
+ #include <stdlib.h>
+
+ int main(void)
+ {
+ printf("Hello World!\n");
+
+ return 0;
+ }
+ \end{codebox}
+ \end{minipage}
+\end{center}
+
+\subsection{\tn{codefile} and \tn{codefile*} macros}
+
+\begin{function}[added=2021-12-25,updated=2021-12-25]{\codefile,\codefile*}
+ \begin{syntax}
+ \tn{codefile} \oarg{options} \Arg{codebox title} \Arg{code file}
+ \tn{codefile*} \oarg{options} \Arg{codebox title} \Arg{code file}
+ \end{syntax}
+ Typesetting codebox from a source code file.
+ You can set the title of the codebox with \Arg{codebox title}.
+
+ The appearance of the codebox is set by key-value in \oarg{options}.
+
+ The starred environment \tn{codefile*} is used to add comments at the bottom of the codebox,
+ note that this needs to be done with \kvopt{\meta{comments}}{\meta{texts}} in \oarg{options}.
+
+ Of course the key-value \oarg{options} can alse be set
+ via the comma-separated key-value list of the \tn{codeset} macro.
+\end{function}
+\newpage
+\begin{Verbatim}[frame=none,numbers=left,gobble=2]
+ \centering
+ \codefile{CodeBox Title}{test.c}
+\end{Verbatim}
+
+\begin{center}
+ \begin{minipage}{0.85\textwidth}
+ \codefile{CodeBox Title}{test.c}
+ \end{minipage}
+\end{center}
+
+\subsection{\env{codeview} and \env{codeview*} environments}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{codeview,codeview*}
+ \begin{syntax}
+ \tn{begin}\{codeview\}\oarg{options}\Arg{codeview title}
+ .....
+ \tn{end}\{codeview\}
+ \tn{begin}\{codeview*\}\oarg{options}\Arg{codeview title}
+ .....
+ \tn{end}\{codeview*\}
+ \end{syntax}
+ Typesetting code viewer with environment body.
+ You can set the title of the code viewer with \Arg{codeview title}.
+
+ The appearance of the code viewer is set by key-value in \oarg{options}.
+
+ The starred environment \env{codeview*} is used to add comments at the bottom of the codebox,
+ note that this needs to be done with \kvopt{\meta{comments}}{\meta{texts}} in \oarg{options}.
+
+ Of course the key-value \oarg{options} can alse be set
+ via the comma-separated key-value list of the \tn{codeset} macro.
+\end{function}
+
+\begin{Verbatim}[frame=none,numbers=left,gobble=2]
+ \centering
+ \begin{codeview}{CodeViewer Title}
+ #include <stdio.h>
+ #include <stdlib.h>
+
+ int main(void)
+ {
+ printf("Hello World!\n");
+
+ return 0;
+ }
+ \end{codeview}
+\end{Verbatim}
+
+\begin{center}
+ \begin{minipage}{0.85\textwidth}
+ \begin{codeview}{CodeViewer Title}
+ #include <stdio.h>
+ #include <stdlib.h>
+
+ int main(void)
+ {
+ printf("Hello World!\n");
+
+ return 0;
+ }
+ \end{codeview}
+ \end{minipage}
+\end{center}
+
+\subsection{\tn{cvfile} and \tn{cvfile*} macros}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{\cvfile,\cvfile*}
+ \begin{syntax}
+ \tn{cvfile} \oarg{options} \Arg{codeview title} \Arg{code file}
+ \tn{cvfile*} \oarg{options} \Arg{codeview title} \Arg{code file}
+ \end{syntax}
+ Typesetting code viewer from a source code file.
+ You can set the title of the code viewer with \Arg{codeview title}.
+
+ The appearance of the code viewer is set by key-value in \oarg{options}.
+
+ The starred environment \tn{vcfile*} is used to add comments at the bottom of the codebox,
+ note that this needs to be done with \kvopt{\meta{comments}}{\meta{texts}} in \oarg{options}.
+
+ Of course the key-value \oarg{options} can alse be set
+ via the comma-separated key-value list of the \tn{codeset} macro.
+\end{function}
+
+\begin{Verbatim}[frame=none,numbers=left,gobble=2]
+ \centering
+ \cvfile*[comments=this is a simple C code]{CodeViewer Title}{test.c}
+\end{Verbatim}
+
+\begin{center}
+ \begin{minipage}{0.85\textwidth}
+ \cvfile*[comments=this is a simple C code]{CodeViewer Title}{test.c}
+ \end{minipage}
+\end{center}
+
+\section{Options}
+
+The \pkg{codebox} package provides a number of options to set the style of the codebox.
+The following options can be set with \tn{codeset} macro.
+Also, these options can be set with the all environment's
+or command's \oarg{options}.
+
+\subsection{code engine}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{minted}
+ \begin{syntax}
+ minted = <\TTF> \init{true}
+ \end{syntax}
+ \opt{minted} is used to set code highlight engine, if it is \textbf{true} then
+ the \pkg{minted} package is used, if it is \textbf{false} then
+ the \pkg{listings} package is used. The default is \textbf{true}.
+\end{function}
+
+\subsection{language}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{lang}
+ \begin{syntax}
+ lang = \Arg{source code language} \init{C}
+ \end{syntax}
+ \opt{lang} is used to set source code language.
+ The default is \textbf{C}.
+\end{function}
+
+\subsection{title prefix}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{pretitle}
+ \begin{syntax}
+ pretitle = \Arg{title prefix} \init{Code}
+ \end{syntax}
+ \opt{pretitle} is used to set prefix of code counter.
+ The default is \textbf{Code}。
+\end{function}
+
+\subsection{code highlight style}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{codestyle}
+ \begin{syntax}
+ codestyle = \Arg{highlight style} \init{codeblocks}
+ \end{syntax}
+ \opt{codestyle} is used to set code highlight style, valid only for the \pkg{minted} engine.
+ The default is \textbf{codeblocks}.
+\end{function}
+
+\subsection{code fontsize}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{codesize}
+ \begin{syntax}
+ codesize = \Arg{fontsize macro} \init{\small}
+ \end{syntax}
+ \opt{codesize} is used to set code fontsize, valid only for \pkg{minted} engine.
+ The default is\textbf{\tn{small}}.
+\end{function}
+
+\subsection{comment contents}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{comments}
+ \begin{syntax}
+ comments = \Arg{texts} \init{nothing}
+ \end{syntax}
+ \opt{comments} is used to set comment contents.
+ The default is \textbf{nothing}.
+\end{function}
+
+\subsection{comment format}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{commentf}
+ \begin{syntax}
+ commentf = \Arg{format macros} \init{\small\sffamily}
+ \end{syntax}
+ \opt{commentf} is used to set comment format at codebox bottom.
+ The default is \textbf{\tn{small}\tn{sffamily}}.
+\end{function}
+
+\subsection{code baseline stretch}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{codestretch}
+ \begin{syntax}
+ codestretch = \Arg{float number} \init{1.0}
+ \end{syntax}
+ \opt{codestretch} is used to set code baseline stretch, valid only for \pkg{minted} engine.
+ The default is\textbf{1.0}.
+\end{function}
+
+\subsection{seperation between line number and code}
+
+\begin{function}[added=2021-12-26,updated=2021-12-26]{linenumsep}
+ \begin{syntax}
+ linenumsep = \Arg{float number} \init{3.0}
+ \end{syntax}
+ \opt{linenumsep} is used to set the seperation between line number and code,
+ valid only for \pkg{minted} engine.
+ Note the unit is mm.
+ The default is\textbf{3.0}.
+\end{function}
+
+\section{Examples}
+
+The \pkg{codebox} package can be used in situations
+where the highlight programming source code needs to be typeset
+to avoid the use of screenshots.
+Code box can be with or without underline comments.
+
+\newpage
+
+\subsection{Java code}
+The language can be set with \tn{codeset} macro.
+
+\begin{Verbatim}[frame=none,numbers=left,gobble=2]
+ \centering
+ \codeset{lang=java}
+ \codefile{Java CodeBox}{hellojava.java}
+\end{Verbatim}
+
+\begin{center}
+ \begin{minipage}{0.85\textwidth}
+ \codeset{lang=java}
+ \codefile{Java CodeBox}{hellojava.java}
+ \end{minipage}
+\end{center}
+
+\subsection{Python code}
+The language can be set with \opt{options}.
+
+\begin{Verbatim}[frame=none,numbers=left,gobble=2]
+ \centering
+ \cvfile[lang=python]{Python CodeBox}{hellopy.py}
+\end{Verbatim}
+
+\begin{center}
+ \begin{minipage}{0.85\textwidth}
+ \cvfile[lang=python]{Python CodeBox}{hellopy.py}
+ \end{minipage}
+\end{center}
+
+\newpage
+
+\subsection{listings engine}
+\pkg{listings} engine can be set with \kvopt{\meta{minted}}{\meta{false}}.
+
+\begin{Verbatim}[frame=none,numbers=left,gobble=2]
+ \centering
+ \cvfile[minted=false,lang=c]{C CodeBox}{test.c}
+\end{Verbatim}
+
+\begin{center}
+ \begin{minipage}{0.85\textwidth}
+ \cvfile[minted=false,lang=c]{C CodeBox}{test.c}
+ \end{minipage}
+\end{center}
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/codebox/codebox.dtx b/Master/texmf-dist/doc/latex/codebox/codebox.dtx
new file mode 100644
index 00000000000..fb9168b1338
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/codebox.dtx
@@ -0,0 +1,1157 @@
+% \iffalse meta-comment
+% !TEX program = XeLaTeX
+%<*internal>
+\iffalse
+%</internal>
+%<*readme>
+Create code box and viewer based on tcolorbox and minted/listings
+=======
+
+`codebox` is a LaTeX3 package developed based on tcolorbox and minted/listings, which provides environments `codebox` and `codeview` to typset with environment body, and macros `\codefile` and `\cvfile` to typeset programming source code from a file in a fancy box.
+
+The starred version of all environments and macros are provided at the same time, such as `codebox*`, `codeview*`, `\codefile*` and `\cvfile*` which adds comment at bottom of the fancy box.
+
+You can read the manual (in Chinese/English) for more details and examples.
+
+Contributing
+------------
+
+1. github repository:
+ 1. repository: [codebox](https://github.com/registor/codebox)
+ 2. Issues and pull requests are welcome. [issue](https://github.com/registor/codebox/issues) or [pull request](https://github.com/registor/codebox/pulls).
+
+2. gitee repository:
+ 1. repository: [codebox](https://gitee.com/nwafu_nan/codebox)
+ 2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/codebox/issues) or [pull request](https://gitee.com/nwafu_nan/codebox/pulls).
+
+基于tcolorbox的终端模拟宏包
+=======
+
+`codebox`是一个基于tcolorbox的用LaTeX3开发的终端模拟LaTeX宏包,它提供了用于排版程序源代码盒子的环境和命令。
+
+其中`codebox`和`codeview`环境用于根据环境内容排版代码,`\codefile`和`\cvfile`命令用于根据文件内容排版代码。
+
+`codebox`同时提供了各环境和命令的星号版本,如`codebox*`和`codeview*`,`\codefile*`和`\cvfile*`,用于为代码盒子添加底线注释。
+
+可以通过阅读宏包手册(中文/英文)以也解该宏包更多的使用细节和使用样例。
+
+### 参与贡献
+---------------------
+
+1. github仓库:
+ (1). 仓库地址: [codebox](https://github.com/registor/codebox)
+ (2). Issues和PR: [issue](https://github.com/registor/codebox/issues) or [pull request](https://github.com/registor/codebox/pulls).
+
+2. gitee仓库:
+ (1). 仓库地址: [codebox](https://gitee.com/nwafu_nan/codebox)
+ (2). Issues and PR: [issue](https://gitee.com/nwafu_nan/codebox/issues) or [pull request](https://gitee.com/nwafu_nan/codebox/pulls).
+
+Copyright and Licence
+---------------------
+
+ Copyright (C) 2020-2021 by Nan Geng <nangeng@nwafu.edu.cn>
+ ----------------------------------------------------------------------
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either
+ version 1.3c of this license or (at your option) any later
+ version. This version of this license is in
+ http://www.latex-project.org/lppl/lppl-1-3c.txt
+ and the latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+ and version 1.3 or later is part of all distributions of
+ LaTeX version 2005/12/01 or later.
+
+ This work has the LPPL maintenance status "maintained".
+
+ The Current Maintainer of this work is Nan Geng.
+
+ This package consists of the file codebox.dtx,
+ and the derived files codebox.sty,
+ codebox.pdf,
+ codebox.ins,
+ README.md (this file).
+
+%</readme>
+%<*internal>
+\fi
+\begingroup
+ \def\temp{LaTeX2e}
+\expandafter\endgroup\ifx\temp\fmtname\else
+\csname fi\endcsname
+%</internal>
+%<*install>
+
+\input ctxdocstrip %
+
+\let\MetaPrefix\relax
+
+\preamble
+
+ Copyright (C) 2020-2021 by Nan Geng <nangeng@nwafu.edu.cn>
+--------------------------------------------------------------------------
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either
+ version 1.3c of this license or (at your option) any later
+ version. This version of this license is in
+ http://www.latex-project.org/lppl/lppl-1-3c.txt
+ and the latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+ and version 1.3 or later is part of all distributions of
+ LaTeX version 2005/12/01 or later.
+
+ This work has the LPPL maintenance status "maintained".
+
+ The Current Maintainer of this work is Nan Geng.
+
+--------------------------------------------------------------------------
+
+\endpreamble
+
+\postamble
+
+ This package consists of the file codebox.dtx,
+ and the derived files codebox.sty,
+ codebox.pdf,
+ codebox.ins,
+ README.md.
+\endpostamble
+
+\declarepostamble\emptypostamble
+\endpostamble
+
+\def\MetaPrefix{-- }
+
+
+\let\MetaPrefix\DoubleperCent
+
+\generate
+ {
+%</install>
+%<*internal>
+ \usedir{source/xelatex/codebox}
+ \file{codebox.ins} {\from{\jobname.dtx}{install}}
+%</internal>
+%<*install>
+ \usedir{xetex/xelatex/codebox}
+ \file{codebox.sty} {\from{\jobname.dtx}{package}}
+ \nopreamble\nopostamble
+ \usedir{doc/xelatex/codebox}
+ \file{README.md} {\from{\jobname.dtx}{readme}}
+ }
+
+\endbatchfile
+%</install>
+%<*internal>
+\fi
+%</internal>
+%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
+%<package>\RequirePackage{expl3}
+%<+package>\GetIdInfo$Id: codebox.dtx 1.0.0 2021-12-26 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
+%<package> {Code Box with tcolorbox and minted/listings.}
+%<package>\ProvidesExplPackage{\ExplFileName}
+%<package> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
+%<*driver>
+\documentclass{ctxdoc}
+\usepackage{minted}
+\usepackage{listings}
+\usepackage{xcolor}
+\usepackage{xcolor-material}
+\usepackage{codebox}
+\renewcommand{\thecodecounter}{\thesection.\arabic{codecounter}}
+\renewcommand*\marg[1]{\{\meta{#1}\}}
+\renewcommand*\oarg[1]{[\meta{#1}]}
+\renewcommand*\parg[1]{(\meta{#1})}
+\NewDocumentCommand{\init}{+v}{\hspace{\fill}初始值~=~\textcolor{blue}{\bfseries#1}}
+\DeclareDocumentCommand\opt{m}{\texttt{#1}}
+\DeclareDocumentCommand\kvopt{mm}
+ {\texttt{#1\breakablethinspace=\breakablethinspace#2}}
+\def\breakablethinspace{\hskip 0.16667em\relax}
+\begin{document}
+%<!--CODEDOC--> \DisableImplementation
+ \EnableImplementation
+ \DocInput{\jobname.dtx}
+ \IndexLayout
+ \PrintChanges
+ \PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \changes{v1.0.0}{2021/12/25}{开始编写模板}
+%
+% \CheckSum{309}
+% \GetFileId{codebox.sty}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \title{\bfseries\pkg{codebox}:代码盒子排版宏包\\ \bfseries\pkg{codebox}:progrmming source code box}
+% \author{耿楠\\ \path{nangeng@nwafu.edu.cn}}
+% \date{\filedate\qquad\fileversion\thanks{\url{https://github.com/registor/codebox}}\thanks{\url{https://gitee.com/nwafu_nan/codebox}}}
+% \maketitle
+%
+% \begin{documentation}
+%
+% \begin{abstract}
+%
+% \pkg{codebox} 是一个基于\pkg{tcolorbox}用\LaTeX3 开发的 \LaTeX 宏包,它提供用于
+% 排版源代码盒子的环境和命令。
+% 其中,\env{codebox}和\env{codeview}环境用于根据环境内容排版代码,
+% \tn{codefile}和\tn{cvfile}命令用于根据文件内容排版代码。
+% 同时,\pkg{codebox}还提供了各环境和命令的星号版本,
+% 如\env{codebox*}和\env{codeview*},\tn{codefile*}和\tn{cvfile*},
+% 用于为代码盒子添加底线注释。
+%
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \section{简介}
+%
+% \pkg{codebox} 是一个基于\pkg{tcolorbox}用\LaTeX3 开发的 \LaTeX 宏包,
+% 它可以根据用户设置使用\pkg{minted}或\pkg{listings}宏包实现代码盒子排版。
+%
+% 该宏包提供了\env{codebox}和\env{codeview}两个环境和
+% \tn{codefile}和\tn{cvfile}两个命令以排版代码盒子。
+%
+% 同时,\pkg{codebox}宏包还提供环境和命令的星号版本,
+% 用于为代码盒子添加底线注释。
+%
+% \section{用户接口}
+%
+% \subsection{\env{codebox}和\env{codebox*}环境}
+%
+% \begin{function}[added=2021-12-25,updated=2021-12-25]{codebox,codebox*}
+% \begin{syntax}
+% \tn{begin}\{codebox\}\oarg{外观选项}\Arg{盒子标题}
+% .....
+% \tn{end}\{codebox\}
+% \tn{begin}\{codebox*\}\oarg{外观选项}\Arg{盒子标题}
+% .....
+% \tn{end}\{codebox*\}
+% \end{syntax}
+% 使用环境内容排版代码盒子。
+% 可以通过\Arg{盒子标题}为代码盒子设置标题。
+%
+% \oarg{外观选项}中通过key-value方式设置代码盒子外观。
+%
+% 星号环境\texttt{codebox*}用于为代码盒子添加底线注释,
+% 此时,需要在\oarg{外观选项}中用
+% \kvopt{\meta{comments}}{\meta{底线注释}}选项提供\textbf{底线注释}内容。
+%
+% 代码盒子的外观也可以通过\tn{codeset}命令的逗号分隔
+% key-value列表进行设置。
+%
+% \end{function}
+% \begin{Verbatim}[frame=none,numbers=left,gobble=5]
+% \centering
+% \begin{codebox}{代码标题}
+% #include <stdio.h>
+% #include <stdlib.h>
+%
+% int main(void)
+% {
+% printf("Hello World!\n");
+%
+% return 0;
+% }
+% \end{codebox}
+% \end{Verbatim}
+%
+% \begin{center}
+% \begin{minipage}{0.85\textwidth}
+% \codefile{代码盒子标题}{test.c}
+% \end{minipage}
+% \end{center}
+%
+% \subsection{\tn{codefile}和\tn{codefile*}命令}
+%
+% \begin{function}[added=2021-12-25,updated=2021-12-25]{\codefile,\codefile*}
+% \begin{syntax}
+% \tn{codefile} \oarg{外观选项} \Arg{盒子标题} \Arg{代码文件}
+% \tn{codefile*} \oarg{外观选项} \Arg{盒子标题} \Arg{代码文件}
+% \end{syntax}
+%
+% 用于排版代码盒子,源代码来自于\Arg{代码文件},
+% 可以通过\Arg{盒子标题}为代码盒子设置标题。
+%
+% \oarg{外观选项}中通过key-value方式设置代码盒子外观。
+%
+% 星号命令\texttt{codefile*}用于为代码盒子添加底线注释,
+% 此时,需要在\oarg{外观选项}中用
+% \kvopt{\meta{comments}}{\meta{底线注释}}选项提供\textbf{底线注释}内容。
+%
+% 代码盒子的外观也可以通过\tn{codeset}命令的逗号分隔
+% key-value列表进行设置。
+% \end{function}
+%
+% \newpage
+% \begin{Verbatim}[frame=none,numbers=left,gobble=5]
+% \centering
+% \codefile{代码盒子标题}{test.c}
+% \end{Verbatim}
+%
+% \begin{center}
+% \begin{minipage}{0.85\textwidth}
+% \codefile{代码盒子标题}{test.c}
+% \end{minipage}
+% \end{center}
+%
+% \subsection{\env{codeview}和\env{codeview*}环境}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{codeview,codeview*}
+% \begin{syntax}
+% \tn{begin}\{codeview\}\oarg{外观选项}\Arg{盒子标题}
+% .....
+% \tn{end}\{codeview\}
+% \tn{begin}\{codeview*\}\oarg{外观选项}\Arg{盒子标题}
+% .....
+% \tn{end}\{codeview*\}
+% \end{syntax}
+% 使用环境内容排版带编号代码盒子。
+% 可以通过\Arg{盒子标题}为代码盒子设置标题。
+%
+% \oarg{外观选项}中通过key-value方式设置代码盒子外观。
+%
+% 星号环境\texttt{codeview*}用于为代码盒子添加底线注释,
+% 此时,需要在\oarg{外观选项}中用
+% \kvopt{\meta{comments}}{\meta{底线注释}}选项提供\textbf{底线注释}内容。
+%
+% 代码盒子的外观也可以通过\tn{codeset}命令的逗号分隔
+% key-value列表进行设置。
+% \end{function}
+%
+% \begin{Verbatim}[frame=none,numbers=left,gobble=5]
+% \centering
+% \begin{codeview}{代码标题}
+% #include <stdio.h>
+% #include <stdlib.h>
+%
+% int main(void)
+% {
+% printf("Hello World!\n");
+%
+% return 0;
+% }
+% \end{codeview}
+% \end{Verbatim}
+%
+% \codeset{pretitle=代码}
+% \begin{center}
+% \begin{minipage}{0.85\textwidth}
+% \cvfile{代码标题}{test.c}
+% \end{minipage}
+% \end{center}
+%
+% \subsection{\tn{cvfile}和\tn{cvfile*}命令}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{\cvfile,\cvfile*}
+% \begin{syntax}
+% \tn{cvfile} \oarg{外观选项} \Arg{盒子标题} \Arg{代码文件}
+% \tn{cvfile*} \oarg{外观选项} \Arg{盒子标题} \Arg{代码文件}
+% \end{syntax}
+%
+% 用于排版带编号代码盒子,源代码来自于\Arg{代码文件},
+% 可以通过\Arg{盒子标题}为代码盒子设置标题。
+%
+% \oarg{外观选项}中通过key-value方式设置代码盒子外观。
+%
+% 星号命令\texttt{cvfile*}用于为代码盒子添加底线注释,
+% 此时,需要在\oarg{外观选项}中用
+% \kvopt{\meta{comments}}{\meta{底线注释}}选项提供\textbf{底线注释}内容。
+%
+% 代码盒子的外观也可以通过\tn{codeset}命令的逗号分隔
+% key-value列表进行设置。
+% \end{function}
+%
+% \begin{Verbatim}[frame=none,numbers=left,gobble=5]
+% \centering
+% \cvfile*[comments=这是一个简单的C语言代码]{代码标题}{test.c}
+% \end{Verbatim}
+%
+% \begin{center}
+% \begin{minipage}{0.85\textwidth}
+% \cvfile*[comments=这是一个简单的C语言代码]{代码标题}{test.c}
+% \end{minipage}
+% \end{center}
+%
+% \section{选项说明}
+%
+% \pkg{codebox}宏包提供了一系列选项,以设置代码盒子的外观样式。
+% 载入\pkg{codebox}宏包后,以下选项均可通过用户接口命令\tn{codeset}进行设置。
+% 当然,这些选项也可以通过各个环境或命令的\oarg{外观选项}进行设置。
+%
+% \subsection{代码引擎}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{minted}
+% \begin{syntax}
+% minted = <\TTF> \init{true}
+% \end{syntax}
+% \opt{minted} 用于设置代码排版引擎,如为\textbf{true}则使用\pkg{minted}宏包
+% 排版代码盒子中的内容,如为\textbf{false}则使用\pkg{listings}宏包排版
+% 代码盒子中的内容。默认值为\textbf{true}。
+% \end{function}
+%
+% \subsection{代码语言}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{lang}
+% \begin{syntax}
+% lang = \Arg{代码语言} \init{C}
+% \end{syntax}
+% \opt{lang} 用于设置代码语言,默认值为\textbf{C语言}。
+% \end{function}
+%
+% \subsection{代码名称}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{pretitle}
+% \begin{syntax}
+% pretitle = \Arg{代码名称} \init{Code}
+% \end{syntax}
+% \opt{pretitle} 用于代码编号前的代码名称前缀,默认值为\textbf{Code}。
+% \end{function}
+%
+% \subsection{代码样式}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{codestyle}
+% \begin{syntax}
+% codestyle = \Arg{代码样式} \init{codeblocks}
+% \end{syntax}
+% \opt{codestyle} 用于设置代码盒子中代码的样式,仅对\textbf{minted}
+% 引擎有效,默认值为\textbf{codeblocks}。
+% \end{function}
+%
+% \subsection{代码字号}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{codesize}
+% \begin{syntax}
+% codesize = \Arg{字号命令} \init{\small}
+% \end{syntax}
+% \opt{codesize} 用于设置代码盒子中代码的字号,仅对\textbf{minted}
+% 引擎有效,默认值为\textbf{\tn{small}}。
+% \end{function}
+%
+% \subsection{底线注释内容}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{comments}
+% \begin{syntax}
+% comments = \Arg{注释内容} \init{无}
+% \end{syntax}
+% \opt{commentf} 用于设置代码盒子底线注释的内容,
+% 默认值为\textbf{无}。
+% \end{function}
+%
+% \subsection{底线注释格式}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{commentf}
+% \begin{syntax}
+% commentf = \Arg{格式命令组} \init{\small\sffamily}
+% \end{syntax}
+% \opt{commentf} 用于设置代码盒子底线注释的格式,
+% 默认值为\textbf{\tn{small}\tn{sffamily}}。
+% \end{function}
+%
+% \subsection{代码行距}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{codestretch}
+% \begin{syntax}
+% codestretch = \Arg{浮点数} \init{1.0}
+% \end{syntax}
+% \opt{codestretch} 用于设置代码盒子内容(代码)的行距,仅对\textbf{minted}
+% 引擎有效,取浮点数。默认值为\textbf{1.0}。
+% \end{function}
+%
+% \subsection{行号间距}
+%
+% \begin{function}[added=2021-12-26,updated=2021-12-26]{linenumsep}
+% \begin{syntax}
+% linenumsep = \Arg{浮点数} \init{3.0}
+% \end{syntax}
+% \opt{linenumsep} 用于设置代码盒子行号与代码的间距,仅对\textbf{minted}
+% 引擎有效,取浮点数,单位是mm。默认值为\textbf{3.0}。
+% \end{function}
+%
+% \newpage
+% \section{排版样例}
+%
+% \pkg{codebox}宏包可用于需要语法高亮代码排版场合,
+% 以避免使用代码截图。代码盒子可以带/不带底线注释。
+%
+% \subsection{Java代码}
+% 可以使用\tn{codeset}命令设置代码语言。
+%
+% \begin{Verbatim}[frame=none,numbers=left,gobble=5]
+% \centering
+% \codeset{lang=java}
+% \codefile{Java代码盒子}{hellojava.java}
+% \end{Verbatim}
+%
+% \begin{center}
+% \begin{minipage}{0.85\textwidth}
+% \codeset{lang=java}
+% \codefile{Java代码盒子}{hellojava.java}
+% \end{minipage}
+% \end{center}
+%
+% \subsection{Python代码}
+% 还可以使用环境或命令的\oarg{外观选项}设置代码语言。
+%
+% \begin{Verbatim}[frame=none,numbers=left,gobble=5]
+% \centering
+% \cvfile[lang=python]{Python代码示例}{hellopy.py}
+% \end{Verbatim}
+%
+% \begin{center}
+% % \begin{minipage}{0.85\textwidth}
+% \cvfile[lang=python]{Python代码示例}{hellopy.py}
+% \end{minipage}
+% \end{center}
+%
+% \subsection{listings引擎}
+% 在选项中使用\kvopt{\meta{minted}}{\meta{false}}
+% 以使用\pkg{listings}宏包排版代码。
+%
+% \begin{Verbatim}[frame=none,numbers=left,gobble=5]
+% \centering
+% \cvfile[minted=false,lang=c]{C语言代码示例}{test.c}
+% \end{Verbatim}
+%
+% \begin{center}
+% \begin{minipage}{0.85\textwidth}
+% \cvfile[minted=false,lang=c]{C语言代码示例}{test.c}
+% \end{minipage}
+% \end{center}
+%
+%
+% \end{documentation}
+%
+% \StopEventually{}
+%
+% \begin{implementation}
+%
+% \section{代码实现}
+%
+% 该宏包使用 \LaTeX3 语法编写,依赖 \pkg{expl3} 环境,
+% 并需调用 \pkg{l3packages}、\pkg{tcolorbox}、\pkg{minted}
+% \pkg{listings}、\pkg{fontawesome5}等宏包。
+%
+% 按照 \LaTeX3 语法,代码中的空格、换行、回车与制表符会完全被忽略,
+% 而下划线“|_|”和冒号“|:|”则可作为一般字母使用。
+% 正常的空格可以使用“|~|”代替;至于 |~| 原来所表示的“带子”,
+% 则要用 \LaTeXe{} 的原始命令 \tn{nobreakspace} 代替。
+%
+% 以下代码中有一些形如 \textcolor[HTML]{2E3191}{\textsf{<*package>}}
+% 的标记,这是 \pkg{DocStrip} 中的“guard”,用来选择性地提取文件。
+% “\textsf{*}”和“\textsf{/}”分别表示该部分的开始和结束。不含
+% “\textsf{*}”和“\textsf{/}”的 guard 出现在行号右侧,它们用来确定
+% 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。
+%
+% 另有若干形如 \textcolor[HTML]{AD1457}{\textsf{<@@=codebox>}} 的 guard,
+% 它们由 \pkg{l3docstrip} 定义,用来标识名字空间(模块)。
+%
+% \subsection{环境检测与准备}
+%
+% \begin{macrocode}
+%<*package>
+%<@@=codebox>
+% \end{macrocode}
+%
+% 载入必要的\LaTeX3 宏包
+%
+% \begin{macrocode}
+\RequirePackage { xtemplate, l3keys2e, xparse }
+% \end{macrocode}
+%
+% 检查\LaTeX3 宏包版本
+%
+% \begin{macrocode}
+% \clist_map_inline:nn { xtemplate, l3keys2e }
+% {
+% \@ifpackagelater {#1} { 2020/07/17 }
+% { } { \msg_error:nnn { codebox } { l3-too-old } {#1} }
+% }
+% \msg_new:nnn { codebox } { l3-too-old }
+% {
+% Package~ "#1"~ is~ too~ old. \\\\
+% Please~ update~ an~ up-to-date~ version~ of~ the~ bundles \\
+% "l3kernel"~ and~ "l3packages"~ using~ your~ TeX~ package \\
+% manager~ or~ from~ CTAN.
+% }
+%
+% \end{macrocode}
+%
+% \subsection{载入其它宏包}
+%
+% 载入\pkg{fontawesome5}、\pkg{tcolorbox}、\pkg{amssymb}、
+% \pkg{xcolor}宏包
+%
+% \begin{macrocode}
+\RequirePackage {fontawesome5, tcolorbox, varwidth, xcolor, etoolbox}
+% \end{macrocode}
+%
+% 解决Expl3中\pkg{tcolorbox}和\pkg{tikz}附加库无法加载的
+% 的补丁(需要\pkg{etoolbox}宏包支持)
+%
+% \url{https://tex.stackexchange.com/questions/57424/using-of-usetikzlibrary-in-an-expl3-package-fails}
+%
+% \begin{macrocode}
+\ExplSyntaxOff
+\patchcmd
+{\tcb@input@library@in}
+ {%
+ \input\tcbpkgprefix#1\relax%
+ }
+ {%
+ \@pushfilename
+ \input\tcbpkgprefix#1\relax%
+ \@popfilename
+ }
+ {}{}
+
+\patchcmd
+{\pgfutil@InputIfFileExists}
+ {\input #1}
+ {%
+ \@pushfilename
+ \xdef\@currname{#1}%
+ \input #1 %
+ \@popfilename
+ }
+ {}{}
+\ExplSyntaxOn
+% \end{macrocode}
+%
+% 载入\pkg{tcolorbox}和\pkg{tikz}附加库
+%
+% \begin{macrocode}
+\tcbuselibrary{skins, xparse, breakable}
+\tcbuselibrary{minted,listings}
+\usetikzlibrary{shapes.geometric}
+% \end{macrocode}
+%
+% \subsection{定义颜色}
+%
+% \begin{macrocode}
+\definecolor{cvgrayc}{RGB}{247,247,247}
+\definecolor{cvgray}{RGB}{220,220,220}
+\definecolor{cvgrayb}{RGB}{153,153,153}
+\definecolor{cvblue}{RGB}{223,238,255}
+\definecolor{chengse}{RGB}{250,140,53}
+% \end{macrocode}
+%
+% \subsection{代码盒子样式设计}
+%
+% 代码盒子lang样式
+%
+% \begin{macrocode}
+\tcbset{%
+ skin=enhanced,
+ lang/.style={%
+ breakable,%
+ drop~shadow,%
+ colframe=gray!75!black,%
+ left=4.5mm,
+ enhanced,%
+ colframe=tcbcolback!60!black,%
+ colback=white,%
+ colbacktitle=tcbcolback!5!gray!10!white,%
+ fonttitle=\bfseries,%
+ coltitle=black,%
+ attach~boxed~title~to~top~center={%
+ yshift=-0.25mm-\tcboxedtitleheight/2,%
+ yshifttext=2mm-\tcboxedtitleheight/2%
+ },%
+ attach~boxed~title~to~top~left={%
+ xshift=1cm,%
+ yshift*=1mm-\tcboxedtitleheight%
+ },%
+ varwidth~boxed~title*=-3cm,%
+ boxed~title~style={%
+ frame~code={%
+ \path[fill=tcbcolback!30!black]([yshift=-1mm,xshift=-1mm]frame.north~west)%
+ arc[start~angle=0,end~angle=180,radius=1mm]([yshift=-1mm,xshift=1mm]frame.north~east)%
+ arc[start~angle=180,end~angle=0,radius=1mm];%
+ \path[left~color=tcbcolback!60!black,right~color=tcbcolback!60!black,
+ middle~color=tcbcolback!80!black]([xshift=-2mm]frame.north~west)%
+ --([xshift=2mm]frame.north~east)[rounded~corners=1mm]%
+ --([xshift=1mm,yshift=-1mm]frame.north~east)%
+ --(frame.south~east)%
+ --(frame.south~west)%
+ --([xshift=-1mm,yshift=-1mm]frame.north~west)[sharp~corners]%
+ --cycle;%
+ },%
+ interior~engine=empty%
+ },%
+ overlay={%
+ \begin{tcbclipinterior}
+ \fill[tcbcolback!80!black] (frame.south~west) rectangle
+ ([xshift=5mm]frame.north~west);
+ \end{tcbclipinterior}%
+ },
+ }%
+}%
+% \end{macrocode}
+%
+% 代码盒子cv样式
+%
+% \begin{macrocode}
+\tcbset{%
+ skin=enhanced,
+ cv/.style={
+ boxrule=0.4mm,
+ breakable,
+ top=0mm,
+ boxsep=1mm,
+ drop~shadow,
+ attach~boxed~title~to~top,
+ colframe=blue!75!black,
+ left=4.5mm,
+ right=0mm,
+ enhanced,
+ colframe=tcbcolback!60!black,
+ colback=white,
+ colbacktitle=cvgray,
+ fonttitle=\ttfamily,
+ coltitle=black,
+ % overlay~broken = {
+ % \begin{tcbclipinterior}
+ % \fill[cvblue] (frame.south~west) rectangle ([xshift=5.0mm]frame.north~west);
+ % \end{tcbclipinterior}
+ % },
+ underlay~boxed~title = {
+ \begin{tcbclipinterior}
+ \fill[cvblue] (frame.south~west) rectangle ([xshift=5.0mm,yshift=0mm]frame.north~west);
+ \end{tcbclipinterior}
+ }
+ }
+}%
+% \end{macrocode}
+%
+% \subsection{内部变量声明}
+%
+% \begin{variable}{\l_@@_minted_bool,
+% \l_@@_comment_bool,
+% \l_@@_language_tl,
+% \l_@@_code_style_tl,
+% \l_@@_code_fontsize_tl,
+% \l_@@_code_name_tl,
+% \l_@@_comment_contents_tl,
+% \l_@@_comment_format_tl,
+% \l_@@_baseline_stretch_fp,
+% \l_@@_linenumber_sep_fp
+% }
+% 定义变量。
+%
+% \begin{macrocode}
+\bool_new:N \l_@@_minted_bool
+\bool_new:N \l_@@_comment_bool
+
+\tl_new:N \l_@@_language_tl
+\tl_new:N \l_@@_code_style_tl
+\tl_new:N \l_@@_code_fontsize_tl
+\tl_new:N \l_@@_code_name_tl
+\tl_new:N \l_@@_comment_contents_tl
+\tl_new:N \l_@@_comment_format_tl
+\fp_new:N \l_@@_baseline_stretch_fp
+\fp_new:N \l_@@_linenumber_sep_fp
+% \end{macrocode}
+% \end{variable}
+%
+% \subsection{选项处理}
+%
+% 定义 |codebox| 键值类。
+% \begin{macrocode}
+\keys_define:nn { codebox }
+ {
+% \end{macrocode}
+%
+% \begin{macro}{minted}
+% 是否使用minted宏包排版代码,默认为true。
+% \begin{macrocode}
+ minted .bool_set:N = \l_@@_minted_bool,
+ minted .default:n = true,
+ minted .initial:n = true,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{lang}
+% 设置排版代码语言,默认为C。
+% \begin{macrocode}
+ lang .tl_set:N = \l_@@_language_tl,
+ lang .initial:n = C,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{pretitle}
+% 代码名称前缀
+% \begin{macrocode}
+ pretitle .tl_set:N = \l_@@_code_name_tl,
+ pretitle .initial:n = Code,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{codestyle}
+% 代码样式
+% \begin{macrocode}
+ codestyle .tl_set:N = \l_@@_code_style_tl,
+ codestyle .initial:n = default,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{codesize}
+% 代码字号
+% \begin{macrocode}
+ codesize .tl_set:N = \l_@@_code_fontsize_tl,
+ codesize .initial:n = \small,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{comments}
+% 注释格式
+% \begin{macrocode}
+ comments .tl_set:N = \l_@@_comment_contents_tl,
+ comments .initial:n = {},
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{commentf}
+% 注释格式
+% \begin{macrocode}
+ commentf .tl_set:N = \l_@@_comment_format_tl,
+ commentf .initial:n = \small\sffamily,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{codestretch}
+% 基线伸展系数
+% \begin{macrocode}
+ codestretch .code:n = { \fp_set:Nn \l_@@_baseline_stretch_fp { #1 }
+ },
+ codestretch .initial:n = 1.0,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{linenumsep}
+% 行号与文本之间的距离(单位:mm)
+% \begin{macrocode}
+ linenumsep .fp_set:N = \l_@@_linenumber_sep_fp,
+ linenumsep .initial:n = 3.00,
+% \end{macrocode}
+% \end{macro}
+%
+% 处理未知选项。
+% \begin{macrocode}
+ unknown .code:n = { \@@_error:n { unknown-option } }
+ }
+\msg_new:nnn { codebox } { unknown-option }
+ { package~ option~ "\l_keys_key_tl"~ is~ unknown. }
+% \end{macrocode}
+%
+% \subsection{选项设置用户接口}
+%
+% \begin{macro}{\codeset}
+% 选项设置用户接口。
+% \begin{macrocode}
+\NewDocumentCommand \codeset { m }
+ { \keys_set:nn { codebox } {#1} }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{内部函数}
+%
+% \begin{macrocode}
+% \bool_if:NTF \l_@@_minted_bool
+% {
+% \tcbuselibrary{minted}
+% }{
+% \tcbuselibrary{listings}
+% }
+% \end{macrocode}
+%
+% \begin{macro}{\@@_set_counter_parent:}
+% 设置代码编号计数器的父计数器。
+%
+% \begin{macrocode}
+\cs_new:Npn \@@_set_counter_parent:
+ {
+ \ifdef{\thechapter}
+ {
+ \newcounter{codecounter}[chapter]%
+ }{
+ \newcounter{codecounter}[section]%
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_code_engine_tcbset:}
+% 设置代码盒子minted宏包参数。
+%
+% \begin{macrocode}
+\cs_new:Npn \@@_code_engine_tcbset:n #1
+ {
+ \bool_if:NTF \l_@@_minted_bool
+ {
+ \tcbset{
+ listing~engine=minted,%
+ minted~style=#1,
+ minted~options={%
+ % highlightlines={\ifodd\value{lstnumber}\value{lstnumber}\fi},
+ autogobble,
+ breaklines,%
+ fontsize=\tl_use:N \l_@@_code_fontsize_tl,%
+ baselinestretch=\fp_eval:n { \l_@@_baseline_stretch_fp },
+ breaksymbolleft={},%
+ linenos,%
+ numbersep=\fp_eval:n { \l_@@_linenumber_sep_fp }~mm,
+ },%
+ minted~language=\tl_use:N \l_@@_language_tl%
+ }
+ }{
+ \lstset{% general command to set parameter(s)
+ basicstyle=\ttfamily\tl_use:N \l_@@_code_fontsize_tl, % print whole listing small
+ keywordstyle=\color{chengse}\bfseries,%
+ identifierstyle=, % nothing happens
+ breaklines=true,
+ commentstyle=\itshape\color{gray},
+ stringstyle=\ttfamily, % typewriter type for strings
+ numbers=left,%
+ numberstyle=\tl_use:N \l_@@_code_fontsize_tl\sffamily\color[rgb]{0.5,0.5,1.0},%
+ }%
+ \tcbset{
+ overlay={%
+ \begin{tcbclipinterior}
+ \fill[tcbcolback!80!black] (frame.south~west) rectangle
+ ([xshift=5mm]frame.north~west);
+ \end{tcbclipinterior}%
+ },%
+ listing~options={
+ language=\tl_use:N \l_@@_language_tl,
+ numbersep=\fp_eval:n { \l_@@_linenumber_sep_fp }~mm,
+ %linebackgroundcolor={\ifodd\value{lstnumber}\color{cvgray}\fi}
+ }
+ }%
+ }
+ }
+\cs_generate_variant:Nn \@@_code_engine_tcbset:n {V}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_comment_tcbset:}
+% 设置代码盒子底线注释。
+%
+% \begin{macrocode}
+\cs_new:Npn \@@_comment_tcbset:
+ {
+ \bool_if:NTF { \l_@@_comment_bool }
+ {
+ \tcbset{%
+ listing~and~comment,%
+ colbacklower=tcbcolback!5!yellow!10!white,%
+ collower=tcbcolback!60!black,%
+ comment={\tl_use:N \l_@@_comment_format_tl~
+ \tl_use:N \l_@@_comment_contents_tl},%
+ }
+ }{
+ \tcbset{ listing~only,}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{不计数代码盒子用户接口}
+%
+% 定义不带底线注释的代码盒子环境\env{codebox}
+%
+% \begin{macrocode}
+\NewDocumentEnvironment{ codebox }{O{} m }
+ {
+ \bool_set_false:N \l_@@_comment_bool
+ \group_begin:
+ \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \@@_code_engine_tcbset:V \l_@@_code_style_tl,
+ \@@_comment_tcbset:
+ \tcbset{lang, title={#2} }%
+ \tcblisting{}
+ }{
+ \endtcblisting
+ \group_end:
+ }
+% \end{macrocode}
+%
+% 定义带底线注释的代码盒子环境\env{codebox*}
+%
+% \begin{macrocode}
+\NewDocumentEnvironment{ codebox* }{O{} m }
+ {
+ \bool_set_false:N \l_@@_comment_bool
+ \group_begin:
+ \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \@@_code_engine_tcbset:V \l_@@_code_style_tl,
+ \@@_comment_tcbset:
+ \tcbset{lang, title={#2} }%
+ \tcblisting{}
+ }{
+ \endtcblisting
+ \group_end:
+ }
+% \end{macrocode}
+%
+% 定义带/不带底线注释的从文件读取内容的命令\tn{codefile}/\tn{codefile*}
+%
+% \begin{macrocode}
+\NewDocumentCommand \codefile { s O{} m m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \bool_set_true:N \l_@@_comment_bool
+ }{
+ \bool_set_false:N \l_@@_comment_bool
+ }
+
+ \group_begin:
+ \IfNoValueF{#2}{ \keys_set:nn { codebox } { #2 } }
+ \@@_code_engine_tcbset:V \l_@@_code_style_tl,
+ \@@_comment_tcbset:
+ \tcbset{
+ lang,
+ title={#3},
+ listing~file={#4},
+ }%
+ \tcbinputlisting{ }
+ \group_end:
+ }
+% \end{macrocode}
+%
+% \subsection{计数代码盒子用户接口}
+%
+% 设置代码盒子计算器
+%
+% \begin{macrocode}
+\@@_set_counter_parent:
+% \end{macrocode}
+%
+% 定义不带底线注释的代码盒子环境\env{codeview}
+%
+% \begin{macrocode}
+\DeclareTCBListing[use~counter=codecounter]{codeviewaux}{m}
+ {
+ title={\tl_use:N \l_@@_code_name_tl\thecodecounter~#1},
+ }
+\NewDocumentEnvironment{ codeview }{O{} m }
+ {
+ \bool_set_false:N \l_@@_comment_bool
+ \group_begin:
+ \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \@@_code_engine_tcbset:V \l_@@_code_style_tl,
+ \@@_comment_tcbset:
+ \tcbset{
+ cv,
+ overlay~unbroken~and~first ={
+ \begin{tcbclipinterior}
+ \node[inner~sep=0pt,anchor=north~east,yshift=-3pt,xshift=-5pt,text=cvgrayb]
+ at (frame.north~east){
+ \ttfamily\faFile*\ \faCode\ \faCodeBranch\ \faCopy\ \faExternalLink*\
+ \MakeUppercase{\tl_use:N \l_@@_language_tl}
+ };
+ \end{tcbclipinterior}
+ }
+ }%
+ \codeviewaux{#2}
+ }{
+ \endcodeviewaux
+ \group_end:
+ }
+% \end{macrocode}
+%
+% 定义带底线注释的代码盒子环境\env{codeview*}
+%
+% \begin{macrocode}
+\NewDocumentEnvironment{ codeview* }{O{} m }
+ {
+ \bool_set_true:N \l_@@_comment_bool
+ \group_begin:
+ \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \@@_code_engine_tcbset:V \l_@@_code_style_tl,
+ \@@_comment_tcbset:
+ \tcbset{
+ cv,
+ overlay~unbroken~and~first ={
+ \begin{tcbclipinterior}
+ \node[inner~sep=0pt,anchor=north~east,yshift=-3pt,xshift=-5pt,text=cvgrayb]
+ at (frame.north~east){
+ \ttfamily\faFile*\ \faCode\ \faCodeBranch\ \faCopy\ \faExternalLink*\
+ \MakeUppercase{\tl_use:N \l_@@_language_tl}
+ };
+ \end{tcbclipinterior}
+ }
+ }%
+ \codeviewaux{#2}
+ }{
+ \endcodeviewaux
+ \group_end:
+ }
+% \end{macrocode}
+%
+% 定义带/不带底线注释的从文件读取内容的命令\tn{cvfile}/\tn{cvfile*}
+%
+% \begin{macrocode}
+\DeclareTCBInputListing[use~counter=codecounter]{\langfileaux}{m}
+ {
+ title={\tl_use:N \l_@@_code_name_tl\thecodecounter~#1},
+ }
+\NewDocumentCommand \cvfile { s O{} m m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \bool_set_true:N \l_@@_comment_bool
+ }{
+ \bool_set_false:N \l_@@_comment_bool
+ }
+
+ \group_begin:
+ \IfNoValueF{#2}{ \keys_set:nn { codebox } { #2 } }
+ \@@_code_engine_tcbset:V \l_@@_code_style_tl,
+ \@@_comment_tcbset:
+ \tcbset{
+ cv,
+ listing~file={#4},
+ overlay~unbroken~and~first ={
+ \begin{tcbclipinterior}
+ \node[inner~sep=0pt,anchor=north~east,yshift=-3pt,xshift=-5pt,text=cvgrayb]
+ at (frame.north~east){
+ \ttfamily\faFile*\ \faCode\ \faCodeBranch\ \faCopy\ \faExternalLink*\
+ \MakeUppercase{\tl_use:N \l_@@_language_tl}
+ };
+ \end{tcbclipinterior}
+ }
+ }%
+ \langfileaux{#3}
+ \group_end:
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \end{implementation}
+%
+% \Finale
+%
+\endinput
diff --git a/Master/texmf-dist/doc/latex/codebox/codebox.pdf b/Master/texmf-dist/doc/latex/codebox/codebox.pdf
new file mode 100644
index 00000000000..05a15aa3485
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/codebox.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/codebox/ctxdoc-en.cls b/Master/texmf-dist/doc/latex/codebox/ctxdoc-en.cls
new file mode 100644
index 00000000000..68fab5f9676
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/ctxdoc-en.cls
@@ -0,0 +1,883 @@
+%%
+%% File ctxdoc.cls
+%%
+%% Copyright (C) 2016--2020
+%% CTEX.ORG and any individual authors listed in the documentation.
+%%---------------------------------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. This version of this license is in
+%% http://www.latex-project.org/lppl/lppl-1-3c.txt
+%% and the latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%%---------------------------------------------------------------------
+%%
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{expl3}
+\GetIdInfo$Id$
+ {ctex documentation (CTEX)}
+\ProvidesExplClass{ctxdoc}{\ExplFileDate}{}{\ExplFileDescription}
+\ExplSyntaxOff
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{l3doc}}
+\PassOptionsToClass{a4paper,full}{l3doc}
+\ProcessOptions
+\LoadClass{l3doc}
+\RequirePackage[UTF8, punct=kaiming, heading, linespread=1.2, sub3section,scheme=plain]{ctex}
+
+\RequirePackage[toc]{multitoc}
+\RequirePackage{geometry}
+\RequirePackage{tabularx}
+\RequirePackage{makecell}
+\RequirePackage{threeparttable}
+\RequirePackage{siunitx}
+\RequirePackage{unicode-math}
+\RequirePackage{xcolor}
+\RequirePackage{caption}
+\RequirePackage{fancyvrb-ex}
+\RequirePackage{zref-base}
+\geometry{includemp, hmargin={0mm,15mm}, vmargin={25mm,15mm}, footskip=7mm}
+\hypersetup{pdfstartview=FitH, bookmarksdepth=subparagraph}
+\setcounter{secnumdepth}{4}
+\setcounter{tocdepth}{2}
+\newcommand*\email{\nolinkurl}
+\setmainfont{texgyrepagella}[
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-italic,
+ BoldItalicFont = *-bolditalic]
+\setsansfont{texgyreheros}[
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-italic,
+ BoldItalicFont = *-bolditalic]
+\setmonofont{cmun}[
+ Extension = .otf,
+ UprightFont = *btl,
+ BoldFont = *tb,
+ ItalicFont = *bto,
+ BoldItalicFont = *tx,
+ HyphenChar = None]
+\setmathfont{texgyrepagella-math.otf}
+\captionsetup{%
+ strut=off, labelsep=quad, labelfont+=bf,
+ figureposition = bottom, tableposition = top}
+%% <--- http://tex.stackexchange.com/a/40896
+\patchcmd{\@addtocurcol}%
+ {\vskip \intextsep}%
+ {\edef\save@first@penalty{\the\lastpenalty}\unpenalty
+ \ifnum \lastpenalty = \@M % hopefully the OR penalty
+ \unpenalty
+ \else
+ \penalty \save@first@penalty \relax % put it back
+ \fi
+ \ifnum\outputpenalty <-\@Mii
+ \addvspace\intextsep
+ \vskip\parskip
+ \else
+ \addvspace\intextsep
+ \fi}%
+ {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
+\patchcmd{\@addtocurcol}%
+ {\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}%
+ {\ifnum\outputpenalty <-\@Mii
+ \aftergroup\vskip\aftergroup\intextsep
+ \aftergroup\nointerlineskip
+ \else
+ \vskip\intextsep
+ \fi}%
+ {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
+\patchcmd{\@getpen}{\@M}{\@Mi}
+ {\typeout{*** SUCCESS ***}}{\typeout{*** FAIL ***}}
+%% --->
+%% 不对代码实现的 \section 以下标题编目录。
+\AtBeginEnvironment{implementation}{%
+ \ifnum\value{tocdepth}>\@ne
+ \addtocontents{toc}{\protect\value{tocdepth}=1\relax}%
+ \fi}
+\ifxetex
+ \let\ctexdocverbaddon\xeCJKVerbAddon
+ \def\ctexdisableecglue{\xeCJKsetup{CJKecglue}}
+ \def\ctexplainps{\xeCJKsetup{PunctStyle=plain}}
+ \appto\meta@font@select{\ifinner\ctexdisableecglue\fi}
+\else
+ \let\ctexdocverbaddon\relax
+ \let\ctexplainps\relax
+ \def\ctexdisableecglue{\ltjsetparameter{autoxspacing=false}}
+ \appto\meta@font@select{\ctexdisableecglue}
+\fi
+\setlist{noitemsep,topsep=\smallskipamount}
+\setlist[1]{labelindent=\parindent}
+\setlist[enumerate]{leftmargin=*}
+\setlist[itemize]{leftmargin=*}
+\newlist{optdesc}{description}{3}
+%% 设置间距为 \marginparsep,与 l3doc 一致
+\setlist[optdesc]{%
+ font=\mdseries\small\ttfamily,align=right,listparindent=\parindent,
+ labelsep=\marginparsep,labelindent=-\marginparsep,leftmargin=0pt}
+%% 重新定义 threeparttable 包的 tablenotes 环境
+\renewlist{tablenotes}{description}{1}
+\setlist[tablenotes]{%
+ format=\normalfont\tnote@item,align=right,listparindent=\parindent,
+ labelindent=\tabcolsep,leftmargin=*,rightmargin=\tabcolsep,
+ after=\@noparlisttrue}
+\AtBeginEnvironment{tablenotes}{%
+ \setlength\parindent{2\ccwd}%
+ \normalfont\footnotesize}
+\AtBeginEnvironment{threeparttable}{%
+ \stepcounter{tpt@id}%
+ \edef\curr@tpt@id{tpt@\arabic{tpt@id}}}
+\newcounter{tpt@id}
+\def\tnote@item#1{%
+ \Hy@raisedlink{\hyper@anchor{\curr@tpt@id-#1}}#1}
+\def\TPTtagStyle#1{\hyperlink{\curr@tpt@id-#1}{#1}}
+\fvset{
+ fontsize=\small,baselinestretch=1,numbersep=5pt,
+ formatcom=\ctexdocverbaddon,
+ listparameters=\setlength\topsep{\MacrocodeTopsep}}
+\DefineVerbatimEnvironment{frameverb}{Verbatim}{%
+ gobble=4,
+ frame=single,framesep=8pt,
+ listparameters=
+ \setlength\topsep{\medskipamount}%
+ \appto\FV@EndList{\nointerlineskip}}
+\DefineVerbatimEnvironment{ctexexam}{Verbatim}{%
+ gobble=4,
+ frame=single,framesep=10pt,
+ label=\rule{0pt}{12pt}\textnormal{\bfseries 例 \arabic{ctexexam}},
+ listparameters=
+ \setlength\topsep{\bigskipamount}%
+ \refstepcounter{ctexexam}\ctexexamlabelref
+ \appto\FV@EndList{\nointerlineskip}}
+\define@key{FV}{labelref}{\def\ctexexamlabelref{\label{#1}}}
+\let\ctexexamlabelref\empty
+\newcounter{ctexexam}
+\BeforeBeginEnvironment{function}{\par\nointerlineskip}
+\AtEndEnvironment{function}{%
+ \par\xdef\ctexfixprevdepth{\prevdepth=\the\prevdepth\space}}
+\AfterEndEnvironment{function}{\ctexfixprevdepth}
+\AtBeginEnvironment{syntax}{\linespread{1}\ctexplainps\ctexdisableecglue}
+\BeforeBeginEnvironment{SideBySideExample}{\par\addvspace{\medskipamount}}
+\newrobustcmd\exptarget{%
+ \AddLineBeginMainAux{\csgdef{Codedoc@expstar}{}}%
+ \Hy@raisedlink{\hypertarget{expstar}{}}}
+\newrobustcmd\rexptarget{%
+ \AddLineBeginMainAux{\csgdef{Codedoc@rexpstar}{}}%
+ \Hy@raisedlink{\hypertarget{rexpstar}{}}}
+\newrobustcmd\expstar{\hyperlink{expstar}{$\star$}}
+\newrobustcmd\rexpstar{\hyperlink{rexpstar}{\ding{73}}}
+\ExplSyntaxOn
+%% l3doc 会设置列表环境中 \listparindent=\z@,我们在这里恢复它。
+\cs_set_eq:NN \list \__codedoc_oldlist:nn
+\cs_new_nopar:Npn \zihaopt #1
+ {
+ \exp_last_unbraced:Nf \tl_head:w
+ { \prop_item:Nn \c__ctex_font_size_prop {#1} } { } \q_stop
+ }
+%% 抑制首段的 \parskip
+\ctex_patch_cmd_once:NnnnTF \__codedoc_function_descr_start:w
+ { }
+ { \noindent }
+ { \skip_vertical:n { -\parskip } \noindent }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+%% l3doc 会在 function 环境的 syntax 和 descr 盒子中间加上 \medskipamount 的距离。
+%% 但是若 syntax 盒子为空(未使用 syntax 环境),就会显得不好看。
+%% 此时我们通过将 \medskipamount 设置为零来修正。若盒子非空,则将 \parskip 还回去。
+\ctex_preto_cmd:NnnTF \__codedoc_function_assemble:
+ { }
+ { \ctex_doc_fix_yoffset: }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+\cs_new_protected_nopar:Npn \ctex_doc_fix_yoffset:
+ {
+ \box_if_empty:NTF \g__codedoc_syntax_box
+ { \skip_zero:N \medskipamount }
+ { \skip_add:Nn \medskipamount { \parskip } }
+ }
+%% 左侧边注的函数列表采用单倍行距
+\ctex_preto_cmd:NnnTF \__codedoc_typeset_functions:
+ { }
+ { \MacroFont }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_init:
+ { }
+ { \hbox:n }
+ { \MacroFont \hbox:n }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_dump:
+ { }
+ { \hbox_unpack_drop:N }
+ { \MacroFont \hbox_unpack_drop:N }
+ { \iow_term:n { *** ~ SUCCESS ~ *** } }
+ { \iow_term:n { *** ~ FAIL ~ *** } }
+\cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n
+\cs_set_protected:Npn \__codedoc_macro_typeset_one:nN #1#2
+ {
+ \vbox_set:Nn \l__codedoc_macro_box
+ {
+ \MacroFont
+ \vbox_unpack_drop:N \l__codedoc_macro_box
+ \hbox_set:Nn \l_tmpa_box
+ { \__codedoc_print_macroname:nN {#1} #2 }
+ \dim_set:Nn \l_tmpa_dim { \marginparwidth - \labelsep }
+ \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > \l_tmpa_dim
+ {
+ \box_resize_to_wd_and_ht:Nnn \l_tmpa_box
+ { \l_tmpa_dim }
+ { \box_ht:N \l_tmpa_box }
+ }
+ \hbox_overlap_left:n
+ {
+ \box_use:N \l_tmpa_box
+ \skip_horizontal:n { \marginparsep - \labelsep }
+ }
+ }
+ \int_incr:N \l__codedoc_macro_int
+ }
+\cs_set_protected:Npn \__codedoc_print_macroname:nN #1#2
+ {
+ \strut
+ \__codedoc_get_hyper_target:xN
+ {
+ \exp_not:n {#1}
+ \bool_if:NT #2 { \tl_to_str:n {TF} }
+ }
+ \l__codedoc_tmpa_tl
+ \cs_if_exist:cTF { r@ \l__codedoc_tmpa_tl }
+ { \exp_args:NNo \label@hyperref [ \l__codedoc_tmpa_tl ] }
+ { \use:n }
+ {
+ \tl_set:Nn \l__codedoc_tmpa_tl {#1}
+ \tl_replace_all:Non \l__codedoc_tmpa_tl
+ { \c_catcode_other_space_tl }
+ { \fontspec_visible_space: }
+ \__codedoc_macroname_prefix:o \l__codedoc_tmpa_tl
+ \__codedoc_macroname_suffix:N #2
+ }
+ }
+\AtBeginEnvironment { syntax }
+ {
+ \char_set_catcode_active:N \|
+ \char_set_active_eq:NN \| \orbar
+ \char_set_catcode_active:N \(
+ \char_set_active_eq:NN \( \defaultvalaux
+ }
+%% 不对目录中出现的 \cs 和 \tn 等编索引
+\DeclareDocumentCommand \StopSpecialIndexModule { }
+ { \cs_set_eq:NN \__codedoc_special_index_module:nnnnN \use_none:nnnnn }
+\tl_map_inline:nn { \actualchar \encapchar \levelchar }
+ { \exp_args:Nx \DoNotIndex { \bslash \tl_to_str:N #1 } }
+\DeclareDocumentCommand \package { o m }
+ {
+ \exp_args:Nx \href
+ {
+ http \c_colon_str //www.ctan.org/pkg/
+ \IfNoValueTF {#1} { \str_lowercase:n {#2} } {#1}
+ }
+ { \pkg {#2} }
+ }
+\DeclareDocumentCommand \GetFileId { m }
+ {
+ \GetFileInfo {#1}
+ \file_get:nnNTF { \c_sys_jobname_str .id }
+ { \int_set:Nn \tex_endlinechar:D { -1 } } \l__ctxdoc_tmp_tl
+ { \exp_after:wN \GetIdInfo \l__ctxdoc_tmp_tl }
+ { \GetIdInfo $Id$ }
+ { \fileinfo }
+ }
+\cs_new_eq:NN \__ctxdoc_ltx_changes:nnn \changes@
+\cs_set_protected:Npn \changes@ #1#2
+ {
+ \__ctxdoc_save_version_date:nn {#1} {#2}
+ \tl_if_empty:nTF {#1}
+ { \__ctxdoc_ltx_changes:nnn }
+ { \__ctxdoc_version_zfill:wnnn #1 \q_stop }
+ {#1} {#2}
+ }
+\cs_new_protected:Npn \__ctxdoc_version_zfill:wnnn #1#2 \q_stop
+ {
+ \str_if_eq:nnTF {#1} { v }
+ { \__ctxdoc_version_zfill:nnnn {#2} }
+ { \__ctxdoc_ltx_changes:nnn }
+ }
+\cs_new_protected:Npn \__ctxdoc_version_zfill:nnnn #1#2
+ {
+ \tl_clear:N \l__ctxdoc_tmp_tl
+ \int_zero:N \l_tmpa_int
+ \seq_set_split:Nnn \l_tmpa_seq { . } {#1}
+ \seq_map_function:NN \l_tmpa_seq \__ctxdoc_version_zfill:n
+ \int_compare:nNnF \l_tmpa_int > 2
+ {
+ \tl_put_right:Nx \l__ctxdoc_tmp_tl
+ { \prg_replicate:nn { 3 - \l_tmpa_int } { 00000 } }
+ }
+ \__ctxdoc_ltx_changes:nnn { \l__ctxdoc_tmp_tl \actualchar #2 }
+ }
+\tl_new:N \l__ctxdoc_tmp_tl
+\cs_new_protected:Npn \__ctxdoc_version_zfill:n #1
+ {
+ \int_incr:N \l_tmpa_int
+ \tl_put_right:Nx \l__ctxdoc_tmp_tl
+ {
+ \prg_replicate:nn
+ { \int_max:nn { 0 } { 5 - \tl_count:n {#1} } } { 0 }
+ \exp_not:n {#1}
+ }
+ }
+\cs_new_protected:Npn \__ctxdoc_save_version_date:nn #1#2
+ {
+ \prop_get:NnNTF \g__ctxdoc_version_date_prop {#1} \l__ctxdoc_tmp_tl
+ { \exp_after:wN \__ctxdoc_save_version_date:nnnn \l__ctxdoc_tmp_tl {#2} {#1} }
+ { \__ctxdoc_save_version_date:nnn {#1} {#2} {#2} }
+ }
+\cs_new_protected:Npn \__ctxdoc_save_version_date:nnnn #1#2#3#4
+ {
+ \__ctxdoc_if_date_later:nnTF {#1} {#3}
+ { \__ctxdoc_save_version_date:nnn {#4} {#3} {#2} }
+ {
+ \__ctxdoc_if_date_later:nnT {#3} {#2}
+ { \__ctxdoc_save_version_date:nnn {#4} {#1} {#3} }
+ }
+ }
+\prg_new_conditional:Npnn \__ctxdoc_if_date_later:nn #1#2 { TF , T }
+ {
+ \if_int_compare:w \__ctxdoc_parse_date:w #1 / / / 0 \q_stop >
+ \__ctxdoc_parse_date:w #2 / / / 0 \q_stop \exp_stop_f:
+ \prg_return_true: \else: \prg_return_false: \fi:
+ }
+\cs_new:Npn \__ctxdoc_parse_date:w #1/#2/#3/ #4 \q_stop
+ { #1#2#3 }
+\cs_new_protected:Npn \__ctxdoc_save_version_date:nnn #1#2#3
+ { \prop_gput:Nnn \g__ctxdoc_version_date_prop {#1} { {#2} {#3} } }
+\cs_new_protected:Npn \CTEX@versionitem #1 \efill
+ {
+ \@idxitem
+ \prop_get:NnNTF \g__ctxdoc_version_date_prop {#1} \l__ctxdoc_tmp_tl
+ { \exp_after:wN \__ctxdoc_version_item:nnn \l__ctxdoc_tmp_tl {#1} }
+ { \BOOM }
+ }
+\cs_new_protected:Npn \__ctxdoc_version_item:nnn #1#2#3
+ {
+ \noindent
+ \Hy@raisedlink { \belowpdfbookmark {#3} { HD.#3 } }
+ \textbf {#3} \hfill
+ \hbox:n
+ {
+ \footnotesize
+ \str_if_eq:nnTF {#1} {#2}
+ { ( #1 ) }
+ { ( #1 ~ -- ~ #2 ) }
+ }
+ \par \nopagebreak
+ }
+\prop_new:N \g__ctxdoc_version_date_prop
+\ctex_patch_cmd:Nnn \HDorg@theglossary
+ { \let \item \@idxitem }
+ { \let \item \CTEX@versionitem }
+\ctex_patch_cmd:Nnn \l@section { 2.5em } { 1.5em }
+\ctex_patch_cmd:Nnn \l@subsection { 2.5em } { 1.5em }
+\ctex_patch_cmd:Nnn \@wrglossary
+ { hdpindex }
+ {
+ \ifnum \c@HD@hypercount = \z@
+ hdpindex
+ \else
+ hdclindex { \the \c@HD@hypercount }
+ \fi
+ }
+%% 重定义 macrocode 环境的实现,逐行处理
+\cs_set_protected_nopar:Npn \xmacro@code
+ { \__ctxdoc_marco_code:w }
+\cs_set_protected_nopar:Npn \sxmacro@code
+ {
+ \fontspec_print_visible_spaces:
+ \xmacro@code
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_marco_code:w
+ {
+ \ifcodeline@index
+ \__ctxdoc_marco_every_par:n { \__ctxdoc_code_line_no: }
+ \else:
+ \__ctxdoc_marco_every_par:n { }
+ \fi:
+ \exp_args:Nx \__ctxdoc_make_finish_tag:n { \@currenvir }
+ \__ctxdoc_verbatim_start:w
+ }
+\cs_new_protected:Npn \__ctxdoc_marco_every_par:n #1
+ {
+ \everypar
+ {
+ \everypar {#1}
+ \if@inlabel
+ \global \@inlabelfalse
+ \@noparlistfalse
+ \llap { \box \@labels \hskip \leftskip }
+ \fi
+ #1
+ }
+ }
+\ctex_patch_cmd:Nnn \macro@code
+ { \if@inlabel \leavevmode \fi }
+ { \partopsep \z@skip }
+\group_begin:
+ \int_set:Nn \tex_endlinechar:D { -1 }
+ \use:n
+ {
+ \char_set_catcode_active:n { 32 }
+ \tl_const:Nn \c__ctxdoc_active_space_tl
+ }
+ { }
+\group_end:
+\group_begin:
+ \char_set_catcode_active:n { 13 }
+ \cs_new_protected:Npx \__ctxdoc_make_finish_tag:n #1
+ {
+ \tl_set:Nn \exp_not:N \l__ctxdoc_verbatim_finish_tl
+ {
+ \c_percent_str
+ \prg_replicate:nn { 4 }
+ { \exp_not:o { \c__ctxdoc_active_space_tl } }
+ \exp_not:o { \active@escape@char } end
+ \c_left_brace_str #1 \c_right_brace_str
+ \exp_not:N ^^M
+ }
+ }
+ \cs_new_protected:Npn \__ctxdoc_verbatim_start:w #1
+ {
+ \str_if_eq:nnTF {#1} { ^^M }
+ { \__ctxdoc_verbatim_read_line:w }
+ { \__ctxdoc_verbatim_read_line:w #1 }
+ }
+ \cs_new_protected:Npn \__ctxdoc_verbatim_read_line:w #1 ^^M
+ {
+ \tl_set:Nn \l__ctxdoc_verbatim_line_tl { #1 ^^M }
+ \tl_if_eq:NNTF \l__ctxdoc_verbatim_line_tl \l__ctxdoc_verbatim_finish_tl
+ { \exp_args:Nx \end { \@currenvir } }
+ {
+ \__ctxdoc_verbatim_process_line:
+ \__ctxdoc_verbatim_read_line:w
+ }
+ }
+ \cs_new_protected:Npn \__ctxdoc_swap_cr:
+ { \exp_after:wN \__ctxdoc_swap_cr:w \l__ctxdoc_verbatim_line_tl }
+ \cs_new_protected:Npn \__ctxdoc_swap_cr:w #1 ^^M
+ {
+ \group_insert_after:N ^^M
+ \tl_set:Nn \l__ctxdoc_verbatim_line_tl {#1}
+ }
+ \tl_const:Nn \c__ctxdoc_active_cr_tl { ^^M }
+\group_end:
+\tl_new:N \l__ctxdoc_verbatim_line_tl
+\tl_new:N \l__ctxdoc_verbatim_finish_tl
+\tl_new:N \g__ctxdoc_verbatim_verb_stop_tl
+\cs_new_protected_nopar:Npn \__ctxdoc_process_normal_line:
+ {
+ \str_if_eq:eeTF
+ { \str_head:N \l__ctxdoc_verbatim_line_tl } { \c_percent_str }
+ { \__ctxdoc_check_angle:x { \tl_tail:N \l__ctxdoc_verbatim_line_tl } }
+ { \__ctxdoc_output_line: }
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_process_verb_line:
+ {
+ \tl_if_eq:NNTF \l__ctxdoc_verbatim_line_tl \g__ctxdoc_verbatim_verb_stop_tl
+ {
+ \tl_gclear:N \g__ctxdoc_verbatim_verb_stop_tl
+ \cs_gset_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_process_normal_line:
+ \__ctxdoc_output_module:nn
+ { \color { verb@guard } }
+ {
+ \__ctxdoc_swap_cr:
+ \__ctxdoc_module_pop:n { \l__ctxdoc_verbatim_line_tl }
+ }
+ }
+ { \tl_use:N \l__ctxdoc_verbatim_line_tl }
+ }
+\cs_new_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_process_normal_line:
+\DeclareDocumentCommand \CheckModules { }
+ { \cs_set_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_process_normal_line: }
+\DeclareDocumentCommand \DontCheckModules { }
+ { \cs_set_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_output_line: }
+\cs_new_protected:Npn \__ctxdoc_check_angle:n #1
+ {
+ \str_if_eq:eeTF { \str_head:n {#1} } { < }
+ { \__ctxdoc_check_module:x { \tl_tail:n {#1} } }
+ { \__ctxdoc_output_percent_line: }
+ }
+\cs_generate_variant:Nn \__ctxdoc_check_angle:n { x }
+\cs_new_protected:Npn \__ctxdoc_check_module:n #1
+ {
+ \exp_args:Nx \str_case:nnF { \str_head:n {#1} }
+ {
+ { * } { \__ctxdoc_module_star:w }
+ { / } { \__ctxdoc_module_slash:w }
+ { @ } { \__ctxdoc_module_at:w }
+ { < } { \__ctxdoc_module_verb:w }
+ }
+ { \__ctxdoc_module_pm:w }
+ #1 \q_stop
+ }
+\cs_generate_variant:Nn \__ctxdoc_check_module:n { x }
+\group_begin:
+ \char_set_catcode_active:N \>
+ \cs_new_protected:Npn \__ctxdoc_module_star:w #1 > #2 \q_stop
+ {
+ \__ctxdoc_output_module:nn
+ { \__ctxdoc_star_color: }
+ { \__ctxdoc_module_push:n { \__ctxdoc_module_angle:n {#1} } }
+ \__ctxdoc_output_line:n {#2}
+ \__ctxdoc_star_format:
+ }
+ \cs_new_protected:Npn \__ctxdoc_module_slash:w #1 > #2 \q_stop
+ {
+ \__ctxdoc_output_module:nn
+ { \__ctxdoc_slash_color: }
+ { \__ctxdoc_module_pop:n { \__ctxdoc_module_angle:n {#1} } }
+ \__ctxdoc_output_line:n {#2}
+ \__ctxdoc_slash_format:
+ }
+ \cs_new_protected:Npn \__ctxdoc_module_at:w @ @ = #1 > #2 \q_stop
+ {
+ \__ctxdoc_output_module:nn
+ { \color { at@guard } }
+ { \__ctxdoc_module_angle:n { @ @ = #1 } }
+ \tl_gset:Nn \g__codedoc_module_name_tl {#1}
+ \__ctxdoc_output_line:n {#2}
+ }
+ \cs_new_protected:Npn \__ctxdoc_module_pm:w #1 > #2 \q_stop
+ {
+ \tex_noindent:D
+ \hbox_overlap_left:n
+ {
+ \__ctxdoc_output_module:nn
+ { \__ctxdoc_pm_color: }
+ { \__ctxdoc_module_angle:n {#1} }
+ \skip_horizontal:n { \leftskip + \smallskipamount }
+ }
+ \group_begin:
+ \__ctxdoc_pm_format:
+ \__ctxdoc_output_line:n {#2}
+ \group_end:
+ }
+ \cs_new_protected:Npn \__ctxdoc_module_verb:w #1 \q_stop
+ {
+ \cs_gset_eq:NN \__ctxdoc_verbatim_process_line: \__ctxdoc_process_verb_line:
+ \tl_gset:Nx \g__ctxdoc_verbatim_verb_stop_tl
+ { \c_percent_str \tl_tail:n {#1} }
+ \__ctxdoc_output_module:nn
+ { \color { verb@guard } }
+ {
+ \__ctxdoc_swap_cr:
+ \__ctxdoc_module_push:n { \l__ctxdoc_verbatim_line_tl }
+ }
+ }
+\group_end:
+\cs_new_protected_nopar:Npn \__ctxdoc_output_line:
+ {
+ \tex_noindent:D
+ \__ctxdoc_replace_at_at:N \l__ctxdoc_verbatim_line_tl
+ \tl_use:N \l__ctxdoc_verbatim_line_tl
+ }
+\cs_new_protected:Npn \__ctxdoc_replace_at_at:N #1
+ {
+ \tl_if_empty:NF \g__codedoc_module_name_tl
+ {
+ \exp_args:NNo \__ctxdoc_replace_at_at_aux:Nn
+ #1 \g__codedoc_module_name_tl
+ }
+ }
+\cs_new_protected:Npx \__ctxdoc_replace_at_at_aux:Nn #1#2
+ {
+ \tl_replace_all:Nnn #1 { \token_to_str:N @ } { @ }
+ \tl_replace_all:Nnn #1 { \token_to_str:N _ } { _ }
+ \tl_replace_all:Nnn #1 { @ @ @ @ } { \token_to_str:N a a }
+ \tl_replace_all:Nnn #1 { _ _ @ @ } { _ _ #2 }
+ \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 }
+ \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 }
+ \tl_replace_all:Nnn #1 { \token_to_str:N a a } { @ @ }
+ }
+\cs_new_protected:Npn \__ctxdoc_output_line:n #1
+ {
+ \tl_set:Nn \l__ctxdoc_verbatim_line_tl {#1}
+ \tl_if_eq:NNTF \l__ctxdoc_verbatim_line_tl \c__ctxdoc_active_cr_tl
+ { \tl_use:N \l__ctxdoc_verbatim_line_tl }
+ {
+ \str_if_eq:eeTF
+ { \str_head:N \l__ctxdoc_verbatim_line_tl }
+ { \c_percent_str }
+ { \__ctxdoc_output_percent_line: }
+ { \__ctxdoc_output_line: }
+ }
+ }
+\cs_new_protected:Npn \__ctxdoc_output_percent_line:
+ {
+ \tex_noindent:D
+ \group_begin:
+ \color { code@gray }
+ \__ctxdoc_swap_cr:
+ \str_if_eq:eeTF { \f@shape } { \updefault }
+ { \slshape }
+ { \upshape }
+ \__ctxdoc_output_line:
+ \group_end:
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_module_push:n
+ { \exp_args:No \__ctxdoc_module_push_aux:nn { \int_use:N \c@HD@hypercount } }
+\cs_new_protected:Npn \__ctxdoc_module_push_aux:nn #1
+ {
+ \seq_gpush:Nn \g__ctxdoc_module_dest_seq {#1}
+ \hypersetup { hidelinks }
+ \exp_args:Nx \hdclindex
+ { \zref@extractdefault { HD.#1 } { guard@end } { 1 } } { }
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_module_pop:n
+ {
+ \seq_gpop:NNTF \g__ctxdoc_module_dest_seq \l__ctxdoc_tmp_tl
+ { \exp_args:No \__ctxdoc_module_pop_aux:nn { \l__ctxdoc_tmp_tl } }
+ { \BOOM \use:n }
+ }
+\cs_new_protected:Npn \__ctxdoc_module_pop_aux:nn #1
+ {
+ \zref@labelbylist { HD.#1 } { ctxdoc }
+ \hypersetup { hidelinks }
+ \hdclindex {#1} { }
+ }
+\seq_new:N \g__ctxdoc_module_dest_seq
+\zref@newlist { ctxdoc }
+\zref@newprop { guard@end } [ 1 ]
+ { \int_eval:n { \c@HD@hypercount - 1 } }
+\zref@addprop { ctxdoc } { guard@end }
+\cs_new_protected_nopar:Npn \__ctxdoc_star_format:
+ {
+ \seq_gpush:No \g__ctxdoc_slash_format_seq { \macro@font }
+ \seq_gpop:NNF \g__ctxdoc_star_format_seq \l__ctxdoc_format_tl
+ { \__ctxdoc_pop_format: }
+ \__ctxdoc_select_format:
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_slash_format:
+ {
+ \seq_gpop:NNTF \g__ctxdoc_slash_format_seq \l__ctxdoc_format_tl
+ {
+ \seq_gpush:No \g__ctxdoc_star_format_seq { \macro@font }
+ \__ctxdoc_select_format:
+ }
+ { \BOOM }
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_pm_format:
+ {
+ \seq_get:NNF \g__ctxdoc_star_format_seq \l__ctxdoc_format_tl
+ {
+ \__ctxdoc_pop_format:
+ \seq_gpush:No \g__ctxdoc_star_format_seq { \l__ctxdoc_format_tl }
+ }
+ \cs_if_eq:NNF \macro@font \l__ctxdoc_format_tl
+ { \l__ctxdoc_format_tl }
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_pop_format:
+ {
+ \seq_gpop_left:NN \g__ctxdoc_format_seq \l__ctxdoc_format_tl
+ \seq_gput_right:No \g__ctxdoc_format_seq { \l__ctxdoc_format_tl }
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_select_format:
+ {
+ \cs_if_eq:NNF \macro@font \l__ctxdoc_format_tl
+ {
+ \cs_gset_eq:NN \macro@font \l__ctxdoc_format_tl
+ \macro@font
+ }
+ }
+\tl_new:N \l__ctxdoc_format_tl
+\seq_new:N \g__ctxdoc_format_seq
+\seq_new:N \g__ctxdoc_star_format_seq
+\seq_new:N \g__ctxdoc_slash_format_seq
+\seq_gput_right:Nn \g__ctxdoc_format_seq { \MacroFont }
+\seq_gput_right:Nn \g__ctxdoc_format_seq { \AltMacroFont }
+\cs_set_protected:Npn \MacroFont
+ {
+ \linespread { 1 }
+ \small
+ \fontseries { \mddefault }
+ \fontshape { \updefault }
+ \ttfamily
+ \ctexdocverbaddon
+ }
+\cs_set_protected:Npn \AltMacroFont
+ {
+ \linespread { 1 }
+ \small
+ \fontseries { \mddefault }
+ \fontshape { \sldefault }
+ \ttfamily
+ \ctexdocverbaddon
+ }
+\AtBeginDocument
+ {
+ \tl_gset:Nx \macro@font
+ { \seq_item:Nn \g__ctxdoc_format_seq { 1 } }
+ }
+\cs_new_protected:Npn \__ctxdoc_output_module:nn #1#2
+ {
+ \tex_noindent:D
+ \group_begin:
+ #1
+ \footnotesize \normalfont \sffamily #2
+ \group_end:
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_star_color:
+ {
+ \seq_gpop:NNTF \g__ctxdoc_star_color_seq \current@color
+ { \set@color }
+ { \__ctxdoc_select_color: }
+ \seq_gpush:No \g__ctxdoc_slash_color_seq { \current@color }
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_slash_color:
+ {
+ \seq_gpop:NNTF \g__ctxdoc_slash_color_seq \current@color
+ {
+ \set@color
+ \seq_gpush:No \g__ctxdoc_star_color_seq { \current@color }
+ }
+ { \BOOM }
+ }
+\cs_new_protected_nopar:Npn \__ctxdoc_pm_color:
+ {
+ \seq_get:NNTF \g__ctxdoc_star_color_seq \current@color
+ { \set@color }
+ {
+ \__ctxdoc_select_color:
+ \seq_gpush:No \g__ctxdoc_star_color_seq { \current@color }
+ }
+ }
+\seq_new:N \g__ctxdoc_star_color_seq
+\seq_new:N \g__ctxdoc_slash_color_seq
+\cs_new_protected_nopar:Npn \__ctxdoc_select_color:
+ { \color { guard@series!!+ } }
+\definecolorseries { guard@series }
+ { cmyk } { last } { blue } { purple }
+\resetcolorseries [ 3 ] { guard@series }
+\definecolor { verb@guard } { rgb } { 0.5 , 0.5 , 0 }
+\definecolor { at@guard } { rgb } { 0.5 , 0 , 0.5 }
+\definecolor { code@gray } { gray } { 0.5 }
+\cs_new_protected:Npn \__ctxdoc_module_angle:n #1
+ { \textlangle #1 \textrangle }
+\cs_new_protected_nopar:Npn \__ctxdoc_code_line_no:
+ {
+ \int_gincr:N \c@CodelineNo
+ \hbox_overlap_left:n
+ {
+ \hbox_to_wd:nn
+ { \MacroIndent }
+ {
+ \HD@target
+ \tex_hss:D
+ \__ctxdoc_code_line_no_style:
+ \theCodelineNo \enspace
+ }
+ \tex_kern:D \@totalleftmargin
+ }
+ }
+\tl_set:Nn \theCodelineNo
+ { \arabic { CodelineNo } }
+\cs_new_protected_nopar:Npn \__ctxdoc_code_line_no_style:
+ { \color { code@gray } \normalfont \sffamily \tiny }
+\cs_set_protected:Npn \HD@SetMacroIndent #1
+ {
+ \group_begin:
+ \settowidth \MacroIndent
+ {
+ \__ctxdoc_code_line_no_style:
+ \prg_replicate:nn { \tl_count:n {#1} } { 0 }
+ \enspace
+ }
+ \dim_gset_eq:NN \MacroIndent \MacroIndent
+ \group_end:
+ }
+\ExplSyntaxOff
+\AtBeginDocument{\addtocontents{toc}{\StopSpecialIndexModule}}
+\pdfstringdefDisableCommands{%
+ \let\path\meta
+ \let\opt\@firstofone}
+\preto\@thehead{\cslet{MakeUppercase\space}{\@iden}}
+\def\orbar{\textup{\textbar}}
+\def\defaultval#1{\textbf{\textup{#1}}}
+\def\defaultvalaux#1){\defaultval{#1}}
+\def\TF{true\orbar false}
+\def\TTF{\defaultval{true}\orbar false}
+\def\TFF{true\orbar\defaultval{false}}
+\protected\def\opt{\texttt}
+\def\TeX{\hologo{TeX}}
+\def\pdfTeX{\hologo{pdfTeX}}
+\def\XeTeX{\hologo{XeTeX}}
+\def\XeLaTeX{\hologo{XeLaTeX}}
+\def\LuaLaTeX{\hologo{LuaLaTeX}}
+\def\pdfLaTeX{\hologo{pdfLaTeX}}
+\def\LaTeX{\hologo{LaTeX}}
+\def\LaTeXe{\hologo{LaTeX2e}}
+\def\LaTeXiii{\hologo{LaTeX3}}
+\def\dvipdfmx{\hologo{DVIPDFMx}}
+\def\TeXLive{\hologo{TeXLive}}
+\def\MiKTeX{\hologo{MiKTeX}}
+\def\pTeX{\hologo{pTeX}}
+\def\ApTeX{\hologo{ApTeX}}
+\def\upTeX{\hologo{upTeX}}
+\def\ApLaTeX{\hologo{ApLaTeX}}
+\def\upLaTeX{\hologo{upLaTeX}}
+\def\HoLogo@pTeX#1{p\kern -.15em \hologo{TeX}}
+\def\HoLogo@pLaTeX#1{p\kern -.05em \hologo{LaTeX}}
+\def\HoLogo@ApTeX#1{A\kern -.05em \hologo{pTeX}}
+\def\HoLogo@upTeX#1{u\kern -.05em \hologo{pTeX}}
+\def\HoLogo@ApLaTeX#1{A\kern -.05em \hologo{pLaTeX}}
+\def\HoLogo@upLaTeX#1{u\kern -.05em \hologo{pLaTeX}}
+\def\HoLogoBkm@pTeX#1{p\hologo{TeX}}
+\def\HoLogoBkm@pLaTeX#1{p\hologo{LaTeX}}
+\def\HoLogoBkm@ApTeX#1{A\hologo{pTeX}}
+\def\HoLogoBkm@upTeX#1{u\hologo{pTeX}}
+\def\HoLogoBkm@ApLaTeX#1{A\hologo{pLaTeX}}
+\def\HoLogoBkm@upLaTeX#1{u\hologo{pLaTeX}}
+\def\HoLogo@TeXLive#1{\TeX\ Live}
+\def\HoLogo@DVIPDFMx#1{DVIPDFM\ensuremath{x}}
+\def\bashcmd{\texttt}
+\def\BSTACK{\begin{tabular}[t]{@{}l@{}}}
+\def\ESTACK{\end{tabular}}
+\newenvironment{defaultcapconfig}{%
+ \MakePercentComment
+ \input{ctex-name-utf8.cfg}%
+ \ExplSyntaxOff
+ \MakePercentIgnore}{}
+\def\ctexkit{\href{https://github.com/CTeX-org/ctex-kit/}{\texttt{ctex-kit}}}
+\def\ctexkitrev#1{%
+ \href{https://github.com/CTeX-org/ctex-kit/commit/#1}{\texttt{ctex-kit} rev. #1}}
+\appto\GlossaryParms{%
+ \raggedcolumns
+ \let\Hy@writebookmark\HDorg@writebookmark
+ \def\@idxitem{\par\hangindent 2em }%
+ \def\subitem{\@idxitem\hspace*{1em}}%
+ \def\subsubitem{\@idxitem\hspace*{2em}}}
+\def\glossaryname{版本历史}
+\GlossaryPrologue{\section{\glossaryname}}
+\IndexPrologue{%
+ \section{\indexname}
+ \textit{意大利体的数字表示描述对应索引项的页码;
+ 带下划线的数字表示定义对应索引项的代码行号;
+ 罗马字体的数字表示使用对应索引项的代码行号。}}
+\def\IndexLayout{%
+ \newgeometry{hmargin=15mm,vmargin={25mm,15mm},footskip=7mm}%
+ \setlength\IndexMin{.5\textheight}%
+ \ctexset{section/numbering=false}%
+ \StopSpecialIndexModule}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+%%
+%%
+%% End of file ctxdoc.cls.
diff --git a/Master/texmf-dist/doc/latex/codebox/hellojava.java b/Master/texmf-dist/doc/latex/codebox/hellojava.java
new file mode 100755
index 00000000000..1cf8d2e9bc7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/hellojava.java
@@ -0,0 +1,5 @@
+public class HelloWorld {
+ public static void main(String[] args){
+ System.out.println("Hello World!");
+ }
+}
diff --git a/Master/texmf-dist/doc/latex/codebox/hellopy.py b/Master/texmf-dist/doc/latex/codebox/hellopy.py
new file mode 100755
index 00000000000..af687ef3847
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/hellopy.py
@@ -0,0 +1,32 @@
+import tensorflow as tf
+import numpy as np
+import os
+os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
+
+# Create 100 phony x, y data points in Numpy, y = x * 0.1 + 0.3
+x_data = np.random.random(100).astype("float32")
+y_data = x_data * 0.1 + 0.3
+
+# Try to find values for W and b that compute y_data = W * x_data + b
+W = tf.Variable(tf.random_uniform([1], -1.0, 1.0))
+b = tf.Variable(tf.zeros([1]))
+y = W * x_data + b
+
+# Minimize the mean squared errors.
+loss = tf.reduce_mean(tf.square(y -y_data))
+optimizer = tf.train.GradientDescentOptimizer(0.5)
+train = optimizer.minimize(loss)
+
+# Before starting, initialize the variables. We will 'run' this first
+init = tf.global_variables_initializer()
+
+# Launch the graph.
+sess = tf.Session()
+sess.run(init)
+
+# Fit the line.
+for step in range(201):
+ sess.run(train)
+ if step % 20 == 0:
+ print(step, sess.run(W), sess.run(b))
+
diff --git a/Master/texmf-dist/doc/latex/codebox/test.c b/Master/texmf-dist/doc/latex/codebox/test.c
new file mode 100644
index 00000000000..398d2d12bfa
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/codebox/test.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(void)
+{
+ printf("Hello World!\n");
+
+ return 0;
+}
diff --git a/Master/texmf-dist/tex/latex/codebox/codebox.sty b/Master/texmf-dist/tex/latex/codebox/codebox.sty
new file mode 100644
index 00000000000..69d19d788af
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/codebox/codebox.sty
@@ -0,0 +1,393 @@
+%%
+%% This is file `codebox.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% codebox.dtx (with options: `package')
+%%
+%% Copyright (C) 2020-2021 by Nan Geng <nangeng@nwafu.edu.cn>
+%% --------------------------------------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. This version of this license is in
+%% http://www.latex-project.org/lppl/lppl-1-3c.txt
+%% and the latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Nan Geng.
+%%
+%% --------------------------------------------------------------------------
+%%
+\NeedsTeXFormat{LaTeX2e}[2020/10/01]
+\RequirePackage{expl3}
+\GetIdInfo$Id: codebox.dtx 1.0.0 2021-12-26 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
+ {Code Box with tcolorbox and minted/listings.}
+\ProvidesExplPackage{\ExplFileName}
+ {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
+\RequirePackage { xtemplate, l3keys2e, xparse }
+\RequirePackage {fontawesome5, tcolorbox, varwidth, xcolor, etoolbox}
+\ExplSyntaxOff
+\patchcmd
+{\tcb@input@library@in}
+ {%
+ \input\tcbpkgprefix#1\relax%
+ }
+ {%
+ \@pushfilename
+ \input\tcbpkgprefix#1\relax%
+ \@popfilename
+ }
+ {}{}
+
+\patchcmd
+{\pgfutil@InputIfFileExists}
+ {\input #1}
+ {%
+ \@pushfilename
+ \xdef\@currname{#1}%
+ \input #1 %
+ \@popfilename
+ }
+ {}{}
+\ExplSyntaxOn
+\tcbuselibrary{skins, xparse, breakable}
+\tcbuselibrary{minted,listings}
+\usetikzlibrary{shapes.geometric}
+\definecolor{cvgrayc}{RGB}{247,247,247}
+\definecolor{cvgray}{RGB}{220,220,220}
+\definecolor{cvgrayb}{RGB}{153,153,153}
+\definecolor{cvblue}{RGB}{223,238,255}
+\definecolor{chengse}{RGB}{250,140,53}
+\tcbset{%
+ skin=enhanced,
+ lang/.style={%
+ breakable,%
+ drop~shadow,%
+ colframe=gray!75!black,%
+ left=4.5mm,
+ enhanced,%
+ colframe=tcbcolback!60!black,%
+ colback=white,%
+ colbacktitle=tcbcolback!5!gray!10!white,%
+ fonttitle=\bfseries,%
+ coltitle=black,%
+ attach~boxed~title~to~top~center={%
+ yshift=-0.25mm-\tcboxedtitleheight/2,%
+ yshifttext=2mm-\tcboxedtitleheight/2%
+ },%
+ attach~boxed~title~to~top~left={%
+ xshift=1cm,%
+ yshift*=1mm-\tcboxedtitleheight%
+ },%
+ varwidth~boxed~title*=-3cm,%
+ boxed~title~style={%
+ frame~code={%
+ \path[fill=tcbcolback!30!black]([yshift=-1mm,xshift=-1mm]frame.north~west)%
+ arc[start~angle=0,end~angle=180,radius=1mm]([yshift=-1mm,xshift=1mm]frame.north~east)%
+ arc[start~angle=180,end~angle=0,radius=1mm];%
+ \path[left~color=tcbcolback!60!black,right~color=tcbcolback!60!black,
+ middle~color=tcbcolback!80!black]([xshift=-2mm]frame.north~west)%
+ --([xshift=2mm]frame.north~east)[rounded~corners=1mm]%
+ --([xshift=1mm,yshift=-1mm]frame.north~east)%
+ --(frame.south~east)%
+ --(frame.south~west)%
+ --([xshift=-1mm,yshift=-1mm]frame.north~west)[sharp~corners]%
+ --cycle;%
+ },%
+ interior~engine=empty%
+ },%
+ overlay={%
+ \begin{tcbclipinterior}
+ \fill[tcbcolback!80!black] (frame.south~west) rectangle
+ ([xshift=5mm]frame.north~west);
+ \end{tcbclipinterior}%
+ },
+ }%
+}%
+\tcbset{%
+ skin=enhanced,
+ cv/.style={
+ boxrule=0.4mm,
+ breakable,
+ top=0mm,
+ boxsep=1mm,
+ drop~shadow,
+ attach~boxed~title~to~top,
+ colframe=blue!75!black,
+ left=4.5mm,
+ right=0mm,
+ enhanced,
+ colframe=tcbcolback!60!black,
+ colback=white,
+ colbacktitle=cvgray,
+ fonttitle=\ttfamily,
+ coltitle=black,
+ % overlay~broken = {
+ % \begin{tcbclipinterior}
+ % \fill[cvblue] (frame.south~west) rectangle ([xshift=5.0mm]frame.north~west);
+ % \end{tcbclipinterior}
+ % },
+ underlay~boxed~title = {
+ \begin{tcbclipinterior}
+ \fill[cvblue] (frame.south~west) rectangle ([xshift=5.0mm,yshift=0mm]frame.north~west);
+ \end{tcbclipinterior}
+ }
+ }
+}%
+\bool_new:N \l__codebox_minted_bool
+\bool_new:N \l__codebox_comment_bool
+
+\tl_new:N \l__codebox_language_tl
+\tl_new:N \l__codebox_code_style_tl
+\tl_new:N \l__codebox_code_fontsize_tl
+\tl_new:N \l__codebox_code_name_tl
+\tl_new:N \l__codebox_comment_contents_tl
+\tl_new:N \l__codebox_comment_format_tl
+\fp_new:N \l__codebox_baseline_stretch_fp
+\fp_new:N \l__codebox_linenumber_sep_fp
+\keys_define:nn { codebox }
+ {
+ minted .bool_set:N = \l__codebox_minted_bool,
+ minted .default:n = true,
+ minted .initial:n = true,
+ lang .tl_set:N = \l__codebox_language_tl,
+ lang .initial:n = C,
+ pretitle .tl_set:N = \l__codebox_code_name_tl,
+ pretitle .initial:n = Code,
+ codestyle .tl_set:N = \l__codebox_code_style_tl,
+ codestyle .initial:n = default,
+ codesize .tl_set:N = \l__codebox_code_fontsize_tl,
+ codesize .initial:n = \small,
+ comments .tl_set:N = \l__codebox_comment_contents_tl,
+ comments .initial:n = {},
+ commentf .tl_set:N = \l__codebox_comment_format_tl,
+ commentf .initial:n = \small\sffamily,
+ codestretch .code:n = { \fp_set:Nn \l__codebox_baseline_stretch_fp { #1 }
+ },
+ codestretch .initial:n = 1.0,
+ linenumsep .fp_set:N = \l__codebox_linenumber_sep_fp,
+ linenumsep .initial:n = 3.00,
+ unknown .code:n = { \__codebox_error:n { unknown-option } }
+ }
+\msg_new:nnn { codebox } { unknown-option }
+ { package~ option~ "\l_keys_key_tl"~ is~ unknown. }
+\NewDocumentCommand \codeset { m }
+ { \keys_set:nn { codebox } {#1} }
+\cs_new:Npn \__codebox_set_counter_parent:
+ {
+ \ifdef{\thechapter}
+ {
+ \newcounter{codecounter}[chapter]%
+ }{
+ \newcounter{codecounter}[section]%
+ }
+ }
+\cs_new:Npn \__codebox_code_engine_tcbset:n #1
+ {
+ \bool_if:NTF \l__codebox_minted_bool
+ {
+ \tcbset{
+ listing~engine=minted,%
+ minted~style=#1,
+ minted~options={%
+ % highlightlines={\ifodd\value{lstnumber}\value{lstnumber}\fi},
+ autogobble,
+ breaklines,%
+ fontsize=\tl_use:N \l__codebox_code_fontsize_tl,%
+ baselinestretch=\fp_eval:n { \l__codebox_baseline_stretch_fp },
+ breaksymbolleft={},%
+ linenos,%
+ numbersep=\fp_eval:n { \l__codebox_linenumber_sep_fp }~mm,
+ },%
+ minted~language=\tl_use:N \l__codebox_language_tl%
+ }
+ }{
+ \lstset{% general command to set parameter(s)
+ basicstyle=\ttfamily\tl_use:N \l__codebox_code_fontsize_tl, % print whole listing small
+ keywordstyle=\color{chengse}\bfseries,%
+ identifierstyle=, % nothing happens
+ breaklines=true,
+ commentstyle=\itshape\color{gray},
+ stringstyle=\ttfamily, % typewriter type for strings
+ numbers=left,%
+ numberstyle=\tl_use:N \l__codebox_code_fontsize_tl\sffamily\color[rgb]{0.5,0.5,1.0},%
+ }%
+ \tcbset{
+ overlay={%
+ \begin{tcbclipinterior}
+ \fill[tcbcolback!80!black] (frame.south~west) rectangle
+ ([xshift=5mm]frame.north~west);
+ \end{tcbclipinterior}%
+ },%
+ listing~options={
+ language=\tl_use:N \l__codebox_language_tl,
+ numbersep=\fp_eval:n { \l__codebox_linenumber_sep_fp }~mm,
+ %linebackgroundcolor={\ifodd\value{lstnumber}\color{cvgray}\fi}
+ }
+ }%
+ }
+ }
+\cs_generate_variant:Nn \__codebox_code_engine_tcbset:n {V}
+\cs_new:Npn \__codebox_comment_tcbset:
+ {
+ \bool_if:NTF { \l__codebox_comment_bool }
+ {
+ \tcbset{%
+ listing~and~comment,%
+ colbacklower=tcbcolback!5!yellow!10!white,%
+ collower=tcbcolback!60!black,%
+ comment={\tl_use:N \l__codebox_comment_format_tl~
+ \tl_use:N \l__codebox_comment_contents_tl},%
+ }
+ }{
+ \tcbset{ listing~only,}
+ }
+ }
+\NewDocumentEnvironment{ codebox }{O{} m }
+ {
+ \bool_set_false:N \l__codebox_comment_bool
+ \group_begin:
+ \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \__codebox_code_engine_tcbset:V \l__codebox_code_style_tl,
+ \__codebox_comment_tcbset:
+ \tcbset{lang, title={#2} }%
+ \tcblisting{}
+ }{
+ \endtcblisting
+ \group_end:
+ }
+\NewDocumentEnvironment{ codebox* }{O{} m }
+ {
+ \bool_set_false:N \l__codebox_comment_bool
+ \group_begin:
+ \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \__codebox_code_engine_tcbset:V \l__codebox_code_style_tl,
+ \__codebox_comment_tcbset:
+ \tcbset{lang, title={#2} }%
+ \tcblisting{}
+ }{
+ \endtcblisting
+ \group_end:
+ }
+\NewDocumentCommand \codefile { s O{} m m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \bool_set_true:N \l__codebox_comment_bool
+ }{
+ \bool_set_false:N \l__codebox_comment_bool
+ }
+
+ \group_begin:
+ \IfNoValueF{#2}{ \keys_set:nn { codebox } { #2 } }
+ \__codebox_code_engine_tcbset:V \l__codebox_code_style_tl,
+ \__codebox_comment_tcbset:
+ \tcbset{
+ lang,
+ title={#3},
+ listing~file={#4},
+ }%
+ \tcbinputlisting{ }
+ \group_end:
+ }
+\__codebox_set_counter_parent:
+\DeclareTCBListing[use~counter=codecounter]{codeviewaux}{m}
+ {
+ title={\tl_use:N \l__codebox_code_name_tl\thecodecounter~#1},
+ }
+\NewDocumentEnvironment{ codeview }{O{} m }
+ {
+ \bool_set_false:N \l__codebox_comment_bool
+ \group_begin:
+ \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \__codebox_code_engine_tcbset:V \l__codebox_code_style_tl,
+ \__codebox_comment_tcbset:
+ \tcbset{
+ cv,
+ overlay~unbroken~and~first ={
+ \begin{tcbclipinterior}
+ \node[inner~sep=0pt,anchor=north~east,yshift=-3pt,xshift=-5pt,text=cvgrayb]
+ at (frame.north~east){
+ \ttfamily\faFile*\ \faCode\ \faCodeBranch\ \faCopy\ \faExternalLink*\
+ \MakeUppercase{\tl_use:N \l__codebox_language_tl}
+ };
+ \end{tcbclipinterior}
+ }
+ }%
+ \codeviewaux{#2}
+ }{
+ \endcodeviewaux
+ \group_end:
+ }
+\NewDocumentEnvironment{ codeview* }{O{} m }
+ {
+ \bool_set_true:N \l__codebox_comment_bool
+ \group_begin:
+ \IfNoValueF{#1}{ \keys_set:nn { codebox } { #1 } }
+ \__codebox_code_engine_tcbset:V \l__codebox_code_style_tl,
+ \__codebox_comment_tcbset:
+ \tcbset{
+ cv,
+ overlay~unbroken~and~first ={
+ \begin{tcbclipinterior}
+ \node[inner~sep=0pt,anchor=north~east,yshift=-3pt,xshift=-5pt,text=cvgrayb]
+ at (frame.north~east){
+ \ttfamily\faFile*\ \faCode\ \faCodeBranch\ \faCopy\ \faExternalLink*\
+ \MakeUppercase{\tl_use:N \l__codebox_language_tl}
+ };
+ \end{tcbclipinterior}
+ }
+ }%
+ \codeviewaux{#2}
+ }{
+ \endcodeviewaux
+ \group_end:
+ }
+\DeclareTCBInputListing[use~counter=codecounter]{\langfileaux}{m}
+ {
+ title={\tl_use:N \l__codebox_code_name_tl\thecodecounter~#1},
+ }
+\NewDocumentCommand \cvfile { s O{} m m }
+ {
+ \IfBooleanTF{#1}
+ {
+ \bool_set_true:N \l__codebox_comment_bool
+ }{
+ \bool_set_false:N \l__codebox_comment_bool
+ }
+
+ \group_begin:
+ \IfNoValueF{#2}{ \keys_set:nn { codebox } { #2 } }
+ \__codebox_code_engine_tcbset:V \l__codebox_code_style_tl,
+ \__codebox_comment_tcbset:
+ \tcbset{
+ cv,
+ listing~file={#4},
+ overlay~unbroken~and~first ={
+ \begin{tcbclipinterior}
+ \node[inner~sep=0pt,anchor=north~east,yshift=-3pt,xshift=-5pt,text=cvgrayb]
+ at (frame.north~east){
+ \ttfamily\faFile*\ \faCode\ \faCodeBranch\ \faCopy\ \faExternalLink*\
+ \MakeUppercase{\tl_use:N \l__codebox_language_tl}
+ };
+ \end{tcbclipinterior}
+ }
+ }%
+ \langfileaux{#3}
+ \group_end:
+ }
+%%
+%% This package consists of the file codebox.dtx,
+%% and the derived files codebox.sty,
+%% codebox.pdf,
+%% codebox.ins,
+%% README.md.
+%%
+%% End of file `codebox.sty'.
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 02300b4b310..fed32d41e97 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -185,7 +185,7 @@ my @TLP_working = qw(
cmap cmarrows cmathbb cmbright cmcyr
cmdstring cmdtrack cmexb cmextra cmll cmpica cmpj cmsd cmsrb cmtiup
cmupint cnbwp cnltx cntformats cntperchap
- cochineal codeanatomy codedoc codehigh codepage codesection
+ cochineal codeanatomy codebox codedoc codehigh codepage codesection
codicefiscaleitaliano
coelacanth coffeestains collcell collectbox collref
colophon color-edits colordoc colorinfo coloring colorist colorprofiles
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 3ff4c8114c2..84576659b46 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -1932,6 +1932,7 @@ $standardtex
'clock', '\.sty|clock\.tex',
'cloze', '\.tex|' . $standardtex,
'cmap', '\.cmap|' . $standardtex,
+ 'codebox', '\.sty', # not ctxdoc-en.cls
'codehigh', '\.lua$|' . $standardtex,
'codepage', '\.sty|\.tex',
'colorprofiles', '\.(icc|sty|tex)$',
@@ -2783,6 +2784,7 @@ $standardsource = '(\.(bat|c|drv|[dem]tx|fea|fdd|ins|mk|sfd)'
'circuit-macros', 'NULL', # leave Makefile
'cluttex', 'NULL', # leave Makefile
'cmextra', 'NULL',
+ 'codebox', 'NULL',
'concmath-fonts', 'NULL',
'crossrefware', 'NULL',
'crossword', $standardsource . '|AcrossLite',
@@ -2972,6 +2974,7 @@ my $core_latex = "$Master/texmf-dist/tex/latex";
'clefval' => 'latex -translate-file=empty.tcx', # no 8-bit
'cleveref' => 'latex', # requires interaction
'clrstrip' => 'tex',
+ 'codebox', => 'etex',
'ctable' => 'latex', # requires interaction
'curve2e' => 'pdflatex', # 8bit
'dateiliste' => 'latex', # requires interaction
diff --git a/Master/tlpkg/tlpsrc/codebox.tlpsrc b/Master/tlpkg/tlpsrc/codebox.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/codebox.tlpsrc
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index fdd3f50fbdf..feb9dcf8e90 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -198,6 +198,7 @@ depend cmsd
depend cnltx
depend cntformats
depend cntperchap
+depend codebox
depend codedoc
depend codehigh
depend codepage