diff options
-rw-r--r-- | ekdosis.dtx | 68 |
1 files changed, 51 insertions, 17 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index 461eaac..3bb4f9c 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -131,6 +131,7 @@ Running "make install" installs the files in the local TeX tree. | |||
131 | %<*driver> | 131 | %<*driver> |
132 | \documentclass{ltxdoc} | 132 | \documentclass{ltxdoc} |
133 | \usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} | 133 | \usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} |
134 | \usepackage{hologo} | ||
134 | \usepackage{hyperxmp} | 135 | \usepackage{hyperxmp} |
135 | \usepackage{uri} | 136 | \usepackage{uri} |
136 | \usepackage[numbered]{hypdoc} | 137 | \usepackage[numbered]{hypdoc} |
@@ -148,8 +149,9 @@ Running "make install" installs the files in the local TeX tree. | |||
148 | pdfmetalang={en-US}, pdftype={Text}, pdfkeywords={Arabic language, | 149 | pdfmetalang={en-US}, pdftype={Text}, pdfkeywords={Arabic language, |
149 | arabtex, luatex}} | 150 | arabtex, luatex}} |
150 | \usepackage[lot]{multitoc} | 151 | \usepackage[lot]{multitoc} |
151 | \usepackage{\jobname} | 152 | %\usepackage{\jobname} |
152 | \usepackage{fontspec,luatextra} | 153 | \usepackage{ekdosis} |
154 | \usepackage{fontspec} | ||
153 | \setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] | 155 | \setmainfont{Old Standard}[RawFeature={+ss05;+ss06}] |
154 | \usepackage{newunicodechar} | 156 | \usepackage{newunicodechar} |
155 | \newunicodechar{ǧ}{ǧ} % Old Standard does not include ǧ/Ǧ | 157 | \newunicodechar{ǧ}{ǧ} % Old Standard does not include ǧ/Ǧ |
@@ -162,7 +164,6 @@ Running "make install" installs the files in the local TeX tree. | |||
162 | numberblanklines=false, numbersep=3pt, firstnumber=last} | 164 | numberblanklines=false, numbersep=3pt, firstnumber=last} |
163 | \renewcommand{\theFancyVerbLine}{\rmfamily\smaller\arabic{FancyVerbLine}} | 165 | \renewcommand{\theFancyVerbLine}{\rmfamily\smaller\arabic{FancyVerbLine}} |
164 | \usepackage[contents]{colordoc} | 166 | \usepackage[contents]{colordoc} |
165 | \usepackage{authblk} | ||
166 | \newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} | 167 | \newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}} |
167 | \usepackage{tikz} | 168 | \usepackage{tikz} |
168 | \usepackage[breakable, skins, xparse, minted]{tcolorbox} | 169 | \usepackage[breakable, skins, xparse, minted]{tcolorbox} |
@@ -271,7 +272,7 @@ Running "make install" installs the files in the local TeX tree. | |||
271 | % \begin{macrocode} | 272 | % \begin{macrocode} |
272 | \RequirePackage{ifluatex} | 273 | \RequirePackage{ifluatex} |
273 | % \end{macrocode} | 274 | % \end{macrocode} |
274 | % \package{ekdosis} requires \LuaLaTeX\ of course. Issue a warning | 275 | % \package{ekdosis} requires \hologo{LuaLaTeX} of course. Issue a warning |
275 | % if the document is processed with another engine. | 276 | % if the document is processed with another engine. |
276 | % \begin{macrocode} | 277 | % \begin{macrocode} |
277 | \ifluatex\else | 278 | \ifluatex\else |
@@ -284,15 +285,35 @@ Running "make install" installs the files in the local TeX tree. | |||
284 | % \end{macrocode} | 285 | % \end{macrocode} |
285 | % Packages that are required by \package{ekdosis}: | 286 | % Packages that are required by \package{ekdosis}: |
286 | % \begin{macrocode} | 287 | % \begin{macrocode} |
288 | \RequirePackage{xkeyval} | ||
289 | \newif\if@parnotesroman | ||
290 | \newif\if@pkg@parnotes | ||
291 | \define@choicekey+{ekdosis.sty}{parnotes}{true, false, roman}[true]{% | ||
292 | \edef\@pntrue{true}\edef\@pnfalse{false}\edef\@pnrm{roman} | ||
293 | \edef\@tempa{#1} | ||
294 | \ifx\@tempa\@pnfalse | ||
295 | \else | ||
296 | \ifx\@tempa\@pntrue\@pkg@parnotestrue | ||
297 | \else | ||
298 | \ifx\@tempa\@pnrm | ||
299 | \@pkg@parnotestrue\@parnotesromantrue | ||
300 | \fi\fi\fi | ||
301 | }{\PackageWarning{ekdosis}{parnotes: erroneous input (ignored)}} | ||
302 | \ExecuteOptionsX{} | ||
303 | \ProcessOptionsX\relax | ||
287 | \RequirePackage{luacode} | 304 | \RequirePackage{luacode} |
288 | \RequirePackage{xparse} | 305 | \RequirePackage{xparse} |
289 | \RequirePackage{etoolbox} | 306 | \RequirePackage{etoolbox} |
290 | \RequirePackage{lineno} | 307 | \RequirePackage[addpageno]{lineno} |
291 | \PassOptionsToPackage{addpageno}{lineno} | ||
292 | \RequirePackage{vplref} | 308 | \RequirePackage{vplref} |
293 | \RequirePackage{keyfloat} | 309 | \RequirePackage{keyfloat} |
294 | \RequirePackage{afterpage} | 310 | \RequirePackage{afterpage} |
295 | \RequirePackage{refcount} | 311 | \RequirePackage{refcount} |
312 | \RequirePackage{calc} | ||
313 | \RequirePackage{zref-savepos} | ||
314 | \if@pkg@parnotes | ||
315 | \RequirePackage{parnotes} | ||
316 | \fi | ||
296 | % \end{macrocode} | 317 | % \end{macrocode} |
297 | % Here begins the real work: load |ekdosis.lua|: | 318 | % Here begins the real work: load |ekdosis.lua|: |
298 | % \begin{macrocode} | 319 | % \begin{macrocode} |
@@ -310,16 +331,15 @@ Running "make install" installs the files in the local TeX tree. | |||
310 | \NewDocumentCommand{\append}{+m}{% | 331 | \NewDocumentCommand{\append}{+m}{% |
311 | \ifbool{ekdstate}{% | 332 | \ifbool{ekdstate}{% |
312 | \label{ekd:\theekd@lab}% | 333 | \label{ekd:\theekd@lab}% |
313 | \luadirect{appin(\luastring{<\getpagerefnumber{ekd:\theekd@lab}>}, "no")}% | 334 | \luadirect{appin(\luastring{<\getpagerefnumber{ekd:\theekd@lab}>}, |
335 | "no")}% | ||
314 | \luadirect{appin(\luastringN{#1}, "no")}% | 336 | \luadirect{appin(\luastringN{#1}, "no")}% |
315 | \luadirect{appin(\luastring{</\getpagerefnumber{ekd:\theekd@lab}>}, "yes")}% | 337 | \luadirect{appin(\luastring{</\getpagerefnumber{ekd:\theekd@lab}>}, |
338 | "yes")}% | ||
316 | \stepcounter{ekd@lab}}{}} | 339 | \stepcounter{ekd@lab}}{}} |
317 | \NewDocumentCommand{\obappend}{+m}% | 340 | \NewDocumentCommand{\obappend}{+m}% |
318 | {\luadirect{tex.sprint(mdvappend(\luastringN{#1}))}} | 341 | {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringN{#1}))}} |
319 | \NewDocumentCommand{\app}{+m}{#1} | 342 | \NewDocumentCommand{\app}{+m}{#1} |
320 | % \NewDocumentCommand{\lem}{o +m}{% | ||
321 | % \IfNoValueTF{#1}{#2\obappend{#2:}}{#2\obappend{#2 #1:}}% | ||
322 | % } | ||
323 | \NewDocumentCommand{\lem}{o +m}{% | 343 | \NewDocumentCommand{\lem}{o +m}{% |
324 | \ifbool{al@rlmode}% | 344 | \ifbool{al@rlmode}% |
325 | {\IfNoValueTF{#1}% | 345 | {\IfNoValueTF{#1}% |
@@ -335,17 +355,28 @@ Running "make install" installs the files in the local TeX tree. | |||
335 | {\IfNoValueTF{#1}{\append{#2}}{\append{#2 #1}}}% | 355 | {\IfNoValueTF{#1}{\append{#2}}{\append{#2 #1}}}% |
336 | } | 356 | } |
337 | \NewDocumentCommand{\note}{s +m}{% | 357 | \NewDocumentCommand{\note}{s +m}{% |
338 | \IfBooleanTF{#1}{\append{\footnote{#2}}}{\append{#2}}% | 358 | \IfBooleanTF{#1}{% |
359 | \if@pkg@parnotes\append{\parnote{#2}} | ||
360 | \else\append{\footnote{#2}}\fi}{\append{#2}}% | ||
339 | } | 361 | } |
340 | \NewDocumentCommand{\apparatus}{}{\luadirect{tex.sprint(appout())}} | 362 | \NewDocumentCommand{\apparatus}{}{\luadirect{tex.sprint(appout())}} |
341 | \NewDocumentCommand{\testapparatus}{}{\luadirect{tex.sprint(testapparatus())}} | 363 | \NewDocumentCommand{\testapparatus}{}{% |
364 | \luadirect{tex.sprint(testapparatus())}} | ||
342 | \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} | 365 | \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext} |
343 | \def\add@@apparatus{% | 366 | \def\add@@apparatus{% |
344 | \testapparatus% | 367 | \testapparatus% |
345 | \ifbool{isapp}{% | 368 | \ifbool{isapp}{% |
346 | % \blfootnote{\apparatus}% | 369 | % \blfootnote{\apparatus}% |
347 | \keyparbox[b]{}{\rule{5cm}{0.5pt}\\ | 370 | \if@pkg@parnotes\parnotes\else\fi% |
348 | \footnotesize\apparatus}% | 371 | \keyparbox[b!]{}{% |
372 | \rule{5cm}{0.5pt}\\ | ||
373 | \if@pkg@parnotes% | ||
374 | \if@parnotesroman% | ||
375 | \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi% | ||
376 | \parnoteclear\begin{autopn}\else\fi% | ||
377 | \footnotesize\apparatus% | ||
378 | \if@pkg@parnotes\end{autopn}\parnotereset\else\fi% | ||
379 | }% | ||
349 | }{}} | 380 | }{}} |
350 | \def\add@apparatus{% | 381 | \def\add@apparatus{% |
351 | \add@@apparatus% | 382 | \add@@apparatus% |
@@ -368,6 +399,9 @@ Running "make install" installs the files in the local TeX tree. | |||
368 | %<*lua> | 399 | %<*lua> |
369 | % \fi | 400 | % \fi |
370 | % \begin{ekdlua} | 401 | % \begin{ekdlua} |
402 | |||
403 | ekdosis = {} | ||
404 | |||
371 | function closestream() | 405 | function closestream() |
372 | os.remove(tex.jobname..".ekd") | 406 | os.remove(tex.jobname..".ekd") |
373 | os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") | 407 | os.rename(tex.jobname.."_tmp.ekd", tex.jobname..".ekd") |
@@ -428,7 +462,7 @@ end | |||
428 | md5items = {} | 462 | md5items = {} |
429 | local salt = 0 | 463 | local salt = 0 |
430 | 464 | ||
431 | function mdvappend(str) | 465 | ekdosis.mdvappend = function(str) |
432 | i = md5.sumhexa(str) | 466 | i = md5.sumhexa(str) |
433 | if not isintable(md5items, i) then | 467 | if not isintable(md5items, i) then |
434 | table.insert(md5items, i) | 468 | table.insert(md5items, i) |