bff8918bc46fec18118ca05b62bb24aaa24db7f1
[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 %
66 \newenvironment{prototype}[2]{
67   \center
68    \footnotesize
69   \begin{minipage}[c]{14cm}
70     \par \texttt{\#include <#1>}
71 %    \par \ 
72     \par \texttt{#2}
73 %   \begin{lstlisting}{}
74 % #1
75 % #2
76 %   \end{lstlisting}
77   \begin{list}{}{} 
78     \item }
79 { \end{list} 
80   \par 
81 \par \texttt{ }
82 \end{minipage} 
83 \normalsize 
84 \par
85 }
86 \newenvironment{errlist}{\begin{description}}{\end{description}}