elsarticle/doc/rvdtx.sty
changeset 5 c04b029e623a
equal deleted inserted replaced
-1:000000000000 0:b749afb59876
       
     1 %
       
     2 %
       
     3 %  File: rvdtx.sty
       
     4 %  
       
     5 %  Auxiliary package to format *.dtx documents.
       
     6 % 
       
     7 %  Copyright (c) 2008, 2009 CV Radhakrishnan <cvr@river-valley.org>,
       
     8 %                     
       
     9 %  This file may be distributed and/or modified under the conditions
       
    10 %  of the LaTeX Project Public License, either version 1.2 of this
       
    11 %  license or (at your option) any later version.  The latest version
       
    12 %  of this license is in:
       
    13 %   
       
    14 %    http://www.latex-project.org/lppl.txt
       
    15 %   
       
    16 %  and version 1.2 or later is part of all distributions of LaTeX
       
    17 %  version 1999/12/01 or later.
       
    18 %
       
    19 %
       
    20 \newcounter{colorscheme}
       
    21 
       
    22 \newif\if@xcolor \@xcolorfalse
       
    23 \newif\if@mylogo \@mylogofalse
       
    24 
       
    25 \DeclareOption{mylogo}{\global\@mylogotrue}
       
    26 \DeclareOption{green}{\setcounter{colorscheme}{1}}
       
    27 \DeclareOption{orange}{\setcounter{colorscheme}{0}}
       
    28 \DeclareOption{xcolor}{\global\@xcolortrue}
       
    29 \DeclareOption{qone}{\AtEndOfPackage{\global\let\dtxmark\dtxmarkone}}
       
    30 \DeclareOption{qtwo}{\AtEndOfPackage{\global\let\dtxmark\dtxmarktwo}}
       
    31 
       
    32 \ProcessOptions
       
    33 \def\loadXcolor{\if@xcolor\RequirePackage[dvipsnames,svgnames]{xcolor}\fi}
       
    34 
       
    35 \loadXcolor
       
    36 \ifcase\thecolorscheme
       
    37 %
       
    38 %  Orange color spec (default)
       
    39 %
       
    40  \colorlet{itemcolor}{brown}
       
    41  \colorlet{verbcolor}{Sepia}
       
    42  \colorlet{botrulecolor}{orange!25}
       
    43  \colorlet{botbgcolor}{orange!15}
       
    44  \colorlet{botcolor}{orange!80}
       
    45  \colorlet{pgrulecolor}{orange}
       
    46  \colorlet{pgbgcolor}{white}
       
    47 
       
    48  \colorlet{quicklinkrulecolor}{orange!40}
       
    49  \colorlet{quicklinkcolor}{brown}
       
    50  \colorlet{topverticalrule}{brown}
       
    51  \colorlet{titlecolor}{brown}
       
    52  \colorlet{hlinkcolor}{brown}
       
    53  \colorlet{hlinktricolor}{orange!70}
       
    54  \colorlet{linkcolor}{brown}
       
    55  \colorlet{urlcolor}{brown}
       
    56 
       
    57 % \colorlet{arrayrulecolor}{olive!30}
       
    58  \colorlet{seccolor}{brown}
       
    59 
       
    60  \colorlet{toprulecolor}{orange!30}
       
    61  \colorlet{topbgcolor}{orange!10}
       
    62  \colorlet{topcolor}{brown!80}
       
    63 %
       
    64 %
       
    65 \or% Green color specs
       
    66 %
       
    67 %
       
    68  \colorlet{itemcolor}{OliveGreen}
       
    69  \colorlet{verbcolor}{OliveGreen}
       
    70  \colorlet{botrulecolor}{GreenYellow!25}
       
    71  \colorlet{botbgcolor}{GreenYellow!30}
       
    72  \colorlet{botcolor}{Green!80}
       
    73  \colorlet{pgrulecolor}{GreenYellow}
       
    74  \colorlet{pgbgcolor}{white}
       
    75 
       
    76  \colorlet{quicklinkrulecolor}{Green!40}
       
    77  \colorlet{quicklinkcolor}{Green}
       
    78  \colorlet{topverticalrule}{Green}
       
    79  \colorlet{titlecolor}{DarkOliveGreen}
       
    80  \colorlet{hlinkcolor}{DarkOliveGreen}
       
    81  \colorlet{hlinktricolor}{Green!70}
       
    82  \colorlet{linkcolor}{OliveGreen}
       
    83  \colorlet{urlcolor}{OliveGreen}
       
    84 
       
    85 % \colorlet{arrayrulecolor}{olive!30}
       
    86  \colorlet{seccolor}{OliveGreen}
       
    87 
       
    88  \colorlet{toprulecolor}{GreenYellow!50}
       
    89  \colorlet{topbgcolor}{GreenYellow!20}
       
    90  \colorlet{topcolor}{GreenYellow!80}
       
    91 \fi
       
    92 
       
    93 \def\floatpagefraction{.99}
       
    94 \usepackage{geometry}
       
    95 \geometry{top=2in,
       
    96   bottom=1in,
       
    97   left=2in,
       
    98   right=1in,
       
    99   a4paper}
       
   100 
       
   101 %\DeclareRobustCommand{\LaTeX}{L\kern-.25em%
       
   102 %   {\sbox\z@ T%
       
   103 %     \vbox to\ht\z@{%
       
   104 %     {\check@mathfonts
       
   105 %     \fontsize\sf@size\z@
       
   106 %     \math@fontsfalse\selectfont
       
   107 %     A}%
       
   108 %    \vss}%
       
   109 %   }%-.10em%
       
   110 %  \TeX
       
   111 %}
       
   112 \DeclareRobustCommand{\LaTeX}{L\kern-.25em%
       
   113   {\sbox\z@ T%
       
   114          \vbox to\ht\z@{%
       
   115            \hbox{%
       
   116              \check@mathfonts
       
   117               \fontsize\sf@size\z@
       
   118               \math@fontsfalse\selectfont
       
   119               A}%
       
   120           \vss}%
       
   121         }%
       
   122    \kern-.10em%
       
   123    \TeX}
       
   124 
       
   125 \RequirePackage{pdfwidgets}
       
   126 
       
   127 \RequirePackage{comment,xspace}
       
   128 \def\xml{\textsc{xml}\xspace}
       
   129 \def\latex{\LaTeX\xspace}
       
   130 \def\pdf{\textsc{pdf}\xspace}
       
   131 \def\pdfa{\textsc{pdf/a-1}b\xspace}
       
   132 \def\pdfx{\textsc{pdf/x-1}a\xspace}
       
   133 \def\xmp{\textsc{xmp}\xspace}
       
   134 \def\pdftex{\textsc{pdf\TeX}\xspace}
       
   135 \def\defmacro#1{\texttt{\@bsl#1}}
       
   136 \def\thanh{H\`an Th\^e Th\`anh\xspace}
       
   137 \def\gnulinux{\textsc{gnu/linux}\xspace}
       
   138 
       
   139 \let\@DRAFTout@Hook\@empty
       
   140 \newcommand{\DRAFTout}{\g@addto@macro\@DRAFTout@Hook}
       
   141 \newcommand{\@DRAFTout@Out}{%
       
   142    \afterassignment\@DRAFTout@Test
       
   143    \global\setbox\@cclv=
       
   144    }
       
   145 \newcommand{\@DRAFTout@Test}{%
       
   146    \ifvoid\@cclv\relax
       
   147       \aftergroup\@DRAFTout@Output
       
   148    \else
       
   149       \@DRAFTout@Output
       
   150    \fi%
       
   151    }
       
   152 \newcommand{\@DRAFTout@Output}{%
       
   153    \@DRAFTout@Hook%
       
   154    \@DRAFTout@Org@Out\box\@cclv%
       
   155    }
       
   156 \newcommand{\@DRAFTout@Org@Out}{}
       
   157 \newcommand*{\@DRAFTout@Init}{%
       
   158    \let\@DRAFTout@Org@Out\shipout
       
   159    \let\shipout\@DRAFTout@Out
       
   160    }
       
   161 \newdimen\OHeight
       
   162 \setlength\OHeight{\textheight}
       
   163 \addtolength\OHeight{\headheight}
       
   164 \addtolength\OHeight{\headsep}
       
   165 \addtolength\OHeight{\footskip}
       
   166 
       
   167 
       
   168 \newif\ifoverlay\overlayfalse
       
   169 
       
   170 \AtBeginDocument{\@DRAFTout@Init}
       
   171 \newcommand{\@DraftOverlay@Hook}{}
       
   172 \newcommand{\AddToDraftOverlay}{\g@addto@macro\@DraftOverlay@Hook}
       
   173 \newcommand{\ClearDraftOverlay}{\let\@DraftOverlay@Hook\@empty}
       
   174 \newcommand{\@DraftOverlay}{%
       
   175   \ifx\@DraftOverlay@Hook\@empty
       
   176   \else
       
   177     \bgroup
       
   178       \@tempdima=1in
       
   179       \@tempcnta=\@tempdima
       
   180       \@tempcntb=-\@tempdima
       
   181       \advance\@tempcntb\paperheight
       
   182       \ifoverlay
       
   183        \global\setbox\@cclv\vbox{%
       
   184         \box\@cclv
       
   185         \vbox{\let\protect\relax%
       
   186          \unitlength=1pt%
       
   187          \pictur@(0,0)(\strip@pt\@tempdima,\strip@pt\@tempdimb)%
       
   188           \@DraftOverlay@Hook%
       
   189          \endpicture}}%
       
   190      \else
       
   191        \global\setbox\@cclv\vbox{%
       
   192         \vbox{\let\protect\relax%
       
   193          \unitlength=1sp%
       
   194          \pictur@(0,0)(\@tempcnta,\@tempcntb)%
       
   195           \@DraftOverlay@Hook%
       
   196          \endpicture}%
       
   197          \box\@cclv}%
       
   198      \fi 
       
   199     \egroup
       
   200   \fi
       
   201 }
       
   202 
       
   203 \definecolor{gray30}{gray}{.7}
       
   204 \definecolor{gray20}{gray}{.8}
       
   205 \definecolor{gray10}{gray}{.9}
       
   206 
       
   207 \DRAFTout{\@DraftOverlay}
       
   208 \long\def\puttext(#1)#2{\AddToDraftOverlay{%
       
   209   \setlength{\unitlength}{1pt}\thinlines%
       
   210   \put(#1){#2}}}
       
   211 
       
   212 \RequirePackage{shortvrb}
       
   213 \MakeShortVerb{\|}
       
   214 \RequirePackage{amsfonts,amssymb}
       
   215 \IfFileExists{pxfonts.sty}{\RequirePackage{pxfonts}}{}
       
   216 %\IfFileExists{charter.sty}{\RequirePackage{charter}}{}
       
   217 \IfFileExists{lfr.sty}{\RequirePackage[scaled=.85]{lfr}}{}
       
   218 %\IfFileExists{prima.sty}{\RequirePackage[scaled=.8]{prima}}{}
       
   219 
       
   220 \def\theCodelineNo{\reset@font\tiny\arabic{CodelineNo}}
       
   221  
       
   222 \def\@seccntformat#1{\llap{\csname the#1\endcsname.\hspace*{6pt}}}
       
   223 \def\section{\@startsection {section}{1}{\z@}%
       
   224       {-3.5ex \@plus -1ex \@minus -.2ex}%
       
   225       {2.3ex \@plus.2ex}%
       
   226       {\normalfont\large\bfseries\color{seccolor}}}
       
   227 \def\subsection{\@startsection{subsection}{2}{\z@}%
       
   228       {-2.25ex\@plus -1ex \@minus -.2ex}%
       
   229       {1.5ex \@plus .2ex}%
       
   230       {\normalfont\normalsize\bfseries\color{seccolor}}}
       
   231 \def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
       
   232       {-1.25ex\@plus -1ex \@minus -.2ex}%
       
   233       {1.5ex \@plus .2ex}%
       
   234       {\normalfont\normalsize\bfseries\color{seccolor}}}
       
   235 
       
   236 %\RequirePackage[draft]{pdfdraftcopy}
       
   237 % \draftstring{}
       
   238  \puttext(0,36){\botstring}%
       
   239  \puttext(0,840){\copy\topbox}
       
   240 \if@mylogo
       
   241  \puttext(531,829){\cvrlogo}
       
   242 \fi
       
   243 
       
   244 \RequirePackage{colortbl}
       
   245 %\arrayrulecolor{arrayrulecolor}
       
   246 \let\shline\hline
       
   247 \def\hline{\noalign{\vskip3pt}\shline\noalign{\vskip4pt}}
       
   248 
       
   249 \RequirePackage[pdftex,colorlinks]{hyperref}
       
   250 \def\Hlink#1#2{\hyperlink{#2}{\color{hlinktricolor}%
       
   251      $\blacktriangleright$~\color{hlinkcolor}#1}}
       
   252  \def\@linkcolor{linkcolor}
       
   253  \def\@urlcolor{urlcolor}
       
   254 
       
   255 \pagestyle{empty}
       
   256 \def\version#1{\gdef\@version{#1}}
       
   257 \def\@version{1.0}
       
   258 \def\contact#1{\gdef\@contact{#1}}
       
   259 \def\author#1{\gdef\@author{#1}}
       
   260 \def\@author{River Valley Technologies}
       
   261 \def\@contact{\texttt{support@river-valley.com}}
       
   262 \def\keywords#1{\gdef\@keywords{#1}}
       
   263 \def\@keywords{\LaTeX, \xml}
       
   264 
       
   265 \long\def\Hrule{\\[-4pt]\hspace*{-3em}%
       
   266      {\color{quicklinkrulecolor}\rule{\linewidth}{.1pt}}\\}
       
   267 
       
   268 \long\def\dtxmarkone[#1][#2]#3#4#5{\def\next{#1}%
       
   269      \ifcase\next\or\Hlink{#4}{#3}\Hrule \fi}
       
   270 
       
   271 \newcounter{dtx}
       
   272 
       
   273 \long\def\dtxmarktwo[#1][#2]#3#4#5{\def\next{#1}%
       
   274    \stepcounter{dtx}\parbox{.45\linewidth}%
       
   275     {\ifcase\next\or\Hlink{#4}{#3}\fi}%
       
   276    \ifodd\thedtx\relax\else\Hrule\fi}
       
   277 
       
   278 \let\dtxmark\dtxmarkone
       
   279 
       
   280 \newbox\topbox
       
   281 \long\def\maketitle{\global\setbox\topbox=\vbox{\hsize=\paperwidth
       
   282     \parindent=0pt
       
   283     \fcolorbox{toprulecolor}{topbgcolor}%
       
   284     {\parbox[t][2in][c]{\paperwidth}%
       
   285       {\hspace*{15mm}%
       
   286        \parbox[c]{.35\paperwidth}{\fontsize{18pt}{20pt}%
       
   287           \raggedright\normalfont\sffamily \selectfont
       
   288           \color{titlecolor} \@title\\[6pt]
       
   289           {\normalsize\rmfamily\scshape\@author}}%
       
   290 %          {\footnotesize\textsc{keywords:} \@keywords}}%
       
   291         \hfill
       
   292         \parbox[c][2in][c]{1mm}{\color{topverticalrule}%
       
   293           \rule{.1pt}{2in}}%
       
   294         \hfill
       
   295         \parbox[c][2in][c]{.35\paperwidth}%
       
   296         {\normalfont\footnotesize\sffamily\color{quicklinkcolor}%
       
   297            \vspace*{6pt} QUICK LINKS\Hrule
       
   298             \IfFileExists{tmp.out}{\input tmp.out}{}%
       
   299          }\hspace*{5mm}%
       
   300       }%
       
   301     }%
       
   302   }%
       
   303 }
       
   304 \gdef\botstring{\fcolorbox{botrulecolor}{botbgcolor}%
       
   305     {\parbox[t][.5in][t]{\paperwidth}%
       
   306       {\normalfont\sffamily\footnotesize%
       
   307         \color{botcolor}%
       
   308         \hspace*{5mm}\parbox[c][.5in][c]{.45\paperwidth}%
       
   309          {\raggedright \textcopyright\ 2009, Elsevier Ltd.
       
   310 %           \href{http://www.river-valley.com}{%
       
   311 %            http://www.river-valley.com}\\
       
   312 %            \textsc{sjp} Building, Cotton Hills, Trivandrum
       
   313 %           695014, India\\  9, Browns Court, Kennford,
       
   314 %           Exeter, United Kingdom          
       
   315           Bugs, feature requests, suggestions and comments\\
       
   316           shall be mailed to \href{mailto:elsarticle@river-valley.com}
       
   317           {$<$elsarticle@river-valley.com$>$}. 
       
   318         }\hfill%
       
   319        \parbox[c][.5in][c]{1cm}
       
   320         {\centering\sffamily\mdseries
       
   321           \fcolorbox{pgrulecolor}{pgbgcolor}{\thepage}%
       
   322         }\hfill
       
   323        \parbox[c][.5in][c]{.45\paperwidth}
       
   324         {\raggedleft\begin{tabular}{rl}%
       
   325           Version:&\@version\\
       
   326           Date:&\@date\\
       
   327           Contact:&\@contact
       
   328          \end{tabular}\hspace*{5mm}%
       
   329         }%
       
   330       }%
       
   331     }%
       
   332   }
       
   333 
       
   334 \def\MacroFont{\fontencoding\encodingdefault
       
   335         \fontfamily\ttdefault
       
   336         \fontseries\mddefault
       
   337         \fontshape\updefault
       
   338         \color{verbcolor}\small}%
       
   339 
       
   340 \def\verbatim@font{\normalfont\color{verbcolor}\ttfamily}
       
   341 
       
   342 \def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
       
   343   \bgroup
       
   344     \verb@eol@error \let\do\@makeother \dospecials
       
   345     \verbatim@font\@noligs
       
   346     \@ifstar\@sverb\@verb}
       
   347 
       
   348 
       
   349 \def\@lbr{\expandafter\@gobble\string\{}
       
   350 \def\@rbr{\expandafter\@gobble\string\}}
       
   351 \def\@bsl{\expandafter\@gobble\string\\}
       
   352 \def\@Bsl#1{\texttt{\@bsl#1}\xspace}
       
   353 \def\trics#1{\protect\@Bsl{#1}}
       
   354 \def\onecs#1{\protect\@Bsl{#1}}
       
   355 %\let\trics\onecs
       
   356 \@ifundefined{c@Glossary}{}{\c@GlossaryColumns=1
       
   357   \c@IndexColumns=2}
       
   358 
       
   359 \def\index@prologue{\section{Index}%
       
   360                  \markboth{Index}{Index}%
       
   361 %                  Numbers written in italic refer to the page
       
   362 %                  where the corresponding entry is described;
       
   363 %                  numbers underlined refer to the
       
   364 %                  \ifcodeline@index
       
   365 %                    code line of the
       
   366 %                  \fi
       
   367 %                  definition; numbers in roman refer to the
       
   368 %                  \ifcodeline@index
       
   369 %                    code lines
       
   370 %                  \else
       
   371 %                    pages
       
   372 %                  \fi
       
   373 %                  where the entry is used.
       
   374                  }
       
   375 
       
   376 \@ifundefined{theglossary}{}{%
       
   377 \renewenvironment{theglossary}{%
       
   378    \glossary@prologue%][\GlossaryMin]%
       
   379     \GlossaryParms \let\item\@idxitem \ignorespaces}%
       
   380    {}}
       
   381 
       
   382 \newenvironment{decl}[1][]%
       
   383     {\par\small\addvspace{1.5ex plus 1ex}%
       
   384      \vskip -\parskip
       
   385      \ifx\relax#1\relax
       
   386         \def\@decl@date{}%
       
   387      \else
       
   388         \def\@decl@date{\NEWfeature{#1}}%
       
   389      \fi
       
   390      \noindent%\hspace{-\leftmargini}%
       
   391      \begin{tabular}{l}\hline\ignorespaces}%
       
   392     {\\\hline\end{tabular}\nobreak\@decl@date\par\nobreak
       
   393      \vspace{0.75ex}\vskip -\parskip\ignorespacesafterend\noindent}
       
   394 
       
   395 \newif\ifhave@multicol
       
   396 \newif\ifcodeline@index
       
   397 
       
   398 \IfFileExists{multicol.sty}{\have@multicoltrue
       
   399                             \RequirePackage{multicol}%
       
   400                            }{}
       
   401 
       
   402 \newdimen\IndexMin         \IndexMin       = 80pt
       
   403 \newcount\c@IndexColumns   \c@IndexColumns = 2
       
   404 \ifhave@multicol
       
   405   \renewenvironment{theindex}
       
   406     {\begin{multicols}\c@IndexColumns[\index@prologue][\IndexMin]%
       
   407       \IndexParms \let\item\@idxitem \ignorespaces}%
       
   408     {\end{multicols}}
       
   409 \else
       
   410   \typeout{Can't find multicol.sty -- will use normal index layout if
       
   411      necessary.}
       
   412   \def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
       
   413     \columnseprule \z@  \columnsep 35\p@
       
   414     \twocolumn[\index@prologue]%
       
   415     \IndexParms \let\item\@idxitem \ignorespaces}
       
   416   \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
       
   417 \fi
       
   418 \long\def\IndexPrologue#1{\@bsphack\def\index@prologue{#1}\@esphack}
       
   419 \@ifundefined{index@prologue}
       
   420      {\def\index@prologue{\section{Index}%
       
   421                  \markboth{Index}{Index}%
       
   422 %                  Numbers written in italic refer to the page
       
   423 %                  where the corresponding entry is described;
       
   424 %                  numbers underlined refer to the
       
   425 %                  \ifcodeline@index
       
   426 %                    code line of the
       
   427 %                  \fi
       
   428 %                  definition; numbers in roman refer to the
       
   429 %                  \ifcodeline@index
       
   430 %                    code lines
       
   431 %                  \else
       
   432 %                    pages
       
   433 %                  \fi
       
   434 %                  where the entry is used.
       
   435                  }}{}
       
   436 \@ifundefined{IndexParms}
       
   437     {\def\IndexParms{%
       
   438        \parindent \z@
       
   439        \columnsep 15pt
       
   440        \parskip 0pt plus 1pt
       
   441        \rightskip 15pt
       
   442        \mathsurround \z@
       
   443        \parfillskip=-15pt
       
   444         \footnotesize
       
   445        \def\@idxitem{\par\hangindent 30pt}%
       
   446        \def\subitem{\@idxitem\hspace*{15pt}}%
       
   447        \def\subsubitem{\@idxitem\hspace*{25pt}}%
       
   448        \def\indexspace{\par\vspace{10pt plus 2pt minus 3pt}}%
       
   449       }}{}
       
   450 \def\efill{\hfill\nopagebreak}%
       
   451 \def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus  1fill}%
       
   452 \def\dotfil{\leaders\hbox to.6em{\hss .\hss}\hfil}%
       
   453 \def\pfill{\unskip~\dotfill\penalty500\strut\nobreak
       
   454                \dotfil~\ignorespaces}%
       
   455 
       
   456 \let\scan@allowedfalse\relax
       
   457 
       
   458 \def\tlformat#1{\begingroup\Large
       
   459   \parbox[c][1.25em][c]{1.25em}{\centering\fontfamily{phv}
       
   460   \fontseries{m}%
       
   461   \selectfont\color{white}\huge#1}%
       
   462   \endgroup}
       
   463 \def\tlFormat#1{\begingroup\Large
       
   464   \parbox[c][1.25em][c]{1.25em}{\centering\fontfamily{phv}
       
   465   \fontseries{m}%
       
   466   \selectfont\color{black}\huge#1}%
       
   467   \endgroup}
       
   468 \def\cvrlogo{\begingroup\fboxsep=2pt
       
   469   \colorbox{olive}{\tlformat{c}}%
       
   470   \colorbox{blue}{\tlformat{v}}%
       
   471   \colorbox{red}{\tlformat{r}}
       
   472   \endgroup}
       
   473 
       
   474 
       
   475 \endinput
       
   476 
       
   477 %%
       
   478 %% End of file 'rvdtx.sty'
       
   479 %%