% -*- coding: utf-8; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*-
% Execute etex on this file to extract package files.
% See in README for more build instructions.
%<*dtx>
\def\dtxtimestamp {Time-stamp: <13-11-2022 at 17:14:21 CET>}
%%
%% Package: libgreek
%% Greek in math mode via Libertinus or Linux Libertine (JFB)
%% Version: 1.1
%% License: LPPL 1.3c
%% Copyright (C) 2011-2012, 2022 Jean-Francois Burnol
%%                               <jfbu at free dot fr>
%%
%</dtx>
%<*tex>
\def\libgreekversion{1.1}
\def\libgreekdate{2022/11/11}
%</tex>
%<*dtx>
\iffalse
%</dtx>
%<*tex>
%% This is a generated file. Run latexmk on this file libgreek.tex then
%% run dvipdfmx on libgreek.dvi to produce the documentation libgreek.pdf,
%% with the package source code included.
%%
%% Customize as desired the class options and the two toggles below.
%%
%% See libgreek.dtx for the copyright and the conditions for distribution
%% and/or modification of this Work.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{libgreek.tex}%
[\libgreekdate\space v\libgreekversion\space 
       driver file for libgreek documentation (JFB)]%
\PassOptionsToClass{a4paper,fontsize=11pt}{scrartcl}
\chardef\Withdvipdfmx \ifdefined\pdfoutput\ifnum\pdfoutput>0 0\else1\fi\else0\fi\relax
\chardef\NoSourceCode 0 % replace 0<space> by 1<space> for no source code
\input libgreek.dtx
%%% Local Variables:
%%% mode: latex
%%% End:
%</tex>
%<*dtx>
\fi
\chardef\noetex 0
\ifx\numexpr\undefined\chardef\noetex 1 \fi
\ifnum\noetex=1 \chardef\extractfiles 0 % extract files, then stop
\else
    \ifx\ProvidesFile\undefined
      \chardef\extractfiles 0 % etex etc.. on libgreek.dtx
    \else % latex/pdflatex on libgreek.tex or on libgreek.dtx
      \ifx\Withdvipdfmx\undefined
        % (lua|xe|pdf)latex run is on libgreek.dtx, we will extract all files
        \chardef\extractfiles 1 % 1 = extract all and typeset doc
        \chardef\Withdvipdfmx
                \ifdefined\pdfoutput\ifnum\pdfoutput>0 0\else1\fi\else0\fi\relax
        \chardef\NoSourceCode 1 % 
        \NeedsTeXFormat{LaTeX2e}%
        \PassOptionsToClass{a4paper,fontsize=11pt}{scrartcl}%
      \else % latex run is on libgreek.tex, 
        \chardef\extractfiles 2 % no extractions
      \fi
    \ProvidesFile{libgreek.dtx}%
    [libgreek source (\libgreekversion\space of \libgreekdate) (JFB)]%
    \fi
\fi
\ifnum\extractfiles<2 % extract files
\def\MessageDeFin{\newlinechar10 \let\Msg\message
\Msg{^^J}%
\Msg{********************************************************************^^J}%
\Msg{*^^J}%
\Msg{* To finish the installation you have to move the following^^J}%
\Msg{* files into a directory searched by TeX:^^J}%
\Msg{*^^J}%
\Msg{*\space\space\space\space libgreek.sty^^J}%
\Msg{*\space\space\space\space libgreek-legacy.sty^^J}%
\Msg{*^^J}%
\Msg{* To produce the documentation with source code included run latexmk^^J}%
\Msg{* on extracted libgreek.tex and then dvipdfmx on libgreek.dvi^^J}%
\Msg{*^^J}%
\Msg{* Happy TeXing!^^J}%
\Msg{*^^J}%
\Msg{********************************************************************^^J}%
}%
\begingroup
\input docstrip.tex
\askforoverwritefalse
\generate{\nopreamble
  \usepostamble\defaultpostamble
    \file{libgreek.tex}{\from{libgreek.dtx}{tex}}%
  \usepreamble\defaultpreamble
    \file{libgreek-legacy.sty}{\from{libgreek.dtx}{legacy}}%
    \file{libgreek.sty}{\from{libgreek.dtx}{sty}}%
}
\endgroup
\fi % end of file extractions
\ifnum\extractfiles=0 
% tex/etex/xetex/etc on libgreek.dtx, files are now extracted, stop
  \MessageDeFin\expandafter\end
\fi
% no file extractions if latex compilation was on libgreek.tex
\ifdefined\MessageDeFin\AtEndDocument{\MessageDeFin}\fi
\ifnum\Withdvipdfmx>0
\documentclass [dvipdfmx]{scrartcl}
\else
\documentclass {scrartcl}
\fi
\tracinglostchars=3

% use doc with v2 because hyperref option clash with hypdoc
% or warning of hypdoc is simply TOO MUCH OF A BIG PAIN
\usepackage{doc}[=v2]
% but the v2 does not define \cs, it got defined in ltxdoc
\def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}}
\def\cmd@to@cs#1#2{\char\number`#2\relax}
\DeclareRobustCommand\cs[1]{\texttt{\bslash#1}}
\AtBeginDocument{%
\pdfstringdefDisableCommands{\def\cs#1{\textbackslash\detokenize{#1}}}%
}%
% these are not defined by doc package
\providecommand\marg[1]{%
  {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
\providecommand\oarg[1]{%
  {\ttfamily[}\meta{#1}{\ttfamily]}}
\providecommand\parg[1]{%
  {\ttfamily(}\meta{#1}{\ttfamily)}}

\CodelineNumbered
\AtBeginDocument{\MakeShortVerb\|}
\ifnum\NoSourceCode=1
  \OnlyDescription
\fi
\usepackage[LGR,T1]{fontenc}

\usepackage{hologo}
%% \hologoFontSetup{general=\upshape\rmfamily}
\DeclareRobustCommand*{\pdfLaTeX}{\hologo{pdfLaTeX}}%
% \DeclareRobustCommand*{\eTeX}{\hologo{eTeX}}%
% \DeclareRobustCommand*{\LuaTeX}{\hologo{LuaTeX}}%
% \DeclareRobustCommand*{\LuaLaTeX}{\hologo{LuaLaTeX}}%
% \DeclareRobustCommand*{\XeTeX}{\hologo{XeTeX}}%
% \DeclareRobustCommand*{\XeLaTeX}{\hologo{XeLaTeX}}%

\usepackage{geometry}
\usepackage[english]{babel}

\usepackage{multicol}
\usepackage{framed}

\usepackage{color}
\definecolor{joli}{RGB}{225,95,0}
\definecolor{JOLI}{RGB}{225,95,0}
\definecolor{urlcolor}{RGB}{38,128,192}

\usepackage{hyperref}
\hypersetup{%
linktoc=all,%
breaklinks=true,%
colorlinks=true,%
linkcolor={red},%
urlcolor={urlcolor},
pdfauthor={Jean-François Burnol},%
pdftitle={The libgreek package},%
pdfstartview=FitH,%
pdfpagemode=UseNone,%
}
\usepackage{hypcap}
\usepackage{bookmark}
\usepackage{enumerate}

\usepackage{mlmodern}
\DeclareEncodingSubset{TS1}{mlmtt}{0}% fix \textasciigrave related latex2e#905

% useless with doc.sty
% \usepackage{upquote}
% as \verb, verbatim and macrocode do not use \@noligs
\begingroup
\catcode`\'\active\catcode`\`\active
\gdef\MakePrivateLetters{\makeatletter\def`{\textasciigrave}\def'{\textquotesingle}}
\endgroup
% https://github.com/latex3/latex2e/issues/953, for the record

\usepackage{xspace}

\newcommand\ctanpkg[1]{\href{https://ctan.org/pkg/#1}{#1}}

% Vendredi 11 novembre 2022 : impossible d'utiliser \hypersetup{urlcolor=joli}
% dans \section (même sans le \texorpdfstring).
% même si la macro \libgreek est déclarée robuste mais avec \protected c'est bon
% \DeclareRobustCommand\libgreek{{\hypersetup{urlcolor=joli}libgreek}}% <-- BAD
% ceci ok (mais il faudra ajouter \texorpdfstring)
% \protected\def\libgreek{{\hypersetup{urlcolor=joli}libgreek}}%        <-- OK
% L'erreur est
%     Argument of \KVS@@CommaComma has an extra }
% mais je n'ai pas cherché à en savoir plus.  De plus dans le code ci-dessous
% on avait plutôt un stack overflow dû à boucle infinie.

% le \texorpdfstring ne sert à rien si \protected dans \section
\protected\def\libgreek{%
   {\hypersetup{urlcolor=joli}\bfseries \ctanpkg{libgreek}}\xspace
}
\pdfstringdefDisableCommands{\def\libgreek{libgreek\xspace}}

\usepackage{centeredline}
\usepackage[libertinus]{libgreek}
\usepackage{libgreek-legacy}
% don't do this double loading at home!
% it overwrites all Greek letters to use libertine-legacy ufxl03,
% but we will use the internal \libgreek@setgreekcs in a local scope
% to still get the LibertinusSerif when needed for display.
% The greek, Greek and style options of libgreek are broken by this
% so we can't use \libgreeksetup.

\begin{document}\renewcommand\familydefault\sfdefault
\begin{center}
 {\Large The \libgreek package}\\
 Jean-François \textsc{Burnol}\\
 \texttt{jfbu (at) free (dot) fr}\\
\footnotesize
  This is \libgreekversion\ (\libgreekdate) from
  source file having \dtxtimestamp
\end{center}

{
\addtocontents{toc}{\protect\hypersetup{hidelinks}}
\addtocontents{lot}{\protect\hypersetup{hidelinks}}

\tableofcontents

\listoftables
}

\section{Description}

The \libgreek package sets the Greek letters {in math mode} (\textbf{only}) to use glyphs
ultimately from the Libertinus%
%
\footnote{Khaled~\textsc{Hosny} originated
  the \url{https://github.com/alerque/libertinus} project, now maintained by
  Caleb~\textsc{Maclennan}, as a fork of
  the \href{https://en.wikipedia.org/wiki/Linux_Libertine}{Linux Libertine}
  fonts designed by Philipp~H.~\textsc{Poll}.}
%
Unicode font, as made available to the ``8bit'' traditional \TeX{} engines
thanks to the \ctanpkg{libertinus-type1} package%
%
\footnote{Bob~\textsc{Tennent}, \emph{Support for using Libertinus fonts with
    \LaTeX/\pdfLaTeX}, \url{https://ctan.org/pkg/libertinus-type1}}.
%
The package \ctanpkg{libertinus-type1} is not loaded, but must be present.

Thus \libgreek is for people who want \emph{only} to adjust Greek letters in math
mode (and easily configure usage of upright or italic/slanted shapes), perhaps
in the context of having changed Latin letters as well, e.g.\@ from using the
\ctanpkg{mathastext} or the \ctanpkg{frenchmath} packages.

Nota bene: complete math configuration is provided by the
\ctanpkg{libertinust1math} package%
%
\footnote{Michael \textsc{Sharpe}, \emph{A Type 1 font and \LaTeX\ support for Libertinus
    Math}, \url{https://ctan.org/pkg/libertinust1math}.},
%
and you very probably do not want using \libgreek if already loading
\ctanpkg{libertinust1math}!


The Greek letters all come with \cs{...up} and \cs{...it} named variants, and
whether ``bare'' control sequences map to the `|up|' or `|it|' ones can be
configured via package options, even midway in the document via
\cs{libgreeksetup}.  Further, the package optionally defines two math
alphabets \cs{libgreekup} and \cs{libgreekit}.  What `|up|' and `|it|'
actually mean can be configured using the |upshape| and |itshape| keys at
package loading time.


On old systems where the (now obsolete) \ctanpkg{libertine-legacy}%
%
\footnote{Bob~\textsc{Tennent}, \emph{Linux Libertine fonts for \hologo{(La)TeX} and
    %{\upshape\rmfamily pdf}
   pdf\hologo{(La)TeX} users}, \url{https://ctan.org/pkg/libertine-legacy}}
%
is installed, \libgreek will switch automatically for backwards compatibility
to a ``legacy'' mode which uses rather the font support files as provided by
\ctanpkg{libertine-legacy}.  This ``legacy'' package |libgreek-legacy| uses
almost unchanged the code from the original 2011 release.

On \LaTeX{} installations with \ctanpkg{libertine-legacy} present you can
author new documents using directly
\centeredline{|\usepackage|\oarg{options}|{libgreek-legacy}|}
but they
will not be portable to installations lacking \ctanpkg{libertine-legacy}.

The ``legacy'' package does not provide the \cs{...up} and
\cs{...it} control sequences nor does it provide the \cs{libgreekup} and
\cs{libgreekit} math alphabets, or the \cs{libgreeksetup} command.

To author new documents which will always use \ctanpkg{libertinus-type1} even
if moved to systems having kept in some local |texmf| tree the obsolete (and not
included in \TeX Live for some years) \ctanpkg{libertine-legacy} package
files, use
%
\centeredline{|\usepackage[libertinus,|\meta{options}|]{libgreek}|}
%
This is not needed if anyone of the options recognized only by \libgreek and
not by \libgreek-legacy is used: i.e.\@ |serif|, |sans|, |upshape|,
|itshape| and |alphabets|.

\section{Documentation of the \libgreek package}

Here are the options recognized by the package:
\begin{description}
\item[libertinus] This option forces usage of the font support
  files from package \ctanpkg{libertinus-type1} even if
  \ctanpkg{libertine-legacy} is avalable on the \LaTeX{} installation.
\item[serif] Configures the package to use the (type1) Libertinus Serif font.  This is
  the default behaviour (if the ``legacy''
  mode is not activated).
\item[libertine] This is a deprecated alias for |serif|, which is provided for
  backwards compatibility with existing documents and does not inhibit the
  ``legacy'' mode: on a system having the \ctanpkg{libertine-legacy} files it
  will end up being handed over to \libgreek-legacy, except if some other
  option inhibits this.
\item[sans] Configures the package to use the (type1) Libertinus Sans font.
\item[biolinum] Configures the package to use either the Libertinus Sans font
  or the (type1) Biolinum font if the ``legacy'' mode kicks in.
\item[upshape=\meta{shape}] Declares the shape to be used by the \cs{...up}
  Greek letters and the \cs{libgreekup} math alphabet.  Defaults to `|n|'
  (without the quotes).
\item[itshape=\meta{shape}] Declares the shape to be used by the \cs{...it}
  Greek letters and the \cs{libgreekit} math alphabet.  Defaults to `|it|'.
\item[scale=\meta{factor}] will scale the font by the given
  factor, relative to nominal size.

  Example: scale=1.2 will scale by 20\%.\DeleteShortVerb{\|}
\item[style=\meta{\upshape\ttfamily ISO|French|TeX}] specifies the shape style
  of the Greek letters.\MakeShortVerb{\|}

  |ISO| means `italic' for lowercase
  and uppercase, |French| means `upright' for lowercase and uppercase, |TeX|
  means `italic' for lowercase and `upright' for uppercase.

  This option will
  override any |greek| or |Greek| option. The package defaults to |style=TeX|.

  What `upright' and `italic' mean is configured by the |upshape| and
  |itshape| respective settings.\DeleteShortVerb\|
\item[greek=\meta{\ttfamily\upshape up|it|...}] Says\MakeShortVerb{\|} whether
  Greek letters will be `upright' or `italic' i.e.\@ whether they obey the
  |upshape| or |itshape| setting, i.e.\@ whether \cs{alpha} et al.\@ are
  \cs{let} to \cs{alphaup} (et al.) or to \cs{alphait} (et
  al.).\MakeShortVerb{\|}

  So |greek=it| is like |style=ISO|, and |greek=up| is like |style=French|.

  For backwards compatibility with the behaviour of the 2011 release, other
  shape values, such as `|n|' and `|sl|' or even `|sc|', are accepted.  For
  more details, see the explanations for |Greek|.  For example |greek=n| is
  like |style=French|.

  This option is ignored if |style| is used (order does not matter).
  \DeleteShortVerb\|
\item[Greek=\meta{\ttfamily\upshape up|it|...}] Says\MakeShortVerb{\|}
  whether uppercase Greek
  letters (and only them) will be `upright' or `italic' i.e.\@ whether they
  use |upshape| or |itshape|, i.e.\@ whether \cs{Alpha} et al.\@ are \cs{let}
  to \cs{Alphaup} (et al.) or to \cs{Alphait} (et al.).\MakeShortVerb{\|}

  So to obtain lowercase to be `upright' and uppercase to be `italic', use
  |greek=up| and then |Greek=it| (|Greek| must appear after |greek| else it will be
  shadowed by it).  Alternatively, do not use the |greek/Greek| keys but set
  |upshape=it|, |itshape=n|, as the package by default assigns `italic' to
  lowercase and `upright' to uppercase.

  This option, like the  |greek| option, is ignored if the |style| option is used.

  For backwards compatibility with the behaviour of the 2011 release, other
  shape values, such as `|n|' and `|sl|', are accepted.  They will then
  override the |upshape| setting for it to match it.  For example |Greek=sc|
  will force |upshape| to be |sc|, because the assumed style is the \TeX{} one
  of italic lowercase and upright uppercase, so setting the shape of uppercase
  must update the |upshape| value.

  \DeleteShortVerb{\|}
  It is however recommended to use rather the \verb+upshape|itshape|style+ keys.
  \MakeShortVerb{\|}

  Using |greek=up| or |Greek=up| does not inhibit ``legacy'' mode although the
  legacy package did not a priori accept that value `|up|'.  But since
  \LaTeX{} 2020-02-02, the `|up|' shape is recognized and triggers
  |up|$\to$|n| substitutions, so one can use that syntax even in contexts
  which will let the package fall back to ``legacy'' mode.  Not recommended, though.

  % Actually |greek| and |Greek| are provided mainly as compatibility stubs with
  % legacy behaviour, in order for the package, even if not using ``legacy''
  % mode, to behave similarly regarding shapes as was doing its initial release.

\item[series=\meta{series}] This tells which series to use. The default is the
  value of \cs{seriesdefault} at the time of loading the package.  There is no interface to configure distinct series for the `upright' and `italic' shapes.
\item[boldseries=\meta{series}] This tells which series to use in bold
  math. Default is \cs{bfdefault} at the time of loading the package.  There is no interface to configure distinct series for the `upright' and `italic' shapes.
\item[alphabets] Says whether to define \cs{libgreekup} and \cs{libgreekit}.
\end{description}

\begin{table}[htbp]
\capstart
\DeleteShortVerb\|% a effet global !
\let\s\string
\ttfamily
\makeatletter
\libgreek@upper@uptrue
\libgreek@lower@uptrue
\libgreek@setgreekcs
\begin{multicols}{3}\def\foo{\kern1cm}\raggedcolumns
\s\alphatonos\hfill$\alphatonos$ \foo\\
\s\epsilontonos\hfill$\epsilontonos$ \foo\\
\s\etatonos\hfill$\etatonos$ \foo\\
\s\iotatonos\hfill$\iotatonos$ \foo\\
\s\omicrontonos\hfill$\omicrontonos$ \foo\\
\s\upsilontonos\hfill$\upsilontonos$ \foo\\
\s\omegatonos\hfill$\omegatonos$ \foo\\
\s\upsilondieresistonos\hfill$\upsilondieresistonos$ \foo\\
\s\iotadieresis\hfill$\iotadieresis$ \foo\\
\s\iotadieresistonos\hfill$\iotadieresistonos$ \foo\\
\s\upsilondieresis\hfill$\upsilondieresis$ \foo\\
\end{multicols}
\medskip
\centeredline{%
\begin{tabular}{|lc|lc|lc|lc|}
\hline
\s\Alpha&$\Alpha$    &\s\Nu&$\Nu$          &\s\alpha&$\alpha$    &\s\nu&$\nu$\\
\s\Beta&$\Beta$      &\s\Xi&$\Xi$          &\s\beta&$\beta$      &\s\xi&$\xi$\\
\s\Gamma&$\Gamma$    &\s\Omicron&$\Omicron$&\s\gamma&$\gamma$    &\s\omicron&$\omicron$\\
\s\Delta&$\Delta$    &\s\Pi&$\Pi$          &\s\delta&$\delta$    &\s\pi&$\pi$\\
\s\Epsilon&$\Epsilon$&\s\Rho&$\Rho$        &\s\epsilon&$\epsilon$&\s\rho&$\rho$\\
\s\Zeta&$\Zeta$      &\s\Sigma&$\Sigma$    &\s\zeta&$\zeta$      &\s\sigma&$\sigma$\\
\s\Eta&$\Eta$        &\s\Tau&$\Tau$        &\s\eta&$\eta$        &\s\tau&$\tau$\\
\s\Theta&$\Theta$    &\s\Upsilon&$\Upsilon$&\s\theta&$\theta$    &\s\upsilon&$\upsilon$\\
\s\Iota&$\Iota$      &\s\Phi&$\Phi$        &\s\iota&$\iota$      &\s\phi&$\phi$\\
\s\Kappa&$\Kappa$    &\s\Chi&$\Chi$        &\s\kappa&$\kappa$    &\s\chi&$\chi$\\
\s\Lambda&$\Lambda$  &\s\Psi&$\Psi$        &\s\lambda&$\lambda$  &\s\psi&$\psi$\\
\s\Mu&$\Mu$          &\s\Omega&$\Omega$    &\s\mu&$\mu$          &\s\omega&$\omega$\\
\hline
\end{tabular}}
\medskip
% il faut mettre le \columnbreak avant le \\ ...
\begin{multicols}{3}\def\foo{\kern1cm}\raggedcolumns
\s\varsigma\hfill$\varsigma$ \foo\\
\s\varvarsigma\hfill$\varvarsigma$ \foo\\
\s\sampi\hfill$\sampi$ \foo\\
\s\digamma\hfill$\digamma$ \foo\\
\s\koppa\hfill$\koppa$ \foo\\
\s\varSigma\hfill$\varSigma$ \foo\\
\s\Sampi\hfill$\Sampi$ \foo\\
\s\Digamma\hfill$\Digamma$ \foo
\par
\end{multicols}
% il y a bien sûr d'horribles espacement verticaux typiques de LaTeX
\vspace*{-\baselineskip}
\caption[Greek letters via Libertinus Serif (upright)]{Greek letters from LibertinusSerif in LGR encoding, upright shapes}
\label{table:LibertinusSerif upright}
\MakeShortVerb\|
\end{table}

\begin{table}[htbp]
\capstart
\DeleteShortVerb\|% a effet global !
\let\s\string
\ttfamily
\makeatletter
% comme j'ai utilise libertine-legacy, le comportement des clés
% greek et Greek a été changé, donc je ne peux pas utiliser \libgreeksetup
\libgreek@upper@upfalse
\libgreek@lower@upfalse
\libgreek@setgreekcs
\begin{multicols}{3}\def\foo{\kern1cm}\raggedcolumns
\s\alphatonos\hfill$\alphatonos$ \foo\\
\s\epsilontonos\hfill$\epsilontonos$ \foo\\
\s\etatonos\hfill$\etatonos$ \foo\\
\s\iotatonos\hfill$\iotatonos$ \foo\\
\s\omicrontonos\hfill$\omicrontonos$ \foo\\
\s\upsilontonos\hfill$\upsilontonos$ \foo\\
\s\omegatonos\hfill$\omegatonos$ \foo\\
\s\upsilondieresistonos\hfill$\upsilondieresistonos$ \foo\\
\s\iotadieresis\hfill$\iotadieresis$ \foo\\
\s\iotadieresistonos\hfill$\iotadieresistonos$ \foo\\
\s\upsilondieresis\hfill$\upsilondieresis$ \foo\\
\end{multicols}
\medskip
\centeredline{%
\begin{tabular}{|lc|lc|lc|lc|}
\hline
\s\Alpha&$\Alpha$    &\s\Nu&$\Nu$          &\s\alpha&$\alpha$    &\s\nu&$\nu$\\
\s\Beta&$\Beta$      &\s\Xi&$\Xi$          &\s\beta&$\beta$      &\s\xi&$\xi$\\
\s\Gamma&$\Gamma$    &\s\Omicron&$\Omicron$&\s\gamma&$\gamma$    &\s\omicron&$\omicron$\\
\s\Delta&$\Delta$    &\s\Pi&$\Pi$          &\s\delta&$\delta$    &\s\pi&$\pi$\\
\s\Epsilon&$\Epsilon$&\s\Rho&$\Rho$        &\s\epsilon&$\epsilon$&\s\rho&$\rho$\\
\s\Zeta&$\Zeta$      &\s\Sigma&$\Sigma$    &\s\zeta&$\zeta$      &\s\sigma&$\sigma$\\
\s\Eta&$\Eta$        &\s\Tau&$\Tau$        &\s\eta&$\eta$        &\s\tau&$\tau$\\
\s\Theta&$\Theta$    &\s\Upsilon&$\Upsilon$&\s\theta&$\theta$    &\s\upsilon&$\upsilon$\\
\s\Iota&$\Iota$      &\s\Phi&$\Phi$        &\s\iota&$\iota$      &\s\phi&$\phi$\\
\s\Kappa&$\Kappa$    &\s\Chi&$\Chi$        &\s\kappa&$\kappa$    &\s\chi&$\chi$\\
\s\Lambda&$\Lambda$  &\s\Psi&$\Psi$        &\s\lambda&$\lambda$  &\s\psi&$\psi$\\
\s\Mu&$\Mu$          &\s\Omega&$\Omega$    &\s\mu&$\mu$          &\s\omega&$\omega$\\
\hline
\end{tabular}}
\medskip
% il faut mettre le \columnbreak avant le \\ ...
\begin{multicols}{3}\def\foo{\kern1cm}\raggedcolumns
\s\varsigma\hfill$\varsigma$ \foo\\
\s\varvarsigma\hfill$\varvarsigma$ \foo\\
\s\sampi\hfill$\sampi$ \foo\\
\s\digamma\hfill$\digamma$ \foo\\
\s\koppa\hfill$\koppa$ \foo\\
\s\varSigma\hfill$\varSigma$ \foo\\
\s\Sampi\hfill$\Sampi$ \foo\\
\s\Digamma\hfill$\Digamma$ \foo
\par
\end{multicols}
% il y a bien sûr d'horribles espacement verticaux typiques de LaTeX
\vspace*{-\baselineskip}
\caption[Greek letters via Libertinus Serif (italic)]{Greek letters from LibertinusSerif in LGR encoding, italic shapes}
\label{table:LibertinusSerif italic}
\MakeShortVerb\|
\end{table}

\begin{table}[htbp]
\capstart
\DeleteShortVerb\|% a effet global !
% ah que TeX est mieux avec tt
\def\s#1{{\usefont{T1}{mlmtt}{m}{n}\string#1}}%
\usefont{LGR}{LibertinusSans-TLF}{m}{n}%
\begin{multicols}{3}\def\foo{\kern1cm}\raggedcolumns
\s\alphatonos\hfill\char136 \foo\\
\s\epsilontonos\hfill\char232 \foo\\
\s\etatonos\hfill\char160 \foo\\
\s\iotatonos\hfill\char208 \foo\\
\s\omicrontonos\hfill\char236 \foo\\
\s\upsilontonos\hfill\char212 \foo\\
\s\omegatonos\hfill\char184 \foo\\
\s\upsilondieresistonos\hfill\char246 \foo\\
\s\iotadieresis\hfill\char240 \foo\\
\s\iotadieresistonos\hfill\char242 \foo\\
\s\upsilondieresis\hfill\char244 \foo\\
\end{multicols}
\medskip
\centeredline{%
\begin{tabular}{|lc|lc|lc|lc|}
\hline
\s\Alpha&\char65   &\s\Nu&\char78      &\s\alpha&\char97    &\s\nu&\char110 \\
\s\Beta&\char66    &\s\Xi&\char88      &\s\beta&\char98     &\s\xi&\char120 \\
\s\Gamma&\char71   &\s\Omicron&\char79 &\s\gamma&\char103   &\s\omicron&\char111 \\
\s\Delta&\char68   &\s\Pi&\char80      &\s\delta&\char100   &\s\pi&\char112 \\
\s\Epsilon&\char69 &\s\Rho&\char82     &\s\epsilon&\char101 &\s\rho&\char114 \\
\s\Zeta&\char90    &\s\Sigma&\char83   &\s\zeta&\char122    &\s\sigma&\char115 \\
\s\Eta&\char72     &\s\Tau&\char84     &\s\eta&\char104     &\s\tau&\char116 \\
\s\Theta&\char74   &\s\Upsilon&\char85 &\s\theta&\char106   &\s\upsilon&\char117 \\
\s\Iota&\char73    &\s\Phi&\char70     &\s\iota&\char105    &\s\phi&\char102 \\
\s\Kappa&\char75   &\s\Chi&\char81     &\s\kappa&\char107   &\s\chi&\char113 \\
\s\Lambda&\char76  &\s\Psi&\char89     &\s\lambda&\char108  &\s\psi&\char121 \\
\s\Mu&\char77      &\s\Omega&\char87   &\s\mu&\char109      &\s\omega&\char119 \\
\hline
\end{tabular}}
\medskip
% il faut mettre le \columnbreak avant le \\ ...
\begin{multicols}{3}\def\foo{\kern1cm}\raggedcolumns
\s\varsigma\hfill\char99 \foo\\
\s\varvarsigma\hfill\char6 \foo\\
\s\sampi\hfill\char27 \foo\\
\s\digamma\hfill\char147 \foo\\
\s\koppa\hfill\char18 \foo\\
\s\varSigma\hfill\char22 \foo\\
\s\Sampi\hfill\char23 \foo\\
\s\Digamma\hfill\char195 \foo
\par
\end{multicols}
% il y a bien sûr d'horribles espacement verticaux typiques de LaTeX
\vspace*{-\baselineskip}
\caption[Greek letters via Libertinus Sans (upright)]{Greek letters from LibertinusSans in LGR encoding, upright shapes}
\label{table:LibertinusSans upright}
\MakeShortVerb\|
\end{table}

\begin{table}[htbp]
\capstart
\DeleteShortVerb\|% a effet global !
% ah que TeX est mieux avec tt
\def\s#1{{\usefont{T1}{mlmtt}{m}{n}\string#1}}%
\usefont{LGR}{LibertinusSans-TLF}{m}{it}%
\begin{multicols}{3}\def\foo{\kern1cm}\raggedcolumns
\s\alphatonos\hfill\char136 \foo\\
\s\epsilontonos\hfill\char232 \foo\\
\s\etatonos\hfill\char160 \foo\\
\s\iotatonos\hfill\char208 \foo\\
\s\omicrontonos\hfill\char236 \foo\\
\s\upsilontonos\hfill\char212 \foo\\
\s\omegatonos\hfill\char184 \foo\\
\s\upsilondieresistonos\hfill\char246 \foo\\
\s\iotadieresis\hfill\char240 \foo\\
\s\iotadieresistonos\hfill\char242 \foo\\
\s\upsilondieresis\hfill\char244 \foo\\
\end{multicols}
\medskip
\centeredline{%
\begin{tabular}{|lc|lc|lc|lc|}
\hline
\s\Alpha&\char65   &\s\Nu&\char78      &\s\alpha&\char97    &\s\nu&\char110 \\
\s\Beta&\char66    &\s\Xi&\char88      &\s\beta&\char98     &\s\xi&\char120 \\
\s\Gamma&\char71   &\s\Omicron&\char79 &\s\gamma&\char103   &\s\omicron&\char111 \\
\s\Delta&\char68   &\s\Pi&\char80      &\s\delta&\char100   &\s\pi&\char112 \\
\s\Epsilon&\char69 &\s\Rho&\char82     &\s\epsilon&\char101 &\s\rho&\char114 \\
\s\Zeta&\char90    &\s\Sigma&\char83   &\s\zeta&\char122    &\s\sigma&\char115 \\
\s\Eta&\char72     &\s\Tau&\char84     &\s\eta&\char104     &\s\tau&\char116 \\
\s\Theta&\char74   &\s\Upsilon&\char85 &\s\theta&\char106   &\s\upsilon&\char117 \\
\s\Iota&\char73    &\s\Phi&\char70     &\s\iota&\char105    &\s\phi&\char102 \\
\s\Kappa&\char75   &\s\Chi&\char81     &\s\kappa&\char107   &\s\chi&\char113 \\
\s\Lambda&\char76  &\s\Psi&\char89     &\s\lambda&\char108  &\s\psi&\char121 \\
\s\Mu&\char77      &\s\Omega&\char87   &\s\mu&\char109      &\s\omega&\char119 \\
\hline
\end{tabular}}
\medskip
% il faut mettre le \columnbreak avant le \\ ...
\begin{multicols}{3}\def\foo{\kern1cm}\raggedcolumns
\s\varsigma\hfill\char99 \foo\\
\s\varvarsigma\hfill\char6 \foo\\
\s\sampi\hfill\char27 \foo\\
\s\digamma\hfill\char147 \foo\\
\s\koppa\hfill\char18 \foo\\
\s\varSigma\hfill\char22 \foo\\
\s\Sampi\hfill\char23 \foo\\
\s\Digamma\hfill\char195 \foo
\par
\end{multicols}
% il y a bien sûr d'horribles espacement verticaux typiques de LaTeX
\vspace*{-\baselineskip}
\caption[Greek letters via Libertinus Sans (italic)]{Greek letters from LibertinusSans in LGR encoding, italic shapes}
\label{table:LibertinusSans italic}
\MakeShortVerb\|
\end{table}

Here are the commands defined by the package:
\begin{description}
\item[\cs{libgreeksetup}\marg{key=value,...}] The only allowed keys are
  |style|, |greek| and |Greek|.  And for the latter two only the values |up|
  or |it| should be used (or values matching the |upshape| or |itshape|
  settings), as it is only possible after package loading time to toggle
  between `upright' and `italic' depending on whether the letter is uppercase
  or lowercase, but one can not switch to an altogether different shape as
  this would require re-declaring the symbol fonts.

  If the |style| key is used, then |greek/Greek| are ignored.  However,
  one can always naturally reuse later \cs{libgreeksetup} using only the
  |greek| and/or |Greek| keys.
\item[\cs{libgreekup}] This is a math alphabet.  It is defined only if the
  package received the |alphabets| option.
\item[\cs{libgreekit}] This is a math alphabet.  It is defined only if the
  package received the |alphabets| option.
\end{description}

Miscellaneous remarks:
\begin{enumerate}
\item Even if not receiving the option |alphabets|, the package will declare
  all Greek letters to be of type \cs{mathalpha}.  The legacy package on the
  other hand declares them all to be of type \cs{mathord}.
\item The \libgreek package ignores global class options.  It handles only
  options originating from the \cs{usepackage} preamble declaration (or some
  options handed over via \cs{PassOptionsToPackage} or options passed to
  \cs{libgreeksetup} in the preamble or body).  The \libgreek-legacy package
  on the other hand handles global class options if it recognizes them.
\end{enumerate}

\section{Documentation of the \libgreek-legacy package}

Except for a fix to a problem with \cs{varvarsigma} and \cs{varvarkappa}, and
the handling of option |libertine| (which formerly would have remained
effectless if used after |biolinum|) \libgreek-legacy is functionally
equivalent with the original |1.0| release of \libgreek from |2011/03/14|.

Compared to the 2022 \libgreek, and apart from the fact that the legacy mode
relies on presence of the files of \ctanpkg{libertine-legacy}, the main
difference is that this legacy version does not define \cs{...up} and
\cs{...it} shape variants, does not provide \cs{libgreekup} and
\cs{libgreekit} math alphabets, and does not define a command
\cs{libgreeksetup} allowing to change the shapes midway in a document.  All
Greek letters are defined as math symbols of type \cs{mathord}, whereas the
2022 \libgreek uses type \cs{mathalpha}.

Also, the legacy package defines even more
control sequences for letters with diacritics or special variant
glyphs, than does the 2022 \libgreek relying on \ctanpkg{libertinus-type1}
LGR-encoded fonts.

Now to the decription of the recognized options.

With the exception of |libertine| and |biolinum|, all options are of the
|key=value| type.
\begin{description}
\item[libertine] Configures the package to use the (type1) Libertine font
  (i.e.\@ the serif font).  This is the default behaviour.
\item[biolinum] Configures the package to use the (type1) Biolinum font
  (i.e.\@ the sans serif font).
\item[scale=\meta{factor}] will scale the font by the given
  factor, relative to nominal size (when the
  Libertine/Biolinum fonts are used elsewhere in the
  document, they will also be scaled by this
  factor). Note that the similar option of the
  \ctanpkg{libertine-legacy} package is called |scaled| and has
  precisely the same effect. Example: scale=1.2 will
  scale by 20\%.\DeleteShortVerb{\|}
\item[style=\meta{\upshape\ttfamily ISO|French|TeX}]
  specifies the shape of the Greek\MakeShortVerb{\|} 
  letters. |ISO| means italic for lowercase and
  uppercase, |French| means upright for lowercase and
  uppercase, |TeX| means italic for lowercase and upright
  for uppercase. This option will
  override any |greek| or |Greek|
  option. The package defaults to |style=TeX|.
\item[greek=\meta{shape}] specifies the shape (|n|, |it|, or |sl|) for both
  the lowercase and uppercase Greek letters. So |greek=it| is
  like |style=ISO|, and |greek=n| is like |style=French|.
\item[Greek=\meta{shape}] specifies the shape (|n|, |it|, or |sl|)
  for only the uppercase Greek letters. To have lowercase
  upright and uppercase italic, use |greek=n,Greek=it|.
\item[series=\meta{series}] tells which series to use. The
  default is the value of \cs{seriesdefault} at the time of
  loading the package. See the \ctanpkg{libertine-legacy} package
  documentation for the admissible values (they include |m|,
  |b|, |bx| (=|b|) for Libertine and |m|, |b|, |bx| (=|b|), |o|, |s| for
  Biolinum). 
\item[boldseries=\meta{series}] tells which series to use in
  bold math. Default is
  \cs{bfdefault} at the time of loading the
  package.
\end{description}
\begin{enumerate}[(1)]
\item the bold italic Greek Libertine glyphs are missing from |libertine v5|
  and later versions up to |libertine-legacy| (or some bug in the font
  definition files triggers usage of \TeX{} font files not having the glyphs):
  the log file will contain ``Missing character'' entries, and the PDF will
  simply display nothing.  With |\tracinglostchars=3| and \TeX Live 2021 or
  later, these ``Missing character'''s will be reported as build errors by \TeX,
  as they should. Use bold slanted instead.
\item  the bold lowercase Greek Biolinum letters
are in fact not bold. 
\end{enumerate}

Advanced example of use (we use slanted rather than italic
to circumvent the problem mentioned above):
\begin{verbatim}
\documentclass{article}
\usepackage[scale=2,series=b,greek=sl,Greek=n]{libgreek}
\begin{document}
$\alpha\beta\gamma\phi\psi \Alpha\Beta\Gamma\Phi\Psi$
\end{document}
\end{verbatim}

As shown in the \autoref{table:libertine}, the package also defines control
sequences to access quite a few letters with diacritics.  The displayed glyphs
correspond to using |libgreek-legacy| with its default, i.e.\@ the serif font
(Libertine) is used, the lowercase italic letters are italic, and the
uppercase are upright.

\begin{table}[htbp]
\capstart
\DeleteShortVerb\|% a effet global !
\let\s\string
\ttfamily
% attention un center modifierait le \\ aussi pour l'intérieur de multicols
% (je suppose que j'aurais dû essayer en mettant le multicols dans un minipage)
\begin{multicols}{3}
\s\Alphatonos\hfill$\Alphatonos$\kern1em\\
\s\Epsilontonos\hfill$\Epsilontonos$\kern1em\\
\s\Etatonos\hfill$\Etatonos$\kern1em\\
\s\Iotadieresis\hfill$\Iotadieresis$\kern1em\\
\s\Iotatonos\hfill$\Iotatonos$\kern1em\\
\s\Omicrontonos\hfill$\Omicrontonos$\kern1em\\
\s\Upsilontonos\hfill$\Upsilontonos$\kern1em\\
\s\varUpsilontonos\hfill$\varUpsilontonos$\kern1em\\
\s\Upsilondieresis\hfill$\Upsilondieresis$\kern1em\\
\s\varUpsilondieresis\hfill$\varUpsilondieresis$\kern1em\\
\s\Omegatonos\hfill$\Omegatonos$\kern1em\\
\s\alphatonos\hfill$\alphatonos$\kern1em\\
\s\epsilontonos\hfill$\epsilontonos$\kern1em\\
\s\etatonos\hfill$\etatonos$\kern1em\\
\s\iotatonos\hfill$\iotatonos$\kern1em\\
\s\iotadieresis\hfill$\iotadieresis$\kern1em\\
\s\iotadieresistonos\hfill$\iotadieresistonos$\kern1em\\
\s\upsilontonos\hfill$\upsilontonos$\kern1em\\
\s\upsilondieresis\hfill$\upsilondieresis$\kern1em\\
\s\upsilondieresistonos\hfill$\upsilondieresistonos$\kern1em\\
\s\omicrontonos\hfill$\omicrontonos$\kern1em\\
\s\omegatonos\hfill$\omegatonos$\kern1em\\
\s\anoteleia\hfill$\anoteleia$\kern1em\\
\s\tonos\hfill$\tonos$\kern1em\\
\s\dieresistonos\hfill$\dieresistonos$\kern1em\par
\end{multicols}
\medskip
\centeredline{%
\begin{tabular}{|lc|lc|lc|lc|}
\hline
% heureusement qu'il y a Emacs et les copié-collés rectangulaires
% j'ai envisagé plusieurs autres approches dont du \halign à l'intérieur
% de multicols mais finalement je fais donc un tabular
\s\Alpha&$\Alpha$&     \s\Nu&$\Nu$&           \s\alpha&$\alpha$&     \s\nu&$\nu$\\
\s\Beta&$\Beta$&       \s\Xi&$\Xi$&           \s\beta&$\beta$&       \s\xi&$\xi$\\
\s\Gamma&$\Gamma$&     \s\Omicron&$\Omicron$& \s\gamma&$\gamma$&     \s\omicron&$\omicron$\\
\s\Delta&$\Delta$&     \s\Pi&$\Pi$&           \s\delta&$\delta$&     \s\pi&$\pi$\\
\s\Epsilon&$\Epsilon$& \s\Rho&$\Rho$&         \s\epsilon&$\epsilon$& \s\rho&$\rho$\\
\s\Zeta&$\Zeta$&       \s\Sigma&$\Sigma$&     \s\zeta&$\zeta$&       \s\sigma&$\sigma$\\
\s\Eta&$\Eta$&         \s\Tau&$\Tau$&         \s\eta&$\eta$&         \s\tau&$\tau$\\
\s\Theta&$\Theta$&     \s\Upsilon&$\Upsilon$& \s\theta&$\theta$&     \s\upsilon&$\upsilon$\\
\s\Iota&$\Iota$&       \s\Phi&$\Phi$&         \s\iota&$\iota$&       \s\phi&$\phi$\\
\s\Kappa&$\Kappa$&     \s\Chi&$\Chi$&         \s\kappa&$\kappa$&     \s\chi&$\chi$\\
\s\Lambda&$\Lambda$&   \s\Psi&$\Psi$&         \s\lambda&$\lambda$&   \s\psi&$\psi$\\
\s\Mu&$\Mu$&           \s\Omega&$\Omega$&     \s\mu&$\mu$&           \s\omega&$\omega$\\
\hline
\end{tabular}}
\medskip
% il faut mettre le \columnbreak avant le \\ ...
\begin{multicols}{3}\def\foo{\kern1cm}\raggedcolumns
\s\varsigma\hfill$\varsigma$\foo\\
\s\varvarsigma\hfill$\varvarsigma$\foo\\
\s\vartheta\hfill$\vartheta$\foo\\
\s\varphi\hfill$\varphi$\foo\\
\s\varpi\hfill$\varpi$\foo\\
\s\varkappa\hfill$\varkappa$\foo\\
\s\varvarkappa\hfill$\varvarkappa$\foo\columnbreak\\
\s\varepsilon\hfill$\varepsilon$\foo\\
\s\reversedvarepsilon\hfill$\reversedvarepsilon$\foo\\
\s\varrho\hfill$\varrho$\foo\\
\s\digamma\hfill$\digamma$\foo\\
\s\koppa\hfill$\koppa$\foo\\
\s\sampi\hfill$\sampi$\foo\columnbreak\\
\s\varTheta\hfill$\varTheta$\foo\\
\s\varUpsilon\hfill$\varUpsilon$\foo\\
\s\Digamma\hfill$\Digamma$\foo\\
\s\Koppa\hfill$\Koppa$\foo\\
\s\Sampi\hfill$\Sampi$\foo
\par
\end{multicols}
% il y a bien sûr d'horribles espacements verticaux typiques de LaTeX
\vspace*{-\baselineskip}
\caption[Greek letters via libgreek-legacy and Linux Libertine]
{Greek letters via libgreek-legacy and default configuration
  (i.e. no options, or equivalently options \texttt{[libertine,style=TeX]} giving
  upright uppercase, italic lowercase, and usage of the Libertine glyphs).  In
  the \texttt{1.0} \libgreek release of 2011 the \cs{varvarkappa} and
  \cs{varvarsigma} would have been upright like the uppercase letters, due to
  a bug which was fixed for the 2022 transformation into \libgreek-legacy.}
\label{table:libertine}
\end{table}


\MakeShortVerb\|

\section{Release history}

\libgreek was initially developed on a computer equipped with \TeX Live 2010
and was released on March 14, 2011. It got a documentation update on September 23,
2012, but its source code and version number 1.0 did not change then.

The initial release used files as included in the v4 version of the
\ctanpkg{libertine} package then maintained by Michael~\textsc{Niedermair} and
which allowed traditional non-Unicode \TeX{} engines to access glyphs of the
Unicode Linux Libertine fonts as designed by Philipp~H.~\textsc{Poll}.

By the time of \TeX Live 2012 (and even earlier), the files needed by \libgreek
had been moved to the \ctanpkg{libertine-legacy} package (maintained by
Bob~\textsc{Tennent}).  This documentation was updated in September 2012
to mention this. 

But around circa 2018 (I think) \ctanpkg{libertine-legacy} package was moved
to the ``Obsolete'' section of CTAN, and stopped being included in new \TeX
Live releases.  This means that \ctanpkg{libgreek}, although still included in
\TeX Live, was actually broken on new installations.  Theoretically the user
could still install \ctanpkg{libertine-legacy}
manually, but this is not easy
as it is not distributed as a |.tds.zip| archive on CTAN mirrors, and
furthermore the |libertine.map| may need to be renamed before being listed in
some |updmap.cfg| file, else it would clash with the |libertine.map| from the
current \ctanpkg{libertine} package (maintained by Bob~\textsc{Tennent}, and
which now can be used on all engines as it auto-detects the context).

This situation, and the fact that the \ctanpkg{libertinus-type1} package
(also maintained by Bob~\textsc{Tennent}, thanks Bob!) provides support files
for the LGR encoding, thus allowing to access Greek glyphs, motivated the 2022
release of \libgreek.

Thanks to Antoine~\textsc{Missier} (author of \ctanpkg{frenchmath}) for making
the author aware that \libgreek had ceased functioning and was in need of an
update, and indeed for quite some years already.


\StopEventually{\end{document}\endinput}
\cleardoublepage
%\newgeometry{hmarginratio=3:2}
\small

\makeatletter

\section{Implementation of the \libgreek package}

% https://github.com/latex3/latex2e/issues/563
\AddToHook{env/macrocode/after}{\@nobreakfalse}
\AddToHook{env/macrocode/begin}{\partopsep0pt\relax}

% The catcode hackery next is to avoid to have the guard be listed
% in the commented source code... (here <*legacy>)
% (c) 2012/11/19 jf burnol ;-)

\def\gardesactifs {\catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11 }
\def\gardesinactifs {\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12 }
\gardesactifs
\let</dtx>\relax
\let<*sty>\gardesinactifs

\MakePercentIgnore
%</dtx>
%<*sty>
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{libgreek}
         [2022/11/11 1.1 Greek in math mode via libertinus-type1 (JFB)]
\@ifpackageloaded{libgreek-legacy}{%
    \PackageWarning{libgreek}%
    {libgreek-legacy loaded previously, now aborting\@gobble}%
    \endinput
}{}%
%    \end{macrocode}
% We will use \ctanpkg{kvoptions} to handle options with |key=value| syntax.
% First let's check for some hint that \ctanpkg{libertine-legacy} is present
% and then hand over to the |libgreek-legacy|, but only if only legacy
% options have been used.
%    \begin{macrocode}
\RequirePackage{kvoptions}
\IfFileExists{ufxl03.fd}{%
    \define@key{libgreek}{libertinus}[0]{\global\let\libgreek@nolegacy\@empty}
    \define@key{libgreek}{serif}[0]{\global\let\libgreek@nolegacy\@empty}
    \define@key{libgreek}{libertine}[0]{}
    \define@key{libgreek}{sans}[0]{\global\let\libgreek@nolegacy\@empty}
    \define@key{libgreek}{biolinum}[0]{}
    \define@key{libgreek}{scale}[0]{}
    \define@key{libgreek}{upshape}[0]{\global\let\libgreek@nolegacy\@empty}
    \define@key{libgreek}{itshape}[0]{\global\let\libgreek@nolegacy\@empty}
    \define@key{libgreek}{style}[0]{}
    \define@key{libgreek}{Greek}[0]{}
    \define@key{libgreek}{greek}[0]{}
    \define@key{libgreek}{series}[0]{}
    \define@key{libgreek}{boldseries}[0]{}
    \define@key{libgreek}{alphabets}[0]{\global\let\libgreek@nolegacy\@empty}
%    \end{macrocode}
% Good that this will do only scope-obeying things.
%    \begin{macrocode}
    {\ProcessLocalKeyvalOptions*}%
    \ifdefined\libgreek@nolegacy\expandafter\@gobble\else\expandafter\@firstofone\fi
   {%
   \PackageInfo{libgreek}{%
   ****************************************************\MessageBreak
   File ufxl03.fd exists!\MessageBreak
   Thus, now handing over to libgreek-legacy.\MessageBreak
   To avoid this, use libertinus option.\MessageBreak
   ****************************************************\@gobbletwo
   }%
%    \end{macrocode}
% Let's transfer all options to |libgreek-legacy| without trying some shortcut.
%    \begin{macrocode}
   \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{libgreek-legacy}}%
   \ProcessOptions\relax
   \endinput
   \RequirePackage{libgreek-legacy}%
   }%
  }{}%
%    \end{macrocode}
% To minimize the author's task, we keep close to original code with minimal
% adaptations.  In particular I decided to keep the fact that |style| option
% makes the |Greek| and |greek| options ignored.  But there are some
% complications originating in the addition of the \cs{libgreeksetup}, which
% requires to keep a trace of various things, for example if |style| option is
% used at package level and then later on using \cs{libgreeksetup} the user
% employs the |Greek/greek| options.
%
% Although the user interface is kept in a maximally backwards compatible way
% (i.e.\@{} even if not falling back to ``legacy'' the option behaviour should
% be stable), the underlying architecture of the symbol fonts is completely
% different because this package assigns two symbol fonts, one for upright,
% the other one for italic-like, whereas the legacy package assigns one or two
% symbol fonts depending on whether lowercase and uppercase letters have been
% assigned or not the same shape.  In the legacy package the symbol fonts are
% mapped to either lowercase or uppercase, but in this more modern package,
% the symbol fonts are for the `upright' and `italic' shapes.
%
% The new |upshape| and |itshape| keys allow to configure what the \cs{...up}
% and \cs{...it} macros will actually use as shapes.
%    \begin{macrocode}
\def\libgreek@fontfamily{LibertinusSerif}
\def\libgreek@scale{1}
\def\libgreek@upshape{n}
\def\libgreek@itshape{it}
\newif\iflibgreek@upper@up\libgreek@upper@uptrue
\newif\iflibgreek@lower@up
\edef\libgreek@series{\seriesdefault}
\edef\libgreek@boldseries{\bfdefault}
\def\libgreek@upper@shape{\libgreek@upshape}
\def\libgreek@lower@shape{\libgreek@itshape}
\def\libgreek@style{TeX}
\newif\iflibgreek@sty
%    \end{macrocode}
% We use the \ctanpkg{keyval} interface mostly to not have to rework
% everything, if at all possible, into the \ctanpkg{kvoptions} declarative
% interface.  It is a very good thing that the latter package can be used
% without forcing on the user its own declarative interface... however this
% means that inputs such as |serif=false| do not generate errors but are
% handled exactly the same as |serif=true|...
%    \begin{macrocode}
\define@key{libgreek}{libertinus}[true]{}
\define@key{libgreek}{serif}[true]{\def\libgreek@fontfamily{LibertinusSerif}}
\define@key{libgreek}{libertine}[true]{\def\libgreek@fontfamily{LibertinusSerif}}
\define@key{libgreek}{sans}[true]{\def\libgreek@fontfamily{LibertinusSans}}
\define@key{libgreek}{biolinum}[true]{\def\libgreek@fontfamily{LibertinusSans}}
\define@key{libgreek}{scale}[1]{\def\libgreek@scale{#1}}
\define@key{libgreek}{upshape}{\edef\libgreek@upshape{#1}}
\define@key{libgreek}{itshape}{\edef\libgreek@itshape{#1}}
\define@key{libgreek}{style}{\edef\libgreek@style{#1}\libgreek@stytrue}
\define@key{libgreek}{Greek}{\edef\libgreek@upper@shape{#1}}
\define@key{libgreek}{greek}{\edef\libgreek@lower@shape{#1}%
                             \edef\libgreek@upper@shape{#1}}
\define@key{libgreek}{series}{\edef\libgreek@series{#1}}
\define@key{libgreek}{boldseries}{\edef\libgreek@boldseries{#1}}
%    \end{macrocode}
% The single truly Boolean option...
%    \begin{macrocode}
\DeclareBoolOption[false]{alphabets}
%    \end{macrocode}
% We need some auxiliaries to handle the |style| values.  As mentioned
% already, some extra stuff is executed for reasons of various scenarii
% with \cs{libgreeksetup}.
%    \begin{macrocode}
\def\libgreek@style@ISO{%
    \libgreek@upper@upfalse
    \libgreek@lower@upfalse
    \let\libgreek@upper@shape\libgreek@itshape
    \let\libgreek@lower@shape\libgreek@itshape
}
\def\libgreek@style@French{%
    \libgreek@upper@uptrue
    \libgreek@lower@uptrue
    \let\libgreek@upper@shape\libgreek@upshape
    \let\libgreek@lower@shape\libgreek@upshape
}
\def\libgreekk@style@TeX{%
    \libgreek@upper@uptrue
    \libgreek@lower@upfalse
    \let\libgreek@upper@shape\libgreek@upshape
    \let\libgreek@lower@shape\libgreek@itshape
}
%    \end{macrocode}
% This always resets the \cs{iflibgreek@sty} to false for \cs{libgreeksetup}
% being usable with |greek| and |Greek| keys.
%    \begin{macrocode}
\def\libgreek@process@style{%
   \libgreek@styfalse
   \ifcsname libgreek@style@\libgreek@style\endcsname
     \csname libgreek@style@\libgreek@style\endcsname
   \else
     \PackageWarning{libgreek}{Unknown style `\libgreek@style'}%
   \fi
}
%    \end{macrocode}
% This stuff is a bit involved, but this is done for maximal backwards
% compatibility in terms of stability of behaviour (of course the real maximal
% stability is when the ``legacy'' mode gets activated).
%    \begin{macrocode}
\def\libgreek@process@shapes{%
   \edef\libgreek@upper@shape{\libgreek@upper@shape}%
   \edef\libgreek@lower@shape{\libgreek@lower@shape}%
   \ifx\libgreek@upper@shape\libgreek@upshape
      \libgreek@upper@uptrue
   \else
      \ifx\libgreek@upper@shape\libgreek@itshape
         \libgreek@upper@upfalse
      \else
   \expandafter\in@\expandafter{\expandafter.\libgreek@upper@shape,}{.up,}%
   \ifin@\libgreek@upper@uptrue
   \else
     \expandafter\in@\expandafter{\expandafter.\libgreek@upper@shape,}{.it,}%
     \ifin@\libgreek@upper@upfalse
     \else
        \libgreek@process@upper@lastresort
   \fi\fi\fi\fi
   \ifx\libgreek@lower@shape\libgreek@itshape
      \libgreek@lower@upfalse
   \else
      \ifx\libgreek@lower@shape\libgreek@upshape
         \libgreek@lower@uptrue
      \else
   \expandafter\in@\expandafter{\expandafter.\libgreek@lower@shape,}{.it,}%
   \ifin@\libgreek@lower@upfalse
   \else
     \expandafter\in@\expandafter{\expandafter.\libgreek@lower@shape,}{.up,}%
     \ifin@\libgreek@lower@uptrue
     \else
        \libgreek@process@lower@lastresort
   \fi\fi\fi\fi
}% 
\def\libgreek@process@upper@lastresort{%
    \libgreek@upper@uptrue
    \let\libgreek@upshape\libgreek@upper@shape
}
\def\libgreek@process@lower@lastresort{%
    \libgreek@lower@upfalse
    \let\libgreek@itshape\libgreek@lower@shape
}
%    \end{macrocode}
% The fact that packages may be handed global options is rather dangerous.
% Fortunately \ctanpkg{kvoptions} has an interface to handle only local options.
%    \begin{macrocode}
\ProcessLocalKeyvalOptions*
%    \end{macrocode}
% This is as per the |libertinus-type1.sty| code.
%    \begin{macrocode}
\expandafter\edef\csname\libgreek@fontfamily @scale\endcsname{\libgreek@scale}
%    \end{macrocode}
% We now do the post-processing regarding the shape configuration after
% option parsing.  Once this is done we will reconfigure slightly
% \cs{libgreek@process@shapes} for usability in the document preamble or body,
% after the symbol fonts have been declared.  As is well-known the \LaTeX{}
% interface to math fonts is full of  ``only-preamble'' restrictions.
%    \begin{macrocode}
\iflibgreek@sty
  \libgreek@process@style
\else
  \libgreek@process@shapes
\fi
\def\libgreek@process@upper@lastresort{%
    \PackageWarning{libgreek}{%
                       Too late for the shape `\libgreek@upper@shape'\MessageBreak
                       originating in Greek or greek option. Ignored.\MessageBreak
                       Use `up' or `it'}%
}
\def\libgreek@process@lower@lastresort{%
    \PackageWarning{libgreek}{%
                       Too late for the shape `\libgreek@lower@shape'\MessageBreak
                       originating in greek option. Ignored.\MessageBreak
                       Use `up' or `it'}%
}
\def\libgreeksetup#1{%
    \setkeys{libgreek}{#1}%
    \iflibgreek@sty\libgreek@process@style\else\libgreek@process@shapes\fi
    \libgreek@setgreekcs
}
%    \end{macrocode}
% Almost all options must be restricted to the package loading time only.
%    \begin{macrocode}
\DisableKeyvalOption{libgreek}{libertinus}
\DisableKeyvalOption{libgreek}{serif}
\DisableKeyvalOption{libgreek}{libertine}
\DisableKeyvalOption{libgreek}{sans}
\DisableKeyvalOption{libgreek}{biolinum}
\DisableKeyvalOption{libgreek}{scale}
\DisableKeyvalOption{libgreek}{upshape}
\DisableKeyvalOption{libgreek}{itshape}
\DisableKeyvalOption{libgreek}{series}
\DisableKeyvalOption{libgreek}{boldseries}
\DisableKeyvalOption{libgreek}{alphabets}
%    \end{macrocode}
% Declarations of the two symbol fonts, one for `upright' (or whatever is
% configured by the |upshape| key), one for `italic' (or whatever is configured
% by the |itshape| key).  One can not specify distinct series, both
% `upright' and `italic' use the same font series.  This could be added but I
% doubt anyone will use the package to start with...
%    \begin{macrocode}
\DeclareFontEncoding{LGR}{}{}
\DeclareSymbolFont{libgreekup}{LGR}{\libgreek@fontfamily-TLF}
                                   {\libgreek@series}
                                   {\libgreek@upshape}
\SetSymbolFont{libgreekup}{bold}{LGR}{\libgreek@fontfamily-TLF}
                                     {\libgreek@boldseries}
                                     {\libgreek@upshape}
\DeclareSymbolFont{libgreekit}{LGR}{\libgreek@fontfamily-TLF}
                                   {\libgreek@series}
                                   {\libgreek@itshape}
\SetSymbolFont{libgreekit}{bold}{LGR}{\libgreek@fontfamily-TLF}
                                     {\libgreek@boldseries}
                                     {\libgreek@itshape}
%    \end{macrocode}
% As all Greek letters are already available in \cs{...up} and \cs{...it}
% variants, it is indeed not immediately pressing to have math alphabets, so
% let's not do it by default.
%    \begin{macrocode}
\iflibgreek@alphabets
   \DeclareSymbolFontAlphabet{\libgreekup}{libgreekup}
   \DeclareSymbolFontAlphabet{\libgreekit}{libgreekit}
\fi
%    \end{macrocode}
% Definition of the `|up|' \cs{mathchar}'s.  There are 48 `standard'
% ones plus 8 extras and 11 with diacritics for a total of 67 ones.
%
% Hesitation whether I should declare with \cs{mathalpha} \emph{only} if
% |alphabets| is passed to the package.
%    \begin{macrocode}
\DeclareMathSymbol{\Alphaup}{\mathalpha}{libgreekup}{65}
\DeclareMathSymbol{\Betaup}{\mathalpha}{libgreekup}{66}
\DeclareMathSymbol{\Gammaup}{\mathalpha}{libgreekup}{71}
\DeclareMathSymbol{\Deltaup}{\mathalpha}{libgreekup}{68}
\DeclareMathSymbol{\Epsilonup}{\mathalpha}{libgreekup}{69}
\DeclareMathSymbol{\Zetaup}{\mathalpha}{libgreekup}{90}
\DeclareMathSymbol{\Etaup}{\mathalpha}{libgreekup}{72}
\DeclareMathSymbol{\Thetaup}{\mathalpha}{libgreekup}{74}
\DeclareMathSymbol{\Iotaup}{\mathalpha}{libgreekup}{73}
\DeclareMathSymbol{\Kappaup}{\mathalpha}{libgreekup}{75}
\DeclareMathSymbol{\Lambdaup}{\mathalpha}{libgreekup}{76}
\DeclareMathSymbol{\Muup}{\mathalpha}{libgreekup}{77}
\DeclareMathSymbol{\Nuup}{\mathalpha}{libgreekup}{78}
\DeclareMathSymbol{\Xiup}{\mathalpha}{libgreekup}{88}
\DeclareMathSymbol{\Omicronup}{\mathalpha}{libgreekup}{79}
\DeclareMathSymbol{\Piup}{\mathalpha}{libgreekup}{80}
\DeclareMathSymbol{\Rhoup}{\mathalpha}{libgreekup}{82}
\DeclareMathSymbol{\Sigmaup}{\mathalpha}{libgreekup}{83}
\DeclareMathSymbol{\Tauup}{\mathalpha}{libgreekup}{84}
\DeclareMathSymbol{\Upsilonup}{\mathalpha}{libgreekup}{85}
\DeclareMathSymbol{\Phiup}{\mathalpha}{libgreekup}{70}
\DeclareMathSymbol{\Chiup}{\mathalpha}{libgreekup}{81}
\DeclareMathSymbol{\Psiup}{\mathalpha}{libgreekup}{89}
\DeclareMathSymbol{\Omegaup}{\mathalpha}{libgreekup}{87}
\DeclareMathSymbol{\alphaup}{\mathalpha}{libgreekup}{97}
\DeclareMathSymbol{\betaup}{\mathalpha}{libgreekup}{98}
\DeclareMathSymbol{\gammaup}{\mathalpha}{libgreekup}{103}
\DeclareMathSymbol{\deltaup}{\mathalpha}{libgreekup}{100}
\DeclareMathSymbol{\epsilonup}{\mathalpha}{libgreekup}{101}
\DeclareMathSymbol{\zetaup}{\mathalpha}{libgreekup}{122}
\DeclareMathSymbol{\etaup}{\mathalpha}{libgreekup}{104}
\DeclareMathSymbol{\thetaup}{\mathalpha}{libgreekup}{106}
\DeclareMathSymbol{\iotaup}{\mathalpha}{libgreekup}{105}
\DeclareMathSymbol{\kappaup}{\mathalpha}{libgreekup}{107}
\DeclareMathSymbol{\lambdaup}{\mathalpha}{libgreekup}{108}
\DeclareMathSymbol{\muup}{\mathalpha}{libgreekup}{109}
\DeclareMathSymbol{\nuup}{\mathalpha}{libgreekup}{110}
\DeclareMathSymbol{\xiup}{\mathalpha}{libgreekup}{120}
\DeclareMathSymbol{\omicronup}{\mathalpha}{libgreekup}{111}
\DeclareMathSymbol{\piup}{\mathalpha}{libgreekup}{112}
\DeclareMathSymbol{\rhoup}{\mathalpha}{libgreekup}{114}
\DeclareMathSymbol{\sigmaup}{\mathalpha}{libgreekup}{115}
\DeclareMathSymbol{\tauup}{\mathalpha}{libgreekup}{116}
\DeclareMathSymbol{\upsilonup}{\mathalpha}{libgreekup}{117}
\DeclareMathSymbol{\phiup}{\mathalpha}{libgreekup}{102}
\DeclareMathSymbol{\chiup}{\mathalpha}{libgreekup}{113}
\DeclareMathSymbol{\psiup}{\mathalpha}{libgreekup}{121}
\DeclareMathSymbol{\omegaup}{\mathalpha}{libgreekup}{119}
%    \end{macrocode}
% Defintion of the `|it|' \cs{mathchar}'s.
%    \begin{macrocode}
\DeclareMathSymbol{\Alphait}{\mathalpha}{libgreekit}{65}
\DeclareMathSymbol{\Betait}{\mathalpha}{libgreekit}{66}
\DeclareMathSymbol{\Gammait}{\mathalpha}{libgreekit}{71}
\DeclareMathSymbol{\Deltait}{\mathalpha}{libgreekit}{68}
\DeclareMathSymbol{\Epsilonit}{\mathalpha}{libgreekit}{69}
\DeclareMathSymbol{\Zetait}{\mathalpha}{libgreekit}{90}
\DeclareMathSymbol{\Etait}{\mathalpha}{libgreekit}{72}
\DeclareMathSymbol{\Thetait}{\mathalpha}{libgreekit}{74}
\DeclareMathSymbol{\Iotait}{\mathalpha}{libgreekit}{73}
\DeclareMathSymbol{\Kappait}{\mathalpha}{libgreekit}{75}
\DeclareMathSymbol{\Lambdait}{\mathalpha}{libgreekit}{76}
\DeclareMathSymbol{\Muit}{\mathalpha}{libgreekit}{77}
\DeclareMathSymbol{\Nuit}{\mathalpha}{libgreekit}{78}
\DeclareMathSymbol{\Xiit}{\mathalpha}{libgreekit}{88}
\DeclareMathSymbol{\Omicronit}{\mathalpha}{libgreekit}{79}
\DeclareMathSymbol{\Piit}{\mathalpha}{libgreekit}{80}
\DeclareMathSymbol{\Rhoit}{\mathalpha}{libgreekit}{82}
\DeclareMathSymbol{\Sigmait}{\mathalpha}{libgreekit}{83}
\DeclareMathSymbol{\Tauit}{\mathalpha}{libgreekit}{84}
\DeclareMathSymbol{\Upsilonit}{\mathalpha}{libgreekit}{85}
\DeclareMathSymbol{\Phiit}{\mathalpha}{libgreekit}{70}
\DeclareMathSymbol{\Chiit}{\mathalpha}{libgreekit}{81}
\DeclareMathSymbol{\Psiit}{\mathalpha}{libgreekit}{89}
\DeclareMathSymbol{\Omegait}{\mathalpha}{libgreekit}{87}
\DeclareMathSymbol{\alphait}{\mathalpha}{libgreekit}{97}
\DeclareMathSymbol{\betait}{\mathalpha}{libgreekit}{98}
\DeclareMathSymbol{\gammait}{\mathalpha}{libgreekit}{103}
\DeclareMathSymbol{\deltait}{\mathalpha}{libgreekit}{100}
\DeclareMathSymbol{\epsilonit}{\mathalpha}{libgreekit}{101}
\DeclareMathSymbol{\zetait}{\mathalpha}{libgreekit}{122}
\DeclareMathSymbol{\etait}{\mathalpha}{libgreekit}{104}
\DeclareMathSymbol{\thetait}{\mathalpha}{libgreekit}{106}
\DeclareMathSymbol{\iotait}{\mathalpha}{libgreekit}{105}
\DeclareMathSymbol{\kappait}{\mathalpha}{libgreekit}{107}
\DeclareMathSymbol{\lambdait}{\mathalpha}{libgreekit}{108}
\DeclareMathSymbol{\muit}{\mathalpha}{libgreekit}{109}
\DeclareMathSymbol{\nuit}{\mathalpha}{libgreekit}{110}
\DeclareMathSymbol{\xiit}{\mathalpha}{libgreekit}{120}
\DeclareMathSymbol{\omicronit}{\mathalpha}{libgreekit}{111}
\DeclareMathSymbol{\piit}{\mathalpha}{libgreekit}{112}
\DeclareMathSymbol{\rhoit}{\mathalpha}{libgreekit}{114}
\DeclareMathSymbol{\sigmait}{\mathalpha}{libgreekit}{115}
\DeclareMathSymbol{\tauit}{\mathalpha}{libgreekit}{116}
\DeclareMathSymbol{\upsilonit}{\mathalpha}{libgreekit}{117}
\DeclareMathSymbol{\phiit}{\mathalpha}{libgreekit}{102}
\DeclareMathSymbol{\chiit}{\mathalpha}{libgreekit}{113}
\DeclareMathSymbol{\psiit}{\mathalpha}{libgreekit}{121}
\DeclareMathSymbol{\omegait}{\mathalpha}{libgreekit}{119}
%    \end{macrocode}
% Alternate shapes and other glyphs.
%    \begin{macrocode}
\DeclareMathSymbol{\varsigmaup}{\mathalpha}{libgreekup}{99}
\DeclareMathSymbol{\varvarsigmaup}{\mathalpha}{libgreekup}{6}
\DeclareMathSymbol{\varSigmaup}{\mathalpha}{libgreekup}{22}
\DeclareMathSymbol{\Sampiup}{\mathalpha}{libgreekup}{23}
\DeclareMathSymbol{\sampiup}{\mathalpha}{libgreekup}{27}
\DeclareMathSymbol{\digammaup}{\mathalpha}{libgreekup}{147}
\DeclareMathSymbol{\Digammaup}{\mathalpha}{libgreekup}{195}
\DeclareMathSymbol{\koppaup}{\mathalpha}{libgreekup}{18}
\DeclareMathSymbol{\varsigmait}{\mathalpha}{libgreekit}{99}
\DeclareMathSymbol{\varvarsigmait}{\mathalpha}{libgreekit}{6}
\DeclareMathSymbol{\varSigmait}{\mathalpha}{libgreekit}{22}
\DeclareMathSymbol{\Sampiit}{\mathalpha}{libgreekit}{23}
\DeclareMathSymbol{\sampiit}{\mathalpha}{libgreekit}{27}
\DeclareMathSymbol{\digammait}{\mathalpha}{libgreekit}{147}
\DeclareMathSymbol{\Digammait}{\mathalpha}{libgreekit}{195}
\DeclareMathSymbol{\koppait}{\mathalpha}{libgreekit}{18}
%    \end{macrocode}
% Some glyphs with diacritics.  I hesitated keeping this,
% which comes from some file I had constituted in September 2011
% to use LGR encoded fonts, and which I am reusing here.
% I hesitated also defining for them both `|up|' and `|it|' shapes.
%    \begin{macrocode}
\DeclareMathSymbol{\alphatonosup}{\mathalpha}{libgreekup}{136}
\DeclareMathSymbol{\epsilontonosup}{\mathalpha}{libgreekup}{232}
\DeclareMathSymbol{\etatonosup}{\mathalpha}{libgreekup}{160}
\DeclareMathSymbol{\iotatonosup}{\mathalpha}{libgreekup}{208}
\DeclareMathSymbol{\omicrontonosup}{\mathalpha}{libgreekup}{236}
\DeclareMathSymbol{\upsilontonosup}{\mathalpha}{libgreekup}{212}
\DeclareMathSymbol{\omegatonosup}{\mathalpha}{libgreekup}{184}
\DeclareMathSymbol{\upsilondieresistonosup}{\mathalpha}{libgreekup}{246}
\DeclareMathSymbol{\iotadieresisup}{\mathalpha}{libgreekup}{240}
\DeclareMathSymbol{\iotadieresistonosup}{\mathalpha}{libgreekup}{242}
\DeclareMathSymbol{\upsilondieresisup}{\mathalpha}{libgreekup}{244}
\DeclareMathSymbol{\alphatonosit}{\mathalpha}{libgreekit}{136}
\DeclareMathSymbol{\epsilontonosit}{\mathalpha}{libgreekit}{232}
\DeclareMathSymbol{\etatonosit}{\mathalpha}{libgreekit}{160}
\DeclareMathSymbol{\iotatonosit}{\mathalpha}{libgreekit}{208}
\DeclareMathSymbol{\omicrontonosit}{\mathalpha}{libgreekit}{236}
\DeclareMathSymbol{\upsilontonosit}{\mathalpha}{libgreekit}{212}
\DeclareMathSymbol{\omegatonosit}{\mathalpha}{libgreekit}{184}
\DeclareMathSymbol{\upsilondieresistonosit}{\mathalpha}{libgreekit}{246}
\DeclareMathSymbol{\iotadieresisit}{\mathalpha}{libgreekit}{240}
\DeclareMathSymbol{\iotadieresistonosit}{\mathalpha}{libgreekit}{242}
\DeclareMathSymbol{\upsilondieresisit}{\mathalpha}{libgreekit}{244}
%    \end{macrocode}
% Definition of the \cs{mathchar}'s without `|up/it|' postfix. There are 27
% uppercase and 40 lowercase letters, for a total of 67 glyphs.  Actually, as
% stated above, I had done some work with LGR in September 2011 when I
% realized that bold italic had gone missing from the ``8bit'' font support of
% libertine v5 compared to libertine v4, and was vaguely hoping that going via
% the LGR encoded font definition files would help, but it did not.  I kept
% the file around, and basically only had to replace the font family name, or
% so I thought about ten days ago when I started re-examining the matter.  But
% at no point did I go back to check if I had done exhaustive work in 2011 and
% whether some other glyphs could be accounted for by LGR (I did re-check an
% old file about the LGR encoding I had from that 2011 work, but did not try
% to check for updates).  Anyway, it is very doubtful whether it made any
% sense for \libgreek to define control sequences for Greek letters with
% diacritics...
%    \begin{macrocode}
\def\libgreek@setgreekcs{%
    \iflibgreek@upper@up
       \let\Alpha\Alphaup
       \let\Beta\Betaup
       \let\Gamma\Gammaup
       \let\Delta\Deltaup
       \let\Epsilon\Epsilonup
       \let\Zeta\Zetaup
       \let\Eta\Etaup
       \let\Theta\Thetaup
       \let\Iota\Iotaup
       \let\Kappa\Kappaup
       \let\Lambda\Lambdaup
       \let\Mu\Muup
       \let\Nu\Nuup
       \let\Xi\Xiup
       \let\Omicron\Omicronup
       \let\Pi\Piup
       \let\Rho\Rhoup
       \let\Sigma\Sigmaup
       \let\Tau\Tauup
       \let\Upsilon\Upsilonup
       \let\Phi\Phiup
       \let\Chi\Chiup
       \let\Psi\Psiup
       \let\Omega\Omegaup
       \let\Sampi\Sampiup
       \let\Digamma\Digammaup
       \let\varSigma\varSigmaup
    \else
       \let\Alpha\Alphait
       \let\Beta\Betait
       \let\Gamma\Gammait
       \let\Delta\Deltait
       \let\Epsilon\Epsilonit
       \let\Zeta\Zetait
       \let\Eta\Etait
       \let\Theta\Thetait
       \let\Iota\Iotait
       \let\Kappa\Kappait
       \let\Lambda\Lambdait
       \let\Mu\Muit
       \let\Nu\Nuit
       \let\Xi\Xiit
       \let\Omicron\Omicronit
       \let\Pi\Piit
       \let\Rho\Rhoit
       \let\Sigma\Sigmait
       \let\Tau\Tauit
       \let\Upsilon\Upsilonit
       \let\Phi\Phiit
       \let\Chi\Chiit
       \let\Psi\Psiit
       \let\Omega\Omegait
       \let\Sampi\Sampiit
       \let\Digamma\Digammait
       \let\varSigma\varSigmait
    \fi
    \iflibgreek@lower@up
       \let\alpha\alphaup
       \let\beta\betaup
       \let\gamma\gammaup
       \let\delta\deltaup
       \let\epsilon\epsilonup
       \let\zeta\zetaup
       \let\eta\etaup
       \let\theta\thetaup
       \let\iota\iotaup
       \let\kappa\kappaup
       \let\lambda\lambdaup
       \let\mu\muup
       \let\nu\nuup
       \let\xi\xiup
       \let\omicron\omicronup
       \let\pi\piup
       \let\rho\rhoup
       \let\sigma\sigmaup
       \let\tau\tauup
       \let\upsilon\upsilonup
       \let\phi\phiup
       \let\chi\chiup
       \let\psi\psiup
       \let\omega\omegaup
       \let\varsigma\varsigmaup
       \let\varvarsigma\varvarsigmaup
       \let\sampi\sampiup
       \let\digamma\digammaup
       \let\koppa\koppaup
       \let\alphatonos\alphatonosup
       \let\epsilontonos\epsilontonosup
       \let\etatonos\etatonosup
       \let\iotatonos\iotatonosup
       \let\omicrontonos\omicrontonosup
       \let\upsilontonos\upsilontonosup
       \let\omegatonos\omegatonosup
       \let\upsilondieresistonos\upsilondieresistonosup
       \let\iotadieresis\iotadieresisup
       \let\iotadieresistonos\iotadieresistonosup
       \let\upsilondieresis\upsilondieresisup
    \else
       \let\alpha\alphait
       \let\beta\betait
       \let\gamma\gammait
       \let\delta\deltait
       \let\epsilon\epsilonit
       \let\zeta\zetait
       \let\eta\etait
       \let\theta\thetait
       \let\iota\iotait
       \let\kappa\kappait
       \let\lambda\lambdait
       \let\mu\muit
       \let\nu\nuit
       \let\xi\xiit
       \let\omicron\omicronit
       \let\pi\piit
       \let\rho\rhoit
       \let\sigma\sigmait
       \let\tau\tauit
       \let\upsilon\upsilonit
       \let\phi\phiit
       \let\chi\chiit
       \let\psi\psiit
       \let\omega\omegait
       \let\varsigma\varsigmait
       \let\varvarsigma\varvarsigmait
       \let\sampi\sampiit
       \let\digamma\digammait
       \let\koppa\koppait
       \let\alphatonos\alphatonosit
       \let\epsilontonos\epsilontonosit
       \let\etatonos\etatonosit
       \let\iotatonos\iotatonosit
       \let\omicrontonos\omicrontonosit
       \let\upsilontonos\upsilontonosit
       \let\omegatonos\omegatonosit
       \let\upsilondieresistonos\upsilondieresistonosit
       \let\iotadieresis\iotadieresisit
       \let\iotadieresistonos\iotadieresistonosit
       \let\upsilondieresis\upsilondieresisit
    \fi
}%
\libgreek@setgreekcs
%    \end{macrocode}
% And we have now reached the end of the \libgreek package code.  The actual
% |.sty| file will contain an \cs{endinput} added by the DocStrip extraction.
%\MakePercentComment
%</sty>
%<*dtx>
\section{Implementation of the \libgreek-legacy package}
\gardesactifs
\let</dtx>\relax
\let<*legacy>\gardesinactifs
\global\c@CodelineNo\z@
\MakePercentIgnore
We use a rather short summary line because the package name is long and we are
maniac and want the thing to occupy only one line in the log file...
%</dtx>
%<*legacy>
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{libgreek-legacy}
         [2022/11/11 1.1 libertine-legacy math Greek (JFB)]
%    \end{macrocode}
% The font support from obsolete package \ctanpkg{libertine-legacy} must be
% present.  The legacy code used one of two possible font definition files for
% the LaTeX font system with |U| encoding, either associated with Libertine or
% Biolinum.  We check if the Libertine-associated file exists, else abort with
% an Error.
%    \begin{macrocode}
\IfFileExists{ufxl03.fd}{%
    }{%
\PackageError{libgreek-legacy}{%
    Required font support file not present%
    }{%
    Is (now obsolete) libertine-legacy or earlier libertine v4 or v5\MessageBreak
    package installed on your system?\MessageBreak
    Maybe you meant to use libgreek not libgreek-legacy?\MessageBreak
    Try again with libgreek, not libgreek-legacy.  Will abort now, sorry}%
    \endinput
}
%    \end{macrocode}
% Now back to the old 2011 code.
%    \begin{macrocode}
\def\libgreek@font{fxl03}
\def\libgreek@shape{it}
\def\libgreek@uppershape{n}
\newif\iflibgreek@twoshapes\libgreek@twoshapestrue
\edef\libgreek@series{\seriesdefault}
\edef\libgreek@boldseries{\bfdefault}
\newif\iflibgreek@sty
%    \end{macrocode}
% Original package used only \ctanpkg{keyval} package and handled options via
% a \cs{ProcessOptionsWithKV} which had been copied-pasted from some forgotten
% source.  Let's rather load \ctanpkg{kvoptions}.  But we will not use its
% declarative interface, only \cs{define@key} directly.
%
% No need  for a \cs{fxb@scale} for Biolinum as file |ufxb03.fd| also uses \cs{fxl@scale}.
%    \begin{macrocode}
\RequirePackage{kvoptions}
\define@key{libgreek}{scale}[1]{\def\fxl@scale{#1}}
%    \end{macrocode}
% The |1.0| code did not let the |libertine| key do the \cs{def} as has been
% added at |1.1|, thus in situation with |biolinum,libertine| it did not
% revert action of |biolinum|.
%
% By the way this \ctanpkg{keyval} strange syntax means that
% |libertine=false| will have exact same effect |libertine=true|... it is only
% there to allow its usage without a |=value| part...
%    \begin{macrocode}
\define@key{libgreek}{libertine}[true]{\def\libgreek@font{fxl03}}
\define@key{libgreek}{biolinum}[true]{\def\libgreek@font{fxb03}}
\define@key{libgreek}{style}{\libgreek@stytrue\edef\libgreek@style{#1}}
\define@key{libgreek}{Greek}{\def\libgreek@Greekshape{#1}}
\define@key{libgreek}{greek}{\edef\libgreek@shape{#1}
                             \edef\libgreek@uppershape{#1}}
\define@key{libgreek}{series}{\edef\libgreek@series{#1}}
\define@key{libgreek}{boldseries}{\edef\libgreek@boldseries{#1}}
%    \end{macrocode}
% Now we call the \ctanpkg{kvoptions} interface.  We did not change the family
% key from legacy code so we have to inform \ctanpkg{kvoptions} about that.
% Then \cs{ProcessKeyvalOptions} replaces the |1.0| definition of some
% \cs{ProcessOptionsWithKV}.  No need to set the |prefix| key as we don't
% use \ctanpkg{kvoptions} declarative interface.
%    \begin{macrocode}
\SetupKeyvalOptions{family=libgreek}
\ProcessKeyvalOptions*
%    \end{macrocode}
% The |1.0| code uses one or two Symbol fonts, depending on whether the shape
% for uppercase is same or differs from the shape for lowercase.  Indeed it
% assigns one symbol font to lowercase and one symbol font for uppercase.
%    \begin{macrocode}
\def\lbg@ISO{ISO}
\def\lbg@French{French}
\iflibgreek@sty
   \ifx\libgreek@style\lbg@ISO
        \def\libgreek@shape{it}
        \libgreek@twoshapesfalse
   \else
   \ifx\libgreek@style\lbg@French
        \def\libgreek@shape{n}
        \libgreek@twoshapesfalse
   \else
       \def\libgreek@shape{it}
       \def\libgreek@uppershape{n}
   \fi\fi
\else
 \ifx\libgreek@Greekshape\undefined
         \else\edef\libgreek@uppershape{\libgreek@Greekshape}\fi
 \ifx\libgreek@shape\libgreek@uppershape\libgreek@twoshapesfalse\fi
\fi
%    \end{macrocode}
% The |libgreekfont|  is the one for lowercase (and perhaps uppercase).
%    \begin{macrocode}
\DeclareSymbolFont{libgreekfont}{U}{\libgreek@font}
                                   {\libgreek@series}
                                   {\libgreek@shape}
\SetSymbolFont{libgreekfont}{bold}{U}{\libgreek@font}
                                     {\libgreek@boldseries}
                                     {\libgreek@shape}
\def\libgreek@Greek{libgreekfont}
%    \end{macrocode}
% If a separate one is needed for uppercase it is |libGreekfont|.
%    \begin{macrocode}
\iflibgreek@twoshapes
  \DeclareSymbolFont{libGreekfont}{U}{\libgreek@font}
                                     {\libgreek@series}
                                     {\libgreek@uppershape}
  \SetSymbolFont{libGreekfont}{bold}{U}{\libgreek@font}
                                       {\libgreek@boldseries}
                                       {\libgreek@uppershape}
  \def\libgreek@Greek{libGreekfont}
\fi
%    \end{macrocode}
%  The macro \cs{libgreek@Greek} holds the symbol font name for uppercase.
%
%  Here the legacy code has all definitions done in the order of the
%  codepoint; this was a bit perilous as lowercase may be intermixed with
%  uppercase, and indeed on two occasions (\cs{varvarkappa} and
%  \cs{varvarsigma}) the possibly wrong font was assigned.
%
%  Apart from that, it is not exactly clear why I decided to define control
%  sequences for letters with diacritics; it was not even really documented,
%  as the user was only invited to check a |libgreekcheck.tex| file (now not
%  included anymore among extracted files from the |.dtx|).
%
%  Another thing to notice is that all those Greek letters are here defined to
%  be of type \cs{mathord}.
%    \begin{macrocode}
\DeclareMathSymbol{\Alphatonos}{\mathord}{\libgreek@Greek}{134}
\DeclareMathSymbol{\anoteleia}{\mathord}{libgreekfont}{135}
\DeclareMathSymbol{\Epsilontonos}{\mathord}{\libgreek@Greek}{136}
\DeclareMathSymbol{\Etatonos}{\mathord}{\libgreek@Greek}{137}
\DeclareMathSymbol{\Iotatonos}{\mathord}{\libgreek@Greek}{138}
\DeclareMathSymbol{\Omicrontonos}{\mathord}{\libgreek@Greek}{140}
\DeclareMathSymbol{\Upsilontonos}{\mathord}{\libgreek@Greek}{142}
\DeclareMathSymbol{\Omegatonos}{\mathord}{\libgreek@Greek}{143}
\DeclareMathSymbol{\iotadieresistonos}{\mathord}{libgreekfont}{144}
\DeclareMathSymbol{\Alpha}{\mathord}{\libgreek@Greek}{145}
\DeclareMathSymbol{\Beta}{\mathord}{\libgreek@Greek}{146}
\DeclareMathSymbol{\Gamma}{\mathord}{\libgreek@Greek}{147}
\DeclareMathSymbol{\Delta}{\mathord}{\libgreek@Greek}{148}
\DeclareMathSymbol{\Epsilon}{\mathord}{\libgreek@Greek}{149}
\DeclareMathSymbol{\Zeta}{\mathord}{\libgreek@Greek}{150}
\DeclareMathSymbol{\Eta}{\mathord}{\libgreek@Greek}{151}
\DeclareMathSymbol{\Theta}{\mathord}{\libgreek@Greek}{152}
\DeclareMathSymbol{\Iota}{\mathord}{\libgreek@Greek}{153}
\DeclareMathSymbol{\Kappa}{\mathord}{\libgreek@Greek}{154}
\DeclareMathSymbol{\Lambda}{\mathord}{\libgreek@Greek}{155}
\DeclareMathSymbol{\Mu}{\mathord}{\libgreek@Greek}{156}
\DeclareMathSymbol{\Nu}{\mathord}{\libgreek@Greek}{157}
\DeclareMathSymbol{\Xi}{\mathord}{\libgreek@Greek}{158}
\DeclareMathSymbol{\Omicron}{\mathord}{\libgreek@Greek}{159}
\DeclareMathSymbol{\Pi}{\mathord}{\libgreek@Greek}{160}
\DeclareMathSymbol{\Rho}{\mathord}{\libgreek@Greek}{161}
\DeclareMathSymbol{\Sigma}{\mathord}{\libgreek@Greek}{163}
\DeclareMathSymbol{\Tau}{\mathord}{\libgreek@Greek}{164}
\DeclareMathSymbol{\Upsilon}{\mathord}{\libgreek@Greek}{165}
\DeclareMathSymbol{\Phi}{\mathord}{\libgreek@Greek}{166}
\DeclareMathSymbol{\Chi}{\mathord}{\libgreek@Greek}{167}
\DeclareMathSymbol{\Psi}{\mathord}{\libgreek@Greek}{168}
\DeclareMathSymbol{\Omega}{\mathord}{\libgreek@Greek}{169}
\DeclareMathSymbol{\Iotadieresis}{\mathord}{\libgreek@Greek}{170}
\DeclareMathSymbol{\Upsilondieresis}{\mathord}{\libgreek@Greek}{171}
\DeclareMathSymbol{\alphatonos}{\mathord}{libgreekfont}{172}
\DeclareMathSymbol{\epsilontonos}{\mathord}{libgreekfont}{173}
\DeclareMathSymbol{\etatonos}{\mathord}{libgreekfont}{174}
\DeclareMathSymbol{\iotatonos}{\mathord}{libgreekfont}{175}
\DeclareMathSymbol{\upsilondieresistonos}{\mathord}{libgreekfont}{176}
\DeclareMathSymbol{\alpha}{\mathord}{libgreekfont}{177}
\DeclareMathSymbol{\beta}{\mathord}{libgreekfont}{178}
\DeclareMathSymbol{\gamma}{\mathord}{libgreekfont}{179}
\DeclareMathSymbol{\delta}{\mathord}{libgreekfont}{180}
\DeclareMathSymbol{\epsilon}{\mathord}{libgreekfont}{181}
\DeclareMathSymbol{\zeta}{\mathord}{libgreekfont}{182}
\DeclareMathSymbol{\eta}{\mathord}{libgreekfont}{183}
\DeclareMathSymbol{\theta}{\mathord}{libgreekfont}{184}
\DeclareMathSymbol{\iota}{\mathord}{libgreekfont}{185}
\DeclareMathSymbol{\kappa}{\mathord}{libgreekfont}{186}
\DeclareMathSymbol{\lambda}{\mathord}{libgreekfont}{187}
\DeclareMathSymbol{\mu}{\mathord}{libgreekfont}{188}
\DeclareMathSymbol{\nu}{\mathord}{libgreekfont}{189}
\DeclareMathSymbol{\xi}{\mathord}{libgreekfont}{190}
\DeclareMathSymbol{\omicron}{\mathord}{libgreekfont}{191}
\DeclareMathSymbol{\pi}{\mathord}{libgreekfont}{192}
\DeclareMathSymbol{\rho}{\mathord}{libgreekfont}{193}
\DeclareMathSymbol{\varsigma}{\mathord}{libgreekfont}{194}
\DeclareMathSymbol{\sigma}{\mathord}{libgreekfont}{195}
\DeclareMathSymbol{\tau}{\mathord}{libgreekfont}{196}
\DeclareMathSymbol{\upsilon}{\mathord}{libgreekfont}{197}
\DeclareMathSymbol{\phi}{\mathord}{libgreekfont}{198}
\DeclareMathSymbol{\chi}{\mathord}{libgreekfont}{199}
\DeclareMathSymbol{\psi}{\mathord}{libgreekfont}{200}
\DeclareMathSymbol{\omega}{\mathord}{libgreekfont}{201}
\DeclareMathSymbol{\iotadieresis}{\mathord}{libgreekfont}{202}
\DeclareMathSymbol{\upsilondieresis}{\mathord}{libgreekfont}{203}
\DeclareMathSymbol{\omicrontonos}{\mathord}{libgreekfont}{204}
\DeclareMathSymbol{\upsilontonos}{\mathord}{libgreekfont}{205}
\DeclareMathSymbol{\omegatonos}{\mathord}{libgreekfont}{206}
\DeclareMathSymbol{\vartheta}{\mathord}{libgreekfont}{209}
\DeclareMathSymbol{\varUpsilon}{\mathord}{\libgreek@Greek}{210}
\DeclareMathSymbol{\varUpsilontonos}{\mathord}{\libgreek@Greek}{211}
\DeclareMathSymbol{\varUpsilondieresis}{\mathord}{\libgreek@Greek}{212}
\DeclareMathSymbol{\varphi}{\mathord}{libgreekfont}{213}
\DeclareMathSymbol{\varpi}{\mathord}{libgreekfont}{214}
%    \end{macrocode}
% The |1.0| code used \cs{libgreek@Greek} here for the next two but
% this was a bug, so after some hesitation I fix it for the |1.1| release,
% eleven years later...
%    \begin{macrocode}
\DeclareMathSymbol{\varvarkappa}{\mathord}{libgreekfont}{215}
\DeclareMathSymbol{\varvarsigma}{\mathord}{libgreekfont}{219}
\DeclareMathSymbol{\Digamma}{\mathord}{\libgreek@Greek}{220}
\DeclareMathSymbol{\digamma}{\mathord}{libgreekfont}{221}
\DeclareMathSymbol{\Koppa}{\mathord}{\libgreek@Greek}{222}
\DeclareMathSymbol{\koppa}{\mathord}{libgreekfont}{223}
\DeclareMathSymbol{\Sampi}{\mathord}{\libgreek@Greek}{224}
\DeclareMathSymbol{\sampi}{\mathord}{libgreekfont}{225}
\DeclareMathSymbol{\varkappa}{\mathord}{libgreekfont}{240}
\DeclareMathSymbol{\varrho}{\mathord}{libgreekfont}{241}
\DeclareMathSymbol{\varTheta}{\mathord}{\libgreek@Greek}{244}
\DeclareMathSymbol{\varepsilon}{\mathord}{libgreekfont}{245}
\DeclareMathSymbol{\reversedvarepsilon}{\mathord}{libgreekfont}{246}
%    \end{macrocode}
% Those for some reason got listed here last, despite having lower
% codepoints.
%    \begin{macrocode}
\DeclareMathSymbol{\tonos}{\mathord}{libgreekfont}{132}
\DeclareMathSymbol{\dieresistonos}{\mathord}{libgreekfont}{133}
%    \end{macrocode}
% And we have now reached the end of the \libgreek-legacy package code.  The actual
% |.sty| file will contain an \cs{endinput} added by the DocStrip extraction.
%\MakePercentComment
%</legacy>
%<*dtx>
\Finale
%%
%% End of file `libgreek.dtx'.
