%%%% Une précaution.
\ifhtml\else\warning{html/hevea is for html mode !!!}\endinput\fi
%%%% package used by all packages
\input{plain.hva}
\newif\ififthen\ifthenfalse
\input{ifthen.hva}
%%%%%%%%%%%%%%%%%%%%%%%
%%Style-sheet support %
%%%%%%%%%%%%%%%%%%%%%%%
%% External/internal style declarations are accumulated into approriate
%% token registers
% Linking to external style sheets
\newtokens{\css@link}%
\newcommand{\addcssfile}[1]{\addtokens{\css@link}{#1}}%
\newcommand{\loadcssfile}[1]{\addcssfile{\@print{<}\@getprint{LINK REL=STYLESHEET type=\char34 text/css\char34\@print{ }HREF=\char34#1\char34\char62\@print{
}}}}%
%%%%%%
% Styles definition in the <HEAD> element
\newtokens{\hevea@css}%
\newcommand{\addstyle}[1]{\addtokens{\hevea@css}{#1}}%
\newcommand{\newstyle}[2]{\addstyle{\@getprint{#1\char123#2\char125\@print{
}}}}%
%
%%Style attributes are normaly set through an indirection.
%% Ie the class of the BLOCK elt that translates environment 'env' is
%%    \'env'@class
\newcommand{\class@attr}[2]{\ife#1\else\@getprint{CLASS="#1"#2}\fi}
\newcommand{\setenvclass}[2]{\def\csname{}#1@class\endcsname{#2}}
\newcommand{\getenvclass}[1]{\csname{}#1@class\endcsname}
\newcommand{\envclass@attr}[2][]{\class@attr{\getenvclass{#2}}{#1}}
%% Packages
\input{packages.hva}
%%%%%% Spacing
\input{spaces.hva}
%%% \... symbols renderered with iso-latin1
\input{iso-symb.hva}
\renewcommand{\&}{\ifraw\@print{&}\else\@print{&amp;}\fi}
\input{latexcommon.hva}
%%%% A few strange entities
\ifentities
\newcommand{\glqq}{\@print{&#8222;}}
\newcommand{\grqq}{\@print{&#8220;}}
\newcommand{\glq}{\@print{&#8218;}}
\newcommand{\grq}{\@print{&#8216;}}
\newcommand{\flqq}{\@print{&#0171;}}
\newcommand{\frqq}{\@print{&#0187;}}
\newcommand{\flq}{\@print{&#8249;}}
\newcommand{\frq}{\@print{&#8250;}}
\fi
%%% Logos
\def\TeX{\@print{T<sub>E</sub>X}}
\def\LaTeX{\@print{L<sup>A</sup>T<sub>E</sub>X}}
\def\LaTeXe{\mbox{\@print{L<sup>A</sup>T<sub>E</sub>X}~$2\epsilon$}}
\newcommand{\hevea}{\@print{H}{\@incsize{-1}\@print{<sup>E</sup>}}\@print{V}%
{\@incsize{-1}\@print{<sup>E</sup>}}\@print{A}}
\newcommand{\hacha}{\@print{H}{\@incsize{-1}\@print{<sup>A</sup>}}\@print{C}%
{\@incsize{-1}\@print{<sup>H</sup>}}\@print{A}}
\newcommand{\html}{HTML}
%%% HTML related stuff (TEX equivalents are in the hevea.sty file)
\newcommand{\@doaelement}[2]
{{\@nostyle\@print{<A }\@getprint{#1}\@print{>}}{#2}{\@nostyle\@print{</A>}}}
\newcommand{\@nestedaelement}[2]{\warning{Suppressing nested A element}#2}
\newcommand{\@aelement}[2]
{\bgroup\let\@aelement\@nestedaelement\@doaelement{#1}{#2}\egroup}
\newcommand{\ahref}[2]{\@aelement{HREF="#1"}{#2}}
\def\ahrefurl#1{\@aelement{HREF="#1"}{\texttt{#1}}}
\let\footahref\ahref
\newcommand{\mailto}[1]{\@aelement{HREF="mailto:#1"}{#1}}
\newcommand{\imgsrc}[2][]
{\@print{<IMG SRC="}\@getprint{#2}\ifpedantic\@print{" ALT="}\@getprint{#2}\fi
\ifthenelse{\equal{#1}{}}{\@print{"}}{\@print{" }\@getprint{#1}}\@print{>}}
%% Hyper-text references inside the document, internal usage
\newcommand{\@locref}[2]{\@aelement{HREF="\@print{#}#1"}{#2}}
\newcommand{\@locname}[2]{\@aelement{NAME="#1"}{#2}}
\newcommand{\@locnameref}[3]{\@aelement{NAME="#1" HREF="\@print{#}#2"}{#3}}
%% Two exported commands
\let\ahrefloc\@locref
\let\aname\@locname
\newcommand{\anchor}[1]{\@locname{#1}{}}
%% Html footer, header and prefix for titles
\newsavebox{\@htmlhead}
\newsavebox{\@htmlfoot}
\newsavebox{\@htmlprefix}
\newcommand{\htmlhead}[1]{\sbox{\@htmlhead}{#1}}
\newcommand{\htmlfoot}[1]{\sbox{\@htmlfoot}{#1}}
\newcommand{\htmlprefix}[1]{\sbox{\@htmlprefix}{#1}}
\AtEndDocument
{{\@nostyle\@print{<!--HTMLFOOT-->
}}%
\usebox{\@htmlfoot}%
{\@nostyle\@print{<!--ENDHTML-->
}}}
%%%%% Footnotes, html dependant part
\newcommand{\@noteref}[4]{\@locnameref{#2#3}{#1#3}{#4}}
\newcommand{\@notetextstyle}[1]
  {{\@nostyle\@print{<SUP>}}#1{{\@nostyle\@print{</SUP>}}}}
\newcommand{\@notenotestyle}[1]
  {{\@clearstyle\Large{}#1}}
\newenvironment{thefootnotes}[1]
  {{\@nostyle\@print{<!--BEGIN NOTES }#1\@print{-->
}}\footnoterule\begin{list}[]{}{\renewcommand{\makelabel}[1]{##1}}}
  {\end{list}{\@nostyle\@print{
<!--END NOTES-->
}}}
%%% for HaChA
\newcounter{cuttingdepth}
\setcounter{cuttingdepth}{1}
\newcommand{\cutdef}[2][]{%
{\@nostyle\@print{<!--CUT DEF }#2\@print{ }#1\@print{ -->
}}}%
\newcommand{\cutend}{%
{\@nostyle\@print{<!--CUT END }\@print{-->
}}%
}
\newcommand{\@secend}{%
\@saveclosed{\@nostyle\@print{<!--SEC END }\@print{-->
}\@restoreclosed}%
}
\newcommand{\cuthere}[2]{%
\@footnoteflush{#1}%
{\@nostyle\@print{<!--TOC }\@getprint{#1}\@print{ }}%
\begin{@norefs}#2\end{@norefs}{\@nostyle\@print{-->
}}}
\newcommand{\@hacha@arg}[2]
  {{\@nostyle\@print{<ARG }\@getprint{#1}\@print{>}{#2}\@print{</ARG>}}}
\newenvironment{cutflow}[1]
  {\@printnostyle{<!--FLOW }%
  \@hacha@arg{TITLE}{#1}%
  \@printnostyle{-->
}}
{\@printnostyle{<!--END FLOW-->
}}
\newcommand{\cutname}[1]
  {{\@nostyle\@print{<!--NAME }\@getprint{#1}\@print{-->
}}}
\newcommand{\@link@arg}[2]
  {\ifthenelse{\equal{#2}{}}{}
  {\@hacha@arg{#1}{#2}}}
\newsavebox{\@toplinks}
\newcommand{\toplinks}[3]
  {\sbox{\@toplinks}
    {\@printnostyle{<!--LINKS }%
    \@link@arg{PREV}{#1}%
    \@link@arg{UP}{#2}%
    \@link@arg{NEXT}{#3}%
    \@printnostyle{-->
}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Using style CLASSES with DIV for local style-setting   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newenvironment{divstyle}[1]
  {\@open{DIV}{\class@attr{#1}{}}}{\@close{DIV}}%
\newenvironment{cellstyle}[2]
  {\@open{TABLE}{\class@attr{#1}{}}\@open{TR}{}\@open{TD}{\class@attr{#2}{}}}
  {\@close{TD}\@close{TR}\@close{TABLE}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Echoing to the image file %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\@iopt@def{!*!}
\newcommand{\@imageopt}[1][!*!]
{\def\@itmp{#1}\ifx\@itmp\@iopt@def\else\begin{toimage}[#1]\end{toimage}\fi}
\newcommand{\@imagearg}[1]{\begin{toimage}{#1}\end{toimage}}
\newcommand{\@imagecommand}[2]
  {\newcommand{#1}{\begin{toimage}#1\end{toimage}#2}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   \maketitle (is no longer redefined by fancysection)		%
%   Thus defining different styles explicitly will have to 	%
%     be done using the respective classes :			%
%     .title     : table containing the title and supplements   %
%     .titlemain : H1 containing title name		        %
%     .titlerest : H3 containing other fields (author,date,etc.)%
%   'checkbox' now takes three instead of two arguments,        %
%     one for the class.					%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newstyle{.title}{margin:auto;text-align:center}
\newcommand{\maketitle}{%
  \bgroup\newcommand{\checkbox}[4]%
    {\ifthenelse{\equal{\usebox{##3}}{}}%
      {\ifthenelse{\equal{##4}{}}{}{\warning{No ##4 given}}}%
      {\@open{##1}{\class@attr{##2}{}}\usebox{##3}\@close{##1}}%
    }%
  \@opencell{CLASS="title"}{}{}%
  \checkbox{H1}{titlemain}{\@@title}{title}%
  \checkbox{H3}{titlerest}{\@@author}{author}%
  \checkbox{H3}{titlerest}{\@@date}{}%
  \@closecell%
  \egroup%
\let\maketitle\relax\let\checkbox\relax}%
%
%%%%%%%%%
% Maths %
%%%%%%%%%
\ifmathml
\input{html/symb-mathml.hva}
\else
\ifentities\input{html/symb-ent.hva}\fi
\ifsymb\input{html/symb.hva}\fi
\ifsymbtext\input{html/symb-text.hva}\fi
\fi
%% Maths fonts
%%%%%%%%%%%
\def\textsqsubset{\mbox{sqsubset}}
%\def\sqsubset{%
%\ifdisplay\@itemdisplay\@sqsubset\@itemdisplay\else
%\textsqsubset\fi}
\def\textsqsupset{\mbox{sqsupset}}
%\def\sqsupset{%
%\ifdisplay\@itemdisplay\@sqsupset\@itemdisplay\else
%\textsqsupset\fi}
\def\textdoteq{=^{\cdot}}
%\def\doteq{%
%\ifdisplay\@itemdisplay\@print{<FONT SIZE=7>·</FONT><BR>}=\@itemdisplay\else
%\textdoteq\fi}
\input{mathop.hva}
%%%%%%%%%%%% Bibliography
\newcommand{\@bibref}[2]{\@locref{#1}{\ifx#2\@empty\@verbarg{#1}\else#2\fi}}
\newsavebox{\@bibbox}
\newcommand{\@biblabel}[1]{\@locname{#1}{\purple[\@bibread{#1}]}}
%%% Environment document.
\newcommand{\@charset}{ISO-8859-1}
\newcommand{\@bodyargs}{}
\newcommand{\@meta}
{\begin{rawhtml}
<META http-equiv="Content-Type" content="text/html; charset=\end{rawhtml}\@charset\begin{rawhtml}">
<META name="GENERATOR" content="hevea \end{rawhtml}\usebox{\@heveaversion}\@print{">
}%
% style declarations
\ife\css@link\else\css@link\@print{
}%
\fi
\ife\hevea@css\else\@print{<STYLE type="text/css">}
\hevea@css\@print{</STYLE>
}\fi\undef\hevea@css\undef\newstyle}
\newenvironment{document}{%
\@end{document}
\@restartoutput\unskip%
\@atbegindocument%
\@print{<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
}\@print{<HTML>
}
\@print{<HEAD>
}
\ifthenelse{\equal{\usebox{\@@title}}{}}{}
{\@print{<TITLE>}%
\@notags{\usebox{\@@title}}%
\@print{</TITLE>
}}\@meta%
\ifmathml\@print{<STYLE type="text/css">
  math.centered { text-align: center}
</STYLE>
}\fi
\@print{</HEAD>
}
\@print{<BODY }\@notags{\@bodyargs}\@print{>
}%
\@print{<!--HEVEA command line is: }\usebox{\@heveacomline}\@print{-->
}%
{\@nostyle\@print{<!--HTMLHEAD-->
}}%
\usebox{\@htmlhead}%
{\@nostyle\@print{<!--ENDHTML-->
}}%
\@printnostyle{<!--PREFIX }%
\@hacha@arg{}{\usebox{\@htmlprefix}}%
\@printnostyle{-->
}%
\usebox{\@toplinks}%
\cutdef[\thecuttingdepth]{\cuttingunit}%
\renewcommand{\addstyle}[1]{\warning{\addstyle{} must be used in document preamble}}
}{%
\@clearstyle\@footnoteflush{document}%
\@atenddocument%
\@final@footer%
\@clearstyle%
\@print{</BODY>
</HTML>
}\@raise@enddocument}
\newstyle{.center}{text-align:center;margin-left:auto;margin-right:auto;}%
\newstyle{.flushleft}{text-align:left;margin-left:0ex;margin-right:auto;}%
\newstyle{.flushright}{text-align:right;margin-left:auto;margin-right:0ex;}%
\newstyle{DIV TABLE}{margin-left:inherit;margin-right:inherit;}
\newstyle{PRE}{text-align:left;margin-left:0ex;margin-right:auto;}
\newstyle{BLOCKQUOTE}{margin-left:4ex;margin-right:4ex;text-align:left;}
\setenvclass{center}{center}%
\newenvironment{center}{\@open{DIV}{\envclass@attr{center}}}{\@close{DIV}}
\setenvclass{flushleft}{flushleft}
\newenvironment{flushleft}
  {\@open{DIV}{\envclass@attr{flushleft}}}
  {\@close{DIV}}
\setenvclass{flushright}{flushright}%
\newenvironment{flushright}
  {\@open{DIV}{\envclass@attr{flushright}}}
  {\@close{DIV}}%
\newcommand{\centerline}[1]{\begin{center}#1\end{center}}
\setenvclass{quote}{quote}%
\newenvironment{quote}
{\@close{}\@open{BLOCKQUOTE}{\envclass@attr{quote}}}
{\@close{BLOCKQUOTE}\@open{}{}}%
\setenvclass{quotation}{quotation}%
\newenvironment{quotation}
{\@open{BLOCKQUOTE}{\envclass@attr{quotation}}}{\@close{BLOCKQUOTE}}
\newcommand{\centering}{\@insert{DIV}{\envclass@attr{center}}}
\newcommand{\raggedleft}{\@insert{DIV}{\envclass@attr{flushright}}}
\newcommand{\raggedright}{\@insert{DIV}{\envclass@attr{flushleft}}}
\newcommand{\rule}[3][]{\@printHR{}{}}%
%%%%%%%%%%%%%%%% LaTeX 2.09 style declarations
\newenvironment{tt}{\@style{TT}}{}
\newenvironment{bf}{\@style{B}}{}
\newenvironment{em}{\@style{EM}}{}
\newenvironment{it}{\@style{I}}{}
\newenvironment{rm}{\@anti{\sf,\tt}}{}
\newenvironment{tiny}{\@fontsize{1}}{}
\newenvironment{footnotesize}{\@fontsize{2}}{}
\newenvironment{scriptsize}{\@fontsize{2}}{}
\newenvironment{small}{\@fontsize{3}}{}
\newenvironment{normalsize}{\@fontsize{3}}{}
\newenvironment{large}{\@fontsize{4}}{}
\newenvironment{Large}{\@fontsize{5}}{}
\newenvironment{LARGE}{\@fontsize{5}}{}
\newenvironment{huge}{\@fontsize{6}}{}
\newenvironment{Huge}{\@fontsize{7}}{}
%%%%%% Colors
\newenvironment{purple}{\@fontcolor{purple}}{}
\newenvironment{black}{\@fontcolor{black}}{}
\newenvironment{silver}{\@fontcolor{silver}}{}
\newenvironment{gray}{\@fontcolor{gray}}{}
\newenvironment{white}{\@fontcolor{white}}{}
\newenvironment{maroon}{\@fontcolor{maroon}}{}
\newenvironment{red}{\@fontcolor{red}}{}
\newenvironment{fuchsia}{\@fontcolor{fuchsia}}{}
\newenvironment{green}{\@fontcolor{green}}{}
\newenvironment{lime}{\@fontcolor{lime}}{}
\newenvironment{olive}{\@fontcolor{olive}}{}
\newenvironment{yellow}{\@fontcolor{yellow}}{}
\newenvironment{navy}{\@fontcolor{navy}}{}
\newenvironment{blue}{\@fontcolor{blue}}{}
\newenvironment{teal}{\@fontcolor{teal}}{}
\newenvironment{aqua}{\@fontcolor{aqua}}{}
\def\cal{\ifmath\ifmathml\@style{font-family: cursive }%
\else\red\fi\else\red\fi}
\def\sf{\ifmath\ifmathml\@style{font-family: sans-serif }%
\else\purple\fi\else\purple\fi}
%\def\sc{\ifmath\ifmathml\@style{font-family: monospace }%
%\else\navy\fi\else\navy\fi}
\def\sl{\ifmath\ifmathml\@style{font-family: fantasy; font-style: italic }%
\else\it\maroon\fi\else\it\maroon\fi}
%%%% LaTeX2e verbose declarations
\newenvironment{mdseries}{\@anti{\bf}}{}
\newenvironment{bfseries}{\bf}{}
\newenvironment{rmfamily}{\rm}{}
\newenvironment{sffamily}{\@anti{\tt}\sf}{}
\newenvironment{ttfamily}{\@anti{\sf}\tt}{}
\newenvironment{upshape}{\@anti{\it,\sl,\sc}}{}
\newenvironment{itshape}{\@anti{\sl,\sc}\it}{}
\newenvironment{slshape}{\@anti{\it,\sc}\sl}{}
\newenvironment{scshape}{\@anti{\it,\sl}\sc}{}
\newenvironment{normalfont}{\rm\mdseries\upshape}{}
%%%%%%%%%%%%%%%%
\def\textrm#1{\mbox{\rmfamily#1}}
\def\textup#1{\mbox{\upshape#1}}
\def\textmd#1{\mbox{\mdseries#1}}
\def\textnormal#1{\mbox{\normalfont#1}}
\def\texttt#1{\mbox{\ttfamily#1}}
\def\textit#1{\mbox{\itshape#1}}
\def\textbf#1{\mbox{\bfseries#1}}
\def\textsf#1{\mbox{\sffamily#1}}
\def\textsl#1{\mbox{\slshape#1}}
\def\textsc#1{\mbox{\scshape#1}}
\newcommand{\emph}[1]{\mbox{\em#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  New implementation of \sc & \textsc using "small-caps" style. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\sc{\@styleattr{SPAN}{STYLE="font-variant:small-caps"}}%
%
%%%%%%%%%%%%%%% Multicolumns index formating
\newcommand{\setindexpos}[2]
{\providesavebox{\csname indexpos#1\endcsname}%
\sbox{\csname indexpos#1\endcsname}{\@nostyle #2}}
\newcommand{\getindexpos}[1]{\usebox{\csname indexpos#1\endcsname}}
\newcounter{indexcols}\setcounter{indexcols}{2}
\newcounter{indexcount}\newcounter{indexdepth}
\newcounter{indexbox}
\newcommand{\indexitem}
{\stepcounter{indexcount}%
\end{lrbox}%
\setindexpos{\theindexbox}{\theindexcount}%
\stepcounter{indexbox}%
\providesavebox{\csname indexbox\theindexbox\endcsname}%
\begin{lrbox}{\csname indexbox\theindexbox\endcsname}}
\newcommand{\indexspace}{\indexitem}
{\stepcounter{indexcount}}
\newenvironment{indexenv}
{\stepcounter{indexdepth}
\ifthenelse{\value{indexdepth}>1}
{\begin{itemize}%
\renewcommand{\indexitem}{\stepcounter{indexcount}\item}%
\renewcommand{\indexspace}{\stepcounter{indexcount}\vspace*{2ex}}}
{\setcounter{indexbox}{0}\setcounter{indexcount}{0}%
\providesavebox{\csname indexbox0\endcsname}%
\begin{lrbox}{\csname indexbox0\endcsname}}}
{\ifthenelse{\value{indexdepth}>1}
{\end{itemize}\addtocounter{indexdepth}{-1}}
{\end{lrbox}%
\setindexpos{\theindexbox}{\theindexcount}%
\stepcounter{indexbox}%
\addtocounter{indexdepth}{-1}\printindexboxes}}
\newcounter{indexwork}\newcounter{indexlimit}
\newcounter{indexlines}
\newboolean{spaceallowed}
\newcounter{indexclines}\newcounter{indexprev}\newcounter{indexnow}%
\newcommand{\printindexboxes}
{\setcounter{indexwork}{1}%
\setcounter{indexlimit}{(\value{indexcount}+\value{indexcols}-1)/\value{indexcols}}
\setcounter{indexclines}{0}%
\setcounter{indexprev}{0}%
\setcounter{indexnow}{0}%
\begin{tabular}{*{\value{indexcols}}{X}}
\begin{itemize}
\whiledo{\value{indexwork}<\value{indexbox}}
{\setcounter{indexnow}{\pushint{\getindexpos{\theindexwork}}}%
\addtocounter{indexclines}{\value{indexnow}-\value{indexprev}}%
\ifthenelse{\equal{\usebox{\csname indexbox\theindexwork\endcsname}}{}}
{\ifthenelse{\boolean{spaceallowed}}{\vspace*{2ex}}{}}
{\item}%
\setboolean{spaceallowed}{true}%
\usebox{\csname indexbox\theindexwork\endcsname}%
\ifthenelse{\value{indexclines}>\value{indexlimit}}
{\end{itemize}&\begin{itemize}\setboolean{spaceallowed}{false}%
\setcounter{indexclines}{0}}{}%
\stepcounter{indexwork}\setcounter{indexprev}{\value{indexnow}}}%
\end{itemize}\end{tabular}}
%%%%%% Default TABLE attribute for array and tabular
\newcommand{\@table@attributes}{CELLSPACING=2 CELLPADDING=0}
\newcommand{\@table@attributes@border}{CELLSPACING=0 CELLPADDING=1}
%%%%
\newcommand{\@opencell}[3]{\@open{TABLE}{#1}\@open{TR}{#2}\@open{TD}{#3}}
\newcommand{\@closecell}{\@force{TD}\@close{TR}\@close{TABLE}}
%%%%%% Do not load hevea.hva again !
\def\csname hevea@loaded\endcsname{}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   Redefining \textoverline of latexcommon.hva			%
%   Here we can use HTML primitives				%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand{\overlinedbox}[1]%
     {{\@styleattr{SPAN}{style="text-decoration:overline"}#1}}% 
\renewcommand{\textoverline}[1]{\overlinedbox{#1}}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   We can now define \sqrt using \overlinedbox                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand{\sqrt}[2][1]{\ifdisplay%
 \ifthenelse{\equal{#1}{4}}{\@print{<BIG>&#8732;</BIG>}\overline{#2}}{%
  \ifthenelse{\equal{#1}{3}}{\@print{<BIG>&#8731;</BIG>}\overline{#2}}{%
   \ifthenelse{\equal{#1}{1}}{%
    \@print{<BIG><BIG>}\surd\@print{</BIG></BIG>}\overline{#2}}{%
    %\warning{opt argument to \sqrt not 3 or 4, ignored}%
    %\@print{<BIG><BIG>}\surd\@print{</BIG></BIG>}\overline{#2}%
    \left(#2\right)^{\frac{1}{#1}}%
   }%
  }%
 }%
\else
 \ifthenelse{\equal{#1}{4}}{\@print{&#8732;}\overlinedbox{#2}}{%
  \ifthenelse{\equal{#1}{3}}{\@print{&#8731;}\overlinedbox{#2}}{%
   \ifthenelse{\equal{#1}{1}}{\surd\overlinedbox{#2}}{%
   %\warning{opt argument to \sqrt (outside display mode) ignored}%
   %\surd\overlinedbox{#2}%
   (#2)^{\frac{1}{#1}}
   }%
  }%
 }%
\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   \boxed is more complicated, though                          %
%   1) outside display mode, we can use style-sheets            %
%   2) in display mode, we need to maintain the display-like    %
%      treatment of the argument, so the solution would be to   %
%      create a virtual display-box inside the current box, and %
%      then draw a box around it before continuing in display   %
%      mode.							%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand{\boxed}[1]{\ifdisplay%
	{\@boxed{#1}}%
	\else{\@styleattr{SPAN}{STYLE="border:solid thin black"}#1}%
	\fi%
}%
%%%%%%%%Default env class for verbatim
\setenvclass{verbatim}{verbatim}