summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/shdoc/shdoc.sty
blob: 8bb5283f5d451f9c9c25560e1cf44e8fe7bed646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
%%
%% This is file `shdoc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% shdoc.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright 2015 Simon M. Laube
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% 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 `author maintained'.
%% 
%% The Current Maintainer of this work is S. M. Laube
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{shdoc}[2015/05/24 v2.0 Package for documenting terminal operations]
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage{float}
\RequirePackage{caption}
\RequirePackage{mdframed}
\RequirePackage{kvoptions}

\begin{sh}
    \shuser{simon}
    \shmachine{linuxmint}
    \begin{shbox}
        \shline{}{cd Desktop/}
        \shline{Desktop/}{xsensors -help}
        \shoutput{}{}
        \shoutput{}{\underline{Options:}}
        \shoutput{}{}
        \shoutput{-f} {Display all temperatures in Fahrenheit.}
        \shoutput{-h} {Display this help text and exit.}
        \shoutput{-c} {+filename Specify the libsensors configuration file.}
        \shoutput{-i} {+filename Specify the image file to use as a theme.}
        \shoutput{-t} {+time Specify the update time in number of seconds.}
        \shoutput{-v} {Display version number.}
    \end{shbox}
    \caption{The options of \textit{xsensors}}
    \label{sh:xsensor}
\end{sh}
\DeclareStringOption[gray!70]{backgroundcolor}
\DeclareStringOption[green!80!yellow]{usernamecolor}
\DeclareStringOption[green!80!yellow]{machinenamecolor}
\DeclareStringOption[RoyalBlue]{pathcolor}
\DeclareStringOption[RoyalBlue]{indicatorcolor}
\DeclareStringOption[green!80!yellow]{separatorcolor}
\DeclareStringOption[white!60!gray]{optioncolor}
\DeclareStringOption[black]{textcolor}
\DeclareStringOption[\$]{indicatorsymbol}
\DeclareStringOption[\~]{rootpathsymbol}
\DeclareStringOption[@]{separatorsymbol}
\ProcessKeyvalOptions*
\def\shpreset#1{\csname sh@preset@#1\endcsname}
\def\shpresetdef#1#2{
\expandafter\gdef\csname sh@preset@#1\endcsname{\shpreset{default} #2}
}
\def\shchangecolor#1#2{\expandafter\gdef\csname shdoc@#1\endcsname{#2}}
\let\shchangesymbol\shchangecolor
\def\sh@preset@default{
\shchangecolor{backgroundcolor}{gray!70}
\shchangecolor{usernamecolor}{green!80!yellow}
\shchangecolor{machinenamecolor}{green!80!yellow}
\shchangecolor{pathcolor}{RoyalBlue}
\shchangecolor{indicatorcolor}{RoyalBlue}
\shchangecolor{separatorcolor}{green!80!yellow}
\shchangecolor{optioncolor}{white!60!gray}
\shchangecolor{textcolor}{black}
\shchangesymbol{indicatorsymbol}{\$}
\shchangesymbol{rootpathsymbol}{\~}
\shchangesymbol{separatorsymbol}{@}
}
\shpresetdef{mint}{\shpreset{default}}
\shpresetdef{arrows}{
\shchangecolor{usernamecolor}{red}
\shchangecolor{machinenamecolor}{green!80!yellow}
\shchangecolor{separatorcolor}{white}
\shchangecolor{indicatorsymbol}{$\gg$}
\shchangecolor{indicatorcolor}{green!80!yellow}
\shchangecolor{backgroundcolor}{black}
\shchangecolor{textcolor}{white}
\shchangecolor{optioncolor}{gray}
}
\shpresetdef{darkblue}{
\definecolor{shdarkblue}{RGB}{7,75,138}
\shchangecolor{backgroundcolor}{shdarkblue}
\shchangecolor{textcolor}{white}
\shchangecolor{separatorcolor}{white}
\shchangecolor{usernamecolor}{orange}
\shchangecolor{machinenamecolor}{orange}
\shchangecolor{pathcolor}{green!60!black}
\shchangecolor{optioncolor}{SkyBlue!80!black}
}
\shpresetdef{blackwhite}{
\shchangecolor{backgroundcolor}{gray!30}
\shchangecolor{textcolor}{black}
\shchangecolor{separatorcolor}{black}
\shchangecolor{usernamecolor}{gray}
\shchangecolor{machinenamecolor}{gray}
\shchangecolor{pathcolor}{gray!50!black}
\shchangecolor{optioncolor}{white}
\shchangecolor{indicatorcolor}{white}
}
\shpresetdef{airy}{
\shchangecolor{backgroundcolor}{SkyBlue!15}
\shchangecolor{usernamecolor}{Emerald}
\shchangecolor{machinenamecolor}{Emerald}
\shchangecolor{pathcolor}{orange!70}
\shchangecolor{indicatorcolor}{orange!70}
\shchangecolor{separatorcolor}{Emerald}
\shchangecolor{optioncolor}{Emerald!30}
}
\newcounter{shlinenumber}
\setcounter{shlinenumber}{0}
\let\@shlistname\relax
\gdef\shlistname#1{\gdef\@shlistname{#1}}
\shlistname{List of Terminal Sessions}
\newfloat{sh}{tbph}{lsh}
\restylefloat*{sh}
\floatstyle{plain}
\let\@shfloatname\relax
\gdef\shfloatname#1{\gdef\@shfloatname{#1}}
\shfloatname{Terminal~Session}
\floatname{sh}{\@shfloatname}
\captionsetup[sh]{position=bottom}
\def\listofsh{\listof{sh}{\@shlistname}}
\makeatletter
\let\@shuser\relax
\let\@shmachine\relax
\def\shuser#1{\gdef\@shuser{#1}}
\def\shmachine#1{\gdef\@shmachine{#1}}
\long\def\shline#1#2{
\ttfamily\noindent\scriptsize
\ifnum\value{shlinenumber}<10
\textcolor{\shdoc@textcolor}{0\theshlinenumber}
\else
\textcolor{\shdoc@textcolor}{\theshlinenumber}
\fi
\normalsize\ \ \textcolor{\shdoc@usernamecolor}{\@shuser}\ignorespaces
\textcolor{\shdoc@separatorcolor}{\shdoc@separatorsymbol}\ignorespaces
\textcolor{\shdoc@machinenamecolor}{\@shmachine}\ignorespaces
\ \ifx&#1&\ignorespaces
\textcolor{\shdoc@pathcolor}{\shdoc@rootpathsymbol\ }\ignorespaces
\textcolor{\shdoc@indicatorcolor}{\shdoc@indicatorsymbol}
\else\ignorespaces
\textcolor{\shdoc@pathcolor}{#1\ }\ignorespaces
\textcolor{\shdoc@indicatorcolor}{\shdoc@indicatorsymbol}\ignorespaces
\fi\ \textcolor{\shdoc@textcolor}{#2}
\stepcounter{shlinenumber}\par
}
\long\def\shoutput#1#2{
\ttfamily\noindent\scriptsize
\ifnum\value{shlinenumber}<10
\textcolor{\shdoc@textcolor}{0\theshlinenumber}
\else
\textcolor{\shdoc@textcolor}{\theshlinenumber}
\fi
\normalsize
\ifx&#1&
\textcolor{\shdoc@textcolor}{#2}\stepcounter{shlinenumber}
\else
\fcolorbox{\shdoc@optioncolor}{\shdoc@optioncolor}{\textcolor{\shdoc@textcolor}{[#1]}}
\begin{tabular}{l l}
& \textcolor{\shdoc@textcolor}{#2}\stepcounter{shlinenumber}
\end{tabular}
\fi\par
}
\newmdenv[linecolor=white,backgroundcolor=\shdoc@backgroundcolor,
settings=\setcounter{shlinenumber}{1}]{shbox}
\makeatother

\endinput
%%
%% End of file `shdoc.sty'.