% ------------------------ % exlab.htx % A sample HtX source file for generalized lab manuals, % by members of Oberlin DRAGN Project 1994-1997. % HtX v. 1.0b1 (c) 1995-7, Richard M. Salter % Please read copyright and distribution agreement % ------------------------ % ------------------------ Configuration ----------------------- \documentstyle{lab} % ------------------------ % Uncomment to override the default graphic configuration. % Use the file "bw.cfg" as a template; % see other "*.cfg" files for samples. % ------------------------ %\input{XXX.cfg} % % is used to preface comment lines. Such lines are there solely for the % (human) reader of the .htx file. Ignored by HtX compiler and do not % appear in the generated .html file. \me{rhyspj@cs.oberlin.edu} \paintbackgd % Uncomment to include exercise solutions (see \begin{exsol} below) % Comment or delete to exclude exercise solutions. \solutionon % Create a bibliography file \newbibfile[ffffbb][Lab]{labref} % Used with \cite and \refstart and \refentry to provide a citation % facility. Alternatively. a BibTeX-like master bibliography can be % used; see the HtX reference manual for details. % ------------------------ Document Start ---------------------- \begin{document} \labstart[7]{Generic Lab}{July, 1996} % ^ ^ ^ % | | |________need I say more? % | |______the title % |______the number of the lab \chapter{Introduction: } This is a demonstration of how to create labs with HtX. It should serve as a template demonstrating the features available with this style. \chapter*{Some TeX-like Features} \section*{Itemize-Enumerate-Description} HtX maps the LaTeX itemize-enumerate-description list environments to HTML unordered lists, ordered lists and definition lists, respectively. We begin with the ``itemize'' environment. It's very much like what you find in LaTeX. \begin{itemize} \item This is item number 1, which is followed by: \item item number 2. \item Finally, we have the third item. \end{itemize} Similar to itemize, we have an ``enumerate'' environment: \begin{enumerate} \item one \item two \item buckle \item my shoe \end{enumerate} You can force lists using capital letters, etc. using an optional argument: \begin{enumerate}[A] \item This is item A, which is followed by: \item item number B. \item Finally, we have the third item (C). \end{enumerate} Also try using [a] and [I]. Finally, there is ``description'' (or definition): \begin{description} \item[\bf the first] number one \item[\bf the second] number two, and \item[\bf the third] number six \end{description} \section*{Tables} HtX implements versions of LaTeX's tabular and array environments using Netscape tables: \begin{tabular}{lcr} left¢er&right\\ 1&2&3\\ \hline a&b&c\\ \end{tabular} Also try: \begin{tabular}{|l|c|r|} left¢er&right\\ 1&2&3\\ \hline a&b&c\\ \end{tabular} and (to specifiy cell size) \begin{tabular}[10]{|l|c|r|} left¢er&right\\ 1&2&3\\ \hline a&b&c\\ \end{tabular} The array environment is similar for math displays \section*{Headers-fonts-alignment} We can put in headlines: \header{3}{Hello} in various sizes: \header{2}{Hello Again} and center them if need be: \begin{center} \header{1}{And Hello Again} \end{center} \centerline{You also can center this way} {\centering and this way} We can {\em italicize} and {\bf bold-face} and {\tt typewriter-font} our text. Soon, math mode will be available. In the meantime we have some limited math mode commands: Inline: $T(n) = T(\frac{n}{2}) + T(\frac{n}{2}) + a$; or in displays: $$ T(n) = T(\frac{n}{2}) + T(\frac{n}{2}) + a\break T(1) = b $$ or: $$\begin{array}{lll} T(n)&=&T(2^{m})\\ &=&U(m)\\ &=&O(m log(m))\\ &=&O(log(n) (log (log (n))))\\ \end{array}$$ To engage a typewriter font, as we often do for including sections of program code, we can use the ``code'' environment. It switches to a fixed-width font and produces HTML that respects the layout of the HtX file. \begin{code} (define i-am-a-program-sample (lambda (x y) (cond ((= x y) 'now-i-stop) ((or (not (integer x)) (not (integer y))) (display "This program works with two integers") (newline)) ((> x y) (display "x is too big") (newline) (i-am-a-program-sample x (+ 1 y))) ((< x y) (display "x is too small") (newline) (i-am-a-program-sample (+ 1 x) y))))) \end{code} You can also enter a similar environment ``in-line'' with {\code (i-am-a-program-sample 2 8)}. \chapter*{Other useful environments} Sometimes it's handy \begin{gloss*}{to jump elsewhere} for a little while. Of course, you can always return to the main window. This feature is useful, for example, for footnotes or for linking to an external program file. \end{gloss*} . If you do not follow the link to the footnote, you can just keep reading. \chapter{Reference citations} References may be listed at the end of the source file and cited from within: \cite{Baase}{Baase}. % (See the {\it refentry} entries at the end of this file). Alternatively, a master bibliography can be referenced (analogous to BibTeX). See the Reference Guide for details. \chapter*{Lab-specific environments} \begin{quest} Do you know what a ``quest'' environment is? \ans Well this is one \end{quest} That was a straightforward question with an answer. What if you want to provide a hint? \begin{quest} May I have a hint please? \begin{hint} Here is your hint \end{hint} \ans We hope the hint was useful \end{quest} That demonstrates HtX's question-hint-answer environment. At Oberlin, we use also use an ``exercise'' environment, which is used to assign work that is to be handed in. \begin{exercise}[Exercise titles appear in the table of contents] Write a program to determine if an arbitrary program, started with no input, will ever print the string ``Turing''. \end{exercise} \begin{exsol} You may include the solution in the htx file. Setting \verb/\solutionon/ in the preamble and retranslating will allow solutions to appear in the output. Otherwise they are flushed into the null device (On Unix systems: /dev/null) \end{exsol} Exercises are automatically numbered. They are also catalogued in the table of contents that HtX automatically generates. \begin{exercise}[Exercises are also numbered consecutively] Who was the first president of the United States? \begin{hint} His/her last name was the first name of Rip van Winkle's creator. \end{hint} \end{exercise} \paintbackgd \chapter*{Incorporating graphics} % All you need to do is to reference a .gif image: Images used only by one document may reside in the document's directory: \image[top]{foo.gif} \chapter{Linking to other documents} The linking facility is provided by the ``xlink'' command. Here, for example is how to link to the HtX source for this document: Click \xlink{exlab.htx}{here} to see the source file for this suite of documents. Click \xlink{http://www.cs.oberlin.edu/htx/}{here} to see the HtX home page. \chapter{Special characters} % \chapter and \chapter* are used to start new chapters. \section{What does * mean in chapter* etc.?} We use {\tt \backslash chapter} for a short chapter where we do not need the navigation aids to appear both at the top and at the bottom of the chapter. {\tt \backslash chapter*} is for longer chapters. \section{How about section?} The difference between {\tt \backslash section} and {\tt \backslash section*} is the same -- the * adds a navigation tool at the end of the section in addition to the one which is always at the beginning of the section. \subsection*{And subsection*} Even though this is a short subsection, we've done it with {\tt \backslash subsection*} just so that you can see the navigation box at both the top and the bottom. This is quite annoying when the units are short; and so you must use your judgment and select {\tt \backslash subsection} when appropriate. % ---references--- \refstart \refentry{Baase} Baase, S. {\it Computer Algorithms}, Reading: Addison-Wesley, 1993. \refentry{Cormen} Cormen, T. H., et al. {\it Introduction to Algorithms}, Cambridge: MIT Press, 1990. \refend \end{document}