% and it is htx.sty in -*- LaTeX -*- mode

\input psfig
\usepackage{graphics}
\usepackage{ifthen}

%% htx incompatabilities:
%   code enviroment must be changed to verbatim environment
%   code command must be changed to verb command
%   section* has LaTeX meaning


% page display
\evensidemargin=-0.5cm
\oddsidemargin=-0.5cm
% \topmargin=-2.3cm	%%% \topmargin=-.6in
\topmargin=-1.3cm	%%% \topmargin=-.6in
\headsep=0.5cm
% \textheight=24.6cm	%%% \textheight=9.1in
\textheight=23.3cm	%%% \textheight=9.1in
\textwidth=17.5cm
\columnwidth=\textwidth


% skip the irritating space above mathematical displays
\setlength{\abovedisplayskip}{0ex}


% decent size for verbatim text
\def\verbatim{\small \@verbatim \frenchspacing\@vobeyspaces \@xverbatim}
\let\endverbatim=\endtrivlist


% decent sized section and subsection headers
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
    -.2ex}{2.3ex plus .2ex}{\large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus 
 -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}

\def\nl{\hfil\break}

\def\bigno{\bigskip\noindent}
\def\medno{\medskip\noindent}
\def\smallno{\smallskip\noindent}

% mmcc to htx compatibility

\def\me#1{}
\def\header#1#2{\par\textbf{#2}\par}
\def\wallpaint#1{}

\newsavebox{\modnum}
\newcommand{\docheader}[3]{
\savebox{\modnum}{\it #2}
\thispagestyle{plain}
\chead{\fancyplain{}{Module \# #2: #3}}
\cfoot{\fancyplain{#2-\thepage}{#2-\thepage}}
\lhead{\fancyplain{}{}}
\rhead{\fancyplain{}{}}
\setlength{\headrulewidth}{0.4pt}
\parbox{2.5in}{\psfig{file=mmcc.ps}}
\hspace{.5in}
\begin{minipage}{3in}
\begin{center}
{\it Indiana University\\Multi-campus Modular\\Computing Curriculum\par}
\vspace{2ex}{\large #1\par}\vspace{3ex}
{\Large Module \# #2: #3}\vspace{3ex}
\end{center}
\end{minipage}}

\newenvironment{goallist}{
{\it\large Goals}
\begin{itemize}}
{\end{itemize}\vspace{2ex}}

\newenvironment{prereqs}{
{\it\large Prerequisite Skills}
\begin{itemize}}
{\end{itemize}\vspace{2ex}}

\newenvironment{lab*}{\section*{Laboratory Assignment}}{}

\newcommand{\indx}[2][x]{\index{#2}}

\def\mycatcodes{%
  \@makeother\#\@makeother\&\@makeother\^\@makeother\_%
  \@makeother\$\@makeother\`\@makeother\'\@makeother\~\@makeother\@%
  \@makeother\"\@makeother\%}

\def\xlink{\begingroup\mycatcodes\endlink}
\def\endlink#1#2{\underline{\mbox{#2}}\footnote{{\tt #1}}\endgroup}
\let\zlink=\xlink
\let\olink=\xlink

\newcommand{\anchor}[2]{\label{#1}{#2}}
\newcommand{\link}[2]{\underline{\mbox{#2}} (see page~\pageref{#1})}
\newcommand{\latexonly}[1]{#1}
\newcommand{\htx}{{\it HtX}}

%\def\code{\begingroup\tt\mycatcodes\endcode}
%\def\endcode#1{#1\endgroup}

\newsavebox{\glossbox}
\newenvironment{gloss*}[1]{#1%
\begin{lrbox}{\glossbox}\begin{minipage}[t]{6.5in}\small}
{\hfill\break\phantom{X}\par\end{minipage}\end{lrbox}%
\footnote{\usebox{\glossbox}}}

\newcounter{qctr}
\newcounter{actr}

\newenvironment{quest}{\addtocounter{qctr}{1}%
\rule{6in}{.01in}\par{\bf Q. \theqctr}\hspace{1em}}
{\par{\it (Answer on page 
\usebox{\modnum}-\pageref{qanda\theqctr}.)}\par\rule{6in}{.01in}} 
%{\hfill\break\phantom{X}\par\end{minipage}\end{lrbox}

%\newcommand{\ans}{\addtocounter{actr}{1}\item\label{qanda\theactr}}
\newcommand{\ans}{{\bf Answer:  }}
%\let\ans=\item

\newcommand{\anslist}[1]{
\newpage
\section*{Answers to Questions}
\begin{enumerate}
\input{#1}
\end{enumerate}}

%\newcommand{\ans}{
%\begin{lrbox}{\ansbox}
%\begin{minipage}[t]{7.0in}}

\newcounter{ectr}
\newenvironment{exercise}{\addtocounter{ectr}{1}
\rule{6in}{.01in}\par{\bf Exercise. \theectr}\hspace{1em}}
{\par\rule{6in}{.01in}}

% \hr is defined in TeX since it has an optional argument
% but no required argument, which LaTeX can't handle.
\def\hr{\@ifnextchar[{\@hr}{\@hr[]}}
\def\@hr[#1]{{\centering\rule[.05in]{4in}{.01in}\par}}

% The \image macro is a little brittle:  the required URL argument 
% must be a local file, and it must end with a three character extension
% (.gif or .jpg).  A postscript file with the same base name is assumed
% to exist.  (In older versions of LaTeX, use \psfig instead of
% \includegraphics)
% Image alignment is even more brittle!  Left and right alignment are
% only intended for wrapping text around an image that appears at the
% beginning of a paragraph.  If the text height is less than the image
% height, strange things will happen.

\newbox\imagebox
\newdimen\imagewidth
\newdimen\imageheight

\def\image{\@ifnextchar[{\@image}{\@image[bottom]}}
\def\@image[#1]{\@ifnextchar[{\@@image[#1]}{\@@image[#1][]}}
\def\@@image[#1][#2]{\@ifnextchar[{\@@@image[#1][#2]}{\@@@image[#1][#2][]}}
\def\@@@image[#1][#2][#3]#4{%
%  \setbox\imagebox=\hbox{\includegraphics*{\basename#4}}
  \setbox\imagebox=\hbox{\psfig{file=\basename#4.ps}}
  \imagewidth=\wd\imagebox
  \imageheight=\ht\imagebox
  % \dropimage is the dimension required to top-align the image
  \newdimen\dropimage
  \dropimage=-\imageheight
  \advance\dropimage by 1ex
  \ifthenelse{\equal{#1}{left}}{\alignimage{left}}
   {\ifthenelse{\equal{#1}{right}}{\alignimage{right}}
     {\ifthenelse{\equal{#1}{top}}{\raisebox{\dropimage}{\box\imagebox}}
       {\ifthenelse{\equal{#1}{center}}{\raisebox{0.5\dropimage}{\box\imagebox}}}
       {\raisebox{0pt}{\box\imagebox}}}}}

\def\basename#1.#2#3#4{#1}

\newcommand{\alignimage}[1]{%
% Determine how many lines of text correspond to the image height
\newcount\hanglines
\newdimen\hangdepth
\hangdepth=\ht\imagebox
\divide\hangdepth by \baselineskip
\hanglines=-\hangdepth
\advance\hanglines by -1
% Determine how wide to make the hanging indent
\newdimen\hangwidth
\hangwidth=\wd\imagebox
\advance\hangwidth by 0.8em
% The text of the paragraph is raised by an amount similar to the
\newdimen\raisepar
% height of the image
\raisepar=\ht\imagebox
\advance\raisepar by \parsep
\advance\raisepar by 1ex
% Start of paragraph:
\ifthenelse{\equal{#1}{left}}
{\bigskip \par \noindent \box\imagebox \par
 \vspace{-\raisepar} \hangindent=\hangwidth \hangafter=\hanglines
 \noindent \hspace{-.7em}}
{\bigskip \par \hfill \box\imagebox \par
 \vspace{-\raisepar} \hangindent=-\hangwidth \hangafter=\hanglines}
}

% bogocity
\newcommand{\htxonly}[1]{}
\newcommand{\seticondir}[1]{}
\newcommand{\paleBlue}{}
\newcommand{\palePink}{}
\newcommand{\paleGreen}{}
\newcommand{\paleLavender}{}
\newcommand{\robinsEggBlue}{}
\newcommand{\pastelGreen}{}
\newcommand{\palePurple}{}
\newcommand{\base}[1]{}
\newcommand{\getbase}{}

\makeindex
\parindent 0pt
\parskip 1ex
\usepackage{fancyheadings}
\usepackage{graphics}
\usepackage{code}
\pagestyle{fancyplain}




