From c6d56047fce75536865d1d9977258f654bacee4e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 3 Jun 2018 21:20:15 +0000 Subject: lualatex-truncate (3jun18) git-svn-id: svn://tug.org/texlive/trunk@47915 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/lualatex/lualatex-truncate/README.md | 36 +++ .../lualatex-truncate/lualatex-truncate-doc.pdf | Bin 0 -> 61653 bytes .../lualatex-truncate/lualatex-truncate-doc.dtx | 263 +++++++++++++++++++++ .../lualatex-truncate/lualatex-truncate.dtx | 135 +++++++++++ .../lualatex-truncate/lualatex-truncate.ins | 41 ++++ .../lualatex-truncate/lualatex-truncate.sty | 73 ++++++ 6 files changed, 548 insertions(+) create mode 100644 Master/texmf-dist/doc/lualatex/lualatex-truncate/README.md create mode 100644 Master/texmf-dist/doc/lualatex/lualatex-truncate/lualatex-truncate-doc.pdf create mode 100644 Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx create mode 100644 Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx create mode 100644 Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.ins create mode 100644 Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/lualatex/lualatex-truncate/README.md b/Master/texmf-dist/doc/lualatex/lualatex-truncate/README.md new file mode 100644 index 00000000000..53de8f04861 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/lualatex-truncate/README.md @@ -0,0 +1,36 @@ +# lualatex-truncate +This package provides a wrapper for the [`truncate` package](https://ctan.org/pkg/truncate) package, +which fixes issues related to LuaTeX's hyphenation algorithm. + + +### Dependencies +`lualatex-truncate` depends on these packages: +`iftex`, `letltxmacro` and `truncate` + + +### Installation +Extract the *package* file first: + + 1. Run LaTeX over the file `lualatex-truncate.ins` + 2. Move the resulting `.sty` file to `TEXMF/tex/lualatex/lualatex-truncate/` + +Then, you can compile the *documentation* yourself by executing + + lualatex lualatex-truncate-doc.dtx + makeindex -s gind.ist lualatex-truncate-doc.idx + makeindex -s gglo.ist -o lualatex-truncate-doc.gls lualatex-truncate-doc.glo + lualatex lualatex-truncate-doc.dtx + lualatex lualatex-truncate-doc.dtx + + +or just use the precompiled documentation shipped with the source files. +In both cases, copy the files `lualatex-truncate-doc.pdf` and `README.md` to `TEXMF/doc/lualatex/lualatex-truncate/`. + + + +### License +LPPL 1.3c or any later version (available at [http://www.latex-project.org/lppl.txt](http://www.latex-project.org/lppl.txt "Show the current version of the LPPL")) + +This package is *maintained*. Current maintainer is [Sebastian Friedl](mailto:sfr682k@t-online.de). + + 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 new file mode 100644 index 00000000000..dbedf32bc23 Binary files /dev/null and b/Master/texmf-dist/doc/lualatex/lualatex-truncate/lualatex-truncate-doc.pdf differ 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 new file mode 100644 index 00000000000..ee6b8215e82 --- /dev/null +++ b/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx @@ -0,0 +1,263 @@ +%\iffalse +%% Doc-Source file to use with LaTeX2e +%% Copyright (C) 2018 Sebastian Friedl +%% +%% This work is subject to the LaTeX Project Public License, Version 1.3c or -- at +%% your option -- any later version of this license. +%% The work consists of the files lualatex-truncate.dtx, lualatex-truncate.ins, +%% lualatex-truncate-doc.dtx and the derived file lualatex-truncate.sty +%% +%% This work has the LPPL maintenance status ‘maintained’. +%% Current maintainer of the work is Sebastian Friedl. +%% +%% ------------------------------------------------------------------------------------------- +%% +%% A LuaLaTeX wrapper for the truncate package +%% +%% ------------------------------------------------------------------------------------------- +%% +%% Please report bugs and other problems as well as suggestions for improvements +%% to my email address (sfr682k@t-online.de). +%% +%% ------------------------------------------------------------------------------------------- +%\fi + +\documentclass[11pt]{ltxdoc} + +\usepackage{iftex} +\RequireLuaTeX + +\usepackage[no-math]{fontspec} +\usepackage{polyglossia} +\setdefaultlanguage{english} +\usepackage[english]{selnolig} + +\usepackage{array} +\usepackage{csquotes} +\usepackage{hologo} +\usepackage{multicol} +\usepackage{xcolor} + + +\parindent0pt + +\usepackage[erewhon]{newtxmath} +\setmainfont{erewhon} +\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} + + +\hyphenation{mo-dify-ing} + +\def\Lua{\textsf{Lua}\ignorespaces} + +\usepackage[unicode, pdfborder={0 0 0}, linktoc=all, hyperindex=false]{hyperref} +\usepackage{bookmark}% fix PDF bookmark issues caused by hyperref + + + +\MakeShortVerb{"} +\CheckSum{38} + +\renewcommand*{\usage}[1]{\hyperpage{#1}} +\renewcommand*{\main}[1]{\hyperpage{#1}} + +\newcommand*{\sty}[1]{\textsf{#1}} +\newcommand*{\opt}[1]{\texttt{#1}\index{#1=\texttt{#1}~~option|main}} + +\def\param#1{\textit{\rmfamily\ensuremath{\langle}#1\ensuremath{\rangle}}} +\def\DescribeOption#1{\marginpar{\raggedleft\PrintDescribeMacro{#1}}} + + +\PageIndex +\RecordChanges + + + + +\title{The \sty{lualatex-truncate} package \\ {\large\url{https://github.com/SFr682k/lualatex-truncate}}} +\author{Sebastian Friedl \\ \href{mailto:sfr682k@t-online.de}{\ttfamily sfr682k@t-online.de}} +\date{2018/06/03 (v1.0)} + +\hypersetup{pdftitle={The lualatex-truncate package},pdfauthor={Sebastian Friedl}} + +\begin{document} + \maketitle + \thispagestyle{empty} + + + + + \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}} + \end{abstract} + + + + \tableofcontents + + + + + \clearpage + + + \subsection*{Dependencies and other requirements} + \addcontentsline{toc}{subsection}{Dependencies and other requirements} + \sty{lualatex-truncate} requires \LaTeXe\ and depends on the following packages: + \begin{multicols}{3}\sffamily\centering + if\kern0pt tex \\ letltxmacro \\ truncate + \end{multicols} + + + \subsection*{Installation} + \addcontentsline{toc}{subsection}{Installation} + Extract the \textit{package} file first: + \begin{enumerate} + \item Run \LaTeX\ over the file "lualatex-truncate.ins" + \item Move the resulting ".sty" file to "TEXMF/tex/lualatex/lualatex-truncate/" + \end{enumerate} + + Then, you can compile the \textit{documentation} yourself by executing \\[\smallskipamount] + "lualatex lualatex-truncate-doc.dtx" \\ + "makeindex -s gind.ist lualatex-truncate-doc.idx" \\ + "makeindex -s gglo.ist -o lualatex-truncate-doc.gls lualatex-truncate-doc.glo" \\ + "lualatex lualatex-truncate-doc.dtx" \\ + "lualatex lualatex-truncate-doc.dtx" + + \smallskip + or just use the precompiled documentation shipped with the source files. \\ + In both cases, copy the files "lualatex-truncate-doc.pdf" and "README.md" to \\ + "TEXMF/doc/lualatex/lualatex-truncate/" + + + \subsection*{License} + \addcontentsline{toc}{subsection}{License} + \textcopyright\ 2018 Sebastian Friedl + + \smallskip + This work may be distributed and/or modified under the conditions of the \LaTeX\ Project Public License, either version 1.3c of this license or (at your option) any later version. + + \smallskip + The latest version of this license is available at \url{http://www.latex-project.org/lppl.txt} and version 1.3c or later is part of all distributions of \LaTeX\ version 2008-05-04 or later. + + \smallskip + This work has the LPPL maintenace status \enquote*{maintained}. \\ + Current maintainer of this work is Sebastian Friedl. + + \medskip + This work consists of the following files: + \begin{itemize} \itemsep 0pt + \item "lualatex-truncate.sty", + \item "lualatex-truncate.ins", + \item "lualatex-truncate-doc.dtx" and + \item the derived file "lualatex-truncate.sty" + \end{itemize} + + + + + + % 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}! + + \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. + \end{minipage}}} + \end{center} + + + \subsection*{Truncating text to a given width% + \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} + 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. + The default marker, used when the optional \texttt{[\param{marker}]} parameter is omitted, is "\,\dots". You can change this default by redefining \DescribeMacro{\TruncateMarker}"\TruncateMarker" (e.g.~"\renewcommand\TruncateMarker{\dots}"). + + \medskip + Normally, the text (no matter whether truncated or not) is printed flushed-left in a box with exactly the width specified. The package option \DescribeOption{fit}\opt{fit} causes the output text to have its natural width, up to a maximum of the specified width. + + \medskip + Normally, the text won't be truncated in the middle of a word, nor at a space specified with a tie ("~"). For example: + \begin{quote} + "\truncate{122pt}{This text has been~truncated}" + \end{quote} + gives + \begin{quote} + \enquote{\hbox to 122pt {This text has\,\dots\hfill}} + \end{quote} + + \medskip + You can use one of the package options \DescribeOption{hyphenate}\opt{hyphenate}, \DescribeOption{breakwords}\opt{breakwords} or \DescribeOption{breakall}\opt{breakall} to allow truncating in the middle of words. The first two only truncate at hyphenation points; with the only difference that \opt{breakwords} suppresses the hyphen character. + On the other hand, \opt{breakall} allows truncation at any character. For example: + \begin{quote} + "\truncate{122pt}{This text has been~truncated}" + \end{quote} + gives + \begin{quote} + \begin{tabular}{l@{\quad}l} + \enquote{\hbox to 122pt {This text has been trun-\,\dots\hfill}} & (package option \texttt{hyphenate}) \\ + \enquote{\hbox to 122pt {This text has been trun\,\dots~\hfill}} & (package option \texttt{breakwords}) \\ + \enquote{\hbox to 122pt {This text has been trunc\,\dots\hfill}} & (package option \texttt{breakall}) + \end{tabular} + \end{quote} + + [All of these options work through (Lua)\TeX's hyphenation mechanism.] + + + \subsection*{Known limitations} + \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{}-}}. + \end{itemize} + + + + + + + + + % Start determining the checksum from here + \StopEventually{% + \clearpage + \phantomsection + \addcontentsline{toc}{part}{Index}% + \PrintChanges + \setcounter{IndexColumns}{2} + \IndexPrologue{\section*{Index}} + \PrintIndex} + + + + \vspace{3\bigskipamount} + \part{The package code} + \CodelineNumbered + \DocInput{lualatex-truncate.dtx} + + + \Finale +\end{document} + diff --git a/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx b/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx new file mode 100644 index 00000000000..69ad4b80885 --- /dev/null +++ b/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.dtx @@ -0,0 +1,135 @@ +%\iffalse +%<*package> +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +% +%\fi +%\iffalse +% Doc-Source file to use with LaTeX2e +% Copyright (C) 2018 Sebastian Friedl +% +% This work is subject to the LaTeX Project Public License, Version 1.3c or -- at +% your option -- any later version of this license. +% The work consists of the files lualatex-truncate.dtx, lualatex-truncate.ins, +% lualatex-truncate-doc.dtx and the derived file lualatex-truncate.sty +% +% This work has the LPPL maintenance status 'maintained'. +% Current maintainer of the work is Sebastian Friedl. +%\fi +% +% +% +% \subsubsection*{Initialization} +% Identify the package and require \LaTeXe: +% \begin{macrocode} +\ProvidesPackage{lualatex-truncate}% + [2018/06/03 v1.0 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: +% \begin{macrocode} +\newif\if@lualtxtruncate@hackhyphen +\@lualtxtruncate@hackhyphenfalse +% \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: +% \begin{macrocode} +\DeclareOption{breakwords}{% + \@lualtxtruncate@hackhyphentrue + \PassOptionsToPackage{breakwords}{truncate}} +\DeclareOption{breakall}{% + \@lualtxtruncate@hackhyphentrue + \PassOptionsToPackage{breakall}{truncate}} +% \end{macrocode} +% +% \smallskip +% Pass all other options (\opt{hyphenate} and \opt{fit}) directly to the \sty{truncate} package: +% \begin{macrocode} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{truncate}} +% \end{macrocode} +% +% \smallskip +% Process all options passed to \sty{lualatex-truncate}: +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% +% +% \subsubsection*{Loading the \sty{truncate} package} +% Load the \sty{truncate} package. Required package options have already been passed on. +% \begin{macrocode} +\RequirePackage{truncate} +% \end{macrocode} +% +% +% +% \subsubsection*{If the document is not compiled via \hologo{LuaLaTeX}\dots} +% Don't wrap anything if the document isn't compiled by \hologo{LuaLaTeX}: +% \begin{macrocode} +\RequirePackage{iftex} +\ifLuaTeX\else% + \PackageWarningNoLine{lualatex-truncate}% + {Whoops! You don't want to use LuaLaTeX?}% + \endinput% +\fi% +% \end{macrocode} +% +% +% +% \subsubsection*{Constructing the wrapper} +% \begin{macro}{\lualtxtruncate@truncate} +% Remember the original "\truncate" command's definition. +% Since "\truncate" provides an optional argument, "\LetLtxMacro" has to be used +% instead of the primitive "\let" command: +% \begin{macrocode} +\RequirePackage{letltxmacro} +\LetLtxMacro\lualtxtruncate@truncate\truncate +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\truncate} +% Construct the wrapper by redefining the "\truncate" command +% and -- if necessary -- modifying "\prehyphenchar": +% \begin{macrocode} +\renewcommand{\truncate}[3][\TruncateMarker]{% + \if@lualtxtruncate@hackhyphen% + \prehyphenchar=0% + \fi% + \lualtxtruncate@truncate[#1]{#2}{#3}% + \if@lualtxtruncate@hackhyphen% + \prehyphenchar=`\-% + \fi% +} +% \end{macrocode} +% \end{macro} +% +% +% +% \subsubsection*{Famous last words} +% Enough code for this package. "\endinput". +% \begin{macrocode} +\endinput +% \end{macrocode} diff --git a/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.ins b/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.ins new file mode 100644 index 00000000000..696eeca771b --- /dev/null +++ b/Master/texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate.ins @@ -0,0 +1,41 @@ +\input docstrip + +\preamble + lualatex-truncate.dtx + Copyright 2018 Sebastian Friedl + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either version 1.3c + of this license of (at your option) any later version. + The latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3c or later is part of all distributions of LaTeX + version 2008/05/04 or later. + + This work has the LPPL maintenance status 'maintained'. + Current maintainer of the work is Sebastian Friedl + + This work consists of the files lualatex-truncate.dtx, lualatex-truncate.ins, + lualatex-truncate-doc.dtx and the derived file lualatex-truncate.sty + +\endpreamble + +\askforoverwritefalse + + + + +\generate +{% + \file + {lualatex-truncate.sty}% + {% + \usepreamble\defaultpreamble + \usepostamble\defaultpostamble + \from{lualatex-truncate.dtx}{lualatex-truncate.sty,package}% + }% +} + + +\endbatchfile + diff --git a/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty b/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty new file mode 100644 index 00000000000..70b742bc7f7 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/lualatex-truncate/lualatex-truncate.sty @@ -0,0 +1,73 @@ +%% +%% This is file `lualatex-truncate.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% lualatex-truncate.dtx (with options: `lualatex-truncate.sty,package') +%% lualatex-truncate.dtx +%% Copyright 2018 Sebastian Friedl +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status 'maintained'. +%% Current maintainer of the work is Sebastian Friedl +%% +%% This work consists of the files lualatex-truncate.dtx, lualatex-truncate.ins, +%% lualatex-truncate-doc.dtx and the derived file lualatex-truncate.sty +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\ProvidesPackage{lualatex-truncate}% + [2018/06/03 v1.0 LuaLaTeX wrapper for the truncate package] +\NeedsTeXFormat{LaTeX2e} +\newif\if@lualtxtruncate@hackhyphen +\@lualtxtruncate@hackhyphenfalse +\DeclareOption{breakwords}{% + \@lualtxtruncate@hackhyphentrue + \PassOptionsToPackage{breakwords}{truncate}} +\DeclareOption{breakall}{% + \@lualtxtruncate@hackhyphentrue + \PassOptionsToPackage{breakall}{truncate}} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{truncate}} +\ProcessOptions +\RequirePackage{truncate} +\RequirePackage{iftex} +\ifLuaTeX\else% + \PackageWarningNoLine{lualatex-truncate}% + {Whoops! You don't want to use LuaLaTeX?}% + \endinput% +\fi% +\RequirePackage{letltxmacro} +\LetLtxMacro\lualtxtruncate@truncate\truncate +\renewcommand{\truncate}[3][\TruncateMarker]{% + \if@lualtxtruncate@hackhyphen% + \prehyphenchar=0% + \fi% + \lualtxtruncate@truncate[#1]{#2}{#3}% + \if@lualtxtruncate@hackhyphen% + \prehyphenchar=`\-% + \fi% +} +\endinput +%% +%% End of file `lualatex-truncate.sty'. -- cgit v1.2.3