%% Copyright 2025 Jonathan Walls
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%   https://www.latex-project.org/lppl/lppl-1-3c.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Jonathan Walls.
%
% This work consists of the files lydtype.sty, lydtype-doc.tex
%    and the derived file lydtype-doc.pdf. The Noto Sans Lydian font is distributed under the terms of the SIL Open Font License 1.1 as included in the package.
% 
%
% Version history:
% 1.0 - Original Release Version

\documentclass[12pt,A4]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{expex}
\setdefaultlanguage{english}
\usepackage{hyperref}
\setmainfont{Charis SIL}
\usepackage{lydtype}
\usepackage{float}

\title{The LydType Package}
\author{Jonathan Walls}

\begin{document}
\maketitle

\section{Introduction}
This package aims to allow platform-agnostic typing in the Lydian alphabet using LaTeX, in particular as a way to deal with the fact that Overleaf does not support direct input of certain characters outside of a given Unicode range. It includes the Noto Sans Lydian font as developed by Google. This package was developed for use with LuaLaTeX and XeLaTeX, functionality with other compilers is not guaranteed.

\section{Setup}
The system aims to be maximally user-friendly (to the extent that LaTeX ever is), allowing more-or-less free typing using Latin characters which are then converted to the Lydian alphabet in the PDF. To begin, in the project folders, one must include:
\begin{enumerate}
    \item The Fonts folder containing the necessary font
    \item The lydtype.sty file containing the commands necessary for the Unicode conversions.
\end{enumerate}

In the preamble of the main.tex file, one must also include the following line to import the package:\small
\begin{verbatim}
\usepackage{lydtype}
\end{verbatim}
\normalsize
This will incorporate the fontspec package allowing switching to the Unicode font, bring in the LydType functionality from the .sty file, and create the 
\begin{verbatim}
    \Lyd{}
\end{verbatim} 
command which will allow easy switching to the Lydian alphabet mode.

\section{Usage}
\subsection{Basic Lydian Typing}
To use the package, in a given section, you can trigger the Lydian writing mode by using the \verb|\Lyd{}| command as listed above. Each character can be accessed based on a Latin transcription, according to the following correspondences (which allow for different transcription conventions):

\begin{table}[H]
    \centering
    \begin{tabular}{cc}
    \textbf{Input} & \textbf{Output}\\\hline
         a & \Lyd{a}\\
    b, p & \Lyd{b}\\
    g & \Lyd{g}\\
    d, ð & \Lyd{d}\\
    e & \Lyd{e}\\
    v, w & \Lyd{w}\\
    i & \Lyd{i}\\
    y & \Lyd{y}\\
    k & \Lyd{k}\\
    l & \Lyd{l}\\
    m & \Lyd{m}\\
    n & \Lyd{n}\\
    o & \Lyd{o}\\
    r & \Lyd{r}\\
    s, ś & \Lyd{s}\\
    t & \Lyd{t}\\
    u & \Lyd{u}\\
    f & \Lyd{f}\\
    q, kw & \Lyd{q}\\
    sh, š, š, ç & \Lyd{š}\\
    ch, tsh, tch, tç & \Lyd{ch}\\
    ã & \Lyd{ã}\\
    ẽ & \Lyd{ẽ}\\
    λ, gl, lh, ll & \Lyd{gl}\\
    ng & \Lyd{ng}\\
    c, ts & \Lyd{c}
    \end{tabular}
\end{table}

Usage is as follows:
\begin{verbatim}
    \Lyd{a.b.g.d}
    or
    \Lyd{a b g d}
\end{verbatim}
This displays the Lydian text corresponding to: 
\\

\Lyd{a b g d}

\subsection{Formatting Lydian Transcriptions}
This package also contains a number of commands which are useful for formatting transcriptions of Lydian, which follows conventions that are often tedious to work through. Some of these will create special characters often used in such transcriptions, as in the following table.


\begin{table}[H]
    \centering
    \begin{tabular}{cc}
        \textbf{Command} & \textbf{Effect} \\ \hline
        \verb|\badeq| (``bad equal") & \badeq\\
        \verb|\hl| (``half left") & \hl\\
        \verb|\hr| (``half right") & \hr\\
        \verb|\tsup{}| & \tsup{M}\\
        \verb|\tsub{}| & \tsub{2}\\
    \end{tabular}
\end{table}

\verb|\tsup| and \verb|\tsub| create super- and subscripts, respectively.\\

\centerline{\Large Happy Lydian!}
\end{document}

