Correzioni per far andare pdflatex
[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   \par
70   \center
71   \footnotesize
72   \begin{minipage}[c]{14cm}
73     \par \texttt{\#include <#1>}
74 %    \par \ 
75     \par \texttt{#2}
76 %   \begin{lstlisting}{}
77 % #1
78 % #2
79 %   \end{lstlisting}
80   \begin{list}{}{} 
81     \item 
82 }
83 {% defining what is done by \end
84   \end{list} 
85   \par 
86 \par \texttt{ }
87 \end{minipage} 
88 \normalsize 
89 \par
90 }
91 \newenvironment{errlist}{\begin{description*}}{\end{description*}}
92
93 %
94 % Slighty different envirnoment to be used for multi-header, 
95 % multi-functions boxed description
96 %
97 \newcommand{\headdecl}[1]{\item\texttt{\#include <#1>}}
98 \newcommand{\funcdecl}[1]{\item\texttt{#1}\par}
99 \newenvironment{functions}
100 {% defining what is done by \begin
101   \par
102   \footnotesize
103   \center
104     \begin{minipage}[c]{14cm}
105     \begin{description*}{}{} 
106 }
107 {% defining what is done by \end
108       \end{description*}
109       \par 
110     \end{minipage}
111     \vspace{6pt}
112     \par
113     \normalsize 
114 %\break
115 }
116 %
117 % Wrapper for shell command, functions, filenames, links,
118 % variables, macros,  and everything can be useul, 
119 %
120 \newcommand{\cmd}[1]{\texttt{#1}}     % shell command
121 \newcommand{\func}[1]{\texttt{#1}}    % library function (or system call)
122 \newcommand{\macro}[1]{\texttt{#1}}   % macro constant
123 \newcommand{\var}[1]{\texttt{#1}}     % variable 
124 \newcommand{\file}[1]{\texttt{#1}}    % file name
125 \newcommand{\link}[1]{\texttt{#1}}    % html link
126 \newcommand{\type}[1]{\texttt{#1}}    % variable type
127 \newcommand{\param}[1]{\texttt{#1}}   % function parameter
128 \newcommand{\acr}[1]{\textsl{#1}}     % acrostic (for pid, suid, etc.)
129
130
131 % per usare latex2html scommentare questi e non includere mdwlist
132 %\newenvironment{description*}{\begin{description}}{\end{description}}
133 %\newenvironment{itemize*}{\begin{itemize}}{\end{itemize}}
134 %\newenvironment{enumerate*}{\begin{enumerate}}{\end{enumerate}}