diff options
Diffstat (limited to 'macros/latex/contrib/formular/formular.sty')
-rw-r--r-- | macros/latex/contrib/formular/formular.sty | 340 |
1 files changed, 340 insertions, 0 deletions
diff --git a/macros/latex/contrib/formular/formular.sty b/macros/latex/contrib/formular/formular.sty new file mode 100644 index 0000000000..9c4a8b5173 --- /dev/null +++ b/macros/latex/contrib/formular/formular.sty @@ -0,0 +1,340 @@ +%% +%% This is file `formular.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% formular.dtx +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from formular.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file formular.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +\def\fileversion{v1.0a -- (c) 2001 by Hans-Christoph Wirth} +\def\filedate{2005/06/15} +%% +%% Copyright 2001 Hans-Christoph Wirth (hcw@gmx.de) +%% +%% This program/package may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% of this license or (at your option) any later version. +%% The latest version of this license is available at +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% The quintessence of LPPL is: +%% - Distribute the package only in its full contents +%% - If you modify any files, rename them before +%% +%% This program/package consists of the files +%% formular.ins (driver file) +%% formular.dtx (source and documentation) +%% formular.sty (actual style file, generated) +%% formular.dvi (documentation, generated) +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{formular}[\filedate \space \fileversion] + +\RequirePackage{xspace} +\def\FRM@err{\PackageError{formular}} +\def\FRM@warn{\PackageWarning{formular}} + +\newlength\frm@margin +\newlength\frm@baselineskip +\newbox\frm@namebx +\newbox\frm@contbx +\newcount\frm@cnt +\newcount\frm@lbound +\newif\iffrm@breakstyle +\newif\iffrm@ruledstyle + +\newcommand{\FRM@generatesetcommand}[1]{% + \expandafter + \newcommand\expandafter{\csname setFRM#1\endcsname}[2][]{% + \ifx##1\relax\relax + \expandafter\def\csname frm@#1\endcsname{##2}\else + \@ifundefined{frm@##1@content} + {\FRM@err{FRMfield `##1' not declared.}}{% + \expandafter\def\csname frm@##1@#1\endcsname{##2}}\fi + } + } +\newcommand{\FRM@generatesetstylecommand}[3]{% + \expandafter + \newcommand\expandafter{\csname setFRM#1style\endcsname}[1][]{% + \ifx##1\relax\relax + \csname frm@#2style#3\endcsname \else + \@ifundefined{frm@##1@content} + {\FRM@err{FRMfield `##1' not declared.}}{% + \expandafter\let\csname iffrm@##1@#2style\expandafter + \endcsname \csname if#3\endcsname }\fi + } + } +\newcommand{\FRM@generatesetlengthcommand}[1]{% + \expandafter + \newcommand\expandafter{\csname setFRM#1\endcsname}[2][]{% + \ifx##1\relax\relax + \csname frm@#1\endcsname=##2\relax \else + \@ifundefined{frm@##1@content} + {\FRM@err{FRMfield `##1' not declared.}}{% + \expandafter\def\csname frm@##1@#1\endcsname{##2}}\fi + } + } + +\FRM@generatesetcommand{content} +\FRM@generatesetcommand{description} +\FRM@generatesetcommand{rulewidth} +\setFRMrulewidth{0.1pt} +\FRM@generatesetcommand{rulesep} +\setFRMrulesep{2pt} + +\FRM@generatesetstylecommand{plain}{ruled}{false} +\FRM@generatesetstylecommand{ruled}{ruled}{true} +\def\frm@width{0pt} + +\FRM@generatesetlengthcommand{margin} +\setFRMmargin{5pt} +\FRM@generatesetlengthcommand{baselineskip} +\setFRMbaselineskip{18pt} +\FRM@generatesetstylecommand{break}{break}{true} +\FRM@generatesetstylecommand{inline}{break}{false} +\frm@lbound=0 + +\FRM@generatesetcommand{fontencoding} +\FRM@generatesetcommand{fontsize} +\FRM@generatesetcommand{fontfamily} +\FRM@generatesetcommand{fontseries} +\FRM@generatesetcommand{fontshape} +\setFRMfontencoding{T1} +\setFRMfontsize{10} +\setFRMfontfamily{cmtt} +\setFRMfontseries{m} +\setFRMfontshape{n} + +\FRM@generatesetcommand{dfontencoding} +\FRM@generatesetcommand{dfontsize} +\FRM@generatesetcommand{dfontfamily} +\FRM@generatesetcommand{dfontseries} +\FRM@generatesetcommand{dfontshape} +\setFRMdfontencoding{T1} +\setFRMdfontsize{6} +\setFRMdfontfamily{cmss} +\setFRMdfontseries{m} +\setFRMdfontshape{n} + +\newcommand{\FRM@storeappearance}[1]{% + \expandafter\let\csname frm@#1@content\endcsname \frm@content + \expandafter\let\csname frm@#1@description\endcsname \frm@description + \expandafter\let\csname iffrm@#1@breakstyle\endcsname \iffrm@breakstyle + \expandafter\let\csname iffrm@#1@ruledstyle\endcsname \iffrm@ruledstyle + \expandafter\let\csname frm@#1@width\endcsname \frm@width + \expandafter\let\csname frm@#1@rulewidth\endcsname \frm@rulewidth + \expandafter\let\csname frm@#1@rulesep\endcsname \frm@rulesep + \expandafter\edef\csname frm@#1@lbound\endcsname{\the\frm@lbound} + \expandafter\edef\csname frm@#1@baselineskip\endcsname{\the\frm@baselineskip} + \expandafter\edef\csname frm@#1@margin\endcsname{\the\frm@margin} + \expandafter\let\csname frm@#1@fontfamily\endcsname \frm@fontfamily + \expandafter\let\csname frm@#1@fontseries\endcsname \frm@fontseries + \expandafter\let\csname frm@#1@fontsize\endcsname \frm@fontsize + \expandafter\let\csname frm@#1@fontshape\endcsname \frm@fontshape + \expandafter\let\csname frm@#1@fontencoding\endcsname \frm@fontencoding + \expandafter\let\csname frm@#1@dfontfamily\endcsname \frm@dfontfamily + \expandafter\let\csname frm@#1@dfontseries\endcsname \frm@dfontseries + \expandafter\let\csname frm@#1@dfontsize\endcsname \frm@dfontsize + \expandafter\let\csname frm@#1@dfontshape\endcsname \frm@dfontshape + \expandafter\let\csname frm@#1@dfontencoding\endcsname \frm@dfontencoding + } +\newcommand{\FRM@restoreappearance}[1]{% + \expandafter\let\expandafter\frm@content + \csname frm@#1@content\endcsname + \expandafter\let\expandafter\frm@description + \csname frm@#1@description\endcsname + \expandafter\let\expandafter\iffrm@breakstyle + \csname iffrm@#1@breakstyle\endcsname + \expandafter\let\expandafter \iffrm@ruledstyle + \csname iffrm@#1@ruledstyle\endcsname + \expandafter\let\expandafter\frm@width + \csname frm@#1@width\endcsname + \expandafter\let\expandafter\frm@rulewidth + \csname frm@#1@rulewidth\endcsname + \expandafter\let\expandafter\frm@rulesep + \csname frm@#1@rulesep\endcsname + \expandafter + \frm@lbound\expandafter=\csname frm@#1@lbound\endcsname + \expandafter + \frm@baselineskip=\csname frm@#1@baselineskip\endcsname + \expandafter + \frm@margin=\csname frm@#1@margin\endcsname + \expandafter\let\expandafter\frm@fontencoding + \csname frm@#1@fontencoding\endcsname + \expandafter\let\expandafter\frm@fontseries + \csname frm@#1@fontseries\endcsname + \expandafter\let\expandafter\frm@fontshape + \csname frm@#1@fontshape\endcsname + \expandafter\let\expandafter\frm@fontsize + \csname frm@#1@fontsize\endcsname + \expandafter\let\expandafter\frm@fontfamily + \csname frm@#1@fontfamily\endcsname + \expandafter\let\expandafter\frm@dfontencoding + \csname frm@#1@dfontencoding\endcsname + \expandafter\let\expandafter\frm@dfontseries + \csname frm@#1@dfontseries\endcsname + \expandafter\let\expandafter\frm@dfontshape + \csname frm@#1@dfontshape\endcsname + \expandafter\let\expandafter\frm@dfontsize + \csname frm@#1@dfontsize\endcsname + \expandafter\let\expandafter\frm@dfontfamily + \csname frm@#1@dfontfamily\endcsname + } + +\newcommand{\FRM@selectfont}{% + \fontsize{\frm@fontsize}{\the\frm@baselineskip}% + \usefont{\frm@fontencoding}{\frm@fontfamily} + {\frm@fontseries}{\frm@fontshape}% +} +\newcommand{\FRM@selectdfont}{% + \fontsize{\frm@dfontsize}{\the\frm@baselineskip}% + \usefont{\frm@dfontencoding}{\frm@dfontfamily} + {\frm@dfontseries}{\frm@dfontshape}% +} + +\newcommand{\newFRMfield}[1]{% + \@ifundefined{frm@#1@content} + {\new@FRMfield{#1}}{\FRM@err{cannot + \string\new... existing field `#1'}} +} +\newcommand{\renewFRMfield}[1]{% + \@ifundefined{frm@#1@content} + {\FRM@err{cannot \string\renew... undeclared + field `#1'}}{\new@FRMfield{#1}} +} +\def\new@FRMfield#1#2{% + \@ifnextchar[%] + {\new@FRMfield@{#1}{#2}}{\new@FRMfield@@{#1}{#2}[][]}} +\def\new@FRMfield@#1#2[#3]{% + \@ifnextchar[%] + {\new@FRMfield@@{#1}{#2}[#3]}{\new@FRMfield@@{#1}{#2}[#3][]}} +\def\new@FRMfield@@#1#2[#3][#4]{% + \def\frm@width{#2} + \def\frm@description{#3} + \def\frm@content{#4} + \FRM@storeappearance{#1} + \new@FRMcontainerhook{#1} +} + +\let\new@FRMcontainerhook\@gobble +\def\new@FRMfieldspecials#1{% + \expandafter\def\csname set#1\endcsname##1{\setFRMcontent[#1]{##1}} +} + +\newcommand{\useFRMfield}[1]{% + \@ifundefined{frm@#1@content} + {\FRM@err{FRMfield `#1' is not declared.}} + {\use@FRMfield{#1}} +} +\def\use@FRMfield#1{% + \@ifnextchar[%] + {\use@FRMfield@{#1}} + {\use@FRMfield@{#1}[\csname frm@#1@content\endcsname]\xspace} +} +\def\use@FRMfield@#1[#2]{\begingroup + \FRM@restoreappearance{#1}% + \setbox\frm@contbx=\hbox{% + \FRM@selectfont + \kern\frm@margin #2\kern\frm@margin}% + \dp\frm@contbx0pt\relax + \leavevmode + \vtop to \frm@rulesep{% + \halign{\hfil##\hfil\cr + {\usebox{\frm@contbx}}\cr + \noalign{\kern\frm@rulesep + \iffrm@ruledstyle + \dimen0=\frm@fontsize pt\dimen2=0pt\relax + \loop + \kern-2pt\advance\dimen2 by 2pt% + \hrule height\frm@rulewidth \kern-\frm@rulewidth + \advance\dimen0 by-2pt% + \ifnum\dimen0>0% + \repeat + \kern\dimen2\relax + \fi + \hrule height\frm@rulewidth depth0pt \kern2pt}% + \FRM@selectdfont \frm@description\cr + \vrule width \frm@width height 0pt\cr}\vss + }\endgroup + } + +\newcommand{\newFRMenvironment}[3]{% + \def\frm@description{#2}% + \frm@lbound=#3\relax + \FRM@storeappearance{env@#1}% + \newenvironment{#1}{% + \FRM@restoreappearance{env@#1}% + \@ifnextchar[%] + {\FRM@openenvironment} + {\FRM@openenvironment[\the\frm@lbound]}% + }{% + \FRM@closeenvironment% + }% +} +\def\FRM@openenvironment[#1]{% + \frm@lbound=#1\relax + \setbox\frm@namebx\hbox + \iffrm@breakstyle to\hsize\fi + {\frm@description\enspace + \skip0=\frm@baselineskip \advance\skip0-\frm@rulesep + \vrule width0pt height \skip0\hfil}% + \setbox\frm@contbx=\vtop\bgroup + \advance\hsize-2\frm@margin + \hskip-\frm@margin + \hskip\wd\frm@namebx + \hskip-\frm@margin\penalty0\relax + \hskip2\frm@margin + \FRM@selectfont + } +\newcommand{\FRM@closeenvironment}{% + \par\egroup + \frm@cnt=\dp\frm@contbx + \dimen0=\frm@baselineskip + \divide\frm@cnt\dimen0\relax + \leavevmode\rlap{\dp\frm@contbx0pt \kern\frm@margin \usebox\frm@contbx}% + \raise-\frm@rulesep\vtop{% + \hbox to\hsize{% + \dp\frm@namebx0pt% + \raise\frm@rulesep\hbox{\usebox{\frm@namebx}}\leaders \hrule + height \frm@rulewidth \hfill} + \iffrm@breakstyle\else \advance\frm@lbound-1\fi\relax + \ifnum\frm@cnt>\frm@lbound\relax + \@tempcnta\frm@cnt \advance\@tempcnta-\frm@lbound\relax + \FRM@warn{Line bound in FRMenvironment exceeded by + \the\@tempcnta\space line(s)} + \else \frm@cnt\frm@lbound \fi + \loop + \ifnum\frm@cnt>0\relax + \advance\frm@cnt-1\relax + \kern\frm@baselineskip \kern-\frm@rulewidth + \hrule height \frm@rulewidth\relax + \repeat + }% + } + +\long\def\newFRMcontainer#1#2#3{% + \FRM@storeappearance{con@#1}% + \newenvironment{#1}{% + \let\new@FRMcontainerhook=\new@FRMfieldspecials + \FRM@restoreappearance{con@#1}#2}{#3} +} + +\endinput +%% +%% End of file `formular.sty'. |