diff options
Diffstat (limited to 'macros')
45 files changed, 1633 insertions, 790 deletions
diff --git a/macros/generic/markdown/CHANGES.md b/macros/generic/markdown/CHANGES.md index 48d2d7066d..614cef6912 100644 --- a/macros/generic/markdown/CHANGES.md +++ b/macros/generic/markdown/CHANGES.md @@ -2,6 +2,41 @@ ## 3.5.0 +## 3.4.3 + +Fixes: + +- Remove trailing paragraph/interblock separators in right-open slice + intervals. (#408, #419) +- Do not misinterpret bracketed e-mails as citations. (#424, #426, + sponsored by @istqborg) +- Comply with CommonMark 0.31.2. (#416, 40b516ee, de8d137d, #432, + contributed by @lostenderman) +- Do not end a paragraph before a `:::` in fenced divs. + (#407, lostenderman/markdown#157, #427, #428, lostenderman/markdown#158, + #431, contributed by @lostenderman) + +Documentation: + +- Add slides from the defense of projects MUNI/33/1654/2022 and + MUNI/33/1658/2022 to `README.md`. (49f01ccf) +- Remove `<mroot>` from MathML in the user manual. (#420, #422, + contributed by @quark67) + +Contributed Software: + +- Make the documentation of contributions more detailed. (3f928162) + +Docker: + +- Add support for TeX Live 2024. + (#411, bafbb164, #413, 04957eee, 16000aa4, #425, 9549a5d8, 8f8e1315, + 844beafc, cf592003) + +Continuous Integration: + +- Style-check tabs and trailing spaces in `markdown.dtx`. (a0c941ca) + ## 3.4.2 (2024-03-09) Fixes: @@ -119,7 +154,7 @@ Fixes: - Remove the `options.cacheDir` directory if it is empty after conversion. (5cfcea6) - Allow tables inside lists. (#368, #371, contributed by @lostenderman, - sponsored by ISTQB) + sponsored by @istqborg) - Check that shell access is unrestricted before attempting shell escape. (#365, witiko/lt3luabridge#22, latex3/latex3#1339, #372) @@ -152,7 +187,7 @@ Development: Fixes: - Make the `import` LaTeX option correctly handle recursive imports. - (68c7a2f5, danopolan/istqb_latex#87) + (68c7a2f5, istqborg/istqb_shared_documents#87) - Support attributes on multi-line setext headings. (#315, #355, #356, contributed by @lostenderman) - Correctly process the combination of Lua options `fancyLists` and @@ -160,8 +195,8 @@ Fixes: - Properly parse emphasis at line endings in headings. (#358, #360, contributed by @lostenderman) - Fix fancy lists that use roman numerals as markers. - (danopolan/istqb_latex#87, #359, #364, - contributed by @lostenderman, sponsored by ISTQB) + (istqborg/istqb_shared_documents#87, #359, #364, + contributed by @lostenderman, sponsored by @istqborg) Documentation: @@ -232,7 +267,7 @@ Documentation: Fixes: - Correctly parse paragraphs with trailing spaces. - (danopolan/istqb_latex#77, #345, #347) + (istqborg/istqb_shared_documents#77, #345, #347) ## 3.0.0 (2023-08-25) diff --git a/macros/generic/markdown/README.md b/macros/generic/markdown/README.md index 5a87521f0f..76ad39d740 100644 --- a/macros/generic/markdown/README.md +++ b/macros/generic/markdown/README.md @@ -204,9 +204,10 @@ For further information, consult one of the following: 6. Talks: - [Five Years of Markdown in LaTeX: What, Why, How, and Whereto][pv212-fall2020] (in Czech), - [Markdown 2.10.0: LaTeX Themes & Snippets, Two Flavors of Comments, and LuaMetaTeX][tb131-video] ([slides][tb131-slides]), - - [A Self-Publisher's Take on Markdown and TeX][tb134-01-video] ([slides][tb134-01-slides]), and - - [A Gentle Introduction to Markdown for Writers][tb134-02-video] ([slides][tb134-02-slides], [example][tb134-02-example]), and - - [Markdown 3: What's New, What's Next?][tb137-video] ([slides][tb137-slides]). + - [A Self-Publisher's Take on Markdown and TeX][tb134-01-video] ([slides][tb134-01-slides]), + - [A Gentle Introduction to Markdown for Writers][tb134-02-video] ([slides][tb134-02-slides], [example][tb134-02-example]), + - [Markdown 3: What's New, What's Next?][tb137-video] ([slides][tb137-slides]), and + - An Implementation of the CommonMark Standard and new Syntax Extensions to the Markdown Package for TeX ([slides][gencur-defense-slides]). 7. Theses: - [Generic TeX Writer for the Pandoc Document Converter][thesis-umhg5] - [An implementation of the CommonMark standard into the Markdown package for TeX][thesis-r7z7l] @@ -248,6 +249,8 @@ For further information, consult one of the following: [pv212-fall2020]: https://is.muni.cz/elearning/io/?qurl=%2Fel%2Ffi%2Fpodzim2020%2FPV212%2Findex.qwarp;prejit=5595952 + [gencur-defense-slides]: https://docs.google.com/presentation/d/e/2PACX-1vRbgJZ-UJlj5WMOjgWnq0BeNWKdA9ZhFqCKajhCjXtv3OarSKmojl5-X8tDp1ivnKtujuyEDmD2z_Z0/pub "An Implementation of the CommonMark Standard and new Syntax Extensions to the Markdown Package for TeX" + [install]: https://mirrors.ctan.org/macros/generic/markdown/markdown.html#installation "Markdown Package User Manual" [liantze]: http://liantze.penguinattack.org/ "Rants from the Lab" [overleaf]: https://www.overleaf.com/ "Overleaf: Real-time Collaborative Writing and Publishing Tools with Integrated PDF Preview" @@ -271,16 +274,17 @@ Acknowledgements | [<img width="150" src="https://www.fi.muni.cz/images/fi-logo.png">][fimu] | I gratefully acknowledge the funding from the [Faculty of Informatics][fimu] at the [Masaryk University][mu] in Brno, Czech Republic, for the development of the Markdown package in projects [MUNI/33/12/2015][], [MUNI/33/1784/2020][], [MUNI/33/0776/2021][], [MUNI/33/1654/2022][], and [MUNI/33/1658/2022][]. | | [<img width="150" src="https://cdn.overleaf.com/img/ol-brand/overleaf_og_logo.png">][overleaf] | Extensive user documentation for the Markdown package was kindly written by [Lian Tze Lim][liantze] and published by [Overleaf][]. | | [<img width="150" src="https://pbs.twimg.com/profile_images/1004769879319334912/6Bh1UthD.jpg">][omedym] | Support for content slicing (Lua options [`shiftHeadings`][option-shift-headings] and [`slice`][option-slice]) and pipe tables (Lua options [`pipeTables`][option-pipe-tables] and [`tableCaptions`][option-table-captions]) was graciously sponsored by [David Vins][dvins] and [Omedym][]. | -| [<img width="150" src="https://www.istqb.org/static/istqb-logo-1b043e800a580724ad223567f9ea57c0.png">][istqb] | Fixes for issues [#359][issue-359] and [#368][issue-368] were graciously sponsored by the [International Software Testing Qualifications Board (ISTQB)][istqb]. | +| [<img width="150" src="https://www.istqb.org/static/istqb-logo-1b043e800a580724ad223567f9ea57c0.png">][istqb] | Fixes for issues [#359][issue-359], [#368][issue-368], and [#424][issue-424] were graciously sponsored by the [International Software Testing Qualifications Board (ISTQB)][istqb]. | [dvins]: https://github.com/dvins "David Vins" [fimu]: https://www.fi.muni.cz/index.html.en "Faculty of Informatics, Masaryk University" - [ISTQB]: https://www.istqb.org/ "International Software Testing Qualifications Board" + [ISTQB]: https://github.com/istqborg "ISTQB.ORG: Official ISTQBยฎ GitHub account" [mu]: https://www.muni.cz/en "Masaryk University" [Omedym]: https://www.omedym.com/ "Omedym" [issue-359]: https://github.com/witiko/markdown/issues/359 "First item of a fancy list forms a separate list" [issue-368]: https://github.com/witiko/markdown/issues/368 "Tables nested in list items have empty lines" + [issue-424]: https://github.com/witiko/markdown/issues/424 "E-mail addresses are incorrectly interpreted as bracketed citations" [option-pipe-tables]: https://mirrors.ctan.org/macros/generic/markdown/markdown.html#pipe-tables "Markdown Package User Manual" [option-shift-headings]: https://mirrors.ctan.org/macros/generic/markdown/markdown.html#option-shiftheadings "Markdown Package User Manual" diff --git a/macros/generic/markdown/VERSION b/macros/generic/markdown/VERSION index 7fba28f70e..d13fdfa34f 100644 --- a/macros/generic/markdown/VERSION +++ b/macros/generic/markdown/VERSION @@ -1 +1 @@ -3.4.2-0-ga45cf0ed (2024-03-09) +3.4.3-0-ge2c6be1a (2024-04-04) diff --git a/macros/generic/markdown/markdown.dtx b/macros/generic/markdown/markdown.dtx index 5ce5a6496e..dd4c7367fb 100644 --- a/macros/generic/markdown/markdown.dtx +++ b/macros/generic/markdown/markdown.dtx @@ -104,7 +104,13 @@ \newunicodechar{โ}{\markdownRendererTickedBox} \newunicodechar{โ}{\markdownRendererHalfTickedBox} \newunicodechar{โ}{\markdownRendererUntickedBox} -\newunicodechar{๐}{;-)} +\usepackage{emoji} +\makeatletter +\@ifpackagelater{emoji}{2020/03/16}{ + \newunicodechar{๐}{\emoji{winking-face}} +}{ + \newunicodechar{๐}{;-)} +} \makeatother % Set up the catcodes. @@ -1881,7 +1887,7 @@ following text: > \$\\sqrt{-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -1924,7 +1930,7 @@ following text: > \$\\sqrt{-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -1977,7 +1983,7 @@ following text: > \$\\sqrt{-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -5563,15 +5569,15 @@ A PDF document named `document.pdf` should be produced and contain the following text: > Term 1 -> +> > : Definition 1 -> +> > Term 2 with *inline markup* -> +> > : Definition 2 -> +> > { some code, part of Definition 2 } -> +> > Third paragraph of definition 2. ##### \Hologo{ConTeXt} Example {.unnumbered} @@ -5605,15 +5611,15 @@ A PDF document named `document.pdf` should be produced and contain the following text: > Term 1 -> +> > : Definition 1 -> +> > Term 2 with *inline markup* -> +> > : Definition 2 -> +> > { some code, part of Definition 2 } -> +> > Third paragraph of definition 2. %</manual-options> @@ -7157,7 +7163,7 @@ following text: > \$\\sqrt {-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -7199,7 +7205,7 @@ following text: > \$\\sqrt {-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -7231,7 +7237,7 @@ following text: > \$\\sqrt {-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -7263,7 +7269,7 @@ following text: > \$\\sqrt {-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -7295,7 +7301,7 @@ following text: > \$\\sqrt {-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -8066,20 +8072,20 @@ A PDF document named `document.pdf` should be produced and contain the following text: > Here is a note reference,[^1] and another.[^longnote] -> +> > [^1]: Here is the note. -> +> > [^longnote]: Here's one with multiple blocks. -> +> > Subsequent paragraphs are indented to show that they > belong to the previous note. -> +> > { some.code } -> +> > The whole paragraph can be indented, or just the > first line. In this way, multi-paragraph notes > work like multi-paragraph list items. -> +> > This paragraph won't be part of the note, because it > isn't indented. @@ -8120,20 +8126,20 @@ A PDF document named `document.pdf` should be produced and contain the following text: > Here is a note reference,[^1] and another.[^longnote] -> +> > [^1]: Here is the note. -> +> > [^longnote]: Here's one with multiple blocks. -> +> > Subsequent paragraphs are indented to show that they > belong to the previous note. -> +> > { some.code } -> +> > The whole paragraph can be indented, or just the > first line. In this way, multi-paragraph notes > work like multi-paragraph list items. -> +> > This paragraph won't be part of the note, because it > isn't indented. @@ -9123,13 +9129,13 @@ A PDF document named `document.pdf` should be produced and contain the following text: > The following list respects the numbers specified in the markup: -> +> > 3. third item > 4. fourth item > 5. fifth item > > The following list does not respect the numbers specified in the markup: -> +> > 1. third item > 2. fourth item > 3. fifth item @@ -9168,13 +9174,13 @@ A PDF document named `document.pdf` should be produced and contain the following text: > The following list respects the numbers specified in the markup: -> +> > 3. third item > 4. fourth item > 5. fifth item > > The following list does not respect the numbers specified in the markup: -> +> > 1. third item > 2. fourth item > 3. fifth item @@ -9812,7 +9818,7 @@ following text: > | 12 | 12 | 12 | 12 | > | 123 | 123 | 123 | 123 | > | 1 | 1 | 1 | 1 | -> +> > : Demonstration of pipe table syntax. ##### \Hologo{ConTeXt} Example {.unnumbered} @@ -9850,7 +9856,7 @@ following text: > | 12 | 12 | 12 | 12 | > | 123 | 123 | 123 | 123 | > | 1 | 1 | 1 | 1 | -> +> > : Demonstration of pipe table syntax. %</manual-options> @@ -10234,7 +10240,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > $E=mc^2$ -> +> > $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ ##### \LaTeX{} Example {.unnumbered} @@ -10262,7 +10268,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > $E=mc^2$ -> +> > $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ ##### \Hologo{ConTeXt} Example {.unnumbered} @@ -10290,7 +10296,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > $E=mc^2$ -> +> > $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ %</manual-options> @@ -10445,7 +10451,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > \\(E=mc^2\\) -> +> > \\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] ##### \LaTeX{} Example {.unnumbered} @@ -10473,7 +10479,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > \\(E=mc^2\\) -> +> > \\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] ##### \Hologo{ConTeXt} Example {.unnumbered} @@ -10501,7 +10507,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > \\(E=mc^2\\) -> +> > \\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] %</manual-options> @@ -10656,7 +10662,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > \(E=mc^2\) -> +> > \[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] ##### \LaTeX{} Example {.unnumbered} @@ -10684,7 +10690,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > \(E=mc^2\) -> +> > \[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] ##### \Hologo{ConTeXt} Example {.unnumbered} @@ -10712,7 +10718,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > \(E=mc^2\) -> +> > \[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] %</manual-options> @@ -10815,21 +10821,21 @@ A PDF document named `document.pdf` should be produced and contain the following text: > The following list is tight: -> +> > - first item > - second item > - third item -> +> > The following list is loose: -> +> > - first item > - second item that spans -> +> > multiple paragraphs > - third item -> +> > The following list is now also loose: -> +> > - first item > > - second item @@ -11298,7 +11304,7 @@ following text: > \$\\sqrt{-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -11373,10 +11379,10 @@ pdftex --shell-escape document.tex % ``` tex % \input markdown % a -% b \markdownBegin c -% d +% b \markdownBegin c +% d % e \markdownEnd f -% g +% g % \bye % ``````` % @@ -12696,7 +12702,7 @@ The following ordered list will be preceded by roman numerals: \end{markdown} ``````` -Furthermore, we can also specify the name of the snippet in the current +Furthermore, we can also specify the name of the snippet in the current namespace, which can be different from the name of the snippet in the `jdoe/lists` theme. For example, we can make the snippet `jdoe/lists/romanNumerals` available under the name `roman`. @@ -13532,11 +13538,11 @@ following text: > This is a tight list (the first item, the second item, and the third item). > > This is a loose list: -> +> > - This is the first item. -> +> > - This is the second item. -> +> > - This is the third item. ##### \LaTeX{} Example {.unnumbered} @@ -13560,7 +13566,7 @@ following content: }, ulItemEnd = {}, ulEndTight = {).}, - }, + }, ] This is a tight list @@ -13579,7 +13585,7 @@ This is a tight list ulItem = {\item}, ulItemEnd = {.}, ulEnd = {\end{itemize}}, - }, + }, ] This is a loose list @@ -13602,11 +13608,11 @@ following text: > This is a tight list (the first item, the second item, and the third item). > > This is a loose list: -> +> > - This is the first item. -> +> > - This is the second item. -> +> > - This is the third item. ##### \Hologo{ConTeXt} Example {.unnumbered} @@ -13668,11 +13674,11 @@ following text: > This is a tight list (the first item, the second item, and the third item). > > This is a loose list: -> +> > - This is the first item. -> +> > - This is the second item. -> +> > - This is the third item. %</manual-tokens> @@ -13800,7 +13806,7 @@ following text: The \mdef{markdownRendererTextCite} macro represents a string of one or more text citations. This macro will only be produced, when the -\Opt{citations} option is enabled. The macro receives parameters in the same +\Opt{citations} option is enabled. The macro receives parameters in the same format as the \mref{markdownRendererCite} macro. % \end{markdown} @@ -13926,8 +13932,8 @@ filename of a file contaning the code block contents. The \mdef{markdownRendererInputFencedCode} macro represents a fenced code block. This macro will only be produced, when the \Opt{fencedCode} option is enabled. The macro receives three arguments that correspond to the filename of -a file contaning the code block contents, the fully escaped code fence infostring -that can be directly typeset, and the raw code fence infostring that can be used +a file contaning the code block contents, the fully escaped code fence infostring +that can be directly typeset, and the raw code fence infostring that can be used outside typesetting. % \end{markdown} @@ -14083,7 +14089,7 @@ following text: > > \$\\sqrt{-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -14124,7 +14130,7 @@ following text: > > \$\\sqrt{-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -14161,7 +14167,7 @@ following text: > > \$\\sqrt{-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -15223,7 +15229,7 @@ following text: > Hello *world*! > > *(The end of a block)* -> +> > _Foo_ bar! %</manual-tokens> @@ -16395,7 +16401,7 @@ following text: > - Hello *world*! > > *(The end of a block)* -> +> > _Foo_ bar! ##### \LaTeX{} Example {.unnumbered} @@ -16432,7 +16438,7 @@ following text: > - Hello *world*! > > *(The end of a block)* -> +> > _Foo_ bar! ##### \Hologo{ConTeXt} Example {.unnumbered} @@ -16464,7 +16470,7 @@ following text: > - Hello *world*! > > *(The end of a block)* -> +> > _Foo_ bar! %</manual-tokens> @@ -18080,11 +18086,11 @@ following text: > This is a tight list (the first item, the second item, and the third item). > > This is a loose list: -> +> > 1. This is the first item. -> +> > 2. This is the second item. -> +> > 3. This is the third item. ##### \LaTeX{} Example {.unnumbered} @@ -18113,7 +18119,7 @@ following content: }, olItemEnd = {}, olEndTight = {).}, - }, + }, ] This is a tight list @@ -18143,7 +18149,7 @@ This is a tight list }, olItemEnd = {.}, olEnd = {\end{enumerate}}, - }, + }, ] This is a loose list @@ -18166,11 +18172,11 @@ following text: > This is a tight list (the first item, the second item, and the third item). > > This is a loose list: -> +> > 1. This is the first item. -> +> > 2. This is the second item. -> +> > 3. This is the third item. ##### \Hologo{ConTeXt} Example {.unnumbered} @@ -18253,11 +18259,11 @@ following text: > This is a tight list (the first item, the second item, and the third item). > > This is a loose list: -> +> > 1. This is the first item. -> +> > 2. This is the second item. -> +> > 3. This is the third item. %</manual-tokens> @@ -19323,7 +19329,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > $E=mc^2\dots$ -> +> > $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\eqno(1)$$ ##### \LaTeX{} Example {.unnumbered} @@ -19352,7 +19358,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > $E=mc^2\dots$ -> +> > $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\quad(1)$$ ##### \Hologo{ConTeXt} Example {.unnumbered} @@ -19380,7 +19386,7 @@ A PDF document named `document.pdf` should be produced and contain the following text: > $E=mc^2\dots$ -> +> > $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\quad(1)$$ %</manual-tokens> @@ -21053,7 +21059,7 @@ following text: > \$\\sqrt{-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -21674,7 +21680,7 @@ following text: > \$\\sqrt{-1}\$ *equals* \$i\$. > -> <math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> +> <math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> > *equals* > <math><mi>i</mi></math>. @@ -22057,19 +22063,6 @@ end % \par % \begin{markdown} % -% The \luamdef{util.lookup_files} method looks up files with filename `f` -% and returns their paths. Further options for the \pkg{Kpathsea} library -% can be specified in table `options`. [@luatex21, Section 10.7.4] -% -% \end{markdown} -% \begin{macrocode} -function util.lookup_files(f, options) - return kpse.lookup(f, options) -end -% \end{macrocode} -% \par -% \begin{markdown} -% % The \luamdef{util.expand_tabs_in_line} expands tabs in string `s`. If % `tabstop` is specified, it is used as the tab stop width. Otherwise, % the tab stop width of 4 characters is used. The method is a copy of the tab @@ -24509,7 +24502,7 @@ function entities.char_entity(s) end local char_table = {} for _, code_point in ipairs(code_points) do - table.insert(char_table, unicode.utf8.char(code_point)) + table.insert(char_table, unicode.utf8.char(code_point)) end return table.concat(char_table) end @@ -24689,9 +24682,10 @@ function M.writer.new(options) % % \end{markdown} % \begin{macrocode} + self.interblocksep_text = "\\markdownRendererInterblockSeparator\n{}" function self.interblocksep() if not self.is_writing then return "" end - return "\\markdownRendererInterblockSeparator\n{}" + return self.interblocksep_text end % \end{macrocode} % \par @@ -24704,9 +24698,24 @@ function M.writer.new(options) % % \end{markdown} % \begin{macrocode} + self.paragraphsep_text = "\\markdownRendererParagraphSeparator\n{}" function self.paragraphsep() if not self.is_writing then return "" end - return "\\markdownRendererParagraphSeparator\n{}" + return self.paragraphsep_text + end +% \end{macrocode} +% \par +% \begin{markdown} +% +% Define \luamdef{writer->undosep} as a function that will remove the output +% produced by an immediately preceding block element / paragraph separator. +% +% \end{markdown} +% \begin{macrocode} + self.undosep_text = "\\markdownRendererUndoSeparator\n{}" + function self.undosep() + if not self.is_writing then return "" end + return self.undosep_text end % \end{macrocode} % \par @@ -25378,6 +25387,7 @@ function M.writer.new(options) if attributes["#" .. self.slice_end_identifier] ~= nil and self.slice_end_type == "^" then if self.is_writing then + table.insert(buf, self.undosep()) table.insert(buf, tear_down_attributes()) end self.is_writing = false @@ -25429,6 +25439,7 @@ function M.writer.new(options) if attributes["#" .. self.slice_end_identifier] ~= nil and self.slice_end_type == "$" then if self.is_writing then + table.insert(buf, self.undosep()) table.insert(buf, tear_down_attributes()) end self.is_writing = false @@ -25448,55 +25459,55 @@ function M.writer.new(options) % % \end{markdown} % \begin{macrocode} -local function create_auto_identifier(s) - local buffer = {} - local prev_space = false - local letter_found = false + local function create_auto_identifier(s) + local buffer = {} + local prev_space = false + local letter_found = false - for _, code in utf8.codes(uni_algos.normalize.NFC(s)) do - local char = utf8.char(code) + for _, code in utf8.codes(uni_algos.normalize.NFC(s)) do + local char = utf8.char(code) - -- Remove everything up to the first letter. - if not letter_found then - local is_letter = unicode.utf8.match(char, "%a") - if is_letter then - letter_found = true - else - goto continue + -- Remove everything up to the first letter. + if not letter_found then + local is_letter = unicode.utf8.match(char, "%a") + if is_letter then + letter_found = true + else + goto continue + end end - end - -- Remove all non-alphanumeric characters, except underscores, hyphens, and periods. - if not unicode.utf8.match(char, "[%w_%-%.%s]") then - goto continue - end - - -- Replace all spaces and newlines with hyphens. - if unicode.utf8.match(char, "[%s\n]") then - char = "-" - if prev_space then + -- Remove all non-alphanumeric characters, except underscores, hyphens, and periods. + if not unicode.utf8.match(char, "[%w_%-%.%s]") then goto continue + end + + -- Replace all spaces and newlines with hyphens. + if unicode.utf8.match(char, "[%s\n]") then + char = "-" + if prev_space then + goto continue + else + prev_space = true + end else - prev_space = true + -- Convert all alphabetic characters to lowercase. + char = unicode.utf8.lower(char) + prev_space = false end - else - -- Convert all alphabetic characters to lowercase. - char = unicode.utf8.lower(char) - prev_space = false - end - table.insert(buffer, char) + table.insert(buffer, char) - ::continue:: - end + ::continue:: + end - if prev_space then - table.remove(buffer) - end + if prev_space then + table.remove(buffer) + end - local identifier = #buffer == 0 and "section" or table.concat(buffer, "") - return identifier -end + local identifier = #buffer == 0 and "section" or table.concat(buffer, "") + return identifier + end % \end{macrocode} % \begin{markdown} % @@ -25504,56 +25515,56 @@ end % % \end{markdown} % \begin{macrocode} -local function create_gfm_auto_identifier(s) - local buffer = {} - local prev_space = false - local letter_found = false + local function create_gfm_auto_identifier(s) + local buffer = {} + local prev_space = false + local letter_found = false - for _, code in utf8.codes(uni_algos.normalize.NFC(s)) do - local char = utf8.char(code) + for _, code in utf8.codes(uni_algos.normalize.NFC(s)) do + local char = utf8.char(code) - -- Remove everything up to the first non-space. - if not letter_found then - local is_letter = unicode.utf8.match(char, "%S") - if is_letter then - letter_found = true - else - goto continue + -- Remove everything up to the first non-space. + if not letter_found then + local is_letter = unicode.utf8.match(char, "%S") + if is_letter then + letter_found = true + else + goto continue + end end - end - -- Remove all non-alphanumeric characters, except underscores and hyphens. - if not unicode.utf8.match(char, "[%w_%-%s]") then - prev_space = false - goto continue - end - - -- Replace all spaces and newlines with hyphens. - if unicode.utf8.match(char, "[%s\n]") then - char = "-" - if prev_space then + -- Remove all non-alphanumeric characters, except underscores and hyphens. + if not unicode.utf8.match(char, "[%w_%-%s]") then + prev_space = false goto continue + end + + -- Replace all spaces and newlines with hyphens. + if unicode.utf8.match(char, "[%s\n]") then + char = "-" + if prev_space then + goto continue + else + prev_space = true + end else - prev_space = true + -- Convert all alphabetic characters to lowercase. + char = unicode.utf8.lower(char) + prev_space = false end - else - -- Convert all alphabetic characters to lowercase. - char = unicode.utf8.lower(char) - prev_space = false - end - table.insert(buffer, char) + table.insert(buffer, char) - ::continue:: - end + ::continue:: + end - if prev_space then - table.remove(buffer) - end + if prev_space then + table.remove(buffer) + end - local identifier = #buffer == 0 and "section" or table.concat(buffer, "") - return identifier -end + local identifier = #buffer == 0 and "section" or table.concat(buffer, "") + return identifier + end % \end{macrocode} % \par % \begin{markdown} @@ -25564,6 +25575,8 @@ end % % \end{markdown} % \begin{macrocode} + self.secbegin_text = "\\markdownRendererSectionBegin\n" + self.secend_text = "\n\\markdownRendererSectionEnd " function self.heading(s, level, attributes) local buf = {} local flat_text, inlines = table.unpack(s) @@ -25573,8 +25586,8 @@ end table.insert(buf, self.push_attributes("heading", nil, - "\\markdownRendererSectionBegin\n", - "\n\\markdownRendererSectionEnd ")) + self.secbegin_text, + self.secend_text)) end -- pop attributes for sections that have ended @@ -25595,8 +25608,8 @@ end -- push attributes for the new section local start_output = {} local end_output = {} - table.insert(start_output, "\\markdownRendererSectionBegin\n") - table.insert(end_output, "\n\\markdownRendererSectionEnd ") + table.insert(start_output, self.secbegin_text) + table.insert(end_output, self.secend_text) table.insert(buf, self.push_attributes("heading", normalized_attributes, @@ -25752,7 +25765,6 @@ parsers.letter = R("AZ","az") parsers.alphanumeric = R("AZ","az","09") parsers.keyword = parsers.letter * (parsers.alphanumeric + parsers.dash)^0 -parsers.internal_punctuation = S(":;,.?") parsers.doubleasterisks = P("**") parsers.doubleunderscores = P("__") @@ -25763,7 +25775,50 @@ parsers.any = P(1) parsers.succeed = P(true) parsers.fail = P(false) -parsers.escapable = S("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") +parsers.internal_punctuation = S(":;,.?") +parsers.ascii_punctuation = S("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") +% \end{macrocode} +% \par +% \begin{markdown} +% +%### Unicode punctuation +% This section documents [the Unicode punctuation][unicode-punctuation] +% recognized by the markdown reader. The punctuation is organized in the +% \luamdef{parsers.punctuation} table according to the number of bytes occupied +% after conversion to \acro{utf}8. +% +% [unicode-punctuation]: https://spec.commonmark.org/0.31.2/#unicode-punctuation-character +% (CommonMark Spec, Version 0.31.2 (2024-01-28)) +% +% \end{markdown} +% \begin{macrocode} +parsers.punctuation = {} +(function() + local pathname = kpse.lookup("UnicodeData.txt") + local file = assert(io.open(pathname, "r"), + [[Could not open file "UnicodeData.txt"]]) + for line in file:lines() do + local codepoint, major_category = line:match("^(%x+);[^;]*;(%a)") + if major_category == "P" or major_category == "S" then + local code = unicode.utf8.char(tonumber(codepoint, 16)) + if parsers.punctuation[#code] == nil then + parsers.punctuation[#code] = parsers.fail + end + local code_parser = parsers.succeed + for i = 1, #code do + local byte = code:sub(i, i) + local byte_parser = S(byte) + code_parser = code_parser + * byte_parser + end + parsers.punctuation[#code] = parsers.punctuation[#code] + + code_parser + end + end + assert(file:close()) +end)() + +parsers.escapable = parsers.ascii_punctuation parsers.anyescaped = parsers.backslash / "" * parsers.escapable + parsers.any @@ -25812,8 +25867,8 @@ parsers.leader = parsers.space^-3 % \end{markdown} % \begin{macrocode} local function has_trail(indent_table) - return indent_table ~= nil and - indent_table.trail ~= nil and + return indent_table ~= nil and + indent_table.trail ~= nil and next(indent_table.trail) ~= nil end @@ -25825,8 +25880,8 @@ end % \end{markdown} % \begin{macrocode} local function has_indents(indent_table) - return indent_table ~= nil and - indent_table.indents ~= nil and + return indent_table ~= nil and + indent_table.indents ~= nil and next(indent_table.indents) ~= nil end @@ -25902,8 +25957,8 @@ end % % Process the spacing of a string of spaces and tabs `spacing` with preceding indent width from % the start of the line `indent` and strip up to `left_strip_length` spaces. Return the remainder -% `remainder` and whether there is enough spaces to produce a code `is_code`. Return how many -% spaces were stripped, as well as if the minimum was met `is_minimum` and what remainder it +% `remainder` and whether there is enough spaces to produce a code `is_code`. Return how many +% spaces were stripped, as well as if the minimum was met `is_minimum` and what remainder it % left `minimum_remainder`. % % \end{markdown} @@ -25947,7 +26002,7 @@ local function process_starter_spacing(indent, spacing, minimum, left_strip_leng minimum_found = true minimum_remainder = minimum_remainder .. string.rep(" ", count - minimum) end - + if (code_started) then code_start = code_start .. character elseif (count >= minimum + 4) then @@ -26119,13 +26174,13 @@ end % % Apply the patterns decoded from the indents of the indent table `indent_table` % iteratively starting at position `index` of the string `s`. If the `is_optional` -% mode is selected, match as many patterns as possible, else match all or fail. -% With the option `is_blank`, the parsing behaves as optional after the position +% mode is selected, match as many patterns as possible, else match all or fail. +% With the option `is_blank`, the parsing behaves as optional after the position % of a blank-only indent has been surpassed. % % \end{markdown} % \begin{macrocode} -local function traverse_indent(s, i, indent_table, is_optional, is_blank) +local function traverse_indent(s, i, indent_table, is_optional, is_blank, current_line_indents) local new_index = i local preceding_indentation = 0 @@ -26133,6 +26188,10 @@ local function traverse_indent(s, i, indent_table, is_optional, is_blank) local blank_starter = left_blank_starter(indent_table) + if current_line_indents == nil then + current_line_indents = {} + end + for index = 1,#indent_table.indents do local value = indent_table.indents[index] local pattern = decode_pattern(value.name) @@ -26142,10 +26201,10 @@ local function traverse_indent(s, i, indent_table, is_optional, is_blank) if new_indent_info == nil then local blankline_end = lpeg.match(Ct(parsers.blankline * Cg(Cp(), "pos")), s, new_index) if is_optional or not indent_table.ignore_blockquote_blank or not blankline_end then - return is_optional, new_index, current_trail + return is_optional, new_index, current_trail, current_line_indents end - return traverse_indent(s, tonumber(blankline_end.pos), indent_table, is_optional, is_blank) + return traverse_indent(s, tonumber(blankline_end.pos), indent_table, is_optional, is_blank, current_line_indents) end local raw_last_trail = new_indent_info[1] @@ -26158,13 +26217,13 @@ local function traverse_indent(s, i, indent_table, is_optional, is_blank) -- check previous trail if not space_only and next(current_trail) == nil then local sp = process_starter_spacing(0, raw_last_trail, 0, 0) - current_trail = {is_code=sp.is_code, remainder=sp.remainder, total_length=sp.total_length, + current_trail = {is_code=sp.is_code, remainder=sp.remainder, total_length=sp.total_length, full_remainder=sp.full_remainder} end if next(current_trail) ~= nil then if not space_only and current_trail.is_code then - return is_optional, new_index, current_trail + return is_optional, new_index, current_trail, current_line_indents end if current_trail.internal_remainder ~= nil then raw_last_trail = current_trail.internal_remainder @@ -26196,7 +26255,7 @@ local function traverse_indent(s, i, indent_table, is_optional, is_blank) local sp = process_starter_spacing(total_indent_level, spacing_to_process, minimum, left_strip_length) if space_only and not sp.is_minimum then - return is_optional or (is_blank and blank_starter <= index), new_index, current_trail + return is_optional or (is_blank and blank_starter <= index), new_index, current_trail, current_line_indents end local indent_length = raw_last_trail_length + delimiter_length + sp.left_total_stripped @@ -26210,10 +26269,12 @@ local function traverse_indent(s, i, indent_table, is_optional, is_blank) current_trail = {is_code=sp.is_code, remainder=sp.remainder, internal_remainder=sp.minimum_remainder, total_length=sp.total_length, full_remainder=sp.full_remainder} + + current_line_indents[#current_line_indents + 1] = new_indent_info new_index = next_index end - return true, new_index, current_trail + return true, new_index, current_trail, current_line_indents end % \end{macrocode} @@ -26230,8 +26291,8 @@ end % \end{macrocode} % \begin{markdown} % -% Check if the current trail of the `indent_table` would produce code if it is expected `expect_code` -% or it would not if it is not. If there is no trail, process and check the current spacing `spacing`. +% Check if the current trail of the `indent_table` would produce code if it is expected `expect_code` +% or it would not if it is not. If there is no trail, process and check the current spacing `spacing`. % % \end{markdown} % \begin{macrocode} @@ -26242,7 +26303,7 @@ local function check_trail_joined(s, i, indent_table, spacing, expect_code, omit if has_trail(indent_table) then local trail = indent_table.trail is_code = trail.is_code - if is_code then + if is_code then remainder = trail.remainder else remainder = trail.full_remainder @@ -26250,7 +26311,7 @@ local function check_trail_joined(s, i, indent_table, spacing, expect_code, omit else local sp = process_starter_spacing(0, spacing, 0, 0) is_code = sp.is_code - if is_code then + if is_code then remainder = sp.remainder else remainder = sp.full_remainder @@ -26291,7 +26352,7 @@ end % \end{macrocode} % \begin{markdown} % -% Check the indentation of the continuation line, optionally with +% Check the indentation of the continuation line, optionally with % the mode `is_optional` selected. Check blank line exclusively with `is_blank`. % % \end{markdown} @@ -26301,9 +26362,11 @@ local function check_continuation_indentation(s, i, indent_table, is_optional, i return true end - local passes, new_index, current_trail = traverse_indent(s, i, indent_table, is_optional, is_blank) + local passes, new_index, current_trail, current_line_indents = + traverse_indent(s, i, indent_table, is_optional, is_blank) if passes then + indent_table.current_line_indents = current_line_indents indent_table = add_trail(indent_table, current_trail) return new_index, indent_table end @@ -26341,7 +26404,7 @@ end % \end{macrocode} % \begin{markdown} % -% Take the trail `trail` or create a new one from `spacing` and comapre it +% Take the trail `trail` or create a new one from `spacing` and compare it % with the expected `trail_type`. On success return the index `i` and the % remainder of the trail. % @@ -26394,25 +26457,25 @@ end % \end{macrocode} % \begin{markdown} % -% Check the indentation of the continuation line, optionally with -% the mode `is_optional` selected. Check blank line specifically with `is_blank`. +% Check the indentation of the continuation line, optionally with +% the mode `is_optional` selected. Check blank line specifically with `is_blank`. % Additionally, also directly check the new trail with a type `trail_type`. % % \end{markdown} % \begin{macrocode} local function check_continuation_indentation_and_trail(s, i, indent_table, is_optional, is_blank, trail_type, - reset_rem, omit_remainder) + reset_rem, omit_remainder) if not has_indents(indent_table) then local spacing, new_index = lpeg.match(C(parsers.spacechar^0) * Cp(), s, i) local result, remainder = check_trail_type(s, i, indent_table.trail, spacing, trail_type) if remainder == nil then - if result then + if result then return new_index end return false end - if result then - return new_index, remainder + if result then + return new_index, remainder end return false end @@ -26431,17 +26494,17 @@ local function check_continuation_indentation_and_trail(s, i, indent_table, is_o end local result, remainder = check_trail_type(s, new_index, current_trail, spacing, trail_type) if remainder == nil or omit_remainder then - if result then - return new_index + if result then + return new_index end return false end - + if is_blank and reset_rem then remainder = remove_remainder_if_blank(indent_table, remainder) end - if result then - return new_index, remainder + if result then + return new_index, remainder end return false end @@ -26516,11 +26579,11 @@ parsers.check_minimal_blank_indent_and_full_code_trail = Cmt( Cb("indent_info") check_continuation_indentation_and_trail) parsers.check_minimal_indent_and_any_trail = Cmt( Cb("indent_info") - * Cc(false) * Cc(false) * Cc("full-any") * Cc(true) * Cc(false), + * Cc(false) * Cc(false) * Cc("full-any") * Cc(true) * Cc(false), check_continuation_indentation_and_trail) parsers.check_minimal_blank_indent_and_any_trail = Cmt( Cb("indent_info") - * Cc(false) * Cc(true) * Cc("full-any") * Cc(true) * Cc(false), + * Cc(false) * Cc(true) * Cc("full-any") * Cc(true) * Cc(false), check_continuation_indentation_and_trail) parsers.check_minimal_blank_indent_and_any_trail_no_rem = Cmt( Cb("indent_info") @@ -26528,11 +26591,11 @@ parsers.check_minimal_blank_indent_and_any_trail_no_rem = Cmt( Cb("indent_info") check_continuation_indentation_and_trail) parsers.check_optional_indent_and_any_trail = Cmt( Cb("indent_info") - * Cc(true) * Cc(false) * Cc("full-any") * Cc(true) * Cc(false), + * Cc(true) * Cc(false) * Cc("full-any") * Cc(true) * Cc(false), check_continuation_indentation_and_trail) parsers.check_optional_blank_indent_and_any_trail = Cmt( Cb("indent_info") - * Cc(true) * Cc(true) * Cc("full-any") * Cc(true) * Cc(false), + * Cc(true) * Cc(true) * Cc("full-any") * Cc(true) * Cc(false), check_continuation_indentation_and_trail) % \end{macrocode} @@ -26865,10 +26928,10 @@ parsers.block_keyword = -- end conditions parsers.html_blankline_end_condition = parsers.linechar^0 - * ( parsers.newline - * (parsers.check_minimal_blank_indent_and_any_trail + * ( parsers.newline + * (parsers.check_minimal_blank_indent_and_any_trail * #parsers.blankline - + parsers.check_minimal_indent_and_any_trail) + + parsers.check_minimal_indent_and_any_trail) * parsers.linechar^1)^0 * (parsers.newline^-1 / "") @@ -26877,10 +26940,10 @@ local function remove_trailing_blank_lines(s) end parsers.html_until_end = function(end_marker) - return Cs(Cs((parsers.newline - * (parsers.check_minimal_blank_indent_and_any_trail + return Cs(Cs((parsers.newline + * (parsers.check_minimal_blank_indent_and_any_trail * #parsers.blankline - + parsers.check_minimal_indent_and_any_trail) + + parsers.check_minimal_indent_and_any_trail) + parsers.linechar - end_marker)^0 * parsers.linechar^0 * parsers.newline^-1) / remove_trailing_blank_lines) @@ -26896,27 +26959,27 @@ parsers.html_attribute_name = (parsers.letter + parsers.colon + parsers.undersco * (parsers.alphanumeric + parsers.colon + parsers.underscore + parsers.period + parsers.dash)^0 -parsers.html_attribute_value = parsers.squote - * (parsers.linechar - parsers.squote)^0 +parsers.html_attribute_value = parsers.squote + * (parsers.linechar - parsers.squote)^0 * parsers.squote - + parsers.dquote - * (parsers.linechar - parsers.dquote)^0 + + parsers.dquote + * (parsers.linechar - parsers.dquote)^0 * parsers.dquote + ( parsers.any - parsers.spacechar - parsers.newline - parsers.dquote - parsers.squote - parsers.backtick - parsers.equal - parsers.less - parsers.more)^1 -parsers.html_inline_attribute_value = parsers.squote +parsers.html_inline_attribute_value = parsers.squote * (V("NoSoftLineBreakEndline") + parsers.any - parsers.blankline^2 - - parsers.squote)^0 + - parsers.squote)^0 * parsers.squote - + parsers.dquote + + parsers.dquote * (V("NoSoftLineBreakEndline") + parsers.any - parsers.blankline^2 - - parsers.dquote)^0 + - parsers.dquote)^0 * parsers.dquote + (parsers.any - parsers.spacechar - parsers.newline - parsers.dquote - parsers.squote - parsers.backtick @@ -26944,7 +27007,7 @@ parsers.html_non_newline_attribute = parsers.spacechar^1 * parsers.html_attribute_value_specification^-1 parsers.nested_breaking_blank = parsers.newline - * parsers.check_minimal_blank_indent + * parsers.check_minimal_blank_indent * parsers.blankline parsers.html_comment_start = P("<!--") @@ -26953,10 +27016,10 @@ parsers.html_comment_end = P("-->") parsers.html_comment = Cs( parsers.html_comment_start * parsers.html_until_end(parsers.html_comment_end)) - + parsers.html_inline_comment = (parsers.html_comment_start / "") * -P(">") * -P("->") - * Cs((V("NoSoftLineBreakEndline") + parsers.any - P("--") + * Cs((V("NoSoftLineBreakEndline") + parsers.any - parsers.nested_breaking_blank - parsers.html_comment_end)^0) * (parsers.html_comment_end / "") @@ -26980,7 +27043,7 @@ parsers.html_declaration = Cs( parsers.html_declaration_start * parsers.html_until_end(parsers.html_declaration_end)) parsers.html_inline_declaration = parsers.html_declaration_start - * Cs(V("NoSoftLineBreakEndline") + parsers.any + * Cs(V("NoSoftLineBreakEndline") + parsers.any - parsers.nested_breaking_blank - parsers.html_declaration_end)^0 * parsers.html_declaration_end @@ -26992,7 +27055,7 @@ parsers.html_instruction = Cs( parsers.html_instruction_start * parsers.html_until_end(parsers.html_instruction_end)) parsers.html_inline_instruction = parsers.html_instruction_start - * Cs(V("NoSoftLineBreakEndline") + parsers.any + * Cs(V("NoSoftLineBreakEndline") + parsers.any - parsers.nested_breaking_blank - parsers.html_instruction_end)^0 * parsers.html_instruction_end @@ -27135,7 +27198,7 @@ parsers.html_any_block = parsers.html_any_block_opening parsers.html_inline_comment_full = parsers.html_comment_start * -P(">") * -P("->") - * Cs((V("NoSoftLineBreakEndline") + parsers.any - P("--") + * Cs((V("NoSoftLineBreakEndline") + parsers.any - P("--") - parsers.nested_breaking_blank - parsers.html_comment_end)^0) * parsers.html_comment_end @@ -27367,7 +27430,7 @@ parsers.heading_start = #parsers.hash * C(parsers.hash^-6) * -parsers.hash / length -- parse setext header ending and return level -parsers.heading_level = parsers.nonindentspace * parsers.equal^1 * parsers.optionalspace * #parsers.newline * Cc(1) +parsers.heading_level = parsers.nonindentspace * parsers.equal^1 * parsers.optionalspace * #parsers.newline * Cc(1) + parsers.nonindentspace * parsers.dash^1 * parsers.optionalspace * #parsers.newline * Cc(2) local function strip_atx_end(s) @@ -27377,10 +27440,10 @@ end parsers.atx_heading = parsers.check_trail_no_rem * Cg(parsers.heading_start, "level") * (C( parsers.optionalspace - * parsers.hash^0 + * parsers.hash^0 * parsers.optionalspace * parsers.newline) - + parsers.spacechar^1 + + parsers.spacechar^1 * C(parsers.line)) % \end{macrocode} % \par @@ -27627,7 +27690,7 @@ function M.reader.new(writer, options) parsers.minimally_indented_par_or_plain = parsers.minimally_indented_paragraph + parsers.minimally_indented_plain - parsers.minimally_indented_par_or_plain_no_blank = parsers.minimally_indented_par_or_plain + parsers.minimally_indented_par_or_plain_no_blank = parsers.minimally_indented_par_or_plain - parsers.minimally_indented_blankline parsers.minimally_indented_ref = parsers.check_minimal_indent * V("Reference") @@ -27653,8 +27716,8 @@ function M.reader.new(writer, options) % \begin{macrocode} parsers.separator_loop = function(separated_block, paragraph, block_separator, paragraph_separator) - return separated_block - + block_separator + return separated_block + + block_separator * paragraph * separated_block + paragraph_separator @@ -27681,20 +27744,20 @@ function M.reader.new(writer, options) end parsers.sep_group_no_output = function(blank) - return blank^0 * parsers.eof + return blank^0 * parsers.eof + blank^0 end parsers.content_blank = parsers.minimally_indented_blankline - parsers.ref_or_block_separated = parsers.sep_group_no_output(parsers.content_blank) - * ( parsers.minimally_indented_ref + parsers.ref_or_block_separated = parsers.sep_group_no_output(parsers.content_blank) + * ( parsers.minimally_indented_ref - parsers.content_blank) + parsers.block_sep_group(parsers.content_blank) - * ( parsers.minimally_indented_block + * ( parsers.minimally_indented_block - parsers.content_blank) - parsers.loop_body_pair = + parsers.loop_body_pair = parsers.create_loop_body_pair(parsers.ref_or_block_separated, parsers.minimally_indented_par_or_plain_no_blank, parsers.block_sep_group(parsers.content_blank), @@ -27712,7 +27775,7 @@ function M.reader.new(writer, options) parsers.indented_content = function() return Ct( (V("Reference") + (parsers.blankline / "")) * parsers.content_blank^0 - * parsers.check_minimal_indent + * parsers.check_minimal_indent * parsers.content_loop + (V("Reference") + (parsers.blankline / "")) * parsers.content_blank^0 @@ -27758,7 +27821,7 @@ function M.reader.new(writer, options) * allowed_end end - parsers.starter = parsers.bullet(parsers.dash) + parsers.starter = parsers.bullet(parsers.dash) + parsers.bullet(parsers.asterisk) + parsers.bullet(parsers.plus) + parsers.enumerator(parsers.period) @@ -27842,7 +27905,7 @@ function M.reader.new(writer, options) % \end{macrocode} % \begin{markdown} % -% Render content between the `opening_index` and `closing_index` in the delimiter table `t` +% Render content between the `opening_index` and `closing_index` in the delimiter table `t` % as emphasis. % % \end{markdown} @@ -27856,7 +27919,7 @@ function M.reader.new(writer, options) % \end{macrocode} % \begin{markdown} % -% Render content between the `opening_index` and `closing_index` in the delimiter table `t` +% Render content between the `opening_index` and `closing_index` in the delimiter table `t` % as strong emphasis. % % \end{markdown} @@ -27876,8 +27939,8 @@ function M.reader.new(writer, options) % \end{markdown} % \begin{macrocode} local function breaks_three_rule(opening_delimiter, closing_delimiter) - return (opening_delimiter.is_closing or closing_delimiter.is_opening) and - ((opening_delimiter.original_count + closing_delimiter.original_count) % 3 == 0) and + return (opening_delimiter.is_closing or closing_delimiter.is_opening) and + ((opening_delimiter.original_count + closing_delimiter.original_count) % 3 == 0) and (opening_delimiter.original_count % 3 ~= 0 or closing_delimiter.original_count % 3 ~= 0) end @@ -27940,11 +28003,11 @@ function M.reader.new(writer, options) while current_position <= max_position do local value = t[current_position] - - if value.type ~= "delimiter" or - value.element ~= "emphasis" or - not value.is_active or - not value.is_closing or + + if value.type ~= "delimiter" or + value.element ~= "emphasis" or + not value.is_active or + not value.is_closing or (value.current_count <= 0) then current_position = current_position + 1 goto continue @@ -27978,7 +28041,7 @@ function M.reader.new(writer, options) t[current_position].current_count = current_closing_count - 1 fill_emph(t, opener_position, current_position) end - + ::continue:: end end @@ -28006,7 +28069,6 @@ function M.reader.new(writer, options) return lpeg.R("\240\244") * cont * cont * cont end end - % \end{macrocode} % \begin{markdown} % @@ -28024,15 +28086,22 @@ function M.reader.new(writer, options) else char_length = pos + 1 end - c = lpeg.match({ C(utf8_by_byte_count(char_length)) },s,i+pos) - if (c ~= nil) and (unicode.utf8.match(c, chartype)) then - return i + + if (chartype == "punctuation") then + if lpeg.match(parsers.punctuation[char_length], s, i+pos) then + return i + end + else + c = lpeg.match({ C(utf8_by_byte_count(char_length)) },s,i+pos) + if (c ~= nil) and (unicode.utf8.match(c, chartype)) then + return i + end end end end local function check_preceding_unicode_punctuation(s, i) - return check_unicode_type(s, i, -4, -1, "%p") + return check_unicode_type(s, i, -4, -1, "punctuation") end local function check_preceding_unicode_whitespace(s, i) @@ -28040,19 +28109,19 @@ function M.reader.new(writer, options) end local function check_following_unicode_punctuation(s, i) - return check_unicode_type(s, i, 0, 3, "%p") + return check_unicode_type(s, i, 0, 3, "punctuation") end local function check_following_unicode_whitespace(s, i) return check_unicode_type(s, i, 0, 3, "%s") end - parsers.unicode_preceding_punctuation = B(parsers.escapable) + parsers.unicode_preceding_punctuation = B(parsers.escapable) + Cmt(parsers.succeed, check_preceding_unicode_punctuation) parsers.unicode_preceding_whitespace = Cmt(parsers.succeed, check_preceding_unicode_whitespace) - parsers.unicode_following_punctuation = #parsers.escapable + parsers.unicode_following_punctuation = #parsers.escapable + Cmt(parsers.succeed, check_following_unicode_punctuation) parsers.unicode_following_whitespace = Cmt(parsers.succeed, check_following_unicode_whitespace) @@ -28064,8 +28133,8 @@ function M.reader.new(writer, options) end parsers.left_flanking_delimiter_run = function(character) - return (B( parsers.any) - * (parsers.unicode_preceding_punctuation + parsers.unicode_preceding_whitespace) + return (B( parsers.any) + * (parsers.unicode_preceding_punctuation + parsers.unicode_preceding_whitespace) + -B(parsers.any)) * parsers.delimiter_run(character) * parsers.unicode_following_punctuation @@ -28079,7 +28148,7 @@ function M.reader.new(writer, options) * parsers.delimiter_run(character) * (parsers.unicode_following_punctuation + parsers.unicode_following_whitespace + parsers.eof) - + (B(parsers.any) + + (B(parsers.any) * -(parsers.unicode_preceding_punctuation + parsers.unicode_preceding_whitespace)) * parsers.delimiter_run(character) end @@ -28087,13 +28156,13 @@ function M.reader.new(writer, options) if options.underscores then parsers.emph_start = parsers.left_flanking_delimiter_run(parsers.asterisk) + (-#parsers.right_flanking_delimiter_run(parsers.underscore) - + (parsers.unicode_preceding_punctuation + + (parsers.unicode_preceding_punctuation * #parsers.right_flanking_delimiter_run(parsers.underscore))) * parsers.left_flanking_delimiter_run(parsers.underscore) parsers.emph_end = parsers.right_flanking_delimiter_run(parsers.asterisk) + (-#parsers.left_flanking_delimiter_run(parsers.underscore) - + #(parsers.left_flanking_delimiter_run(parsers.underscore) + + #(parsers.left_flanking_delimiter_run(parsers.underscore) * parsers.unicode_following_punctuation)) * parsers.right_flanking_delimiter_run(parsers.underscore) else @@ -28115,7 +28184,7 @@ function M.reader.new(writer, options) * Cg(Cc(true), "is_opening") * Cg(Cc(false), "is_closing")) - parsers.emph_capturing_close = Ct( Cg(Cc("delimiter"), "type") + parsers.emph_capturing_close = Ct( Cg(Cc("delimiter"), "type") * Cg(Cc("emphasis"), "element") * Cg(C(parsers.emph_end), "content") * Cg(Cc(false), "is_opening") @@ -28281,20 +28350,20 @@ function M.reader.new(writer, options) end parsers.link_and_emph_endline = parsers.newline - * ((parsers.check_minimal_indent - * -V("EndlineExceptions") - + parsers.check_optional_indent - * -V("EndlineExceptions") + * ((parsers.check_minimal_indent + * -V("EndlineExceptions") + + parsers.check_optional_indent + * -V("EndlineExceptions") * -parsers.starter) / "") * parsers.spacechar^0 / "\n" parsers.link_and_emph_content = Ct( Cg(Cc("content"), "type") - * Cg(Cs(( parsers.link_emph_precedence + * Cg(Cs(( parsers.link_emph_precedence + parsers.backslash * parsers.any + parsers.link_and_emph_endline + (parsers.linechar - parsers.blankline^2 - - parsers.link_image_open_or_close + - parsers.link_image_open_or_close - parsers.emph_open_or_close))^0), "content")) parsers.link_and_emph_table = (parsers.link_image_opening + parsers.emph_open) @@ -28330,7 +28399,7 @@ function M.reader.new(writer, options) local value = t[i] if value.type == "delimiter" and value.is_opening and - (value.element == "link" or value.element == "image") + (value.element == "link" or value.element == "image") and not value.removed then if value.is_active then return i @@ -28455,8 +28524,8 @@ function M.reader.new(writer, options) % \end{macrocode} % \begin{markdown} % -% Parse content between two delimiters in the delimiter table `t`. Produce the respective link and image -% macros. +% Parse content between two delimiters in the delimiter table `t`. Produce the respective link and image +% macros. % % \end{markdown} % \begin{macrocode} @@ -28538,7 +28607,7 @@ function M.reader.new(writer, options) % \end{macrocode} % \begin{markdown} % -% Resolve an inline link [a](b "c") from the delimiters at `opening_index` and `closing_index` +% Resolve an inline link [a](b "c") from the delimiters at `opening_index` and `closing_index` % within a delimiter table `t`. Here, compared to other types of links, no reference definition is needed. % % \end{markdown} @@ -28571,7 +28640,7 @@ function M.reader.new(writer, options) % \begin{markdown} % % Resolve a full link [a][b] from the delimiters at `opening_index` and `closing_index` within a delimiter table `t`. -% Continue if a tag `b` is not found in the references. +% Continue if a tag `b` is not found in the references. % % \end{markdown} % \begin{macrocode} @@ -28581,7 +28650,7 @@ function M.reader.new(writer, options) local r = self.lookup_reference(next_link_content) if r then - local inline_content = resolve_inline_following_content(t, next_link_closing_index, false, + local inline_content = resolve_inline_following_content(t, next_link_closing_index, false, t.match_link_attributes) r.attributes = join_attributes(r.attributes, inline_content.attributes) render_link_or_image(t, opening_index, next_link_closing_index, closing_index, r) @@ -28591,9 +28660,9 @@ function M.reader.new(writer, options) % \end{macrocode} % \begin{markdown} % -% Resolve a collapsed link [a][] from the delimiters at `opening_index` and `closing_index` +% Resolve a collapsed link [a][] from the delimiters at `opening_index` and `closing_index` % within a delimiter table `t`. -% Continue if a tag `a` is not found in the references. +% Continue if a tag `a` is not found in the references. % % \end{markdown} % \begin{macrocode} @@ -28613,7 +28682,7 @@ function M.reader.new(writer, options) % \begin{markdown} % % Parse a table of link and emphasis delimiters `t`. -% First, iterate over the link delimiters and produce either link or image macros. +% First, iterate over the link delimiters and produce either link or image macros. % Then run `process_emphasis` over the entire delimiter table, resolving emphasis and strong % emphasis and parsing any content outside of closed delimiters. % @@ -28625,8 +28694,8 @@ function M.reader.new(writer, options) end for i,value in ipairs(t) do - if not value.is_closing or - value.type ~= "delimiter" or + if not value.is_closing or + value.type ~= "delimiter" or not (value.element == "link" or value.element == "image") then goto continue end @@ -28640,7 +28709,7 @@ function M.reader.new(writer, options) opening_delimiter.removed = true local link_type = opening_delimiter.link_type - + if (link_type == "inline") then resolve_inline_link(t, opener_position, i) end @@ -28657,7 +28726,7 @@ function M.reader.new(writer, options) ::continue:: end - t[#t].content = t[#t].content:gsub("%s*$","") + t[#t].content = t[#t].content:gsub("%s*$","") process_emphasis(t, 1, #t) local final_result = collect_emphasis_content(t, 1, #t) @@ -28706,7 +28775,7 @@ function M.reader.new(writer, options) parsers.interrupting_bullets = parsers.fail parsers.interrupting_enumerators = parsers.fail else - parsers.interrupting_bullets = parsers.bullet(parsers.dash, true) + parsers.interrupting_bullets = parsers.bullet(parsers.dash, true) + parsers.bullet(parsers.asterisk, true) + parsers.bullet(parsers.plus, true) @@ -28756,17 +28825,17 @@ function M.reader.new(writer, options) parsers.NoSoftLineBreakEndline = parsers.newline - * (parsers.check_minimal_indent - * -V("NoSoftLineBreakEndlineExceptions") - + parsers.check_optional_indent - * -V("NoSoftLineBreakEndlineExceptions") + * (parsers.check_minimal_indent + * -V("NoSoftLineBreakEndlineExceptions") + + parsers.check_optional_indent + * -V("NoSoftLineBreakEndlineExceptions") * -parsers.starter) * parsers.spacechar^0 / writer.space parsers.EndlineBreak = parsers.backslash * parsers.Endline / writer.hard_line_break - + parsers.OptionalIndent = parsers.spacechar^1 / writer.space @@ -28790,7 +28859,7 @@ function M.reader.new(writer, options) / writer.soft_line_break parsers.NonbreakingSpace - = parsers.spacechar^2 * parsers.Endline + = parsers.spacechar^2 * parsers.Endline / writer.hard_line_break + parsers.spacechar^1 * parsers.Endline^-1 * parsers.eof / "" + parsers.spacechar^1 * parsers.Endline @@ -28864,23 +28933,23 @@ end % % \end{markdown} % \begin{macrocode} - parsers.DisplayHtml = Cs(parsers.check_trail - * ( parsers.html_comment - + parsers.html_special_block - + parsers.html_block - + parsers.html_any_block - + parsers.html_instruction - + parsers.html_cdatasection + parsers.DisplayHtml = Cs(parsers.check_trail + * ( parsers.html_comment + + parsers.html_special_block + + parsers.html_block + + parsers.html_any_block + + parsers.html_instruction + + parsers.html_cdatasection + parsers.html_declaration)) / writer.block_html_element parsers.indented_non_blank_line = parsers.indentedline - parsers.blankline - parsers.Verbatim = Cs( - parsers.check_code_trail + parsers.Verbatim = Cs( + parsers.check_code_trail * (parsers.line - parsers.blankline) * ((parsers.check_minimal_blank_indent_and_full_code_trail * parsers.blankline)^0 - * ((parsers.check_minimal_indent / "") * parsers.check_code_trail + * ((parsers.check_minimal_indent / "") * parsers.check_code_trail * (parsers.line - parsers.blankline))^1)^0 ) / self.expandtabs / writer.verbatim @@ -28921,23 +28990,23 @@ end parsers.list_blank = parsers.conditionally_indented_blankline - parsers.ref_or_block_list_separated = parsers.sep_group_no_output(parsers.list_blank) + parsers.ref_or_block_list_separated = parsers.sep_group_no_output(parsers.list_blank) * parsers.minimally_indented_ref + parsers.block_sep_group(parsers.list_blank) * parsers.minimally_indented_block parsers.ref_or_block_non_separated = parsers.minimally_indented_ref - + (parsers.succeed / writer.interblocksep) + + (parsers.succeed / writer.interblocksep) * parsers.minimally_indented_block - parsers.minimally_indented_blankline - parsers.tight_list_loop_body_pair = + parsers.tight_list_loop_body_pair = parsers.create_loop_body_pair(parsers.ref_or_block_non_separated, parsers.minimally_indented_par_or_plain_no_blank, (parsers.succeed / writer.interblocksep), (parsers.succeed / writer.paragraphsep)) - parsers.loose_list_loop_body_pair = + parsers.loose_list_loop_body_pair = parsers.create_loop_body_pair(parsers.ref_or_block_list_separated, parsers.minimally_indented_par_or_plain, parsers.block_sep_group(parsers.list_blank), @@ -28969,7 +29038,7 @@ end * #parsers.list_blank * remove_indent("li") + ( (V("Reference") + (parsers.blankline / "")) - * parsers.check_minimal_indent + * parsers.check_minimal_indent * parsers.tight_list_content_loop + (V("Reference") + (parsers.blankline / "")) + (parsers.tickbox^-1 / writer.escape) @@ -28977,11 +29046,11 @@ end ) * parsers.list_item_tightness_condition ) - + parsers.indented_content_loose = Ct( (parsers.blankline / "") * #parsers.list_blank + ( (V("Reference") + (parsers.blankline / "")) - * parsers.check_minimal_indent + * parsers.check_minimal_indent * parsers.loose_list_content_loop + (V("Reference") + (parsers.blankline / "")) + (parsers.tickbox^-1 / writer.escape) @@ -29004,7 +29073,7 @@ end parsers.BulletListOfType = function(bullet_type) local bullet = parsers.bullet(bullet_type) - return ( Ct( parsers.TightListItem(bullet) + return ( Ct( parsers.TightListItem(bullet) * ( (parsers.check_minimal_indent / "") * parsers.TightListItem(bullet) )^0 @@ -29024,7 +29093,7 @@ end ) / writer.bulletlist end - parsers.BulletList = parsers.BulletListOfType(parsers.dash) + parsers.BulletList = parsers.BulletListOfType(parsers.dash) + parsers.BulletListOfType(parsers.asterisk) + parsers.BulletListOfType(parsers.plus) @@ -29046,11 +29115,11 @@ end return Cg(enumerator, "listtype") * (Ct( parsers.TightListItem(Cb("listtype")) * ((parsers.check_minimal_indent / "") * parsers.TightListItem(enumerator))^0) - * Cc(true) - * -#((parsers.list_blank^0 / "") + * Cc(true) + * -#((parsers.list_blank^0 / "") * parsers.check_minimal_indent * enumerator) + Ct( parsers.LooseListItem(Cb("listtype")) - * ((parsers.list_blank^0 / "") + * ((parsers.list_blank^0 / "") * (parsers.check_minimal_indent / "") * parsers.LooseListItem(enumerator))^0) * Cc(false) ) * Ct(Cb("listtype")) / ordered_list @@ -29090,10 +29159,10 @@ end parsers.AtxHeading = parsers.check_trail_no_rem * Cg(parsers.heading_start, "level") * ((C( parsers.optionalspace - * parsers.hash^0 + * parsers.hash^0 * parsers.optionalspace * parsers.newline) - + parsers.spacechar^1 + + parsers.spacechar^1 * C(parsers.line)) / strip_atx_end / parsers.parse_heading_text) @@ -29108,7 +29177,7 @@ end * parsers.newline^-1 parsers.SetextHeading = parsers.freeze_trail * parsers.check_trail_no_rem - * #(parsers.heading_text + * #(parsers.heading_text * parsers.check_minimal_indent * parsers.check_trail * parsers.heading_level) * Cs(parsers.heading_text) / parsers.parse_heading_text @@ -29637,16 +29706,59 @@ end table.sort(opt_string) local salt = table.concat(opt_string, ",") .. "," .. metadata.version local output + local function convert(input) + local document = self.parser_functions.parse_blocks(input) + local output = util.rope_to_string(writer.document(document)) +% \end{macrocode} +% \begin{markdown} +% Remove block element / paragraph separators immediately followed by the +% output of \luamref{writer->undosep}, possibly interleaved by section ends. +% Then, remove any leftover output of \luamref{writer->undosep}. +% \end{markdown} +% \begin{macrocode} + local undosep_start, undosep_end + local potential_secend_start, secend_start + local potential_sep_start, sep_start + while true do + -- find a `writer->undosep` + undosep_start, undosep_end = output:find(writer.undosep_text, 1, true) + if undosep_start == nil then break end + -- skip any preceding section ends + secend_start = undosep_start + while true do + potential_secend_start = secend_start - #writer.secend_text + if potential_secend_start < 1 + or output:sub(potential_secend_start, secend_start - 1) ~= writer.secend_text then + break + end + secend_start = potential_secend_start + end + -- find an immediately preceding block element / paragraph separator + sep_start = secend_start + potential_sep_start = sep_start - #writer.interblocksep_text + if potential_sep_start >= 1 + and output:sub(potential_sep_start, sep_start - 1) == writer.interblocksep_text then + sep_start = potential_sep_start + else + potential_sep_start = sep_start - #writer.paragraphsep_text + if potential_sep_start >= 1 + and output:sub(potential_sep_start, sep_start - 1) == writer.paragraphsep_text then + sep_start = potential_sep_start + end + end + -- remove `writer->undosep` and immediately preceding block element / paragraph separator + output = output:sub(1, sep_start - 1) + .. output:sub(secend_start, undosep_start - 1) + .. output:sub(undosep_end + 1) + end + return output + end % \end{macrocode} % \begin{markdown} % If we cache markdown documents, produce the cache file and transform its % filename to plain \TeX{} output via the \luamref{writer->pack} method. % \end{markdown} % \begin{macrocode} - local function convert(input) - local document = self.parser_functions.parse_blocks(input) - return util.rope_to_string(writer.document(document)) - end if options.eagerCache or options.finalizeCache then local name = util.cache(options.cacheDir, input, salt, convert, ".md" .. writer.suffix) @@ -29840,11 +29952,11 @@ M.extensions.citations = function(citation_nbsps) + parsers.bracketed + parsers.inticks + parsers.autolink - + V("InlineHtml") + + V("InlineHtml") + V("Space") + V("Endline") + (parsers.anyescaped - (parsers.newline + parsers.rbracket + parsers.blankline^2)) - - (parsers.spnl * parsers.dash^-1 * parsers.at))^0) + - (parsers.spnl * parsers.dash^-1 * parsers.at))^1) local citation_body_postnote = Cs((parsers.alphanumeric^1 @@ -29856,18 +29968,28 @@ M.extensions.citations = function(citation_nbsps) + (parsers.anyescaped - (parsers.newline + parsers.rbracket + parsers.semicolon + parsers.blankline^2)) - - (parsers.spnl * parsers.rbracket))^0) + - (parsers.spnl * parsers.rbracket))^1) local citation_body_chunk - = citation_body_prenote - * parsers.spnlc * citation_name + = ( citation_body_prenote + * parsers.spnlc_sep + + Cc("") + * parsers.spnlc + ) + * citation_name * (parsers.internal_punctuation - parsers.semicolon)^-1 - * parsers.spnlc * citation_body_postnote + * ( parsers.spnlc + * citation_body_postnote + + Cc("") + * parsers.spnlc + ) local citation_body = citation_body_chunk - * (parsers.semicolon * parsers.spnlc - * citation_body_chunk)^0 + * ( parsers.semicolon + * parsers.spnlc + * citation_body_chunk + )^0 local citation_headless_body_postnote = Cs((parsers.alphanumeric^1 @@ -29883,8 +30005,10 @@ M.extensions.citations = function(citation_nbsps) local citation_headless_body = citation_headless_body_postnote - * (parsers.sp * parsers.semicolon * parsers.spnlc - * citation_body_chunk)^0 + * ( parsers.semicolon + * parsers.spnlc + * citation_body_chunk + )^0 local citations = function(text_cites, raw_cites) @@ -29969,7 +30093,7 @@ M.extensions.content_blocks = function(language_map) % \begin{macrocode} local languages_json = (function() local base, prev, curr - for _, pathname in ipairs{util.lookup_files(language_map, { all=true })} do + for _, pathname in ipairs{kpse.lookup(language_map, { all=true })} do local file = io.open(pathname, "r") if not file then goto continue end local input = assert(file:read("*a")) @@ -30180,7 +30304,7 @@ M.extensions.definition_lists = function(tight_lists) local indented_blocks = function(bl) return Cs( bl - * (blank^1 * (parsers.check_minimal_indent / "") + * (blank^1 * (parsers.check_minimal_indent / "") * parsers.check_code_trail * -parsers.blankline * bl)^0 * (blank^1 + parsers.eof)) end @@ -30348,7 +30472,7 @@ M.extensions.fancy_lists = function() local digit_marker = parsers.dig * parsers.dig^-8 - local markers = { + local markers = { {lowercase_opening_roman_marker, lowercase_roman_marker}, {uppercase_opening_roman_marker, uppercase_roman_marker}, lowercase_letter_marker, @@ -30358,9 +30482,9 @@ M.extensions.fancy_lists = function() digit_marker } - local delims = { - parsers.period, - parsers.rparent + local delims = { + parsers.period, + parsers.rparent } local markers_table = combine_markers_and_delims(markers, delims) @@ -30466,11 +30590,11 @@ M.extensions.fancy_lists = function() return Cg(enumerator_start, "listtype") * (Ct( TightListItem(Cb("listtype")) * ((parsers.check_minimal_indent / "") * TightListItem(enumerator_cont))^0) - * Cc(true) - * -#((parsers.conditionally_indented_blankline^0 / "") + * Cc(true) + * -#((parsers.conditionally_indented_blankline^0 / "") * parsers.check_minimal_indent * enumerator_cont) + Ct( LooseListItem(Cb("listtype")) - * ((parsers.conditionally_indented_blankline^0 / "") + * ((parsers.conditionally_indented_blankline^0 / "") * (parsers.check_minimal_indent / "") * LooseListItem(enumerator_cont))^0) * Cc(false) ) * Ct(Cb("listtype")) / fancylist @@ -30479,10 +30603,10 @@ M.extensions.fancy_lists = function() local FancyList = join_table_with_func(FancyListOfType, markers_table) local Endline = parsers.newline - * (parsers.check_minimal_indent - * -parsers.EndlineExceptions - + parsers.check_optional_indent - * -parsers.EndlineExceptions + * (parsers.check_minimal_indent + * -parsers.EndlineExceptions + + parsers.check_optional_indent + * -parsers.EndlineExceptions * -starter) * parsers.spacechar^0 / writer.soft_line_break @@ -30574,12 +30698,12 @@ M.extensions.fenced_code = function(blank_before_code_fence, return str:gsub("^%s*(.-)%s*$", "%1") end - local tilde_infostring = Cs(Cs((V("HtmlEntity") - + parsers.anyescaped + local tilde_infostring = Cs(Cs((V("HtmlEntity") + + parsers.anyescaped - parsers.newline)^0) / strip_enclosing_whitespaces) - local backtick_infostring = Cs(Cs((V("HtmlEntity") + local backtick_infostring = Cs(Cs((V("HtmlEntity") + (-#(parsers.backslash * parsers.backtick) * parsers.anyescaped) - parsers.newline - parsers.backtick)^0) @@ -30588,14 +30712,14 @@ M.extensions.fenced_code = function(blank_before_code_fence, local fenceindent local function has_trail(indent_table) - return indent_table ~= nil and - indent_table.trail ~= nil and + return indent_table ~= nil and + indent_table.trail ~= nil and next(indent_table.trail) ~= nil end local function has_indents(indent_table) - return indent_table ~= nil and - indent_table.indents ~= nil and + return indent_table ~= nil and + indent_table.indents ~= nil and next(indent_table.indents) ~= nil end @@ -30808,24 +30932,57 @@ M.extensions.fenced_divs = function(blank_before_div_fence) % \par % \begin{markdown} % -% Initialize a named group named `div_level` for tracking how deep we are -% nested in divs. +% Initialize a named group named `fenced_div_level` for tracking how deep +% we are nested in divs and the named group `fenced_div_num_opening_indents` +% for tracking the indent of the starting div fence. The former named group +% is immutable and should roll back properly when we fail to match a fenced +% div. The latter is mutable and may contain items from unsuccessful matches +% on top. However, we always know how many items at the head of the latter we +% can trust by consulting the former. % % \end{markdown} % \begin{macrocode} - self.initialize_named_group("div_level", "0") + self.initialize_named_group("fenced_div_level", "0") + self.initialize_named_group("fenced_div_num_opening_indents") - local function increment_div_level(increment) - local function update_div_level(s, i, current_level) -- luacheck: ignore s i - current_level = tonumber(current_level) - local next_level = tostring(current_level + increment) - return true, next_level + local function increment_div_level() + local function push_indent_table(s, i, indent_table, -- luacheck: ignore s i + fenced_div_num_opening_indents, fenced_div_level) + fenced_div_level = tonumber(fenced_div_level) + 1 + local num_opening_indents = 0 + if indent_table.indents ~= nil then + num_opening_indents = #indent_table.indents + end + fenced_div_num_opening_indents[fenced_div_level] = num_opening_indents + return true, fenced_div_num_opening_indents end - return Cg( Cmt(Cb("div_level"), update_div_level) - , "div_level") + local function increment_level(s, i, fenced_div_level) -- luacheck: ignore s i + fenced_div_level = tonumber(fenced_div_level) + 1 + return true, tostring(fenced_div_level) + end + + return Cg( Cmt( Cb("indent_info") + * Cb("fenced_div_num_opening_indents") + * Cb("fenced_div_level"), push_indent_table) + , "fenced_div_num_opening_indents") + * Cg( Cmt( Cb("fenced_div_level"), increment_level) + , "fenced_div_level") end - + + local function decrement_div_level() + local function pop_indent_table(s, i, fenced_div_indent_table, fenced_div_level) -- luacheck: ignore s i + fenced_div_level = tonumber(fenced_div_level) + fenced_div_indent_table[fenced_div_level] = nil + return true, tostring(fenced_div_level - 1) + end + + return Cg( Cmt( Cb("fenced_div_num_opening_indents") + * Cb("fenced_div_level"), pop_indent_table) + , "fenced_div_level") + end + + local non_fenced_div_block = parsers.check_minimal_indent * V("Block") - parsers.check_minimal_indent_and_trail * fenced_div_end @@ -30860,11 +31017,12 @@ M.extensions.fenced_divs = function(blank_before_div_fence) return attr end / writer.div_begin - * increment_div_level(1) + * increment_div_level() * parsers.skipblanklines * Ct(content_loop) * parsers.minimally_indented_blank^0 - * parsers.check_minimal_indent_and_trail * fenced_div_end * increment_div_level(-1) + * parsers.check_minimal_indent_and_trail * fenced_div_end + * decrement_div_level() * (Cc("") / writer.div_end) self.insert_pattern("Block after Verbatim", @@ -30878,17 +31036,38 @@ M.extensions.fenced_divs = function(blank_before_div_fence) % % If the `blank_before_div_fence` parameter is `false`, we will have the % closing div at the beginning of a line break the current paragraph if -% we are currently nested in a div. +% we are currently nested in a div and the indentation matches the opening +% div fence. % % \end{markdown} % \begin{macrocode} - local function check_div_level(s, i, current_level) -- luacheck: ignore s i - current_level = tonumber(current_level) - return current_level > 0 + local function is_inside_div() + local function check_div_level(s, i, fenced_div_level) -- luacheck: ignore s i + fenced_div_level = tonumber(fenced_div_level) + return fenced_div_level > 0 + end + + return Cmt(Cb("fenced_div_level"), check_div_level) + end + + local function check_indent() + local function compare_indent(s, i, indent_table, -- luacheck: ignore s i + fenced_div_num_opening_indents, fenced_div_level) + fenced_div_level = tonumber(fenced_div_level) + local num_current_indents = (indent_table.current_line_indents ~= nil and + #indent_table.current_line_indents) or 0 + local num_opening_indents = fenced_div_num_opening_indents[fenced_div_level] + return num_current_indents == num_opening_indents + end + + return Cmt( Cb("indent_info") + * Cb("fenced_div_num_opening_indents") + * Cb("fenced_div_level"), compare_indent) end - local is_inside_div = Cmt(Cb("div_level"), check_div_level) - local fencestart = is_inside_div * fenced_div_end + local fencestart = is_inside_div() + * fenced_div_end + * check_indent() if not blank_before_div_fence then self.update_rule("EndlineExceptions", function(previous_pattern) @@ -30945,10 +31124,10 @@ M.extensions.header_attributes = function() return s:gsub("%s*$","") end - local heading_line = (parsers.linechar + local heading_line = (parsers.linechar - (parsers.attributes * parsers.optionalspace - * parsers.newline))^1 + * parsers.newline))^1 - parsers.thematic_break_lines local heading_text = heading_line @@ -30956,7 +31135,7 @@ M.extensions.header_attributes = function() * parsers.newline^-1 local SetextHeading = parsers.freeze_trail * parsers.check_trail_no_rem - * #(heading_text + * #(heading_text * (parsers.attributes * parsers.optionalspace * parsers.newline)^-1 @@ -31131,7 +31310,7 @@ M.extensions.link_attributes = function() % \begin{macrocode} local define_reference_parser = (parsers.check_trail / "") * parsers.link_label * parsers.colon * parsers.spnlc * parsers.url - * ( parsers.spnlc_sep * parsers.title * (parsers.spnlc * Ct(parsers.attributes)) + * ( parsers.spnlc_sep * parsers.title * (parsers.spnlc * Ct(parsers.attributes)) * parsers.only_blank + parsers.spnlc_sep * parsers.title * parsers.only_blank + Cc("") * (parsers.spnlc * Ct(parsers.attributes)) * parsers.only_blank @@ -31284,7 +31463,7 @@ M.extensions.notes = function(notes, inline_notes) local indented_blocks = function(bl) return Cs( bl - * (blank^1 * (parsers.check_optional_indent / "") + * (blank^1 * (parsers.check_optional_indent / "") * parsers.check_code_trail * -parsers.blankline * bl)^0) end @@ -31447,7 +31626,7 @@ M.extensions.pipe_tables = function(table_captions, table_attributes) , table_hline_separator , table_hline_column) - local table_caption_beginning = (parsers.check_minimal_blank_indent_and_any_trail_no_rem + local table_caption_beginning = (parsers.check_minimal_blank_indent_and_any_trail_no_rem * parsers.optionalspace * parsers.newline)^0 * parsers.check_minimal_indent_and_trail * (P("Table")^-1 * parsers.colon) @@ -32246,7 +32425,7 @@ function M.new(options) % % \end{markdown} % \begin{macrocode} - local pathname = util.lookup_files(filename) + local pathname = kpse.lookup(filename) local input_file = assert(io.open(pathname, "r"), [[Could not open user-defined syntax extension "]] .. pathname .. [[" for reading]]) diff --git a/macros/generic/markdown/markdown.html b/macros/generic/markdown/markdown.html index a5616317fc..277f98bdeb 100644 --- a/macros/generic/markdown/markdown.html +++ b/macros/generic/markdown/markdown.html @@ -93,7 +93,7 @@ <header id="title-block-header"> <h1 class="title">Markdown Package User Manual</h1> <p class="author">Vรญt Starรฝ Novotnรฝ</p> -<p class="date">3.4.2-0-ga45cf0ed 2024-03-09</p> +<p class="date">3.4.3-0-ge2c6be1a 2024-04-04</p> </header> <nav id="TOC" role="doc-toc"> <ul> @@ -604,8 +604,8 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb31-1"><a href="# contain the following text:</p> <blockquote> <p>$\sqrt{-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <p>Invoking pdfTeX should have the same effect:</p> <div class="sourceCode" id="cb32"><pre @@ -641,8 +641,8 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb34-1"><a href="# contain the following text:</p> <blockquote> <p>$\sqrt{-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <p>In this case, we cannot use pdfTeX, because pdfTeX does not define the <code>\directlua</code> <span class="tex">T<sub>e</sub>X</span> @@ -693,8 +693,8 @@ title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> contain the following text:</p> <blockquote> <p>$\sqrt{-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <p>Invoking pdfTeX should have the same effect:</p> <div class="sourceCode" id="cb38"><pre @@ -737,8 +737,8 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb40-1"><a href="# contain the following text:</p> <blockquote> <p>$\sqrt{-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <p>Invoking pdfTeX should have the same effect:</p> <div class="sourceCode" id="cb41"><pre @@ -785,8 +785,8 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb43-1"><a href="# contain the following text:</p> <blockquote> <p>$\sqrt{-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <p>Invoking pdfTeX should have the same effect:</p> <div class="sourceCode" id="cb44"><pre @@ -828,8 +828,8 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb46-1"><a href="# contain the following text:</p> <blockquote> <p>$\sqrt{-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <h2 data-number="2.2" id="options"><span class="header-section-number">2.2</span> Options</h2> @@ -4679,8 +4679,8 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb279-1"><a href=" contain the following text:</p> <blockquote> <p>$\sqrt {-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <h5 class="unnumbered" id="lua-cli-example-10">Lua CLI Example</h5> <p>Using a text editor, create a text document named @@ -4718,8 +4718,8 @@ title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> contain the following text:</p> <blockquote> <p>$\sqrt {-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <h5 class="unnumbered" id="plain-tex-example-11">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> @@ -4746,8 +4746,8 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb284-1"><a href=" contain the following text:</p> <blockquote> <p>$\sqrt {-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <h5 class="unnumbered" id="latex-example-26"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> @@ -4774,8 +4774,8 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb286-1"><a href=" contain the following text:</p> <blockquote> <p>$\sqrt {-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <h5 class="unnumbered" id="context-example-17">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> @@ -4802,8 +4802,8 @@ class="sourceCode sh"><code class="sourceCode bash"><span id="cb288-1"><a href=" contain the following text:</p> <blockquote> <p>$\sqrt {-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <h4 data-number="2.2.1.35" id="option-inlinecodeattributes"><span class="header-section-number">2.2.1.35</span> Option @@ -9109,8 +9109,8 @@ contain the following text:</p> <blockquote> <p>$\sqrt{-1}$ *equals* $i$.</p> <p>$\sqrt{-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <h5 class="unnumbered" id="latex-example-63"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> @@ -9145,8 +9145,8 @@ contain the following text:</p> <blockquote> <p>$\sqrt{-1}$ *equals* $i$.</p> <p>$\sqrt{-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <h5 class="unnumbered" id="context-example-40">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> @@ -9177,8 +9177,8 @@ contain the following text:</p> <blockquote> <p>$\sqrt{-1}$ *equals* $i$.</p> <p>$\sqrt{-1}$ <em>equals</em> $i$.</p> -<p><math><mroot><msqrt><mo>โ</mo><mn>1</mn></msqrt></mroot></math> -<em>equals</em> <math><mi>i</mi></math>.</p> +<p><math><msqrt><mo>โ</mo><mn>1</mn></msqrt></math> <em>equals</em> +<math><mi>i</mi></math>.</p> </blockquote> <h4 data-number="2.3.1.8" id="code-span-attribute-context-renderers"><span diff --git a/macros/generic/markdown/markdown.pdf b/macros/generic/markdown/markdown.pdf Binary files differindex 34822a723f..8e42e32d0b 100644 --- a/macros/generic/markdown/markdown.pdf +++ b/macros/generic/markdown/markdown.pdf diff --git a/macros/latex/contrib/acmart/README b/macros/latex/contrib/acmart/README index 8d799d2832..f72ea3b2bf 100644 --- a/macros/latex/contrib/acmart/README +++ b/macros/latex/contrib/acmart/README @@ -12,6 +12,8 @@ The production version is the one on CTAN and ACM sites. Changes +Version 2.05. Changed title for TELO. + Version 2.04. Compatibility with the new latex-dev format eSSN is always printed, even if pSSN is present Wording change in copyright statement diff --git a/macros/latex/contrib/acmart/acmart.dtx b/macros/latex/contrib/acmart/acmart.dtx index 61251bff30..c9d253b955 100644 --- a/macros/latex/contrib/acmart/acmart.dtx +++ b/macros/latex/contrib/acmart/acmart.dtx @@ -1,6 +1,6 @@ % \iffalse % -% Copyright 2016-2023, Association for Computing Machinery +% Copyright 2016-2024, Association for Computing Machinery % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3 of this license or (at your option) any @@ -57,7 +57,7 @@ % \ifx\currentjob\guide\OnlyDescription\fi % \GetFileInfo{acmart.dtx} % \title{\LaTeX{} Class for the \emph{Association for Computing -% Machinery}\thanks{\copyright 2016--2023, Association for Computing Machinery}} +% Machinery}\thanks{\copyright 2016--2024, Association for Computing Machinery}} % \author{Boris Veytsman\thanks{% % \href{mailto:borisv@lk.net}{\texttt{borisv@lk.net}}, % \href{mailto:boris@varphi.com}{\texttt{boris@varphi.com}}}} @@ -2158,7 +2158,7 @@ % TDS & ACM/IMS Transactions on Data Science\\ % TEAC & ACM Transactions on Economics and Computation\\ % TECS & ACM Transactions on Embedded Computing Systems \\ -% TELO & ACM Transactions on Evolutionary Learning \\ +% TELO & ACM Transactions on Evolutionary Learning and Optimization\\ % THRI & ACM Transactions on Human-Robot Interaction\\ % TIIS & ACM Transactions on Interactive Intelligent Systems\\ % TIOT & ACM Transactions on Internet of Things \\ @@ -2309,7 +2309,7 @@ \ProvidesFile{acmart.dtx} %</gobble> %<class>\ProvidesClass{acmart} -[2024/03/31 v2.04 Typesetting articles for the Association for Computing Machinery] +[2024/04/03 v2.05 Typesetting articles for the Association for Computing Machinery] % \end{macrocode} % % \changes{v1.00}{2016/04/14}{First released version} @@ -4391,6 +4391,7 @@ % \changes{1.89}{2023/03/25}{Added PACMMOD} % \changes{1.89}{2023/03/25}{Added TOPML} % \changes{1.90}{2023/03/30}{Added TOPML eISSN} +% \changes{2.05}{2024/04/04}{New data for TELO} % % We use the |xkeyval| interface to define journal titles and the relevant % information @@ -4633,8 +4634,8 @@ \def\@journalNameShort{ACM Trans. Embedd. Comput. Syst.}% \def\@permissionCodeOne{1539-9087}% \or % TELO - \def\@journalName{ACM Transactions on Evolutionary Learning}% - \def\@journalNameShort{ACM Trans. Evol. Learn.}% + \def\@journalName{ACM Transactions on Evolutionary Learning and Optimization}% + \def\@journalNameShort{ACM Trans. Evol. Learn. Optim.}% \def\@permissionCodeOne{2688-3007}% \or % THRI \def\@journalName{ACM Transactions on Human-Robot Interaction}% diff --git a/macros/latex/contrib/acmart/acmart.pdf b/macros/latex/contrib/acmart/acmart.pdf Binary files differindex af42c74465..344d409f1b 100644 --- a/macros/latex/contrib/acmart/acmart.pdf +++ b/macros/latex/contrib/acmart/acmart.pdf diff --git a/macros/latex/contrib/acmart/acmguide.pdf b/macros/latex/contrib/acmart/acmguide.pdf Binary files differindex c13a1ecd0b..20738de1c0 100644 --- a/macros/latex/contrib/acmart/acmguide.pdf +++ b/macros/latex/contrib/acmart/acmguide.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-acmcp.pdf b/macros/latex/contrib/acmart/samples/sample-acmcp.pdf Binary files differindex 0371cfab76..aa0af4ed03 100644 --- a/macros/latex/contrib/acmart/samples/sample-acmcp.pdf +++ b/macros/latex/contrib/acmart/samples/sample-acmcp.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-acmengage.pdf b/macros/latex/contrib/acmart/samples/sample-acmengage.pdf Binary files differindex a9d9c5573d..ecef3f264c 100644 --- a/macros/latex/contrib/acmart/samples/sample-acmengage.pdf +++ b/macros/latex/contrib/acmart/samples/sample-acmengage.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-acmlarge.pdf b/macros/latex/contrib/acmart/samples/sample-acmlarge.pdf Binary files differindex efad61a4f5..1dadd006b9 100644 --- a/macros/latex/contrib/acmart/samples/sample-acmlarge.pdf +++ b/macros/latex/contrib/acmart/samples/sample-acmlarge.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-acmsmall-biblatex.pdf b/macros/latex/contrib/acmart/samples/sample-acmsmall-biblatex.pdf Binary files differindex fa2c7fcdb0..60c0827ba8 100644 --- a/macros/latex/contrib/acmart/samples/sample-acmsmall-biblatex.pdf +++ b/macros/latex/contrib/acmart/samples/sample-acmsmall-biblatex.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-acmsmall-conf.pdf b/macros/latex/contrib/acmart/samples/sample-acmsmall-conf.pdf Binary files differindex 2d4ae466ce..b2cba4a4f3 100644 --- a/macros/latex/contrib/acmart/samples/sample-acmsmall-conf.pdf +++ b/macros/latex/contrib/acmart/samples/sample-acmsmall-conf.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-acmsmall-submission.pdf b/macros/latex/contrib/acmart/samples/sample-acmsmall-submission.pdf Binary files differindex 925fec5551..23dc335812 100644 --- a/macros/latex/contrib/acmart/samples/sample-acmsmall-submission.pdf +++ b/macros/latex/contrib/acmart/samples/sample-acmsmall-submission.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-acmsmall.pdf b/macros/latex/contrib/acmart/samples/sample-acmsmall.pdf Binary files differindex 1c1a2ab289..c7a9e5f575 100644 --- a/macros/latex/contrib/acmart/samples/sample-acmsmall.pdf +++ b/macros/latex/contrib/acmart/samples/sample-acmsmall.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-acmtog-conf.pdf b/macros/latex/contrib/acmart/samples/sample-acmtog-conf.pdf Binary files differindex b3e3733cfd..b1df26ca61 100644 --- a/macros/latex/contrib/acmart/samples/sample-acmtog-conf.pdf +++ b/macros/latex/contrib/acmart/samples/sample-acmtog-conf.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-acmtog.pdf b/macros/latex/contrib/acmart/samples/sample-acmtog.pdf Binary files differindex 7d9d35c82e..1434d59099 100644 --- a/macros/latex/contrib/acmart/samples/sample-acmtog.pdf +++ b/macros/latex/contrib/acmart/samples/sample-acmtog.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-manuscript.pdf b/macros/latex/contrib/acmart/samples/sample-manuscript.pdf Binary files differindex c9c20da0cf..be3cac8e04 100644 --- a/macros/latex/contrib/acmart/samples/sample-manuscript.pdf +++ b/macros/latex/contrib/acmart/samples/sample-manuscript.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-sigconf-authordraft.pdf b/macros/latex/contrib/acmart/samples/sample-sigconf-authordraft.pdf Binary files differindex ea9d209bd8..c95d95127d 100644 --- a/macros/latex/contrib/acmart/samples/sample-sigconf-authordraft.pdf +++ b/macros/latex/contrib/acmart/samples/sample-sigconf-authordraft.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-sigconf-biblatex.pdf b/macros/latex/contrib/acmart/samples/sample-sigconf-biblatex.pdf Binary files differindex 072c1d6a77..6aa27ae8fb 100644 --- a/macros/latex/contrib/acmart/samples/sample-sigconf-biblatex.pdf +++ b/macros/latex/contrib/acmart/samples/sample-sigconf-biblatex.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-sigconf-i13n.pdf b/macros/latex/contrib/acmart/samples/sample-sigconf-i13n.pdf Binary files differindex 30463e2948..7a84d7c4e7 100644 --- a/macros/latex/contrib/acmart/samples/sample-sigconf-i13n.pdf +++ b/macros/latex/contrib/acmart/samples/sample-sigconf-i13n.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-sigconf.pdf b/macros/latex/contrib/acmart/samples/sample-sigconf.pdf Binary files differindex 3bfab889d7..e1239820b7 100644 --- a/macros/latex/contrib/acmart/samples/sample-sigconf.pdf +++ b/macros/latex/contrib/acmart/samples/sample-sigconf.pdf diff --git a/macros/latex/contrib/acmart/samples/sample-sigplan.pdf b/macros/latex/contrib/acmart/samples/sample-sigplan.pdf Binary files differindex 8a2c4acee7..cb491065d0 100644 --- a/macros/latex/contrib/acmart/samples/sample-sigplan.pdf +++ b/macros/latex/contrib/acmart/samples/sample-sigplan.pdf diff --git a/macros/latex/contrib/csquotes/csq-compat.def b/macros/latex/contrib/csquotes/csq-compat.def index 9a19bf1fa4..d37f4fde7d 100644 --- a/macros/latex/contrib/csquotes/csq-compat.def +++ b/macros/latex/contrib/csquotes/csq-compat.def @@ -1,5 +1,5 @@ \ProvidesFile{csq-compat.def} - [2022-09-14 v5.2n csquotes backwards compatibility (JAW)] + [2024-04-04 v5.2o csquotes backwards compatibility (JAW)] \def\csq@getversion#1{% \expandafter\csq@getversion@i diff --git a/macros/latex/contrib/csquotes/csquotes.def b/macros/latex/contrib/csquotes/csquotes.def index 80f8cb5713..feb396879a 100644 --- a/macros/latex/contrib/csquotes/csquotes.def +++ b/macros/latex/contrib/csquotes/csquotes.def @@ -1,5 +1,5 @@ \ProvidesFile{csquotes.def} - [2022-09-14 v5.2n csquotes generic definitions (JAW)] + [2024-04-04 v5.2o csquotes generic definitions (JAW)] % Set defaults @@ -63,11 +63,11 @@ {\textquoteleft} {\textquoteright} \DeclareQuoteStyle{dutch} - {\quotedblbase} + {\textquotedblleft} {\textquotedblright} [0.05em] - {\quotesinglbase}% unsure - {\textquoteright}% unsure + {\textquoteleft} + {\textquoteright} \DeclareQuoteStyle[american]{english}% verified {\textquotedblleft} {\textquotedblright} @@ -188,6 +188,12 @@ [0.05em] {\quotesinglbase} {\textquoteright} +\DeclareQuoteStyle{lithuanian} + {\quotedblbase} + {\textquotedblleft} + [0.05em] + {\textquoteright} + {\textquoteright} \DeclareQuoteStyle[guillemets]{norwegian} {\guillemotleft} {\guillemotright} @@ -397,6 +403,7 @@ \DeclareQuoteOption{japanese} \DeclareQuoteOption{latin} \DeclareQuoteOption{latvian} +\DeclareQuoteOption{lithuanian} \DeclareQuoteOption{norwegian} \DeclareQuoteOption{polish} \DeclareQuoteOption{portuguese} diff --git a/macros/latex/contrib/csquotes/csquotes.pdf b/macros/latex/contrib/csquotes/csquotes.pdf Binary files differindex c9e8a11c1e..27bb1ac7d3 100644 --- a/macros/latex/contrib/csquotes/csquotes.pdf +++ b/macros/latex/contrib/csquotes/csquotes.pdf diff --git a/macros/latex/contrib/csquotes/csquotes.sty b/macros/latex/contrib/csquotes/csquotes.sty index 0a5cbb4e84..676afbb578 100644 --- a/macros/latex/contrib/csquotes/csquotes.sty +++ b/macros/latex/contrib/csquotes/csquotes.sty @@ -1,5 +1,5 @@ % Copyright (c) 2003-2011 Philipp Lehman. -% (c) 2015-2019,2021,2022 Joseph Wright. +% (c) 2015-2019,2021,2022,2024 Joseph Wright. % % Permission is granted to copy, distribute and/or modify this % software under the terms of the LaTeX Project Public License @@ -12,7 +12,7 @@ \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{csquotes} - [2022-09-14 v5.2n context-sensitive quotations (JAW)] + [2024-04-04 v5.2o context-sensitive quotations (JAW)] %% Compatibility and requirements @@ -1034,22 +1034,22 @@ % PDF strings -\long\def\csq@pdf@quote#1{% - \if#1*\relax +\long\def\csq@pdf@quote#1#{% + \if*#1\relax \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi {\csq@pdf@quote@ii} - {\csq@pdf@quote@i{#1}}} + {\csq@pdf@quote@i #1}} \long\def\csq@pdf@quote@i#1{% \csq@pdf@ooqmark #1\csq@pdf@coqmark} \long\def\csq@pdf@quote@ii#1{% \csq@pdf@oiqmark #1\csq@pdf@ciqmark} -\long\def\csq@pdf@fquote#1{% - \if#1*\relax +\long\def\csq@pdf@fquote#1#{% + \if*#1\relax \expandafter\@firstoftwo \else \expandafter\@secondoftwo diff --git a/macros/latex/contrib/csquotes/csquotes.tex b/macros/latex/contrib/csquotes/csquotes.tex index 97c6e2e3cc..74b7c93e1b 100644 --- a/macros/latex/contrib/csquotes/csquotes.tex +++ b/macros/latex/contrib/csquotes/csquotes.tex @@ -18,8 +18,8 @@ url={http://www.ctan.org/pkg/csquotes/}, author={Philipp Lehman, Joseph Wright}, email={joseph.wright@morningstar2.co.uk}, - revision={v5.2n}, - date={2022-09-14}} + revision={v5.2o}, + date={2024-04-04}} \hypersetup{% pdftitle={The csquotes Package}, @@ -158,6 +158,7 @@ This option controls multilingual support. It requires either the \sty{babel} pa latin & \raggedright italianguillemets, germanquotes, germanguillemets, britishquotes, americanquotes \tabularnewline latvian & \\ + lithuanian & \\ norwegian & guillemets, quotes \\ polish & guillemets, guillemets\* \\ portuguese & portuguese, brazilian \\ @@ -1554,8 +1555,14 @@ This revision history is a list of changes relevant to users of this package. Ch \begin{changelog} +\begin{release}{5.2o}{2024-04-04} +\item Correct detection of \texttt{*} at start of quotes in bookmarks +\item Added Lithuanian style +\item Fixed quoting in Dutch +\end{release} + \begin{release}{5.2n}{2022-09-14} -\item Furtehr work to localise font changes inside quotes +\item Further work to localise font changes inside quotes \end{release} \begin{release}{5.2m}{2022-09-09} diff --git a/macros/latex/contrib/customenvs/doc/customenvs-doc-en.pdf b/macros/latex/contrib/customenvs/doc/customenvs-doc-en.pdf Binary files differindex c4a06de15b..f1bf30aacc 100644 --- a/macros/latex/contrib/customenvs/doc/customenvs-doc-en.pdf +++ b/macros/latex/contrib/customenvs/doc/customenvs-doc-en.pdf diff --git a/macros/latex/contrib/customenvs/doc/customenvs-doc-en.tex b/macros/latex/contrib/customenvs/doc/customenvs-doc-en.tex index 4bc63e0c5f..b8352c628d 100644 --- a/macros/latex/contrib/customenvs/doc/customenvs-doc-en.tex +++ b/macros/latex/contrib/customenvs/doc/customenvs-doc-en.tex @@ -34,8 +34,8 @@ \usepackage[margin=1.5cm]{geometry} \setlength{\parindent}{0pt} -\def\TPversion{0.1.3} -\def\TPdate{30/03/2024} +\def\TPversion{0.1.4} +\def\TPdate{04/04/2024} \usepackage{tcolorbox} \sethlcolor{lightgray!25} \NewDocumentCommand\MontreCode{ m }{% @@ -111,6 +111,8 @@ \section{History} +\verb|v0.1.4|~:~~~~Create a SMS conversation + \verb|v0.1.3|~:~~~~Environment for exercise(s) (in french doc) \verb|v0.1.2|~:~~~~Pencil of skills @@ -357,7 +359,7 @@ The idea is to : \begin{itemize} \item present of list of categories and skills ; - \item prensented like a pencil. + \item presented like a pencil. \end{itemize} The code (within CC-BY-SA 4.0 license) is adapted from : @@ -420,4 +422,79 @@ The last argument, mandatory and between \MontreCode{(...)} give the list of cat Search/Skill 1\\Skill 2,Model/{Skill 1\\Skill 2}} \end{demohigh} +\pagebreak + +\section{SMS conversation} + +\subsection{Global use} + +The idea is to present a conversation of SMS. + +\begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25] +\begin{ChatSMS}[keys]{name} + \InSMS(*){time}{msg} + \OutSMS*(*){time}{msg} +\end{ChatSMS} +\end{codehigh} + +The style is globally fixed, but there's some customization available. + +\subsection{The environment} + +Available \MontreCode{keys} are : + +\begin{itemize} + \item \MontreCode{height} : height of the window (auto or specific) ; \MontreCode{auto} by default + \item \MontreCode{width} : width of the window ; \MontreCode{7cm} by default + \item \MontreCode{margin} : margin (L or R) for the bubble \MontreCode{1.5cm} by default + \item \MontreCode{color} : \textit{main} color (banner) ; \MontreCode{teal!75!cyan!75!white} by default ; + \item \MontreCode{colback} : color for background ; \MontreCode{lightgray!5} by default + \item \MontreCode{colorin} : color for incoming SMS ; \MontreCode{lime!25} by default + \item \MontreCode{colorout} : color for outcoming SMS ; \MontreCode{teal!25} by default + \item \MontreCode{writetxt} : text of sending zone ; \MontreCode{Write} by default + \item \MontreCode{fonttxt} : bubble's font ; \MontreCode{\textbackslash normalfont} by default + \item \MontreCode{avatar} : avatar of contact ; \MontreCode{\textbackslash faAddressCard} by default + \item \MontreCode{dispavatar} : boolean for displaying avatar near the bubbles ; \MontreCode{false} by default + \item \MontreCode{blackwhite} : boolean pour black\&white. \MontreCode{false} by default +\end{itemize} + +The argument, mandatory and between \MontreCode{(...)} give the name of the contact. + +\subsection{Macros for the bubbles} + +Regarding the bubble creation commands, \MontreCode{\textbackslash InSMS} and \MontreCode{\textbackslash OutSMS}: + +\begin{itemize} + \item the \textit{starred} version does not display the \textit{checkmarks} of \textit{good reception}; + \item the first mandatory argument is the time to display ; + \item the second mandatory argument is the message to display (including multi-lines). +\end{itemize} + +\subsection{Examples} + +\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25] +%with a personal image +\begin{ChatSMS}% + [width=6cm,fonttxt=\sffamily,height=10cm,avatar=img/android,dispavatar]{CP} + \InSMS{19:23}{Hi !} + \OutSMS{19:23}{Hi !\\ How are you ?} + \InSMS{19:25}{Just a problem with a math question\ldots} + \OutSMS{19:26}{Wanna help ??} + \InSMS{19:28}{Yes, I need to compute $\mathsf{\int_{0}^{1} x^2e^{-x}\,dx}$\ldots} + \OutSMS*{19:30}{Take care !!} +\end{ChatSMS} +\end{demohigh} + +\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25] +\begin{ChatSMS}% + [width=8cm,fonttxt=\sffamily,avatar=\faCanadianMapleLeaf,blackwhite]{CP} + \InSMS{19:23}{Hi !} + \OutSMS{19:23}{Hi !\\ How are you ?} + \InSMS{19:25}{Just a problem with a math question\ldots} + \OutSMS{19:26}{Wanna help ??} + \InSMS{19:28}{Yes, I need to compute $\mathsf{\int_{0}^{1} x^2e^{-x}\,dx}$\ldots} + \OutSMS*{19:30}{Take care !!} +\end{ChatSMS} +\end{demohigh} + \end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.pdf b/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.pdf Binary files differindex c81bd43b7f..87d7507f61 100644 --- a/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.pdf +++ b/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.pdf diff --git a/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.tex b/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.tex index 650bb37932..9cdaeadf73 100644 --- a/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.tex +++ b/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.tex @@ -39,9 +39,9 @@ \usepackage[margin=1.5cm]{geometry} \setlength{\parindent}{0pt} -\def\TPversion{0.1.3} -\def\TPdate{30 mars 2024} -\usepackage[most]{tcolorbox} +\def\TPversion{0.1.4} +\def\TPdate{4 avril 2024} +\usepackage{tcolorbox} \tcbuselibrary{listingsutf8} \newtcblisting{DemoCode}[1]{% enhanced,width=0.95\linewidth,center,% @@ -66,10 +66,10 @@ keywordstyle={\color{violet}},% classoffset=2,% alsoletter={-},% - morekeywords={\ReponsesQCM,MultiCols,\CreerListeItems,\ListeChoixItems,\TableauCompetences,\CrayonDeCompetences,\StyleEnvtExo,\StyleEnvtExoDefaut,\TitreExo,\ipsum},% + morekeywords={\ReponsesQCM,MultiCols,\CreerListeItems,\ListeChoixItems,\TableauCompetences,\CrayonDeCompetences,\StyleEnvtExo,\StyleEnvtExoDefaut,\TitreExo,\ipsum,EnvSMS,\SMSrec,\SMSenv},% keywordstyle={\color{green!50!black}},% classoffset=3,% - morekeywords={Largeur,Filets,EspacesCL,NbCols,Labels,PoliceLabels,EspaceLabels,Swap,Type,CoeffEspVert,EpTrait,Alea,LargeurNivs,Niveaux,NoticeNiveaux,Titre,PolTitre,PolNotice,PolComp,LigneSep,CouleurNotice,CouleurNiveaux,CouleurFond,Note,Notice,PoliceCateg,PoliceBloc,Couleurs,LargeurBloc,Echelle,NoirBlanc,Libelle,EpTrait,Police,Type,ComplementTitre,Titre,CodeDebut,Couleur,EchelleImage,Decoration,Trait},% + morekeywords={Largeur,Filets,EspacesCL,NbCols,Labels,PoliceLabels,EspaceLabels,Swap,Type,CoeffEspVert,EpTrait,Alea,LargeurNivs,Niveaux,NoticeNiveaux,Titre,PolTitre,PolNotice,PolComp,LigneSep,CouleurNotice,CouleurNiveaux,CouleurFond,Note,Notice,PoliceCateg,PoliceBloc,Couleurs,LargeurBloc,Echelle,NoirBlanc,Libelle,EpTrait,Police,Type,ComplementTitre,Titre,CodeDebut,Couleur,EchelleImage,Decoration,Trait,Avatar,AffAvatar,NoirBlanc,CouleurE,CouleurR,CouleurFond,Hauteur,Largeur,PoliceTxt,CouleurTitre},% keywordstyle={\color{orange}} },% #1 @@ -788,6 +788,88 @@ L'argument, obligatoire et entre \MontreCode{\{...\}} est la liste des catรฉgori \pagebreak +\section{Fenรชtre type conversation instantanรฉe} + +\subsection{Principe et fonctionnement} + +L'idรฉe est de proposer un environnement pour crรฉer une fenรชtre type \textit{conversation instantanรฉe}, basรฉe sur \MontreCode{tcolorbox}. + +\begin{DemoCode}{listing only} +\begin{EnvSMS}[Clรฉs]{nom} + \SMSrec(*){heure}{msg} + \SMSenv(*){heure}{msg} +\end{EnvSMS} +\end{DemoCode} + +\begin{DemoCode}{} +\begin{EnvSMS}{\LaTeX} + \SMSrec{19:23}{Salut !} + \SMSenv{19:23}{Salut!\\ Comment รงa va~?} +\end{EnvSMS} +\end{DemoCode} + +La forme gรฉnรฉrale est fixรฉe, et seuls quelques รฉlรฉments de personnalisation(s) sont modifiables. + +\subsection{L'environnement} + +Les \MontreCode{clรฉs} disponibles pour l'environnement, ร donner entre \MontreCode{[...]}, sont : + +\begin{itemize} + \item \MontreCode{Hauteur} : hauteur de la fenรชtre (automatique ou spรฉcifique) ; \MontreCode{auto} par dรฉfaut + \item \MontreCode{Largeur} : largeur de la fenรชtre (un minimum de 5 cm est conseillรฉ) ; \MontreCode{7cm} par dรฉfaut + \item \MontreCode{Marge} : marge (G ou D) pour les bulles \MontreCode{1.5cm} par dรฉfaut + \item \MontreCode{Couleur} : couleur \textit{principale} (bandeau) ; \MontreCode{teal!75!cyan!75!white} par dรฉfaut ; + \item \MontreCode{CouleurFond} : couleur du fond ; \MontreCode{lightgray!5} par dรฉfaut + \item \MontreCode{CouleurR} : couleur des bulles de rรฉception ; \MontreCode{lime!25} par dรฉfaut + \item \MontreCode{CouleurE} : couleur des bulles d'envoi ; \MontreCode{teal!5} par dรฉfaut + \item \MontreCode{TxtEcrire} : texte dans la zone d'envoi ; \MontreCode{รcrire} par dรฉfaut + \item \MontreCode{PoliceTxt} : police des textes ; \MontreCode{\textbackslash normalfont} par dรฉfaut + \item \MontreCode{Avatar} : avatar du contact ; \MontreCode{\textbackslash faAddressCard} par dรฉfaut + \item \MontreCode{AffAvatar} : boolรฉen pour ajouter l'avatar aux bulles de rรฉception ; \MontreCode{false} par dรฉfaut + \item \MontreCode{NoirBlanc} : boolรฉen pour forcer un affichage N\&B. \MontreCode{false} par dรฉfaut +\end{itemize} + +L'argument, obligatoire et entre \MontreCode{\{...\}}, est le nom du contact ร afficher. + +\subsection{Les commandes de crรฉation des bulles} + +En ce qui concerne les commandes de crรฉation des bulles, \MontreCode{\textbackslash SMSrec} et \MontreCode{\textbackslash SMSenv} : + +\begin{itemize} + \item la version \textit{รฉtoilรฉe} n'affiche pas les \textit{coches} de \textit{bonne rรฉception} ; + \item le premier argument obligatoire est l'heure ร afficher ; + \item le deuxiรจme argument obligatoire est le message ร afficher (y compris multi-lignes). +\end{itemize} + +\subsection{Exemples} + +\begin{DemoCode}{} +%avec une image personnelle +\begin{EnvSMS}% + [Largeur=5cm,Hauteur=13cm,AffAvatar,Avatar=Image/avatar]{CP} + \SMSrec{19:23}{Salut !} + \SMSenv{19:23}{Salut!\\ Comment รงa va~?} + \SMSrec{19:25}{Je n'arrive pas ร un truc en maths\ldots} + \SMSenv{19:26}{Tu veux un coup de main ??} + \SMSrec{19:28}{Oui, faut qu'je calcule $\int_{0}^{1} x^2e^{-x}\,dx$\ldots} + \SMSenv*{19:30}{Je m'en occupe !!} +\end{EnvSMS} +\end{DemoCode} + +\begin{DemoCode}{} +\begin{EnvSMS}% + [Largeur=8cm,PoliceTxt=\sffamily,NoirBlanc]{CP} + \SMSrec{19:23}{Salut !} + \SMSenv{19:23}{Salut!\\ Comment รงa va~?} + \SMSrec{19:25}{Je n'arrive pas ร un truc en maths\ldots} + \SMSenv{19:26}{Tu veux un coup de main ??} + \SMSrec{19:28}{Oui, faut que je calcule $\mathsf{\int_{0}^{1} x^2e^{-x}\,dx}$\ldots} + \SMSenv*{19:30}{Je m'en occupe !!} +\end{EnvSMS} +\end{DemoCode} + +\pagebreak + \section{Titre d'exercices} \subsection{Principe et dรฉfinition du style global} diff --git a/macros/latex/contrib/customenvs/doc/envtexo_exemples.tex b/macros/latex/contrib/customenvs/doc/envtexo_exemples.tex index bc9bf990f7..e782579dec 100644 --- a/macros/latex/contrib/customenvs/doc/envtexo_exemples.tex +++ b/macros/latex/contrib/customenvs/doc/envtexo_exemples.tex @@ -1,80 +1,80 @@ -% !TeX TXS-program:compile = txs:///arara -% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode} -% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') - -\documentclass[a5paper,11pt]{article} -\usepackage[margin=1cm]{geometry} -\usepackage{customenvs} -%facultatif, pour les dรฉcorations -\usepackage{graphicx} -\usepackage{dashrulex} -\usepackage{coloredbelts} -\usepackage{pictochrono} -%mise en page -\usepackage{ipsum} -\setlength{\parindent}{0pt} - -\begin{document} - -\begin{EnvtExo}%exo1 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Trait=pointilles]%exo2 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Trait=dashilles]%exo3 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Decoration=Icone/\faPython]%exo4 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Decoration=Ceinture/rouge]%exo5 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Decoration=Chrono/20]%exo6 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Decoration=Image/goku_ssj4]%exo7 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Decoration=Image/sseiya_shura]%exo8 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Decoration=Points/7]%exo9 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Type=Perso/{Titre perso }]%exo10 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\StyleEnvtExo[Couleur=red,Police=\bfseries\ttfamily,EpTrait=2pt,Libelle={Exercice nยฐ}] - -\begin{EnvtExo}[Decoration=Icone/\faAddressBook]%exo11 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\begin{EnvtExo}[Type=Perso/{Titre perso },Decoration=Chrono/25,Couleur=red,Trait=dashilles]%exo12 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\StyleEnvtExoDefaut - -\begin{EnvtExo}% - [Type=Perso/{Titre perso~},Decoration=Image/goku_ssj4,Trait=non,Compteur=false]%exo13 - \ipsum<Lang=FR,Type=sent> -\end{EnvtExo} - -\TitreExo[Type=Perso/{Annexe Exercice 3},Compteur=false,Decoration=Image/sseiya_aiolos]%exo14 - -\ipsum<Lang=FR,Type=sent> - -\end{document} +% !TeX TXS-program:compile = txs:///arara
+% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode}
+% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)')
+
+\documentclass[a5paper,11pt]{article}
+\usepackage[margin=1cm]{geometry}
+\usepackage{customenvs}
+%facultatif, pour les dรฉcorations
+\usepackage{graphicx}
+\usepackage{dashrulex}
+\usepackage{coloredbelts}
+\usepackage{pictochrono}
+%mise en page
+\usepackage{ipsum}
+\setlength{\parindent}{0pt}
+
+\begin{document}
+
+\begin{EnvtExo}%exo1
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Trait=pointilles]%exo2
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Trait=dashilles]%exo3
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Decoration=Icone/\faPython]%exo4
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Decoration=Ceinture/rouge]%exo5
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Decoration=Chrono/20]%exo6
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Decoration=Image/goku_ssj4]%exo7
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Decoration=Image/sseiya_shura]%exo8
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Decoration=Points/7]%exo9
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Type=Perso/{Titre perso }]%exo10
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\StyleEnvtExo[Couleur=red,Police=\bfseries\ttfamily,EpTrait=2pt,Libelle={Exercice nยฐ}]
+
+\begin{EnvtExo}[Decoration=Icone/\faAddressBook]%exo11
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\begin{EnvtExo}[Type=Perso/{Titre perso },Decoration=Chrono/25,Couleur=red,Trait=dashilles]%exo12
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\StyleEnvtExoDefaut
+
+\begin{EnvtExo}%
+ [Type=Perso/{Titre perso~},Decoration=Image/goku_ssj4,Trait=non,Compteur=false]%exo13
+ \ipsum<Lang=FR,Type=sent>
+\end{EnvtExo}
+
+\TitreExo[Type=Perso/{Annexe Exercice 3},Compteur=false,Decoration=Image/sseiya_aiolos]%exo14
+
+\ipsum<Lang=FR,Type=sent>
+
+\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/customenvs/tex/customenvs.sty b/macros/latex/contrib/customenvs/tex/customenvs.sty index 08083eb103..ee8f4427a2 100644 --- a/macros/latex/contrib/customenvs/tex/customenvs.sty +++ b/macros/latex/contrib/customenvs/tex/customenvs.sty @@ -3,9 +3,10 @@ % source pencil...: CC-BY-SA 4.0 https://tex.stackexchange.com/questions/504092/replicating-a-fancy-bordered-text-style-in-latex/504145#504145 \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{customenvs}[2024/03/30 0.1.3 Custom classic environments] +\ProvidesPackage{customenvs}[2024/04/04 0.1.4 Custom classic environments] %====HISTORIQUE +% v 0.1.4 Commande (en/fr) pour du texte dans une boรฎte arrondie, de hauteur 'figรฉe' + 'Chat' SMS % v 0.1.3 Environnement/Commande pour prรฉsentation d'un exercice % v 0.1.2 Crayon de compรฉtences % v 0.1.1 Ajout de tableaux de compรฉtences @@ -54,6 +55,8 @@ \RequirePackage{calc} \RequirePackage{tikz} \usetikzlibrary{decorations.pathmorphing,positioning,shapes.misc,calc} +\usepackage{tcolorbox} +\tcbuselibrary{skins} %%----COMMANDES FR @@ -913,6 +916,179 @@ \EnvtExoCodeAvant% } +%====BOITE ARRONDIE +\newlength{\tmpheightbox} +\defKV[BoiteArrondie]{EspH=\def\RoundedBoxDelta{#1},Style=\def\RoundedBoxStyle{#1}} +\setKVdefault[BoiteArrondie]{% + Fond=red,% + Texte=white,% + EspH=0.25em,% + Style=rect +} +\NewDocumentCommand\BoiteArrondie{ O{} m O{char} }{% + \restoreKV[BoiteArrondie]% + \setKV[BoiteArrondie]{#1}% + \settototalheight{\tmpheightbox}{\hbox{(EazertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN)#2}}%hauteur globale + \IfStrEqCase{\RoundedBoxStyle}{% + {rect}{\tikz[remember picture,baseline=(#3.base)]{\node[minimum height=\tmpheightbox,shape=rectangle,rounded corners=0.25em,fill={\useKV[BoiteArrondie]{Fond}},inner sep=0.75pt,outer sep=0pt,text={\useKV[BoiteArrondie]{Texte}}] (#3) {\vphantom{(qE)}\kern\RoundedBoxDelta#2\kern\RoundedBoxDelta};}}% + {cercle}{\tikz[remember picture,baseline=(#3.base)]{\node[shape=circle,minimum height=\tmpheightbox,fill={\useKV[BoiteArrondie]{Fond}},inner sep=0.75pt,outer sep=0pt,text={\useKV[BoiteArrondie]{Texte}}] (#3) {\vphantom{(qE)}#2};}}% + }\relax +} + +%%====Chat SMS + +%===Donnรฉes utiles +\newlength{\WidthofSMS} +\newlength{\HeightofSMS} +\newlength{\OffsetofSMS} +\newlength{\WidthofSMSavatar} +\newlength{\MarginofSMSavatar} +\colorlet{smscolp}{teal!75!cyan!75!white} +\colorlet{smscoltitle}{white} + +%===Styles [FR/EN] +\tcbset{SMSglobal/.style={ + enhanced,arc=0pt,outer arc=0pt,colback=\ProjectSmsColback,toptitle=0.3cm,bottomtitle=0.3cm,title={\null}, + overlay={ + %la barre de titre + \node[anchor=east,smscoltitle,font=\large] at ([xshift=-1mm]title.east) {\faVideo~~\faPhone*~~\faEllipsisV}; + \node[draw=none,anchor=west,inner sep=1pt,text=smscoltitle,font=\large] at ([xshift=1mm]title.west) (picture) {\ProjectSmsAvat}; + \node[draw=none,anchor=west,text=smscoltitle,font=\large,text depth=0pt,inner sep=1pt] at (picture.east) {\sffamily\bfseries\vphantom{pB}\NameofSMS} ; + %le bas + \draw[line width=0.85pt,darkgray] ([yshift=1cm]frame.south west) -- ([yshift=1cm]frame.south east); + \node[draw=smscolp!75!black,top color=lightgray!40,bottom color=lightgray!40,middle color=white,line width=1pt,rounded corners=2pt,text width={{\WidthofSMS-2.5cm}},minimum height=0.75cm,font=\large\ProjectSmsFonte,text=darkgray,inner xsep=6pt] at ([shift={(0,0.5cm)}]frame.south) {\textcolor{gray}{\rule[-0.1cm]{1pt}{0.5cm}}\,\ProjectSmsWrite}; + \node[draw=none,font=\LARGE,text=darkgray!50,anchor=east,align=center] at ([shift={(-1mm,0.5cm)}]frame.south east) (send) {\faPaperPlane}; + \node[draw=none,font=\LARGE,text=darkgray!50,anchor=west,align=center] at ([shift={(1mm,0.5cm)}]frame.south west) (add) {\faPlusCircle}; + }, + boxrule=0.85pt,colframe=darkgray, + title style={top color=smscolp!90!black,bottom color=smscolp!90!black,middle color=smscolp!75}, + bottom=1.15cm,top=0mm,left=1mm,right=1mm + } +} + +%===Keys [FR] +\defKV[ProjetSMS]{% + Hauteur=\def\ProjectSmsHeight{#1},% + Largeur=\setlength{\WidthofSMS}{#1},% + Marge=\setlength{\OffsetofSMS}{#1},% + Couleur=\colorlet{smscolp}{#1},% + CouleurFond=\def\ProjectSmsColback{#1},% + CouleurR=\def\ProjectSmsColIn{#1},% + CouleurE=\def\ProjectSmsColOut{#1},% + CouleurTitre=\colorlet{smscoltitle}{#1},% + PoliceTxt=\def\ProjectSmsFonte{#1},% + Avatar=\def\ProjectSmsAvatar{#1},% + TxtEcrire=\def\ProjectSmsWrite{#1} +} +\setKVdefault[ProjetSMS]{% + Hauteur=auto,% + Largeur=7cm,% + Marge=1.5cm,% + CouleurFond={lightgray!5},% + CouleurR=lime!25,% + CouleurE=teal!25,% + TxtEcrire={รcrire\ldots},% + PoliceTxt=\normalfont,% + Avatar=\faAddressCard,% + AffAvatar=false,% + NoirBlanc=false +} + +%===Envt [FR] +\NewDocumentEnvironment{EnvSMS}{ O{} m } +{ + \restoreKV[ProjetSMS]% + \setKV[ProjetSMS]{#1}% + \def\NameofSMS{#2}% + \IfSubStr{\ProjectSmsAvatar}{Image}% + {% + \StrBehind{\ProjectSmsAvatar}{/}[\tmpimgavatar]% + \def\ProjectSmsAvat{\includegraphics[height=0.5cm]{\tmpimgavatar}}% + \ifboolKV[ProjetSMS]{AffAvatar}% + {% + \setlength{\WidthofSMSavatar}{\widthof{\includegraphics[height=0.5\baselineskip]{\tmpimgavatar}}}% + \setlength{\MarginofSMSavatar}{\WidthofSMSavatar+2pt}% + }% + {% + \setlength{\MarginofSMSavatar}{0pt}% + }% + }% + {% + \def\ProjectSmsAvat{\ProjectSmsAvatar}% + \ifboolKV[ProjetSMS]{AffAvatar}% + {% + \setlength{\WidthofSMSavatar}{\widthof{\tiny\ProjectSmsAvatar}}% + \setlength{\MarginofSMSavatar}{\WidthofSMSavatar+2pt}% + }% + {% + \setlength{\MarginofSMSavatar}{0pt}% + }% + }% + \IfStrEq{\ProjectSmsHeight}{auto}% + {% + \tcbset{SMSsize/.style={width=\WidthofSMS}}% + }% + {% + \setlength{\HeightofSMS}{\ProjectSmsHeight}% + \tcbset{SMSsize/.style={width=\WidthofSMS,height=\HeightofSMS,valign=bottom}}% + }% + \ifboolKV[ProjetSMS]{NoirBlanc}% + {% + \colorlet{smscolp}{lightgray!25}% + \def\ProjectSmsColback{lightgray!5}% + \def\ProjectSmsColIn{lightgray!10}% + \def\ProjectSmsColOut{lightgray!10}% + \colorlet{smscoltitle}{gray}% + }% + {}% + \tcolorbox[SMSsize,SMSglobal]% +} +{ + \endtcolorbox% +} + +%===Macros [FR] +\NewDocumentCommand\SMSrec{ s m m }{% + \ifboolKV[ProjetSMS]{AffAvatar}% + {% + \IfSubStr{\ProjectSmsAvatar}{Image}% + {% + \tcbset{SMSAffLogo/.style={left skip=\MarginofSMSavatar,overlay={\node[anchor=north east] at ([yshift={1mm+1pt}]interior.north west) {\includegraphics[height=0.5\baselineskip]{\tmpimgavatar}};}}}% + }% + {% + \tcbset{SMSAffLogo/.style={left skip=\MarginofSMSavatar,overlay={\node[anchor=north east,font=\tiny,text=gray] at ([yshift={1mm+1pt}]interior.north west) {\ProjectSmsAvatar};}}}% + }% + }% + {% + \tcbset{SMSAffLogo/.style={}}% + }% + \tcbox[enhanced,interior code={},before skip=0.5mm,after skip=0.5mm,halign=left,left=1.5mm,right=1.5mm, + frame code={ + \filldraw[\ProjectSmsColIn,draw=black,rounded corners=4pt] + (frame.south east) rectangle (frame.north west) ; + }, + width={\WidthofSMS-\OffsetofSMS},top=1mm,bottom=1mm, + capture=minipage,fontupper=\small\ProjectSmsFonte, + attach boxed title to top left, + coltitle=black,fonttitle=\scriptsize\sffamily, + boxed title style={size=fbox,bottom=0pt,boxsep=2pt,frame empty,interior empty}, + title={\@ifpackageloaded{babel}{\NoAutoSpacing#2}{#2}\IfBooleanTF{#1}{$\cdot$\scalebox{0.6}[0.6]{\faCheckCircle[regular]\!\faCheckCircle[regular]}~}{}},left=1mm,right=1mm,boxsep=0mm,SMSAffLogo]{#3}% +} +\NewDocumentCommand\SMSenv{ s m m }{% + \tcbox[enhanced,interior code={},before skip=0.5mm,after skip=0.5mm,halign=left,left=1.5mm,right=1.5mm, + frame code={ + \filldraw[\ProjectSmsColOut,draw=black,rounded corners=4pt] + (frame.south east) rectangle (frame.north west) ; + }, + width={\WidthofSMS-\OffsetofSMS},top=1mm,bottom=1mm,flush right, + capture=minipage,fontupper=\small\ProjectSmsFonte, + attach boxed title to top right, + coltitle=black,fonttitle=\scriptsize\sffamily, + boxed title style={size=fbox,bottom=0pt,boxsep=2pt,frame empty,interior empty}, + title={\@ifpackageloaded{babel}{\NoAutoSpacing#2}{#2}\IfBooleanTF{#1}{}{$\cdot$\scalebox{0.6}[0.6]{\faCheckCircle[regular]\!\faCheckCircle[regular]}~}},left=1mm,right=1mm,boxsep=0mm]{#3}% +} + + %%----COMMANDES EN %====QCMs @@ -1169,4 +1345,149 @@ \end{tikzpicture}% } +%====ROUNDED BOX +\defKV[RoundedBox]{hmargin=\def\RoundedBoxDelta{#1},style=\def\RoundedBoxStyle{#1}} +\setKVdefault[RoundedBox]{% + bg=red,% + txt=white,% + hmargin=0.25em,% + style=rect +} + + + +\NewDocumentCommand\RoundedBox{ O{} m O{char} }{% + \restoreKV[RoundedBox]% + \setKV[RoundedBox]{#1}% + \settototalheight{\tmpheightbox}{\hbox{(EazertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN)#2}}%hauteur globale + \IfStrEqCase{\RoundedBoxStyle}{% + {rect}{\tikz[remember picture,baseline=(#3.base)]{\node[minimum height=\tmpheightbox,shape=rectangle,rounded corners=0.25em,fill={\useKV[RoundedBox]{bg}},inner sep=0.75pt,outer sep=0pt,text={\useKV[RoundedBox]{txt}}] (#3) {\vphantom{(qE)}\kern\RoundedBoxDelta#2\kern\RoundedBoxDelta};}}% + {circle}{\tikz[remember picture,baseline=(#3.base)]{\node[minimum height=\tmpheightbox,shape=circle,fill={\useKV[RoundedBox]{bg}},inner sep=0.75pt,outer sep=0pt,text={\useKV[RoundedBox]{txt}}] (#3) {\vphantom{(qE)}#2};}}% + }\relax +} + +%====Chat SMS +%===Keys [EN] +\defKV[ProjectSMS]{% + height=\def\ProjectSmsHeight{#1},% + width=\setlength{\WidthofSMS}{#1},% + margin=\setlength{\OffsetofSMS}{#1},% + color=\colorlet{smscolp}{#1},% + colback=\def\ProjectSmsColback{#1},% + colorin=\def\ProjectSmsColIn{#1},% + colorout=\def\ProjectSmsColOut{#1},% + coltitle=\colorlet{smscoltitle}{#1},% + fonttxt=\def\ProjectSmsFonte{#1},% + avatar=\def\ProjectSmsAvatar{#1},% + writetxt=\def\ProjectSmsWrite{#1} +} +\setKVdefault[ProjectSMS]{% + height=auto,% + width=7cm,% + margin=1.5cm,% + colback=lightgray!5,% + colorin=lime!25,% + colorout=teal!25,% + writetxt={Write\ldots},% + fonttxt=\normalfont,% + avatar=\faAddressCard,% + dispavatar=false,% + blackwhite=false +} + +%===Envt [EN] +\NewDocumentEnvironment{ChatSMS}{ O{} m } +{ + \restoreKV[ProjectSMS]% + \setKV[ProjectSMS]{#1}% + \def\NameofSMS{#2}% + \IfSubStr{\ProjectSmsAvatar}{img}% + {% + \StrBehind{\ProjectSmsAvatar}{/}[\tmpimgavatar]% + \def\ProjectSmsAvat{\includegraphics[height=0.5cm]{\tmpimgavatar}}% + \ifboolKV[ProjectSMS]{dispavatar}% + {% + \setlength{\WidthofSMSavatar}{\widthof{\includegraphics[height=0.5\baselineskip]{\tmpimgavatar}}}% + \setlength{\MarginofSMSavatar}{\WidthofSMSavatar+2pt}% + }% + {% + \setlength{\MarginofSMSavatar}{0pt}% + }% + }% + {% + \def\ProjectSmsAvat{\ProjectSmsAvatar}% + \ifboolKV[ProjectSMS]{dispavatar}% + {% + \setlength{\WidthofSMSavatar}{\widthof{\tiny\ProjectSmsAvatar}}% + \setlength{\MarginofSMSavatar}{\WidthofSMSavatar+2pt}% + }% + {% + \setlength{\MarginofSMSavatar}{0pt}% + }% + }% + \IfStrEq{\ProjectSmsHeight}{auto}% + {% + \tcbset{SMSsize/.style={width=\WidthofSMS}}% + }% + {% + \setlength{\HeightofSMS}{\ProjectSmsHeight}% + \tcbset{SMSsize/.style={width=\WidthofSMS,height=\HeightofSMS,valign=bottom}}% + }% + \ifboolKV[ProjectSMS]{blackwhite}% + {% + \colorlet{smscolp}{lightgray!25}% + \def\ProjectSmsColback{lightgray!5}% + \def\ProjectSmsColIn{lightgray!10}% + \def\ProjectSmsColOut{lightgray!10}% + \colorlet{smscoltitle}{gray}% + }% + {}% + \tcolorbox[SMSsize,SMSglobal]% +} +{ + \endtcolorbox% +} + +%===Macros [EN] +\NewDocumentCommand\InSMS{ s m m }{% + \ifboolKV[ProjectSMS]{dispavatar}% + {% + \IfSubStr{\ProjectSmsAvatar}{img}% + {% + \tcbset{SMSAffLogo/.style={left skip=\MarginofSMSavatar,overlay={\node[anchor=north east] at ([yshift={1mm+1pt}]interior.north west) {\includegraphics[height=0.5\baselineskip]{\tmpimgavatar}};}}}% + }% + {% + \tcbset{SMSAffLogo/.style={left skip=\MarginofSMSavatar,overlay={\node[anchor=north east,font=\tiny,text=gray] at ([yshift={1mm+1pt}]interior.north west) {\ProjectSmsAvatar};}}}% + }% + }% + {% + \tcbset{SMSAffLogo/.style={}}% + }% + \tcbox[enhanced,interior code={},before skip=0.5mm,after skip=0.5mm,halign=left,left=1.5mm,right=1.5mm, + frame code={ + \filldraw[\ProjectSmsColIn,draw=black,rounded corners=4pt] + (frame.south east) rectangle (frame.north west) ; + }, + width={\WidthofSMS-\OffsetofSMS},top=1mm,bottom=1mm, + capture=minipage,fontupper=\small\ProjectSmsFonte, + attach boxed title to top left, + coltitle=black,fonttitle=\scriptsize\sffamily, + boxed title style={size=fbox,bottom=0pt,boxsep=2pt,frame empty,interior empty}, + title={#2\IfBooleanTF{#1}{$\cdot$\scalebox{0.6}[0.6]{\faCheckCircle[regular]\!\faCheckCircle[regular]}~}{}},left=1mm,right=1mm,boxsep=0mm,SMSAffLogo]{#3}% +} +\NewDocumentCommand\OutSMS{ s m m }{% + \tcbox[enhanced,interior code={},before skip=0.5mm,after skip=0.5mm,halign=left,left=1.5mm,right=1.5mm, + frame code={ + \filldraw[\ProjectSmsColOut,draw=black,rounded corners=4pt] + (frame.south east) rectangle (frame.north west) ; + }, + width={\WidthofSMS-\OffsetofSMS},top=1mm,bottom=1mm,flush right, + capture=minipage,fontupper=\small\ProjectSmsFonte, + attach boxed title to top right, + coltitle=black,fonttitle=\scriptsize\sffamily, + boxed title style={size=fbox,bottom=0pt,boxsep=2pt,frame empty,interior empty}, + title={#2\IfBooleanTF{#1}{}{$\cdot$\scalebox{0.6}[0.6]{\faCheckCircle[regular]\!\faCheckCircle[regular]}~}},left=1mm,right=1mm,boxsep=0mm]{#3}% +} + + \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/rectopma/README.txt b/macros/latex/contrib/rectopma/README.txt new file mode 100644 index 0000000000..7fe99006d6 --- /dev/null +++ b/macros/latex/contrib/rectopma/README.txt @@ -0,0 +1,29 @@ + + +This file is README.txt for the rectopma package. +Current version : [2024/04/04] +Author: Battista Benciolini <benciolinibattista at gmail dot com> + + +The distribution includes: + + README.txt this file + rectopma.dtx a self extracting and self documenting file + rectopma.sty the package + rectopma.pdf the complete and formatted documentation + TestTitle.tex a minimal example of the usage of the package (source) + TestTitle.pdf a minimal example of the usage of the package (formatted) + + +pdflatex rectopma.dtx creates rectopma.pdf, rectopma.sty and TestTitle.tex +pdflatex TestTitle creates TestTitle.pdf + +tested with TeX-live 2024 + +This program may be used, distributed and modified under +the conditions of the LaTeX Project Public License +see:http://www.latex-project.org/lppl.txt + + +===================== END of README file ====================== + diff --git a/macros/latex/contrib/rectopma/TestTitle.pdf b/macros/latex/contrib/rectopma/TestTitle.pdf Binary files differindex 55cd5861cd..ba73f8c96b 100644 --- a/macros/latex/contrib/rectopma/TestTitle.pdf +++ b/macros/latex/contrib/rectopma/TestTitle.pdf diff --git a/macros/latex/contrib/rectopma/TestTitle.tex b/macros/latex/contrib/rectopma/TestTitle.tex deleted file mode 100644 index 9ec54d5bf8..0000000000 --- a/macros/latex/contrib/rectopma/TestTitle.tex +++ /dev/null @@ -1,56 +0,0 @@ -% THIS IS BOTH A MINIMAL USER-MANUAL -% OF THE PACKAGE rectopma.sty -% AND AN EXAMPLE OF ITS USE -% -% File : TestTitle.tex -% Author: Battista Benciolini -% E-mail: <Battista.Benciolini@ing.unitn.it> -% Date : January 2002 -% See file rectopma.sty for more information -% -\documentclass[a4paper,10pt]{article} -\usepackage{rectopma} -% -\date{ } -\title{Test of the package \texttt{rectopma} \intitlebreak and -suggestions for its use \intitlebreakvs (I need a long title)\thanks{ -Comments are welcome !}} -\author{B.Benciolini\thanks{e-mail: battista.benciolini@ing.uitn.it} -\and No Second Author\thanks{No-Where Institute}} -% -\SaveTopMatter -% -\begin{document} -\maketitle -% -\section{Introduction} -The package \verb+rectopma+ makes it possible to reuse the main -content of \verb+\title+ and \verb+\author+ in different parts of a -document. -It is also possible to force linebreaks in the title with a command -that is only active inside the top-matter, not when the title is -re-printed elsewhere. -% -\section{Instruction} -The new commands \verb+\intitlebreak+ and \verb+\intitlebreakvs+ -(vs= vertical skip) are used to force a line break in the title -that disappears when the title itself is re-used outside the top matter -of the paper. -The content of \verb+\title+ and \verb+\author+ must be saved with the -command \verb+\SaveTopMatter+ before the action of \verb+\maketitle+ -and can be reprinted with the new commands \verb+\SavedAuthor+ -and \verb+\SavedTitle+. When they are reprinted the names of the -various authors are simply separated by commas and the content of -\verb+\thanks+ is ignored. -% -\section{Examples} -The authors of this paper are listed here after: \SavedAuthor. This -is obtained with \verb+\SavedAuthor+. It is also possible to reprint -the title, by means of \verb+\SavedTitle+, and the result is: -\SavedTitle. The title can be printed with a different style, as in: -\textbf{\SavedTitle}, obtained with \verb+\textbf{\SavedTitle}+. -% -\end{document} -\endinput -% -% End of file TestPaper.tex diff --git a/macros/latex/contrib/rectopma/rectopma.dtx b/macros/latex/contrib/rectopma/rectopma.dtx new file mode 100644 index 0000000000..aadfbe1da6 --- /dev/null +++ b/macros/latex/contrib/rectopma/rectopma.dtx @@ -0,0 +1,219 @@ +%\iffalse +% file: rectopma.dtx +% author: Battista Benciolini +% contact: benciolinibattista at gmail dot com +% date: 2024-04-04 +%\fi +%\iffalse +%<*ins> +\begingroup +\input docstrip.tex +\keepsilent +\preamble +---------------------------------------------------------------- +This file is part of the distribution of rectopma [2024-04-04] +The author of rectopma is Battista Benciolini +<benciolinibattista at gmail dot com > +---------------------------------------------------------------- +This program may be used, distributed and modified under +the conditions of the LaTeX Project Public License. +(see: http://www.latex-project.org/lppl.txt) +---------------------------------------------------------------- +\endpreamble +\askforoverwritefalse +\generate{\file{rectopma.sty}{\from{rectopma.dtx}{package}}} +\generate{\file{TestTitle.tex}{\from{rectopma.dtx}{example}}} +\endgroup +%</ins> +%\fi +%\iffalse +%<*driver> +\documentclass[a4paper,10pt]{ltxdoc} +\title{The \texttt{rectopma} package: +\\ recicle top matter, i.e. +\\ reuse the title and author(s)} +\author{Battista Benciolini +\thanks{e-mail: benciolinibattista at gmail dot com}} +\begin{document} +\maketitle +\DocInput{rectopma.dtx} +\end{document} +%</driver> +%\fi +% +%\section{Introduction} +% The package |rectopma| makes it possible to reuse the main +% content of |\title| and |\author| in different parts of a +% document. It is also possible to force linebreaks in the title with +% a command that has no effect +% when the title is re-printed. +% The file |TestTitle.tex| is an example of the use +% of the functions made available by the package. +% +% +%\iffalse +%<*example> +%\fi +%\section{Suggestions for the use and an example} +% +% I first present the suggestions for the use of |rectopma.sty| +% and the example that will be available in |TestTitle.tex| +% The example must obviously start loading the class (I use article) +% and the package rectopma +% \begin{macrocode} +\documentclass{article} +\usepackage{rectopma} +% \end{macrocode} +% +% In the preamble I define the title and the authors. +% The authors must be separated by |\and|. Title and authors +% can have a note using |\thanks|, and the note will disappear when +% the title and the author will be reused. +% When a long title is present it is +% \DescribeMacro{\intitlebreak} +% \DescribeMacro{\intitlebreakvs} +% perhaps useful to force linebreaks in some special position. +% The new commands |\intitlebreak| and |\intitlebreakvs| +% (vs= vertical skip) are used for this purpose, and their effect +% will disappears when the title itself is re-used in the document. +% \begin{macrocode} +\title{Test of the package \texttt{rectopma} +\intitlebreak and suggestions for its use +\intitlebreakvs (I need a long title)% +\thanks{Comments are welcome !}} +\author{Battista Benciolini% +\thanks{e-mail: benciolinibattista at gmail dot com}% +\and No Second Author\thanks{No-Where Institute}}% +% \end{macrocode} +% +%\par +% The main part of the document starts as usual. +% The command \DescribeMacro{\SaveTopMatter} |\SaveTopMatter| +% must be used before |maketitle| to save the title and the author(s). +% +% \begin{macrocode} +\begin{document} +\SaveTopMatter +\maketitle +% \end{macrocode} +% +% The title and the authors can be reprinted with the commands +% \DescribeMacro{\SavedTitle} \DescribeMacro{\SavedAuthor} +%|\SavedTitle| and |\SavedAuthor|. When they are +% reprinted the names of the various authors are simply separated +% by commas and the content of |\thanks| is ignored. +% +% \begin{macrocode} +The authors are listed here after: \SavedAuthor. +This is obtained with \verb|\SavedAuthor|. +It is also possible to reprint the title, +by means of \verb|\SavedTitle|, +and the result is: \SavedTitle. +% \end{macrocode} +% +% And this is the end of the example. +% \begin{macrocode} +\end{document} +% \end{macrocode} +% +%\iffalse +%</example> +%<*package> +%\fi +%\section{Code of the package} +% +% \begin{macrocode} +\ProvidesPackage{rectopma}[2024/04/04] +% \end{macrocode}% +% +% \begin{macro}{\declarecommand} +% I need |\declarecommand| ! +% The definition is due to egreg in +% a comment to question 128797 in |tex.stackexchange.com|. +% \begin{macrocode} +\newcommand\declarecommand[1]{\providecommand{#1}{}\renewcommand{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intitlebreak} +% The command |\intitlebreak| is used to force a line break in the title. +% \begin{macrocode} +\newcommand{\intitlebreak}{\\} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\intitlebreakvs} +% The comman |\intitlebreakvs| (vs= vertical skip) +% produces a line break and a vertical skip. +% \begin{macrocode} +\newcommand{\intitlebreakvs}{\\ \vskip 4mm } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@outsidetitle} +% The commands |\intitlebreak|, |\intitlebreakvs|, +% |\and| and |\thanks| need a redefinition for the +% correct output of title and authors in a generic +% position in the document. +% The redefinition is operated by the command |\@outsidetitle|. +% (I follow the old tradition of inserting a |@| in the +% commands that are of internal use, not available to the user.) +% \begin{macrocode} +\newcommand{\@outsidetitle}{% +\renewcommand{\intitlebreak}{\relax}% +\renewcommand{\intitlebreakvs}{\relax}% +\declarecommand{\thanks}[1]{\relax}% +\declarecommand{\and}{\unskip,\ }}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SaveTopMatter} +% The new command |\SaveTopMatter| saves the contents of |\@title| +% and |\@author| in |\@SavedTitle| and |\@SavedAuthor| respectively, +% so that they can be re-used anywhere in the document. +% \begin{macrocode} +\newcommand{\SaveTopMatter}{% +\global\let\@SavedTitle\@title% +\global\let\@SavedAuthor\@author} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SavedTitle} +% The command |\SavedTitle| +% actually prints the title. +% \begin{macrocode} +\newcommand{\SavedTitle}{\@outsidetitle\@SavedTitle} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SavedAuthor} +% The command |\SavedAuthor| +% actually prints the authors. +% \begin{macrocode} +\newcommand{\SavedAuthor}{\@outsidetitle\@SavedAuthor} +% \end{macrocode} +% \end{macro} +% +% The package is now complete. +% +%\iffalse +%</package> +%\fi +%\section{History} +%\begin{description} +%\item[2002] first release in CTAN, +%\item[2024] second release in CTAN, +% complete re-coding of |rectopma.sty|, +% some changes in |TestTitle.sty|, +% new documentation, +% all stuff collected in |rectopma.dtx|. +%\end{description} +%\section{Recommendation} +% I recommend all the users of |rectopma|, and all the +% persons that by chance encounter it, +% to send me any comment about it. +% \vfill\centerline{\Large ***}\vfill +% +%\iffalse +% END OF FILE rectopma.dtx +%\fi diff --git a/macros/latex/contrib/rectopma/rectopma.pdf b/macros/latex/contrib/rectopma/rectopma.pdf Binary files differnew file mode 100644 index 0000000000..b1a89c3382 --- /dev/null +++ b/macros/latex/contrib/rectopma/rectopma.pdf diff --git a/macros/latex/contrib/rectopma/rectopma.sty b/macros/latex/contrib/rectopma/rectopma.sty deleted file mode 100644 index ec5fd8593a..0000000000 --- a/macros/latex/contrib/rectopma/rectopma.sty +++ /dev/null @@ -1,88 +0,0 @@ -\ProvidesPackage{rectopma}[2002/01/07] -%************************************************* -%* * -%* This file is * -%* * -%* rectopma.sty * -%* ------------- * -%* * -%* RECycling TOp MAtter * -%* * -%* Version : January 5, 2002 * -%* * -%* Author: Battista Benciolini * -%* * -%* Address: Dip. Ing. Civile e Ambientale * -%* Via Mesiano, 77 * -%* I-38050 Trento * -%* ITALY * -%* * -%* e-mail: Battista.Benciolini@ing.unitn.it * -%* * -%************************************************* -% -% -% PURPOSE -% ======= -% -% This package allows the re-use of the main content -% of \title and \author anywhere in the document. -% -% IMPORTANT NOTES -% =============== -% -% 1 - This file is part of a program (in the meaning specified -% by the LPPL) that includes two files posted in the same -% folder: -% - rectopma.sty (= this file) -% - TestTitle.tex (= sample and suggestions) -% 2 - This program may be used, distributed and/or modified under -% the conditions of the LaTeX Project Public License. -% The latest version of this license is in: -% http://www.latex-project.org/lppl.txt -% -% HISTORY -% ======= -% -% (The mechanism implemented here have been originally -% encoded in others packages) -% -% January 2002 : first version -% -% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -% -% -% The new if \ifintitle is used to govern the different format of -% author and title when used in the top matter and when used -% anywhere else. -% (At present it is used only for intitlebreak and intitlebreakvs) -\newif\ifintitle \intitlefalse -% -% The commands \intitlebreak and \intitlebreakvs (vs= vertical skip) -% are used to force a line break in the title that disappears when -% the title itself is re-used outside the top matter of the paper. -\newcommand{\intitlebreak}{\ifintitle \\ \else\relax\fi} -\newcommand{\intitlebreakvs}{\ifintitle \vskip 1mm \else\relax\fi} -% -% The redefinition of \@maketitle includes -% the ON-OFF settings of \ifintitle -\let\OLD@maketitle\@maketitle -\def\@maketitle{\intitletrue\OLD@maketitle\intitlefalse} -% -% The redefinition of maketitle rebuilds -% \and to be a generic separator -% \thanks to do nothing (but it must have an argument) -\global\let\OLDmaketitle\maketitle -\gdef\maketitle{\OLDmaketitle -\gdef\and{\unskip,\ } -\gdef\thanks##1{\relax}} -% -% the new command \SaveTopMatter saves the contents of \@title and -% \@author in \SavedTitle and \SavedAuthor respectively, so that they -% can be re-used anywhere in the document. -\newcommand{\SaveTopMatter}{ -\global\let\SavedTitle\@title -\global\let\SavedAuthor\@author} -% -% -% end end end diff --git a/macros/luatex/generic/luamplib/NEWS b/macros/luatex/generic/luamplib/NEWS index 2bc44d4d0e..aaa0eae0a2 100644 --- a/macros/luatex/generic/luamplib/NEWS +++ b/macros/luatex/generic/luamplib/NEWS @@ -1,5 +1,14 @@ History of the luamplib package +2024/04/04 2.27.2 + * for warning/info/error messages we now use our own lua function, + instead of ltluatex's. As a result, mplib's multi-line messages are + printed as they are with no module name prepended to each line. + * terminal messages are now much conciser than before, printing only + the most relevant part. + * mplibcode which has no figure output does not print a warning, but + just an info to the log. + 2024/03/29 2.27.1 * fix a bug regarding local textext boxes diff --git a/macros/luatex/generic/luamplib/luamplib.dtx b/macros/luatex/generic/luamplib/luamplib.dtx index 7c8bdd97f5..24408cd3b2 100644 --- a/macros/luatex/generic/luamplib/luamplib.dtx +++ b/macros/luatex/generic/luamplib/luamplib.dtx @@ -85,7 +85,7 @@ See source file '\inFileName' for licencing and contact information. %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{luamplib.drv}% - [2024/03/29 v2.27.1 Interface for using the mplib library]% + [2024/04/04 v2.27.2 Interface for using the mplib library]% \documentclass{ltxdoc} \usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace} \usepackage[x11names]{xcolor} @@ -153,7 +153,7 @@ See source file '\inFileName' for licencing and contact information. % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\ % Maintainer: LuaLaTeX Maintainers --- % Support: \email{lualatex-dev@tug.org}} -% \date{2024/03/29 v2.27.1} +% \date{2024/04/04 v2.27.2} % % \maketitle % @@ -189,7 +189,7 @@ See source file '\inFileName' for licencing and contact information. % \begin{itemize} % \item a \LaTeX\ environment % \item all \TeX\ macros start by |mplib| -% \item use of luatexbase for errors, warnings and declaration +% \item use of our own function for errors, warnings and informations % \item possibility to use |btex ... etex| to typeset \TeX\ code. % |textext()| is a more versatile macro equivalent to |TEX()| from TEX.mp. % |TEX()| is also allowed and is a synomym of |textext()|.\par\smallskip @@ -455,23 +455,11 @@ See source file '\inFileName' for licencing and contact information. luatexbase.provides_module { name = "luamplib", - version = "2.27.1", - date = "2024/03/29", + version = "2.27.2", + date = "2024/04/04", description = "Lua package to typeset Metapost with LuaTeX's MPLib.", } -local format, abs = string.format, math.abs - -local err = function(...) - return luatexbase.module_error ("luamplib", format(...)) -end -local warn = function(...) - return luatexbase.module_warning("luamplib", format(...)) -end -local info = function(...) - return luatexbase.module_info ("luamplib", format(...)) -end - % \end{macrocode} % % Use the |luamplib| namespace, since |mplib| is for the metapost library @@ -480,6 +468,41 @@ end luamplib = luamplib or { } local luamplib = luamplib +local format, abs = string.format, math.abs + +% \end{macrocode} +% +% Use our own function for warn/info/err. +% \begin{macrocode} +local function termorlog (target, text, kind) + if text then + local mod, write, append = "luamplib", texio.write_nl, texio.write + kind = kind + or target == "term" and "Warning (more info in the log)" + or target == "log" and "Info" + or target == "term and log" and "Warning" + or "Error" + target = kind == "Error" and "term and log" or target + local t = text:explode"\n+" + write(target, format("Module %s %s:", mod, kind)) + if #t == 1 then + append(target, format(" %s", t[1])) + else + for _,line in ipairs(t) do + write(target, line) + end + write(target, format("(%s) ", mod)) + end + append(target, format(" on input line %s", tex.inputlineno)) + write(target, "") + if kind == "Error" then error() end + end +end + +local warn = function(...) termorlog("term and log", format(...)) end +local info = function(...) termorlog("log", format(...)) end +local err = function(...) termorlog("error", format(...)) end + luamplib.showlog = luamplib.showlog or false % \end{macrocode} @@ -762,8 +785,27 @@ local preamble = [[ input %s ; ]] -local logatload -local function reporterror (result, indeed) +% \end{macrocode} +% +% |plain| or |metafun|, +% though we cannot support |metafun| format fully. +% \begin{macrocode} +local currentformat = "plain" +local function setformat (name) + currentformat = name +end +luamplib.setformat = setformat + +% \end{macrocode} +% +% v2.9 has introduced the concept of ``code inherit'' +% \begin{macrocode} +luamplib.codeinherit = false + +local mplibinstances = {} +local instancename + +local function reporterror (result, prevlog) if not result then err("no result object returned") else @@ -775,31 +817,32 @@ local function reporterror (result, indeed) local log = l or t or "no-term" log = log:gsub("%(Please type a command or say `end'%)",""):gsub("\n+","\n") if result.status > 0 then - warn(log) + local first = log:match"(.-\n! .-)\n! " + if first then + termorlog("term", first) + termorlog("log", log, "Warning") + else + warn(log) + end if result.status > 1 then err(e or "see above messages") end - elseif indeed then - local log = logatload..log + elseif prevlog then + log = prevlog..log % \end{macrocode} % % v2.6.1: now luamplib does not disregard |show| command, % even when |luamplib.showlog| is false. Incidentally, -% it does not raise error but just prints a warning, +% it does not raise error but just prints an info, % even if output has no figure. % \begin{macrocode} - if log:find"\n>>" then - warn(log) - elseif log:find"%g" then - if luamplib.showlog then - info(log) - elseif not result.fig then - info(log) - end + local show = log:match"\n>>? .+" + if show then + termorlog("term", show, "Info (more info in the log)") + info(log) + elseif luamplib.showlog and log:find"%g" then + info(log) end - logatload = "" - else - logatload = log end return log end @@ -836,59 +879,21 @@ local function luamplibload (name) if luamplib.textextlabel then preamble = preamble .. luamplib.textextlabelpreamble end - local result + local result, log if not mpx then result = { status = 99, error = "out of memory"} else result = mpx:execute(format(preamble, replacesuffix(name,"mp"))) end - reporterror(result) - return mpx, result -end - -% \end{macrocode} -% -% |plain| or |metafun|, -% though we cannot support |metafun| format fully. -% \begin{macrocode} -local currentformat = "plain" - -local function setformat (name) - currentformat = name + log = reporterror(result) + return mpx, result, log end -luamplib.setformat = setformat % \end{macrocode} % % Here, excute each |mplibcode| data, % ie |\begin{mplibcode} ... \end{mplibcode}|. % \begin{macrocode} -local function process_indeed (mpx, data) - local converted, result = false, {} - if mpx and data then - result = mpx:execute(data) - local log = reporterror(result, true) - if log then - if result.fig then - converted = luamplib.convert(result) - else - warn("No figure output. Maybe no beginfig/endfig") - end - end - else - err("Mem file unloadable. Maybe generated with a different version of mplib?") - end - return converted, result -end - -% \end{macrocode} -% -% v2.9 has introduced the concept of ``code inherit'' -% \begin{macrocode} -luamplib.codeinherit = false -local mplibinstances = {} -local instancename - local function process (data) % \end{macrocode} % @@ -900,25 +905,41 @@ local function process (data) % end % \end{verbatim} % \begin{macrocode} - local defaultinstancename = currentformat .. (luamplib.numbersystem or "scaled") - .. tostring(luamplib.textextlabel) .. tostring(luamplib.legacy_verbatimtex) - local currfmt = instancename or defaultinstancename - if #currfmt == 0 then - currfmt = defaultinstancename + local currfmt + if instancename and instancename ~= "" then + currfmt = instancename + else + currfmt = currentformat..(luamplib.numbersystem or "scaled") + ..tostring(luamplib.textextlabel)..tostring(luamplib.legacy_verbatimtex) end local mpx = mplibinstances[currfmt] local standalone = false - if currfmt == defaultinstancename then + if currfmt ~= instancename then standalone = not luamplib.codeinherit end if mpx and standalone then mpx:finish() end + local log = "" if standalone or not mpx then - mpx = luamplibload(currentformat) + mpx, _, log = luamplibload(currentformat) mplibinstances[currfmt] = mpx end - return process_indeed(mpx, data) + local converted, result = false, {} + if mpx and data then + result = mpx:execute(data) + local log = reporterror(result, log) + if log then + if result.fig then + converted = luamplib.convert(result) + else + info"No figure output. Maybe no beginfig/endfig" + end + end + else + err"Mem file unloadable. Maybe generated with a different version of mplib?" + end + return converted, result end % \end{macrocode} @@ -1024,13 +1045,6 @@ local mplibcolorfmt = { [[\def\__color_backend_select:nn#1#2{\global\mplibtmptoks{#1 #2}}]].. [[\def\__kernel_backend_literal:e#1{\global\mplibtmptoks\expandafter{\expanded{#1}}}]].. [[\color_select:n%s\endgroup]], - l3xcolor = [[\begingroup\color_if_exist:nTF%s{]].. - [[\def\__color_select:N#1{\expandafter\__color_select:nn#1}]].. - [[\def\__color_backend_select:nn#1#2{\global\mplibtmptoks{#1 #2}}]].. - [[\def\__kernel_backend_literal:e#1{\global\mplibtmptoks\expandafter{\expanded{#1}}}]].. - [[\color_select:n%s}{\let\XC@mcolor\relax]].. - [[\def\set@color{\global\mplibtmptoks\expandafter{\current@color}}]].. - [[\color%s}\endgroup]], } local colfmt = is_defined'color_select:n' and "l3color" or "xcolor" @@ -1069,7 +1083,7 @@ local function process_color (str) end end end - run_tex_code(myfmt:format(str,str,str), ccexplat or catat11) + run_tex_code(myfmt:format(str), ccexplat or catat11) local t = texgettoks"mplibtmptoks" return format('1 withprescript "MPlibOverrideColor=%s"', t) end @@ -1078,10 +1092,7 @@ end % \end{macrocode} % -% \cs{mpdim} is expanded before MPLib process, so code below will not be -% used for |mplibcode| data. But who knows anyone would want it -% in |.mp| input file. If then, you can say |mplibdimen(".5\textwidth")| -% for example. +% for \cs{mpdim} or |mplibdimen| % \begin{macrocode} local function process_dimen (str) if str then @@ -1850,7 +1861,11 @@ local function do_preobj_color(object,prescript) elseif not pdfmode then override = prev_override_color if override then - texsprint(format("\\special{color push %s}",override)) + if override:find"^pdf:" then + texsprint(format("\\special{%s}",override)) + else + texsprint(format("\\special{color push %s}",override)) + end end end end @@ -2193,7 +2208,7 @@ luamplib.colorconverter = colorconverter \else \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{luamplib} - [2024/03/29 v2.27.1 mplib package for LuaTeX] + [2024/04/04 v2.27.2 mplib package for LuaTeX] \ifx\newluafunction\@undefined \input ltluatex \fi diff --git a/macros/luatex/generic/luamplib/luamplib.pdf b/macros/luatex/generic/luamplib/luamplib.pdf Binary files differindex 652add2db7..e7580d5551 100644 --- a/macros/luatex/generic/luamplib/luamplib.pdf +++ b/macros/luatex/generic/luamplib/luamplib.pdf |