% hevea macros for swp usage TEXT TRANSLATION
% call hevea with
% hevea swp.hva -text -e tcilatex.tex myfile.tex
% or the general cover function text myfile.tex



% the \FRAME macro
\@primitives{sword}
\def\swEXT{.gif}  %graphics extension
\def\swFRAME#1{\@print{ [Graphic: }#1\swEXT\@print{ here] }}

% \includegraphics is mapped to \FRAME
\newcommand{\includegraphics}[2][xxx]{\FRAME{1}{2}{3}{4}{5}{6}{7}{'#2'}}


%
% GENERALIZED BINOMIALS
% =====================
% \QOVERD is actually a generalized fraction in large deliminters
% \QATOPD is the generalized binomial with large delimiters
% for text translation we print GFRAC (args) or GBINOM (args)
% where  args  includes the delimiters
\def\QOVERD#1#2#3#4{\@print{ GFRAC}#1 #2 #3 #4\@print{ }}
\def\QATOPD#1#2#3#4{\@print{ GBINOM}#1 #2 #3 #4\@print{ }}
\def\binom#1#2{\QATOPD ( ) #1 #2}

% some non-handled macros - you may want to change these
\def\negthinspace{}
\def\hfill{}
\def\hrulefill{}
\def\dotfill{}
\def\strut{}
\def\mathstrut{}
\def\allowbreak{}



%  these are from tcilatex.tex
\newcommand{\CustomNote}[3][]{\marginpar{#3}}
\def\TCIIcon#1#2#3#4{\relax}
\def\qExtProgCall#1#2#3#4#5#6{\relax}


% as of hevea 1.04 we understand the csname construction
\def\QTR#1#2{\csname#1 \endcsname #2}

\def\QTP#1#2{\csname#1 \endcsname #2}


\let\RequirePackage\usepackage
\newcommand{\url}[1]{\texttt{#1}}

% this may not be the best solution
\renewcommand\newline{

}

\def\vert{|}

% this is a matter of taste
\def\thinspace{ }

\def\prime{\@print{'}}


\def\TEXTsymbol#1{\mbox{$#1$}}%
\def\text#1{\textrm{#1}}

\renewcommand\evensidemargin{}
\renewcommand\oddsidemargin{}
\def\textwidth{}


% the unit construct - just print the argument
\def\unit#1{#1}

% contructs mapped to footnotes
\let\marginpar\footnote

% dotless j to regular versions (dotless i is already provided)
\def\j{j}


% TCI's hyperref
% note that just print out the link itself.
\def\msihyperref#1#2#3#4{\@print{#4}}
\AtBeginDocument{\@ifundefined{hyperref}{\let\hyperref=\msihyperref}{}}

% two comment environments
\newenvironment{comment}{\begin{latexonly}}{\end{latexonly}}
\newenvironment{Comment}{\begin{latexonly}}{\end{latexonly}}


% blackboard bold : make it a function with argument
\def\Bbb#1{Bbb[#1]}
\def\Bbbk{Bbb[k]}

%TeXSymbol from SWP2.0
\def\TeXSymbol#1#2{#2}


% UNICODE SUPPORT
% ========================================
%
% \UNICODE is internal to Hevea
% the \U macro adds "0x" as a prefix, and calls \UNICODE
\def\U#1{\UNICODE{0x#1}}

% \swUNICODE gives you (1) the unicode number in hex and (2) in decimal
% note that you need to format either appropriately. See below where
% we use only the decimal version since most browsers don't suppport hex
% text - we print out UNICODE[nnn]
\newcommand{\swUNICODE}[2]{\@print{UNICODE\[#2\]}}

% SWP 40
% =================
%
% SWP40 seems to introduce macros for these constructs rather than handling them 
% as extended keyboard sequences
\newcommand\textquotedblleft{\@print{``}}
\newcommand\textquotedblright{\@print{''}}
\newcommand\textemdash{\@print{---}}