You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

doc_macros.tex 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. \makeatletter
  2. \newif\ifinbeamerdoc
  3. \newcommand*\onlyengine[1]{\emph{Only available in \hologo{#1TeX}.}}
  4. \newcommand*\pkg[1]{\textrm{#1}}
  5. \newcommand*\pkgWopt[2]{\opt{[#2]}\penalty500\pkg{#1}}
  6. \newcommand*\cls[1]{\textrm{#1}}
  7. \newcommand*\TikZ{\pkg{Ti\textit{k}Z}}
  8. \newcommand*\env[1]{\texttt{#1}}
  9. \newcommand*\opt[1]{\texttt{#1}}
  10. \newcommand*\cs{\texorpdfstring{\cs@TeXString}{\cs@PDFString}}
  11. \protected\def\cs@TeXString#1%>>=
  12. {%
  13. \texttt{\cs@PDFString{#1}}%
  14. }%=<<
  15. \edef\cs@PDFString#1{\@backslashchar\noexpand\detokenize{#1}}
  16. \protected\def\meta#1{\texttt{$\langle${\itshape\meta@a{#1}}\kern.05em$\rangle$}}
  17. \ExplSyntaxOn
  18. \newcommand\meta@a[1]%>>=
  19. {
  20. \group_begin:
  21. \tl_set:Nn \l_docMRTbundle_tmp_tl { #1 }
  22. \regex_replace_once:nnN { \d+$ } { \c{textsubscript} \cB{ \0 \cE} }
  23. \l_docMRTbundle_tmp_tl
  24. \l_docMRTbundle_tmp_tl
  25. \group_end:
  26. }%=<<
  27. \ExplSyntaxOff
  28. \newcommand*\metaEnclosed[3]{\texttt{#1}\meta{#2}\texttt{#3}}
  29. \newcommand*\marg[1]{\metaEnclosed\{{#1}\}}
  30. \newcommand*\oarg[1]{\metaEnclosed[{#1}]}
  31. \newcommand*\barg[1]{\metaEnclosed({#1})}
  32. \newcommand*\sarg[1]{\metaEnclosed<{#1}>}
  33. \newcommand*\carg[2]{\texttt{(}\meta{#1},\meta{#2}\texttt{)}}
  34. \newcommand*\tfarg{\texttt{\textit{TF}}}
  35. \newcommand*\luaxetex%>>=
  36. {%
  37. \luaxe{}%
  38. }%=<<
  39. \newcommand*\luaxelatex%>>=
  40. {%
  41. \luaxe{La}%
  42. }%=<<
  43. \newcommand*\luaxe[1]%>>=
  44. {%
  45. \@ifstar
  46. {\hologo{Lua#1TeX} and \hologo{Xe#1TeX}}
  47. {\hologo{Lua#1TeX} or \hologo{Xe#1TeX}}%
  48. }%=<<
  49. \ExplSyntaxOn
  50. \int_new:N \g_docMRTbundle_dsctable_lines_int
  51. \int_new:N \l_docMRTbundle_fakeit_level_int
  52. \int_set:Nn \l_docMRTbundle_fakeit_level_int { -\c_one_int }
  53. \dim_new:N \l_docMRTbundle_dscmac_widest_dim
  54. \dim_new:N \l_docMRTbundle_dscmac_indent_dim
  55. \dim_new:N \l_docMRTbundle_fakeit_indent_dim
  56. \tl_new:N \l_docMRTbundle_tmp_tl
  57. \clist_new:N \l_docMRTbundle_fakeit_symbols_clist
  58. \clist_set:Nn \l_docMRTbundle_fakeit_symbols_clist% >>=
  59. {
  60. \textbullet
  61. ,\normalfont\bfseries\textendash
  62. ,\textasteriskcentered
  63. ,\textperiodcentered
  64. }% =<<
  65. \clist_new:N \l_docMRTbundle_bverb_both_points_clist
  66. \clist_new:N \l_docMRTbundle_bverb_pre_points_clist
  67. \clist_new:N \l_docMRTbundle_bverb_post_points_clist
  68. \clist_new:N \l_docMRTbundle_file_post_clist
  69. \clist_new:N \l_docMRTbundle_file_pre_clist
  70. \clist_set:Nx \l_docMRTbundle_file_post_clist%>>=
  71. {
  72. \char_generate:nn { `\_ } { 12 }
  73. }%=<<
  74. \clist_set:Nx \l_docMRTbundle_file_pre_clist%>>=
  75. {
  76. \char_generate:nn { `\. } { 12 }
  77. }%=<<
  78. \clist_set:Nx \l_docMRTbundle_bverb_both_points_clist%>>=
  79. {
  80. =
  81. }%=<<
  82. \clist_set:Nx \l_docMRTbundle_bverb_pre_points_clist%>>=
  83. {
  84. [
  85. ,(
  86. ,\char_generate:nn { `\{ } { 12 }
  87. ,\char_generate:nn { `\\ } { 12 }
  88. }%=<<
  89. \clist_set:Nx \l_docMRTbundle_bverb_post_points_clist%>>=
  90. {
  91. \char_generate:nn { `\} } { 12 }
  92. ,)
  93. ,]
  94. }%=<<
  95. \cs_new:Nn \__docMRTbundle_dscmac_end:%>>=
  96. {
  97. \par
  98. \int_compare:nNnT { \prevgraf } < { \g_docMRTbundle_dsctable_lines_int }
  99. {
  100. \expandafter\dscremaininglines\expandafter
  101. {
  102. \expandafter \numexpr
  103. \int_use:N \g_docMRTbundle_dsctable_lines_int - \prevgraf
  104. \relax
  105. }
  106. }
  107. }%=<<
  108. \MRTafterhyperref%>>=
  109. {
  110. \hbox_set:Nn \l_tmpa_box { \cs{PrependSubsectionsfalse} }
  111. \dim_set:Nn \l_docMRTbundle_dscmac_widest_dim { \box_wd:N \l_tmpa_box }
  112. \dim_set:Nn \l_docMRTbundle_dscmac_indent_dim
  113. { \l_docMRTbundle_dscmac_widest_dim - \marginparwidth }
  114. }%=<<
  115. \cs_new:Nn \docMRTbundle_dscmacTF_table_element:n% >>=
  116. {
  117. \exp_args:Nx \cs{\l_docMRTbundle_macro_name_tl #1}\tfarg\\
  118. }% =<<
  119. \cs_new_protected:Nn \docMRTbundle_dscmacTF_widest:n% >>=
  120. {
  121. \hbox_set:Nn \l_tmpa_box
  122. { \exp_args:Nx \cs{\l_docMRTbundle_macro_name_tl #1}\tfarg }
  123. \dim_compare:nNnT
  124. \l_docMRTbundle_dscmac_widest_dim < { \box_wd:N \l_tmpa_box }
  125. {
  126. \dim_set:Nn \l_docMRTbundle_dscmac_widest_dim
  127. { \box_wd:N \l_tmpa_box }
  128. }
  129. }% =<<
  130. \NewDocumentEnvironment { describemacroTF } { o m O{} }% >>=
  131. {
  132. \par\noindent
  133. \int_gzero:N \g_docMRTbundle_dsctable_lines_int
  134. \hspace*{-\dimexpr\marginparwidth+\marginparsep\relax}
  135. \IfNoValueTF { #1 }
  136. { \seq_set_split:Nnn \l_tmpa_seq { , } { } }
  137. { \seq_set_split:Nnn \l_tmpa_seq { , } { ,#1 } }
  138. \tl_set:Nn \l_docMRTbundle_macro_name_tl { #2 }
  139. \seq_map_function:NN \l_tmpa_seq \docMRTbundle_dscmacTF_widest:n
  140. \begin{minipage}[t][0pt]{\l_docMRTbundle_dscmac_widest_dim}
  141. \raggedleft
  142. \noindent
  143. \begin{tabular}[t]{@{}l@{}}
  144. \toprule
  145. \seq_map_function:NN \l_tmpa_seq \docMRTbundle_dscmacTF_table_element:n
  146. \bottomrule
  147. \end{tabular}
  148. \end{minipage}
  149. \hspace*{\marginparsep}
  150. \begin{minipage}[t]
  151. {
  152. \dimexpr
  153. \textwidth + \marginparwidth - \l_docMRTbundle_dscmac_widest_dim
  154. \relax
  155. }
  156. \vspace*{.5\baselineskip}
  157. \raggedright
  158. \setbox0\hbox{\texttt{\space\space}}
  159. \@hangfrom{Usage:~\hskip\wd0}\hskip-\wd0
  160. \cs{#2}\tfarg\hskip0pt\texttt{#3}\hskip0pt\marg{true}\hskip0pt\marg{false}
  161. \vspace*{.5\baselineskip}
  162. \end{minipage}\\
  163. \hangindent \l_docMRTbundle_dscmac_indent_dim
  164. \noindent
  165. \ignorespaces
  166. }
  167. {\__docMRTbundle_dscmac_end:}% =<<
  168. \cs_new:Nn \docMRTbundle_dscmac_table_element:n% >>=
  169. {
  170. \int_gincr:N \g_docMRTbundle_dsctable_lines_int
  171. \exp_args:Nx \cs{\l_docMRTbundle_macro_name_tl #1}\\
  172. }% =<<
  173. \cs_new:Nn \docMRTbunndle_dscmac_multiple_mac:n% >>=
  174. {
  175. \int_gincr:N \g_docMRTbundle_dsctable_lines_int
  176. \cs { #1 } \\
  177. }% =<<
  178. \cs_new_protected:Nn \docMRTbundle_dscmac_widest:n% >>=
  179. {
  180. \hbox_set:Nn \l_tmpa_box
  181. { \exp_args:Nx \cs{\l_docMRTbundle_macro_name_tl #1} }
  182. \dim_compare:nNnT
  183. \l_docMRTbundle_dscmac_widest_dim < { \box_wd:N \l_tmpa_box }
  184. {
  185. \dim_set:Nn \l_docMRTbundle_dscmac_widest_dim
  186. { \box_wd:N \l_tmpa_box }
  187. }
  188. }% =<<
  189. \NewDocumentEnvironment { describemacro } { o m O{} }% >>=
  190. {
  191. \par\noindent
  192. \int_gzero:N \g_docMRTbundle_dsctable_lines_int
  193. \hspace*{-\dimexpr\marginparwidth+\marginparsep\relax}
  194. \IfNoValueTF { #1 }
  195. { \seq_set_split:Nnn \l_tmpa_seq { , } { } }
  196. { \seq_set_split:Nnn \l_tmpa_seq { , } { ,#1 } }
  197. \tl_if_in:nnTF { #2 } { , }
  198. {
  199. \seq_set_split:Nnn \l_tmpb_seq { , } { #2 }
  200. \tl_clear:N \l_docMRTbundle_macro_name_tl
  201. \seq_map_function:NN \l_tmpb_seq \docMRTbundle_dscmac_widest:n
  202. \tl_set:Nn \l_docMRTbundle_macro_name_tl { \seq_item:Nn \l_tmpb_seq 1 }
  203. }
  204. {
  205. \tl_set:Nn \l_docMRTbundle_macro_name_tl { #2 }
  206. \seq_map_function:NN \l_tmpa_seq \docMRTbundle_dscmac_widest:n
  207. }
  208. \begin{minipage}[t][0pt]{\l_docMRTbundle_dscmac_widest_dim}
  209. \raggedleft
  210. \noindent
  211. \begin{tabular}[t]{@{}l@{}}
  212. \toprule
  213. \tl_if_in:nnTF { #2 } { , }
  214. {
  215. \seq_map_function:NN\l_tmpb_seq \docMRTbunndle_dscmac_multiple_mac:n
  216. }
  217. {
  218. \seq_map_function:NN\l_tmpa_seq \docMRTbundle_dscmac_table_element:n
  219. }
  220. \bottomrule
  221. \end{tabular}
  222. \vspace*{-.5\baselineskip}
  223. \end{minipage}
  224. \hspace*{\marginparsep}
  225. \begin{minipage}[t]
  226. {
  227. \dimexpr
  228. \textwidth + \marginparwidth - \l_docMRTbundle_dscmac_widest_dim
  229. \relax
  230. }
  231. \vspace*{.5\baselineskip}
  232. \raggedright
  233. \setbox0\hbox{\texttt{\space\space}}
  234. \@hangfrom{Usage:~\hskip\wd0}\hskip-\wd0
  235. \exp_args:Nx \cs{\l_docMRTbundle_macro_name_tl}\hskip0pt\texttt{#3}
  236. \vspace*{.5\baselineskip}
  237. \end{minipage}\\
  238. \hangindent \l_docMRTbundle_dscmac_indent_dim
  239. \noindent
  240. \ignorespaces
  241. }
  242. {\__docMRTbundle_dscmac_end:}% =<<
  243. \cs_new:Nn \docMRTbundle_dscenv_table_element:n% >>=
  244. {
  245. \int_gincr:N \g_docMRTbundle_dsctable_lines_int
  246. \exp_args:Nx \env{\l_docMRTbundle_macro_name_tl #1}\\
  247. }% =<<
  248. \cs_new_protected:Nn \docMRTbundle_dscenv_widest:n% >>=
  249. {
  250. \hbox_set:Nn \l_tmpa_box
  251. { \exp_args:Nx \env{\l_docMRTbundle_macro_name_tl #1} }
  252. \dim_compare:nNnT
  253. \l_docMRTbundle_dscmac_widest_dim < { \box_wd:N \l_tmpa_box }
  254. {
  255. \dim_set:Nn \l_docMRTbundle_dscmac_widest_dim
  256. { \box_wd:N \l_tmpa_box }
  257. }
  258. }% =<<
  259. \NewDocumentEnvironment { describeenv } { o m O{} }% >>=
  260. {
  261. \par\noindent
  262. \int_gzero:N \g_docMRTbundle_dsctable_lines_int
  263. \hspace*{-\dimexpr\marginparwidth+\marginparsep\relax}
  264. \IfNoValueTF { #1 }
  265. { \seq_set_split:Nnn \l_tmpa_seq { , } { } }
  266. { \seq_set_split:Nnn \l_tmpa_seq { , } { ,#1 } }
  267. \tl_set:Nn \l_docMRTbundle_macro_name_tl { #2 }
  268. \seq_map_function:NN \l_tmpa_seq \docMRTbundle_dscenv_widest:n
  269. \begin{minipage}[t][0pt]{\l_docMRTbundle_dscmac_widest_dim}
  270. \raggedleft
  271. \noindent
  272. \begin{tabular}[t]{@{}l@{}}
  273. \toprule
  274. \seq_map_function:NN \l_tmpa_seq \docMRTbundle_dscenv_table_element:n
  275. \bottomrule
  276. \end{tabular}
  277. \vspace*{-.5\baselineskip}
  278. \end{minipage}
  279. \hspace*{\marginparsep}
  280. \begin{minipage}[t]
  281. {
  282. \dimexpr
  283. \textwidth + \marginparwidth - \l_docMRTbundle_dscmac_widest_dim
  284. \relax
  285. }
  286. \vspace*{.5\baselineskip}
  287. \raggedright
  288. \setbox0\hbox{\texttt{\space\space}}
  289. \@hangfrom{Usage:~\hskip\wd0}\hskip-\wd0
  290. \cs{begin{#2}}\hskip0pt\texttt{#3~...~}\hskip0pt\cs{end{#2}}
  291. \vspace*{.5\baselineskip}
  292. \end{minipage}\\
  293. \hangindent \l_docMRTbundle_dscmac_indent_dim
  294. \noindent
  295. \ignorespaces
  296. }
  297. {\__docMRTbundle_dscmac_end:}% =<<
  298. \cs_new:Nn \docMRTbundle_dscopt_table_element:n% >>=
  299. {
  300. \int_gincr:N \g_docMRTbundle_dsctable_lines_int
  301. \exp_args:Nx \opt{\l_docMRTbundle_macro_name_tl #1}\\
  302. }% =<<
  303. \cs_new:Nn \docMRTbunndle_dscopt_multiple_mac:n% >>=
  304. {
  305. \int_gincr:N \g_docMRTbundle_dsctable_lines_int
  306. \opt { #1 } \\
  307. }% =<<
  308. \cs_new_protected:Nn \docMRTbundle_dscopt_widest:n% >>=
  309. {
  310. \hbox_set:Nn \l_tmpa_box
  311. { \exp_args:Nx \opt{\l_docMRTbundle_macro_name_tl #1} }
  312. \dim_compare:nNnT
  313. \l_docMRTbundle_dscmac_widest_dim < { \box_wd:N \l_tmpa_box }
  314. {
  315. \dim_set:Nn \l_docMRTbundle_dscmac_widest_dim
  316. { \box_wd:N \l_tmpa_box }
  317. }
  318. }% =<<
  319. \NewDocumentEnvironment { describeopt } { o m o }%>>=
  320. {
  321. \par\noindent
  322. \int_gzero:N \g_docMRTbundle_dsctable_lines_int
  323. \hspace*{-\dimexpr\marginparwidth+\marginparsep\relax}
  324. \IfNoValueTF { #1 }
  325. { \seq_set_split:Nnn \l_tmpa_seq { , } { } }
  326. { \seq_set_split:Nnn \l_tmpa_seq { , } { ,#1 } }
  327. \tl_if_in:nnTF { #2 } { , }
  328. {
  329. \seq_set_split:Nnn \l_tmpb_seq { , } { #2 }
  330. \tl_clear:N \l_docMRTbundle_macro_name_tl
  331. \seq_map_function:NN \l_tmpb_seq \docMRTbundle_dscopt_widest:n
  332. \tl_set:Nn \l_docMRTbundle_macro_name_tl { \seq_item:Nn \l_tmpb_seq 1 }
  333. }
  334. {
  335. \tl_set:Nn \l_docMRTbundle_macro_name_tl { #2 }
  336. \seq_map_function:NN \l_tmpa_seq \docMRTbundle_dscopt_widest:n
  337. }
  338. \begin{minipage}[t][0pt]{\l_docMRTbundle_dscmac_widest_dim}
  339. \raggedleft
  340. \noindent
  341. \begin{tabular}[t]{@{}l@{}}
  342. \toprule
  343. \tl_if_in:nnTF { #2 } { , }
  344. {
  345. \seq_map_function:NN\l_tmpb_seq \docMRTbunndle_dscopt_multiple_mac:n
  346. }
  347. {
  348. \seq_map_function:NN\l_tmpa_seq \docMRTbundle_dscopt_table_element:n
  349. }
  350. \bottomrule
  351. \end{tabular}
  352. \end{minipage}
  353. \hspace*{\marginparsep}
  354. \begin{minipage}[t]
  355. {
  356. \dimexpr
  357. \textwidth + \marginparwidth - \l_docMRTbundle_dscmac_widest_dim
  358. \relax
  359. }
  360. \vspace*{1\baselineskip}
  361. \raggedright
  362. \setbox0\hbox{\texttt{\space\space}}
  363. \@hangfrom{\hskip\wd0}\hskip-\wd0
  364. { \smash { \IfValueTF { #3 } { =~ \texttt{#3} } { --NoArgument-- } } }
  365. \vspace*{.5\baselineskip}
  366. \end{minipage}\\
  367. \hangindent \l_docMRTbundle_dscmac_indent_dim
  368. \noindent
  369. \ignorespaces
  370. }
  371. {
  372. \__docMRTbundle_dscmac_end:
  373. }% =<<
  374. \NewDocumentCommand \dscremaininglines { m }%>>=
  375. {
  376. \vskip
  377. \dimexpr
  378. #1\baselineskip - 1.5\baselineskip + 1.2ex
  379. \relax
  380. }%=<<
  381. \NewDocumentCommand \docIndividualVersions {}%>>=
  382. {
  383. \makeatletter
  384. % If one of the packages is not loaded, the version and date of it are not
  385. % defined. So we have to read the first two lines containing those
  386. % definitions.
  387. \ior_new:N \l_docMRTbundle_unloaded_ior
  388. \clist_map_inline:nn
  389. { MRTbeam.cls, MRTalone.cls, MRTlmscale.sty, MRTcirc.sty }
  390. {
  391. \ior_open:Nn \l_docMRTbundle_unloaded_ior { ##1 }
  392. \ior_get:NN \l_docMRTbundle_unloaded_ior \l_tmpa_tl
  393. \exp_args:NnV \tl_rescan:nn {} \l_tmpa_tl
  394. \ior_get:NN \l_docMRTbundle_unloaded_ior \l_tmpa_tl
  395. \exp_args:NnV \tl_rescan:nn {} \l_tmpa_tl
  396. \ior_close:N \l_docMRTbundle_unloaded_ior
  397. }
  398. \makeatother
  399. \begingroup
  400. \begin{MRTtable}
  401. [
  402. ,col=lcc
  403. ,long
  404. ,caption={Versions~of~Individual~Classes~and~Packages}
  405. ,pre=
  406. \setbox0\hbox{0.0.00}%
  407. \edef\versionlineAUX##1##2%
  408. {
  409. ##1{MRT##2}
  410. \noexpand& \noexpand\csuse{MRT##2@date}
  411. \noexpand& \noexpand\makebox[\the\wd0][l]{\noexpand\csuse{MRT##2@version}}
  412. \noexpand\\
  413. }
  414. \protected\def\versionline{\MRTutil@Oarg{\pkg}\versionlineAUX}
  415. ]
  416. Class/Package & Date & Version\\
  417. \versionline[\cls]{thesis}
  418. \versionline[\cls]{beam}
  419. \versionline[\cls]{alone}
  420. \versionline{tab}
  421. \versionline{fonts}
  422. \versionline{if}
  423. \versionline{circ}
  424. \versionline{wuline}
  425. \versionline{sfacc}
  426. \versionline{lmscale}
  427. \versionline{util}
  428. \end{MRTtable}
  429. \endgroup
  430. }%=<<
  431. \NewDocumentCommand \bverb { v }%>>=
  432. {
  433. \group_begin:
  434. \tl_set:Nn \l_docMRTbundle_tmp_tl { #1 }
  435. \clist_map_inline:Nn \l_docMRTbundle_bverb_pre_points_clist
  436. { \tl_replace_all:Nnn \l_docMRTbundle_tmp_tl { ##1 } { \hskip0pt ##1 } }
  437. \clist_map_inline:Nn \l_docMRTbundle_bverb_post_points_clist
  438. { \tl_replace_all:Nnn \l_docMRTbundle_tmp_tl { ##1 } { ##1 \hskip0pt } }
  439. \clist_map_inline:Nn \l_docMRTbundle_bverb_both_points_clist
  440. {
  441. \tl_replace_all:Nnn \l_docMRTbundle_tmp_tl
  442. { ##1 } { \hskip0pt ##1 \hskip0pt }
  443. }
  444. \verbatim@font
  445. \@noligs
  446. \frenchspacing
  447. \l_docMRTbundle_tmp_tl
  448. \group_end:
  449. }%=<<
  450. \NewDocumentCommand \file { v }%>>=
  451. {
  452. \group_begin:
  453. \tl_set:Nn \l_docMRTbundle_tmp_tl { #1 }
  454. \clist_map_inline:Nn \l_docMRTbundle_file_pre_clist
  455. {
  456. \tl_replace_all:Nnn \l_docMRTbundle_tmp_tl { ##1 } { \textrm{\-} ##1 }
  457. }
  458. \clist_map_inline:Nn \l_docMRTbundle_file_post_clist
  459. {
  460. \tl_replace_all:Nnn \l_docMRTbundle_tmp_tl { ##1 } { ##1 \textrm{\-} }
  461. }
  462. \texttt { \l_docMRTbundle_tmp_tl }
  463. \group_end:
  464. }%=<<
  465. \NewDocumentEnvironment { fakeitemize } {}%>>=
  466. {% begin >>=
  467. \dim_set:Nn \l_docMRTbundle_fakeit_indent_dim { 2em }
  468. \int_incr:N \l_docMRTbundle_fakeit_level_int
  469. \int_compare:nNnT { \l_docMRTbundle_fakeit_level_int } = { \c_zero_int }
  470. { \null\\[\dimexpr.9ex-\baselineskip\relax] }
  471. \cs_set_protected:Npn \item
  472. {
  473. \null\\[.1ex]
  474. \null
  475. \hskip\l_docMRTbundle_fakeit_level_int\l_docMRTbundle_fakeit_indent_dim
  476. \makebox[2em][c]
  477. {
  478. \clist_item:Nn \l_docMRTbundle_fakeit_symbols_clist
  479. { \l_docMRTbundle_fakeit_level_int + \c_one_int }
  480. }
  481. }
  482. }%=<<
  483. {% end >>=
  484. \int_compare:nNnTF { \l_docMRTbundle_fakeit_level_int } = { \c_zero_int }
  485. { \null\\[1ex] }
  486. { \null\\[\dimexpr.1ex-\baselineskip\relax] }
  487. }%=<<
  488. %=<<
  489. \NewDocumentCommand \dangerzone { O{1} }%>>=
  490. {
  491. \scalebox{#1}
  492. {
  493. \makebox[1em][c]
  494. {
  495. \makebox[0pt][c]{\raisebox{.17ex}{\scalebox{.4}{\kern-.11ex!}}}
  496. \makebox[0pt][c]{\color{red}$\bigtriangleup$}
  497. }
  498. }
  499. }%=<<
  500. \NewDocumentCommand \dangerzoneAlt { O{1} }%>>=
  501. { % requires installed fourier package
  502. \group_begin:
  503. \scalebox{#1}
  504. {
  505. \fontencoding{U}
  506. \fontfamily{futs}
  507. \selectfont
  508. \char 66
  509. }
  510. \group_end:
  511. }%=<<
  512. \NewDocumentCommand \dangermargin { s O{\Huge} D(){1} }%>>=
  513. {
  514. \group_begin:
  515. \IfBooleanT { #1 } { \reversemarginpar }
  516. \marginnote
  517. {
  518. #2
  519. \dangerzone[#3]
  520. }
  521. \group_end:
  522. }%=<<
  523. \NewDocumentCommand \dangerleft { O{\Huge} D(){1} }%>>=
  524. {
  525. \leavevmode
  526. \llap { \smash { #1 \dangerzone[#2] \hskip \marginparsep } }
  527. \ignorespaces
  528. }%=<<
  529. \NewExpandableDocumentCommand \easysout {}%>>=
  530. {
  531. \texorpdfstring{\easysout@}{\@firstofone}
  532. }%=<<
  533. \NewDocumentCommand \easysout@ {}%>>=
  534. {
  535. \bgroup
  536. \markoverwith { \rule [.4ex ] { .1ex } { .15ex } }
  537. \ULon
  538. }%=<<
  539. \NewDocumentCommand \plannedsection { O{} o m }%>>=
  540. {
  541. \use:c { #1section }
  542. [ \easysout { \IfValueTF { #2 } { #2 } { #3 } } \PlannedSecLabel ]
  543. { #3 }
  544. \leavevmode
  545. \dangermargin*
  546. \NotImplementedMessage{#1}
  547. }%=<<
  548. \NewExpandableDocumentCommand \PlannedSecLabel {}%>>=
  549. {
  550. \texorpdfstring
  551. { \ \ \textsc { [Planned] } }
  552. { ~[Planned] }
  553. }%=<<
  554. \NewDocumentCommand \Seq {}%>>=
  555. {
  556. \mbox{}
  557. \spacefactor100\relax
  558. \space
  559. =
  560. \spacefactor100\relax
  561. \space
  562. }%=<<
  563. \NewDocumentEnvironment { incompatibilities } { O{} m o }%>>=
  564. {%>>=
  565. \use:c { #1 section } { #2 } \IfValueT { #3 } { \label { #3 } }
  566. \hbox_set:Nn \l_tmpa_box { v00.00.00 }
  567. \hbox_set:Nn \l_tmpb_box { Version }
  568. \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > { \box_wd:N \l_tmpb_box }
  569. { \box_set_eq:NN \l_tmpb_box \l_tmpa_box }
  570. \hbox_set:Nn \l_tmpa_box { 0000-00-00 }
  571. \dim_set:Nn \l_tmpa_dim
  572. {
  573. \linewidth - \box_wd:N \l_tmpa_box - \box_wd:N \l_tmpb_box - 7\tabcolsep
  574. - .5\linewidth
  575. }
  576. \begin{MRTtable}
  577. [
  578. ,long
  579. ,caption=
  580. Downwards~Incompatibilities~in~#2~introduced~by~Date~and~Version
  581. ,col=
  582. W { l } { \box_wd:N \l_tmpa_box }
  583. W { c } { \box_wd:N \l_tmpb_box }
  584. >{ \raggedright \setstretch { 1 } } p { \l_tmpa_dim }
  585. >{ \setstretch { 1 } } p { \dim_eval:n { .5\linewidth - \tabcolsep } }
  586. ]
  587. Date & Version & Affected & Description \\
  588. }%=<<
  589. { \end { MRTtable } }%=<<
  590. \cs_new_protected:Npx \__docMRTbundle_replace_verb_newline:Nn #1 #2%>>=
  591. {
  592. \tl_replace_all:Nnn #1
  593. { \char_generate:nn { 13 } { 12 } }
  594. { #2 }
  595. }%=<<
  596. \cs_new_protected:Npx \__docMRTbundle_replace_verb_newline_newline:Nn #1 #2%>>=
  597. {
  598. \tl_replace_all:Nnn #1
  599. { \char_generate:nn { 13 } { 12 } \char_generate:nn { 13 } { 12 } }
  600. { #2 }
  601. }%=<<
  602. \tl_new:N \l__docMRTbundle_doandprint_tl
  603. \cs_set_eq:NN \__docMRTbundle_everyeof:w \tex_everyeof:D
  604. \cs_set_eq:NN \__docMRTbundle_scantokens:w \tex_scantokens:D
  605. \NewDocumentCommand \DoAndPrint { +v }%>>=
  606. {
  607. \tl_set:Nn \l__docMRTbundle_doandprint_tl { #1 }
  608. \__docMRTbundle_replace_verb_newline_newline:Nn
  609. \l__docMRTbundle_doandprint_tl { \par }
  610. \__docMRTbundle_replace_verb_newline:Nn
  611. \l__docMRTbundle_doandprint_tl { ~ }
  612. \group_begin:
  613. \__docMRTbundle_everyeof:w { \exp_not:N }
  614. \exp_args:NNNo
  615. \exp_after:wN
  616. \group_end:
  617. \__docMRTbundle_scantokens:w { \l__docMRTbundle_doandprint_tl }
  618. \tl_set:Nn \l__docMRTbundle_doandprint_tl { #1 }
  619. \__docMRTbundle_replace_verb_newline:Nn
  620. \l__docMRTbundle_doandprint_tl { \\\mbox{} }
  621. \group_begin:
  622. \trivlist\item\relax
  623. \leftskip\@totalleftmargin
  624. \rightskip\z@skip
  625. \parindent\z@
  626. \parfillskip\@flushglue
  627. \parskip\z@skip
  628. \verbatim@font
  629. \frenchspacing
  630. \l__docMRTbundle_doandprint_tl
  631. \endtrivlist
  632. \group_end:
  633. }%=<<
  634. \ExplSyntaxOff
  635. \NewDocumentCommand \NotImplementedMessage { m +O{} }%>>=
  636. {%
  637. \emph{Not Implemented yet!}
  638. Everything in this #1section is mostly inside of the documentation to remind
  639. me that I still have to code this and to give me a specification what has to
  640. be inside the final version. #2\par
  641. }%=<<
  642. %Shamelessly copied from doc.sty
  643. \def\MakeShortVerb{%>>=
  644. \@ifstar
  645. {\def\@shortvrbdef{\verb*}\@MakeShortVerb}%
  646. {\def\@shortvrbdef{\bverb}\@MakeShortVerb}}%=<<
  647. \def\@MakeShortVerb#1{%>>=
  648. \expandafter\ifx\csname cc\string#1\endcsname\relax
  649. \@shortvrbinfo{Made }{#1}\@shortvrbdef
  650. \add@special{#1}%
  651. \expandafter
  652. \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
  653. \begingroup
  654. \catcode`\~\active \lccode`\~`#1%
  655. \lowercase{%
  656. \global\expandafter\let
  657. \csname ac\string#1\endcsname~%
  658. \expandafter\gdef\expandafter~\expandafter{\@shortvrbdef~}}%
  659. \endgroup
  660. \global\catcode`#1\active
  661. \else
  662. \@shortvrbinfo\@empty{#1 already}{\@empty\verb(*)}%
  663. \fi}%=<<
  664. \def\DeleteShortVerb#1{%>>=
  665. \expandafter\ifx\csname cc\string#1\endcsname\relax
  666. \@shortvrbinfo\@empty{#1 not}{\@empty\verb(*)}%
  667. \else
  668. \@shortvrbinfo{Deleted }{#1 as}{\@empty\verb(*)}%
  669. \rem@special{#1}%
  670. \global\catcode`#1\csname cc\string#1\endcsname
  671. \global \expandafter\let \csname cc\string#1\endcsname \relax
  672. \ifnum\catcode`#1=\active
  673. \begingroup
  674. \catcode`\~\active \lccode`\~`#1%
  675. \lowercase{%
  676. \global\expandafter\let\expandafter~%
  677. \csname ac\string#1\endcsname}%
  678. \endgroup \fi \fi}%=<<
  679. \def\@shortvrbinfo#1#2#3{%>>=
  680. \PackageInfo{doc}{%
  681. #1\expandafter\@gobble\string#2 a short reference
  682. for \expandafter\string#3}}%=<<
  683. \def\add@special#1{%>>=
  684. \rem@special{#1}%
  685. \expandafter\gdef\expandafter\dospecials\expandafter
  686. {\dospecials \do #1}%
  687. \expandafter\gdef\expandafter\@sanitize\expandafter
  688. {\@sanitize \@makeother #1}}%=<<
  689. \def\rem@special#1{%>>=
  690. \def\do##1{%
  691. \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
  692. \xdef\dospecials{\dospecials}%
  693. \begingroup
  694. \def\@makeother##1{%
  695. \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
  696. \xdef\@sanitize{\@sanitize}%
  697. \endgroup}%=<<
  698. \AtBeginDocument{\MakeShortVerb \|}
  699. \AtEndDocument{\DeleteShortVerb \|}
  700. \makeatother
  701. % vim: ft=tex fdm=marker fmr=>>=,=<< sw=2 ts=2 tw=80