% LaTeX style file
% Name:   texhelp.sty
% Author: Julian Smart
%
% Purpose
% -------
% Style file to enable the simultaneous preparation of printed LaTeX and on-line
% hypertext manuals.
% Use in conjunction with Tex2RTF (see Tex2RTF documentation).
%
% Note that if a non-ASCII character starts a newline and there should be a space
% between the last word on the previous line and the first word on this line,
% you need to use \rtfsp to generate a space in Windows Help. \rtfsp is ignored
% in all other formats.
%
% Julian Smart
% Artificial Intelligence Applications Institute
%
%
% ============== C++/CLIPS Documentation Facilities ==============
%
% Each class definition should be typeset with e.g.
%
% \section{\class{Name}: Parent}
%
% followed by a description of the class.
% Each member should follow:
%
% \membersection{wxName::Member}
%
% with a description of what this member does.
% Then, one (or more if overloaded) member (function) in detail:
%
% \func{return type}{name}{args}
% or
% \member{type}{name}
%
% where args is a list of \param{type}{name}, ...

% Function, e.g.
% e.g. to typeset
%
% void DoIt(char *string);
%
% write:
%
% \func{void}{DoIt}{\param{char *}{string}}
%

\newcommand{\func}[3]{\hangafter=1\noindent\hangindent=10mm
{{\it #1} {\bf #2}\index{#2}}(#3)}

% For function/type definition where the name is a pointer,
% e.g. to typeset
%
% typedef void (*wxFunction)(wxObject&)
%
% write:
%
% \pfunc{typedef void}{wxFunction}{param{wxObject&}}

\newcommand{\pfunc}[3]{\hangafter=1\noindent\hangindent=10mm
{{\it #1} ({\bf *#2})\index{#2}}(#3)}

% Use an ordinary \section command for class name definitions.

% This is used for a member, such as wxBitmap: GetDepth
\newcommand{\membersection}[1]{\subsection*{#1}\index{#1}}

% CLIPS function
\newcommand{\clipsfunc}[3]{\hangafter=1\noindent\hangindent=10mm
{{\bf #1} ({\bf #2}\index{#2}}#3)}

\newcommand{\clipssection}[1]{\chapter{#1}}

% This is used for a CLIPS function name
\newcommand{\functionsection}[1]{\subsection*{#1}}

% Member: a type and a name
\newcommand{\member}[2]{{\bf #1 \it #2}}

% C++ Parameter: a type and a name (no intervening space)
\newcommand{\param}[2]{{\it #1}{\bf #2}}

% CLIPS Parameter: a type and a name (one intervening space)
\newcommand{\cparam}[2]{{\bf #1} {\it #2}}

% Class: puts in index
\newcommand{\class}[1]{#1\index{#1}}

%\newcommand{\docparam}[2]{\parskip=0pt {\it #1}\par\parskip=10pt\begin{indented}{1cm}{#2}\end{indented}}

% Void type
\newcommand{\void}{{\it void}}

% Typeset destructor
\newcommand{\destruct}[1]{{$\sim$}#1}

% Typeset insert/extract operators
\newcommand{\cinsert}{$<<$}
\newcommand{\cextract}{$>>$}

% pythonnote: A note about the wxpython interface.
%\newcommand{\pythonnote}[1]{{\bf wxPython note: }#1}
\newcommand{\pythonnote}[1]{{}}
\newcommand{\perlnote}[1]{{}}

% =================== Hypertext facilities ===================
%
% To insert hyperlinks (or references, in Latex), \label the sections
% or membersections \label{ref-label} immediately after the section, on the same line,
% and use \helpref{text-to-show}{ref-label} to make a reference.
%

% Type text with section reference
\newcommand{\helpref}[2]{{\it #1} (p.\ \pageref{#2}) }

% Type text with URL in verbatim mode
% \newcommand{\urlref}[2]{#1 (\verb$#2$)}
\newcommand{\urlref}[2]{\href{#1}{#2}}

% Don't typeset section number in LaTeX
\newcommand{\helprefn}[2]{{\it #1}}

% Like helpref, but popup text in WinHelp instead of hyperlinked
\newcommand{\popref}[2]{{\it #1}}

% Like footnote, but popup text.
\newcommand{\footnotepopup}[2]{{\it #1}\footnote{#2}}

% =================== On-line help specific macros ===================
%

% Global document font size/family, help only.
\newcommand{\helpfontsize}[1]{}
\newcommand{\helpfontfamily}[1]{}

% Ignore in all on-line help
\newcommand{\helpignore}[1]{#1}
% Only print in all on-line help
\newcommand{\helponly}[1]{}

% Ignore in LaTeX
\newcommand{\latexignore}[1]{}
% Only print in LaTeX
\newcommand{\latexonly}[1]{#1}

% Ignore in linear RTF
\newcommand{\rtfignore}[1]{#1}
% Only print in linear RTF
\newcommand{\rtfonly}[1]{}

% Ignore in WinHelp RTF
\newcommand{\winhelpignore}[1]{#1}
% Only print in WinHelp RTF
\newcommand{\winhelponly}[1]{}

% Ignore in wxHelp
\newcommand{\xlpignore}[1]{#1}
% Only print in wxHelp
\newcommand{\xlponly}[1]{}

% Ignore in HTML
\newcommand{\htmlignore}[1]{#1}
% Only print in HTML
\newcommand{\htmlonly}[1]{}

% Input a file only for help system (binder thickness is not a limitation
% in help systems!)
\newcommand{\helpinput}[1]{}

\newcommand{\rtfsp}{ } % Force a space in RTF, ignore in Latex

% =================== Miscellaneous macros ===================
%
% Headings consistent with generated ones
\newcommand{\myheading}[1]{\vspace*{25pt}
\begin{flushleft}
{\LARGE \bf #1}
\end{flushleft}
\vskip 20pt
}

% Heading with entry in contents page.
\newcommand{\chapterheading}[1]{\myheading{#1}
\addcontentsline{toc}{chapter}{#1}}

\newcommand{\sectionheading}[1]{\myheading{#1}
\addcontentsline{toc}{section}{#1}}

% Glossary environment
\newenvironment{helpglossary}{\newpage\chapterheading{Glossary}\begin{description}}{\end{description}}

% Glossary entry
\newcommand{\gloss}[1]{\item[#1]\index{#1}}

% Image: EPS in Latex, BMP or MF (whatever's available) in RTF. Requires psbox.
\newcommand{\image}[2]{\psboxto(#1){#2}}

% Image, left aligned (HTML)
\newcommand{\imager}[2]{\psboxto(#1){#2}}

% Image, right aligned (HTML)
\newcommand{\imagel}[2]{\psboxto(#1){#2}}

% Imagemap: principally for HTML only. In Latex,
% acts like \image.
\newcommand{\imagemap}[3]{\psboxto(#1){#2}}

% Headers and footers
% \setheader{EvenPageLeft}{EvenPageCentre}{EvenPageRight}
% {OddPageLeft}{OddPageCentre}{OddPageRight}
\newcommand{\setheader}[6]{
\lhead[\fancyplain{}{#1}]{\fancyplain{}{#4}}
\chead[\fancyplain{}{#2}]{\fancyplain{}{#5}}
\rhead[\fancyplain{}{#3}]{\fancyplain{}{#6}}
}

% \setfooter{EvenPageLeft}{EvenPageCentre}{EvenPageRight}
% {OddPageLeft}{OddPageCentre}{OddPageRight}
\newcommand{\setfooter}[6]{
\lfoot[\fancyplain{#1}{#1}]{\fancyplain{#4}{#4}}
\cfoot[\fancyplain{#2}{#2}]{\fancyplain{#5}{#5}}
\rfoot[\fancyplain{#3}{#3}]{\fancyplain{#6}{#6}}
}

% Needed for telling RTF where margin paragraph should go
% in mirrored margins mode.
\newcommand{\marginpareven}[1]{\hspace*{0pt}\marginpar{#1}}
\newcommand{\marginparodd}[1]{\hspace*{0pt}\marginpar{#1}}

% Environment for two-column table popular in WinHelp and manuals.
\newcommand{\twocolwidtha}[1]{\def\twocolwidthaval{#1}}
\newcommand{\twocolwidthb}[1]{\def\twocolwidthbval{#1}}
\newcommand{\twocolspacing}[1]{\def\twocolspacingval{#1}}

\twocolwidtha{3cm}
\twocolwidthb{8.5cm}
\twocolspacing{2}

\newcommand{\twocolitem}[2]{#1 & #2\\}
\newcommand{\twocolitemruled}[2]{#1 & #2\\\hline}

\newenvironment{twocollist}{\renewcommand{\arraystretch}{\twocolspacingval}\begin{tabular}{lp{\twocolwidthbval}}}%
{\end{tabular}\renewcommand{\arraystretch}{1}}

% Specifying table rows for RTF compatibility
\newcommand{\row}[1]{#1\\}

% Use for the last ruled row for correct RTF generation.
\newcommand{\ruledrow}[1]{#1\\\hline}

% Indentation environment. Arg1 is left margin size
\newenvironment{indented}[1]{\begin{list}{}{\leftmargin=#1}\item[]}%
{\end{list}}

% Framed box of text, normal formatting.
\newcommand{\normalbox}[1]{\fbox{\vbox{#1}}}
% Double-framed box of text.
\newcommand{\normalboxd}[1]{\fbox{\fbox{\vbox{#1}}}}

% WITHDRAWN -- can't do in RTF, easily.
% Framed box of text, horizontally centred. Ragged right within box.
% \newcommand{\centeredbox}[2]{\begin{center}\fbox{\parbox{#1}{\raggedright#2}}\end{center}}
% Double-framed box of text, horizontally centred. Ragged right within box.
% \newcommand{\centeredboxd}[2]{\begin{center}\fbox{\fbox{\parbox{#1}{\raggedright#2}}}\end{center}}

% toocomplex environment: simply prints the argument in LaTeX,
% comes out verbatim in all generated formats.
\newenvironment{toocomplex}{}{}

% Colour: dummy commands since LaTeX doesn't support colour.
% \definecolour{name}{red}{blue}{green}
% \fcol{name}{text} ; Foreground
% \bcol{name}{text} ; Background
% \newcommand{\definecolour}[4]{}
% \newcommand{\definecolor}[4]{}
% Trickery needed to change from 0--255 to 0--1 ...

\def\scalecolornum#1{%
  \ifcase#1 0\or
  0.004\or 0.008\or 0.012\or 0.016\or 0.020\or
  0.024\or 0.028\or 0.032\or 0.036\or 0.040\or
  0.044\or 0.048\or 0.052\or 0.056\or 0.060\or
  0.064\or 0.068\or 0.072\or 0.076\or 0.080\or
  0.084\or 0.088\or 0.092\or 0.096\or 0.100\or
  0.104\or 0.108\or 0.112\or 0.116\or 0.120\or
  0.124\or 0.128\or 0.132\or 0.136\or 0.140\or
  0.144\or 0.148\or 0.152\or 0.156\or 0.160\or
  0.164\or 0.168\or 0.172\or 0.176\or 0.180\or
  0.184\or 0.188\or 0.192\or 0.196\or 0.200\or
  0.204\or 0.208\or 0.212\or 0.216\or 0.220\or
  0.224\or 0.228\or 0.232\or 0.236\or 0.240\or
  0.244\or 0.248\or 0.252\or 0.256\or 0.260\or
  0.264\or 0.268\or 0.272\or 0.276\or 0.280\or
  0.284\or 0.288\or 0.292\or 0.296\or 0.300\or
  0.304\or 0.308\or 0.312\or 0.316\or 0.320\or
  0.324\or 0.328\or 0.332\or 0.336\or 0.340\or
  0.344\or 0.348\or 0.352\or 0.356\or 0.360\or
  0.364\or 0.368\or 0.372\or 0.376\or 0.380\or
  0.384\or 0.388\or 0.392\or 0.396\or 0.400\or
  0.404\or 0.408\or 0.412\or 0.416\or 0.420\or
  0.424\or 0.428\or 0.432\or 0.436\or 0.440\or
  0.444\or 0.448\or 0.452\or 0.456\or 0.460\or
  0.464\or 0.468\or 0.472\or 0.476\or 0.480\or
  0.484\or 0.488\or 0.492\or 0.496\or 0.500\or
  0.504\or 0.508\or 0.512\or 0.516\or 0.520\or
  0.524\or 0.528\or 0.532\or 0.536\or 0.540\or
  0.544\or 0.548\or 0.552\or 0.556\or 0.560\or
  0.564\or 0.568\or 0.572\or 0.576\or 0.580\or
  0.584\or 0.588\or 0.592\or 0.596\or 0.600\or
  0.604\or 0.608\or 0.612\or 0.616\or 0.620\or
  0.624\or 0.628\or 0.632\or 0.636\or 0.640\or
  0.644\or 0.648\or 0.652\or 0.656\or 0.660\or
  0.664\or 0.668\or 0.672\or 0.676\or 0.680\or
  0.684\or 0.688\or 0.692\or 0.696\or 0.700\or
  0.704\or 0.708\or 0.712\or 0.716\or 0.720\or
  0.724\or 0.728\or 0.732\or 0.736\or 0.740\or
  0.744\or 0.748\or 0.752\or 0.756\or 0.760\or
  0.764\or 0.768\or 0.772\or 0.776\or 0.780\or
  0.784\or 0.788\or 0.792\or 0.796\or 0.800\or
  0.804\or 0.808\or 0.812\or 0.816\or 0.820\or
  0.824\or 0.828\or 0.832\or 0.836\or 0.840\or
  0.844\or 0.848\or 0.852\or 0.856\or 0.860\or
  0.864\or 0.868\or 0.872\or 0.876\or 0.880\or
  0.884\or 0.888\or 0.892\or 0.896\or 0.900\or
  0.904\or 0.908\or 0.912\or 0.916\or 0.920\or
  0.924\or 0.928\or 0.932\or 0.936\or 0.940\or
  0.944\or 0.948\or 0.952\or 0.956\or 0.960\or
  0.964\or 0.968\or 0.972\or 0.976\or 0.980\or
  0.984\or 0.988\or 0.992\or 0.996\or 1\else\fi
}

\let\originaldefinecolor\definecolor
\def\definecolor#1#2#3#4{%
  \originaldefinecolor{#1}{rgb}{%
    \scalecolornum{#2},%
    \scalecolornum{#3},%
    \scalecolornum{#4}}}
\let\definecolour\definecolor

% \newcommand{\fcol}[2]{#2}
\let\fcol\textcolor

% \newcommand{\bcol}[2]{#2}
\let\bcol\colorbox

\newcommand{\sethotspotcolour}[1]{}
\newcommand{\sethotspotunderline}[1]{}
\newcommand{\settransparency}[1]{}
\newcommand{\backslashraw}[0]{}
\newcommand{\lbraceraw}[0]{}
\newcommand{\rbraceraw}[0]{}
\newcommand{\registered}[0]{(r)}
\newcommand{\background}[1]{}
% \newcommand{\textcolour}[1]{}
\let\textcolour\color

\newcommand{\overview}[2]{See \helpref{#1}{#2}.}
\newcommand{\docparam}[2]{{\it #1}\begin{list}{}{\leftmargin=1cm}\item[]
#2%
\end{list}}
\newcommand{\wxheading}[1]{{\bf #1}}
\newcommand{\const}[0]{{\bf const}}
\newcommand{\constfunc}[3]{{\bf #1} {\bf #2}(#3) {\bf const}\index{#2}}
\newcommand{\windowstyle}[1]{{\bf #1}\index{#1}}

\addtolength{\textwidth}{1in}
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\topmargin}{-0.5in}
\addtolength{\textheight}{1in}
\sloppy

