%
% This file is Copyright (C) 1993, Konrad Schroder.
% You are free to distribute it as you will.
% If you modify it, you must note your modifications with your name.
%

\newdimen\ksmversion \ksmversion=1.5pt
\newdimen\docversion \docversion=0.0pt

%
% One, and only one, of the following lines should be uncommented.
%
% Uncomment the first if you want to include the EPS diagrams in the TeX
% output: (note that your dvi driver has to support this, and you have
% to have the file epsf.tex where TeX can find it.)
%
%\input epsf
%
% Uncomment the second if you'd rather not see the diagrams (they will
% appear as a cm or two of blank space).
\def\epsfbox#1{}
%

\def\warnifold{\ifdim\ksmversion < \docversion \message{Warning: This
document expects a newer version of ks_macros.tex!}\fi}

\font\sc=cmr7 at 6.5pt
\font\eighteenrm=cmr17 at 18pt
\font\fourteenrm=cmr12 at 14pt
\font\twelverm=cmr12
\font\twelvebf=cmbx12
\font\tenrm=cmr10
\font\eightrm=cmr8
\font\sixrm=cmr6
\tenrm

%
% For later use in \linesby, \lineis
%

\def\residue#1#2{\loop \ifnum 0 < #1 \advance #1 by -#2 \repeat
    \ifnum #1 < 0 \advance #1 by #2 \fi}

% Typing ``{\u e}'' every time I want breve-e is really a pain; so, I've
% redefined ``\,'', since we don't use math mode in the Libellus texts
% anyway.
%

\def\,#1{{\accent21 #1}}

%
% If the user doesn't have the greek .tfm files, but doesn't have any
% Greek in his MS, he should still be able to use TeX on it!
%
% If he is using Greek, though, he will have to get Levy's .tfm and .pk
% files, and his ``greekmacros.tex'' file.
%

\def\greekfollows{
    \input greekmacros
    \def\greek{\greekmode\greektrue\tengr}
    \def\grbf{\greekmode\greektrue\tengrbf}
               }

\def\pounds{{\it\$\/}}

%
% \sectc  numbers the sections (starts at 1, so we use \chap instead of
%         \chap\sec.
% \chapc  numbers the chapters; starts at 0 since we have \chap at the top.
% \isectc numbers independent sections; like \sectc, but does not reset
%         for individual chapters.  Starts at 0 like \chap.
%

\newcount\sectc \newcount\chapc
\newcount\linec \newcount\Clinec
\newcount\isectc
\chapc=0 \sectc=1 \isectc=0

\def\strutdepth{\dp\strutbox}
\def\noheightchar#1{\vtop to \strutdepth
       {\baselineskip\strutdepth
       \vss\llap{#1}\null}}
\def\noheightrightchar#1{\vtop to \strutdepth
       {\baselineskip\strutdepth\vss\rlap{#1}\null}}

\def\chap{\sectc=1 \advance\chapc by 1
       \strut\vadjust{\kern-\strutdepth\noheightchar{\hskip\leftskip \bf\number\chapc\ }}}

%\def\sec{\advance\sectc by 1
%       \strut\vadjust{\kern-\strutdepth\noheightchar{\hskip\leftskip \sc\number\sectc\ }}}

\def\isec{\advance\isectc by 1
               \strut\vadjust{\kern-\strutdepth\hskip \hsize minus 20pt % kluge
                       \noheightrightchar{\hskip 2pt\sc\number\isectc\ }}}

\def\sec{\advance\sectc by 1
               \strut\vadjust{\kern-\strutdepth\hskip \hsize minus 20pt % kluge
                       \noheightrightchar{\hskip 2pt\sc\number\sectc\ }}}

\def\linesbyfive{\linec=-1 \Clinec=0
       \everypar{\hangindent 2\parindent
               \advance\linec by 1 \advance \Clinec by 1
               \ifnum\Clinec=5 \Clinec=0
               \strut\vadjust{\kern-\strutdepth\hskip \hsize plus \rightskip
                       \noheightrightchar{\sc\number\linec\ }}\fi}
       }

\def\lineis#1{\linec=#1
         \Clinec=\linec \residue{\Clinec}{5}
         \advance\linec by -2 \advance\Clinec by -1
               \strut\vadjust{\kern-\strutdepth\hskip \hsize plus \rightskip
                       \noheightrightchar{\sc\number\linec\ }}}

\def\poetrysize{\hsize=3.6in \rightskip=-2em}