summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/shdoc/shdoc.dtx
blob: 30b64fcaac8209341aa8f7a8fc01527b1be75781 (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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
% \iffalse meta-comment
%
% 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
%
% \fi
%
%\iffalse
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{shdoc}[2015/05/24 v2.0 Package for documenting terminal operations]
%<package>\RequirePackage[dvipsnames]{xcolor}
%<package>\RequirePackage{float}
%<package>\RequirePackage{caption}
%<package>\RequirePackage{mdframed}
%<package>\RequirePackage{kvoptions}
%
%
%<*internal>
\iffalse
%</internal>
%<*readme>
 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

 The shdoc package provides a simple, though fancy, float
 environment that can be used to document operations or command
 executions of a terminal session on a shell.
 
 The current version of the package is v2.0.
 
 To create the package (*.sty) from source open a command line prompt,
 change to the package directory and type
     
     tex shdoc.ins
     
 Afterwards you can generate the package documentation by typing
   
     (pdf)latex shdoc.dtx
%</readme>
%
%<*internal>
\fi
%</internal>



%<*driver>
\documentclass[a4paper, 10pt]{ltxdoc}
\usepackage{shdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage[DIV=9]{typearea}
\usepackage{graphicx}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\usepackage[colorlinks=true,linkcolor=black,urlcolor=blue]{hyperref}
\begin{document}
	\DocInput{shdoc.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \changes{v1.0}{2015/03/10}{Initial version}
% \changes{v1.1}{2015/04/06}{Formatting changes}
% \changes{v1.2}{2015/05/20}{Background color changed globally}
% \changes{v2.0}{2015/08/10}{Added package options as kv-list: colors and symbols}
%
% \GetFileInfo{\jobname.sty}
%
% \DoNotIndex{}
%
%
%
%\title{The \textit{shdoc} package -- Manual for version~\fileversion, \filedate}
%\author{Simon Michael Laube \\ \texttt{simon.laube@gmx.at}}
%\date{}
%
%\maketitle
%
%\shuser{simon}
%\shmachine{linuxmint}
% \begin{shbox}
%	\shline{}{tex}
%   \shoutput{}{This is TeX, Version 3.14159265 (TeX Live 2014)}
%	\shoutput{}{**\cmd{\relax}}
%   \shoutput{}{*Hello World!}
%   \shoutput{}{*\cmd{\bye}}
% \end{shbox}
% \begin{abstract}
% \noindent The \textit{shdoc} packages helps documenting commandline actions in
% a fancy way. It tries to imitate the look and feel of the original shell prompt
% while offering a wide range of personalization options.
% \end{abstract}
%
%\tableofcontents\newpage
%
% \section{Introduction}
%
% Many people who use \LaTeX\ and do a bit of coding in other languages have used
% \LaTeX's \textit{listings} package at least once. However, when me and my colleague 
% wrote the documentation of our diploma project in 2015, we stumbled across a ``problem''\footnote{obviously it's not a
% problem, but we wanted something more colourful} with
% \textit{listings}. A lot of command line scripting had to be done for our project to configure a Raspberry Pi B+ and those
% actions needed to be documented. \textit{listings} seemed to be the wrong package to look for, so we wrote our own.
%  At first there were few small macros that we referred to as \textit{bashdoc} -- this was
% version 1.0. Later the macros got a bit more complex and we threw away the \textit{ba} part of \textit{bashdoc},
% that's how the \textit{shdoc} package was born. The basic idea somehow
% stayed the same since the very first draft, but the package is much more applicable now, although there are still many
% things missing that could make the package better.\par 
%
% I hope that \textit{shdoc} fits your application as it fitted ours. If there are any serious problems, feel free to 
% send me an email\footnote{Please do not send spam mails of any kind. Plain text email format would be a great idea, too.}.
% Moreover, I do not guarantee full compatibility with other packages. The package is distributed under the \LaTeX\ Project
% Public License version 1.3.\par 
% 
%
% \section{User commands}
%   \textit{shdoc} implements user commands that allow one to typeset the content/commands 
%	of a command line session appropriately. Further there are macros to
%   create and modify styles and appearance of the final output.\par 
%   \subsection{Package inclusion and options}
% 	Just like every \LaTeX\ package, \textit{shdoc} can be included using the standard
%   \cmd{\usepackage} command:
% 	\begin{quote}
%   \cmd{\usepackage\oarg{options}\{shdoc\}}
%	\end{quote}
%   Since version 2.0 \textit{shdoc} supports several package options to make the environment more
% 	adjustable for users. The available options are described in detail in the following 
%   sections.
%   \subsubsection{Color options}\label{subsubsec:coloropts}
%   The shbox environment uses plenty of \textit{different} colors, which can be adjusted through
%   optional package arguments. Table~\ref{tab:color_var} shows the adjustable colors.
%   Every color is specified using a key-value element as an optional package argument.
%   If no argument is used for a specific color the default value is used.
%
%   \DescribeMacro{backgroundcolor}
%   The background color specifies the color of the background of the ``shell'' in the
%   shbox environment -- see section~\ref{sec:examples}. The default value is set to
%	\begin{quote}
%		\verb|backgroundcolor=gray!70|
%	\end{quote}
%   to imitate the look of a shell and offer a not to dark, printable 
%	background at the same time.\pagebreak[4]
%
%	\DescribeMacro{usernamecolor}
%	The username color specifies the color of the current user's name within
% 	the shbox environment. The default value for this color is
%	\begin{quote}
%		\verb|usernamecolor=green!80!yellow|
%	\end{quote}
%
%	\DescribeMacro{machinenamecolor}
% 	The machine-name color specifies the color of the machine's name within
% 	the shbox environment. The default value for this color is the
%   same as the username color.
%
%	\DescribeMacro{indicatorcolor}
%	The indicator separates the displayed path, user and machine values from the user input.
%	It's default color is
%	\begin{quote}
%	 	\verb|indicatorcolor=RoyalBlue|
%	\end{quote}
%
%	\DescribeMacro{separatorcolor}
%	The separator separates the username from the machine-name. Its default color is the 
% 	same as the username color, namely
%	\begin{quote}
%		\verb|separatorcolor=green!80!yellow|
%	\end{quote}
%   
%   \begin{table}[tbh!]
%	\centering
%	\begin{tabular}{ll}
%		Name & Description \\\hline
%	 	backgroundcolor & color of the environment background\\
%       usernamecolor & color of the username\\
%		machinenamecolor & color of the machine-name\\
%		indicatorcolor & color of the indicator symbol\\
%		separatorcolor & color of the user-machine separator symbol\\
%		pathcolor & the color of the current path\\
% 		optioncolor & color of the little option box\\
%		textcolor & color of the rest of the text\\
%	\end{tabular}
%	\caption{Adjustable colors of the shbox environment and their description}
%	\label{tab:color_var}
% 	\end{table}
%
% 	\DescribeMacro{pathcolor}
% 	The pathcolor specifies the color of the current path and is by default
%	the same as the indicator color:
%	\begin{quote}
%	 	\verb|pathcolor=RoyalBlue|
%	\end{quote}
%
%   \DescribeMacro{optioncolor}
%   The option color specifies the background color of the little optionbox
%   in the \cmd{\shoutput} command. The boxes' default color is
%	\begin{quote}
%		\verb|optioncolor=white!60!gray|
%	\end{quote}
%
%	\DescribeMacro{textcolor}
%   The text color simply specifies the color of the whole rest of all
%	text inside the shbox environment. Its default value is \textit{black}.
%
%   \subsubsection{Symbol options}
%   In total, only two symbols can be changed in the \textit{shdoc} package.
%   Table~\ref{tab:symbol_var} shows their name and description. Just as the
%   colors, every symbol is changed using a key-value element as an optional
%   package argument.
%
%   \DescribeMacro{indicatorsymbol}
%   The indicator symbol separates the displayed username, machine-name and path values from 
%   the user input. Its default value is
%
%	\begin{quote}
%		\verb|indicatorsymbol=\$|
%	\end{quote}
%	\pagebreak[4]
%   \DescribeMacro{separatorsymbol}
%	The separator symbol separates the username from the machine-name. Its default value is
%
%	\begin{quote}
%		\verb|separatorsymbol=@|
%	\end{quote}
%   Please pay attention, that the @'s \textit{catcode} is changed to letter internally. Thus,
%   the @ needs to be specified without a \textbackslash.
%
%   \begin{table}[tbh!]
%	\centering
%	\begin{tabular}{ll}
%		Name & Description \\\hline
%	 	indicatorsymbol & separates user input and displayed path\\
%       separatorsymbol & separates user- and machine-name\\
%	\end{tabular}
%	\caption{Adjustable symbols of the shbox environment and their description}
%	\label{tab:symbol_var}
% 	\end{table}
%
%	\subsubsection{Presets}
%   As described above, \textit{shdoc} has some settings that can be
% 	changed by the user. Some setting values have been tested and 
%   stored as a preset that a user can easily load. Further, users are able to 
% 	create their own presets via built-in commands.\par
%
%	\DescribeMacro{\shpreset}
%	One can easily load a preset with \cmd{\shpreset} by using the preset's name
% 	as an argument to that macro. When a preset has been loaded it is valid for every 
%   new \textit{shbox} environment afterwards, until the \cmd{\shpreset} macro is called
%	again.\par 
%	\DescribeMacro{\shpresetdef} Most of the time, users might want to create their own styles,
%	which can be achieved by defining a new preset via \cmd{\shpresetdef}. The command has two
% 	mandatory arguments: The first one is the desired preset-name and the second one is the 
%	preset definition. For example one can use:
%	\begin{quote}
%		\verb|\shpresetdef{useless}{\relax}|
%	\end{quote}
%   and is then able to apply the preset by calling:
%	\begin{quote}
%		\verb|\shpreset{useless}|
%	\end{quote}
%	\par
%	To make creating presets easier there are two additional commands that simply
%	change the according value within the package.
%	\DescribeMacro{\shchangecolor}
%	If a user wants to change a specific color, he has to use \cmd{\shchangecolor}, where
% 	the first argument is the colors name -- see section~\ref{subsubsec:coloropts} -- and the
%	second one is the desired color (according to the \textit{xcolor} syntax).\par
%
%	\DescribeMacro{\shchangesymbol}
%	The same rules apply to the \cmd{\shchangesymbol} command that implements the same function
% 	for the according symbols. For further information about preset definitions, please have a look
% 	at section~\ref{subsec:presetdef}.\par 
%
%
%	Several presets have been defined by the author and are included in the \textit{shdoc} package.
% 	One can use them by calling the \cmd{\shpreset\marg{name}} command with the name of the desired
% 	preset. The following list shows the appearance and name of the predefined presets -- for visuals
%	see section~\ref{sec:examples}:
%
%	\begin{description}
%		\item[default/mint] The default preset. It implements a gray background theme
%		with light gray option boxes, light green user- and machine-name and a blue path value.
%
%		\item[arrows] Not recommended for printed documents. Implements a black background theme
%		with gray option boxes, red username, white separator, light green machine-name, blue path
%		and two arrows as an indicator symbol. The rest of the text is white, too.
%		
%		\item[darkblue] Implements a dark blue background theme with white text, light blue option
%		boxes, orange user- and machine-name and a green path value.
%
%		\item[airy] A light colored style. Implements a light blue background theme with cyan option
%		boxes and user- \& machine-name, as well as light orange path value and black text.
%
%		\item[blackwhite] Best for non-color prints. Implements a light gray background theme with white option
%		boxes, black text, darker gray user- and machine-name and a dark gray path value.
%	\end{description}
%	
%	\subsection{Name variables}
%	For international compatibility the \textit{shdoc} packages implements two commands to make the list and
% 	caption name easily accessible. \par 
%	\DescribeMacro{\shlistname} One can use \cmd{\shlistname} to change the title of the sessions listThe default 
%	value is  ``\cmd{\shlistname}\{List of Terminal Sessions\}''.\par 
%
%	\DescribeMacro{\shfloatname} In the same manner as described above, the float caption that's displayed below
%	each float could be changed. Its default value is ``\cmd{\shfloatname}\{Terminal Session\}''.
%
%  	\subsection{The environment}\label{subsec:environment}
%	Basically a complete terminal session consists out of two environments that contain the
%	necessary information that is used to typeset the session. 
%	\DescribeMacro{\sh} The outer environment is named \cmd{\sh} and basically acts as the
% 	float environment that could contain one or more so called \cmd{\shbox}es.
%	\DescribeMacro{\shbox} Every \cmd{\shbox} contains in- and output lines of the terminal,
%	with information provided by the user. The following code shows a brief overview of the
%	possible and necessary commands:\par 
%	\begin{verbatim}
%	\shpreset{mint}
%	\begin{sh}
%		  \shuser{simon}
%		  \shmachine{linuxmint}
%		  \begin{shbox}
%		    	\shline{}{cd Desktop/}
%			     \shline{Desktop/}{whoami}
%		    	\shoutput{}{simon}
%		  \end{shbox}
%	\end{sh}
%	\end{verbatim}
%	\DescribeMacro{\shuser} At least once before an occurrence of a \cmd{\shbox},
%	the user- and machine-name must be specified. \DescribeMacro{\shmachine}
%	They are set globally and thus are valid for
%	every \cmd{\shbox} that follows the macro call.\par
%
%	\DescribeMacro{\shline}
%	Within the \cmd{\shbox} there are only two valid commands, namely \cmd{\shline}, which 
%	\DescribeMacro{\shoutput}
%	is basically the users' input, and \cmd{\shoutput}, which is ment to be the machine output.
%	\cmd{\shline} has two mandatory arguments, where the first one is the path value\footnote{a smarter solution
%	for the path value is currently in work as a draft.} and the second one is the command that's
% 	about to be run.
%	\cmd{\shoutput} implements two mandatory macros, too. Here, the first argument is an arbitrary option, which
% 	could also be left blank, when no option box is wanted. The second argument is for the commands' output.
% 	
%
% \section{Examples}\label{sec:examples}
% 	\subsection{Various examples}
%		\subsubsection{Basic Sessions}
%\shpreset{blackwhite}
%\begin{sh}
%	\begin{verbatim}
%	\shpreset{blackwhite}
	\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}
%	\end{verbatim}
%	\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}
%
%
%\shpreset{default}
%\begin{sh}
%	\begin{verbatim}
%		\shpreset{default}
%		\begin{sh}
%		    \shuser{simon}
%		    \shmachine{linuxmint}
% 		    \begin{shbox}
%		        \shline{}{tex}
%   	        \shoutput{}{This is TeX, Version 3.14159265 (TeX Live 2014)}
%		            \shoutput{}{**\cmd{\relax}}
%   	        \shoutput{}{*Hello World!}
%   	        \shoutput{}{*\cmd{\bye}}
%           \end{shbox}
%		    \caption{Hello World in \TeX{}}
%		    \label{sh:TeX}
%		\end{sh}
%	\end{verbatim}
%	\shuser{simon}
%	\shmachine{linuxmint}
% 	\begin{shbox}
%	\shline{}{tex}
%   \shoutput{}{This is TeX, Version 3.14159265 (TeX Live 2014)}
%	\shoutput{}{**\cmd{\relax}}
%   \shoutput{}{*Hello World!}
%   \shoutput{}{*\cmd{\bye}}
% 	\end{shbox}
%	\caption{Hello World in \TeX{}}
%	\label{sh:TeX}
%\end{sh}
%
%		\subsubsection{Preset creation}
%
%	\shpresetdef{odd}{
%		\shpreset{blackwhite}
%		\shchangecolor{usernamecolor}{orange}
%		\shchangecolor{machinenamecolor}{orange}
%	}
%	\shpreset{odd}
%	\begin{sh}[th!]
%	\begin{verbatim}
%	\shpresetdef{odd}{
%	    \shpreset{blackwhite}
%	    \shchangecolor{usernamecolor}{orange}
%	    \shchangecolor{machinenamecolor}{orange}
%	}
%	\shpreset{odd}
%	\begin{sh}
%	    \shuser{doctorX}
%	    \shmachine{supercomputer}
%	    \begin{shbox}
%	        \shline{/home/doctorX/Documents}{exit}
%	    \end{shbox}
%	    \caption{Go away.}
%	    \label{sh:exit}
%	\end{sh}
%	\end{verbatim}
%		\shuser{doctorX}
%		\shmachine{supercomputer}
%		\begin{shbox}
%			\shline{/home/doctorX/Documents}{exit}
%		\end{shbox}
%		\caption{Go away.}
%		\label{sh:exit}
%	\end{sh}
%
%	\shpresetdef{mystyle}{
%		\shchangecolor{backgroundcolor}{white}
%		\shchangecolor{usernamecolor}{red}
%		\shchangecolor{machinenamecolor}{red}
%		\shchangecolor{separatorcolor}{RoyalBlue}
%		\shchangecolor{optioncolor}{orange!50!yellow}
%		\shchangesymbol{indicatorsymbol}{!}
%		\shchangesymbol{separatorsymbol}{$\geq$}
%	}
%	\shpreset{mystyle}
%	\begin{sh}
%	\begin{verbatim}
%		\shpresetdef{mystyle}{
%		    \shchangecolor{backgroundcolor}{white}
%		    \shchangecolor{usernamecolor}{red}
%		    \shchangecolor{machinenamecolor}{red}
%		    \shchangecolor{separatorcolor}{RoyalBlue}
%		    \shchangecolor{optioncolor}{orange!50!yellow}
%		    \shchangesymbol{indicatorsymbol}{!}
%		    \shchangesymbol{separatorsymbol}{$\geq$}
%		}
%
%		\begin{sh}
%		    \shuser{joe}
%		    \shmachine{joesraspian}%
%		    \begin{shbox}
%		        \shline{}{history}
%		        \shoutput{480}{rubber}
%		        \shoutput{481}{xsensors}
%		        \shoutput{482}{tracepath www.google.com}
%		        \shoutput{483}{whoami}
%		        \shoutput{484}{help}
%		        \shoutput{485}{exit}
%		    \end{shbox}
%		    \caption{History of my session}
%		    \label{sh:history}
%		\end{sh}
%	\end{verbatim}
%		\shuser{joe}
%		\shmachine{joesraspian}%
%		\begin{shbox}
%			\shline{}{history}
%			\shoutput{480}{rubber}
%			\shoutput{481}{xsensors}
%			\shoutput{482}{tracepath www.google.com}
%			\shoutput{483}{whoami}
%			\shoutput{484}{help}
%			\shoutput{485}{exit}
%		\end{shbox}
%		\caption{History of my session}
%		\label{sh:history}
%	\end{sh}\newpage
%	
%
%	\subsection{All the predefined presets}
%   \shpreset{default}
%\begin{sh}[th!]
%	\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} -- \textit{default} or \textit{mint} preset}
%	\label{sh:minttest}
%\end{sh}
%   \shpreset{arrows}
%\begin{sh}[th!]
%	\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} -- \textit{arrows} preset}
%	\label{sh:arrtest}
%\end{sh}\newpage
%   \shpreset{darkblue}
%\begin{sh}[th!]
%	\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} -- \textit{darkblue} preset}
%	\label{sh:dbtest}
%\end{sh}
%   \shpreset{airy}
%\begin{sh}[th!]
%	\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} -- \textit{airy} preset}
%	\label{sh:airtest}
%\end{sh}
%\shpreset{blackwhite}
%\begin{sh}[th!]
%	\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} -- \textit{blackwhite} preset}
%	\label{sh:bwtest}
%\end{sh}
% ^^A Implementation from here
%\StopEventually{\PrintIndex}
%
% \newpage
% \section{Implementation}\label{sec:implementation}
% This section describes the implementation of the \textit{shdoc} package and its
% features. The package was written as a \texttt{*.dtx} source file and therefore the
% package code begins with the following instruction:\par 
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
% \subsection{Options}
% First of all, the package options for colouring and symbol options and their default values are defined. The options
% are then processed to make them available for the user.
%\begin{macro}{
%		color, symbol
%				}
%    \begin{macrocode}
\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*
%    \end{macrocode}
%\end{macro}
%
% \subsection{Presets}~\label{subsec:presetdef}
% Right after the option definitions the preset commands are defined. 
% Every preset is stored in a macro with the generic name \cmd{\sh@preset@NAME}, where
% \texttt{NAME} stands for the preset name.
% To make the presets better loadable for users \cmd{\shpreset} is defined
% to simply execute the package internal preset macro:
%
%\begin{macro}{\shpreset}
%
%    \begin{macrocode}
\def\shpreset#1{\csname sh@preset@#1\endcsname}
%    \end{macrocode}    
%\end{macro}
% To simplify the creation of new presets a few macros are needed. The main command
% is \cmd{\shpresetdef}, which creates a new preset macro with the desired settings. 
% The macro calls \cmd{\shpreset\{default\}} at the beginning, so the inital settings of the new preset
% are the default settings of \textit{shdoc}.
%\begin{macro}{
%	\shpresetdef}
%    \begin{macrocode}
\def\shpresetdef#1#2{
	\expandafter\gdef\csname sh@preset@#1\endcsname{\shpreset{default} #2}
}
%    \end{macrocode}
%\end{macro}
% Basically, every command can be used as the second argument of \cmd{\shpresetdef}, but
% most of them won't change any settings in \textit{shdoc}. The only useful macros in this
% context are those, who explicitly change a color or symbol within the package, namely
% \cmd{\shchangecolor} and \cmd{\shchangesymbol}.
%
% \cmd{\shchangecolor} has two arguments, where the first is the name of the color that
% should be changed and the second is the new value. Although there won't be an error,
% colornames that aren't listed in table~\ref{tab:color_var} are not valid. The macro simply
% redefines the according color.
%\begin{macro}{\shchangecolor}
%    \begin{macrocode}
\def\shchangecolor#1#2{\expandafter\gdef\csname shdoc@#1\endcsname{#2}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\shchangesymbol}
% \cmd{\shchangesymbol} implements the same definition as \cmd{\shchangecolor}. 
% Thus, the command only exists for logical reasons. It simply redefines the 
% desired symbol.
%    \begin{macrocode}
\let\shchangesymbol\shchangecolor
%    \end{macrocode}
%\end{macro}
%
% Since \cmd{\shpresetdef} calls \cmd{\shpreset\{default\}}, the default preset
% needed to be defined manually via \cmd{\def}.
%\begin{macro}{\sh@preset@default}
%    \begin{macrocode}
\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}{@}
}
%    \end{macrocode}
%\end{macro}
% As the \textit{shdoc} package was initally ment to imitate the Linux Mint bash, the
% default preset is equal to the \textit{mint} style, which is defined right after the default preset:
%\begin{macro}{\sh@preset@mint}
%    \begin{macrocode}
\shpresetdef{mint}{\shpreset{default}}
%    \end{macrocode}
%\end{macro}
%
% The second preset style is the ``arrows'' style, which is a dark color scheme with
% two arrows as the indicator symbol.
%\begin{macro}{\sh@preset@arrows}
%    \begin{macrocode}
\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}
}
%    \end{macrocode}
%\end{macro}
%
% Another dark scheme is the ``darkblue'' preset, which defines a dark blue background color
% and more or less appropriate other colors. The definition of this preset is furthermore a
% nice example, how macros of other packages could also make sense within the \cmd{\shpresetdef} 
% command.
%\begin{macro}{\sh@preset@darkblue}
%    \begin{macrocode}
\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}
}
%    \end{macrocode}
%\end{macro}
%
% For those, who print their documents with the black ink cartridge only there is the
% ``blackwhite'' preset. The definition sets the background and all the other colors to
% different versions of gray, black and white -- see the examples in section~\ref{sec:examples}.
%\begin{macro}{\sh@preset@blackwhite}
%    \begin{macrocode}
\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}
}
%    \end{macrocode}
%\end{macro}
%
% The last and probably lightest preset is the ``airy'' preset with light blue and green elements.\par 
%\begin{macro}{\sh@preset@airy}
%    \begin{macrocode}
\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}
}
%    \end{macrocode}
%\end{macro}
%
% \subsection{Environment}
% After all the setting definitions above the actual environment for the 
% shell commands can be defined. The whole environment consists of a
% float environment with caption and label and one or more inner frameboxes, which
% are generated with the \textit{mdframed} package. Further there is a
% line number on the left side of every box. The number is defined as a
% standard \LaTeX\ counter and is initially set to 0.
%\begin{macro}{\shlinenumber}
%    \begin{macrocode}
\newcounter{shlinenumber}
\setcounter{shlinenumber}{0}
%    \end{macrocode}
%\end{macro}
%
% Since the outer environment is a float, a list name variable is 
% needed to make the name adjustable. There are two macros that
% implement this functionality: \cmd{\@shlistname} is the 
% name variable that holds the current value of the list name.
% \cmd{\shlistname} is a user command, that redefines the
% name according to the users' input. After the definition the
% standard value is set.
%\begin{macro}{\shlistname}
%    \begin{macrocode}
\let\@shlistname\relax
\gdef\shlistname#1{\gdef\@shlistname{#1}}
\shlistname{List of Terminal Sessions}
%    \end{macrocode}
%\end{macro}
%
% \subsubsection{Float environment}
% Now, the whole float environment is defined. The float is named
% \cmd{\sh} and uses the plain float style. The float name is stored
% in a variable, which is implemented in the same way as the list name.
% Afterwards the name is set. The caption is set to be at the bottom of the
% float and a macro for the generation of the ``List of Terminal Sessions''
% is defined.
%\begin{macro}{\sh}
%    \begin{macrocode}
\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}}
%    \end{macrocode}
%\end{macro}
%
% \subsubsection{Framebox}
% For each session the user and machine values can and must be set, but they could also be 
% set at the beginning of a document to be valid for every terminal session. In the same manner 
% as before, two name variables and their setup commands are defined. There is no default value.
%\begin{macro}{
% 		\shuser,
%		\shmachine}
%    \begin{macrocode}
\makeatletter
\let\@shuser\relax
\let\@shmachine\relax
\def\shuser#1{\gdef\@shuser{#1}}
\def\shmachine#1{\gdef\@shmachine{#1}}
%    \end{macrocode}
%\end{macro}
%
%
% Within the framebox \cmd{\shbox} -- which is defined at the very end of the source code -- 
% there are two commands: \cmd{\shline} for user inputs and \cmd{\shoutput} for shell outputs.
% When \cmd{\shline} is executed it prints the line number onto the left side of the box first.
% 
%\begin{macro}{\shline}
%    \begin{macrocode}
\long\def\shline#1#2{
	\ttfamily\noindent\scriptsize
%    \end{macrocode}
% If the counter is less equal then $10$, a leading zero is added; otherwise the line number
% is directly printed.
%    \begin{macrocode}
	\ifnum\value{shlinenumber}<10 
		\textcolor{\shdoc@textcolor}{0\theshlinenumber}
	\else
		\textcolor{\shdoc@textcolor}{\theshlinenumber}
	\fi
%    \end{macrocode}
% After some white spaces the username is printed in the username color.
% It is followed by the separator and the machine name in their appropriate colors. 
%    \begin{macrocode}
	\normalsize\ \ \textcolor{\shdoc@usernamecolor}{\@shuser}\ignorespaces
	\textcolor{\shdoc@separatorcolor}{\shdoc@separatorsymbol}\ignorespaces
	\textcolor{\shdoc@machinenamecolor}{\@shmachine}\ignorespaces
%    \end{macrocode}
% Furthermore, the path argument is checked. If it's empty, the root path symbol is automatically
% printed, if not the given path is used. The last element that's not a command is the indicator 
% symbol, which is set after a white space. The rest of one \cmd{\shline} contains the commands
% that the user has passed through the second argument.
%    \begin{macrocode}
	\ \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 
}
%    \end{macrocode}
%\end{macro}
%
% Just as before the \cmd{\shoutput} prints the line number first and checks
% if the value is under 10.
%\begin{macro}{\shoutput}
%    \begin{macrocode}
\long\def\shoutput#1#2{
	\ttfamily\noindent\scriptsize
	\ifnum\value{shlinenumber}<10 
		\textcolor{\shdoc@textcolor}{0\theshlinenumber}
	\else 
		\textcolor{\shdoc@textcolor}{\theshlinenumber}
	\fi
%    \end{macrocode}
% After that, the first argument is checked. If it's empty, the second argument is directly printed.
% In this case the user is able to use \cmd{\newline} to insert a linebreak.
% If the first argument isn't empty a tabular with two columns is generated, the first 
% column contains a colorbox that contains the value of argument one. The second column
% contains the value of argument two. In this case no linebreak can be inserted.
%    \begin{macrocode}
	\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  
}
%    \end{macrocode}
%\end{macro}
%
% Finally, the mdframed box is defined through the environment definition command of the
% \textit{mdframed} package. The frameline color is white and the default backgroundcolor
% is set. Further, the linecounter is set to 1, when the \cmd{\shbox} environment is started.
%\begin{macro}{\shbox}
%    \begin{macrocode}
\newmdenv[linecolor=white,backgroundcolor=\shdoc@backgroundcolor,
settings=\setcounter{shlinenumber}{1}]{shbox}
%    \end{macrocode}
%\end{macro}
%    \begin{macrocode}
\makeatother
%</package>
%    \end{macrocode}
%\Finale
%