Usate le nuove macro per le referenze, e trovato un formato sensato per
[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}[1]{
64   \center
65   \begin{minipage}[c]{14cm}
66   \par \texttt{#1}
67    \footnotesize
68   \begin{list}{}{} 
69     \item }
70 { \end{list} 
71   \par 
72 \normalsize 
73 \par \texttt{ }
74 \end{minipage} 
75 \par
76 }
77 \newenvironment{errlist}{\begin{description}}{\end{description}}
78
79