summaryrefslogtreecommitdiffstats
path: root/ast/sst.sty
blob: 55f98dcb319c838a4ee97867f781eb28216fb0f7 (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
\ProvidesPackage{sst}

%%%%
% Packet for formatting latex code output from prolat
%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% .. Set up the sectioning and appearance for the sstroutine.

\RequirePackage{titlesec}

%...  New subsection sstrefsection
\titleclass{\sstrefsection}{straight}[\subsection]
\newcounter{sstrefsection}
\renewcommand{\thesstrefsection}{\arabic{sstrefsection}}

%...  Formatting the title for sstrefsection
\titleformat{name=\sstrefsection}%
{\normalfont\Large\bfseries\centering}{}{0pt}{}
\titlespacing*{\sstrefsection}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}

%...  Command to turn name and short description into single variable for title.
\newcommand{\sstsectitle}[2]{\strut \vphantom{#1}#1\newline \ignorespaces#2\strut}

% ..  Command to completely remove section from contents so it can be
% added in manually at the correct section.
\newcommand{\nocontentsline}[3]{}
\newcommand{\tocless}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup}
%% Add a toc entry which will be used in  the main toc
\newcommand{\sstmaintocline}[2]{\addcontentsline{toc}{subsection}{\protect\numberline{}#1}}

%% commands to temporarily stop sstroutines from writing anything into the main toc
\newcommand{\sstnomaintoc}{\renewcommand{\sstmaintocline}[2]{}}
%% Command to restart sstroutines appearing in the main html toc
%% (does nothing in pdf)
\newcommand{\sstmaintoc}{\renewcommand{\sstmaintocline}[2]{\addcontentsline{toc}{subsection}{\protect\numberline{}##1}}}



%% .. command to format the sst title
\newcommand{\ssttitle}[2]{
  \tocless\sstrefsection{\centering\rule{\textwidth}{0.5mm}\\%
    #1\\#2\\\rule{\textwidth}{0.5mm}}
  \sstmaintocline{\RemoveSpaces{#1}}{#2}
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%...  Basic  SSTROUTINE command
\newcommand{\sstroutine}[3]{
  \clearpage
  % Create the section.
  \ssttitle{#1}{#2}

  % Set the first parameter as the label; need to remove spaces first.
  \label{\RemoveSpaces{#1}}

  %..  change the mark on the left hand side to include the name of the chapter.
  \markright{\textit{\RemoveSpaces{#1}}}
  \iftwoside
  \fancyhead[RE,LO]{\thepage\hspace{1cm}\rightmark}
  \else
  \lhead{\thepage\hspace{1cm}\rightmark}
  \fi

  %..  Nest all the material within a description
  \begin{description}[style=nextline]
    #3
  \end{description}

  % End the page
  \newpage
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% .. Various sst macros that are used within an \sstroutine

% .. diytopic -- basis for many of th commands.
\newcommand{\sstdiytopic}[2]{\item[#1:]
\begin{description}[style=nextline]\item[]\end{description} #2}

\newcommand{\sstdescription}[1]{\item[Description:] #1 }

\newcommand{\sstusage}[1]{\item[Usage:]{\raggedright \tt #1}}

\newcommand{\sstparameters}[1]{\item[Parameters:]
\begin{description}[style=nextline]\item[] #1 \end{description}}

\newcommand{\sstkeywords}[1]{\item[Keywords:]
\begin{description}[style=nextline]\item[] #1 \end{description}}

\newcommand{\sstsubsection}[2]{\item[{#1}] #2}

\newcommand{\sstnotes}[1]{\sstdiytopic{Notes}{#1}}

\newcommand{\sstdiylist}[2]{\item[#1] #2}

\newcommand{\sstimplementationstatus}[1]{\item[Implementation Status:] #1}

\newcommand{\sstbugs}[1]{\item[Bugs:] #1}

%  Format a list of items while in paragraph mode.
\newcommand{\sstitemlist}[1]{
  \mbox{}%\vspace{-1\baselineskip}
  \begin{itemize}
     #1
  \end{itemize}
}

\newcommand{\ssthitemlist}[1]{\mbox{}\begin{itemize}#1\end{itemize}}
\newcommand{\sstapplicability}[1]{\sstdiytopic{Applicability}{#1}}
\newcommand{\sstresparameters}[1]{\sstdiytopic{Results Parameters}{#1}}
\newcommand{\sstarguments}[1]{\sstdiytopic{Arguments}{#1}}
\newcommand{\sstinvocation}[1]{\sstdiytopic{Invocation}{{\tt #1}}}
\newcommand{\sstreturnedvalue}[1]{\sstdiytopic{Returned Value}{#1}}
\newcommand{\sstimplementation}[1]{\sstdiytopic{Implementation}{#1}}


\newcommand{\sstexamplesubsection}[2]{\sloppy
\item[{\texttt{\textcolor{MidnightBlue}{#1}}}]
#2 }

% Set the font of the label of the sstexample items:
% (extra \\ spacing is required to not have weird effects. I think the
% important point is to explicitly force the label into vertical mode,
% so it doesn't try and continue the previous paragraph).
\newcommand{\sstexamplefont}[1]{\\#1\\\\}

\newcommand{\sstexamples}[1]{
  \setlength{\parindent}{0mm}
   \item[Examples:]
   \begin{description}[style=unboxed,font=\sstexamplefont,
     leftmargin=0pt,]
      #1
   \end{description}
}

%  Define the format of an item.
\newcommand{\sstitem}{\item\mbox{}}

%  Format the attribute data type section.
\providecommand{\sstattributetype}[1]{}%\item[Type:]#1}

% an environment for references (for the SST sstdiytopic command).
\newenvironment{refs}{\vspace{-4ex} % normally 3ex
                      \begin{list}{}{\setlength{\topsep}{0mm}
                                     \setlength{\partopsep}{0mm}
                                     \setlength{\itemsep}{0mm}
                                     \setlength{\parsep}{0mm}
                                     \setlength{\leftmargin}{1.5em}
                                     \setlength{\itemindent}{-\leftmargin}
                                     \setlength{\labelsep}{0mm}
                                     \setlength{\labelwidth}{0mm}}
                    }{\end{list}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% .. Additional SST-routine like commands.


% .. SST attribute command: similar to an sstroutine, but slightly
% different formatting and doesn't force a new page. See SUN/95 for
% example of usage. Also doesn't appear in the table of contents.

\newcommand{\sstattribute}[3]{
  % Create the section.
  \subsubsection*{\centering \rule{\textwidth}{0.5mm}\\\Large\ignorespaces#1
    \\#2\\\rule{\textwidth}{0.5mm}}

  % Set the first parameter as the label; need to remove spaces first.
  \label{\RemoveSpaces{#1}}

  %..  change the mark on the left hand side to include the name of the section.
  \markright{\textit{\RemoveSpaces{#1}}}

  \iftwoside
  \fancyhead[RE,LO]{\thepage\hspace{1cm}\rightmark}
  \else
  \lhead{\thepage\hspace{1cm}\rightmark}
  \fi

  %..  Nest all the material within a description
  \begin{description}[style=nextline]
    #3
  \end{description}%
}


%% SSTroutinenolabel should be same as regular sstroutine, but not
%% define a label (see sun209 -- this is because sun209 uses \textit
%% in some of its macro titles, so thesse cannot be automatically
%% changed to a label. The label must be manually created when
%% using these.
\newcommand{\sstroutinenolabel}[3]{
  \clearpage
  % Create the section.
  \ssttitle{#1}{#2}

  %..  change the mark on the left hand side to include the name of the chapter.
  \markright{\textit{\RemoveSpaces{#1}}}
  \iftwoside
  \fancyhead[RE,LO]{\thepage\hspace{1cm}\rightmark}
  \else
  \lhead{\thepage\hspace{1cm}\rightmark}
  \fi

  %..  Nest all the material within a description
  \begin{description}[style=nextline]
    #3
  \end{description}

  % End the page
  \newpage
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% .. Miscellaneous

%% Change the \wedge command to something that looks better.
\renewcommand{\wedge}{\mbox{\textasciicircum}}


%% command to prevent sstroutines from appearing in the extra html toc
%% called by \sstminitoc{Title of Toc} (does nothing in pdf)
\newcommand{\sstnoextratoc}{}
%% Command to restart sstroutines appearing in the extra html toc
%% called by \sstminitoc{Title of Toc} (does nothing in pdf)
\newcommand{\sstextratoc}{}


% Command that in html typesets a listing of all
% sstroutines/sstroutinenolables that occur before the next sectioning
% command. Does nothing in pdf at the moment.
\newcommand{\sstminitoc}[1]{}