revisioni varie
[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{\curfig}{fig.~\thefigure}
12
13 \newcommand{\nfig}{%
14 \setcounter{usercount}{\value{figure}}%
15 \addtocounter{usercount}{1}%
16 fig.~\thechapter.\theusercount}
17
18 \newcommand{\pfig}{%
19 \setcounter{usercount}{\value{figure}}%
20 \addtocounter{usercount}{-1}%
21 fig.~\thechapter.\theusercount}
22
23 \newcommand{\figref}[1]{fig.~\ref{#1}}
24 %
25 % Tables commands
26 %
27 \newcommand{\curtab}{tab.~\thetable}
28 \newcommand{\ntab}{%
29 \setcounter{usercount}{\value{table}}%
30 \addtocounter{usercount}{1}%
31 tab.~\thechapter.\theusercount}
32 \newcommand{\ptab}{%
33 \setcounter{usercount}{\value{table}}%
34 \addtocounter{usercount}{-1}%
35 tab.~\thechapter.\theusercount}
36 \newcommand{\tabref}[1]{tab.~\ref{#1}}
37 %
38 % equations commands
39 %
40 \newcommand{\cureq}{(\theequation)}
41 \newcommand{\nxeq}{%
42 \setcounter{usercount}{\value{equation}}%
43 \addtocounter{usercount}{1}%
44 (\thechapter.\theusercount)}
45 \newcommand{\preeq}{%
46 \setcounter{usercount}{\value{equation}}%
47 \addtocounter{usercount}{-1}%
48 (\thechapter.\theusercount)}
49 %
50 % Macro to put picture (in format PICT) inside a figure
51 %
52 \newcommand{\pictfig}[3]{
53         \begin{minipage}[t][#1][b]{#2}
54         \mbox{\special{pict=#3}}
55 %    \vspace{3cm}
56     \end{minipage}
57 }
58 %
59 % Command for section and chapters
60 %
61 \newcommand{\capref}[1]{cap.~\ref{#1}}
62 \newcommand{\secref}[1]{sez.~\ref{#1}}
63 %
64 % Macro to create a special environment for function prototypes
65 % boxed description
66 %
67 \newenvironment{prototype}[2]
68 {% defining what is done by \begin
69   \center
70   \begin{boxedminipage}[c]{14cm}
71   \footnotesize
72     \begin{description*}{}{} 
73     \item \texttt{\#include <#1>}
74     \item \texttt{#2} \par
75 %   \begin{lstlisting}{}
76 % #1
77 % #2
78 %   \end{lstlisting}
79 }
80 {% defining what is done by \end
81 %  \end{list} 
82 %  \par 
83 \end{description*}
84 \end{boxedminipage}
85 \vspace{6pt}
86 \par
87 \normalsize 
88 }
89 \newenvironment{errlist}{\begin{basedescript}{\desclabelwidth{1.5cm}}}
90 {\end{basedescript}}
91
92 %
93 % Slighty different envirnoment to be used for multi-header, 
94 % multi-functions boxed description
95 %
96 \newcommand{\headdecl}[1]{\item\texttt{\#include <#1>}}
97 \newcommand{\funcdecl}[1]{\item\texttt{#1}\par}
98 \newcommand{\bodydesc}[1]{\par \end{description*} #1
99  \begin{description*}{}{} \baselineskip=0pt
100  \item \vspace{-4pt}
101
102 \newenvironment{functions}
103 {% defining what is done by \begin
104   \center
105     \begin{boxedminipage}[c]{14cm}
106       \footnotesize
107     \begin{description*}{}{} 
108 }
109 {% defining what is done by \end
110       \end{description*}
111     \end{boxedminipage}
112     \vspace{6pt}
113      \par
114     \normalsize 
115 %\break
116 }
117 %
118 % Wrapper for shell command, functions, filenames, links,
119 % variables, macros,  and everything can be useul, 
120 %
121 \newcommand{\cmd}[1]{\texttt{#1}}     % shell command
122 \newcommand{\code}[1]{\texttt{#1}}    % for simple code
123 \newcommand{\func}[1]{%
124 \index{#1@{\tt {#1}}}\texttt{#1}%
125 }                                     % library function (or system call)
126 \newcommand{\macro}[1]{\texttt{#1}}   % macro constant
127 \newcommand{\var}[1]{\texttt{#1}}     % variable 
128 \newcommand{\file}[1]{\texttt{#1}}    % file name
129 \newcommand{\link}[1]{\texttt{#1}}    % html link
130 \newcommand{\ctyp}[1]{\texttt{#1}}    % C standard type
131 \newcommand{\type}[1]{%
132 \index{#1@{\tt {#1}}}\texttt{#1}%
133 }                                     % system type
134 \newcommand{\param}[1]{\texttt{#1}}   % function parameter
135 \newcommand{\acr}[1]{\textsl{#1}}     % acrostic (for pid, suid, etc.)
136
137
138 %%% Local Variables: 
139 %%% mode: latex
140 %%% TeX-master: "gapil"
141 %%% End: