texlive[48469] Master/texmf-dist: lualatex-truncate (23aug18)
commits+karl at tug.org
commits+karl at tug.org
Thu Aug 23 23:58:27 CEST 2018
Revision: 48469
http://tug.org/svn/texlive?view=revision&revision=48469
Author: karl
Date: 2018-08-23 23:58:27 +0200 (Thu, 23 Aug 2018)
Log Message:
-----------
lualatex-truncate (23aug18)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/lualatex/lualatex-truncate/lualatex-truncate-doc.pdf
trunk/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx
trunk/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx
trunk/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty
Modified: trunk/Master/texmf-dist/doc/lualatex/lualatex-truncate/lualatex-truncate-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx 2018-08-23 21:58:14 UTC (rev 48468)
+++ trunk/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx 2018-08-23 21:58:27 UTC (rev 48469)
@@ -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 at t-online.de}{\ttfamily sfr682k at 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}
Modified: trunk/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx 2018-08-23 21:58:14 UTC (rev 48468)
+++ trunk/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx 2018-08-23 21:58:27 UTC (rev 48469)
@@ -32,11 +32,14 @@
%
%
%
+% \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}
%
@@ -43,29 +46,41 @@
%
%
% \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 at lualtxtruncate@hackhyphen
\@lualtxtruncate at hackhyphenfalse
% \end{macrocode}
%
+% Also, enable remembering whether the \opt{breakall} option has been used:
+% \begin{macrocode}
+\newif\if at lualtxtruncate@breakall
+\@lualtxtruncate at 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 at hackhyphentrue
+ \@lualtxtruncate at 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 at hackhyphentrue
+ \@lualtxtruncate at breakalltrue%
+ \@lualtxtruncate at 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 at 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 at lualtxtruncate@breakall%
+ \language\z@% force US english
+ \fi%
+ \newcount\lualtxtruncate at tmp%
+ \lualtxtruncate at tmp=\the\prehyphenchar% remember current hyphen char
\if at lualtxtruncate@hackhyphen%
- \prehyphenchar=0%
+ \prehyphenchar=0% invisible hyphen
\fi%
- \lualtxtruncate at truncate[#1]{#2}{#3}%
+ \lualtxtruncate at truncate[#1]{#2}{#3}% run the original \truncate macro
\if at lualtxtruncate@hackhyphen%
- \prehyphenchar=`\-%
+ \prehyphenchar=\the\lualtxtruncate at tmp% restore hyphen
\fi%
-}
+}}
% \end{macrocode}
% \end{macro}
%
Modified: trunk/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty 2018-08-23 21:58:14 UTC (rev 48468)
+++ trunk/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty 2018-08-23 21:58:27 UTC (rev 48469)
@@ -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 at lualtxtruncate@hackhyphen
\@lualtxtruncate at hackhyphenfalse
+\newif\if at lualtxtruncate@breakall
+\@lualtxtruncate at breakallfalse
\DeclareOption{breakwords}{%
- \@lualtxtruncate at hackhyphentrue
+ \@lualtxtruncate at hackhyphentrue%
\PassOptionsToPackage{breakwords}{truncate}}
\DeclareOption{breakall}{%
- \@lualtxtruncate at hackhyphentrue
+ \@lualtxtruncate at breakalltrue%
+ \@lualtxtruncate at 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 at truncate\truncate
-\renewcommand{\truncate}[3][\TruncateMarker]{%
+\renewcommand{\truncate}[3][\TruncateMarker]{{% two braces -> scope changes
+ \if at lualtxtruncate@breakall%
+ \language\z@% force US english
+ \fi%
+ \newcount\lualtxtruncate at tmp%
+ \lualtxtruncate at tmp=\the\prehyphenchar% remember current hyphen char
\if at lualtxtruncate@hackhyphen%
- \prehyphenchar=0%
+ \prehyphenchar=0% invisible hyphen
\fi%
- \lualtxtruncate at truncate[#1]{#2}{#3}%
+ \lualtxtruncate at truncate[#1]{#2}{#3}% run the original \truncate macro
\if at lualtxtruncate@hackhyphen%
- \prehyphenchar=`\-%
+ \prehyphenchar=\the\lualtxtruncate at tmp% restore hyphen
\fi%
-}
+}}
\endinput
%%
%% End of file `lualatex-truncate.sty'.
More information about the tex-live-commits
mailing list