% LaTeX package that defines meanings to several different Unicode space
% characters.
%
% © 2022 Václav Haisman
%
%% This program can be redistributed and/or modified under the terms of the
%% MIT license. See LICENSE file.
%

\NeedsTeXFormat{LaTeX2e}[1994/06/01]

\ProvidesPackage{uspace}
[2022/04/24 v0.05 LaTeX package that defines meanings to several different
Unicode space characters.]

\RequirePackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\RequirePackage[utf8]{inputenc}
\fi

\RequirePackage{newunicodechar}

% zero width space
\newunicodechar{​}{\hspace{0pt}}

% narrow no-break space
\newunicodechar{ }{\leavevmode\,}

% non-breaking space
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\relax
\else % if !pdftex
\newunicodechar{ }{~}
\fi

% soft hyphen
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\relax
\else % if !pdftex
\newunicodechar{­}{\-}
\fi

% en quad and en space
\newunicodechar{ }{\enskip}
\newunicodechar{ }{\enskip}

% em quad and em space
\newunicodechar{ }{\quad}
\newunicodechar{ }{\quad}

% three-per-em space
\newunicodechar{ }{\hspace{0.33333em}}

% four-per-em space
\newunicodechar{ }{\hspace{0.25em}}

% six-per-em space
\newunicodechar{ }{\hspace{0.16667em}}

% figure space
\newunicodechar{ }{\leavevmode\hphantom{0}}

% punctuation space
\newunicodechar{ }{\hspace{\fontcharwd \font `\,}}

% thin space
\newunicodechar{ }{\leavevmode\allowbreak\,}

% hair space
\newunicodechar{ }{\hspace{0.08333em}}

% Medium Mathematical Space (MMSP)
\newunicodechar{ }{\hspace{0.22222em}}

% line separator
\newunicodechar{ }{\newline}

% next line (NEL)
\newunicodechar{}{\newline}

% paragraph separator
\newunicodechar{ }{\csname par\endcsname}

\endinput

%%
%% End of file `uspace.sty'.
