From 43e60b98142683b95336b9086ee52f4daefff93e Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 23 Oct 2019 03:00:42 +0000 Subject: CTAN sync 201910230300 --- macros/latex/contrib/fancyvrb/Changes | 1 + macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.pdf | Bin 161872 -> 142045 bytes macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.tex | 7 ++-- macros/latex/contrib/fancyvrb/latex/fancyvrb.sty | 6 ++-- macros/luatex/generic/luavlna/README.md | 2 +- macros/luatex/generic/luavlna/luavlna-doc.pdf | Bin 87293 -> 89010 bytes macros/luatex/generic/luavlna/luavlna-doc.tex | 34 ++++++++++++++++-- macros/luatex/generic/luavlna/luavlna.lua | 40 +++++++++++++++++++++ macros/luatex/generic/luavlna/luavlna.sty | 1 + macros/luatex/generic/luavlna/luavlna.tex | 19 ++++++++++ 10 files changed, 101 insertions(+), 9 deletions(-) (limited to 'macros') diff --git a/macros/latex/contrib/fancyvrb/Changes b/macros/latex/contrib/fancyvrb/Changes index c1b5791665..40236df70c 100644 --- a/macros/latex/contrib/fancyvrb/Changes +++ b/macros/latex/contrib/fancyvrb/Changes @@ -1,4 +1,5 @@ --- fancyvrb.sty +3.3 2019/10/22 - use \textvisiblespace for showspaces (hv) 3.2a 2019/01/15 - added missing style files (hv) 3.2 2019/01/08 - remove the loading of package xcolor (hv) 3.1a 2018/11/20 - small changes to the documentation (hv) diff --git a/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.pdf b/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.pdf index 25f66f3824..b0ef26beab 100644 Binary files a/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.pdf and b/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.pdf differ diff --git a/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.tex b/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.tex index ce6e39df8d..6d2d5e71ce 100644 --- a/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.tex +++ b/macros/latex/contrib/fancyvrb/doc/fancyvrb-doc.tex @@ -63,7 +63,7 @@ {\footnotesize and}\\[-2mm] {\footnotesize Herbert Voß\ (FU Berlin -- DE)} } -\date{Version 3.2a\\ \today} +\date{Version 3.3\\ \today} \fvset{frame=single,xrightmargin=0cm,numbers=left,numbersep=3pt,commentchar=Z} @@ -90,8 +90,9 @@ Mikhail Kolodin, %\url{myke@morrigan.spb.su}, Andreas Matthias, Frank Mittelbach, Rolf Niepraschk, %\url{Rolf.Niepraschk@gmx.de}, -Ulrich M. Schwarz, -Thomas Siegel,% \url{siegel@aix520.informatik.uni-leipzig.de}, +Ulrich M. Schwarz, +Thomas Siegel, % \url{siegel@aix520.informatik.uni-leipzig.de}, +Clemens Steinke, and Vladimir Volovich. %\url{vvv@vvv.vsu.ru}. \clearpage diff --git a/macros/latex/contrib/fancyvrb/latex/fancyvrb.sty b/macros/latex/contrib/fancyvrb/latex/fancyvrb.sty index e265f3965d..b9fb18c759 100644 --- a/macros/latex/contrib/fancyvrb/latex/fancyvrb.sty +++ b/macros/latex/contrib/fancyvrb/latex/fancyvrb.sty @@ -13,8 +13,8 @@ %% verbatim environments and commands and extensive documentation. %% \NeedsTeXFormat{LaTeX2e} -\def\fileversion{3.2a} -\def\filedate{2019/01/15} +\def\fileversion{3.3} +\def\filedate{2019/10/22} \ProvidesPackage{fancyvrb}[\filedate] \message{Style option: `fancyvrb' v\fileversion \space <\filedate> (tvz)} \csname fancyvrb@loaded\endcsname @@ -530,7 +530,7 @@ \define@booleankey{FV}{showspaces}% {\def\FV@Space{{\FancyVerbSpace}}}% {\def\FV@Space{\ }} -{\catcode`\ =12 \gdef\FancyVerbSpace{\tt }} +{\catcode`\ =12 \gdef\FancyVerbSpace{\texttt{\textvisiblespace}}} \fvset{showspaces=false} \def\FV@Tab{\hbox to\FancyVerbTabSize\fontdimen2\font{\hss\FV@TabChar}} \define@key{FV}{tabsize}{% diff --git a/macros/luatex/generic/luavlna/README.md b/macros/luatex/generic/luavlna/README.md index 366cd21700..b027486b21 100644 --- a/macros/luatex/generic/luavlna/README.md +++ b/macros/luatex/generic/luavlna/README.md @@ -1,4 +1,4 @@ -# Luavlna, version v0.1c, 2019-04-16 +# Luavlna, version v0.1d, 2019-10-22 # Introduction diff --git a/macros/luatex/generic/luavlna/luavlna-doc.pdf b/macros/luatex/generic/luavlna/luavlna-doc.pdf index c929578013..cb80186aee 100644 Binary files a/macros/luatex/generic/luavlna/luavlna-doc.pdf and b/macros/luatex/generic/luavlna/luavlna-doc.pdf differ diff --git a/macros/luatex/generic/luavlna/luavlna-doc.tex b/macros/luatex/generic/luavlna/luavlna-doc.tex index 1519d7fe9f..f8c95a291c 100644 --- a/macros/luatex/generic/luavlna/luavlna-doc.tex +++ b/macros/luatex/generic/luavlna/luavlna-doc.tex @@ -44,7 +44,7 @@ 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 +Another feature is inclusion of a non-breakable space after initials, like in personal names, after or before academic degrees and between numbers and units (SI and others). @@ -52,10 +52,11 @@ 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 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: @@ -169,6 +170,35 @@ Default values: \end{verbatim} \end{mycode} + +\subsection{Split hyphens} + +The hyphenated words like ``je-li'' should be be hyphenated as ``je-/-li`` +according to the Czech typesetting rules. This behaviour can be enabled or disabled for a particular +language using the following commands: + +\begin{mycode} + \cmd{\enablesplithyphens}\marg{language name}\\ + \cmd{\disablesplithyphens}\marg{language name} +\end{mycode} + +By default, it is enabled for the Czech language. + +Example in action: + +\begin{minipage}{3in} + \selectlanguage{czech} + Sedlec-Prčice, modro-zelený, překladatel-tlumočník, kuchař-číšník, propan-butan, + Otýlie Sklenářová-Malá, František Jílek-Oberpfalcer. + \selectlanguage{english} +\end{minipage} + +The similar behaviour can be achieved using the \verb|\splithyphens| command +provided by Czech langauge definitions for the Babel package, but it's use is +discouraged. It prevents use ot the hyphen character in many situations. The +solution provided by Luavlna should be safe. + + \subsection{Turning off language switching} By default, language of the nodes is taken into account. If you want to use diff --git a/macros/luatex/generic/luavlna/luavlna.lua b/macros/luatex/generic/luavlna/luavlna.lua index 84d4c3f82c..73a10fe9ba 100644 --- a/macros/luatex/generic/luavlna/luavlna.lua +++ b/macros/luatex/generic/luavlna/luavlna.lua @@ -305,10 +305,50 @@ local function prevent_single_letter (head) return true end +-- Enable hyphenation of words that contain hyphens +-- and repeating of the explicit hyphen on a new line when +-- the hyphen is hyphenated +-- It should be used in the `hyphenate` callback +-- based on ShreewatsaR's code from: +-- https://tex.stackexchange.com/a/417883/2891 +local hyphenate_langs = {} +local break_hyphens = function(head, tail) + local hyphenchar = string.byte("-") + local glyph_id = node.id("glyph") + local n = head + while n do + if n.id == glyph_id and hyphenate_langs[n.lang] and n.char == hyphenchar then + -- Insert an infinite penalty before, and a zero-width glue node after, the hyphen. + -- Like writing "\nobreak-\hspace{0pt}" or equivalently "\penalty10000-\hskip0pt" + local p = node.new(node.id('penalty')) + p.penalty = 10000 + head, p = node.insert_before(head, n, p) + local g = node.new(node.id('glue')) + head, g = node.insert_after(head, n, g) + -- insert the discretionary + local disc = node.new("disc") + disc.penalty = tex.hyphenpenalty + disc.subtype = 2 + disc.pre = node.copy(n) + disc.post = node.copy(n) + disc.replace = node.copy(n) + node.insert_before(head, g, disc) + -- insert another penalty + node.insert_before(head, g, node.copy(p)) + node.remove(head,n) + n = g + end + n = n.next + end + lang.hyphenate(head, tail) +end + M.preventsingle = prevent_single_letter M.singlechars = set_singlechars M.initials = set_initials M.set_tex4ht = set_tex4ht M.debug = set_debug M.set_main_language = set_main_language +M.split_hyphen_langs = hyphenate_langs +M.split_hyphens = break_hyphens return M diff --git a/macros/luatex/generic/luavlna/luavlna.sty b/macros/luatex/generic/luavlna/luavlna.sty index 059c260ea1..44efffb6bd 100644 --- a/macros/luatex/generic/luavlna/luavlna.sty +++ b/macros/luatex/generic/luavlna/luavlna.sty @@ -20,5 +20,6 @@ \singlechars{czech}{AIiVvOoUuSsZzKk} \singlechars{slovak}{AIiVvOoUuSsZzKk} \compoundinitials{czech}{Ch,CH} + \enablesplithyphens{czech} } \endinput diff --git a/macros/luatex/generic/luavlna/luavlna.tex b/macros/luatex/generic/luavlna/luavlna.tex index f3c44f1b69..a0fb9e515e 100644 --- a/macros/luatex/generic/luavlna/luavlna.tex +++ b/macros/luatex/generic/luavlna/luavlna.tex @@ -5,6 +5,7 @@ langno = require "luavlna-langno" require "ltluatex" luatexbase.add_to_callback("pre_linebreak_filter", luavlna.preventsingle,"LuaVlna") +luatexbase.add_to_callback("hyphenate", luavlna.split_hyphens, "allow hyphen breaks") % -- define the attribute number luavlna.preventsingleid = math.random(2^16) @@ -54,6 +55,18 @@ set_main_language = function(lang) if not langid then return nil, "Cannot find language number for: "..lang end luavlna.set_main_language(langid) end + +enable_split_hyphens = function(lang) + local langid = languages:get_number(lang) + if not langid then return nil, "Cannot find language number for: "..lang end + luavlna.split_hyphen_langs[langid] = true +end + +disable_split_hyphens = function(lang) + local langid = languages:get_number(lang) + if not langid then return nil, "Cannot find language number for: "..lang end + luavlna.split_hyphen_langs[langid] = nil +end } % Set letters which are prevented from breaking @@ -89,6 +102,11 @@ end \directlua{luavlna.debug(false)} } +% enable/disable split hyphens for a language + +\def\enablesplithyphens#1{\directlua{enable_split_hyphens("#1")}} +\def\disablesplithyphens#1{\directlua{disable_split_hyphens("#1")}} + % disable processing of units or degrees \def\nopredegrees{\directlua{luavlna.no_predegrees = true}} @@ -99,5 +117,6 @@ end \singlechars{czech}{AIiVvOoUuSsZzKk} \singlechars{slovak}{AIiVvOoUuSsZzKk} \compoundinitials{czech}{Ch,CH} + \enablesplithyphens{czech} \fi -- cgit v1.2.3