<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <META name="GENERATOR" content="hevea 1.10"> <META name="Author" content="Luc Maranget"> <LINK rel="stylesheet" type="text/css" href="manual.css"> <TITLE>Style files</TITLE> </HEAD> <BODY > <A HREF="manual003.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A> <A HREF="manual002.html"><IMG SRC="contents_motif.gif" ALT="Up"></A> <A HREF="manual005.html"><IMG SRC="next_motif.gif" ALT="Next"></A> <HR> <H2 CLASS="section"><A NAME="htoc3">2</A>  Style files</H2><UL> <LI><A HREF="manual004.html#toc1">Standard base styles</A> </LI><LI><A HREF="manual004.html#toc2">Other base styles</A> </LI><LI><A HREF="manual004.html#toc3">Other style files</A> </LI></UL> <P> L<sup>A</sup>T<sub>E</sub>X style files are files that are not intended to produce output, but define document layout parameters, commands, environments, etc.</P><H3 CLASS="subsection"><A NAME="toc1"></A><A NAME="htoc4">2.1</A>  Standard base styles</H3><P>The base style of a L<sup>A</sup>T<sub>E</sub>X document is the argument to the <CODE>\documentclass</CODE> command (<CODE>\documentstyle</CODE> in old style). Normally, the base style of a document defines the structure and appearance of the whole document.</P><P>H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A really knows about two L<sup>A</sup>T<sub>E</sub>X base styles, <TT>article</TT> and <TT>book</TT>. Additionally, the <TT>report</TT> base style is recognized and considered equivalent to <TT>book</TT> and the <TT>seminar</TT> base style for making slides is recognized and implemented by small additions on the <TT>article</TT> style.</P><P>Base style <EM>style</EM> is implemented by an H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A specific style file <EM>style</EM><CODE>.hva</CODE>. More precisely, H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A interprets <CODE>\documentclass{</CODE><EM>style</EM><CODE>}</CODE> by attempting to load the file <EM>style</EM><CODE>.hva</CODE> (see section <A HREF="manual041.html#comline">C.1.1.1</A> on where H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A searches for files). Thus, at the moment, H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A distribution includes the files, <TT>article.hva</TT>, <TT>book.hva</TT>, etc.</P><H3 CLASS="subsection"><A NAME="toc2"></A><A NAME="htoc5">2.2</A>  Other base styles</H3><P><A NAME="otherbase"></A> Documents whose base style is not recognized by H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A can be processed when the unknown base style is a derivation of a recognized base style.</P><P>Let us assume that <TT>doc.tex</TT> uses an exotic base style such as <TT>acmconf</TT>. Then, typing <CODE>hevea doc.tex</CODE> will yield an error, since H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A cannot find the <TT>acmconf.hva</TT> file: </P><PRE CLASS="verbatim"># hevea.opt doc.tex doc.tex:1: Warning: Cannot find file: acmconf.hva doc.tex:1: Error while reading LaTeX: No base style Adios </PRE><P>This situation is avoided by invoking H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A with the known base style file <TT>article.hva</TT> as an extra argument: </P><PRE CLASS="verbatim"># hevea article.hva doc.tex </PRE><P>The extra argument instructs H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A to load its <TT>article.hva</TT> style file before processing <TT>doc.tex</TT>. It will then ignore the document base style specified by <CODE>\documentclass</CODE> (or <CODE>\documentstyle</CODE>).</P><P>Observe that the fix above works because the <TT>acmconf</TT> and <TT>article</TT> base styles look the same to the document (<EM>i.e.</EM> they define the same macros). More generally, most base styles that are neither <I>article</I> nor <I>book</I> are in fact variations on either two of them. However, such styles usually provides extra macros. If users documents use these macros, then users should also instruct H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A about them (see section <A HREF="manual006.html#dontknow">4.1</A>).</P><P>Finally, it is important to notice that renaming a base style file <EM>style</EM><CODE>.cls</CODE> into <EM>style</EM><CODE>.hva</CODE> will not work in general. As a matter of fact, base style files are T<sub>E</sub>X and not L<sup>A</sup>T<sub>E</sub>X source and H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A will almost surely fail on T<sub>E</sub>X-ish input.</P><H3 CLASS="subsection"><A NAME="toc3"></A><A NAME="htoc6">2.3</A>  Other style files</H3><P> A L<sup>A</sup>T<sub>E</sub>X document usually loads additional style files, by using the commands <CODE>\input</CODE> or <CODE>\usepackage</CODE> or <CODE>\input</CODE>.</P><H4 CLASS="subsubsection">2.3.1  Files loaded with <TT>\input</TT></H4><P> Just like L<sup>A</sup>T<sub>E</sub>X, H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A reacts to the construct <CODE>\input{</CODE><I>file</I><CODE>}</CODE> by loading the file <I>file</I>. (if I got it right, H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A even follows T<sub>E</sub>X’s crazy conventions on <TT>.tex</TT> extensions).</P><P>As it is often the case, assume that the document <TT>doc.tex</TT> has a <CODE>\input{mymacros.tex}</CODE> instruction in its preamble, where <TT>mymacros.tex</TT> gathers custom definitions. Hopefully, only a few macros give rise to trouble: macros that performs fine typesetting or T<sub>E</sub>Xish macros. Such macros need to be rewritten, using basic L<sup>A</sup>T<sub>E</sub>X constructs (section <A HREF="manual006.html#trouble">4</A> gives examples of macro-rewriting). The new definitions are best collected in a style file, <TT>mymacros.hva</TT> for instance. Then, <TT>doc.tex</TT> is to be translated by issuing the command: </P><PRE CLASS="verbatim"># hevea mymacros.hva doc.tex </PRE><P>The file <TT>mymacros.hva</TT> is processed before <TT>doc.tex</TT> (and thus before <TT>mymacros.tex</TT>). As a consequence of H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A behavior with respect to definition and redefinition (see section <A HREF="manual030.html#usermacro">B.8.1</A>), the macro definitions in <TT>mymacros.hva</TT> take precedence over the ones in <TT>mymacros.tex</TT>, provided the document original definitions (the ones in <TT>mymacros.tex</TT>) are performed by <CODE>\newcommand</CODE> (or <CODE>\newenvironment</CODE>).</P><P>Another situation is when H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A fails to process a whole style file. Usually, this means that H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A crashes on that style file. The basic idea is then to write a <TT>mymacros.hva</TT> style file that contains alternative definitions for all the commands defined in <TT>mymacros.sty</TT>. Then, H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A should be instructed to load <TT>mymacros.hva</TT> and not to load <TT>mymacros.tex</TT>. This is done by invoking <TT>hevea</TT> as follows: </P><PRE CLASS="verbatim"># hevea mymacros.hva -e mymacros.tex doc.tex </PRE><P>Of course, <TT>mymacros.hva</TT> must now contain replacements for all the useful macros of <TT>mymacro.tex</TT>.</P><H4 CLASS="subsubsection">2.3.2  Files loaded with <TT>\usepackage</TT></H4><P> As far as I know, L<sup>A</sup>T<sub>E</sub>X reacts to the construct <CODE>\usepackage{</CODE><I>name</I><CODE>}</CODE> by loading the file <I>name</I><TT>.sty</TT>. H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A reacts in a similar, but different, manner, by loading the file <I>name</I><TT>.hva</TT>.</P><P>H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A distributions already includes quite a few <TT>.hva</TT> implementations of famous packages (see section <A HREF="manual-packages.html#implemented:package">B.17</A>). When a given package (say <TT>zorglub</TT>) is not implemented, the situation may not be as bad as it may seem first. Hopefully, you are only using a few commands from package <TT>zorglub</TT>, and you feel confident enough to implement them yourself. Then, it suffices to put your definitions in file <TT>zorglub.hva</TT> and H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A will react to <CODE>\usepackage{zorglub}</CODE> by loading <TT>zorglub.hva</TT>.</P><P>See section <A HREF="manual027.html#usepackage">B.5.2</A> for the full story on <CODE>\usepackage</CODE>.</P><HR> <A HREF="manual003.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A> <A HREF="manual002.html"><IMG SRC="contents_motif.gif" ALT="Up"></A> <A HREF="manual005.html"><IMG SRC="next_motif.gif" ALT="Next"></A> </BODY> </HTML>