<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta name="generator" content="hevea 2.32"> <meta name="Author" content="Luc Maranget"> <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML"></script><link rel="stylesheet" type="text/css" href="manual.css"> <title>Style files</title> </head> <body> <a href="manual003.html"><img src="previous_motif.svg" alt="Previous"></a> <a href="manual002.html"><img src="contents_motif.svg" alt="Up"></a> <a href="manual005.html"><img src="next_motif.svg" alt="Next"></a> <hr> <h2 class="section" id="sec4">2  Style files</h2> <ul> <li><a href="manual004.html#sec5">Standard base styles</a> </li><li><a href="manual004.html#sec6">Other base styles</a> </li><li><a href="manual004.html#sec7">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" id="sec5">2.1  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<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A really knows about two L<sup>A</sup>T<sub>E</sub>X base styles, <span class="c013">article</span> and <span class="c013">book</span>. Additionally, the <span class="c013">report</span> base style is recognized and considered equivalent to <span class="c013">book</span> and the <span class="c013">seminar</span> base style for making slides is recognized and implemented by small additions on the <span class="c013">article</span> style.</p><p>Base style <em>style</em> is implemented by an H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A specific style file <em>style</em><code>.hva</code>. More precisely, H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>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<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A searches for files). Thus, at the moment, H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A distribution includes the files, <span class="c013">article.hva</span>, <span class="c013">book.hva</span>, etc.</p> <h3 class="subsection" id="sec6">2.2  Other base styles</h3> <p><a id="otherbase"></a> Documents whose base style is not recognized by H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A can be processed when the unknown base style is a derivation of a recognized base style.</p><p>Let us assume that <span class="c013">doc.tex</span> uses an exotic base style such as <span class="c013">acmconf</span>. Then, typing <code>hevea doc.tex</code> will yield an error, since H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A cannot find the <span class="c013">acmconf.hva</span> 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<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A with the known base style file <span class="c013">article.hva</span> as an extra argument: </p><pre class="verbatim"># hevea article.hva doc.tex </pre><p> The extra argument instructs H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A to load its <span class="c013">article.hva</span> style file before processing <span class="c013">doc.tex</span>. 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 <span class="c013">acmconf</span> and <span class="c013">article</span> 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 <span class="c019">article</span> nor <span class="c019">book</span> 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<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>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<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A will almost surely fail on T<sub>E</sub>X-ish input.</p> <h3 class="subsection" id="sec7">2.3  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" id="sec8">2.3.1  Files loaded with <span class="c013">\input</span></h4> <p> Just like L<sup>A</sup>T<sub>E</sub>X, H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A reacts to the construct <code>\input{</code><span class="c019">file</span><code>}</code> by loading the file <span class="c019">file</span>. (if I got it right, H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A even follows T<sub>E</sub>X’s crazy conventions on <span class="c013">.tex</span> extensions).</p><p>As it is often the case, assume that the document <span class="c013">doc.tex</span> has a <code>\input{mymacros.tex}</code> instruction in its preamble, where <span class="c013">mymacros.tex</span> 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, <span class="c013">mymacros.hva</span> for instance. Then, <span class="c013">doc.tex</span> is to be translated by issuing the command: </p><pre class="verbatim"># hevea mymacros.hva doc.tex </pre><p> The file <span class="c013">mymacros.hva</span> is processed before <span class="c013">doc.tex</span> (and thus before <span class="c013">mymacros.tex</span>). As a consequence of H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A behaviour with respect to definition and redefinition (see section <a href="manual030.html#usermacro">B.8.1</a>), the macro definitions in <span class="c013">mymacros.hva</span> take precedence over the ones in <span class="c013">mymacros.tex</span>, provided the document original definitions (the ones in <span class="c013">mymacros.tex</span>) are performed by <code>\newcommand</code> (or <code>\newenvironment</code>).</p><p>Another situation is when H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A fails to process a whole style file. Usually, this means that H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A crashes on that style file. The basic idea is then to write a <span class="c013">mymacros.hva</span> style file that contains alternative definitions for all the commands defined in <span class="c013">mymacros.sty</span>. Then, H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A should be instructed to load <span class="c013">mymacros.hva</span> and not to load <span class="c013">mymacros.tex</span>. This is done by invoking <span class="c013">hevea</span> as follows: </p><pre class="verbatim"># hevea mymacros.hva -e mymacros.tex doc.tex </pre><p>Of course, <span class="c013">mymacros.hva</span> must now contain replacements for all the useful macros of <span class="c013">mymacro.tex</span>.</p> <h4 class="subsubsection" id="usepackage:both">2.3.2  Files loaded with <span class="c013">\usepackage</span></h4> <p> <a id="hevea_default0"></a> As far as I know, L<sup>A</sup>T<sub>E</sub>X reacts to the construct <code>\usepackage{</code><span class="c019">name</span><code>}</code> by loading the file <span class="c019">name</span><span class="c013">.sty</span>. H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A reacts in a similar, but different, manner, by loading the file <span class="c019">name</span><span class="c013">.hva</span>.</p><p>H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A distributions already includes quite a few <span class="c013">.hva</span> implementations of famous packages (see section <a href="manual-packages.html#implemented%3Apackage">B.17</a>). When a given package (say <span class="c013">zorglub</span>) 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 <span class="c013">zorglub</span>, and you feel confident enough to implement them yourself. Then, it suffices to put your definitions in file <span class="c013">zorglub.hva</span> and H<span class="c016"><sup>E</sup></span>V<span class="c016"><sup>E</sup></span>A will react to <code>\usepackage{zorglub}</code> by loading <span class="c013">zorglub.hva</span>.</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.svg" alt="Previous"></a> <a href="manual002.html"><img src="contents_motif.svg" alt="Up"></a> <a href="manual005.html"><img src="next_motif.svg" alt="Next"></a> </body> </html>