| 1 |
% \iffalse meta-comment |
| 2 |
% !TEX program = XeLaTeX |
| 3 |
%<*internal> |
| 4 |
\iffalse |
| 5 |
%</internal> |
| 6 |
%<*readme> |
| 7 |
Terminal simulation based on tcolorbox and minted/listings |
| 8 |
======= |
| 9 |
|
| 10 |
`termsim` is a LaTeX package developed based on tcolorbox and minted/listings, which provides a environment `terminal`(`terminal*`) and a macro `\termfile`(`\termfile*`) to simulate Win10, Ubuntu and Mac terminal. |
| 11 |
|
| 12 |
The `terminal`(`terminal*`) evironment create a tcolorbox to simulate terminal with the eviroment body and the `\termfile`(`\termfile*`) macro from a source file. |
| 13 |
|
| 14 |
The OS type was selected from win10, mac, or ubuntu and |
| 15 |
the terminal theme was selected from dark, light, or with key-value option. |
| 16 |
|
| 17 |
All options can be set with `\termset` macro or `terminal`(`terminal*`) eniroment's and |
| 18 |
`\termfile`(`\termfile*`) macro's option |
| 19 |
|
| 20 |
You can read the manual (in Chinese) for more details and examples. |
| 21 |
|
| 22 |
Contributing |
| 23 |
------------ |
| 24 |
|
| 25 |
1. github repository: |
| 26 |
1. repository: [termsim](https://github.com/registor/termsim) |
| 27 |
2. Issues and pull requests are welcome. [issue](https://github.com/registor/termsim/issues) or [pull request](https://github.com/registor/termsim/pulls). |
| 28 |
|
| 29 |
2. gitee repository: |
| 30 |
1. repository: [termsim](https://gitee.com/nwafu_nan/termsim) |
| 31 |
2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/termsim/issues) or [pull request](https://gitee.com/nwafu_nan/termsim/pulls). |
| 32 |
|
| 33 |
基于tcolorbox的终端模拟宏包 |
| 34 |
======= |
| 35 |
|
| 36 |
`termsim`是一个基于tcolorbox的用LaTeX3开发的终端模拟LaTeX宏包,它提供了用于模拟终端窗口的`terminal`(`terminal*`)环境和`\termfile`(`\termfile*`)命令,以模拟Win10、Ubuntu或Mac的终端窗口。 |
| 37 |
|
| 38 |
`terminal`(`terminal*`)环境根据环境内容创建一个`tcolorbox`盒子用于模拟终端窗口, |
| 39 |
`\termfile`(`\termfile*`)命令根据载入的文件内容创建一个`tcolorbox`盒子用于模拟终端窗口。 |
| 40 |
|
| 41 |
可以通过`terminal`(`terminal*`)环境或`\termfile`(`\termfile*`)命令的`key-value`选项设置操作系统类型(win10、mac或ubuntu),并可选择暗色(dark)、亮色(light)或白色(white)颜色主题。 |
| 42 |
|
| 43 |
所有选项即可以通过环境或命令选项设置,也可以通过`\termset`命令进行设置。 |
| 44 |
|
| 45 |
可以通过阅读宏包手册(中文)以也解该宏包更多的使用细节和使用样例。 |
| 46 |
|
| 47 |
### 参与贡献 |
| 48 |
--------------------- |
| 49 |
|
| 50 |
1. github仓库: |
| 51 |
(1). 仓库地址: [termsim](https://github.com/registor/termsim) |
| 52 |
(2). Issues和PR: [issue](https://github.com/registor/termsim/issues) or [pull request](https://github.com/registor/termsim/pulls). |
| 53 |
|
| 54 |
2. gitee仓库: |
| 55 |
(1). 仓库地址: [termsim](https://gitee.com/nwafu_nan/termsim) |
| 56 |
(2). Issues and PR: [issue](https://gitee.com/nwafu_nan/termsim/issues) or [pull request](https://gitee.com/nwafu_nan/termsim/pulls). |
| 57 |
|
| 58 |
Copyright and Licence |
| 59 |
--------------------- |
| 60 |
|
| 61 |
Copyright (C) 2020-2021 by Nan Geng <[email protected]> |
| 62 |
---------------------------------------------------------------------- |
| 63 |
|
| 64 |
This work may be distributed and/or modified under the |
| 65 |
conditions of the LaTeX Project Public License, either |
| 66 |
version 1.3c of this license or (at your option) any later |
| 67 |
version. This version of this license is in |
| 68 |
http://www.latex-project.org/lppl/lppl-1-3c.txt |
| 69 |
and the latest version of this license is in |
| 70 |
http://www.latex-project.org/lppl.txt |
| 71 |
and version 1.3 or later is part of all distributions of |
| 72 |
LaTeX version 2005/12/01 or later. |
| 73 |
|
| 74 |
This work has the LPPL maintenance status "maintained". |
| 75 |
|
| 76 |
The Current Maintainer of this work is Nan Geng. |
| 77 |
|
| 78 |
This package consists of the file termsim.dtx, |
| 79 |
and the derived files termsim.sty, |
| 80 |
termsim.pdf, |
| 81 |
termsim.ins, |
| 82 |
README.md (this file). |
| 83 |
|
| 84 |
%</readme> |
| 85 |
%<*internal> |
| 86 |
\fi |
| 87 |
\begingroup |
| 88 |
\def\temp{LaTeX2e} |
| 89 |
\expandafter\endgroup\ifx\temp\fmtname\else |
| 90 |
\csname fi\endcsname |
| 91 |
%</internal> |
| 92 |
%<*install> |
| 93 |
|
| 94 |
\input ctxdocstrip % |
| 95 |
|
| 96 |
\let\MetaPrefix\relax |
| 97 |
|
| 98 |
\preamble |
| 99 |
|
| 100 |
Copyright (C) 2020-2021 by Nan Geng <[email protected]> |
| 101 |
-------------------------------------------------------------------------- |
| 102 |
|
| 103 |
This work may be distributed and/or modified under the |
| 104 |
conditions of the LaTeX Project Public License, either |
| 105 |
version 1.3c of this license or (at your option) any later |
| 106 |
version. This version of this license is in |
| 107 |
http://www.latex-project.org/lppl/lppl-1-3c.txt |
| 108 |
and the latest version of this license is in |
| 109 |
http://www.latex-project.org/lppl.txt |
| 110 |
and version 1.3 or later is part of all distributions of |
| 111 |
LaTeX version 2005/12/01 or later. |
| 112 |
|
| 113 |
This work has the LPPL maintenance status "maintained". |
| 114 |
|
| 115 |
The Current Maintainer of this work is Nan Geng. |
| 116 |
|
| 117 |
-------------------------------------------------------------------------- |
| 118 |
|
| 119 |
\endpreamble |
| 120 |
|
| 121 |
\postamble |
| 122 |
|
| 123 |
This package consists of the file termsim.dtx, |
| 124 |
and the derived files termsim.sty, |
| 125 |
termsim.pdf, |
| 126 |
termsim.ins, |
| 127 |
README.md. |
| 128 |
\endpostamble |
| 129 |
|
| 130 |
\declarepostamble\emptypostamble |
| 131 |
\endpostamble |
| 132 |
|
| 133 |
\def\MetaPrefix{-- } |
| 134 |
|
| 135 |
|
| 136 |
\let\MetaPrefix\DoubleperCent |
| 137 |
|
| 138 |
\generate |
| 139 |
{ |
| 140 |
%</install> |
| 141 |
%<*internal> |
| 142 |
\usedir{source/xelatex/termsim} |
| 143 |
\file{termsim.ins} {\from{\jobname.dtx}{install}} |
| 144 |
%</internal> |
| 145 |
%<*install> |
| 146 |
\usedir{xetex/xelatex/termsim} |
| 147 |
\file{termsim.sty} {\from{\jobname.dtx}{package}} |
| 148 |
\nopreamble\nopostamble |
| 149 |
\usedir{doc/xelatex/termsim} |
| 150 |
\file{README.md} {\from{\jobname.dtx}{readme}} |
| 151 |
} |
| 152 |
|
| 153 |
\endbatchfile |
| 154 |
%</install> |
| 155 |
%<*internal> |
| 156 |
\fi |
| 157 |
%</internal> |
| 158 |
%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01] |
| 159 |
%<package>\RequirePackage{expl3} |
| 160 |
%<+package>\GetIdInfo$Id: termsim.dtx 1.1.1 2021-12-26 08:00:00 +0800 Nan Geng <[email protected]> $ |
| 161 |
%<package> {Terminal simulation with tcolorbox and minted/listings.} |
| 162 |
%<package>\ProvidesExplPackage{\ExplFileName} |
| 163 |
%<package> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} |
| 164 |
%<*driver> |
| 165 |
\documentclass{ctxdoc} |
| 166 |
\usepackage{minted} |
| 167 |
\usepackage{listings} |
| 168 |
\usepackage{xcolor} |
| 169 |
\usepackage{xcolor-material} |
| 170 |
\usepackage{termsim} |
| 171 |
\NewDocumentCommand{\init}{+v}{\hspace{\fill}初始值~=~\textcolor{blue}{\bfseries#1}} |
| 172 |
\DeclareDocumentCommand\opt{m}{\texttt{#1}} |
| 173 |
\DeclareDocumentCommand\kvopt{mm} |
| 174 |
{\texttt{#1\breakablethinspace=\breakablethinspace#2}} |
| 175 |
\def\breakablethinspace{\hskip 0.16667em\relax} |
| 176 |
\begin{document} |
| 177 |
%<!--CODEDOC--> \DisableImplementation |
| 178 |
\EnableImplementation |
| 179 |
\DocInput{\jobname.dtx} |
| 180 |
\IndexLayout |
| 181 |
\PrintChanges |
| 182 |
\PrintIndex |
| 183 |
\end{document} |
| 184 |
%</driver> |
| 185 |
% \fi |
| 186 |
% |
| 187 |
% \changes{v1.0.0}{2021/12/14}{开始编写模板} |
| 188 |
% |
| 189 |
% \CheckSum{318} |
| 190 |
% \GetFileId{termsim.sty} |
| 191 |
% |
| 192 |
% \CharacterTable |
| 193 |
% {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 |
| 194 |
% 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 |
| 195 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 196 |
% Exclamation \! Double quote \" Hash (number) \# |
| 197 |
% Dollar \$ Percent \% Ampersand \& |
| 198 |
% Acute accent \' Left paren \( Right paren \) |
| 199 |
% Asterisk \* Plus \+ Comma \, |
| 200 |
% Minus \- Point \. Solidus \/ |
| 201 |
% Colon \: Semicolon \; Less than \< |
| 202 |
% Equals \= Greater than \> Question mark \? |
| 203 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 204 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 205 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 206 |
% Right brace \} Tilde \~} |
| 207 |
% |
| 208 |
% |
| 209 |
% \title{\bfseries\pkg{termsim}:终端窗口模拟宏包\\\bfseries\pkg{termsim}:terminal simulation package} |
| 210 |
% \author{耿楠\\ \path{[email protected]}} |
| 211 |
% \date{\filedate\qquad\fileversion\thanks{\url{https://github.com/registor/termsim}}\thanks{\url{https://gitee.com/nwafu_nan/termsim}}} |
| 212 |
% \maketitle |
| 213 |
% |
| 214 |
% \begin{documentation} |
| 215 |
% |
| 216 |
% \begin{abstract} |
| 217 |
% |
| 218 |
% \pkg{termsim} 是一个基于\pkg{tcolorbox}宏包,用\LaTeX3 开发的 \LaTeX 宏包, |
| 219 |
% 它提供了用于模拟Win10、Ubuntu和Mac的终端窗口的\env{terminal}环境和\tn{termfile}命令, |
| 220 |
% \env{terminal}环境将环境中的内容在模拟的终端窗口中输出, |
| 221 |
% 而\tn{termfile}命令用于将指定的文件读入后在模拟的终端窗口中输出。 |
| 222 |
% 同时提供了\env{terminal*}环境和\tn{termfile*}命令,用于模拟带底线注释的终端窗口。 |
| 223 |
% 操作系统类型和终端窗口颜色主题等样式, |
| 224 |
% 可以通过\tn{termset}命令或\env{terminal}(\env{terminal*})环境和 |
| 225 |
% \tn{termfile}(\tn{termfile*})命令的可选项进行设置。 |
| 226 |
% |
| 227 |
% \end{abstract} |
| 228 |
% |
| 229 |
% \tableofcontents |
| 230 |
% |
| 231 |
% \section{简要说明} |
| 232 |
% |
| 233 |
% \pkg{termsim} 是一个用于模拟Win10、Ubuntu和Mac终端窗口的\LaTeX{}宏包, |
| 234 |
% 用于实现对Win10、Mac或Ubuntu终端窗口的模拟排版。 |
| 235 |
% |
| 236 |
% \section{用户接口} |
| 237 |
% |
| 238 |
% \subsection{\env{terminal}和\env{terminal*}环境} |
| 239 |
% |
| 240 |
% \begin{function}[added=2021-12-17,updated=2021-12-17]{terminal,terminal*} |
| 241 |
% \begin{syntax} |
| 242 |
% \tn{begin}\{terminal\} \oarg{外观选项} \Arg{窗口标题} |
| 243 |
% ..... |
| 244 |
% \tn{end}\{terminal\} |
| 245 |
% |
| 246 |
% \tn{begin}\{terminal*\} \oarg{外观选项} \oarg{底线注释} \Arg{窗口标题} |
| 247 |
% ..... |
| 248 |
% \tn{end}\{terminal*\} |
| 249 |
% \end{syntax} |
| 250 |
% |
| 251 |
% 排版终端窗口,内容来自于由环境内容, |
| 252 |
% 可以通过\Arg{窗口标题}为窗口设置标题。 |
| 253 |
% |
| 254 |
% \oarg{外观选项}中通过key-value方式设置终端窗口的外观。 |
| 255 |
% |
| 256 |
% 星号环境\texttt{terminal*}用于为终端窗口添加底线注释, |
| 257 |
% 注意此时需要在\oarg{外观选项}后提供\oarg{底线注释}内容。 |
| 258 |
% |
| 259 |
% 终端窗口的外观也可以通过\tn{termset}命令的逗号分隔 |
| 260 |
% key-value列表进行设置。 |
| 261 |
% |
| 262 |
% \end{function} |
| 263 |
% \begin{Verbatim}[frame=none,numbers=left,gobble=5] |
| 264 |
% \centering |
| 265 |
% \termset{os=win10,theme=dark,shstretch=1.0} |
| 266 |
% \begin{terminal}{窗口标题} |
| 267 |
% C:\Users\Administrator 的目录 |
| 268 |
% 2018/07/21 15:39 <DIR> . |
| 269 |
% 2018/07/21 15:39 <DIR> .. |
| 270 |
% 2018/07/13 08:35 <DIR> 3D Objects |
| 271 |
% 2018/07/13 08:35 <DIR> Contacts |
| 272 |
% 2018/08/06 07:46 <DIR> Desktop |
| 273 |
% 2 个文件 6,029,312 字节 |
| 274 |
% 18 个目录 14,035,107,840 可用字节 |
| 275 |
% \end{terminal} |
| 276 |
% \end{Verbatim} |
| 277 |
% |
| 278 |
%\begin{center} |
| 279 |
%\begin{minipage}{0.85\textwidth} |
| 280 |
%\termset{os=win10,theme=dark,shstretch=1.0} |
| 281 |
%\begin{terminal}{窗口标题} |
| 282 |
%C:\Users\Administrator 的目录 |
| 283 |
%2018/07/21 15:39 <DIR> . |
| 284 |
%2018/07/21 15:39 <DIR> .. |
| 285 |
%2018/07/13 08:35 <DIR> 3D Objects |
| 286 |
%2018/07/13 08:35 <DIR> Contacts |
| 287 |
%2018/08/06 07:46 <DIR> Desktop |
| 288 |
% 2 个文件 6,029,312 字节 |
| 289 |
% 18 个目录 14,035,107,840 可用字节 |
| 290 |
%\end{terminal} |
| 291 |
%\end{minipage} |
| 292 |
%\end{center} |
| 293 |
% |
| 294 |
% \subsection{\tn{termfile}和\tn{termfile*}命令} |
| 295 |
% |
| 296 |
% \begin{function}[added=2021-12-18,updated=2021-12-18]{\termfile,\termfile*} |
| 297 |
% \begin{syntax} |
| 298 |
% \tn{termfile} \oarg{外观选项} \Arg{窗口标题} \Arg{内容文件} |
| 299 |
% \tn{termfile*} \oarg{外观选项} \oarg{底线注释} \Arg{窗口标题} \Arg{内容文件} |
| 300 |
% \end{syntax} |
| 301 |
% |
| 302 |
% 排版终端窗口,内容来自于由\Arg{内容文件}, |
| 303 |
% 可以通过\Arg{窗口标题}为窗口设置标题。 |
| 304 |
% |
| 305 |
% \oarg{外观选项}中通过key-value方式设置终端窗口的外观。 |
| 306 |
% |
| 307 |
% 星号命令\tn{termfile*}用于为终端窗口添加底线注释, |
| 308 |
% 注意此时需要在\oarg{外观选项}后提供\oarg{底线注释}内容。 |
| 309 |
% |
| 310 |
% 排版样式也可以通过\tn{termset}命令的逗号分隔的 |
| 311 |
% key-value列表进行设置。 |
| 312 |
% \end{function} |
| 313 |
% |
| 314 |
% \newpage |
| 315 |
% |
| 316 |
% \begin{Verbatim}[frame=none,numbers=left,gobble=5] |
| 317 |
% \centering |
| 318 |
% \termfile{窗口标题}{test.bat} |
| 319 |
% \end{Verbatim} |
| 320 |
% |
| 321 |
%\begin{center} |
| 322 |
%\begin{minipage}{0.85\textwidth} |
| 323 |
%\termfile{窗口标题}{test.bat} |
| 324 |
%\end{minipage} |
| 325 |
%\end{center} |
| 326 |
% |
| 327 |
%\subsection{\tn{termset}命令} |
| 328 |
% |
| 329 |
% \begin{function}[added=2021-12-18,updated=2021-12-18]{\termset} |
| 330 |
% \begin{syntax} |
| 331 |
% \tn{termset} \marg{键值列表} |
| 332 |
% \end{syntax} |
| 333 |
% \tn{termset} 的参数是一组由(英文)逗号分隔的选项列表, |
| 334 |
% 列表中的选项采用 \kvopt{\meta{key}}{\meta{value}} 形式。 |
| 335 |
% 部分选项的\meta{value} 可以省略。 |
| 336 |
% 对于同一选项,后续设置会覆盖以前的设置。 |
| 337 |
% |
| 338 |
% 多数选项都设有默认值。 |
| 339 |
% |
| 340 |
% \tn{termset} 采用 \LaTeX3 风格的键值设置,支持不同类型以及多种 |
| 341 |
% 层次的选项设定。键值列表中,“|=|”左右的空格不影响设置;但需注意, |
| 342 |
% 参数列表中\textbf{不可以出现空行}。 |
| 343 |
% |
| 344 |
% 布尔型的参数 \kvopt{\meta{选项}}{true} 中的“|= true|”可以省略。 |
| 345 |
% \end{function} |
| 346 |
% |
| 347 |
% \section{选项说明} |
| 348 |
% |
| 349 |
% \pkg{termsim}宏包提供了一系列选项,以设置终端窗口外观样式。 |
| 350 |
% 载入\pkg{termsim}宏包后,以下选项均可通过用户接口命令\tn{termset}进行设置。 |
| 351 |
% 同时,这些选项也可以通过\env{terminal}(\env{terminal*})环境或 |
| 352 |
% \tn{termfile}(\tn{termfile*})命令的\oarg{外观选项}进行设置。 |
| 353 |
% |
| 354 |
% \subsection{代码引擎} |
| 355 |
% |
| 356 |
% \begin{function}[added=2021-12-18,updated=2021-12-18]{minted} |
| 357 |
% \begin{syntax} |
| 358 |
% minted = <\TTF> \init{true} |
| 359 |
% \end{syntax} |
| 360 |
% \opt{minted} 用于设置代码排版引擎,如为\textbf{true}则使用\pkg{minted}宏包 |
| 361 |
% 排版终端窗口中的内容,如为\textbf{false}则使用\pkg{listings}宏包排版 |
| 362 |
% 终端窗口中的内容。默认值为\textbf{true}。 |
| 363 |
% \end{function} |
| 364 |
% |
| 365 |
% \subsection{操作系统} |
| 366 |
% |
| 367 |
% \begin{function}[added=2021-12-18,updated=2021-12-18]{os} |
| 368 |
% \begin{syntax} |
| 369 |
% os = <win10|mac|ubuntu> \init{win10} |
| 370 |
% \end{syntax} |
| 371 |
% \opt{os} 用于设置终端窗口的操作系统类型,默认值为\textbf{win10}。 |
| 372 |
% \end{function} |
| 373 |
% |
| 374 |
% \subsection{颜色主题} |
| 375 |
% |
| 376 |
% \begin{function}[added=2021-12-18,updated=2021-12-18]{theme} |
| 377 |
% \begin{syntax} |
| 378 |
% theme = <dark|light|white> \init{dark} |
| 379 |
% \end{syntax} |
| 380 |
% \opt{theme} 用于设置终端窗口的颜色主题,默认值为\textbf{dark}。 |
| 381 |
% \end{function} |
| 382 |
% |
| 383 |
% \subsection{代码样式} |
| 384 |
% |
| 385 |
% \begin{function}[added=2021-12-18,updated=2021-12-18]{shstyle} |
| 386 |
% \begin{syntax} |
| 387 |
% shstyle = \Arg{代码样式} \init{bw} |
| 388 |
% \end{syntax} |
| 389 |
% \opt{shstyle} 用于设置终端窗口内容(代码)的样式,仅对\textbf{minted} |
| 390 |
% 引擎有效,默认值为\textbf{bw}。 |
| 391 |
% \end{function} |
| 392 |
% |
| 393 |
% \subsection{代码字号} |
| 394 |
% |
| 395 |
% \begin{function}[added=2021-12-18,updated=2021-12-18]{shsize} |
| 396 |
% \begin{syntax} |
| 397 |
% shsize = \Arg{字号命令} \init{\small} |
| 398 |
% \end{syntax} |
| 399 |
% \opt{shsize} 用于设置终端窗口内容(代码)的字号,仅对\textbf{minted} |
| 400 |
% 引擎有效,默认值为\textbf{\tn{small}}。 |
| 401 |
% \end{function} |
| 402 |
% |
| 403 |
% \subsection{底线注释格式} |
| 404 |
% |
| 405 |
% \begin{function}[added=2021-12-18,updated=2021-12-18]{commentf} |
| 406 |
% \begin{syntax} |
| 407 |
% commentf = \Arg{格式命令组} \init{\small\sffamily} |
| 408 |
% \end{syntax} |
| 409 |
% \opt{commentf} 用于设置终端窗口底线注释的格式, |
| 410 |
% 默认值为\textbf{\tn{small}\tn{sffamily}}。 |
| 411 |
% \end{function} |
| 412 |
% |
| 413 |
% \subsection{代码行距} |
| 414 |
% |
| 415 |
% \begin{function}[added=2021-12-18,updated=2021-12-18]{shstretch} |
| 416 |
% \begin{syntax} |
| 417 |
% shstretch = \Arg{浮点数} \init{1.0} |
| 418 |
% \end{syntax} |
| 419 |
% \opt{shstretch} 用于设置终端窗口内容(代码)的行距,仅对\textbf{minted} |
| 420 |
% 引擎有效,取浮点数。默认值为\textbf{1.0}。 |
| 421 |
% \end{function} |
| 422 |
% |
| 423 |
% \newpage |
| 424 |
% |
| 425 |
% \section{排版样例} |
| 426 |
% |
| 427 |
% \pkg{termsim}宏包可用于需要排版操作系统终端窗口的场合, |
| 428 |
% 以避免使用截图。终端窗口可以带/不带底线注释,也可以 |
| 429 |
% 是暗色(dark)、亮色(light)或白色(white)颜色主题。 |
| 430 |
% |
| 431 |
% \subsection{Win10终端窗口} |
| 432 |
% |
| 433 |
% \subsubsection{\env{terminal}/\env{terminal*}环境} |
| 434 |
% |
| 435 |
% \begin{Verbatim}[frame=none,numbers=left,gobble=5] |
| 436 |
% \centering |
| 437 |
% \termset{os=win10,theme=dark,shstretch=1.0} |
| 438 |
% \begin{terminal}{窗口标题} |
| 439 |
% C:\Users\Administrator 的目录 |
| 440 |
% 2018/07/21 15:39 <DIR> . |
| 441 |
% 2018/07/21 15:39 <DIR> .. |
| 442 |
% 2018/07/13 08:35 <DIR> 3D Objects |
| 443 |
% 2018/07/13 08:35 <DIR> Contacts |
| 444 |
% 2018/08/06 07:46 <DIR> Desktop |
| 445 |
% 2 个文件 6,029,312 字节 |
| 446 |
% 18 个目录 14,035,107,840 可用字节 |
| 447 |
% \end{terminal} |
| 448 |
% \end{Verbatim} |
| 449 |
% |
| 450 |
%\begin{center} |
| 451 |
%\begin{minipage}{0.85\textwidth} |
| 452 |
%\termset{os=win10,theme=dark,shstretch=1.0} |
| 453 |
%\begin{terminal}{窗口标题} |
| 454 |
%C:\Users\Administrator 的目录 |
| 455 |
%2018/07/21 15:39 <DIR> . |
| 456 |
%2018/07/21 15:39 <DIR> .. |
| 457 |
%2018/07/13 08:35 <DIR> 3D Objects |
| 458 |
%2018/07/13 08:35 <DIR> Contacts |
| 459 |
%2018/08/06 07:46 <DIR> Desktop |
| 460 |
% 2 个文件 6,029,312 字节 |
| 461 |
% 18 个目录 14,035,107,840 可用字节 |
| 462 |
%\end{terminal} |
| 463 |
%\end{minipage} |
| 464 |
%\end{center} |
| 465 |
% |
| 466 |
% \begin{Verbatim}[frame=none,numbers=left,gobble=5] |
| 467 |
% \centering |
| 468 |
% \begin{terminal*}[os=win10,theme=light][底线注释]{窗口标题} |
| 469 |
% C:\Users\Administrator 的目录 |
| 470 |
% 2018/07/21 15:39 <DIR> . |
| 471 |
% 2018/07/21 15:39 <DIR> .. |
| 472 |
% 2018/07/13 08:35 <DIR> 3D Objects |
| 473 |
% 2018/07/13 08:35 <DIR> Contacts |
| 474 |
% 2018/08/06 07:46 <DIR> Desktop |
| 475 |
% 2 个文件 6,029,312 字节 |
| 476 |
% 18 个目录 14,035,107,840 可用字节 |
| 477 |
% \end{terminal*} |
| 478 |
% \end{Verbatim} |
| 479 |
% |
| 480 |
%\begin{center} |
| 481 |
%\begin{minipage}{0.85\textwidth} |
| 482 |
%\begin{terminal*}[os=win10,theme=light][底线注释]{窗口标题} |
| 483 |
%C:\Users\Administrator 的目录 |
| 484 |
%2018/07/21 15:39 <DIR> . |
| 485 |
%2018/07/21 15:39 <DIR> .. |
| 486 |
%2018/07/13 08:35 <DIR> 3D Objects |
| 487 |
%2018/07/13 08:35 <DIR> Contacts |
| 488 |
%2018/08/06 07:46 <DIR> Desktop |
| 489 |
% 2 个文件 6,029,312 字节 |
| 490 |
% 18 个目录 14,035,107,840 可用字节 |
| 491 |
%\end{terminal*} |
| 492 |
%\end{minipage} |
| 493 |
%\end{center} |
| 494 |
% |
| 495 |
% |
| 496 |
% \subsubsection{\tn{termfile}/\tn{termfile*}命令} |
| 497 |
% |
| 498 |
% \begin{Verbatim}[frame=none,numbers=left] |
| 499 |
% \centering |
| 500 |
% \termset{os=win10,theme=dark} |
| 501 |
% \termfile{窗口标题}{test.bat} |
| 502 |
% \end{Verbatim} |
| 503 |
% |
| 504 |
%\begin{center} |
| 505 |
%\begin{minipage}{0.85\textwidth} |
| 506 |
%\termset{os=win10,theme=dark} |
| 507 |
%\termfile{窗口标题}{test.bat} |
| 508 |
%\end{minipage} |
| 509 |
%\end{center} |
| 510 |
% |
| 511 |
% \begin{Verbatim}[frame=none,numbers=left] |
| 512 |
% \centering |
| 513 |
% \termfile*[os=win10,theme=light][底线注释]{窗口标题}{test.bat} |
| 514 |
% \end{Verbatim} |
| 515 |
% |
| 516 |
%\begin{center} |
| 517 |
%\begin{minipage}{0.85\textwidth} |
| 518 |
%\termfile*[os=win10,theme=light][底线注释]{窗口标题}{test.bat} |
| 519 |
%\end{minipage} |
| 520 |
%\end{center} |
| 521 |
% |
| 522 |
% \newpage |
| 523 |
% \subsection{Mac终端窗口} |
| 524 |
% |
| 525 |
% \subsubsection{\env{terminal}/\env{terminal*}环境} |
| 526 |
% |
| 527 |
% \begin{Verbatim}[frame=none,numbers=left,gobble=5] |
| 528 |
% \centering |
| 529 |
% \termset{os=mac,theme=dark} |
| 530 |
% \begin{terminal}{窗口标题} |
| 531 |
% xxxxxx@xxxxxx-lap:~$ ls |
| 532 |
% Desktop Downloads p2 Public Templates Videos |
| 533 |
% Documents Music Pictures snap '#test#' workspace |
| 534 |
% xxxxxx@xxxxxx-lap:~$ |
| 535 |
% \end{terminal} |
| 536 |
% \end{Verbatim} |
| 537 |
% |
| 538 |
%\begin{center} |
| 539 |
%\begin{minipage}{0.85\textwidth} |
| 540 |
%\termset{os=mac,theme=dark} |
| 541 |
%\begin{terminal}{窗口标题} |
| 542 |
%xxxxxx@xxxxxx-lap:~$ ls |
| 543 |
%Desktop Downloads p2 Public Templates Videos |
| 544 |
%Documents Music Pictures snap '#test#' workspace |
| 545 |
%xxxxxx@xxxxxx-lap:~$ |
| 546 |
%\end{terminal} |
| 547 |
%\end{minipage} |
| 548 |
%\end{center} |
| 549 |
% |
| 550 |
% \begin{Verbatim}[frame=none,numbers=left,gobble=5] |
| 551 |
% \centering |
| 552 |
% \begin{terminal*}[os=mac,theme=light][底线注释]{窗口标题} |
| 553 |
% xxxxxx@xxxxxx-lap:~$ ls |
| 554 |
% Desktop Downloads p2 Public Templates Videos |
| 555 |
% Documents Music Pictures snap '#test#' workspace |
| 556 |
% xxxxxx@xxxxxx-lap:~$ |
| 557 |
% \end{terminal*} |
| 558 |
% \end{Verbatim} |
| 559 |
% |
| 560 |
%\begin{center} |
| 561 |
%\begin{minipage}{0.85\textwidth} |
| 562 |
%\begin{terminal*}[os=mac,theme=light][底线注释]{窗口标题} |
| 563 |
%xxxxxx@xxxxxx-lap:~$ ls |
| 564 |
%Desktop Downloads p2 Public Templates Videos |
| 565 |
%Documents Music Pictures snap '#test#' workspace |
| 566 |
%xxxxxx@xxxxxx-lap:~$ |
| 567 |
%\end{terminal*} |
| 568 |
%\end{minipage} |
| 569 |
%\end{center} |
| 570 |
% |
| 571 |
% \subsubsection{\tn{termfile}/\tn{termfile*}命令} |
| 572 |
% |
| 573 |
% \begin{Verbatim}[frame=none,numbers=left] |
| 574 |
% \centering |
| 575 |
% \termset{os=mac,theme=dark} |
| 576 |
% \termfile{窗口标题}{testls} |
| 577 |
% \end{Verbatim} |
| 578 |
% |
| 579 |
%\begin{center} |
| 580 |
%\begin{minipage}{0.85\textwidth} |
| 581 |
%\termset{os=mac,theme=dark} |
| 582 |
%\termfile{窗口标题}{testls} |
| 583 |
%\end{minipage} |
| 584 |
%\end{center} |
| 585 |
% \newpage |
| 586 |
% \begin{Verbatim}[frame=none,numbers=left] |
| 587 |
% \centering |
| 588 |
% \termfile*[os=mac,theme=light][底线注释]{窗口标题}{testls} |
| 589 |
% \end{Verbatim} |
| 590 |
% |
| 591 |
%\begin{center} |
| 592 |
%\begin{minipage}{0.85\textwidth} |
| 593 |
%\termfile*[os=mac,theme=light][底线注释]{窗口标题}{testls} |
| 594 |
%\end{minipage} |
| 595 |
%\end{center} |
| 596 |
% |
| 597 |
% \subsection{Ubuntu终端窗口} |
| 598 |
% |
| 599 |
% \subsubsection{\env{terminal}/\env{terminal*}环境} |
| 600 |
% |
| 601 |
% \begin{Verbatim}[frame=none,numbers=left,gobble=5] |
| 602 |
% \centering |
| 603 |
% \termset{os=ubuntu,theme=dark} |
| 604 |
% \begin{terminal}{窗口标题} |
| 605 |
% xxxxxx@xxxxxx-lap:~/Desktop $ |
| 606 |
% git clone [email protected]:xxxxxx/xxxxxx |
| 607 |
% 正克隆到 'xxxxxx'... |
| 608 |
% remote: Enumerating objects: 106, done. |
| 609 |
% remote: Counting objects: 100% (106/106), done. |
| 610 |
% remote: Compressing objects: 100% (105/105), done. |
| 611 |
% remote: Total 106 (delta 9), reused 0 (delta 0) |
| 612 |
% 接收对象中: 100% (106/106), 237.88 MiB | 730.00 KiB/s, 完成. |
| 613 |
% 处理 delta 中: 100% (9/9), 完成. |
| 614 |
% 正在检出文件: 100% (75/75), 完成. |
| 615 |
% xxxxxx@xxxxxx-lap:~/Desktop $ |
| 616 |
% \end{terminal} |
| 617 |
% \end{Verbatim} |
| 618 |
% |
| 619 |
%\begin{center} |
| 620 |
%\begin{minipage}{0.85\textwidth} |
| 621 |
%\termset{os=ubuntu,theme=dark} |
| 622 |
%\begin{terminal}{窗口标题} |
| 623 |
%xxxxxx@xxxxxx-lap:~/Desktop $ |
| 624 |
%git clone [email protected]:xxxxxx/xxxxxx |
| 625 |
%正克隆到 'xxxxxx'... |
| 626 |
%remote: Enumerating objects: 106, done. |
| 627 |
%remote: Counting objects: 100% (106/106), done. |
| 628 |
%remote: Compressing objects: 100% (105/105), done. |
| 629 |
%remote: Total 106 (delta 9), reused 0 (delta 0) |
| 630 |
%接收对象中: 100% (106/106), 237.88 MiB | 730.00 KiB/s, 完成. |
| 631 |
%处理 delta 中: 100% (9/9), 完成. |
| 632 |
%正在检出文件: 100% (75/75), 完成. |
| 633 |
%xxxxxx@xxxxxx-lap:~/Desktop $ |
| 634 |
%\end{terminal} |
| 635 |
%\end{minipage} |
| 636 |
%\end{center} |
| 637 |
% |
| 638 |
% \begin{Verbatim}[frame=none,numbers=left,gobble=5] |
| 639 |
% \centering |
| 640 |
% \begin{terminal*}[os=ubuntu,theme=light][底线注释]{窗口标题} |
| 641 |
% xxxxxx@xxxxxx-lap:~/Desktop $ |
| 642 |
% git clone [email protected]:xxxxxx/xxxxxx |
| 643 |
% 正克隆到 'xxxxxx'... |
| 644 |
% remote: Enumerating objects: 106, done. |
| 645 |
% remote: Counting objects: 100% (106/106), done. |
| 646 |
% remote: Compressing objects: 100% (105/105), done. |
| 647 |
% remote: Total 106 (delta 9), reused 0 (delta 0) |
| 648 |
% 接收对象中: 100% (106/106), 237.88 MiB | 730.00 KiB/s, 完成. |
| 649 |
% 处理 delta 中: 100% (9/9), 完成. |
| 650 |
% 正在检出文件: 100% (75/75), 完成. |
| 651 |
% xxxxxx@xxxxxx-lap:~/Desktop $ |
| 652 |
% \end{terminal*} |
| 653 |
% \end{Verbatim} |
| 654 |
% |
| 655 |
%\newpage |
| 656 |
%\begin{center} |
| 657 |
%\begin{minipage}{0.85\textwidth} |
| 658 |
%\begin{terminal*}[os=ubuntu,theme=light][底线注释]{窗口标题} |
| 659 |
%xxxxxx@xxxxxx-lap:~/Desktop $ |
| 660 |
%git clone [email protected]:xxxxxx/xxxxxx |
| 661 |
%正克隆到 'xxxxxx'... |
| 662 |
%remote: Enumerating objects: 106, done. |
| 663 |
%remote: Counting objects: 100% (106/106), done. |
| 664 |
%remote: Compressing objects: 100% (105/105), done. |
| 665 |
%remote: Total 106 (delta 9), reused 0 (delta 0) |
| 666 |
%接收对象中: 100% (106/106), 237.88 MiB | 730.00 KiB/s, 完成. |
| 667 |
%处理 delta 中: 100% (9/9), 完成. |
| 668 |
%正在检出文件: 100% (75/75), 完成. |
| 669 |
%xxxxxx@xxxxxx-lap:~/Desktop $ |
| 670 |
%\end{terminal*} |
| 671 |
%\end{minipage} |
| 672 |
%\end{center} |
| 673 |
% |
| 674 |
% \subsubsection{\tn{termfile}/\tn{termfile*}命令} |
| 675 |
% |
| 676 |
% \begin{Verbatim}[frame=none,numbers=left] |
| 677 |
% \centering |
| 678 |
% \termset{os=ubuntu,theme=dark} |
| 679 |
% \termfile{窗口标题}{testsh} |
| 680 |
% \end{Verbatim} |
| 681 |
% |
| 682 |
%\begin{center} |
| 683 |
%\begin{minipage}{0.85\textwidth} |
| 684 |
%\termset{os=ubuntu,theme=dark} |
| 685 |
%\termfile{窗口标题}{testsh} |
| 686 |
%\end{minipage} |
| 687 |
%\end{center} |
| 688 |
% |
| 689 |
% \begin{Verbatim}[frame=none,numbers=left] |
| 690 |
% \centering |
| 691 |
% \termfile*[os=ubuntu,theme=light][底线注释]{窗口标题}{testsh} |
| 692 |
% \end{Verbatim} |
| 693 |
% |
| 694 |
%\begin{center} |
| 695 |
%\begin{minipage}{0.85\textwidth} |
| 696 |
%\termfile*[os=ubuntu,theme=light][底线注释]{窗口标题}{testsh} |
| 697 |
%\end{minipage} |
| 698 |
%\end{center} |
| 699 |
% |
| 700 |
% 也可以使用\texttt{white}颜色主题,使用白底黑字排版,以便 |
| 701 |
% 打印输出。 |
| 702 |
% |
| 703 |
% \begin{Verbatim}[frame=none,numbers=left,gobble=5] |
| 704 |
% \centering |
| 705 |
% \termset{os=ubuntu,theme=white} |
| 706 |
% \begin{terminal}{窗口标题} |
| 707 |
% xxxxxx@xxxxxx-lap:~/Desktop $ |
| 708 |
% git clone [email protected]:xxxxxx/xxxxxx |
| 709 |
% 正克隆到 'xxxxxx'... |
| 710 |
% remote: Enumerating objects: 106, done. |
| 711 |
% remote: Counting objects: 100% (106/106), done. |
| 712 |
% remote: Compressing objects: 100% (105/105), done. |
| 713 |
% remote: Total 106 (delta 9), reused 0 (delta 0) |
| 714 |
% 接收对象中: 100% (106/106), 237.88 MiB | 730.00 KiB/s, 完成. |
| 715 |
% 处理 delta 中: 100% (9/9), 完成. |
| 716 |
% 正在检出文件: 100% (75/75), 完成. |
| 717 |
% xxxxxx@xxxxxx-lap:~/Desktop $ |
| 718 |
% \end{terminal} |
| 719 |
% \end{Verbatim} |
| 720 |
% |
| 721 |
%\begin{center} |
| 722 |
%\begin{minipage}{0.85\textwidth} |
| 723 |
%\termset{os=ubuntu,theme=white} |
| 724 |
%\begin{terminal}{窗口标题} |
| 725 |
%xxxxxx@xxxxxx-lap:~/Desktop $ |
| 726 |
%git clone [email protected]:xxxxxx/xxxxxx |
| 727 |
%正克隆到 'xxxxxx'... |
| 728 |
%remote: Enumerating objects: 106, done. |
| 729 |
%remote: Counting objects: 100% (106/106), done. |
| 730 |
%remote: Compressing objects: 100% (105/105), done. |
| 731 |
%remote: Total 106 (delta 9), reused 0 (delta 0) |
| 732 |
%接收对象中: 100% (106/106), 237.88 MiB | 730.00 KiB/s, 完成. |
| 733 |
%处理 delta 中: 100% (9/9), 完成. |
| 734 |
%正在检出文件: 100% (75/75), 完成. |
| 735 |
%xxxxxx@xxxxxx-lap:~/Desktop $ |
| 736 |
%\end{terminal} |
| 737 |
%\end{minipage} |
| 738 |
%\end{center} |
| 739 |
% |
| 740 |
% \end{documentation} |
| 741 |
% |
| 742 |
% \StopEventually{} |
| 743 |
% |
| 744 |
% \begin{implementation} |
| 745 |
% |
| 746 |
% \section{代码实现} |
| 747 |
% |
| 748 |
% 该宏包使用 \LaTeX3 语法编写,依赖 \pkg{expl3} 环境, |
| 749 |
% 并需调用 \pkg{l3packages}、\pkg{tcolorbox}、\pkg{minted} |
| 750 |
% \pkg{listings}、\pkg{fontawesome5}等宏包。 |
| 751 |
% |
| 752 |
% 按照 \LaTeX3 语法,代码中的空格、换行、回车与制表符会完全被忽略, |
| 753 |
% 而下划线“|_|”和冒号“|:|”则可作为一般字母使用。 |
| 754 |
% 正常的空格可以使用“|~|”代替;至于 |~| 原来所表示的“带子”, |
| 755 |
% 则要用 \LaTeXe{} 的原始命令 \tn{nobreakspace} 代替。 |
| 756 |
% |
| 757 |
% 以下代码中有一些形如 \textcolor[HTML]{2E3191}{\textsf{<*package>}} |
| 758 |
% 的标记,这是 \pkg{DocStrip} 中的“guard”,用来选择性地提取文件。 |
| 759 |
% “\textsf{*}”和“\textsf{/}”分别表示该部分的开始和结束。不含 |
| 760 |
% “\textsf{*}”和“\textsf{/}”的 guard 出现在行号右侧,它们用来确定 |
| 761 |
% 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。 |
| 762 |
% |
| 763 |
% 另有若干形如 \textcolor[HTML]{AD1457}{\textsf{<@@=termsim>}} 的 guard, |
| 764 |
% 它们由 \pkg{l3docstrip} 定义,用来标识名字空间(模块)。 |
| 765 |
% |
| 766 |
% \subsection{环境检测与准备} |
| 767 |
% |
| 768 |
% \begin{macrocode} |
| 769 |
%<*package> |
| 770 |
%<@@=termsim> |
| 771 |
% \end{macrocode} |
| 772 |
% |
| 773 |
% \subsection{载入宏包} |
| 774 |
% |
| 775 |
% 载入必要的宏包 |
| 776 |
% |
| 777 |
% \begin{macrocode} |
| 778 |
\RequirePackage { xtemplate, l3keys2e, xparse } |
| 779 |
% \end{macrocode} |
| 780 |
% |
| 781 |
% 载入\pkg{fontawesome5}、\pkg{tcolorbox}、\pkg{varwidth}、 |
| 782 |
% \pkg{amssymb}、\pkg{xcolor}、\pkg{etoolbox}宏包。 |
| 783 |
% |
| 784 |
% \begin{macrocode} |
| 785 |
\RequirePackage {fontawesome5, tcolorbox, varwidth, amssymb, xcolor, etoolbox} |
| 786 |
% \end{macrocode} |
| 787 |
% |
| 788 |
% 解决Expl3中\pkg{tcolorbox}和\pkg{tikz}附加库无法加载的 |
| 789 |
% 补丁(需要\pkg{etoolbox}宏包支持) |
| 790 |
% |
| 791 |
% \url{https://tex.stackexchange.com/questions/57424/using-of-usetikzlibrary-in-an-expl3-package-fails} |
| 792 |
% |
| 793 |
% \begin{macrocode} |
| 794 |
\ExplSyntaxOff |
| 795 |
\patchcmd |
| 796 |
{\tcb@input@library@in} |
| 797 |
{% |
| 798 |
\input\tcbpkgprefix#1\relax% |
| 799 |
} |
| 800 |
{% |
| 801 |
\@pushfilename |
| 802 |
\input\tcbpkgprefix#1\relax% |
| 803 |
\@popfilename |
| 804 |
} |
| 805 |
{}{} |
| 806 |
|
| 807 |
\patchcmd |
| 808 |
{\pgfutil@InputIfFileExists} |
| 809 |
{\input #1} |
| 810 |
{% |
| 811 |
\@pushfilename |
| 812 |
\xdef\@currname{#1}% |
| 813 |
\input #1 % |
| 814 |
\@popfilename |
| 815 |
} |
| 816 |
{}{} |
| 817 |
\ExplSyntaxOn |
| 818 |
% \end{macrocode} |
| 819 |
% |
| 820 |
% 载入\pkg{tcolorbox}和\pkg{tikz}附加库 |
| 821 |
% |
| 822 |
% \begin{macrocode} |
| 823 |
\tcbuselibrary{skins, xparse, breakable} |
| 824 |
\usetikzlibrary{shapes.geometric} |
| 825 |
% \end{macrocode} |
| 826 |
% |
| 827 |
% \subsection{定义颜色} |
| 828 |
% |
| 829 |
% \begin{macrocode} |
| 830 |
\definecolor{mpurple}{RGB}{48,10,36} |
| 831 |
\definecolor{mgray}{RGB}{70,72,67} |
| 832 |
\definecolor{ogray}{RGB}{148,147,141} |
| 833 |
\definecolor{oorange}{RGB}{233,101,56} |
| 834 |
\definecolor{termimal}{RGB}{80,78,70} |
| 835 |
\definecolor{linux}{RGB}{0,39,51} |
| 836 |
\definecolor{windows}{HTML}{00B294} |
| 837 |
\definecolor{cvgrayc}{RGB}{247,247,247} |
| 838 |
\definecolor{cvgray}{RGB}{220,220,220} |
| 839 |
\definecolor{cvgrayb}{RGB}{153,153,153} |
| 840 |
\definecolor{cvblue}{RGB}{223,238,255} |
| 841 |
\definecolor{zhanqing}{RGB}{0,51,113} |
| 842 |
\definecolor{chengse}{RGB}{250,140,53} |
| 843 |
|
| 844 |
\definecolor{AppleRed}{RGB}{255,95,86} |
| 845 |
\definecolor{AppleYellow}{RGB}{255,189,46} |
| 846 |
\definecolor{AppleGreen}{RGB}{39,201,63} |
| 847 |
\definecolor{AppleGray}{HTML}{D8D6D9} |
| 848 |
|
| 849 |
\definecolor{WinGray}{HTML}{FFFFFF} |
| 850 |
\definecolor{WinBlue}{HTML}{1883D7} |
| 851 |
% \end{macrocode} |
| 852 |
% |
| 853 |
% \subsection{终端盒子图标设计} |
| 854 |
% |
| 855 |
% 用TikZ绘制Ubuntu终端盒子的最小化、关闭和最大化图标 |
| 856 |
% |
| 857 |
% \begin{macrocode} |
| 858 |
\newcommand{\UbuntuMin}{% |
| 859 |
\begin{tikzpicture}[x=2.4ex,y=2.4ex,line~width=0.15ex,scale=1] |
| 860 |
\shade[shading=ball,left~color=ogray,right~color=ogray!50!white] (0,0) circle (0.5); |
| 861 |
\draw[termimal](-0.3,0)--(0.3,0); |
| 862 |
\end{tikzpicture} |
| 863 |
} |
| 864 |
\newcommand{\UbuntuClose}{% |
| 865 |
\begin{tikzpicture}[x=2.4ex,y=2.4ex,line~width=0.15ex,scale=1] |
| 866 |
\shade[shading=ball,left~color=oorange,right~color=oorange!70!white] (0,0) circle (0.5); |
| 867 |
\draw[termimal](-0.25,-0.25)--(0.25,0.25); |
| 868 |
\draw[termimal](-0.25,0.25)--(0.25,-0.25); |
| 869 |
\end{tikzpicture} |
| 870 |
} |
| 871 |
\newcommand{\UbuntuMax}{% |
| 872 |
\begin{tikzpicture}[x=2.4ex,y=2.4ex,line~width=0.15ex,scale=1] |
| 873 |
\shade [shading=ball,left~color=ogray,right~color=ogray!50!white] (0,0) circle (0.5); |
| 874 |
\draw[termimal](-0.25,-0.2)rectangle(0.25,0.2); |
| 875 |
\end{tikzpicture} |
| 876 |
} |
| 877 |
% \end{macrocode} |
| 878 |
% |
| 879 |
% 绘制Windows Logo |
| 880 |
% |
| 881 |
% \begin{macrocode} |
| 882 |
\newcommand{\WindowsLogo}{% |
| 883 |
\begin{tikzpicture}[square/.style={regular~polygon,regular~polygon~sides=4}, |
| 884 |
scale=0.65, every~node/.style={scale=0.65}] |
| 885 |
\node[square,draw,fill=black,text=white] at (0, 0) (a) {\small\faTerminal}; |
| 886 |
\end{tikzpicture} |
| 887 |
} |
| 888 |
% \end{macrocode} |
| 889 |
% |
| 890 |
% \subsection{终端盒子样式设计} |
| 891 |
% |
| 892 |
% 定义Mac终端盒子的tcolorbox样式 |
| 893 |
% |
| 894 |
% \begin{macrocode} |
| 895 |
\tcbset{% |
| 896 |
skin=enhanced,% |
| 897 |
apple/.style={% |
| 898 |
halign~title=center,% |
| 899 |
skin=bicolor,% |
| 900 |
boxrule=0.5mm,% |
| 901 |
breakable,% |
| 902 |
frame~style={% |
| 903 |
draw=AppleGray,% |
| 904 |
left~color=AppleGray,% |
| 905 |
right~color=AppleGray% |
| 906 |
},% |
| 907 |
overlay~unbroken = {% |
| 908 |
\node[inner~sep=0pt,anchor=north~west,yshift=-4pt,xshift=10pt,text=white] |
| 909 |
at (frame.north~west) {\textcolor{AppleRed}{\faCircle}$\,$ |
| 910 |
\textcolor{AppleYellow}{\faCircle}$\,$ |
| 911 |
\textcolor{AppleGreen}{\faCircle}}; |
| 912 |
},% |
| 913 |
overlay~first = {% |
| 914 |
\node[inner~sep=0pt,anchor=north~west,yshift=-4pt,xshift=10pt,text=white] |
| 915 |
at (frame.north~west) {\textcolor{AppleRed}{\faCircle}$\,$ |
| 916 |
\textcolor{AppleYellow}{\faCircle}$\,$ |
| 917 |
\textcolor{AppleGreen}{\faCircle}}; |
| 918 |
},% |
| 919 |
fonttitle=\sffamily,%\bfseries,% |
| 920 |
fontupper=\small\sffamily,% |
| 921 |
fontlower=\small\sffamily% |
| 922 |
}, |
| 923 |
appledark/.style={% |
| 924 |
apple,% |
| 925 |
colback=black,% |
| 926 |
colupper=white,% |
| 927 |
colbacktitle=AppleGray,% |
| 928 |
colframe=AppleGray,% |
| 929 |
coltitle=black% |
| 930 |
%coltext=MyLightGray |
| 931 |
}, |
| 932 |
applelight/.style={% |
| 933 |
apple,% |
| 934 |
colback=cvgrayc,% |
| 935 |
colupper=black,% |
| 936 |
colbacktitle=AppleGray,% |
| 937 |
colframe=AppleGray,% |
| 938 |
coltitle=black% |
| 939 |
},% |
| 940 |
applewhite/.style={% |
| 941 |
apple,% |
| 942 |
colback=white,% |
| 943 |
colupper=black,% |
| 944 |
colbacktitle=AppleGray,% |
| 945 |
colframe=AppleGray,% |
| 946 |
coltitle=black% |
| 947 |
},% |
| 948 |
}% |
| 949 |
% \end{macrocode} |
| 950 |
% |
| 951 |
% \changes{v1.1.0}{2021/12/24}{调整Win10 Logo的yshift} |
| 952 |
% |
| 953 |
% 定义Win10终端盒子的tcolorbox样式 |
| 954 |
% |
| 955 |
% \begin{macrocode} |
| 956 |
\tcbset{% |
| 957 |
skin=enhanced,% |
| 958 |
win10/.style={% |
| 959 |
skin=bicolor,% |
| 960 |
boxrule=0.1mm,% |
| 961 |
%toptitle=1ex, |
| 962 |
sharp~corners, |
| 963 |
breakable,% |
| 964 |
colbacktitle=WinGray,% |
| 965 |
colframe=WinGray,% |
| 966 |
coltitle=black,% |
| 967 |
fonttitle=\sffamily,%\bfseries, |
| 968 |
fontupper=\small\sffamily, |
| 969 |
fontlower=\small\sffamily, |
| 970 |
frame~style={% |
| 971 |
draw=WinBlue,% |
| 972 |
left~color=WinBlue,% |
| 973 |
right~color=WinBlue% |
| 974 |
},% |
| 975 |
overlay~unbroken = {% |
| 976 |
\node[inner~sep=0pt,anchor=north~west,yshift=-2pt,xshift=1.2pt,text=black] |
| 977 |
at (frame.north~west){\WindowsLogo}; |
| 978 |
\node[inner~sep=0pt,anchor=north~east,yshift=-4pt,xshift=-8pt,text=black] |
| 979 |
at (frame.north~east){\rule{0.8em}{0.6pt}\quad$\square$\quad{\Large$\times$}}; |
| 980 |
},% |
| 981 |
overlay~first = {% |
| 982 |
\node[inner~sep=0pt,anchor=north~west,yshift=-2pt,xshift=1.0pt,text=black] |
| 983 |
at (frame.north~west){\WindowsLogo}; |
| 984 |
\node[inner~sep=0pt,anchor=north~east,yshift=-4pt,xshift=-8pt,text=black] |
| 985 |
at (frame.north~east){\rule{0.8em}{0.6pt}\quad$\square$\quad{\Large$\times$}}; |
| 986 |
}% |
| 987 |
}, |
| 988 |
win10dark/.style={ |
| 989 |
win10,% |
| 990 |
colback=black,% |
| 991 |
colupper=white,% |
| 992 |
%coltext=white% |
| 993 |
}, |
| 994 |
win10light/.style={ |
| 995 |
win10,% |
| 996 |
colback=white,% |
| 997 |
colupper=black,% |
| 998 |
%coltext=black% |
| 999 |
}, |
| 1000 |
win10white/.style={ |
| 1001 |
win10,% |
| 1002 |
colback=white,% |
| 1003 |
colupper=black,% |
| 1004 |
%coltext=white% |
| 1005 |
}, |
| 1006 |
}% |
| 1007 |
% \end{macrocode} |
| 1008 |
% |
| 1009 |
% 定义Ubuntu终端盒子的tcolorbox样式 |
| 1010 |
% |
| 1011 |
% \begin{macrocode} |
| 1012 |
\tcbset{% |
| 1013 |
skin=enhanced,% |
| 1014 |
ubuntu/.style={% |
| 1015 |
halign~title=center,% |
| 1016 |
skin=bicolor,% |
| 1017 |
boxrule=0.5mm,% |
| 1018 |
breakable,% |
| 1019 |
overlay~unbroken = {% |
| 1020 |
\node[inner~sep=0pt,anchor=north~east,yshift=-3.5pt,xshift=-5pt,text=white] |
| 1021 |
at (frame.north~east){\UbuntuMin$\,$\UbuntuMax$\,$\UbuntuClose};% |
| 1022 |
},% |
| 1023 |
overlay~first = {% |
| 1024 |
\node[inner~sep=0pt,anchor=north~east,yshift=-3.5pt,xshift=-5pt,text=white] |
| 1025 |
at (frame.north~east){\UbuntuMin$\,$\UbuntuMax$\,$\UbuntuClose};% |
| 1026 |
},% |
| 1027 |
fonttitle=\sffamily,% |
| 1028 |
fontupper=\small\sffamily,% |
| 1029 |
fontlower=\small\sffamily% |
| 1030 |
}, |
| 1031 |
udark/.style={% |
| 1032 |
ubuntu,% |
| 1033 |
frame~style={% |
| 1034 |
draw=mgray,% |
| 1035 |
left~color=mgray,% |
| 1036 |
right~color=mgray% |
| 1037 |
},% |
| 1038 |
colback=mpurple,% |
| 1039 |
colupper=white,% |
| 1040 |
colbacktitle=mgray,% |
| 1041 |
colframe=mgray,% |
| 1042 |
coltitle=white% |
| 1043 |
%coltext=MyLightGray |
| 1044 |
}, |
| 1045 |
ulight/.style={% |
| 1046 |
ubuntu,% |
| 1047 |
frame~style={% |
| 1048 |
draw=cvgrayb,% |
| 1049 |
left~color=cvgrayb,% |
| 1050 |
right~color=cvgrayb% |
| 1051 |
},% |
| 1052 |
colback=cvgrayc,% |
| 1053 |
colupper=black,% |
| 1054 |
colbacktitle=cvgrayb,% |
| 1055 |
colframe=cvgrayb,% |
| 1056 |
coltitle=black% |
| 1057 |
},% |
| 1058 |
uwhite/.style={% |
| 1059 |
ubuntu,% |
| 1060 |
frame~style={% |
| 1061 |
draw=cvgrayb,% |
| 1062 |
left~color=cvgrayb,% |
| 1063 |
right~color=cvgrayb% |
| 1064 |
},% |
| 1065 |
colback=white,% |
| 1066 |
colupper=black,% |
| 1067 |
colbacktitle=cvgrayb,% |
| 1068 |
colframe=cvgrayb,% |
| 1069 |
coltitle=black% |
| 1070 |
},% |
| 1071 |
}% |
| 1072 |
% \end{macrocode} |
| 1073 |
% |
| 1074 |
% \subsection{内部变量声明} |
| 1075 |
% |
| 1076 |
% \begin{variable}{\l_@@_minted_bool, |
| 1077 |
% \l_@@_comment_bool, |
| 1078 |
% \l_@@_os_type_int, |
| 1079 |
% \l_@@_color_theme_int, |
| 1080 |
% \l_@@_code_style_tl, |
| 1081 |
% \l_@@_code_fontsize_tl, |
| 1082 |
% \l_@@_comment_format_tl, |
| 1083 |
% \l_@@_shell_baseline_stretch_fp |
| 1084 |
% } |
| 1085 |
% 定义变量。 |
| 1086 |
% |
| 1087 |
% \begin{macrocode} |
| 1088 |
\bool_new:N \l_@@_minted_bool |
| 1089 |
\bool_new:N \l_@@_comment_bool |
| 1090 |
\int_new:N \l_@@_os_type_int |
| 1091 |
\int_new:N \l_@@_color_theme_int |
| 1092 |
% |
| 1093 |
\tl_new:N \l_@@_shell_style_tl |
| 1094 |
\tl_new:N \l_@@_shell_fontsize_tl |
| 1095 |
\tl_new:N \l_@@_comment_format_tl |
| 1096 |
\fp_new:N \l_@@_shell_baseline_stretch_fp |
| 1097 |
% \end{macrocode} |
| 1098 |
% \end{variable} |
| 1099 |
% |
| 1100 |
% \subsection{选项处理} |
| 1101 |
% |
| 1102 |
% 定义 |termsim| 键值类。 |
| 1103 |
% \begin{macrocode} |
| 1104 |
\keys_define:nn { termsim } |
| 1105 |
{ |
| 1106 |
% \end{macrocode} |
| 1107 |
% |
| 1108 |
% \begin{macro}{minted} |
| 1109 |
% 是否使用minted宏包排版代码,默认为true。 |
| 1110 |
% \begin{macrocode} |
| 1111 |
minted .bool_set:N = \l_@@_minted_bool, |
| 1112 |
minted .default:n = true, |
| 1113 |
minted .initial:n = true, |
| 1114 |
% \end{macrocode} |
| 1115 |
% \end{macro} |
| 1116 |
% |
| 1117 |
% \begin{macro}{os} |
| 1118 |
% 选择操作系统,默认为Win10。 |
| 1119 |
% \begin{macrocode} |
| 1120 |
os .choice:, |
| 1121 |
os .value_required:n = true, |
| 1122 |
os .choices:nn = |
| 1123 |
{ win10, mac, ubuntu } |
| 1124 |
{ \int_set_eq:NN \l_@@_os_type_int \l_keys_choice_int }, |
| 1125 |
os .initial:n = win10, |
| 1126 |
% \end{macrocode} |
| 1127 |
% \end{macro} |
| 1128 |
% |
| 1129 |
% \begin{macro}{theme} |
| 1130 |
% 选择终端窗口颜色主题,默认为dark。 |
| 1131 |
% \begin{macrocode} |
| 1132 |
theme .choice:, |
| 1133 |
theme .value_required:n = true, |
| 1134 |
theme .choices:nn = |
| 1135 |
{ dark, light, white } |
| 1136 |
{ \int_set_eq:NN \l_@@_color_theme_int \l_keys_choice_int }, |
| 1137 |
theme .initial:n = dark, |
| 1138 |
% \end{macrocode} |
| 1139 |
% \end{macro} |
| 1140 |
% |
| 1141 |
% \begin{macro}{shstyle} |
| 1142 |
% 代码样式 |
| 1143 |
% \begin{macrocode} |
| 1144 |
shstyle .tl_set:N = \l_@@_shell_style_tl, |
| 1145 |
shstyle .initial:n = bw, |
| 1146 |
% \end{macrocode} |
| 1147 |
% \end{macro} |
| 1148 |
% |
| 1149 |
% \begin{macro}{shsize} |
| 1150 |
% 代码字号 |
| 1151 |
% \begin{macrocode} |
| 1152 |
shsize .tl_set:N = \l_@@_shell_fontsize_tl, |
| 1153 |
shsize .initial:n = \small, |
| 1154 |
% \end{macrocode} |
| 1155 |
% \end{macro} |
| 1156 |
% |
| 1157 |
% \begin{macro}{commentf} |
| 1158 |
% 注释格式 |
| 1159 |
% \begin{macrocode} |
| 1160 |
commentf .tl_set:N = \l_@@_comment_format_tl, |
| 1161 |
commentf .initial:n = \small\sffamily, |
| 1162 |
% \end{macrocode} |
| 1163 |
% \end{macro} |
| 1164 |
% |
| 1165 |
% \begin{macro}{shstrech} |
| 1166 |
% 基线伸展系数 |
| 1167 |
% \begin{macrocode} |
| 1168 |
shstretch .fp_set:N = \l_@@_shell_baseline_strech_fp, |
| 1169 |
shstretch .initial:n = 1.0, |
| 1170 |
% \end{macrocode} |
| 1171 |
% \end{macro} |
| 1172 |
% |
| 1173 |
% 处理未知选项。 |
| 1174 |
% \begin{macrocode} |
| 1175 |
unknown .code:n = { \@@_error:n { unknown-option } } |
| 1176 |
} |
| 1177 |
\msg_new:nnn { termsim } { unknown-option } |
| 1178 |
{ package~ option~ "\l_keys_key_tl"~ is~ unknown. } |
| 1179 |
% \end{macrocode} |
| 1180 |
% |
| 1181 |
% 参数默认值 |
| 1182 |
% \begin{macrocode} |
| 1183 |
\keys_set:nn { termsim } |
| 1184 |
{ |
| 1185 |
minted = true, |
| 1186 |
os = win10, |
| 1187 |
theme = dark, |
| 1188 |
} |
| 1189 |
% \end{macrocode} |
| 1190 |
% |
| 1191 |
% \subsection{选项用户接口} |
| 1192 |
% |
| 1193 |
% \begin{macro}{\termset} |
| 1194 |
% 选项设置用户接口。 |
| 1195 |
% \begin{macrocode} |
| 1196 |
\NewDocumentCommand \termset { m } |
| 1197 |
{ \keys_set:nn { termsim } {#1} } |
| 1198 |
% \end{macrocode} |
| 1199 |
% \end{macro} |
| 1200 |
% |
| 1201 |
% \subsection{内部函数} |
| 1202 |
% |
| 1203 |
% \changes{v1.1.0}{2021/12/24}{为minted宏包添加autogobble参数} |
| 1204 |
% |
| 1205 |
% \begin{macro}{\@@_minted_tcbset:} |
| 1206 |
% 设置终端盒子minted宏包参数。 |
| 1207 |
% |
| 1208 |
% \begin{macrocode} |
| 1209 |
\cs_new:Npn \@@_minted_tcbset:n #1 |
| 1210 |
{ |
| 1211 |
\tcbset{ |
| 1212 |
listing~engine=minted,% |
| 1213 |
minted~style=#1,% |
| 1214 |
minted~options={% |
| 1215 |
autogobble, |
| 1216 |
breaklines,% |
| 1217 |
fontsize=\tl_use:N \l_@@_shell_fontsize_tl,% |
| 1218 |
baselinestretch=\fp_eval:n { \l_@@_shell_baseline_stretch_fp },% |
| 1219 |
breaksymbolleft={},% |
| 1220 |
linenos=false,% |
| 1221 |
},% |
| 1222 |
minted~language=bash% |
| 1223 |
} |
| 1224 |
} |
| 1225 |
\cs_generate_variant:Nn \@@_minted_tcbset:n {V} |
| 1226 |
% \end{macrocode} |
| 1227 |
% \end{macro} |
| 1228 |
% |
| 1229 |
% \begin{macro}{\@@_listings_tcbset:} |
| 1230 |
% 设置终端盒子listings宏包参数。 |
| 1231 |
% |
| 1232 |
% \begin{macrocode} |
| 1233 |
\cs_new:Npn \@@_listings_tcbset: |
| 1234 |
{ |
| 1235 |
\lstset{% general command to set parameter(s) |
| 1236 |
basicstyle=\ttfamily\tl_use:N \l_@@_shell_fontsize_tl, % print whole listing small |
| 1237 |
keywordstyle=\color{chengse}\bfseries,% |
| 1238 |
identifierstyle=, % nothing happens |
| 1239 |
breaklines=true, |
| 1240 |
commentstyle=\itshape\color{gray}, |
| 1241 |
stringstyle=\ttfamily, % typewriter type for strings |
| 1242 |
numbers=left,% |
| 1243 |
numberstyle=\tl_use:N \l_@@_shell_fontsize_tl\sffamily\color[rgb]{0.5,0.5,1.0},% |
| 1244 |
}% |
| 1245 |
} |
| 1246 |
\cs_generate_variant:Nn \@@_minted_tcbset:n {V} |
| 1247 |
% \end{macrocode} |
| 1248 |
% \end{macro} |
| 1249 |
% |
| 1250 |
% \begin{macro}{\@@_comment_tcbset:} |
| 1251 |
% 设置终端盒子底线注释。 |
| 1252 |
% |
| 1253 |
% \begin{macrocode} |
| 1254 |
\cs_new:Npn \@@_comment_tcbset:n #1 |
| 1255 |
{ |
| 1256 |
\bool_if:NTF { \l_@@_comment_bool } |
| 1257 |
{ |
| 1258 |
\tcbset{% |
| 1259 |
listing~and~comment,% |
| 1260 |
colbacklower=tcbcolback!5!yellow!10!white,% |
| 1261 |
collower=linux,% |
| 1262 |
comment={\tl_use:N \l_@@_comment_format_tl~#1},% |
| 1263 |
} |
| 1264 |
}{ |
| 1265 |
\tcbset{ listing~only,} |
| 1266 |
} |
| 1267 |
} |
| 1268 |
% \end{macrocode} |
| 1269 |
% \end{macro} |
| 1270 |
% |
| 1271 |
% \begin{macro}{\@@_terminal_theme_select:} |
| 1272 |
% 选择终端盒子颜色主题。 |
| 1273 |
% |
| 1274 |
% \begin{macrocode} |
| 1275 |
\cs_new:Npn \@@_terminal_theme_select: |
| 1276 |
{ |
| 1277 |
\int_case:nn {\l_@@_os_type_int} |
| 1278 |
{ |
| 1279 |
{1}{ |
| 1280 |
\int_case:nn {\l_@@_color_theme_int} |
| 1281 |
{ |
| 1282 |
{1}{ |
| 1283 |
\tcbset{ win10dark, } |
| 1284 |
} |
| 1285 |
{2}{ |
| 1286 |
\tcbset{ win10light, } |
| 1287 |
} |
| 1288 |
{3}{ |
| 1289 |
\tcbset{ win10white, } |
| 1290 |
} |
| 1291 |
} |
| 1292 |
} |
| 1293 |
{2}{ |
| 1294 |
\int_case:nn {\l_@@_color_theme_int} |
| 1295 |
{ |
| 1296 |
{1}{ |
| 1297 |
\tcbset{ appledark, } |
| 1298 |
} |
| 1299 |
{2}{ |
| 1300 |
\tcbset{ applelight, } |
| 1301 |
} |
| 1302 |
{3}{ |
| 1303 |
\tcbset{ applewhite, } |
| 1304 |
} |
| 1305 |
} |
| 1306 |
} |
| 1307 |
{3}{ |
| 1308 |
\int_case:nn {\l_@@_color_theme_int} |
| 1309 |
{ |
| 1310 |
{1}{ |
| 1311 |
\tcbset{ udark, } |
| 1312 |
} |
| 1313 |
{2}{ |
| 1314 |
\tcbset{ ulight, } |
| 1315 |
} |
| 1316 |
{3}{ |
| 1317 |
\tcbset{ uwhite, } |
| 1318 |
} |
| 1319 |
} |
| 1320 |
} |
| 1321 |
} |
| 1322 |
} |
| 1323 |
% \end{macrocode} |
| 1324 |
% \end{macro} |
| 1325 |
% |
| 1326 |
% \subsection{定义排版环境和命令} |
| 1327 |
% |
| 1328 |
% \begin{macrocode} |
| 1329 |
\bool_if:NTF \l_@@_minted_bool |
| 1330 |
{ |
| 1331 |
% \end{macrocode} |
| 1332 |
% |
| 1333 |
% 使用\pkg{minted}宏包排版代码 |
| 1334 |
% |
| 1335 |
% \begin{macrocode} |
| 1336 |
\tcbuselibrary{minted} |
| 1337 |
% \end{macrocode} |
| 1338 |
% |
| 1339 |
% 定义不带底线注释的窗口模拟环境\env{terminal} |
| 1340 |
% |
| 1341 |
% \begin{macrocode} |
| 1342 |
\NewDocumentEnvironment{ terminal }{O{} O{} m } |
| 1343 |
{ |
| 1344 |
\bool_set_false:N \l_@@_comment_bool |
| 1345 |
\group_begin: |
| 1346 |
\IfNoValueF{#1}{ \keys_set:nn { termsim } { #1 } } |
| 1347 |
\@@_comment_tcbset:n { #2 } |
| 1348 |
\@@_terminal_theme_select: |
| 1349 |
\@@_minted_tcbset:V \l_@@_shell_style_tl |
| 1350 |
\tcbset{ title={#3} }% |
| 1351 |
\tcblisting{} |
| 1352 |
}{ |
| 1353 |
\endtcblisting |
| 1354 |
\group_end: |
| 1355 |
} |
| 1356 |
% \end{macrocode} |
| 1357 |
% |
| 1358 |
% 定义带底线注释的窗口模拟环境\env{terminal*} |
| 1359 |
% |
| 1360 |
% \begin{macrocode} |
| 1361 |
\NewDocumentEnvironment{ terminal* }{O{} O{} m } |
| 1362 |
{ |
| 1363 |
\bool_set_true:N \l_@@_comment_bool |
| 1364 |
\group_begin: |
| 1365 |
\IfNoValueF{#1}{ \keys_set:nn { termsim } { #1 } } |
| 1366 |
\@@_comment_tcbset:n { #2 } |
| 1367 |
\@@_terminal_theme_select: |
| 1368 |
\@@_minted_tcbset:V \l_@@_shell_style_tl |
| 1369 |
\tcbset{ title={#3} }% |
| 1370 |
\tcblisting{} |
| 1371 |
}{ |
| 1372 |
\endtcblisting |
| 1373 |
\group_end: |
| 1374 |
} |
| 1375 |
% \end{macrocode} |
| 1376 |
% |
| 1377 |
% 定义带/不带底线注释的从文件读取内容的命令\tn{termfile}/\tn{termfile*} |
| 1378 |
% |
| 1379 |
% \begin{macrocode} |
| 1380 |
\NewDocumentCommand \termfile { s O{} O{} m m } |
| 1381 |
{ |
| 1382 |
\IfBooleanTF{#1} |
| 1383 |
{ |
| 1384 |
\bool_set_true:N \l_@@_comment_bool |
| 1385 |
}{ |
| 1386 |
\bool_set_false:N \l_@@_comment_bool |
| 1387 |
} |
| 1388 |
|
| 1389 |
\group_begin: |
| 1390 |
\IfNoValueF{#2}{ \keys_set:nn { termsim } { #2 } } |
| 1391 |
\@@_comment_tcbset:n { #3 } |
| 1392 |
\@@_terminal_theme_select: |
| 1393 |
\@@_minted_tcbset:V \l_@@_shell_style_tl |
| 1394 |
\tcbset{ |
| 1395 |
title={#4}, |
| 1396 |
listing~file={#5}, |
| 1397 |
}% |
| 1398 |
\tcbinputlisting{ } |
| 1399 |
\group_end: |
| 1400 |
} |
| 1401 |
}{ |
| 1402 |
% \end{macrocode} |
| 1403 |
% |
| 1404 |
% 使用\pkg{listings}宏包排版代码,并设置代码样式。 |
| 1405 |
% |
| 1406 |
% \begin{macrocode} |
| 1407 |
\tcbuselibrary{listings}% 用listings排版代码 |
| 1408 |
|
| 1409 |
\@@_listings_tcbset: |
| 1410 |
|
| 1411 |
% \end{macrocode} |
| 1412 |
% |
| 1413 |
% 定义不带底线注释的窗口模拟环境\env{terminal} |
| 1414 |
% |
| 1415 |
% \begin{macrocode} |
| 1416 |
\NewDocumentEnvironment{ terminal }{O{} O{} m } |
| 1417 |
{ |
| 1418 |
\bool_set_false:N \l_@@_comment_bool |
| 1419 |
\group_begin: |
| 1420 |
\IfNoValueF{#1}{ \keys_set:nn { termsim } { #1 } } |
| 1421 |
\@@_comment_tcbset:n { #2 } |
| 1422 |
\@@_terminal_theme_select: |
| 1423 |
\tcbset{ |
| 1424 |
title={#3}, |
| 1425 |
listing~options={ |
| 1426 |
language=bash, |
| 1427 |
numbers=none, |
| 1428 |
} |
| 1429 |
}% |
| 1430 |
\tcblisting{} |
| 1431 |
}{ |
| 1432 |
\endtcblisting |
| 1433 |
\group_end: |
| 1434 |
} |
| 1435 |
% \end{macrocode} |
| 1436 |
% |
| 1437 |
% 定义带底线注释的窗口模拟环境\env{terminal*} |
| 1438 |
% |
| 1439 |
% \begin{macrocode} |
| 1440 |
\NewDocumentEnvironment{ terminal* }{O{} O{} m } |
| 1441 |
{ |
| 1442 |
\bool_set_true:N \l_@@_comment_bool |
| 1443 |
\group_begin: |
| 1444 |
\IfNoValueF{#1}{ \keys_set:nn { termsim } { #1 } } |
| 1445 |
\@@_comment_tcbset:n { #2 } |
| 1446 |
\@@_terminal_theme_select: |
| 1447 |
\tcbset{ |
| 1448 |
title={#3}, |
| 1449 |
listing~options={ |
| 1450 |
language=bash, |
| 1451 |
numbers=none, |
| 1452 |
} |
| 1453 |
}% |
| 1454 |
\tcblisting{} |
| 1455 |
}{ |
| 1456 |
\endtcblisting |
| 1457 |
\group_end: |
| 1458 |
} |
| 1459 |
% \end{macrocode} |
| 1460 |
% |
| 1461 |
% 定义带/不带底线注释的从文件读取内容的命令\tn{termfile}/\tn{termfile*} |
| 1462 |
% |
| 1463 |
% \begin{macrocode} |
| 1464 |
\NewDocumentCommand \termfile { s O{} O{} m m } |
| 1465 |
{ |
| 1466 |
\IfBooleanTF{#1} |
| 1467 |
{ |
| 1468 |
\bool_set_true:N \l_@@_comment_bool |
| 1469 |
}{ |
| 1470 |
\bool_set_false:N \l_@@_comment_bool |
| 1471 |
} |
| 1472 |
\group_begin: |
| 1473 |
\IfNoValueF{#2}{ \keys_set:nn { termsim } { #2 } } |
| 1474 |
\@@_comment_tcbset:n { #3 } |
| 1475 |
\@@_terminal_theme_select: |
| 1476 |
\tcbset{ |
| 1477 |
title={#4}, |
| 1478 |
listing~file={#5}, |
| 1479 |
listing~options={ |
| 1480 |
language=bash, |
| 1481 |
numbers=none, |
| 1482 |
},% |
| 1483 |
}% |
| 1484 |
\tcbinputlisting{ } |
| 1485 |
\group_end: |
| 1486 |
} |
| 1487 |
} |
| 1488 |
% \end{macrocode} |
| 1489 |
% |
| 1490 |
% \begin{macrocode} |
| 1491 |
\endinput |
| 1492 |
% \end{macrocode} |
| 1493 |
% |
| 1494 |
% \begin{macrocode} |
| 1495 |
%</package> |
| 1496 |
% \end{macrocode} |
| 1497 |
% |
| 1498 |
% \end{implementation} |
| 1499 |
% |
| 1500 |
% \Finale |
| 1501 |
% |
| 1502 |
\endinput |