"Fossies" - the Fresh Open Source Software Archive

Member "hevea-2.35/examples/style-test.tex" (16 Jan 2021, 9892 Bytes) of package /linux/www/hevea-2.35.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TeX and LaTeX source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.


    1 \documentclass {article}
    2 %\usepackage {texnames}
    3 \usepackage {array}
    4 \usepackage {url}
    5 \usepackage {amssymb}
    6 \usepackage {amsmath}
    7 \usepackage {hevea}
    8 
    9 \def\imp{\to}
   10 \def\land{\mathbin\&}
   11 
   12 \title{\hevea{} User Documentation}
   13 \author{Luc Maranget\thanks{Inria Rocquencourt -- BP 105, 78153 Le
   14 Chesnay Cedex. {\tt \mailto{Luc.Maranget@inria.fr}}}}
   15 \date{\today}
   16 
   17 %\title {Styles Everywhere}
   18 %\author {Abhishek Thakur}
   19 %HEVEA \loadcssfile{x.css}
   20 %HEVEA \loadcssfile{y.css}
   21 %HEVEA \newstyle{H1.part}{background:blue;color:white;font-variant:small-caps}
   22 %HEVEA \newstyle{.section}{background:blue;color:white}
   23 %HEVEA \newstyle{.subsection}{background:blue;color:white}
   24 %HEVEA \newstyle{.titlecommon}{background:\#ddccaa;color:white}
   25 %HEVEA \newstyle{.titlemain}{padding:5;background:\#ffeecc;color:black;font-variant:small-caps;font-size:30pt}
   26 %HEVEA \newstyle{.titlerest}{padding:5;background:\#ffeecc;color:black;font-variant:small-caps}
   27 %HEVEA \newstyle{H5}{background:cyan;color:black}
   28 %HEVEA \newstyle{.subparagraph}{background:magenta;color:white}
   29 %HEVEA \newstyle{.itemize}{border:dotted black;margin-left:20;background:\#eeddbb;color:black;font-variant:small-caps}
   30 %HEVEA \newstyle{.li-itemize}{padding-left:10;border-left:solid blue;background:\#bbddff;color:black;font-variant:small-caps}
   31 %HEVEA \newstyle{.enumerate}{border:solid black;margin-left:20;background:\#eeddbb;color:\#ccccc;font-style:italic}
   32 %HEVEA \newstyle{.li-enumerate}{padding-left:10;background:\#bbddff;color:black;font-variant:small-caps}
   33 %HEVEA \newstyle{.list}{border:solid red;padding:8;margin-left:20;background:\#eeddbb;color:black;font-style:italic;font-variant:small-caps}
   34 %HEVEA \newstyle{.dt-list}{background:\#eeddbb;color:black;font-style:italic;font-variant:small-caps}
   35 %HEVEA \newstyle{.dd-list}{border:solid blue;background:\#bbddff;color:black;font-style:italic;font-variant:normal}
   36 %HEVEA \newstyle{.tabular}{margin-left:20;background:\#eeddbb;color:black}
   37 %HEVEA \newstyle{.proof}{border:solid \#88aacc;background:\#bbddff;color:black;align:center}
   38 %HEVEA \newstyle{.bussproofs}{border:thin solid red;background:\#eeddbb;color:black;align:center}
   39 
   40 %\newstyle{H3}{background:blue;color:white;font:sans-serif}
   41 %\setstyles{background:blue;color:white;font:sans-serif}
   42 %\setstyles{backgound:green}
   43 %HEVEA \newstyle{.fancy}{background:\#00cb00;color:white}
   44 %HEVEA \newstyle{.ruled-table}{border:solid black;padding:5;background:\#00cb00;color:white}
   45 \begin{document}
   46 
   47 \maketitle
   48 
   49 \part{Adding Style to Macros and Environments}
   50 
   51 \section {Adding 'Style' to Listing Mechanisms}
   52 HEVEA implements the list environments \texttt{itemize}, \texttt{enumerate}, \texttt{description} using the HTML block elements \texttt{UL}, \texttt{OL}, and \texttt{DL}. The \texttt{$\setminus$begin} and \texttt{$\setminus$end} commands correspond to opening and closing of the respective blocks. 
   53 
   54 To allow the user to add style, the blocks for each environment is opened with the a class, whose name is the same as the name of the environment. This allows the user to give a specific style by defining the class in the preamble using the \texttt{$\setminus$newstyle} command. The following subsections describe the three environments in detail, with examples. 
   55 
   56 \subsection{Itemize}
   57 \begin{tabular}{lll}
   58 Name of Class & : & itemize\\
   59 Example & : & <UL CLASS=itemize> .... </UL>, <LI CLASS=li-itemize>\\
   60 \end{tabular}
   61 
   62 Class definitions 
   63 \begin{verbatim}
   64 \newstyle{.itemize}{border:dotted black;margin-left:20;background:\#eeddbb;color:black;font-variant:small-caps}
   65 \newstyle{.li-itemize}{border-left:solid blue;padding-left:10;background:\#bbddff;color:black;font-variant:small-caps}
   66 \end{verbatim}
   67 in the document preamble, for an input 
   68 \begin{verbatim}
   69 \begin{itemize}
   70 \item First Row of \texttt{Itemize}
   71 \item Second Row of \texttt{Itemize}
   72 \item Third Row of \texttt{Itemize}
   73 \end{itemize}
   74 \end{verbatim}
   75 would produce output 
   76 \begin{itemize}
   77 \item First Row of \texttt{Itemize}
   78 \item Second Row of \texttt{Itemize}
   79 \item Third Row of \texttt{Itemize}
   80 \end{itemize}
   81 Note the use of $\setminus$\# when specifying the color in the \emph{rgb} format. It is exactly what one would do when printing out \# in \LaTeX{} (it would be unreasonable to expect the argument to be parsed in verbose). The arguments of all style commands follow the same principle.
   82 \subsection{Enumerate}
   83 \begin{tabular}{lll}
   84 Name of Class & : & enumerate\\
   85 Example & : & <OL CLASS=enumerate> .... </OL>, <LI CLASS=li-enumerate>\\
   86 Example Class Definition & : & $\setminus$newstyle\{.enumerate\}\{border:solid black;margin-left:20;background:\#eeddbb;color:black;font-variant:small-caps;font-style:italics\}\\
   87  & & $\setminus$newstyle\{.li-enumerate\}\{padding-left:10;background:\#bbddff;color:black;font-variant:small-caps\}\\
   88 \end{tabular}
   89 
   90 An input of the form
   91 \begin{verbatim}
   92 \begin{enumerate}
   93 \item First Row of \texttt{Enumerate}
   94 \item Second Row of \texttt{Enumerate}
   95 \item Third Row of \texttt{Enumerate}
   96 \end{enumerate}
   97 \end{verbatim}
   98 would then produce output of the form\begin{enumerate}
   99 \item First Row of \texttt{Enumerate}
  100 \item Second Row of \texttt{Enumerate}
  101 \item Third Row of \texttt{Enumerate}
  102 \end{enumerate}
  103 
  104 \subsection{Description}
  105 \begin{tabular}{lll}
  106 Name of Class & : & list\\
  107 Example & : & <DL CLASS=list> .... </DL>, <DT CLASS=dt-list>, <DD CLASS=dd-list>\\
  108 Example Class Definition & : & $\setminus$newstyle\{.list\}\{border:solid red;padding:8;margin-left:20;background:$\setminus$\#eeddbb;color:black;font-style:italic;font-variant:small-caps\}\\
  109  & & $\setminus$newstyle\{.dt-list\}\{background:\#eeddbb;color:black;font-style:italic;font-variant:small-caps\}\\
  110  & & $\setminus$newstyle\{.dd-list\}\{border:solid blue;background:\#bbddff;color:black;font-style:italic;font-variant:normal\}\\
  111 \end{tabular}
  112 
  113 An input of the form
  114 \begin{verbatim}
  115 \begin{description}
  116 \item[Itemize] Unordered lists. $${unordered \over lists}$$
  117 \item[Enumerate] Ordered lists. $${ordered \over lists}$$
  118 \item[Description] Lists with user-defined labels, (also referred to as description lists). $${description \over lists}$$ 
  119 \end{description}
  120 \end{verbatim}
  121 would then produce output of the form
  122 \begin{description}
  123 \item[Itemize] Unordered lists. $${unordered \over lists}$$
  124 \item[Enumerate] Ordered lists. $${ordered \over lists}$$
  125 \item[Description] Lists with user-defined labels, (also referred to as description lists). $${description \over lists}$$ 
  126 \end{description}
  127 
  128 \section{Using DIV for Styles}
  129 Due to internal use of certain environments by HEVEA, they cannot be supported by defining an appropriate class in the preamble. A typical example would be the \texttt{table} environment. Defining a class \emph{.table} and using it universaly would throw also effect math constructs, such as \verb+\over,\frac,\xleftarrow,etc.+, besides many other things.
  130 
  131 One could separate \emph{internal} usages from the \emph{real} ones, using a class \emph{.internal} for the former; however, the use of constructs such as tables and arrays is too wide and entertwined to be able to do that. 
  132 
  133 However, for such constructs, limited support for style-sheets is offered by the environment \verb+\divstyle+, which takes the name of a class as an argument, and encloses the part inside using \verb+<DIV CLASS=...>+ and \verb+</DIV>+. 
  134 
  135 The limitation is that the enclosed part may generate more HTML blocks, and only the inherited style attributes shall apply uniformly inside. However, it is pretty effective for some basic styling.
  136 
  137 As an example consider the class definition below.
  138 \begin{verbatim}
  139 \newstyle{.ruled-table}{border:solid black; padding:5; background:\#00cb00;color:white}
  140 \end{verbatim}   
  141 Enclosing a \emph{tabular} environment using \emph{divstyle} with the class \emph{.ruled-table} as the argument, as shown below
  142 \begin{verbatim}
  143 $$
  144 \begin{divstyle}{ruled-table}
  145 \begin{tabular}{|>{\tt}c|p{0.7\hsize}|}
  146 ...
  147 \end{tabular}
  148 \end{divstyle}
  149 $$
  150 \end{verbatim}
  151 will produced output of the form
  152 
  153 %\begin{divstyle}{ruled-table}
  154 $$
  155 \def \val {{\em v}}
  156 \def \arraystretch {1.4}
  157 %HEVEA \begin{divstyle}{ruled-table}
  158 \begin{tabular}{|>{\tt}c|p{0.7\hsize}|}
  159 \hline
  160 \bf key & \bf Effect for value {\val}
  161 \\\hline\hline
  162 before & Execute {\val} before typesetting the rule.
  163          Useful for instance to change the maximal width of the rule.
  164 \\\hline
  165 width &  Set the width of the rule to {\val}
  166 \\\hline
  167 narrower & Set the width of the rule to {\val} times \verb"\hsize".
  168 \\\hline
  169 left & Put a label {\val} on the left of the rule
  170 \\\hline
  171 Left & Idem, but as if the label had zero width. 
  172 \\\hline
  173 Right & As \verb"Left", but on  the right of the rule.
  174 \\\hline
  175 right & As \verb"left",  but on the right of the rule.
  176 \\\hline
  177 leftskip & Cheat by (skip negative space) {\val} on the left side.
  178 \\\hline
  179 rightskip & Cheat by {\val} on the right side of the rule.
  180 \\\hline
  181 vdots & Raise the rule by {\val} and insert vertical dots. 
  182 \\\hline
  183 \end{tabular}
  184 %HEVEA \end{divstyle}
  185 $$
  186 %\end{divstyle}
  187 
  188 As one can see, all attributes except color (which is not inherited), worked. Thus the user should remember to use only those arttributes which do not need to be inherited (e.g. border and padding, used once at the beginning), or those that get inherited by blocks inside (e.g. background).
  189 
  190 A typical error would be of the kind.
  191 \begin{verbatim}
  192 \begin{divstyle}{ruled-table}
  193 I should be $$\frac{white}{white}$$
  194 \end{divstyle}
  195 \end{verbatim}
  196 which would result in
  197 
  198 \begin{divstyle}{ruled-table}
  199 I should be $$\frac{white}{white}$$
  200 \end{divstyle}
  201 
  202 However, such problems usually arise in math mode, when most stuff is set using tables, and fewer attributes are inherited. The simpler version
  203  \begin{verbatim}
  204 \begin{divstyle}{ruled-table}
  205 I should be $\frac{white}{white}$
  206 \end{divstyle}
  207 \end{verbatim}
  208 would still work!
  209 
  210 \begin{divstyle}{ruled-table}
  211 I should be $\frac{white}{white}$
  212 \end{divstyle}
  213 
  214 \label {options}
  215 
  216 \end{document}