Debian Codegraph @

texmf-dist/source/lualatex/lualatex-truncate/lualatex-truncate-doc.dtx

raw
1 %\iffalse
2 %% Doc-Source file to use with LaTeX2e
3 %% Copyright (C) 2018 Sebastian Friedl
4 %%
5 %% This work is subject to the LaTeX Project Public License, Version 1.3c or -- at
6 %% your option -- any later version of this license.
7 %% The work consists of the files lualatex-truncate.dtx, lualatex-truncate.ins,
8 %% lualatex-truncate-doc.dtx and the derived file lualatex-truncate.sty
9 %%
10 %% This work has the LPPL maintenance status ‘maintained’.
11 %% Current maintainer of the work is Sebastian Friedl.
12 %%
13 %% -------------------------------------------------------------------------------------------
14 %%
15 %% A LuaLaTeX wrapper for the truncate package
16 %%
17 %% -------------------------------------------------------------------------------------------
18 %%
19 %% Please report bugs and other problems as well as suggestions for improvements
20 %% to my email address ([email protected]).
21 %%
22 %% -------------------------------------------------------------------------------------------
23 %\fi
24
25 % !TeX spellcheck=en_US
26
27 \documentclass[11pt]{ltxdoc}
28
29 \usepackage{iftex}
30 \RequireLuaTeX
31
32 \usepackage[no-math]{fontspec}
33 \usepackage{polyglossia}
34 \setdefaultlanguage{english}
35 \usepackage[english]{selnolig}
36
37 \usepackage{array}
38 \usepackage{csquotes}
39 \usepackage{hologo}
40 \usepackage{multicol}
41 \usepackage{xcolor}
42
43
44 \parindent0pt
45
46 \usepackage[erewhon]{newtxmath}
47 \setmainfont{erewhon}
48 \setsansfont[Scale=MatchLowercase]{Source Sans Pro}
49 \setmonofont[Scale=MatchLowercase]{Hack}
50
51 \usepackage[a4paper,left=4.50cm,right=2.75cm,top=3.25cm,bottom=2.75cm,nohead]{geometry}
52
53
54 \hyphenation{mo-dify-ing}
55
56 \def\Lua{\textsf{Lua}\ignorespaces}
57
58 \usepackage[unicode, pdfborder={0 0 0}, linktoc=all, hyperindex=false]{hyperref}
59 \usepackage{bookmark}% fix PDF bookmark issues caused by hyperref
60
61
62
63 \MakeShortVerb{"}
64 \CheckSum{55}
65
66 \renewcommand*{\usage}[1]{\hyperpage{#1}}
67 \renewcommand*{\main}[1]{\hyperpage{#1}}
68
69 \newcommand*{\sty}[1]{\textsf{#1}}
70 \newcommand*{\opt}[1]{\texttt{#1}\index{#1=\texttt{#1}~~option|main}}
71
72 \def\param#1{\textit{\rmfamily\ensuremath{\langle}#1\ensuremath{\rangle}}}
73 \def\DescribeOption#1{\marginpar{\raggedleft\PrintDescribeMacro{#1}}}
74
75
76 \PageIndex
77 \RecordChanges
78
79
80
81
82 \title{The \sty{lualatex-truncate} package \\ {\large\url{https://gitlab.com/SFr682k/lualatex-truncate}}}
83 \author{Sebastian Friedl \\ \href{mailto:[email protected]}{\ttfamily [email protected]}}
84 \date{2018/08/22 (v1.1)}
85
86 \hypersetup{pdftitle={The lualatex-truncate package},pdfauthor={Sebastian Friedl}}
87
88 \begin{document}
89 \maketitle
90 \thispagestyle{empty}
91
92
93
94
95 \medskip
96 \begin{abstract}\centering
97 \hspace{-1.5em}%
98 This package provides a wrapper for using the \sty{truncate} package\footnote{available at \url{https://ctan.org/pkg/truncate}},
99 thus fixing issues related to \hologo{LuaTeX}'s hyphenation mechanism.
100 \end{abstract}
101
102
103
104 \tableofcontents
105
106
107
108
109 \clearpage
110
111
112 \subsection*{Dependencies and other requirements}
113 \addcontentsline{toc}{subsection}{Dependencies and other requirements}
114 \sty{lualatex-truncate} requires \LaTeXe\ and depends on the following packages:
115 \begin{multicols}{3}\sffamily\centering
116 if\kern0pt tex \\ letltxmacro \\ truncate
117 \end{multicols}
118
119
120 \subsection*{Installation}
121 \addcontentsline{toc}{subsection}{Installation}
122 Extract the \textit{package} file first:
123 \begin{enumerate}
124 \item Run \LaTeX\ over the file "lualatex-truncate.ins"
125 \item Move the resulting ".sty" file to "TEXMF/tex/lualatex/lualatex-truncate/"
126 \end{enumerate}
127
128 Then, you can compile the \textit{documentation} yourself by executing \\[\smallskipamount]
129 "lualatex lualatex-truncate-doc.dtx" \\
130 "makeindex -s gind.ist lualatex-truncate-doc.idx" \\
131 "makeindex -s gglo.ist -o lualatex-truncate-doc.gls lualatex-truncate-doc.glo" \\
132 "lualatex lualatex-truncate-doc.dtx" \\
133 "lualatex lualatex-truncate-doc.dtx"
134
135 \smallskip
136 or just use the precompiled documentation shipped with the source files. \\
137 In both cases, copy the files "lualatex-truncate-doc.pdf" and "README.md" to \\
138 "TEXMF/doc/lualatex/lualatex-truncate/"
139
140
141 \subsection*{License}
142 \addcontentsline{toc}{subsection}{License}
143 \textcopyright\ 2018 Sebastian Friedl
144
145 \smallskip
146 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.
147
148 \smallskip
149 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.
150
151 \smallskip
152 This work has the LPPL maintenace status \enquote*{maintained}. \\
153 Current maintainer of this work is Sebastian Friedl.
154
155 \medskip
156 This work consists of the following files:
157 \begin{itemize} \itemsep 0pt
158 \item "lualatex-truncate.sty",
159 \item "lualatex-truncate.ins",
160 \item "lualatex-truncate-doc.dtx" and
161 \item the derived file "lualatex-truncate.sty"
162 \end{itemize}
163
164
165
166
167
168 % DOCUMENTATION PART ----------------------------------------------------------------------
169 \clearpage
170 \part{The documentation}
171 \begin{center}
172 \colorbox{red!75!black}{\colorbox{white}{\begin{minipage}{.95\textwidth}
173 \textbf{\color{red!75!black}\large Don't load the \sty{truncate} package in your preamble!!}
174
175 \medskip
176 This task is already done for you by \sty{lualatex-truncate}!
177
178 \smallskip
179 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.
180 \end{minipage}}}
181 \end{center}
182
183
184 \subsection*{Truncating text to a given width%
185 \footnote{This section has been adapted from \sty{truncate}'s documentation: \\
186 \indent\indent\url{http://mirrors.ctan.org/macros/latex/contrib/truncate/truncate.pdf}}}
187 \addcontentsline{toc}{subsection}{Truncating text to a given width}
188
189 \leavevmode%
190 \DescribeOption{\truncate}%
191 The package defines a command "\truncate["\param{marker}"]{"\param{width}"}{"\param{text}"}".
192
193 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.
194 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}").
195
196 \medskip
197 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.
198
199 \medskip
200 Normally, the text won't be truncated in the middle of a word, nor at a space specified with a tie ("~"). For example:
201 \begin{quote}
202 "\truncate{122pt}{This text has been~truncated}"
203 \end{quote}
204 gives
205 \begin{quote}
206 \enquote{\hbox to 122pt {This text has\,\dots\hfill}}
207 \end{quote}
208
209 \medskip
210 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.
211 On the other hand, \opt{breakall} allows truncation at any character. For example:
212 \begin{quote}
213 "\truncate{122pt}{This text has been~truncated}"
214 \end{quote}
215 gives
216 \begin{quote}
217 \begin{tabular}{l@{\quad}l}
218 \enquote{\hbox to 122pt {This text has been trun-\,\dots\hfill}} & (package option \texttt{hyphenate}) \\
219 \enquote{\hbox to 122pt {This text has been trun\,\dots~\hfill}} & (package option \texttt{breakwords}) \\
220 \enquote{\hbox to 122pt {This text has been trunc\,\dots\hfill}} & (package option \texttt{breakall})
221 \end{tabular}
222 \end{quote}
223
224 [All of these options work through (Lua)\TeX's hyphenation mechanism.]
225
226
227 \subsection*{Known limitations}
228 \addcontentsline{toc}{subsection}{Known limitations}
229 \begin{itemize}
230 \item
231 \sty{lualatex-truncate} provides a \textit{wrapper} fixing \hologo{LuaTeX}-related \enquote{glitches} in the \sty{truncate} package.
232 It doesn't (and won't) fix any bugs or \enquote{undocumented features} introduced by the \sty{truncate} package itself.
233 \end{itemize}
234
235
236
237
238
239
240
241
242 % Start determining the checksum from here
243 \StopEventually{%
244 \clearpage
245 \phantomsection
246 \addcontentsline{toc}{part}{Index}%
247 \PrintChanges
248 \setcounter{IndexColumns}{2}
249 \IndexPrologue{\section*{Index}}
250 \PrintIndex}
251
252
253
254 \vspace{3\bigskipamount}
255 \part{The package code}
256 \CodelineNumbered
257 \DocInput{lualatex-truncate.dtx}
258
259
260 \Finale
261 \end{document}
262