diff options
author | Karl Berry <karl@freefriends.org> | 2018-08-23 21:58:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-08-23 21:58:27 +0000 |
commit | ab5a34bb0e115a822ce300baee997608c943af86 (patch) | |
tree | 7ccf57a1236f1274ed23590bd563c2d9b3b4e79d /Master/texmf-dist | |
parent | 14b9c74b24ab667050881bb540464c1593f7e3c9 (diff) |
lualatex-truncate (23aug18)
git-svn-id: svn://tug.org/texlive/trunk@48469 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
4 files changed, 84 insertions, 40 deletions
diff --git a/Master/texmf-dist/doc/lualatex/lualatex-truncate/lualatex-truncate-doc.pdf b/Master/texmf-dist/doc/lualatex/lualatex-truncate/lualatex-truncate-doc.pdf Binary files differindex dbedf32bc23..67dd999e19f 100644 --- a/Master/texmf-dist/doc/lualatex/lualatex-truncate/lualatex-truncate-doc.pdf +++ b/Master/texmf-dist/doc/lualatex/lualatex-truncate/lualatex-truncate-doc.pdf diff --git a/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx b/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx index ee6b8215e82..38fb37afa4c 100644 --- a/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx +++ b/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx @@ -22,6 +22,8 @@ %% ------------------------------------------------------------------------------------------- %\fi +% !TeX spellcheck=en_US + \documentclass[11pt]{ltxdoc} \usepackage{iftex} @@ -46,7 +48,7 @@ \setsansfont[Scale=MatchLowercase]{Source Sans Pro} \setmonofont[Scale=MatchLowercase]{Hack} -\usepackage[left=4.50cm,right=2.75cm,top=3.25cm,bottom=2.75cm,nohead]{geometry} +\usepackage[a4paper,left=4.50cm,right=2.75cm,top=3.25cm,bottom=2.75cm,nohead]{geometry} \hyphenation{mo-dify-ing} @@ -59,7 +61,7 @@ \MakeShortVerb{"} -\CheckSum{38} +\CheckSum{55} \renewcommand*{\usage}[1]{\hyperpage{#1}} \renewcommand*{\main}[1]{\hyperpage{#1}} @@ -77,9 +79,9 @@ -\title{The \sty{lualatex-truncate} package \\ {\large\url{https://github.com/SFr682k/lualatex-truncate}}} +\title{The \sty{lualatex-truncate} package \\ {\large\url{https://gitlab.com/SFr682k/lualatex-truncate}}} \author{Sebastian Friedl \\ \href{mailto:sfr682k@t-online.de}{\ttfamily sfr682k@t-online.de}} -\date{2018/06/03 (v1.0)} +\date{2018/08/22 (v1.1)} \hypersetup{pdftitle={The lualatex-truncate package},pdfauthor={Sebastian Friedl}} @@ -93,8 +95,8 @@ \medskip \begin{abstract}\centering \hspace{-1.5em}% - This package provides a wrapper for using the \sty{truncate} package with \hologo{LuaLaTeX}% - \footnote{The \sty{truncate} package is available at \url{https://ctan.org/pkg/truncate}} + This package provides a wrapper for using the \sty{truncate} package\footnote{available at \url{https://ctan.org/pkg/truncate}}, + thus fixing issues related to \hologo{LuaTeX}'s hyphenation mechanism. \end{abstract} @@ -166,17 +168,15 @@ % DOCUMENTATION PART ---------------------------------------------------------------------- \clearpage \part{The documentation} - \subsection*{Read this section first} - \addcontentsline{toc}{subsection}{Read this section first} \begin{center} \colorbox{red!75!black}{\colorbox{white}{\begin{minipage}{.95\textwidth} \textbf{\color{red!75!black}\large Don't load the \sty{truncate} package in your preamble!!} \medskip - This task is already done for you when loading \sty{lualatex-truncate}! + This task is already done for you by \sty{lualatex-truncate}! \smallskip - Also, all package options stated in this documentation are meant to be passed to \sty{lualatex-truncate}, so they can be processed by the wrapper mechanism. + Also, all package options stated in this documentation are meant to be passed to \sty{lualatex-truncate}; otherwise they can't be processed by the wrapper mechanism. \end{minipage}}} \end{center} @@ -185,6 +185,9 @@ \footnote{This section has been adapted from \sty{truncate}'s documentation: \\ \indent\indent\url{http://mirrors.ctan.org/macros/latex/contrib/truncate/truncate.pdf}}} \addcontentsline{toc}{subsection}{Truncating text to a given width} + + \leavevmode% + \DescribeOption{\truncate}% The package defines a command "\truncate["\param{marker}"]{"\param{width}"}{"\param{text}"}". If the text is too wide to fit in the specified width, then it is truncated, and a continuation marker is shown at the end. @@ -225,12 +228,8 @@ \addcontentsline{toc}{subsection}{Known limitations} \begin{itemize} \item - \sty{lualatex-truncate} provides a \textit{wrapper} to enable using the \sty{truncate} package together with \hologo{LuaLaTeX}. - It doesn't (and won't) fix any bugs or \enquote{undocumented features} introduced by the \sty{truncate} package. - - \item - \sty{lualatex-truncate} applies some \enquote{hacking} to the hyphenation character. \\ - This might cause some problems if the hyphenation character of the currently used language is different from \enquote{\texttt{\textbackslash{}-}}. + \sty{lualatex-truncate} provides a \textit{wrapper} fixing \hologo{LuaTeX}-related \enquote{glitches} in the \sty{truncate} package. + It doesn't (and won't) fix any bugs or \enquote{undocumented features} introduced by the \sty{truncate} package itself. \end{itemize} diff --git a/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx b/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx index 69ad4b80885..06d035702a1 100644 --- a/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx +++ b/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx @@ -32,40 +32,55 @@ % % % +% \changes{1.0}{2018/06/03}{Initial release} +% \changes{1.1}{2018/08/22}{\textsc{\bfseries Bugfix:} visible hyphen char with \texttt{breakall} option and non-english language} +% % \subsubsection*{Initialization} % Identify the package and require \LaTeXe: % \begin{macrocode} \ProvidesPackage{lualatex-truncate}% - [2018/06/03 v1.0 LuaLaTeX wrapper for the truncate package] + [2018/08/22 v1.1 LuaLaTeX wrapper for the truncate package] \NeedsTeXFormat{LaTeX2e} % \end{macrocode} % % % % \subsubsection*{Internal variables} -% This internal variable is used to remember whether \enquote{hacking} the hyphenation character (i.e.~"\prehyphenchar") is required: +% This variable is used to remember whether messing with the hyphen char is required: % \begin{macrocode} \newif\if@lualtxtruncate@hackhyphen \@lualtxtruncate@hackhyphenfalse % \end{macrocode} % +% Also, enable remembering whether the \opt{breakall} option has been used: +% \begin{macrocode} +\newif\if@lualtxtruncate@breakall +\@lualtxtruncate@breakallfalse +% \end{macrocode} +% +% % % % \subsubsection*{Package options} % The \opt{breakwords} and \opt{breakall} options require the hyphanation character to be hidden. % Therefore, we remember to \enquote{hack} the hyphen character before passing these options -% to the original \sty{truncate} package: +% to the \enquote{original} \sty{truncate} package: % \begin{macrocode} \DeclareOption{breakwords}{% - \@lualtxtruncate@hackhyphentrue + \@lualtxtruncate@hackhyphentrue% \PassOptionsToPackage{breakwords}{truncate}} +% \end{macrocode} +% +% In case of the \opt{breakall} option, we also need to remember the option's usage: +% \begin{macrocode} \DeclareOption{breakall}{% - \@lualtxtruncate@hackhyphentrue + \@lualtxtruncate@breakalltrue% + \@lualtxtruncate@hackhyphentrue% \PassOptionsToPackage{breakall}{truncate}} % \end{macrocode} % % \smallskip -% Pass all other options (\opt{hyphenate} and \opt{fit}) directly to the \sty{truncate} package: +% Pass all other options (i.e. \opt{hyphenate} and \opt{fit}) directly to the \sty{truncate} package: % \begin{macrocode} \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{truncate}} % \end{macrocode} @@ -78,10 +93,17 @@ % % % -% \subsubsection*{Loading the \sty{truncate} package} -% Load the \sty{truncate} package. Required package options have already been passed on. +% \subsubsection*{Load the \sty{truncate} package} +% Require the \sty{truncate} package. All package options have already been passed on. \\ +% If \sty{truncate} has been loaded already, a error message is printed to the log. % \begin{macrocode} -\RequirePackage{truncate} +\@ifpackageloaded{truncate}{% + \PackageError{lualatex-truncate}% + {Don't load the truncate package when using lualatex-truncate!}% + {Don't load the truncate package and pass all package options + to lualatex-truncate! Otherwise, the wrapper mechanism won't + be able to understand what you want.}% +}{\RequirePackage{truncate}} % \end{macrocode} % % @@ -111,18 +133,27 @@ % \end{macro} % % \begin{macro}{\truncate} +% \changes{1.1}{2018/08/22}{Remember previous hyphenation character} % Construct the wrapper by redefining the "\truncate" command -% and -- if necessary -- modifying "\prehyphenchar": +% and -- if necessary -- modifying "\prehyphenchar". \\ +% "\prehyphenchar"'s value is stored inside the counter +% "\lualtxtruncate@tmp". Also, the current language must be set to US english, +% if the \opt{breakall} option has been used. % \begin{macrocode} -\renewcommand{\truncate}[3][\TruncateMarker]{% +\renewcommand{\truncate}[3][\TruncateMarker]{{% two braces -> scope changes + \if@lualtxtruncate@breakall% + \language\z@% force US english + \fi% + \newcount\lualtxtruncate@tmp% + \lualtxtruncate@tmp=\the\prehyphenchar% remember current hyphen char \if@lualtxtruncate@hackhyphen% - \prehyphenchar=0% + \prehyphenchar=0% invisible hyphen \fi% - \lualtxtruncate@truncate[#1]{#2}{#3}% + \lualtxtruncate@truncate[#1]{#2}{#3}% run the original \truncate macro \if@lualtxtruncate@hackhyphen% - \prehyphenchar=`\-% + \prehyphenchar=\the\lualtxtruncate@tmp% restore hyphen \fi% -} +}} % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty b/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty index 70b742bc7f7..9036f400a97 100644 --- a/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty +++ b/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty @@ -38,19 +38,28 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \ProvidesPackage{lualatex-truncate}% - [2018/06/03 v1.0 LuaLaTeX wrapper for the truncate package] + [2018/08/22 v1.1 LuaLaTeX wrapper for the truncate package] \NeedsTeXFormat{LaTeX2e} \newif\if@lualtxtruncate@hackhyphen \@lualtxtruncate@hackhyphenfalse +\newif\if@lualtxtruncate@breakall +\@lualtxtruncate@breakallfalse \DeclareOption{breakwords}{% - \@lualtxtruncate@hackhyphentrue + \@lualtxtruncate@hackhyphentrue% \PassOptionsToPackage{breakwords}{truncate}} \DeclareOption{breakall}{% - \@lualtxtruncate@hackhyphentrue + \@lualtxtruncate@breakalltrue% + \@lualtxtruncate@hackhyphentrue% \PassOptionsToPackage{breakall}{truncate}} \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{truncate}} \ProcessOptions -\RequirePackage{truncate} +\@ifpackageloaded{truncate}{% + \PackageError{lualatex-truncate}% + {Don't load the truncate package when using lualatex-truncate!}% + {Don't load the truncate package and pass all package options + to lualatex-truncate! Otherwise, the wrapper mechanism won't + be able to understand what you want.}% +}{\RequirePackage{truncate}} \RequirePackage{iftex} \ifLuaTeX\else% \PackageWarningNoLine{lualatex-truncate}% @@ -59,15 +68,20 @@ \fi% \RequirePackage{letltxmacro} \LetLtxMacro\lualtxtruncate@truncate\truncate -\renewcommand{\truncate}[3][\TruncateMarker]{% +\renewcommand{\truncate}[3][\TruncateMarker]{{% two braces -> scope changes + \if@lualtxtruncate@breakall% + \language\z@% force US english + \fi% + \newcount\lualtxtruncate@tmp% + \lualtxtruncate@tmp=\the\prehyphenchar% remember current hyphen char \if@lualtxtruncate@hackhyphen% - \prehyphenchar=0% + \prehyphenchar=0% invisible hyphen \fi% - \lualtxtruncate@truncate[#1]{#2}{#3}% + \lualtxtruncate@truncate[#1]{#2}{#3}% run the original \truncate macro \if@lualtxtruncate@hackhyphen% - \prehyphenchar=`\-% + \prehyphenchar=\the\lualtxtruncate@tmp% restore hyphen \fi% -} +}} \endinput %% %% End of file `lualatex-truncate.sty'. |