summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/latex-uni8
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/latex-uni8
Initial commit
Diffstat (limited to 'macros/latex/contrib/latex-uni8')
-rw-r--r--macros/latex/contrib/latex-uni8/README.txt122
-rw-r--r--macros/latex/contrib/latex-uni8/example_fl.tex27
-rw-r--r--macros/latex/contrib/latex-uni8/example_flr.tex29
-rw-r--r--macros/latex/contrib/latex-uni8/example_fm.tex13
-rw-r--r--macros/latex/contrib/latex-uni8/example_fmr.tex13
-rw-r--r--macros/latex/contrib/latex-uni8/example_fu.tex27
-rw-r--r--macros/latex/contrib/latex-uni8/example_fur.tex28
-rw-r--r--macros/latex/contrib/latex-uni8/example_fut.tex27
-rw-r--r--macros/latex/contrib/latex-uni8/example_futr.tex33
-rw-r--r--macros/latex/contrib/latex-uni8/example_pl.tex22
-rw-r--r--macros/latex/contrib/latex-uni8/example_plr.tex24
-rw-r--r--macros/latex/contrib/latex-uni8/example_pm.tex13
-rw-r--r--macros/latex/contrib/latex-uni8/example_pmr.tex14
-rw-r--r--macros/latex/contrib/latex-uni8/example_pu.tex23
-rw-r--r--macros/latex/contrib/latex-uni8/example_pur.tex25
-rw-r--r--macros/latex/contrib/latex-uni8/uni8.sty281
16 files changed, 721 insertions, 0 deletions
diff --git a/macros/latex/contrib/latex-uni8/README.txt b/macros/latex/contrib/latex-uni8/README.txt
new file mode 100644
index 0000000000..be78498c46
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/README.txt
@@ -0,0 +1,122 @@
+latex-uni8: Universal inputenc, fontenc and babel for pdflatex + lualatex
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+uni8.sty is a LaTeX style file which makes it easy to use input encoding
+(UTF-8 by default, can be changed), fontspec.sty (optional), font
+encoding (T1 if fontspec.sty is not used), babel (English language by
+default), hyphenation, underline (with soul.sty), default text and math
+fonts (Computer Modern or Times) and paper sizes correctly with both
+pdflatex and lualatex.
+
+How to use:
+
+ \documentclass{article}
+ \usepackage{uni8}
+ ...
+ \begin{document}
+ ...
+ \end{document}
+
+See the project page https://github.com/pts/latex-uni8 for example files
+and the latest updates.
+
+The name uni8 is an abbreviation of: universal UTF-8 and 8-bit input
+encoding. It indicates that uni8.sty can set up UTF-8 (utf8) and legacy
+8-bit input encodings (e.g. latin1, latin2) correctly in many environments
+(pdflatex or lualatex, with or without fontspec.sty, T1 or Unicode font
+encoding).
+
+Limitations:
+
+* \showhyphens doesn't display accented characters correctly in the console
+ log. With pdflatex on an UTF-8 console all non-ASCII characters are wrong.
+ With lualatex on an UTF-8 console with T1 font encoding some non-ASCII
+ characters (e.g. ő and ű) are wrong: the ones which are at a different
+ location in Unicode and T1 encoding.
+
+uni8.sty takes care of the following:
+
+* It sets up font families (text: main, sans and mono; also math): Computer
+ Modern (implemented using Latin Modern) by default, and it's possible to
+ select Times + Helvetica + Courier (implemented using TeX Gyre and mathptmx)
+ instead.
+* It sets up input encoding (UTF-8 is the default, it does
+ \usepackage[utf8]{inputenc} or a variation of that).
+* It sets the page size based on \documentclass[a4paper]{article} etc.
+* \usepackage[english]{babel} (this includes setting up hyphenation).
+ If you want a different language, then do someting like
+ \PassOptionsToPackage{hungarian}{babel} before \usepackage{uni8}.
+* \usepackage{soul} (or a variation of it, if available).
+* It makes the \ul command (as defined in soul.sty) should just work with
+ footnotes and automatic hyphenation as well.
+* It makes \hyphenation{...} exceptions work properly, even with accented
+ characters specified the usual way (encoded with the input encoding, UTF-8
+ by default). (For lualatex, it also makes \patterns{...} work similarly.)
+* It makes sure that magyar.ldf (if \PassOptionsToPackage{hungarian}{babel}
+ is used) doesn't print useless warnings about inputenc.sty or t1enc.sty.
+* It sets up font encoding (like T1 encoding with \usepackage{t1enc} if
+ needed).
+
+Usage recommendations and best practices:
+
+* Use \usepackage{uni8} with pdflatex it possible.
+* If you need lualatex, probaby you want to use Unicode fonts, thus use
+ \usepackage[fontspec]{uni8}. Configure fonts with \fontspec{...} and
+ \setmainfont{...} as usual. The default for for uni8 is cm (Latin Modern).
+* \usepackage{uni8} also works with lualatex without fontspec.sty
+ (tested on TeX Live 2019), but for simplicity and increased backwards
+ compatibility (especially for magyar.ldf), use pdflatex instead of
+ lualatex-without-fontspec.sty if possible. The most fragile part of how
+ uni8.sty uses lualatex without fontspec.sty is setting up hyphenation
+ patterns with the T1 encoding.
+
+Features:
+
+* The default font (\usepackage[font=cm]) families are Computer Modern
+ (implemented using Latin Modern) by default.
+* Use \usepackage[font=times] to use Times, Helvetica and Courier font
+ families (implemented using TeX Gyre and mathptmx).
+* Use \usepackage[font=old-times] to use Times, Helvetica and Courier as
+ text and math default fonts (rather than Latin Modern, which is based on
+ Computer Modern). This uses the new old URW-based text fonts with
+ times.sty.
+* Use \usepackage[inputenc=latin2] to use ISO-8859-2 input encoding. Most
+ users shouldn't need this nowaday, the UTF-8 default is better.
+* Use \usepackage[inputenc=latin1] to use ISO-8859-1 input encoding. Most
+ users shouldn't need this nowaday, the UTF-8 default is better.
+* uni8.sty is compatible with hyperref.sty, color.sty and xcolor.sty in both
+ pdflatex and lualatex.
+* uni8.sty works with pdflatex, lualatex and latex (with .dvi
+ output).
+
+How to install LaTeX on Debian Buster, with TeX Live 2019:
+
+* To get the pdflatex command, run:
+ sudo apt-get install texlive-latex-base
+* To get the lualatex command (and the minimal defaults for uni8.sty), run:
+ sudo apt-get install texlive-latex-base texlive-luatex
+* To make [fontspec] (eqivalent to \usepackage{fontspec}) work, run:
+ sudo apt-get install texlive-latex-base texlive-luatex texlive-latex-recommended
+* To make [font=times] work without [fontspec], run:
+ sudo apt-get install texlive-latex-base texlive-latex-recommended tex-gyre
+* To make [font=times] work with [fontspec], run:
+ sudo apt-get install texlive-latex-base texlive-luatex fonts-texgyre texlive-latex-recommended
+* To make \usepackage{soul} (automatically done by uni8.sty) work, run:
+ sudo apt-get install texlive-latex-base texlive-latex-extra
+* To make \usepackage{lmodern} (automatically done by uni8.sty) work, run:
+ sudo apt-get install texlive-latex-base
+* To make \PassOptionsToPackage{english,american,british}{babel} (and the
+ corresponding hyphenation) work, run:
+ sudo apt-get install texlive-latex-base
+* To make \PassOptionsToPackage{german}{babel} work, run:
+ sudo apt-get install texlive-latex-base texlive-lang-german
+* To make \PassOptionsToPackage{spanish}{babel} work, run:
+ sudo apt-get install texlive-latex-base texlive-lang-spanish
+* To make \PassOptionsToPackage{french}{babel} work, run:
+ sudo apt-get install texlive-latex-base texlive-lang-french
+* To make \PassOptionsToPackage{italian}{babel} work, run:
+ sudo apt-get install texlive-latex-base texlive-lang-italian
+* To make \PassOptionsToPackage{hungarian}{babel} (and the corresponding
+ hyphenation) work, run:
+ sudo apt-get install texlive-latex-base texlive-lang-european
+
+__END__
diff --git a/macros/latex/contrib/latex-uni8/example_fl.tex b/macros/latex/contrib/latex-uni8/example_fl.tex
new file mode 100644
index 0000000000..a0dc778d72
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_fl.tex
@@ -0,0 +1,27 @@
+% -*- coding: iso-8859-2 -*-
+% example_fl.tex, works with modern lualatex in TeX Live 2019.
+% The input encoding is ISO-8859-2 (latin2).
+\documentclass{article}
+\PassOptionsToPackage{hungarian}{babel}
+\usepackage[fontspec,inputenc=latin2]{uni8}
+\begin{document}
+% Alternatively, this works in lualatex: \language99 \patterns{õ9y}
+\hyphenation{yõ-yõ-yõ-yõ-yõ-yõ-yõ}
+\showhyphens{yõyõyõyõyõyõyõ}
+\showhyphens{árvíztûrõ tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bõbõbõbõbõbõbõ\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yõyõyõyõyõyõyõ\hrule}
+\bigskip
+\vbox{\Huge\hsize9em\hrule\noindent$\sin^2\alpha+\cos^2\alpha=1$\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent Hel\texttt{lo}, \textsf{Wörld!}\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_flr.tex b/macros/latex/contrib/latex-uni8/example_flr.tex
new file mode 100644
index 0000000000..3f62737068
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_flr.tex
@@ -0,0 +1,29 @@
+% -*- coding: iso-8859-2 -*-
+% example_flr.tex, works with modern lualatex in TeX Live 2019.
+% The input encoding is ISO-8859-2 (latin2).
+\documentclass{article}
+\def\magyarOptions{defaults=hu-min}
+\usepackage[magyar]{babel}
+\usepackage[latin2]{luainputenc} % Must be loaded after babel.sty.
+\usepackage{fontspec}
+\begin{document}
+% Alternatively, this works in lualatex: \language99 \patterns{õ9y}
+\hyphenation{yõ-yõ-yõ-yõ-yõ-yõ-yõ}
+\showhyphens{yõyõyõyõyõyõyõ}
+\showhyphens{árvíztûrõ tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bõbõbõbõbõbõbõ\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yõyõyõyõyõyõyõ\hrule}
+\bigskip
+\vbox{\Huge\hsize9em\hrule\noindent$\sin^2\alpha+\cos^2\alpha=1$\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent Hel\texttt{lo}, \textsf{Wörld!}\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_fm.tex b/macros/latex/contrib/latex-uni8/example_fm.tex
new file mode 100644
index 0000000000..821daf64ed
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_fm.tex
@@ -0,0 +1,13 @@
+% -*- coding: utf-8 -*-
+% example_fm.tex, works with modern lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass[a5paper]{article}
+\def\magyarOptions{defaults=hu-min}
+\PassOptionsToPackage{magyar}{babel}
+\usepackage[fontspec]{uni8}
+\begin{document}
+\section{Első}\label{f1}
+\Aref{f2}.\ szakasz se érdekesebb ennél.
+\section{Második}\label{f2}
+\Aref{f1}.\ szakasz se érdekesebb ennél.
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_fmr.tex b/macros/latex/contrib/latex-uni8/example_fmr.tex
new file mode 100644
index 0000000000..098d012303
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_fmr.tex
@@ -0,0 +1,13 @@
+% -*- coding: utf-8 -*-
+% example_fmr.tex, works with modern lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass[a5paper]{article}
+\def\magyarOptions{defaults=hu-min}
+\usepackage[magyar]{babel}
+\usepackage{fontspec}
+\begin{document}
+\section{Első}\label{f1}
+\Aref{f2}.\ szakasz se érdekesebb ennél.
+\section{Második}\label{f2}
+\Aref{f1}.\ szakasz se érdekesebb ennél.
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_fu.tex b/macros/latex/contrib/latex-uni8/example_fu.tex
new file mode 100644
index 0000000000..ac124bf855
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_fu.tex
@@ -0,0 +1,27 @@
+% -*- coding: utf-8 -*-
+% example_fu.tex, works with modern lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass{article}
+\PassOptionsToPackage{hungarian}{babel}
+\usepackage[fontspec]{uni8}
+\begin{document}
+% Alternatively, this works in lualatex: \language99 \patterns{Å‘9y}
+\hyphenation{yő-yő-yő-yő-yő-yő-yő}
+\showhyphens{yőyőyőyőyőyőyő}
+\showhyphens{árvíztűrő tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bőbőbőbőbőbőbő\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yőyőyőyőyőyőyő\hrule}
+\bigskip
+\vbox{\Huge\hsize9em\hrule\noindent$\sin^2\alpha+\cos^2\alpha=1$\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent Hel\texttt{lo}, \textsf{Wörld!}\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_fur.tex b/macros/latex/contrib/latex-uni8/example_fur.tex
new file mode 100644
index 0000000000..2d80e7b9dd
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_fur.tex
@@ -0,0 +1,28 @@
+% -*- coding: utf-8 -*-
+% example_fur.tex, works with modern lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass{article}
+\def\magyarOptions{defaults=hu-min}
+\usepackage[magyar]{babel}
+\usepackage{fontspec}
+\begin{document}
+% Alternatively, this works in lualatex: \language99 \patterns{Å‘9y}
+\hyphenation{yő-yő-yő-yő-yő-yő-yő}
+\showhyphens{yőyőyőyőyőyőyő}
+\showhyphens{árvíztűrő tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bőbőbőbőbőbőbő\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yőyőyőyőyőyőyő\hrule}
+\bigskip
+\vbox{\Huge\hsize9em\hrule\noindent$\sin^2\alpha+\cos^2\alpha=1$\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent Hel\texttt{lo}, \textsf{Wörld!}\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_fut.tex b/macros/latex/contrib/latex-uni8/example_fut.tex
new file mode 100644
index 0000000000..be93bcd082
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_fut.tex
@@ -0,0 +1,27 @@
+% -*- coding: utf-8 -*-
+% example_fut.tex, works with modern lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass{article}
+\PassOptionsToPackage{hungarian}{babel}
+\usepackage[fontspec,font=times]{uni8}
+\begin{document}
+% Alternatively, this works in lualatex: \language99 \patterns{Å‘9y}
+\hyphenation{yő-yő-yő-yő-yő-yő-yő}
+\showhyphens{yőyőyőyőyőyőyő}
+\showhyphens{árvíztűrő tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bőbőbőbőbőbőbő\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yőyőyőyőyőyőyő\hrule}
+\bigskip
+\vbox{\Huge\hsize9em\hrule\noindent$\sin^2\alpha+\cos^2\alpha=1$\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent Hel\texttt{lo}, \textsf{Wörld!}\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_futr.tex b/macros/latex/contrib/latex-uni8/example_futr.tex
new file mode 100644
index 0000000000..52dd86c115
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_futr.tex
@@ -0,0 +1,33 @@
+% -*- coding: utf-8 -*-
+% example_futr.tex, works with modern lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass{article}
+\def\magyarOptions{defaults=hu-min}
+\usepackage[magyar]{babel}
+\usepackage{fontspec}
+\usepackage{unicode-math}
+\setmainfont{TeX Gyre Termes}
+\setsansfont{TeX Gyre Heros}[Scale=MatchLowercase]
+\setmonofont{TeX Gyre Cursor}[Scale=MatchLowercase]
+\setmathfont{TeX Gyre Termes Math}
+\begin{document}
+% Alternatively, this works in lualatex: \language99 \patterns{Å‘9y}
+\hyphenation{yő-yő-yő-yő-yő-yő-yő}
+\showhyphens{yőyőyőyőyőyőyő}
+\showhyphens{árvíztűrő tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bőbőbőbőbőbőbő\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yőyőyőyőyőyőyő\hrule}
+\bigskip
+\vbox{\Huge\hsize9em\hrule\noindent$\sin^2\alpha+\cos^2\alpha=1$\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent Hel\texttt{lo}, \textsf{Wörld!}\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_pl.tex b/macros/latex/contrib/latex-uni8/example_pl.tex
new file mode 100644
index 0000000000..544704dd77
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_pl.tex
@@ -0,0 +1,22 @@
+% -*- coding: iso-8859-2 -*-
+% example_pl.tex, works with pdflatex and modern lualatex in TeX Live 2019.
+% The input encoding is ISO-8859-2 (latin2).
+\documentclass{article}
+\PassOptionsToPackage{hungarian}{babel}
+\usepackage[inputenc=latin2]{uni8}
+\begin{document}
+\hyphenation{yõ-yõ-yõ-yõ-yõ-yõ-yõ}
+\showhyphens{yõyõyõyõyõyõyõ}
+\showhyphens{árvíztûrõ tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bõbõbõbõbõbõbõ\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yõyõyõyõyõyõyõ\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_plr.tex b/macros/latex/contrib/latex-uni8/example_plr.tex
new file mode 100644
index 0000000000..38c6d61eb3
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_plr.tex
@@ -0,0 +1,24 @@
+% -*- coding: iso-8859-2 -*-
+% example_plr.tex, works with pdflatex, but not with lualatex in TeX Live 2019.
+% The input encoding is ISO-8859-2 (latin2).
+\documentclass{article}
+\usepackage[latin2]{inputenc}
+\usepackage{t1enc}
+\def\magyarOptions{defaults=hu-min}
+\usepackage[magyar]{babel}
+\begin{document}
+\hyphenation{yõ-yõ-yõ-yõ-yõ-yõ-yõ}
+\showhyphens{yõyõyõyõyõyõyõ}
+\showhyphens{árvíztûrõ tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bõbõbõbõbõbõbõ\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yõyõyõyõyõyõyõ\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_pm.tex b/macros/latex/contrib/latex-uni8/example_pm.tex
new file mode 100644
index 0000000000..fdd2018e78
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_pm.tex
@@ -0,0 +1,13 @@
+% -*- coding: utf-8 -*-
+% example_pm.tex, works with pdflatex and modern lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass[a5paper]{article}
+\def\magyarOptions{defaults=hu-min}
+\PassOptionsToPackage{magyar}{babel}
+\usepackage{uni8}
+\begin{document}
+\section{Első}\label{f1}
+\Aref{f2}.\ szakasz se érdekesebb ennél.
+\section{Második}\label{f2}
+\Aref{f1}.\ szakasz se érdekesebb ennél.
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_pmr.tex b/macros/latex/contrib/latex-uni8/example_pmr.tex
new file mode 100644
index 0000000000..b88ad8bcbb
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_pmr.tex
@@ -0,0 +1,14 @@
+% -*- coding: utf-8 -*-
+% example_pmr.tex, works with pdflatex, but not with lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass[a5paper]{article}
+\usepackage[utf8]{inputenc}
+\usepackage{t1enc}
+\def\magyarOptions{defaults=hu-min}
+\usepackage[magyar]{babel}
+\begin{document}
+\section{Első}\label{f1}
+\Aref{f2}.\ szakasz se érdekesebb ennél.
+\section{Második}\label{f2}
+\Aref{f1}.\ szakasz se érdekesebb ennél.
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_pu.tex b/macros/latex/contrib/latex-uni8/example_pu.tex
new file mode 100644
index 0000000000..563e614fba
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_pu.tex
@@ -0,0 +1,23 @@
+% -*- coding: utf-8 -*-
+% example_pu.tex, works with pdflatex and modern lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass{article}
+\PassOptionsToPackage{hungarian}{babel}
+\usepackage{uni8}
+\begin{document}
+% Alternatively, this works in lualatex: \language99 \patterns{Å‘9y}
+\hyphenation{yő-yő-yő-yő-yő-yő-yő}
+\showhyphens{yőyőyőyőyőyőyő}
+\showhyphens{árvíztűrő tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bőbőbőbőbőbőbő\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yőyőyőyőyőyőyő\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/example_pur.tex b/macros/latex/contrib/latex-uni8/example_pur.tex
new file mode 100644
index 0000000000..13839d45be
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/example_pur.tex
@@ -0,0 +1,25 @@
+% -*- coding: utf-8 -*-
+% example_pur.tex, works with pdflatex, but not with lualatex in TeX Live 2019.
+% The input encoding is UTF-8 (utf8).
+\documentclass{article}
+\usepackage[utf8]{inputenc}
+\usepackage{t1enc}
+\def\magyarOptions{defaults=hu-min}
+\usepackage[magyar]{babel}
+\begin{document}
+% Alternatively, this works in lualatex: \language99 \patterns{Å‘9y}
+\hyphenation{yő-yő-yő-yő-yő-yő-yő}
+\showhyphens{yőyőyőyőyőyőyő}
+\showhyphens{árvíztűrő tükörfúrógép}
+\hrule width \hsize
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bababababababa\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bábábábábábábá\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . bőbőbőbőbőbőbő\hrule}
+\bigskip
+\vbox{\Huge\hsize7em\hrule\noindent . . . . . yőyőyőyőyőyőyő\hrule}
+\bigskip
+\vfill\hrule width\hsize
+\end{document}
diff --git a/macros/latex/contrib/latex-uni8/uni8.sty b/macros/latex/contrib/latex-uni8/uni8.sty
new file mode 100644
index 0000000000..c6b4402346
--- /dev/null
+++ b/macros/latex/contrib/latex-uni8/uni8.sty
@@ -0,0 +1,281 @@
+%
+% uni8.sty: Universal inputenc, fontenc and babel for pdflatex + lualatex
+% by pts@fazekas.hu at Fri Jan 11 15:48:05 CET 2019
+%
+% License for uni8.sty: LPPL (https://opensource.org/licenses/LPPL)
+%
+% See the project page https://github.com/pts/latex-uni8 for example files
+% and the latest updates.
+%
+% uni8.sty does these:
+%
+% * It sets up hyphenation patterns correctly for pdflatex and lualatex,
+% with or without fontspec.
+% * It works with pdflatex and lualatex.
+% * It works with hyperref.sty.
+% * It works with color.sty and xcolor.sty.
+% * It defines \ul for underlining text.
+% * It sets the default fonts with [font=...] options.
+% * It sets the input encoding with [inputenc=...] options.
+% * It loads fontspec.sty with the [fontspec] option.
+% * It sets the page size based on [a4paper] etc. to \documentclass.
+% * It hides useless warnings about inputenc.sty or t1enc.sty by magyar.ldf.
+%
+% See README.txt for more features and detailed documentation.
+%
+\ProvidesPackage{uni8}[2019/01/14 v0.03 Universal inputenc, fontenc and babel for pdflatex + lualatex]
+
+% Extra customization from .tex: \PassOptionsToPackage{hungarian}{babel}
+
+% Defaults.
+\def\@univ@font{cm}
+\def\@univ@inputenc{utf8}\def\@univ@inputenc@isutfe{1}
+\def\@univ@fontspec{0}
+
+\DeclareOption{fontspec}{\def\@univ@fontspec{1}}
+\DeclareOption{fontspec=yes}{\def\@univ@fontspec{1}}
+\DeclareOption{fontspec=no}{\def\@univ@fontspec{0}}
+\DeclareOption{inputenc=utf8}{\def\@univ@inputenc{utf8}\def\@univ@inputenc@isutfe{1}}
+\DeclareOption{inputenc=utf8x}{\def\@univ@inputenc{utf8x}\def\@univ@inputenc@isutfe{1}}
+\DeclareOption{inputenc=latin1}{\def\@univ@inputenc{latin1}\def\@univ@inputenc@isutfe{0}}
+\DeclareOption{inputenc=latin2}{\def\@univ@inputenc{latin2}\def\@univ@inputenc@isutfe{0}}
+\DeclareOption{font=cm}{\def\@univ@font{cm}} % Preferred.
+\DeclareOption{font=lm}{\def\@univ@font{cm}}
+\DeclareOption{font=ec}{\def\@univ@font{cm}}
+\DeclareOption{font=lmodern}{\def\@univ@font{cm}}
+\DeclareOption{font=tg}{\def\@univ@font{times}}
+\DeclareOption{font=times}{\def\@univ@font{times}} % Preferred.
+\DeclareOption{font=old-times}{\def\@univ@font{oldtimes}} % Preferred.
+\DeclareOption{font=oldtimes}{\def\@univ@font{oldtimes}}
+\DeclareOption{nop}{}
+\ProcessOptions\relax
+
+\def\@univ@fatal@ifpackage#1{%
+ \expandafter\ifx\csname ver@#1.sty\endcsname\relax\else
+ \PackageError{uni8}{Package #1 is already loaded.\MessageBreak
+ Solution: remove \string\usepackage...{#1}}{}\expandafter\@@end
+ \fi}
+% We fail early if any of these packages are already loaded, because we
+% want to load them, in the correct order.
+\@univ@fatal@ifpackage{t1enc}
+\@univ@fatal@ifpackage{fontenc}
+\@univ@fatal@ifpackage{inputenc}
+\@univ@fatal@ifpackage{luainputenc}
+\@univ@fatal@ifpackage{fontspec}
+\@univ@fatal@ifpackage{babel}
+
+\def\@univ@fatal@ifpackageopt#1{%
+ \expandafter\ifx\csname opt@#1.sty\endcsname\relax\else
+ \PackageError{uni8}{Package #1 already has options.\MessageBreak
+ Solution: remove \string\PassOptionsToPackage{...}{#1}}{}%
+ \expandafter\@@end
+ \fi}
+% We fail early if any of these packages already have options, becase we
+% want to specify and control the correct options for them.
+\@univ@fatal@ifpackageopt{t1enc}
+\@univ@fatal@ifpackageopt{fontenc}
+\@univ@fatal@ifpackageopt{inputenc}
+\@univ@fatal@ifpackageopt{luainputenc}
+%\@univ@fatal@ifpackageopt{fontspec} % Passing options to fontspec.sty is OK.
+%\@univ@fatal@ifpackageopt{babel} % Passing options to babel.sty is OK.
+
+% if #1 specifies an UTF-8 encoding, runs #2, otherwise runs #3.
+% @param #1 a control sequence.
+\def\@univ@ifutfe#1#2#3{%
+ \ifx#1\@univ@ifutfe@a
+ #2%
+ \else
+ \ifx#1\@univ@ifutfe@b#2\else#3\fi
+ \fi}
+\def\@univ@ifutfe@a{utf8}
+\def\@univ@ifutfe@b{utf8x}
+
+\expandafter\ifx\csname opt@babel.sty\endcsname\relax
+ % english is the default language (including default hyphenation) if
+ % \PassOptionsToPackage{...}{babel} was not specified.
+ \expandafter\def\csname opt@babel.sty\endcsname{english}\fi
+
+\if1\@univ@fontspec
+ \ifnum0\ifx\luatexversion\@undefined1\fi\ifx\luatexversion\relax1\fi>0
+ \PackageError{uni8}{[fontspec] needs to be run with lualatex}{}
+ \def\@univ@fontspec{0}% Disable [fontspec] as a fallback.
+ \fi
+\fi
+\if1\@univ@fontspec
+ \RequirePackage{babel}
+ % It's important to load luainputenc.sty after babel.sty, otherwise
+ % loadhyph-hu.tex loaded by babel.sty would load hyphenation patterns
+ % (e.g. hyph-hu.tex) with conv-utf8-ec.tex. But we are using TU font
+ % encoding, and conv-utf8-ec.tex would make hyphenation patterns use the
+ % T1 font encoding.
+ \@univ@ifutfe\@univ@inputenc{}{
+ \expandafter\RequirePackage\expandafter[\@univ@inputenc]{luainputenc}}
+ \RequirePackage{fontspec} % lmodern font is the default for fontspec.
+ % Override magyar.ldf loaded by babel.sty to prevent useless warning about
+ % \usepackage{t1enc}.
+ \def\magyar@sugg@to#1{}
+
+ \def\@univ@font@cm{% Latin Modern fonts, bettern than CM and EC for international text in T1 encoding.
+ % Even though Latin Modern is the default text font for lualatex (see
+ % fonttext.cfg in format generation time, it loads tulmr.fd), cmr is
+ % still the default math font. By loading lmodern.sty we also change the
+ % default math font to (non-Unicode) Latin Modern (e.g. lmmi10.pfb).
+ \RequirePackage{lmodern}
+ }
+ \def\@univ@font@times{% TeX Gyre fonts, great alternative for Times, Helvetica and Courier.
+ \RequirePackage{unicode-math}
+ \setmainfont{TeX Gyre Termes}
+ \setsansfont{TeX Gyre Heros}[Scale=MatchLowercase]
+ \setmonofont{TeX Gyre Cursor}[Scale=MatchLowercase]
+ \setmathfont{TeX Gyre Termes Math}
+ }
+ \def\@univ@font@oldtimes{% Times, Helvetica and Courier.
+ \@univ@font@times % old-times is not available in Unicode, using times.
+ }
+ \csname @univ@font@\@univ@font\endcsname
+ \normalfont\selectfont
+\else
+ \ifnum0\ifx\luatexversion\@undefined1\fi\ifx\luatexversion\relax1\fi>0
+ % luainputenc would also work, but we don't want to depend on it, to
+ % remain compatible with earlier versions of pdflatex.
+ \expandafter\RequirePackage\expandafter[\@univ@inputenc]{inputenc}
+ \else
+ % Needed for ő and ű in non-fontspec fonts.
+ \expandafter\RequirePackage\expandafter[\@univ@inputenc]{luainputenc}
+ \fi
+ \def\encodingdefault{T1} % Part of t1enc.sty
+ \fontencoding{T1} % Part of t1enc.sty.
+ % We don't run \selectfont here (t1enc.sty does), to avoid loading
+ % ecrm1000.tfm here when it is not available (e.g. no
+ % sudo apt-get install texlive-fonts-recommended).
+ % TODO(pts): Add [font=tnr] for Times New Roman, Helvetica, Courier New.
+ \def\@univ@font@cm{% Latin Modern fonts, bettern than CM and EC for international text in T1 encoding.
+ \RequirePackage{lmodern}
+ }
+ \def\@univ@font@times{% TeX Gyre fonts, great alternative for Times, Helvetica and Courier.
+ % Also changes math fonts. Load before tgtermes so that tgtermes can
+ % change text fonts back.
+ %
+ % TODO(pts): Better with newtxtext and newtxmath?
+ % https://tex.stackexchange.com/q/469726/820
+ % TODO(pts): Check txfonts.sty aand https://ctan.org/pkg/newtx as well.
+ \RequirePackage{mathptmx}
+ \RequirePackage{tgtermes}
+ \RequirePackage{tgheros}
+ \RequirePackage{tgcursor}
+ }
+ \def\@univ@font@oldtimes{% Times, Helvetica and Courier.
+ % Ugly spacing of the accent in \H{o}. Use [font=times] instead.
+ %
+ % Doesn't affect math fonts.
+ %\RequirePackage{times}
+ % Also changes math fonts.
+ \RequirePackage{mathptmx}
+ }
+ \csname @univ@font@\@univ@font\endcsname
+ % Without this \cf@encoding would remain TU (Unicode), but we want both
+ % \cf@encoding and \f@encoding T1.
+ \normalfont\selectfont
+
+ % Without this lualatex wouldn't consider the characters ő and ű in font
+ % encoding T1 as letters during hyphenation.
+ %
+ % This magic is based on https://tex.stackexchange.com/a/469909/820
+ \@tempcnta128 \loop\ifnum\@tempcnta<159 \ifnum\lccode\@tempcnta=0
+ \lccode\@tempcnta\@tempcnta\fi \advance\@tempcnta1 \repeat
+ \@tempcnta160 \loop\ifnum\@tempcnta<190 \ifnum\lccode\@tempcnta=0
+ \lccode\@tempcnta\@tempcnta\fi \advance\@tempcnta1 \repeat
+ \@tempcnta192 \loop\ifnum\@tempcnta<256 \ifnum\lccode\@tempcnta=0
+ \lccode\@tempcnta\@tempcnta\fi \advance\@tempcnta1 \repeat
+
+ % Make loadhyph-hu.tex loaded by babel.sty in TeX Live 2019 load
+ % hyph-hu.ec.tex rather than hyph-hu.tex in lualatex.
+ %
+ % This magic is based on https://tex.stackexchange.com/a/469909/820
+ \let\kanjiskip\hsize
+ % Without loading babel, hyphenation \language macros such as \l@english and
+ % \l@hungarian wouldn't be defined in lualatex.
+ \RequirePackage{babel}
+ \let\kanjkiskip\@undefined % Undo our hack above.
+\fi
+
+% Override magyar.ldf loaded by babel.sty to prevent useless warning about
+% \usepackage[...]{inputenc}.
+\def\magyar@sugg@ie#1{}
+
+\edef\reserved@a{\csname inputencodingname\endcsname}
+\@univ@ifutfe\reserved@a{\def\@univ@inputenc@isutfe{1}}{}
+
+\ifnum10=\@univ@inputenc@isutfe\@univ@fontspec
+ \IfFileExists{soulutf8.sty}{\IfFileExists{soul.sty}{
+ % For non-utf8 input encodings, use \usepackage{soul}.
+ \RequirePackage{soulutf8}
+ \def\underline{\ul} % \underline is built-in. Let's use soul's.
+ \def\uline{\ul} % \uline is from ulem. Let's use soul's.
+ }{}}{}
+\else
+ \IfFileExists{soul.sty}{
+ \usepackage{soul}
+ \def\underline{\ul} % \underline is built-in. Let's use soul's.
+ \def\uline{\ul} % \uline is from ulem. Let's use soul's.
+ }{}
+\fi
+
+% Propagate a4paper, a5paper, b5paper, letterpaper, legalpaper,
+% executivepaper, landscape documentclass options to actual paper size
+% as understood by dvips (\special{papersize=...}), pdflatex (\pdfpagewidth)
+% and lualatex (\pagewidth).
+\def\UnivFixPaperSize{%
+ \ifx\pdfpagewidth\undefined
+ \ifx\pagewidth\undefined\special{papersize=\paperwidth,\paperheight}\else
+ \pagewidth\paperwidth \pageheight\paperheight \fi\else
+ \pdfpagewidth\paperwidth \pdfpageheight\paperheight \fi}
+\UnivFixPaperSize
+
+% Display a warning if the user calls \fontencoding{...} unexpectedly in the
+% preamble.
+\def\@univ@sugg@fontenc{%
+ % We want T1 font encoding, because hyphenation patterns are in T1
+ % encoding.
+ \edef\reserved@a{%
+ \expandafter\ifx\csname ver@fontspec.sty\endcsname\relax T1\else TU\fi}%
+ \edef\reserved@b{\f@encoding}%
+ \ifx\reserved@a\reserved@b\else
+ \PackageWarningNoLine{uni8}{The font encoding is
+ \expandafter\strip@prefix\meaning\reserved@b, should be
+ \expandafter\strip@prefix\meaning\reserved@a}%
+ \fi}
+% Display a warning if the user loads a package in the preamble which would
+% break what uni8.sty has set up.
+\def\@univ@sugg@fontspec@package#1{%
+ \expandafter\ifx\csname ver@fontspec.sty\endcsname\relax\else
+ \expandafter\ifx\csname ver@#1.sty\endcsname\relax\else
+ \PackageWarningNoLine{uni8}{[fontspec] conflicts with #1.sty\MessageBreak
+ Solution: remove \string\usepackage...{#1}}%
+ \fi
+ \fi}
+\def\@univ@sugg@inputencoding{%
+ \if1\@univ@inputenc@isutfe
+ \expandafter\ifx\csname ver@fontspec.sty\endcsname\relax\else
+ \expandafter\ifx\csname inputencodingname\endcsname\relax\else
+ % Actually, if \inputencodingname is lutf8, that would work here,
+ % but we display the warning anyway to discourage the user to do
+ % \usepackage[...]{luainputenc} manually. By doing so we we make
+ % things less diverse, thus less likely to fail.
+ \PackageError{uni8}{[fontspec] conflicts with input encoding:
+ \expandafter\strip@prefix\meaning\inputencodingname\MessageBreak
+ Solution: remove \string\usepackage...{luainputenc}}{}\@@end
+ \fi
+ \fi
+ \fi}
+
+\AtBeginDocument{%
+ \selectfont % Make \f@encoding and \cf@encoding match.
+ \@univ@sugg@fontspec@package{t1enc}%
+ \@univ@sugg@fontspec@package{fontenc}%
+ \@univ@sugg@fontspec@package{inputenc}%
+ \@univ@sugg@fontenc
+ \@univ@sugg@inputencoding
+}
+
+\endinput