summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-05-31 21:52:21 +0000
committerKarl Berry <karl@freefriends.org>2018-05-31 21:52:21 +0000
commit0a964418bc66e27bdc4733bd834819c2dd10d52d (patch)
tree4c8540601255e9a3845c345beb874e4262e108bd /Master/texmf-dist/doc
parent629cc6d9525b419abb49e5a39e5b24c61e0cef60 (diff)
luavlna (31may18)
git-svn-id: svn://tug.org/texlive/trunk@47892 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r--Master/texmf-dist/doc/luatex/luavlna/README.md119
-rw-r--r--Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdfbin0 -> 87276 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.tex269
-rw-r--r--Master/texmf-dist/doc/luatex/luavlna/luavlna.tex104
4 files changed, 492 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/luatex/luavlna/README.md b/Master/texmf-dist/doc/luatex/luavlna/README.md
new file mode 100644
index 00000000000..871d2900b49
--- /dev/null
+++ b/Master/texmf-dist/doc/luatex/luavlna/README.md
@@ -0,0 +1,119 @@
+# Luavlna, version v0.1b, 2018-05-31
+
+# Introduction
+
+`Luavlna` is a small package for plain LuaTeX and LuaLaTeX. In some languages,
+like Czech or Polish, there should be no single letter words at the
+line end, according to the typographical norms. There exists some
+external commands (like `vlna`) or packages (`encxvlna` for encTeX,
+`xevlna` for XeTeX, `impnattypo` for LuaLaTeX).
+
+Other feature of this package is including of non-breakable space after initials,
+like in personal names, after or before academic degrees
+and between numbers and units (SI and others).
+
+The code is modified version of Patrick Gundlach’s answer on
+TeX.sx[^1]. The difference is that it is possible to specify which
+single letters should be taken into account for different
+languages.
+The support for degrees and units was added as well.
+
+# Usage
+
+The usage is simple:
+
+ \input ucode
+ \uselanguage{czech}
+ %% in the case of luacsplain, use instead:
+ %% \chyph
+ %% but language code for Czech is different than in LaTeX or normal
+ %% LuaTeX, so you will need to set single letters with somethinh like:
+ %% \singlechars{5}{AIiVvOoUuSsZzKk}
+ \input luavlna
+ \preventsingledebugon
+ \input luaotfload.sty
+ \font\hello={name:Linux Libertine O:+rlig;+clig;+liga;+tlig} at 12pt
+ \hsize=3in
+ \hello
+ Příliš žluťoučký kůň úpěl ďábelské ódy.
+ Text s krátkými souhláskami a samohláskami i dalšími jevy
+ z nabídky možností (v textu možnými).
+
+ I začátek odstavce je třeba řešit, i když výskyt zalomení není pravděpodobný.
+
+ Co třeba í znaky š diakritikou?
+
+ Různé možnosti [v závorkách <i jiných znacích
+
+ Podpora iniciál a titulů: M. J. Hegel, Ing. Běháková, Ph.D., Ž. Zíbrt.
+
+ Podpora jednotek: 100,5 MN\cdot{}s, 100.5 kJ, 200 µA, $-1$ dag, 12 MiB, 1 m$^3$/s.
+
+ \preventsingledebugoff
+ \bye
+
+
+It is also possible to use the package with lua, just use
+
+ \usepackage{luavlna}
+
+in the preamble.
+
+# Commands
+
+ \singlechars{language name}{letters}
+
+Enable this feature for certain letters in given language.
+
+Default values:
+
+ %% only Czech and Slovak are supported out of the box
+ \singlechars{czech}{AIiVvOoUuSsZzKk}
+ \singlechars{slovak}{AIiVvOoUuSsZzKk}
+
+ \compoundinitials{language name}{compounds}
+
+Declare compound letters for given language. Second argument should be comma
+separated list of compound letters, in exact form in which they can appear.
+
+Default values:
+
+ \compoundinitials{czech}{Ch}
+
+##Turning off language switching
+
+By default, language of the nodes is taken into account. If you want to use
+settings for one language for a whole document, you can use following command:
+
+ \preventsinglelang{language name}
+
+##Turning off processing
+
+If you want to stop processing of the spaces in the document you can use
+command
+
+ \preventsingleoff
+
+To resume processing, use
+
+ \preventsingleon
+
+## Debugging commands
+
+ \preventsingledebugon
+ \preventsingledebugoff
+
+Insert debugging marks on/off. Default off.
+
+# Authors
+
+Michal Hoftich
+Miro Hrončok
+
+# License
+
+Permission is granted to copy, distribute and/or modify this software
+under the terms of the LaTeX Project Public License, version 1.3.
+
+[^1]:
+ <http://tex.stackexchange.com/a/28128/2891>
diff --git a/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdf b/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdf
new file mode 100644
index 00000000000..b96633d362b
--- /dev/null
+++ b/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.tex b/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.tex
new file mode 100644
index 00000000000..7a4ac630657
--- /dev/null
+++ b/Master/texmf-dist/doc/luatex/luavlna/luavlna-doc.tex
@@ -0,0 +1,269 @@
+\documentclass[12pt]{ltxdoc}
+%\documentclass{article}
+%\usepackage[utf8]{luainputenc}
+\usepackage{fontspec}
+\setmainfont[Ligatures=TeX]{Linux Libertine O}
+\usepackage[czech,english]{babel}
+\usepackage{luacode}
+\usepackage{amsfonts}
+%\usepackage[]{polyglossia}
+%\setmainlanguage{english}
+%\setotherlanguage{czech}
+%\usepackage{url}
+\usepackage{hyperref}
+%\input prevent-single
+%\usepackage[]{prevent-single}
+\usepackage[]{luavlna}
+%\input prevent-single
+%\def\preventsingledebugon{}
+\newenvironment{mycode}{
+ %\leavevmode%
+ \medskip%
+ \parindent=0pt%
+}{\medskip}
+
+\ifdefined\version\else
+ \def\version{{{VERSION}}}
+ \let\gitdate\date
+\fi
+
+\begin{document}
+\title{The \verb|luavlna| package}
+\author{Michal Hoftich (\url{michal.h21@gmail.com})\\Miro Hrončok (\url{miro@hroncok.cz})}
+\date{Version \version\\\gitdate}
+\maketitle
+\tableofcontents
+\section{Introduction}
+
+
+This is a small package for plain Lua\TeX and Lua\LaTeX. In some languages, like
+Czech or Polish, there should be no single letter words at the line
+end, according to the typographical norms. There exists some
+external commands (like \verb!vlna!) or packages (\verb!encxvlna!
+for enc\TeX, \verb!xevlna! for Xe\TeX,
+\verb!impnattypo! for Lua\LaTeX). %This package is for plain
+%lua\TeX and for lua\LaTeX.
+
+Other feature of this package is including of non-breakable space after
+initials, like in personal names, after or before academic degrees
+and between numbers and units (SI and others).
+
+The code is modified version of Patrick Gundlach's answer on
+TeX.sx\footnote{\url{http://tex.stackexchange.com/a/28128/2891}}.
+The difference is that it is possible to specify which single letters
+should be taken into account for different languages.
+The support for degrees and units was added as well.
+% The code works also for single letters at the beginning of the brackets.
+
+
+\section{Usage}
+
+The usage is simple:
+
+\begin{verbatim}
+\input ucode
+\uselanguage{czech}
+%% in the case of luacsplain, use instead:
+%% \chyph
+\input luavlna
+\preventsingledebugon
+\input luaotfload.sty
+\font\hello={name:Linux Libertine O:+rlig;+clig;+liga;+tlig} at 12pt
+\hsize=3in
+\hello
+Příliš žluťoučký kůň úpěl ďábelské ódy.
+Text s krátkými souhláskami a samohláskami i dalšími jevy
+z nabídky možností (v textu možnými).
+
+I začátek odstavce je třeba řešit, i když výskyt zalomení
+není pravděpodobný.
+
+Co třeba í znaky š diakritikou?
+
+Různé možnosti [v závorkách <i jiných znacích
+
+Podpora iniciál a titulů: M. J. Hegel, Ing. Běháková, Ph.D., Ž. Zíbrt.
+
+Podpora jednotek: 100,5 MN\cdot{}s, 100.5 kJ, 200 µA, $-1$ dag,
+12 MiB, 1 m$^3$/s.
+
+Uvnitř matematiky by mělo být zpracování vypnuté: $k \in \mathbb N$.
+Pokračujeme v příkladu.
+
+\preventsingledebugoff
+\bye
+\end{verbatim}
+
+%\noindent\parbox{3in}{%
+
+\noindent
+\begin{minipage}{3in}
+\preventsingledebugon
+\selectlanguage{czech}
+Příliš \textit{žluťoučký kůň} úpěl ďábelské ódy.
+Text s krátkými souhláskami a samohláskami i dalšími jevy z nabídky možností (v textu možnými).
+
+I začátek odstavce je třeba řešit, i když výskyt zalomení není pravděpodobný.
+
+Co třeba í znaky š diakritikou?
+
+Různé možnosti [v závorkách \textless i jiných znacích
+
+Podpora iniciál a titulů: M. J. Hegel, Ing. Běháková, Ph.D., Ž. Zíbrt.
+
+Podpora jednotek: 100,5 MN\cdot{}s, 100.5 kJ, 200 µA, $-1$ dag, 12 MiB, 1 m$^3$/s.
+
+Uvnitř matematiky by mělo být zpracování vypnuté: $k \in \mathbb N$. Pokračujeme v příkladu.
+
+\preventsingledebugoff
+%}
+\end{minipage}
+
+\selectlanguage{english}
+\bigskip
+It is also possible to use the package with Lua\LaTeX, just use
+
+\begin{verbatim}
+ \usepackage{luavlna}
+\end{verbatim}
+
+in the preamble.
+
+\section{Commands}
+
+\begin{mycode}
+\cmd{\singlechars}\marg{language name}\marg{letters}
+\end{mycode}
+
+Enable this feature for certain letters in given language.
+%Language code is internall \TeX\ code for the language, it is $0$ for English,
+%$16$ for Czech. Please note that in \verb|csplain|, language code for Czech
+%is $5$ and you will have to set it yourself.
+
+Default values:
+
+\begin{mycode}
+\begin{verbatim}
+%% only Czech and Slovak are supported out of the box
+\singlechars{czech}{AIiVvOoUuSsZzKk}
+\singlechars{slovak}{AIiVvOoUuSsZzKk}
+\end{verbatim}
+\end{mycode}
+
+%By default, all
+%single letters are processed, this command can be used to pass a
+%string of characters, which should be processed only.
+
+\begin{mycode}
+\cmd{\compoundinitials}\marg{language name}\marg{compounds}
+\end{mycode}
+
+Declare compound letters for given language. Second argument should be comma
+separated list of compound letters, in exact form in which they can appear.
+
+Default values:
+
+\begin{mycode}
+\begin{verbatim}
+\compoundinitials{czech}{Ch,CH}
+\end{verbatim}
+\end{mycode}
+
+\subsection{Turning off language switching}
+
+By default, language of the nodes is taken into account. If you want to use
+settings for one language for a whole document, you can use following command:
+
+\begin{mycode}
+\cmd{\preventsinglelang}\marg{language name}
+\end{mycode}
+
+\subsection{Turning off processing}
+
+If you want to stop processing of the spaces in the document you can use command
+
+\begin{mycode}
+\cmd{\preventsingleoff}
+\end{mycode}
+
+To resume processing, use
+
+\begin{mycode}
+\cmd{\preventsingleon}
+\end{mycode}
+
+You can also disable units and degrees processing:
+
+\begin{mycode}
+ \cmd{\nounits}\\
+ \cmd{\nopredegrees}\\
+ \cmd{\nosufdegrees}
+\end{mycode}
+
+\subsection{Debugging commands}
+\begin{mycode}
+\cmd{\preventsingledebugon}\par
+\cmd{\preventsingledebugoff}
+\end{mycode}
+
+Insert debugging marks on/off. Default off.
+
+\section{Lua module \texttt{luavlna-langno.lua}}
+
+When we process glyph nodes with Lua\TeX\ callbacks, there are \verb|lang|
+fields available. These are numerical codes of languages, but no information
+about language names easily accesible from Lua side is available.\footnote{%
+ Language names are stored in \TeX macros like \verb|\string\l@langname|, but
+ different formats use different naming of these macros}
+These numbers are format dependent, majority of formats like
+Lua\LaTeX use \verb|language.dat| file provided by \verb|babel|
+for assign numbers to languages, but for example \verb|csplain|
+use its own system.
+
+To allow easy setting of language dependent parameters, \verb|langno| module
+was created. It's purpose is to translate language code to language name and
+the other way. Lua\LaTeX, Lua\TeX\ and CSplain formats are supported at the moment.
+
+\subsection{Recognized languages}
+\subsubsection{Lua\TeX\ and Lua\LaTeX}
+
+File \verb|language.dat| is processed to load language names, aliases and assigned numbers. These language names are the same as supported by \verb|babel| package.
+
+\begin{quotation}
+ \small\noindent
+\begin{luacode*}
+ langno = require "luavlna-langno"
+ function print_format_lang(fmt)
+ local luatex = langno.load_languages(fmt)
+ local t = {}
+ for k, v in pairs(luatex.names) do
+ t[#t+1]=k
+ end
+ table.sort(t)
+ tex.print(table.concat(t,", "))
+ end
+ print_format_lang("luatex")
+\end{luacode*}
+\end{quotation}
+
+\subsubsection{CSplain}
+
+Different method is used. File \verb|hyphen.lan| is included in CSplain, where
+language numbers are assigned to ISO-639-1 or ISO-639-2 language codes.
+These language codes were then normalized to names used vy \verb|babel|, or
+standard English language names.
+
+\begin{quotation}
+ \small\noindent
+ \begin{luacode*}
+ print_format_lang("csplain")
+ \end{luacode*}
+\end{quotation}
+
+
+\section{License}
+
+Permission is granted to copy, distribute and/or modify this software
+under the terms of the LaTeX Project Public License, version 1.3.
+
+\end{document}
diff --git a/Master/texmf-dist/doc/luatex/luavlna/luavlna.tex b/Master/texmf-dist/doc/luatex/luavlna/luavlna.tex
new file mode 100644
index 00000000000..33134a800c9
--- /dev/null
+++ b/Master/texmf-dist/doc/luatex/luavlna/luavlna.tex
@@ -0,0 +1,104 @@
+% detect LaTeX and use the correct method for luatexbase inclusion
+\ifx\RequirePackage\undefined
+ \input{luatexbase.sty}%
+\else
+ \RequirePackage{luatexbase}
+\fi
+
+\newluatexattribute\preventsinglestatus
+% Modify pre_linebreak_filter callback so the spaces can be inserted
+\directlua{%
+luavlna = require "luavlna"
+langno = require "luavlna-langno"
+luatexbase.add_to_callback("pre_linebreak_filter", luavlna.preventsingle," ")
+
+local languages = langno.load_languages()
+local get_lang_id = function(lang)
+ local langid = lang
+ if not tonumber(lang) then
+ langid = languages:get_number(lang)
+ end
+ return langid
+end
+
+% Process string and make table of enabled single letters
+% By default, spaces for all single letters are inserted
+% This can be modified with \singlechars macro
+set_singlechars = function(lang,chars)
+ local utf_gmatch = unicode.utf8.gmatch
+ % local langnumbers = languages.names
+ local langid = get_lang_id(lang)
+ if not langid then return nil, "Cannot find language number for: "..lang end
+ local chars = chars or ""
+ local singlechars = {}
+ local percent = string.char(37)
+ local alpha = percent .. "a"
+ for char in utf_gmatch(chars,"("..alpha..")") do
+ singlechars[char] = true
+ end
+ luavlna.singlechars(langid,singlechars)
+end
+
+% set compound characters for initials handling
+% useful for Czech "Ch" etc.
+% comma separated list of compounds
+set_compounds = function(lang, compounds)
+ local langid = get_lang_id(lang)
+ if not langid then return nil, "Cannot find language number for: "..lang end
+ local c = compounds:explode(",+") % match multiple colons as one
+ local compoundstable = {}
+ for _, compound in pairs(c) do
+ compoundstable[compound] = true
+ end
+ luavlna.initials(langid, compoundstable)
+end
+
+set_main_language = function(lang)
+ local langid = languages:get_number(lang)
+ if not langid then return nil, "Cannot find language number for: "..lang end
+ luavlna.set_main_language(langid)
+end
+}
+
+% Set letters which are prevented from breaking
+\def\singlechars#1#2{%
+\directlua{set_singlechars("#1","#2")}
+}
+
+% Define compound initials
+\def\compoundinitials#1#2{%
+\directlua{set_compounds("#1","#2")}
+}
+% Enable inserting of visual marks for debugging
+\def\preventsingledebugon{%
+\directlua{luavlna.debug(true)}
+}
+
+\def\preventsinglelang#1{%
+ \directlua{set_main_language("#1")}
+}
+
+\def\preventsingleon{%
+ \preventsinglestatus=2
+}
+
+\def\preventsingleoff{
+ \preventsinglestatus=1
+}
+% Disable inserting of visual marks for dewbugging
+\def\preventsingledebugoff{%
+\directlua{luavlna.debug(false)}
+}
+
+% disable processing of units or degrees
+
+\def\nopredegrees{\directlua{luavlna.no_predegrees = true}}
+\def\nosufdegrees{\directlua{luavlna.no_sufdegrees = true}}
+\def\nounits{\directlua{luavlna.no_unit = true}}
+
+\ifdefined\nosingledefaults\else
+ \singlechars{czech}{AIiVvOoUuSsZzKk}
+ \singlechars{slovak}{AIiVvOoUuSsZzKk}
+ \compoundinitials{czech}{Ch,CH}
+\fi
+