From afdc51a6036ffaa2e13db5b6af8c4d8a76e265f8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 2 Jul 2013 23:20:17 +0000 Subject: impnattypo git-svn-id: svn://tug.org/texlive/trunk@31076 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/impnattypo/impnattypo-fr.pdf | Bin 79521 -> 81806 bytes .../texmf-dist/doc/latex/impnattypo/impnattypo.pdf | Bin 78362 -> 80408 bytes .../source/latex/impnattypo/impnattypo.dtx | 73 ++++++++++++--------- .../source/latex/impnattypo/impnattypo.ins | 4 +- .../texmf-dist/tex/latex/impnattypo/impnattypo.sty | 51 ++++++++------ 5 files changed, 75 insertions(+), 53 deletions(-) diff --git a/Master/texmf-dist/doc/latex/impnattypo/impnattypo-fr.pdf b/Master/texmf-dist/doc/latex/impnattypo/impnattypo-fr.pdf index 719e99eae0b..4bebd5934b2 100644 Binary files a/Master/texmf-dist/doc/latex/impnattypo/impnattypo-fr.pdf and b/Master/texmf-dist/doc/latex/impnattypo/impnattypo-fr.pdf differ diff --git a/Master/texmf-dist/doc/latex/impnattypo/impnattypo.pdf b/Master/texmf-dist/doc/latex/impnattypo/impnattypo.pdf index d9f1e047f9b..21890faf5a7 100644 Binary files a/Master/texmf-dist/doc/latex/impnattypo/impnattypo.pdf and b/Master/texmf-dist/doc/latex/impnattypo/impnattypo.pdf differ diff --git a/Master/texmf-dist/source/latex/impnattypo/impnattypo.dtx b/Master/texmf-dist/source/latex/impnattypo/impnattypo.dtx index 00a6d410e0e..2a65bfb9639 100644 --- a/Master/texmf-dist/source/latex/impnattypo/impnattypo.dtx +++ b/Master/texmf-dist/source/latex/impnattypo/impnattypo.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2011 by Raphaël Pinson +% Copyright (C) 2011-2012 by Raphaël Pinson % --------------------------------------------------------------------------- % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -26,7 +26,7 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{impnattypo} %<*package> - [2011/09/20 1.0 Typographic utilities inspired by the French Imprimerie Nationale] + [2013/06/17 1.1 Typographic utilities inspired by the French Imprimerie Nationale] % % %<*driver> @@ -130,9 +130,9 @@ % le \emph{Lexique des règles typographiques en usage à l'Imprimerie Nationale} % est une référence incontournable. % -% Si la majorité des recommendations de cet ouvrage est implémentée dans +% Si la majorité des recommandations de cet ouvrage est implémentée dans % le module \textsf{frenchb} pour \textsf{babel}, -% certaines autres recommendations méritent encore d'être automatisées pour être +% certaines autres recommandations méritent encore d'être automatisées pour être % implémentées en \LaTeX. % % C'est le but original de ce paquet, initié par une question sur le site @@ -140,7 +140,7 @@ % et qui implémente plusieurs règles édictées dans ce lexique % afin de les rendre plus facilement applicables aux textes édités avec \LaTeX. % -% Au fur et à mesure que ce paquet a grandi, des fonctionalités sont venues +% Au fur et à mesure que ce paquet a grandi, des fonctionnalités sont venues % s'ajouter, dont certaines ne sont pas directement liées au lexique, % mais améliorent la qualité typographique des documents. % \fi @@ -192,7 +192,7 @@ % les césures en fin de page, ainsi que les césures sur deux lignes % consécutives. % -% Pour activer cette fonctionalité, utilisez l'option \texttt{hyphenation}: +% Pour activer cette fonctionnalité, utilisez l'option \texttt{hyphenation}: % \fi % % \begin{verbatim} @@ -223,14 +223,14 @@ % \DescribeMacro{lastparline} % \ifenglish % Moreover, it is indicated in the ``Hyphenation'' section -% that ``the last line of a paragraph must contain a word of +% that ``the last line of a paragraph must contain a word or % the end of a word of a width at least equal to the double -% of the identation of the next paragraph.'' Since implementing +% of the indent of the next paragraph.'' Since implementing % this solution exactly is quite tricky, the \texttt{lastparline} % option ensures that the last line of a paragraph is at least % as long as the double value of |\parindent|.\footnote{\url{http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line}} % -% When \LuaTeX is used, the solution provided by Patrick Gundlach\footnote{\url{http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line/28361\#28361}} +% When \LuaTeX{} is used, the solution provided by Patrick Gundlach\footnote{\url{http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line/28361\#28361}} % is used. With other rendering engines, it is the native solution provided by % Enrico Gregorio\footnote{\url{http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line/28358\#28358}} % that serves as an implementation: @@ -243,7 +243,7 @@ % ligne d'un alinéa est au moins aussi longue que le double % de la valeur de |\parindent|.\footnote{\url{http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line}} % -% Lorsque \LuaTeX est utilisé, la solution de Patrick Gundlach\footnote{\url{http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line/28361\#28361}} +% Lorsque \LuaTeX{} est utilisé, la solution de Patrick Gundlach\footnote{\url{http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line/28361\#28361}} % est utilisée. Avec les autres moteurs de rendu, c'est la solution native de % Enrico Gregorio\footnote{\url{http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line/28358\#28358}} % qui fait office d'implémentation: @@ -254,12 +254,12 @@ % \end{verbatim} % % \ifenglish -% When the \texttt{draft} option is activated and \LuaTeX is used, +% When the \texttt{draft} option is activated and \LuaTeX{} is used, % the inserted ties are colored in % {\color{\intlastparlinecolor}\intlastparlinecolor}. % The color can be tuned with the \texttt{lastparlinecolor} option. % \else -% Lorsque l'option \texttt{draft} est activée et que \LuaTeX est utilisé, +% Lorsque l'option \texttt{draft} est activée et que \LuaTeX{} est utilisé, % les espaces insécables insérés sont colorés en % {\color{\intlastparlinecolor}\intlastparlinecolor}. % La couleur utilisée peut être ajustée par l'option \texttt{lastparlinecolor}. @@ -469,7 +469,7 @@ % \ifenglish % \subsection{Widows and Orphans} % -% It is recommended to not leave widows and orphans in a document. +% It is recommended not to leave widows and orphans in a document. % For this reason, we recommend you use the |nowidow| package: % \else % \subsection{Lignes orphelines et veuves} @@ -498,7 +498,7 @@ % as well as the information added by the \texttt{homeoarchy} % and \texttt{rivers} options. In draft mode, % places where ties were inserted are indicated -% by colored squared. +% by colored squares. % % To activate the draft mode, use the \texttt{draft} option, % for example: @@ -897,7 +897,7 @@ \ifluatex \RequirePackage{luatexbase,luacode} \begin{luacode} -river_analyze_line = function(line,dim1,dim2) +river_analyze_line = function(line,dim1,dim2,precision) local head = line.head while head do @@ -905,9 +905,9 @@ river_analyze_line = function(line,dim1,dim2) local w1,h1,d1 = node.dimensions(line.glue_set,line.glue_sign,line.glue_order,line.head,head.prev) local w2,h2,d2 = node.dimensions(line.glue_set,line.glue_sign,line.glue_order,line.head,head) --print("dim1:"..dim1.."; dim2:"..dim2.."; w1:"..w1.."; w2:"..w2) - if w1 > dim2 then -- out of range + if w1 > dim2 + precision then -- out of range return false,head - elseif w1 < dim2 and w2 > dim1 then -- found + elseif w1 < (dim2 + precision) and w2 > (dim1 - precision) then -- found return true,head end end @@ -940,23 +940,34 @@ rivers = function (head) if cur_node.id == 37 then -- glyph char_count = char_count + 1 elseif cur_node.id == 10 and char_count > 0 and cur_node.next then -- glue node + -- prev_line local w1,h1,d1 = node.dimensions(head.glue_set,head.glue_sign,head.glue_order,head.head,cur_node.prev) local w2,h2,d2 = node.dimensions(head.glue_set,head.glue_sign,head.glue_order,head.head,cur_node) - found_pp,head_pp = river_analyze_line(prev_prev_line,w1,w2) - found_p,head_p = river_analyze_line(prev_line,w1,w2) + -- if we allow up to 45° diagonal rivers, then there can be up to + or - line height between spaces + local w_p,h_p,d_p = node.dimensions(prev_line.head,cur_line.head) -- calculate line height + found_p,head_p = river_analyze_line(prev_line,w1,w2,h_p) - if found_pp and found_p then - local n_pp = node.new("whatsit","pdf_literal") - n_pp.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" - node.insert_after(prev_prev_line,head_pp.prev,n_pp) - - local n_p = node.new("whatsit","pdf_literal") - n_p.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" - node.insert_after(prev_line,head_p.prev,n_p) - - local n_c = node.new("whatsit","pdf_literal") - n_c.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" - node.insert_after(cur_line,cur_node.prev,n_c) + if found_p then + -- prev_prev_line + local w1,h1,d1 = node.dimensions(prev_line.glue_set,prev_line.glue_sign,prev_line.glue_order,prev_line.head,head_p.prev) + local w2,h2,d2 = node.dimensions(prev_line.glue_set,prev_line.glue_sign,prev_line.glue_order,prev_line.head,head_p) + -- if we allow up to 45° diagonal rivers, then there can be up to + or - line height between spaces + local w_p,h_p,d_p = node.dimensions(prev_prev_line.head,prev_line.head) -- calculate line height + found_pp,head_pp = river_analyze_line(prev_prev_line,w1,w2,h_p) + + if found_pp then + local n_pp = node.new("whatsit","pdf_literal") + n_pp.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" + node.insert_after(prev_prev_line,head_pp.prev,n_pp) + + local n_p = node.new("whatsit","pdf_literal") + n_p.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" + node.insert_after(prev_line,head_p.prev,n_p) + + local n_c = node.new("whatsit","pdf_literal") + n_c.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" + node.insert_after(cur_line,cur_node.prev,n_c) + end end end cur_node = cur_node.next diff --git a/Master/texmf-dist/source/latex/impnattypo/impnattypo.ins b/Master/texmf-dist/source/latex/impnattypo/impnattypo.ins index 0d7cfac919d..b3abf917884 100644 --- a/Master/texmf-dist/source/latex/impnattypo/impnattypo.ins +++ b/Master/texmf-dist/source/latex/impnattypo/impnattypo.ins @@ -1,4 +1,4 @@ -%% Copyright (C) 2011 by Raphaël Pinson +%% Copyright (C) 2011-2012 by Raphaël Pinson %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -25,7 +25,7 @@ This is a generated file. -Copyright (C) 2011 by Raphaël Pinson +Copyright (C) 2011-2012 by Raphaël Pinson -------------------------------------------------------------------------- This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 diff --git a/Master/texmf-dist/tex/latex/impnattypo/impnattypo.sty b/Master/texmf-dist/tex/latex/impnattypo/impnattypo.sty index 79638f99a63..11e6fb0fb43 100644 --- a/Master/texmf-dist/tex/latex/impnattypo/impnattypo.sty +++ b/Master/texmf-dist/tex/latex/impnattypo/impnattypo.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2011 by Raphaël Pinson +%% Copyright (C) 2011-2012 by Raphaël Pinson %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -20,7 +20,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{impnattypo} - [2011/09/20 1.0 Typographic utilities inspired by the French Imprimerie Nationale] + [2013/06/17 1.1 Typographic utilities inspired by the French Imprimerie Nationale] \ProvidesPackage{impnattypo} \RequirePackage{ifluatex} \RequirePackage{kvoptions} @@ -338,7 +338,7 @@ \ifluatex \RequirePackage{luatexbase,luacode} \begin{luacode} -river_analyze_line = function(line,dim1,dim2) +river_analyze_line = function(line,dim1,dim2,precision) local head = line.head while head do @@ -346,9 +346,9 @@ river_analyze_line = function(line,dim1,dim2) local w1,h1,d1 = node.dimensions(line.glue_set,line.glue_sign,line.glue_order,line.head,head.prev) local w2,h2,d2 = node.dimensions(line.glue_set,line.glue_sign,line.glue_order,line.head,head) --print("dim1:"..dim1.."; dim2:"..dim2.."; w1:"..w1.."; w2:"..w2) - if w1 > dim2 then -- out of range + if w1 > dim2 + precision then -- out of range return false,head - elseif w1 < dim2 and w2 > dim1 then -- found + elseif w1 < (dim2 + precision) and w2 > (dim1 - precision) then -- found return true,head end end @@ -381,23 +381,34 @@ rivers = function (head) if cur_node.id == 37 then -- glyph char_count = char_count + 1 elseif cur_node.id == 10 and char_count > 0 and cur_node.next then -- glue node + -- prev_line local w1,h1,d1 = node.dimensions(head.glue_set,head.glue_sign,head.glue_order,head.head,cur_node.prev) local w2,h2,d2 = node.dimensions(head.glue_set,head.glue_sign,head.glue_order,head.head,cur_node) - found_pp,head_pp = river_analyze_line(prev_prev_line,w1,w2) - found_p,head_p = river_analyze_line(prev_line,w1,w2) - - if found_pp and found_p then - local n_pp = node.new("whatsit","pdf_literal") - n_pp.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" - node.insert_after(prev_prev_line,head_pp.prev,n_pp) - - local n_p = node.new("whatsit","pdf_literal") - n_p.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" - node.insert_after(prev_line,head_p.prev,n_p) - - local n_c = node.new("whatsit","pdf_literal") - n_c.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" - node.insert_after(cur_line,cur_node.prev,n_c) + -- if we allow up to 45° diagonal rivers, then there can be up to + or - line height between spaces + local w_p,h_p,d_p = node.dimensions(prev_line.head,cur_line.head) -- calculate line height + found_p,head_p = river_analyze_line(prev_line,w1,w2,h_p) + + if found_p then + -- prev_prev_line + local w1,h1,d1 = node.dimensions(prev_line.glue_set,prev_line.glue_sign,prev_line.glue_order,prev_line.head,head_p.prev) + local w2,h2,d2 = node.dimensions(prev_line.glue_set,prev_line.glue_sign,prev_line.glue_order,prev_line.head,head_p) + -- if we allow up to 45° diagonal rivers, then there can be up to + or - line height between spaces + local w_p,h_p,d_p = node.dimensions(prev_prev_line.head,prev_line.head) -- calculate line height + found_pp,head_pp = river_analyze_line(prev_prev_line,w1,w2,h_p) + + if found_pp then + local n_pp = node.new("whatsit","pdf_literal") + n_pp.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" + node.insert_after(prev_prev_line,head_pp.prev,n_pp) + + local n_p = node.new("whatsit","pdf_literal") + n_p.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" + node.insert_after(prev_line,head_p.prev,n_p) + + local n_c = node.new("whatsit","pdf_literal") + n_c.data = "q \usecolor{\intriverscolor} 0 0 m 0 5 l 5 5 l 5 0 l b Q" + node.insert_after(cur_line,cur_node.prev,n_c) + end end end cur_node = cur_node.next -- cgit v1.2.3