<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%***************************************************************
%
%% betababel.sty
%% Copyright 2005 Felix G. Berkemeier
% 
%
% This work may be distributed and/or modified under the 
% conditions of the LaTeX Project Public License, either 
% version 1.3 of this license or (at your option) any later 
% version.
% 
% The latest version of this license is in
% 
%   http://www.latex-project.org/lppl.txt
%   
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% Please report errors to: felix.berkemeier@gmx.de
% 
% This work consists of the file betababel.sty
% 
%***************************************************************

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{betababel}%
  [2005/07/10 v0.5 betababel.sty Beta Code for Babel package]

\IfFileExists{teubner.sty}%
{%
	\def\TeubnerLo@ded{}
	\PassOptionsToPackage{greek}{babel}
	\DeclareOption{polutonikogreek}{}
	\DeclareOption{greek}{}
	\DeclareOption*{%
	  \PassOptionsToPackage{\CurrentOption}{babel}%
	}
	\ProcessOptions\relax
	\RequirePackage{babel}
	\RequirePackage{teubner}%
}%
{%
	\PassOptionsToPackage{polutonikogreek}{babel}
	\DeclareOption{polutonikogreek}{}
	\DeclareOption{greek}{}
	\DeclareOption*{%
	  \PassOptionsToPackage{\CurrentOption}{babel}%
	}
	\ProcessOptions\relax
	\RequirePackage{babel}%
}

%***************************************************************

\newlength\betaskip
\setlength\betaskip{\medskipamount}

{%
	\catcode`$=0
	\catcode`$\=12
	$catcode`$&amp;=6
	$catcode`$#=12
	$catcode`$==12
	$gdef$Terminus{Terminus}
	$gdef$empty@{}
	$newcount$suffix@
	$suffix@=-48
	$newcount$Bet@Mode
	$newcount$FirstP@r
	$newcount$FirstWord@
	$newcount$Ch@rCode
	
	$gdef$SigmaW@rning&amp;1{$gdef$GreekCh@r{}$PackageWarning{betababel}{The BetaCode s&amp;1 does not exist for greek characters}}
	$gdef$LunateW@rning{$PackageWarning{betababel}{The Lunate Sigma (BetaCode: s3) is not implemented (yet?)!}}
	$gdef$SubDotW@rning{$PackageWarning{betababel}{The Subscript Dot (BetaCode: ?) is not implemented (yet?)!}}
	$gdef$JW@rning{$PackageError{betababel}{'J' and 'j' aren't valid characters in BetaCode! You shouldn't use them, because they can make betababel interrupt. Please remove them from your source or replace them by 'S' or 's'}{You can continue typesetting by pressing &lt;return&gt;, but maybe betababel has ignored some of the BetaCode text you wanted to be typeset. You should correct your document and eliminate every 'J' or 'j' within the BetaCode.}}
	$gdef$HashW@rning{$PackageWarning{betababel}{There is no BetaCode '*#'. Therefore those two characters have been ignored}}
	$gdef$H@shWarning&amp;1{$PackageWarning{betababel}{The extended functionality of betababel (e.g. all the codes containing the hash character '#') only works when teubner.sty is installed. Unless your TeX finds teubner.sty, all the unusable characters will be ignored --- as e.g. the &amp;1 }}
	
	$gdef$SetCodes@{%
		$lccode`(=0$lccode`)=0
		$lccode`[=0$lccode`]=0
		$lccode`+=0$lccode`/=0
		$lccode`$==0$lccode`|=0
		$uccode`(=0$uccode`)=0
		$uccode`[=0$uccode`]=0
		$uccode`+=0$uccode`/=0
		$uccode`$==0$uccode`|=0
		$lccode`-=0$lccode`_=0
		$lccode`.=0$lccode`,=0
		$lccode`:=0$lccode`;=0
		$lccode`'=0$lccode`?=0
	}
	
	$long$gdef$s@veText&amp;1{$xdef$TextToTypeset@{&amp;1}}
	$gdef$@ddToText{$let$tempString@$TextToTypeset@$addToText@}
	$long$gdef$addToText@&amp;1{$s@veText{$tempString@&amp;1}}
	$gdef$@ddCharToText{$let$tempString@$TextToTypeset@$addCh@rToText}
	$gdef$addCh@rToText&amp;1{$s@veText{$tempString@$char&amp;1}}
	$gdef$@ddCsToText{$let$tempString@$TextToTypeset@$addCsToText@}
	$gdef$addCsToText@&amp;1{$s@veText{$tempString@$myProtect@$csname&amp;1$endcsname}}
		
	$gdef$bcode{%
		$expandafter$ifx$csname TeubnerLo@ded$endcsname$relax$fi
		$def$TextToTypeset@{}%
		$Bet@Mode=1
		$FirstP@r=1
		$noindent
		$begingroup
		$catcode`$=0
		$catcode`$\=12
		$catcode`$&amp;=6
		$catcode`$#=12
		$catcode`$==12
		$Bet@Code
	}
	
	$long$gdef$betacode{%
		$expandafter$ifx$csname TeubnerLo@ded$endcsname$relax$fi
		$def$TextToTypeset@{}%
		$Bet@Mode=0
		$vspace{$betaskip}
		$begingroup
		$catcode`$=0
		$catcode`$\=12
		$catcode`$&amp;=6
		$catcode`$#=12
		$catcode`$==12
		$Bet@Environment
	}
	
	$long$gdef$Bet@Environment&amp;1\end{%
		$SetCodes@
		$gdef$myProtect@{$noexpand$myProtect@$noexpand}%
		$ReadP@r&amp;1$par Terminus$par
		$endgroup
%		$message{Final:$TextToTypeset@}% Just for debug purposes
		$gdef$myProtect@{}%
		$foreignlanguage{polutonikogreek}{$obeyspaces$TextToTypeset@}
		$end
	}
	
	$long$gdef$endbetacode{%
		$par$vspace{$betaskip}
	}
	
	$long$gdef$Bet@Code&amp;1{%
		$SetCodes@
		$gdef$myProtect@{$noexpand$myProtect@$noexpand}%
		$ReadP@r&amp;1$par Terminus$par
		$endgroup
%		$message{Final:$TextToTypeset@}% Just for debug purposes
		$gdef$myProtect@{}%
		$foreignlanguage{polutonikogreek}{$obeyspaces$TextToTypeset@}%
	}
	
	$gdef$ReadP@r&amp;1$par{%
	  $gdef$p@rTemp{&amp;1}%
	  $ifx$p@rTemp$Terminus%
	  $else
	    $ifcase$Bet@Mode$@ddToText{$par}$or%
	      $ifnum$FirstP@r=1$FirstWord@=1$FirstP@r=0$else$@ddToText{$par$noindent}$fi%
	    $fi%
	    $Re@dWord&amp;1 J 
	    $expandafter$ReadP@r
	  $fi
	}
	
	$gdef$Re@dWord&amp;1 {%
	  $gdef$wordTemp@{&amp;1}%
	  $if&amp;1J%
	  $else$ifx$wordTemp@$empty@
	    $else
	      $ifnum$FirstWord@=1$FirstWord@=0$else$@ddToText{{ }}$fi%
	      $ReadCh@r&amp;1 JJJJJJ$Terminus
	    $fi
	    $expandafter$Re@dWord
	  $fi
	}

	$gdef$ReadCh@r&amp;1&amp;2&amp;3&amp;4&amp;5&amp;6$Terminus{%
%	  $message{&amp;1,&amp;2,&amp;3,&amp;4,&amp;5,&amp;6; }% Just for debug purposes
	  $lowercase{$if&amp;1}j%
	    $lowercase{$if&amp;2}j%
	    $else$JW@rning$ReadCh@r&amp;2&amp;3&amp;4&amp;5&amp;6$Terminus
	    $fi
	  $else$if&amp;1*%
	      $if&amp;2#%
	        $ifx$TeubnerLo@ded$relax
	          $H@shWarning{&amp;2}%
	          $ReadCh@r&amp;3&amp;4&amp;5&amp;6$Terminus
	        $else
	          $ifcase1&amp;3$or$HashW@rning$ReadCh@r&amp;3&amp;4&amp;5&amp;6$Terminus
	          $else$ifcase1&amp;4$or$H@ndleHash&amp;3jj$ReadCh@r&amp;4&amp;5&amp;6$Terminus
	            $else$ifcase1&amp;5$or$H@ndleHash&amp;3&amp;4j$ReadCh@r&amp;5&amp;6$Terminus
	              $else$H@ndleHash&amp;3&amp;4&amp;5$ReadCh@r&amp;6$Terminus
	              $fi
	            $fi
	          $fi
	        $fi
	      $else
	        $ifnum$lccode`&amp;2=0
	          $ifnum$lccode`&amp;3=0
	            $ifnum$lccode`&amp;4=0
	              $uppercase{$Bet@Spiritus&amp;2&amp;3&amp;4&amp;5}%
	              $ReadCh@r&amp;6$Terminus
	            $else$uppercase{$Bet@Spiritus&amp;2&amp;3j&amp;4}%
	              $ReadCh@r&amp;5&amp;6$Terminus
	            $fi
	          $else$uppercase{$Bet@Spiritus&amp;2jj&amp;3}%
	            $ReadCh@r&amp;4&amp;5&amp;6$Terminus
	          $fi
	        $else$lowercase{$if&amp;2}v%
	            $@ddCsToText{Digamma}%
	          $else
	            $uppercase{$Bet@Spiritus&amp;3&amp;4&amp;5&amp;2}%
	          $fi
	          $ReadCh@r&amp;3&amp;4&amp;5&amp;6$Terminus
	        $fi
	      $fi
	    $else$if&amp;1#%
	        $ifx$TeubnerLo@ded$relax
	          $H@shWarning{&amp;1}
	          $ReadCh@r&amp;2&amp;3&amp;4&amp;5&amp;6$Terminus
	        $else
	          $ifcase1&amp;2$or$@ddToText{$char254{}}$ReadCh@r&amp;2&amp;3&amp;4&amp;5&amp;6$Terminus
	          $else$ifcase1&amp;3$or$HandleH@sh&amp;2jj$ReadCh@r&amp;3&amp;4&amp;5&amp;6$Terminus
	            $else$ifcase1&amp;4$or$HandleH@sh&amp;2&amp;3j$ReadCh@r&amp;4&amp;5&amp;6$Terminus
	              $else$HandleH@sh&amp;2&amp;3&amp;4$ReadCh@r&amp;5&amp;6$Terminus
	              $fi
	            $fi
	          $fi
	        $fi
	      $else$ifnum$lccode`&amp;1=0
	          $ifnum`&amp;1=45$@ddToText{-}$fi%               -
	          $ifnum`&amp;1=95$@ddToText{--}$fi%              _ -&gt; --
	          $ifnum`&amp;1=46$@ddToText{.}$fi%               .
	          $ifnum`&amp;1=44$@ddToText{,}$fi%               ,
	          $ifnum`&amp;1=58$@ddToText{;}$fi%               : -&gt; ;
	          $ifnum`&amp;1=59$@ddToText{?}$fi%               ; -&gt; ?
	          $ifnum`&amp;1=39$@ddToText{''}$fi%              ' -&gt; ''
	          $ifnum`&amp;1=91$@ddToText{[}$fi%				[
	          $ifnum`&amp;1=93$@ddToText{]}$fi%				]
	          $ifnum`&amp;1=63$SubDotW@rning$fi%              ?
	        $else$lowercase{$if&amp;1}v%
	            $@ddCsToText{digamma}%
	          $else
	            $lowercase{$Bet@Spiritus&amp;2&amp;3&amp;4&amp;1}%
	          $fi
	        $fi
	        $ReadCh@r&amp;2&amp;3&amp;4&amp;5&amp;6$Terminus
	      $fi
	    $fi
	  $fi
	}
	
	$gdef$HandleH@sh&amp;1&amp;2&amp;3{% for unprefixed hashes: #...
%		$message{hash: &amp;1,&amp;2,&amp;3}% Just for debug purposes
		$ifcase1&amp;1$or$else
			$ifcase&amp;1$HandleH@sh&amp;2&amp;3j%
				$or$ifcase1&amp;2$or$@ddCsToText{koppa}%		#1
					$else$ifcase&amp;2%
						$or
						$or$ifcase1&amp;3$or$@ddToText{---}%	#12
							$fi
						$fi
					$fi
				$or$ifcase1&amp;2$or$@ddCsToText{stigma}%		#2
					$else$ifcase&amp;2%
						$or
						$or$ifcase1&amp;3$or$@ddToText{$char255{}}%	#22
							$fi
						$fi
					$fi
				$or$ifcase1&amp;2$or$@ddCsToText{coppa}%		#3
					$fi
				$or
				$or$ifcase1&amp;2$or$@ddCsToText{sampi}%		#5
					$fi
				$or$ifcase1&amp;2$or$@ddCsToText{paragr}%		#6
					$fi
				$or
				$or
				$or
			$else
			$fi
		$fi
	}
	
	$gdef$H@ndleHash&amp;1&amp;2&amp;3{% for hashes with asterisk prefix: *#...
%		$message{Hash: &amp;1,&amp;2,&amp;3}% Just for debug purposes
		$ifcase1&amp;1$or$else
			$ifcase&amp;1$H@ndleHash&amp;2&amp;3j%
				$or
				$or$ifcase1&amp;2$or$@ddCsToText{Stigma}%		*#2
					$fi
				$or$ifcase1&amp;2$or$@ddCsToText{Coppa}%		*#3
					$fi
				$or
				$or$ifcase1&amp;2$or$@ddCsToText{Sampi}%		*#5
					$fi
				$or
				$or
				$or
				$or
			$else
			$fi
		$fi
	}

	$gdef$Fin@lSigma&amp;1&amp;2{%
	  $lowercase{$if&amp;1}s%
	    $ifnum`&amp;2=45$suffix@=58
	    $else$ifnum`&amp;2=46$suffix@=58
	      $else$ifnum`&amp;2=44$suffix@=58
	        $else$ifnum`&amp;2=58$suffix@=58
	          $else$ifnum`&amp;2=59$suffix@=58
	            $else$ifnum`&amp;2=63$suffix@=58
	              $else$advance$suffix@`&amp;2
	              $fi
	            $fi
	          $fi
	        $fi
	      $fi
	    $fi
	  $fi
	}

	$gdef$Bet@Spiritus&amp;1&amp;2&amp;3&amp;4{%
	  $Fin@lSigma&amp;4&amp;1%
	  $if&amp;1($@ddToText{&lt;}$Bet@Accent&amp;2&amp;3&amp;4%
	  $else$if&amp;1)$@ddToText{&gt;}$Bet@Accent&amp;2&amp;3&amp;4%
	    $else$if&amp;1+$@ddToText{"}$Bet@Accent&amp;2&amp;3&amp;4%
	      $else$Bet@Accent&amp;1&amp;2&amp;4%
	      $fi
	    $fi
	  $fi
	}

	{%
		$catcode`$~=12
		$gdef$Bet@Accent&amp;1&amp;2&amp;3{%
	      $if&amp;1/$@ddToText{'}$Bet@IotaSigma&amp;2&amp;3%
	      $else$if&amp;1\$@ddToText{`}$Bet@IotaSigma&amp;2&amp;3%
	        $else$if&amp;1=$@ddToText{~}$Bet@IotaSigma&amp;2&amp;3%
	          $else$if&amp;1!$@ddToText{`}$Bet@IotaSigma&amp;2&amp;3% workaround, see below
	          $else$Bet@IotaSigma&amp;1&amp;3%
	          $fi% this is a workaround for the footnote bug (when using betacode within another command)
	          $fi
	        $fi
	      $fi
	    }
    }

	$gdef$Bet@IotaSigma&amp;1&amp;2{%
	  $if&amp;2s%
	    $ifcase$suffix@$expandafter$SigmaW@rning$number$suffix@
	      $or$@ddToText{sv}%
	      $or$@ddToText{c}%
	      $or$LunateW@rning
	      $or$expandafter$SigmaW@rning$number$suffix@
	      $or$expandafter$SigmaW@rning$number$suffix@
	      $or$expandafter$SigmaW@rning$number$suffix@
	      $or$expandafter$SigmaW@rning$number$suffix@
	      $or$expandafter$SigmaW@rning$number$suffix@
	      $or$expandafter$SigmaW@rning$number$suffix@
	    $else
	      $ifnum$suffix@=58$@ddToText{s}%
	      $else$@ddToText{sv}%
	      $fi
	    $fi
	  $else$Ch@rCode=`&amp;2
	    $lowercase{$if&amp;2}q$advance$Ch@rCode-7$fi
	    $lowercase{$if&amp;2}c$advance$Ch@rCode21$fi
	    $lowercase{$if&amp;2}x$advance$Ch@rCode-7$fi
	    $@ddCharToText{$number$Ch@rCode}%
	  $fi
	  $if&amp;1|$@ddToText{|}%
	  $fi
	  $suffix@=-48
	}
}
</pre></body></html>