Correzioni e chiarimenti in base ai suggerimenti di D. Masini, prima
[gapil.git] / macro.tex
1 %
2 % Defining some commands to manipulate counter to avoid ude of 
3 % \label and \ref commands (and related problem to remeber the 
4 % used labels) to refer nearest objects
5 %
6 %
7 \newcounter{usercount}       % define a new counter for internal use
8 %
9 % Figure commands
10 %
11 \newcommand{\figref}[1]{fig.~\ref{#1}}
12 %
13 % Tables commands
14 %
15 \newcommand{\tabref}[1]{tab.~\ref{#1}}
16 %
17 % equations commands
18 %
19 \newcommand{\cureq}{(\theequation)}
20 \newcommand{\nxeq}{%
21 \setcounter{usercount}{\value{equation}}%
22 \addtocounter{usercount}{1}%
23 (\thechapter.\theusercount)}
24 \newcommand{\preeq}{%
25 \setcounter{usercount}{\value{equation}}%
26 \addtocounter{usercount}{-1}%
27 (\thechapter.\theusercount)}
28 %
29 % Macro to put picture (in format PICT) inside a figure
30 %
31 \newcommand{\pictfig}[3]{
32         \begin{minipage}[t][#1][b]{#2}
33         \mbox{\special{pict=#3}}
34 %    \vspace{3cm}
35     \end{minipage}
36 }
37 %
38 % Command for section and chapters
39 %
40 \newcommand{\capref}[1]{cap.~\ref{#1}}
41 \newcommand{\secref}[1]{sez.~\ref{#1}}
42 %
43 % Macro to create a special environment for function prototypes
44 % boxed description
45 %
46 \newenvironment{prototype}[2]
47 {% defining what is done by \begin
48   \center
49   \begin{boxedminipage}[c]{14cm}
50   \footnotesize
51     \begin{description*}{}{} 
52     \item \texttt{\#include <#1>}
53     \item \texttt{#2} \par
54 %   \begin{lstlisting}{}
55 % #1
56 % #2
57 %   \end{lstlisting}
58 }
59 {% defining what is done by \end
60 %  \end{list} 
61 %  \par 
62 \end{description*}
63 \end{boxedminipage}
64 \vspace{6pt}
65 \par
66 \normalsize 
67 }
68 \newenvironment{errlist}{\begin{basedescript}{\desclabelwidth{1.5cm}}}
69 {\end{basedescript}}
70 %
71 % Slighty different envirnoment to be used for multi-header, 
72 % multi-functions boxed description
73 %
74 \newcommand{\headdecl}[1]{\item\texttt{\#include <#1>}}
75 \newcommand{\funcdecl}[1]{\item\texttt{#1}\par}
76 \newcommand{\bodydesc}[1]{\par \end{description*} #1
77  \begin{description*}{}{} \baselineskip=0pt
78  \item \vspace{-4pt}
79
80
81 \newenvironment{functions}
82 {% defining what is done by \begin
83   \center
84     \begin{boxedminipage}[c]{14cm}
85       \footnotesize
86     \begin{description*}{}{} 
87 }
88 {% defining what is done by \end
89       \end{description*}
90     \end{boxedminipage}
91     \vspace{6pt}
92      \par
93     \normalsize 
94 %\break
95 }
96 %
97 % Wrapper for shell command, functions, filenames, links,
98 % variables, macros,  and everything can be useul, 
99 %
100 \newcommand{\cmd}[1]{\texttt{#1}}     % shell command
101 \newcommand{\code}[1]{\texttt{#1}}    % for simple code
102 \newcommand{\func}[1]{%
103 \index{#1@{\tt {#1}}}\texttt{#1}%
104 }                                     % library function (or system call)
105 \newcommand{\macro}[1]{\texttt{#1}}   % macro constant
106 \newcommand{\var}[1]{\texttt{#1}}     % variable 
107 \newcommand{\file}[1]{\texttt{#1}}    % file name
108 \newcommand{\link}[1]{\texttt{#1}}    % html link
109 \newcommand{\ctyp}[1]{\texttt{#1}}    % C standard type
110 \newcommand{\type}[1]{%
111 \index{#1@{\tt {#1}}}\texttt{#1}%
112 }                                     % system type
113 \newcommand{\param}[1]{\texttt{#1}}   % function parameter
114 \newcommand{\acr}[1]{\textsl{#1}}     % acrostic (for pid, suid, etc.)
115
116
117 %%% Local Variables: 
118 %%% mode: latex
119 %%% TeX-master: "gapil"
120 %%% End: