9feadaa9d15e36a1bdb230970d1c28232e7e0118
[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 \newcommand{\nfig}{%
13 \setcounter{usercount}{\value{figure}}%
14 \addtocounter{usercount}{1}%
15 fig.~\thechapter.\theusercount}
16 \newcommand{\pfig}{%
17 \setcounter{usercount}{\value{figure}}%
18 \addtocounter{usercount}{-1}%
19 fig.~\thechapter.\theusercount}
20 \newcommand{\figref}[1]{fig.~\ref{#1}}
21 %
22 % Tables commands
23 %
24 \newcommand{\curtab}{tab.~\thetable}
25 \newcommand{\ntab}{%
26 \setcounter{usercount}{\value{table}}%
27 \addtocounter{usercount}{1}%
28 tab.~\thechapter.\theusercount}
29 \newcommand{\ptab}{%
30 \setcounter{usercount}{\value{table}}%
31 \addtocounter{usercount}{-1}%
32 tab.~\thechapter.\theusercount}
33 \newcommand{\tabref}[1]{tab.~\ref{#1}}
34 %
35 % equations commands
36 %
37 \newcommand{\cureq}{(\theequation)}
38 \newcommand{\nxeq}{%
39 \setcounter{usercount}{\value{equation}}%
40 \addtocounter{usercount}{1}%
41 (\thechapter.\theusercount)}
42 \newcommand{\preeq}{%
43 \setcounter{usercount}{\value{equation}}%
44 \addtocounter{usercount}{-1}%
45 (\thechapter.\theusercount)}
46 %
47 % Macro to put picture (in format PICT) inside a figure
48 %
49 \newcommand{\pictfig}[3]{
50         \begin{minipage}[t][#1][b]{#2}
51         \mbox{\special{pict=#3}}
52 %    \vspace{3cm}
53     \end{minipage}
54 }
55 %
56 % Command for section and chapters
57 %
58 \newcommand{\capref}[1]{cap.~\ref{#1}}
59 \newcommand{\secref}[1]{sez.~\ref{#1}}
60 %
61 % Macro to create a special environment for function prototypes
62 %
63 \newenvironment{prototype}[2]{
64   \center
65    \footnotesize
66   \begin{minipage}[c]{14cm}
67     \par \texttt{\#include <#1>}
68 %    \par \ 
69     \par \texttt{#2}
70 %   \begin{lstlisting}{}
71 % #1
72 % #2
73 %   \end{lstlisting}
74   \begin{list}{}{} 
75     \item }
76 { \end{list} 
77   \par 
78 \par \texttt{ }
79 \end{minipage} 
80 \normalsize 
81 \par
82 }
83 \newenvironment{errlist}{\begin{description}}{\end{description}}