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