summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-ms/latex/blx-unicode-ms.def
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/biblatex-ms/latex/blx-unicode-ms.def')
-rw-r--r--macros/latex/contrib/biblatex-ms/latex/blx-unicode-ms.def129
1 files changed, 129 insertions, 0 deletions
diff --git a/macros/latex/contrib/biblatex-ms/latex/blx-unicode-ms.def b/macros/latex/contrib/biblatex-ms/latex/blx-unicode-ms.def
new file mode 100644
index 0000000000..12eabfe98b
--- /dev/null
+++ b/macros/latex/contrib/biblatex-ms/latex/blx-unicode-ms.def
@@ -0,0 +1,129 @@
+% This test should not be needed since biblatex.sty already checks
+% if LuaTeX or XeTeX is used.
+% Currently Unicode-aware engines are only XeTeX and LuaTeX,
+% both of which define \Umathcode.
+\ifx\Umathcode\undefined
+ \expandafter\endinput
+\fi
+
+\begingroup
+\openin\blx@bcfin=UnicodeData.txt %
+\ifeof\blx@bcfin
+\else
+ \let\blx@setazcodes\@empty
+ \def\Lu{Lu}
+ \def\storedpar{\par}
+ \def\blx@tempa#1;#2;#3;#4\relax{%
+ \def\temp{#3}%
+ \ifx\temp\Lu
+ \xdef\blx@setazcodes{%
+ \blx@setazcodes
+ \sfcode"#1=\@m
+ }
+ \fi
+ }
+ \loop\unless\ifeof\blx@bcfin
+ \read\blx@bcfin to \blx@tempb
+ \unless\ifx\blx@tempb\storedpar
+ \expandafter\blx@tempa\blx@tempb\relax
+ \fi
+ \repeat
+\fi
+\closein\blx@bcfin
+\endgroup
+
+% Second part of workaround for odd XeTeX/babel-french behaviour
+% https://github.com/plk/biblatex/issues/979
+% fix by Ulrike Fischer
+% https://tex.stackexchange.com/a/544914/.
+% The first bit lives in biblatex.sty.
+% At some point we may want to consider providing a
+% blx-unicode-xetex and a blx-unicode-lualatex
+% both loading a blx-unicode-generic.
+% For now this test is enough.
+\ifundef\XeTeXrevision
+ {}
+ {\providerobustcmd*{\textnohyphenation}[1]{%
+ \bgroup\nohyphenation#1\egroup^^^^200b}}
+
+\appto\blx@setfrcodes{%
+ % … should probably have dot spacefactor, but pdfLaTeX
+ % makes it a period, so we have this here for consistency
+ \sfcode`\…=\blx@sf@period
+}
+
+\DeclarePrefChars*{’}
+\DeclareRangeChars*{–—}
+
+\def\blx@normrange@range#1\bibrangedash#2\bibrangedash#3&{%
+ \ifblank{#3}
+ {\blx@normrange@endash#1––&}
+ {\ifblank{#2}
+ {\begingroup
+ \protected@edef\blx@tempc{\endgroup
+ \blx@range@out@value{%
+ \blx@range@out@item@process{\unexpanded{#1}}%
+ \noexpand\bibrangedash}}%
+ \blx@tempc}
+ {\ifblank{#1}
+ {\begingroup
+ \protected@edef\blx@tempc{\endgroup
+ \blx@range@out@value{%
+ \noexpand\bibrangedash
+ \blx@range@out@item@process{%
+ \unexpanded{#2}}}}%
+ \blx@tempc}
+ {\blx@range@process{#1}{#2}}}}}
+
+\def\blx@normrange@endash#1–#2–#3&{%
+ \ifblank{#3}
+ {\blx@normrange@hyphen#1--&}
+ {\ifblank{#2}
+ {\begingroup
+ \protected@edef\blx@tempc{\endgroup
+ \blx@range@out@value{%
+ \blx@range@out@item@process{\unexpanded{#1}}%
+ \noexpand\bibrangedash}}%
+ \blx@tempc}
+ {\ifblank{#1}
+ {\begingroup
+ \protected@edef\blx@tempc{\endgroup
+ \blx@range@out@value{%
+ \noexpand\bibrangedash
+ \blx@range@out@item@process{\unexpanded{#2}}}}%
+ \blx@tempc}
+ {\blx@range@process{#1}{#2}}}}}
+
+\def\blx@firstpage@range#1\bibrangedash#2\bibrangedash#3&{%
+ \ifblank{#3}
+ {\blx@firstpage@endash#1––&}
+ {\ifblank{#1}
+ {\begingroup
+ \protected@edef\blx@tempc{\endgroup
+ \blx@range@out@value{%
+ \noexpand\bibrangedash
+ \blx@range@out@item@process{\unexpanded{#2}}}}%
+ \blx@tempc}
+ {\begingroup
+ \protected@edef\blx@tempc{\endgroup
+ \blx@range@out@value{%
+ \blx@range@out@item@process{\unexpanded{#1}}}}%
+ \blx@tempc}}}
+
+\def\blx@firstpage@endash#1–#2–#3&{%
+ \ifblank{#3}
+ {\blx@firstpage@hyphen#1--&}
+ {\ifblank{#1}
+ {\begingroup
+ \protected@edef\blx@tempc{\endgroup
+ \blx@range@out@value{%
+ \noexpand\bibrangedash
+ \blx@range@out@item@process{\unexpanded{#2}}}}%
+ \blx@tempc}
+ {\begingroup
+ \protected@edef\blx@tempc{\endgroup
+ \blx@range@out@value{%
+ \blx@range@out@item@process{\unexpanded{#1}}}}%
+ \blx@tempc}}}
+
+\endinput