%% \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         \~}
%\iffalse
%
% (c) copyright 2021 A Syropoulos 
%
% This program can be redistributed and/or modified under the 
% terms of the LaTeX Project Public License Distributed from 
% http://www.latex-project.org/lppl.txt; either
% version 1.3c of the License, or any later version.
%  
% This work has the LPPL maintenance status `maintained'.
%
% Please report errors or suggestions for improvement to
%
%    Apostolos Syropoulos  (asyropoulos@yahoo.com)
%
%\fi
% \CheckSum{15}
% \iffalse This is a Metacomment
%
%<xesoul, >\ProvidesFile{xesoul.sty}
%
%<xesoul, >  [2021/02/23 v1.0 Package `xesoul.sty']
%
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\GetFileInfo{xesoul.drv}
\usepackage{xltxtra}
\usepackage{hyperref}
\begin{document}
\setmainfont[Mapping=tex-text,Script=Greek,
             SmallCapsFeatures={Contextuals=Alternate}]{Universal Modern}
\setmonofont{UM Typewriter}
\setsansfont[Mapping=tex-text]{GFS Neohellenic}

   \DocInput{xesoul.dtx}
\end{document}
%</driver>
%    \end{macrocode}
% \fi
%\StopEventually{}
%\MakeShortVerb{\|}
%\title{\textsf{xesoul}: Using the \textsf{soul} package with \XeLaTeX}
%\author{Apostolos Syropoulos\\
%        Xanthi, Greece\\
%        \texttt{asyropoulos@yahoo.com}}
% \date{2021/02/23}
%\maketitle
% \begin{abstract}
% This is a small package that allows users to successfully use the \textsf{soul} package
% when preparing documents with \XeLaTeX.
%\end{abstract}
%
%\section{Introduction}
%
% While I was trying to underline Greek text using the |\ul| command of the \textsf{soul} package with \XeLaTeX, 
% I discovered that this is not possible. I was getting several errors and the output was looking terrible.
% I did not know what was wrong. I did a Google search and I found that another user had the same problem.
% He posted his case to the \XeTeX\ mailing list and Ulrike Fischer helped him and gave a solution to the problem.
% However, since the solution is not part of the \textsf{soul} package, I thought it would be a good idea to create
% a new package that would solve the problem. 
%
% \section{The Implementation}
%
% The code of the package is very simple. It loads the \textsf{soul} package and then it sets the |\SOUL@tt|
% font to be a Unicode encoded font. The most natural choice is to use a font that is included in every
% distribution of \TeX{live}. Thus the package uses the freemono font. If for some reason the font is not available 
% in your installtion, then you can download it from the following URL:
% \begin{center}
% \href{https://fontmeme.com/fonts/freemono-font/}{https://fontmeme.com/fonts/freemono-font/}
% \end{center}
% Since the \textsf{soul} package uses the |\SOUL@ttwidth| variable, we need to reset it. Now one can use
% the \textsf{soul} package with no problem.
%    \begin{macrocode}
%<*xesoul>
\RequirePackage{iftex}
\ifXeTeX
\RequirePackage{soul}
\font\SOUL@tt="[FreeMono.ttf]"
\setbox\z@\hbox{\SOUL@tt-}
\SOUL@ttwidth\wd\z@
\else
\typeout{The `xesoul' package can be used only with XeLaTeX.}
\fi
%</xesoul>
%    \end{macrocode}
%
% \Finale
