summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/shdoc/shdoc.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-09-02 23:59:16 +0000
committerKarl Berry <karl@freefriends.org>2015-09-02 23:59:16 +0000
commit42bfcf8ad29b80c26850bc74b566386ea436ad47 (patch)
tree8e12ed94fb8eebe1777cfe6e6c19b754b00e2d35 /Master/texmf-dist/source/latex/shdoc/shdoc.dtx
parent3f1f1cefd70c2c51b5ebf053549cea2c2709d2d7 (diff)
shdoc (2sep15)
git-svn-id: svn://tug.org/texlive/trunk@38277 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/shdoc/shdoc.dtx')
-rw-r--r--Master/texmf-dist/source/latex/shdoc/shdoc.dtx970
1 files changed, 970 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/shdoc/shdoc.dtx b/Master/texmf-dist/source/latex/shdoc/shdoc.dtx
new file mode 100644
index 00000000000..30b64fcaac8
--- /dev/null
+++ b/Master/texmf-dist/source/latex/shdoc/shdoc.dtx
@@ -0,0 +1,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
+%
+