% \iffalse meta-comment % !TEX program = XeLaTeX %<*internal> \iffalse %</internal> %<*readme> Terminal simulation based on tcolorbox and minted/listings ======= `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. The `terminal`(`terminal*`) evironment create a tcolorbox to simulate terminal with the eviroment body and the `\termfile`(`\termfile*`) macro from a source file. The OS type was selected from win10, mac, or ubuntu and the terminal theme was selected from dark, light, or with key-value option. All options can be set with `\termset` macro or `terminal`(`terminal*`) eniroment's and `\termfile`(`\termfile*`) macro's option You can read the manual (in Chinese) for more details and examples. Contributing ------------ 1. github repository: 1. repository: [termsim](https://github.com/registor/termsim) 2. Issues and pull requests are welcome. [issue](https://github.com/registor/termsim/issues) or [pull request](https://github.com/registor/termsim/pulls). 2. gitee repository: 1. repository: [termsim](https://gitee.com/nwafu_nan/termsim) 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). ������tcolorbox��������������������� ======= `termsim`���������������tcolorbox������LaTeX3���������������������LaTeX������������������������������������������������`terminal`(`terminal*`)���������`\termfile`(`\termfile*`)������������������Win10���Ubuntu���Mac������������������ `terminal`(`terminal*`)������������������������������������`tcolorbox`��������������������������������� `\termfile`(`\termfile*`)���������������������������������������������`tcolorbox`��������������������������������� ������������`terminal`(`terminal*`)���������`\termfile`(`\termfile*`)���������`key-value`������������������������������(win10���mac���ubuntu)���������������������(dark)���������(light)���������(white)��������������� ������������������������������������������������������������������������`\termset`��������������������� ������������������������������(������)��������������������������������������������������������� ### ������������ --------------------- 1. github������: (1). ������������: [termsim](https://github.com/registor/termsim) (2). Issues���PR: [issue](https://github.com/registor/termsim/issues) or [pull request](https://github.com/registor/termsim/pulls). 2. gitee������: (1). ������������: [termsim](https://gitee.com/nwafu_nan/termsim) (2). Issues and PR: [issue](https://gitee.com/nwafu_nan/termsim/issues) or [pull request](https://gitee.com/nwafu_nan/termsim/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 termsim.dtx, and the derived files termsim.sty, termsim.pdf, termsim.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 termsim.dtx, and the derived files termsim.sty, termsim.pdf, termsim.ins, README.md. \endpostamble \declarepostamble\emptypostamble \endpostamble \def\MetaPrefix{-- } \let\MetaPrefix\DoubleperCent \generate { %</install> %<*internal> \usedir{source/xelatex/termsim} \file{termsim.ins} {\from{\jobname.dtx}{install}} %</internal> %<*install> \usedir{xetex/xelatex/termsim} \file{termsim.sty} {\from{\jobname.dtx}{package}} \nopreamble\nopostamble \usedir{doc/xelatex/termsim} \file{README.md} {\from{\jobname.dtx}{readme}} } \endbatchfile %</install> %<*internal> \fi %</internal> %<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01] %<package>\RequirePackage{expl3} %<+package>\GetIdInfo$Id: termsim.dtx 1.1.1 2021-12-26 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $ %<package> {Terminal simulation 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{termsim} \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/14}{������������������} % % \CheckSum{318} % \GetFileId{termsim.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{termsim}���������������������������\\\bfseries\pkg{termsim}���terminal simulation package} % \author{������\\ \path{nangeng@nwafu.edu.cn}} % \date{\filedate\qquad\fileversion\thanks{\url{https://github.com/registor/termsim}}\thanks{\url{https://gitee.com/nwafu_nan/termsim}}} % \maketitle % % \begin{documentation} % % \begin{abstract} % % \pkg{termsim} ���������������\pkg{tcolorbox}������������\LaTeX3 ��������� \LaTeX ��������� % ������������������������Win10���Ubuntu���Mac������������������\env{terminal}���������\tn{termfile}��������� % \env{terminal}��������������������������������������������������������������� % ���\tn{termfile}��������������������������������������������������������������������������� % ���������������\env{terminal*}���������\tn{termfile*}������������������������������������������������������ % ��������������������������������������������������������� % ������������\tn{termset}���������\env{terminal}(\env{terminal*})��������� % \tn{termfile}(\tn{termfile*})��������������������������������� % % \end{abstract} % % \tableofcontents % % \section{������������} % % \pkg{termsim} ���������������������Win10���Ubuntu���Mac���������������\LaTeX{}��������� % ���������������Win10���Mac���Ubuntu������������������������������ % % \section{������������} % % \subsection{\env{terminal}���\env{terminal*}������} % % \begin{function}[added=2021-12-17,updated=2021-12-17]{terminal,terminal*} % \begin{syntax} % \tn{begin}\{terminal\} \oarg{������������} \Arg{������������} % ..... % \tn{end}\{terminal\} % % \tn{begin}\{terminal*\} \oarg{������������} \oarg{������������} \Arg{������������} % ..... % \tn{end}\{terminal*\} % \end{syntax} % % ������������������������������������������������������ % ������������\Arg{������������}������������������������ % % \oarg{������������}���������key-value������������������������������������ % % ������������\texttt{terminal*}������������������������������������������ % ���������������������\oarg{������������}���������\oarg{������������}��������� % % ������������������������������������\tn{termset}��������������������� % key-value��������������������� % % \end{function} % \begin{Verbatim}[frame=none,numbers=left,gobble=5] % \centering % \termset{os=win10,theme=dark,shstretch=1.0} % \begin{terminal}{������������} % C:\Users\Administrator ��������� % 2018/07/21 15:39 <DIR> . % 2018/07/21 15:39 <DIR> .. % 2018/07/13 08:35 <DIR> 3D Objects % 2018/07/13 08:35 <DIR> Contacts % 2018/08/06 07:46 <DIR> Desktop % 2 ��������� 6,029,312 ������ % 18 ��������� 14,035,107,840 ������������ % \end{terminal} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termset{os=win10,theme=dark,shstretch=1.0} %\begin{terminal}{������������} %C:\Users\Administrator ��������� %2018/07/21 15:39 <DIR> . %2018/07/21 15:39 <DIR> .. %2018/07/13 08:35 <DIR> 3D Objects %2018/07/13 08:35 <DIR> Contacts %2018/08/06 07:46 <DIR> Desktop % 2 ��������� 6,029,312 ������ % 18 ��������� 14,035,107,840 ������������ %\end{terminal} %\end{minipage} %\end{center} % % \subsection{\tn{termfile}���\tn{termfile*}������} % % \begin{function}[added=2021-12-18,updated=2021-12-18]{\termfile,\termfile*} % \begin{syntax} % \tn{termfile} \oarg{������������} \Arg{������������} \Arg{������������} % \tn{termfile*} \oarg{������������} \oarg{������������} \Arg{������������} \Arg{������������} % \end{syntax} % % ���������������������������������������\Arg{������������}��� % ������������\Arg{������������}������������������������ % % \oarg{������������}���������key-value������������������������������������ % % ������������\tn{termfile*}������������������������������������������ % ���������������������\oarg{������������}���������\oarg{������������}��������� % % ���������������������������\tn{termset}������������������������ % key-value��������������������� % \end{function} % % \newpage % % \begin{Verbatim}[frame=none,numbers=left,gobble=5] % \centering % \termfile{������������}{test.bat} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termfile{������������}{test.bat} %\end{minipage} %\end{center} % %\subsection{\tn{termset}������} % % \begin{function}[added=2021-12-18,updated=2021-12-18]{\termset} % \begin{syntax} % \tn{termset} \marg{������������} % \end{syntax} % \tn{termset} ���������������������(������)������������������������������ % ������������������������ \kvopt{\meta{key}}{\meta{value}} ��������� % ���������������\meta{value} ��������������� % ������������������������������������������������������������ % % ��������������������������������� % % \tn{termset} ������ \LaTeX3 ������������������������������������������������������ % ���������������������������������������������|=|��������������������������������������������������� % ���������������\textbf{���������������������}��� % % ������������������ \kvopt{\meta{������}}{true} ���������|= true|������������������ % \end{function} % % \section{������������} % % \pkg{termsim}��������������������������������������������������������������������� % ������\pkg{termsim}������������������������������������������������������\tn{termset}��������������� % ������������������������������������\env{terminal}(\env{terminal*})��������� % \tn{termfile}(\tn{termfile*})���������\oarg{������������}��������������� % % \subsection{������������} % % \begin{function}[added=2021-12-18,updated=2021-12-18]{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-18,updated=2021-12-18]{os} % \begin{syntax} % os = <win10|mac|ubuntu> \init{win10} % \end{syntax} % \opt{os} ������������������������������������������������������������\textbf{win10}��� % \end{function} % % \subsection{������������} % % \begin{function}[added=2021-12-18,updated=2021-12-18]{theme} % \begin{syntax} % theme = <dark|light|white> \init{dark} % \end{syntax} % \opt{theme} ������������������������������������������������������\textbf{dark}��� % \end{function} % % \subsection{������������} % % \begin{function}[added=2021-12-18,updated=2021-12-18]{shstyle} % \begin{syntax} % shstyle = \Arg{������������} \init{bw} % \end{syntax} % \opt{shstyle} ������������������������������(������)������������������\textbf{minted} % ���������������������������\textbf{bw}��� % \end{function} % % \subsection{������������} % % \begin{function}[added=2021-12-18,updated=2021-12-18]{shsize} % \begin{syntax} % shsize = \Arg{������������} \init{\small} % \end{syntax} % \opt{shsize} ������������������������������(������)������������������\textbf{minted} % ���������������������������\textbf{\tn{small}}��� % \end{function} % % \subsection{������������������} % % \begin{function}[added=2021-12-18,updated=2021-12-18]{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-18,updated=2021-12-18]{shstretch} % \begin{syntax} % shstretch = \Arg{���������} \init{1.0} % \end{syntax} % \opt{shstretch} ������������������������������(������)������������������\textbf{minted} % ������������������������������������������\textbf{1.0}��� % \end{function} % % \newpage % % \section{������������} % % \pkg{termsim}��������������������������������������������������������������� % ���������������������������������������������/������������������������������ % ���������(dark)���������(light)���������(white)��������������� % % \subsection{Win10������������} % % \subsubsection{\env{terminal}/\env{terminal*}������} % % \begin{Verbatim}[frame=none,numbers=left,gobble=5] % \centering % \termset{os=win10,theme=dark,shstretch=1.0} % \begin{terminal}{������������} % C:\Users\Administrator ��������� % 2018/07/21 15:39 <DIR> . % 2018/07/21 15:39 <DIR> .. % 2018/07/13 08:35 <DIR> 3D Objects % 2018/07/13 08:35 <DIR> Contacts % 2018/08/06 07:46 <DIR> Desktop % 2 ��������� 6,029,312 ������ % 18 ��������� 14,035,107,840 ������������ % \end{terminal} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termset{os=win10,theme=dark,shstretch=1.0} %\begin{terminal}{������������} %C:\Users\Administrator ��������� %2018/07/21 15:39 <DIR> . %2018/07/21 15:39 <DIR> .. %2018/07/13 08:35 <DIR> 3D Objects %2018/07/13 08:35 <DIR> Contacts %2018/08/06 07:46 <DIR> Desktop % 2 ��������� 6,029,312 ������ % 18 ��������� 14,035,107,840 ������������ %\end{terminal} %\end{minipage} %\end{center} % % \begin{Verbatim}[frame=none,numbers=left,gobble=5] % \centering % \begin{terminal*}[os=win10,theme=light][������������]{������������} % C:\Users\Administrator ��������� % 2018/07/21 15:39 <DIR> . % 2018/07/21 15:39 <DIR> .. % 2018/07/13 08:35 <DIR> 3D Objects % 2018/07/13 08:35 <DIR> Contacts % 2018/08/06 07:46 <DIR> Desktop % 2 ��������� 6,029,312 ������ % 18 ��������� 14,035,107,840 ������������ % \end{terminal*} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\begin{terminal*}[os=win10,theme=light][������������]{������������} %C:\Users\Administrator ��������� %2018/07/21 15:39 <DIR> . %2018/07/21 15:39 <DIR> .. %2018/07/13 08:35 <DIR> 3D Objects %2018/07/13 08:35 <DIR> Contacts %2018/08/06 07:46 <DIR> Desktop % 2 ��������� 6,029,312 ������ % 18 ��������� 14,035,107,840 ������������ %\end{terminal*} %\end{minipage} %\end{center} % % % \subsubsection{\tn{termfile}/\tn{termfile*}������} % % \begin{Verbatim}[frame=none,numbers=left] % \centering % \termset{os=win10,theme=dark} % \termfile{������������}{test.bat} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termset{os=win10,theme=dark} %\termfile{������������}{test.bat} %\end{minipage} %\end{center} % % \begin{Verbatim}[frame=none,numbers=left] % \centering % \termfile*[os=win10,theme=light][������������]{������������}{test.bat} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termfile*[os=win10,theme=light][������������]{������������}{test.bat} %\end{minipage} %\end{center} % % \newpage % \subsection{Mac������������} % % \subsubsection{\env{terminal}/\env{terminal*}������} % % \begin{Verbatim}[frame=none,numbers=left,gobble=5] % \centering % \termset{os=mac,theme=dark} % \begin{terminal}{������������} % xxxxxx@xxxxxx-lap:~$ ls % Desktop Downloads p2 Public Templates Videos % Documents Music Pictures snap '#test#' workspace % xxxxxx@xxxxxx-lap:~$ % \end{terminal} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termset{os=mac,theme=dark} %\begin{terminal}{������������} %xxxxxx@xxxxxx-lap:~$ ls %Desktop Downloads p2 Public Templates Videos %Documents Music Pictures snap '#test#' workspace %xxxxxx@xxxxxx-lap:~$ %\end{terminal} %\end{minipage} %\end{center} % % \begin{Verbatim}[frame=none,numbers=left,gobble=5] % \centering % \begin{terminal*}[os=mac,theme=light][������������]{������������} % xxxxxx@xxxxxx-lap:~$ ls % Desktop Downloads p2 Public Templates Videos % Documents Music Pictures snap '#test#' workspace % xxxxxx@xxxxxx-lap:~$ % \end{terminal*} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\begin{terminal*}[os=mac,theme=light][������������]{������������} %xxxxxx@xxxxxx-lap:~$ ls %Desktop Downloads p2 Public Templates Videos %Documents Music Pictures snap '#test#' workspace %xxxxxx@xxxxxx-lap:~$ %\end{terminal*} %\end{minipage} %\end{center} % % \subsubsection{\tn{termfile}/\tn{termfile*}������} % % \begin{Verbatim}[frame=none,numbers=left] % \centering % \termset{os=mac,theme=dark} % \termfile{������������}{testls} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termset{os=mac,theme=dark} %\termfile{������������}{testls} %\end{minipage} %\end{center} % \newpage % \begin{Verbatim}[frame=none,numbers=left] % \centering % \termfile*[os=mac,theme=light][������������]{������������}{testls} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termfile*[os=mac,theme=light][������������]{������������}{testls} %\end{minipage} %\end{center} % % \subsection{Ubuntu������������} % % \subsubsection{\env{terminal}/\env{terminal*}������} % % \begin{Verbatim}[frame=none,numbers=left,gobble=5] % \centering % \termset{os=ubuntu,theme=dark} % \begin{terminal}{������������} % xxxxxx@xxxxxx-lap:~/Desktop $ % git clone git@gitee.com:xxxxxx/xxxxxx % ������������ 'xxxxxx'... % remote: Enumerating objects: 106, done. % remote: Counting objects: 100% (106/106), done. % remote: Compressing objects: 100% (105/105), done. % remote: Total 106 (delta 9), reused 0 (delta 0) % ���������������: 100% (106/106), 237.88 MiB | 730.00 KiB/s, ������. % ������ delta ���: 100% (9/9), ������. % ������������������: 100% (75/75), ������. % xxxxxx@xxxxxx-lap:~/Desktop $ % \end{terminal} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termset{os=ubuntu,theme=dark} %\begin{terminal}{������������} %xxxxxx@xxxxxx-lap:~/Desktop $ %git clone git@gitee.com:xxxxxx/xxxxxx %������������ 'xxxxxx'... %remote: Enumerating objects: 106, done. %remote: Counting objects: 100% (106/106), done. %remote: Compressing objects: 100% (105/105), done. %remote: Total 106 (delta 9), reused 0 (delta 0) %���������������: 100% (106/106), 237.88 MiB | 730.00 KiB/s, ������. %������ delta ���: 100% (9/9), ������. %������������������: 100% (75/75), ������. %xxxxxx@xxxxxx-lap:~/Desktop $ %\end{terminal} %\end{minipage} %\end{center} % % \begin{Verbatim}[frame=none,numbers=left,gobble=5] % \centering % \begin{terminal*}[os=ubuntu,theme=light][������������]{������������} % xxxxxx@xxxxxx-lap:~/Desktop $ % git clone git@gitee.com:xxxxxx/xxxxxx % ������������ 'xxxxxx'... % remote: Enumerating objects: 106, done. % remote: Counting objects: 100% (106/106), done. % remote: Compressing objects: 100% (105/105), done. % remote: Total 106 (delta 9), reused 0 (delta 0) % ���������������: 100% (106/106), 237.88 MiB | 730.00 KiB/s, ������. % ������ delta ���: 100% (9/9), ������. % ������������������: 100% (75/75), ������. % xxxxxx@xxxxxx-lap:~/Desktop $ % \end{terminal*} % \end{Verbatim} % %\newpage %\begin{center} %\begin{minipage}{0.85\textwidth} %\begin{terminal*}[os=ubuntu,theme=light][������������]{������������} %xxxxxx@xxxxxx-lap:~/Desktop $ %git clone git@gitee.com:xxxxxx/xxxxxx %������������ 'xxxxxx'... %remote: Enumerating objects: 106, done. %remote: Counting objects: 100% (106/106), done. %remote: Compressing objects: 100% (105/105), done. %remote: Total 106 (delta 9), reused 0 (delta 0) %���������������: 100% (106/106), 237.88 MiB | 730.00 KiB/s, ������. %������ delta ���: 100% (9/9), ������. %������������������: 100% (75/75), ������. %xxxxxx@xxxxxx-lap:~/Desktop $ %\end{terminal*} %\end{minipage} %\end{center} % % \subsubsection{\tn{termfile}/\tn{termfile*}������} % % \begin{Verbatim}[frame=none,numbers=left] % \centering % \termset{os=ubuntu,theme=dark} % \termfile{������������}{testsh} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termset{os=ubuntu,theme=dark} %\termfile{������������}{testsh} %\end{minipage} %\end{center} % % \begin{Verbatim}[frame=none,numbers=left] % \centering % \termfile*[os=ubuntu,theme=light][������������]{������������}{testsh} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termfile*[os=ubuntu,theme=light][������������]{������������}{testsh} %\end{minipage} %\end{center} % % ���������������\texttt{white}������������������������������������������������ % ��������������� % % \begin{Verbatim}[frame=none,numbers=left,gobble=5] % \centering % \termset{os=ubuntu,theme=white} % \begin{terminal}{������������} % xxxxxx@xxxxxx-lap:~/Desktop $ % git clone git@gitee.com:xxxxxx/xxxxxx % ������������ 'xxxxxx'... % remote: Enumerating objects: 106, done. % remote: Counting objects: 100% (106/106), done. % remote: Compressing objects: 100% (105/105), done. % remote: Total 106 (delta 9), reused 0 (delta 0) % ���������������: 100% (106/106), 237.88 MiB | 730.00 KiB/s, ������. % ������ delta ���: 100% (9/9), ������. % ������������������: 100% (75/75), ������. % xxxxxx@xxxxxx-lap:~/Desktop $ % \end{terminal} % \end{Verbatim} % %\begin{center} %\begin{minipage}{0.85\textwidth} %\termset{os=ubuntu,theme=white} %\begin{terminal}{������������} %xxxxxx@xxxxxx-lap:~/Desktop $ %git clone git@gitee.com:xxxxxx/xxxxxx %������������ 'xxxxxx'... %remote: Enumerating objects: 106, done. %remote: Counting objects: 100% (106/106), done. %remote: Compressing objects: 100% (105/105), done. %remote: Total 106 (delta 9), reused 0 (delta 0) %���������������: 100% (106/106), 237.88 MiB | 730.00 KiB/s, ������. %������ delta ���: 100% (9/9), ������. %������������������: 100% (75/75), ������. %xxxxxx@xxxxxx-lap:~/Desktop $ %\end{terminal} %\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{<@@=termsim>}} ��� guard��� % ��������� \pkg{l3docstrip} ������������������������������������������������ % % \subsection{���������������������} % % \begin{macrocode} %<*package> %<@@=termsim> % \end{macrocode} % % \subsection{������������} % % ��������������������� % % \begin{macrocode} \RequirePackage { xtemplate, l3keys2e, xparse } % \end{macrocode} % % ������\pkg{fontawesome5}���\pkg{tcolorbox}���\pkg{varwidth}��� % \pkg{amssymb}���\pkg{xcolor}���\pkg{etoolbox}��������� % % \begin{macrocode} \RequirePackage {fontawesome5, tcolorbox, varwidth, amssymb, 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} \usetikzlibrary{shapes.geometric} % \end{macrocode} % % \subsection{������������} % % \begin{macrocode} \definecolor{mpurple}{RGB}{48,10,36} \definecolor{mgray}{RGB}{70,72,67} \definecolor{ogray}{RGB}{148,147,141} \definecolor{oorange}{RGB}{233,101,56} \definecolor{termimal}{RGB}{80,78,70} \definecolor{linux}{RGB}{0,39,51} \definecolor{windows}{HTML}{00B294} \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{zhanqing}{RGB}{0,51,113} \definecolor{chengse}{RGB}{250,140,53} \definecolor{AppleRed}{RGB}{255,95,86} \definecolor{AppleYellow}{RGB}{255,189,46} \definecolor{AppleGreen}{RGB}{39,201,63} \definecolor{AppleGray}{HTML}{D8D6D9} \definecolor{WinGray}{HTML}{FFFFFF} \definecolor{WinBlue}{HTML}{1883D7} % \end{macrocode} % % \subsection{������������������������} % % ���TikZ������Ubuntu��������������������������������������������������� % % \begin{macrocode} \newcommand{\UbuntuMin}{% \begin{tikzpicture}[x=2.4ex,y=2.4ex,line~width=0.15ex,scale=1] \shade[shading=ball,left~color=ogray,right~color=ogray!50!white] (0,0) circle (0.5); \draw[termimal](-0.3,0)--(0.3,0); \end{tikzpicture} } \newcommand{\UbuntuClose}{% \begin{tikzpicture}[x=2.4ex,y=2.4ex,line~width=0.15ex,scale=1] \shade[shading=ball,left~color=oorange,right~color=oorange!70!white] (0,0) circle (0.5); \draw[termimal](-0.25,-0.25)--(0.25,0.25); \draw[termimal](-0.25,0.25)--(0.25,-0.25); \end{tikzpicture} } \newcommand{\UbuntuMax}{% \begin{tikzpicture}[x=2.4ex,y=2.4ex,line~width=0.15ex,scale=1] \shade [shading=ball,left~color=ogray,right~color=ogray!50!white] (0,0) circle (0.5); \draw[termimal](-0.25,-0.2)rectangle(0.25,0.2); \end{tikzpicture} } % \end{macrocode} % % ������Windows Logo % % \begin{macrocode} \newcommand{\WindowsLogo}{% \begin{tikzpicture}[square/.style={regular~polygon,regular~polygon~sides=4}, scale=0.65, every~node/.style={scale=0.65}] \node[square,draw,fill=black,text=white] at (0, 0) (a) {\small\faTerminal}; \end{tikzpicture} } % \end{macrocode} % % \subsection{������������������������} % % ������Mac���������������tcolorbox������ % % \begin{macrocode} \tcbset{% skin=enhanced,% apple/.style={% halign~title=center,% skin=bicolor,% boxrule=0.5mm,% breakable,% frame~style={% draw=AppleGray,% left~color=AppleGray,% right~color=AppleGray% },% overlay~unbroken = {% \node[inner~sep=0pt,anchor=north~west,yshift=-4pt,xshift=10pt,text=white] at (frame.north~west) {\textcolor{AppleRed}{\faCircle}$\,$ \textcolor{AppleYellow}{\faCircle}$\,$ \textcolor{AppleGreen}{\faCircle}}; },% overlay~first = {% \node[inner~sep=0pt,anchor=north~west,yshift=-4pt,xshift=10pt,text=white] at (frame.north~west) {\textcolor{AppleRed}{\faCircle}$\,$ \textcolor{AppleYellow}{\faCircle}$\,$ \textcolor{AppleGreen}{\faCircle}}; },% fonttitle=\sffamily,%\bfseries,% fontupper=\small\sffamily,% fontlower=\small\sffamily% }, appledark/.style={% apple,% colback=black,% colupper=white,% colbacktitle=AppleGray,% colframe=AppleGray,% coltitle=black% %coltext=MyLightGray }, applelight/.style={% apple,% colback=cvgrayc,% colupper=black,% colbacktitle=AppleGray,% colframe=AppleGray,% coltitle=black% },% applewhite/.style={% apple,% colback=white,% colupper=black,% colbacktitle=AppleGray,% colframe=AppleGray,% coltitle=black% },% }% % \end{macrocode} % % \changes{v1.1.0}{2021/12/24}{������Win10 Logo���yshift} % % ������Win10���������������tcolorbox������ % % \begin{macrocode} \tcbset{% skin=enhanced,% win10/.style={% skin=bicolor,% boxrule=0.1mm,% %toptitle=1ex, sharp~corners, breakable,% colbacktitle=WinGray,% colframe=WinGray,% coltitle=black,% fonttitle=\sffamily,%\bfseries, fontupper=\small\sffamily, fontlower=\small\sffamily, frame~style={% draw=WinBlue,% left~color=WinBlue,% right~color=WinBlue% },% overlay~unbroken = {% \node[inner~sep=0pt,anchor=north~west,yshift=-2pt,xshift=1.2pt,text=black] at (frame.north~west){\WindowsLogo}; \node[inner~sep=0pt,anchor=north~east,yshift=-4pt,xshift=-8pt,text=black] at (frame.north~east){\rule{0.8em}{0.6pt}\quad$\square$\quad{\Large$\times$}}; },% overlay~first = {% \node[inner~sep=0pt,anchor=north~west,yshift=-2pt,xshift=1.0pt,text=black] at (frame.north~west){\WindowsLogo}; \node[inner~sep=0pt,anchor=north~east,yshift=-4pt,xshift=-8pt,text=black] at (frame.north~east){\rule{0.8em}{0.6pt}\quad$\square$\quad{\Large$\times$}}; }% }, win10dark/.style={ win10,% colback=black,% colupper=white,% %coltext=white% }, win10light/.style={ win10,% colback=white,% colupper=black,% %coltext=black% }, win10white/.style={ win10,% colback=white,% colupper=black,% %coltext=white% }, }% % \end{macrocode} % % ������Ubuntu���������������tcolorbox������ % % \begin{macrocode} \tcbset{% skin=enhanced,% ubuntu/.style={% halign~title=center,% skin=bicolor,% boxrule=0.5mm,% breakable,% overlay~unbroken = {% \node[inner~sep=0pt,anchor=north~east,yshift=-3.5pt,xshift=-5pt,text=white] at (frame.north~east){\UbuntuMin$\,$\UbuntuMax$\,$\UbuntuClose};% },% overlay~first = {% \node[inner~sep=0pt,anchor=north~east,yshift=-3.5pt,xshift=-5pt,text=white] at (frame.north~east){\UbuntuMin$\,$\UbuntuMax$\,$\UbuntuClose};% },% fonttitle=\sffamily,% fontupper=\small\sffamily,% fontlower=\small\sffamily% }, udark/.style={% ubuntu,% frame~style={% draw=mgray,% left~color=mgray,% right~color=mgray% },% colback=mpurple,% colupper=white,% colbacktitle=mgray,% colframe=mgray,% coltitle=white% %coltext=MyLightGray }, ulight/.style={% ubuntu,% frame~style={% draw=cvgrayb,% left~color=cvgrayb,% right~color=cvgrayb% },% colback=cvgrayc,% colupper=black,% colbacktitle=cvgrayb,% colframe=cvgrayb,% coltitle=black% },% uwhite/.style={% ubuntu,% frame~style={% draw=cvgrayb,% left~color=cvgrayb,% right~color=cvgrayb% },% colback=white,% colupper=black,% colbacktitle=cvgrayb,% colframe=cvgrayb,% coltitle=black% },% }% % \end{macrocode} % % \subsection{������������������} % % \begin{variable}{\l_@@_minted_bool, % \l_@@_comment_bool, % \l_@@_os_type_int, % \l_@@_color_theme_int, % \l_@@_code_style_tl, % \l_@@_code_fontsize_tl, % \l_@@_comment_format_tl, % \l_@@_shell_baseline_stretch_fp % } % ��������������� % % \begin{macrocode} \bool_new:N \l_@@_minted_bool \bool_new:N \l_@@_comment_bool \int_new:N \l_@@_os_type_int \int_new:N \l_@@_color_theme_int % \tl_new:N \l_@@_shell_style_tl \tl_new:N \l_@@_shell_fontsize_tl \tl_new:N \l_@@_comment_format_tl \fp_new:N \l_@@_shell_baseline_stretch_fp % \end{macrocode} % \end{variable} % % \subsection{������������} % % ������ |termsim| ������������ % \begin{macrocode} \keys_define:nn { termsim } { % \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}{os} % ������������������������������Win10��� % \begin{macrocode} os .choice:, os .value_required:n = true, os .choices:nn = { win10, mac, ubuntu } { \int_set_eq:NN \l_@@_os_type_int \l_keys_choice_int }, os .initial:n = win10, % \end{macrocode} % \end{macro} % % \begin{macro}{theme} % ������������������������������������������dark��� % \begin{macrocode} theme .choice:, theme .value_required:n = true, theme .choices:nn = { dark, light, white } { \int_set_eq:NN \l_@@_color_theme_int \l_keys_choice_int }, theme .initial:n = dark, % \end{macrocode} % \end{macro} % % \begin{macro}{shstyle} % ������������ % \begin{macrocode} shstyle .tl_set:N = \l_@@_shell_style_tl, shstyle .initial:n = bw, % \end{macrocode} % \end{macro} % % \begin{macro}{shsize} % ������������ % \begin{macrocode} shsize .tl_set:N = \l_@@_shell_fontsize_tl, shsize .initial:n = \small, % \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}{shstrech} % ������������������ % \begin{macrocode} shstretch .fp_set:N = \l_@@_shell_baseline_strech_fp, shstretch .initial:n = 1.0, % \end{macrocode} % \end{macro} % % ��������������������� % \begin{macrocode} unknown .code:n = { \@@_error:n { unknown-option } } } \msg_new:nnn { termsim } { unknown-option } { package~ option~ "\l_keys_key_tl"~ is~ unknown. } % \end{macrocode} % % ��������������� % \begin{macrocode} \keys_set:nn { termsim } { minted = true, os = win10, theme = dark, } % \end{macrocode} % % \subsection{������������������} % % \begin{macro}{\termset} % ��������������������������� % \begin{macrocode} \NewDocumentCommand \termset { m } { \keys_set:nn { termsim } {#1} } % \end{macrocode} % \end{macro} % % \subsection{������������} % % \changes{v1.1.0}{2021/12/24}{���minted������������autogobble������} % % \begin{macro}{\@@_minted_tcbset:} % ������������������minted��������������� % % \begin{macrocode} \cs_new:Npn \@@_minted_tcbset:n #1 { \tcbset{ listing~engine=minted,% minted~style=#1,% minted~options={% autogobble, breaklines,% fontsize=\tl_use:N \l_@@_shell_fontsize_tl,% baselinestretch=\fp_eval:n { \l_@@_shell_baseline_stretch_fp },% breaksymbolleft={},% linenos=false,% },% minted~language=bash% } } \cs_generate_variant:Nn \@@_minted_tcbset:n {V} % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_listings_tcbset:} % ������������������listings��������������� % % \begin{macrocode} \cs_new:Npn \@@_listings_tcbset: { \lstset{% general command to set parameter(s) basicstyle=\ttfamily\tl_use:N \l_@@_shell_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_@@_shell_fontsize_tl\sffamily\color[rgb]{0.5,0.5,1.0},% }% } \cs_generate_variant:Nn \@@_minted_tcbset:n {V} % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_comment_tcbset:} % ��������������������������������� % % \begin{macrocode} \cs_new:Npn \@@_comment_tcbset:n #1 { \bool_if:NTF { \l_@@_comment_bool } { \tcbset{% listing~and~comment,% colbacklower=tcbcolback!5!yellow!10!white,% collower=linux,% comment={\tl_use:N \l_@@_comment_format_tl~#1},% } }{ \tcbset{ listing~only,} } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_terminal_theme_select:} % ��������������������������������� % % \begin{macrocode} \cs_new:Npn \@@_terminal_theme_select: { \int_case:nn {\l_@@_os_type_int} { {1}{ \int_case:nn {\l_@@_color_theme_int} { {1}{ \tcbset{ win10dark, } } {2}{ \tcbset{ win10light, } } {3}{ \tcbset{ win10white, } } } } {2}{ \int_case:nn {\l_@@_color_theme_int} { {1}{ \tcbset{ appledark, } } {2}{ \tcbset{ applelight, } } {3}{ \tcbset{ applewhite, } } } } {3}{ \int_case:nn {\l_@@_color_theme_int} { {1}{ \tcbset{ udark, } } {2}{ \tcbset{ ulight, } } {3}{ \tcbset{ uwhite, } } } } } } % \end{macrocode} % \end{macro} % % \subsection{���������������������������} % % \begin{macrocode} \bool_if:NTF \l_@@_minted_bool { % \end{macrocode} % % ������\pkg{minted}������������������ % % \begin{macrocode} \tcbuselibrary{minted} % \end{macrocode} % % ���������������������������������������������\env{terminal} % % \begin{macrocode} \NewDocumentEnvironment{ terminal }{O{} O{} m } { \bool_set_false:N \l_@@_comment_bool \group_begin: \IfNoValueF{#1}{ \keys_set:nn { termsim } { #1 } } \@@_comment_tcbset:n { #2 } \@@_terminal_theme_select: \@@_minted_tcbset:V \l_@@_shell_style_tl \tcbset{ title={#3} }% \tcblisting{} }{ \endtcblisting \group_end: } % \end{macrocode} % % ������������������������������������������\env{terminal*} % % \begin{macrocode} \NewDocumentEnvironment{ terminal* }{O{} O{} m } { \bool_set_true:N \l_@@_comment_bool \group_begin: \IfNoValueF{#1}{ \keys_set:nn { termsim } { #1 } } \@@_comment_tcbset:n { #2 } \@@_terminal_theme_select: \@@_minted_tcbset:V \l_@@_shell_style_tl \tcbset{ title={#3} }% \tcblisting{} }{ \endtcblisting \group_end: } % \end{macrocode} % % ���������/���������������������������������������������������\tn{termfile}/\tn{termfile*} % % \begin{macrocode} \NewDocumentCommand \termfile { s O{} 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 { termsim } { #2 } } \@@_comment_tcbset:n { #3 } \@@_terminal_theme_select: \@@_minted_tcbset:V \l_@@_shell_style_tl \tcbset{ title={#4}, listing~file={#5}, }% \tcbinputlisting{ } \group_end: } }{ % \end{macrocode} % % ������\pkg{listings}��������������������������������������������� % % \begin{macrocode} \tcbuselibrary{listings}% ���listings������������ \@@_listings_tcbset: % \end{macrocode} % % ���������������������������������������������\env{terminal} % % \begin{macrocode} \NewDocumentEnvironment{ terminal }{O{} O{} m } { \bool_set_false:N \l_@@_comment_bool \group_begin: \IfNoValueF{#1}{ \keys_set:nn { termsim } { #1 } } \@@_comment_tcbset:n { #2 } \@@_terminal_theme_select: \tcbset{ title={#3}, listing~options={ language=bash, numbers=none, } }% \tcblisting{} }{ \endtcblisting \group_end: } % \end{macrocode} % % ������������������������������������������\env{terminal*} % % \begin{macrocode} \NewDocumentEnvironment{ terminal* }{O{} O{} m } { \bool_set_true:N \l_@@_comment_bool \group_begin: \IfNoValueF{#1}{ \keys_set:nn { termsim } { #1 } } \@@_comment_tcbset:n { #2 } \@@_terminal_theme_select: \tcbset{ title={#3}, listing~options={ language=bash, numbers=none, } }% \tcblisting{} }{ \endtcblisting \group_end: } % \end{macrocode} % % ���������/���������������������������������������������������\tn{termfile}/\tn{termfile*} % % \begin{macrocode} \NewDocumentCommand \termfile { s O{} 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 { termsim } { #2 } } \@@_comment_tcbset:n { #3 } \@@_terminal_theme_select: \tcbset{ title={#4}, listing~file={#5}, listing~options={ language=bash, numbers=none, },% }% \tcbinputlisting{ } \group_end: } } % \end{macrocode} % % \begin{macrocode} \endinput % \end{macrocode} % % \begin{macrocode} %</package> % \end{macrocode} % % \end{implementation} % % \Finale % \endinput