% Copyright 2017 Levan Shoshiashvili shoshia@hotmail.com and Werner Lemberg <wl@gnu.org>.
% This file is part of georgiantex package.  License: LPPL, version 1.3 or newer,
% according to http://www.latex-project.org/lppl.txt
%
%
% georgian.ldf
%
%
% Changes
%
%     2.2 20/11/2017
%   Changed EU1,EU2 to TU encoding for utf-8 engines
%
%
%    2.1  17 Apr. 2014
%   Bugs fixed.
%
%
%    2.0 2013/06/06
%    Added unicode support similar to russianb.ldf 
%    
%     1.0  2012/09/21
%     First version.
%  
%
\ProvidesLanguage{georgian}
        [2017/11/20 2.2 Georgian support from the babel system]
\LdfInit{georgian}{captionsgeorgian}
\ifdefined\if@kauni@ode
  \PackageError{babel}{if@kauni@ode already defined.\MessageBreak
    Please contact author of georgian.ldf}
  \relax
\fi
\newif\if@kauni@ode
\ifdefined\luatexversion \@kauni@odetrue \else
\ifdefined\XeTeXrevision \@kauni@odetrue \fi\fi
\ifx\l@georgian\@undefined
  \@nopatterns{Georgian}
  \adddialect\l@georgian0
\fi
\def\@setgeorgianencoding{%
  \def\sce@a##1##2{%
    \edef\sce@b{##1}%
    \edef\sce@c{##2}%
    \ifx\sce@b\sce@c
      \let\georgiancoding\sce@c
    \fi}%
  \def\cdp@elt##1##2##3##4{%
    \sce@a{##1}{T8K}%
    \sce@a{##1}{T8M}%
    \if@kauni@ode
      \sce@a{##1}{TU}%EU1
      \sce@a{##1}{TU}%EU2
    \fi}%
  \cdp@list
}
\@setgeorgianencoding
\@onlypreamble\@setgeorgianencoding
\@onlypreamble\sce@a
\@onlypreamble\sce@b
\@onlypreamble\sce@c
\ifdefined\georgianencoding
\else
  \if@kauni@ode
    \ifdefined\XeTeXrevision
      \edef\georgianencoding{TU}
    \else\ifdefined\luatexversion
      \edef\georgianencoding{TU}
    \fi\fi
  \else
    \edef\georgianencoding{T8M}
  \fi
  \PackageWarning{babel}%
    {No Georgian font encoding has been loaded so far.\MessageBreak
     A font encoding should be declared before babel.\MessageBreak
     Default `\georgianencoding' encoding will be loaded
    }%
  \lowercase\expandafter{\expandafter\input\georgianencoding enc.def\relax}%
  \AtBeginDocument{\@setgeorgianencoding}
\fi
\DeclareRobustCommand{\Georgian}{\selectlanguage{\georgian}}
\DeclareRobustCommand{\georgiantext}{%
  \fontencoding\georgianencoding\selectfont
  \let\encodingdefault\georgianencoding
  \expandafter\set@hyphenmins\georgianhyphenmins
  \language\l@georgian}%
\let\geo\georgiantext
\expandafter\ifx\csname T@8M\endcsname\relax\else
  \DeclareTextSymbolDefault{\AA}{OT1}
  \DeclareTextSymbolDefault{\aa}{OT1}
  \DeclareTextCommand{\aa}{OT1}{\r a}
  \DeclareTextCommand{\AA}{OT1}{\r A}
\fi
\DeclareTextFontCommand{\textgeorgian}{\georgiantext}
\@ifpackageloaded{inputenc}{%
 \if@kauni@ode
   \PackageWarning{babel}{inputenc should not be used with LuaTeX or XeTeX}
 \fi
}{%
   \ifx\reserved@a\georgianencoding\else
       \def\reserved@a{TU}%
       \ifx\reserved@a\georgianencoding\else
          \def\reserved@a{TU}%
          \ifx\reserved@a\georgianencoding\else
             \PackageWarning{babel}%
                {No input encoding specified for Georgian language}
    \fi\fi\fi
  %\fi
}
\initiate@active@char{"}
\begingroup \catcode`\"12
\def\reserved@a{\endgroup
  \def\@SS{\mathchar"7019 }
  \def\dq{"}}
\reserved@a
\declare@shorthand{georgian}{"`}{\quotedblbase}
\declare@shorthand{georgian}{"'}{\textquotedblleft}
\declare@shorthand{georgian}{"<}{\guillemotleft}
\declare@shorthand{georgian}{">}{\guillemotright}
\declare@shorthand{georgian}{""}{\hskip\z@skip}
\declare@shorthand{georgian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
\declare@shorthand{georgian}{"=}{\nobreak-\hskip\z@skip}
\declare@shorthand{georgian}{"|}{%
  \textormath{\nobreak\discretionary{-}{}{\kern.03em}\allowhyphens}{}}
\declare@shorthand{georgian}{"-}{%
  \def\georgian@sh@tmp{%
    \if\georgian@sh@next-\expandafter\georgian@sh@emdash
    \else\expandafter\russian@sh@hyphen\fi}%
  \futurelet\georgian@sh@next\georgian@sh@tmp}
\def\georgian@sh@hyphen{\nobreak\-\bbl@allowhyphens}
\def\georgian@sh@emdash#1#2{\cdash-#1#2}
\def\cdash#1#2#3{\def\tempx@{#3}%
\def\tempa@{-}\def\tempb@{~}\def\tempc@{*}%
 \ifx\tempx@\tempa@\@Acdash\else
  \ifx\tempx@\tempb@\@Bcdash\else
   \ifx\tempx@\tempc@\@Ccdash\else
    \errmessage{Wrong usage of cdash}\fi\fi\fi}
\def\@Acdash{\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi
  \geodash\hskip.2em\ignorespaces}%
\def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi
 \nobreak\geodash\penalty\exhyphenpenalty\hskip\z@skip\ignorespaces}%
\def\@Ccdash{\leavevmode
 \nobreak\geodash\nobreak\hskip.35em\ignorespaces}%
\ifx\geodash\undefined
  \def\geodash{\hbox to.8em{--\hss--}}
  \PackageInfo{babel}{\string\geodash\space is defined}
\fi
\declare@shorthand{georgian}{",}{\nobreak\hskip.2em\ignorespaces}
\providehyphenmins{\CurrentOption}{\tw@\tw@}
\providehyphenmins{georgian}{\tw@\tw@}
\addto\extrasgeorgian{\georgiantext}
\addto\noextrasgeorgian{\latintext}
\addto\extrasgeorgian{\languageshorthands{georgian}}
\addto\extrasgeorgian{\bbl@activate{"}}
\addto\noextrasgeorgian{\bbl@deactivate{"}}
\addto\extrasgeorgian{\bbl@frenchspacing}
\addto\noextrasgeorgian{\bbl@nonfrenchspacing}
\def\Anbani#1{\expandafter\georgian@Alph\csname c@#1\endcsname}
\if@kauni@ode
  \def\georgian@Alph#1{\ifcase#1\or
    Ⴀ\or Ⴁ\or Ⴂ\or Ⴈ\or Ⴃ\or Ⴄ\or Ⴅ\or
    Ⴆ\or Ⴇ\or Ⴉ\or Ⴊ\or Ⴋ\or Ⴌ\or Ⴍ\or
    Ⴎ\or  Ⴏ\or Ⴐ\or Ⴑ\or Ⴒ\or Ⴓ\or Ⴔ\or Ⴕ\or
    Ⴖ\or Ⴗ\or Ⴘ\or Ⴙ\or Ⴚ\or Ⴛ\or Ⴜ\or
    Ⴝ\or Ⴞ\or Ⴟ\or Ⴠ\or Ⴡ\or Ⴢ\or Ⴣ\or Ⴤ\or Ⴥ\else\@ctrerr\fi}
\else
  \def\georgian@Alph#1{\ifcase#1\or
    \GEOA\or\GEOB\or\GEOG\or\GEOD\or\GEOE\or\GEOV\or\GEOZ\or
  \GEOTH\or\GEOI\or\GEOK\or\GEOL\or\GEOM\or\GEON\or\GEOO\or
  \GEOP\or\GEOZH\or\GEOR\or\GEOS\or\GEOT\or\GEOU\or\GEOPH\or
  \GEOQ\or\GEOGH\or\GEOY\or\GEOSH\or\GEOCH\or\GEOC\or\GEODZ\or
  \GEOTS\or\GEOTCH\or\GEOKH\or\GEOSJ\or\GEOH\or\GEOHE\or\GEOIOT\or
  \GEOWE\or\GEOHAR\or\GEOHOE\else\@ctrerr\fi}
\fi
\def\anbani#1{\expandafter\georgian@alph\csname c@#1\endcsname}
\if@kauni@ode
  \def\georgian@alph#1{\ifcase#1\or
    ა\or ბ\or გ\or г\or დ\or ე\or ვ\or
    ზ\or თ\or ი\or კ\or ლ\or მ\or ნ\or
    ო\or პ\or ჟ\or რ\or ს\or ტ\or უ\or ფ\or ქ\or  ღ\or
    ყ\or შ\or ჩ\or ც\or ძ\or წ\or ჭ\or 
    ხ\or ჯ\or ჰ\or ჱ\or ჲ\or  ჳ\or  ჴ\or 
     ჵ\or ჶ\or ჷ\or ჸ\or ჲ\or  ჹ\or  ჺ\else\@ctrerr\fi}
\else
  \def\georgian@alph#1{\ifcase#1\or
  \geoa\or\geob\or\geog\or\geod\or\geoe\or\geov\or\geoz\or
  \geoth\or\geoi\or\geok\or\geol\or\geom\or\geon\or\geoo\or
  \geop\or\geozh\or\geor\or\geos\or\geot\or\geou\or\geoph\or
  \geoq\or\geogh\or\geoy\or\geosh\or\geoch\or\geoc\or\geodz\or
  \geots\or\geotch\or\geokh\or\geosj\or\geoh\or\geohe\or\geoiot\or
  \geowe\or\geohar\or\geohoe\or\geofi\else\@ctrerr\fi}
\fi
\@ifundefined{sym\georgianencoding letters}{}{%
\SetSymbolFont{\georgianencoding letters}{bold}\georgianencoding
  \rmdefault\bfdefault\updefault
\DeclareSymbolFontAlphabet\geomathrm{\georgianencoding letters}
\DeclareMathAlphabet\geomathbf\georgianencoding
  \rmdefault\bfdefault\updefault
\DeclareMathAlphabet\geomathsf\georgianencoding
  \sfdefault\mddefault\updefault
\DeclareMathAlphabet\geomathit\georgianencoding
  \rmdefault\mddefault\itdefault
\DeclareMathAlphabet\geomathtt\georgianencoding
  \ttdefault\mddefault\updefault
\SetMathAlphabet\geomathsf{bold}\georgianencoding
  \sfdefault\bfdefault\updefault
\SetMathAlphabet\geomathit{bold}\georgianencoding
  \rmdefault\bfdefault\itdefault
}
\input{georgiancaps.tex}
\ldf@finish{georgian}
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\endinput
%%
%% End of file `russianb.ldf'.
