diff options
author | Norbert Preining <norbert@preining.info> | 2022-12-04 03:01:36 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-12-04 03:01:36 +0000 |
commit | b153d9b098596910fb2be9311f13c4415233c2a2 (patch) | |
tree | f0f44c9b4caa5756e6957885e8691c0268920a56 /macros/latex | |
parent | 34896a353fe22e8ac88ef0b4e39f4fa878e2b0b6 (diff) |
CTAN sync 202212040301
Diffstat (limited to 'macros/latex')
20 files changed, 1247 insertions, 877 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-publist/README b/macros/latex/contrib/biblatex-contrib/biblatex-publist/README index 0d42209e43..0704ccf202 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-publist/README +++ b/macros/latex/contrib/biblatex-contrib/biblatex-publist/README @@ -46,6 +46,10 @@ instructions. == CHANGES == +* V. 2.1 (2022-12-03) + - Honor \mkbibname* (#41). + - Fix reverse numbering without refsections (#42). + * V. 2.0 (2022-10-24): - Provide \ExecutePublistOptions to change (most) biblatex-publist options on the fly. diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-publist/biblatex-publist.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-publist/biblatex-publist.pdf Binary files differindex cd40d546e2..7f970ec9e8 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-publist/biblatex-publist.pdf +++ b/macros/latex/contrib/biblatex-contrib/biblatex-publist/biblatex-publist.pdf diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-publist/biblatex-publist.tex b/macros/latex/contrib/biblatex-contrib/biblatex-publist/biblatex-publist.tex index f5e91bf716..59220efca2 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-publist/biblatex-publist.tex +++ b/macros/latex/contrib/biblatex-contrib/biblatex-publist/biblatex-publist.tex @@ -113,7 +113,7 @@ \thanks{Please report issues via \protect\url{https://github.com/jspitz/biblatex-publist}.}% } -\date{Version 2.0, 2022/10/24} +\date{Version 2.1, 2022/12/03} \maketitle \begin{abstract} @@ -256,7 +256,7 @@ As opposed to the macro, however, the options do not provide for multiple author \item [{\joption{plauthorhandling{[}=omit|highlight{]}}}] default: \emph{omit}. -By default, the publist author (as defined with \jmacro{plauthor}) is omitted from +By default, the publist author (as defined with \jcsmacro{plauthorname}) is omitted from the author or editor list. If you use the option \joption{plauthorhandling=highlight}, it is highlighted instead (set in bold face by default; see sec.~\ref{sec:auxmacros} how to change that). @@ -284,7 +284,7 @@ on the left side in one-sided documents (via \jfcsmacro{reversemarginpar}). If this is \texttt{true}, the extradate marker (a, b etc.) is also appended to pubstates if there are multiple indentical pubstates; e.\,g., \emph{Forthcoming(a)}, \emph{Forthcoming(b)}. -\item [{\joption{plsorting{[}=sorting scheme{]}}}] default: \emph{ydt}. +\item [{\joption{plsorting=<sorting scheme>}}] default: \emph{ydt}. This option works like the \joption{sorting} option you know from \bibltx. It is provided since \bpl\ sets its own sorting schemes (differently depending on \joption{plauthorhandling}) and thus overrides any setting made @@ -910,6 +910,12 @@ refsection. \begin{description} + \item [{V. 2.1 (2022/12/03):}]~ + \begin{itemize} + \item Honor \jfcsmacro{mkbibname*}. + \item Fix reverse numbering without refsections. + \end{itemize} + \item [{V. 2.0 (2022/10/24):}]~ \begin{itemize} \item Provide \jcsmacro{ExecutePublistOptions} to change (most) \bpl\ options diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx index ab5d84b08a..85e14d2693 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.bbx @@ -25,8 +25,8 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\bpl@version{2.0} -\def\bpl@rdate{2022/10/24} +\def\bpl@version{2.1} +\def\bpl@rdate{2022/12/03} \ProvidesFile{publist.bbx}[\bpl@rdate\space v.\bpl@version\space biblatex bibliography style (JSP)] @@ -734,6 +734,7 @@ \newcounter{plnumgroup} \setcounter{plnumgroup}{0} \newbool{newsection} +\booltrue{newsection} \newbool{needbpxrerun} \newbool{plnumgroup} \def\resetplnumgroup{} @@ -766,7 +767,7 @@ \defbibenvironment{bibliography} {% \addtolength{\labelnumberwidth}{\extralabelnumberwidth}% - \setcounter{bplsecitems}{0}% + \ifbool{newsection}{\setcounter{bplsecitems}{0}}{}% \ifcsundef{bpl@savesecitems:\theplnumgroup}{% \csnumgdef{bpl@savesecitems:\theplnumgroup}{0}% }{}% @@ -1196,20 +1197,20 @@ \plauthorhl{% \if@givenfirst% given name first \ifgiveninits - {\ifdefvoid{\namepartgiveni}{}{\namepartgiveni\addspace}}% - {\ifdefvoid{\namepartgiven}{}{\namepartgiven\addspace}}% + {\ifdefvoid{\namepartgiveni}{}{\mkbibnamegiven{\namepartgiveni}\addspace}}% + {\ifdefvoid{\namepartgiven}{}{\mkbibnamegiven{\namepartgiven}\addspace}}% \ifdefvoid{\namepartprefix}% {}% - {\namepartprefix\addspace}% - \namepartfamily% + {\mkbibnameprefix{\namepartprefix}\addspace}% + \mkbibnamefamily{\namepartfamily}% \else% family name first \ifdefvoid{\namepartprefix}% {}% - {\namepartprefix\addspace}% - \namepartfamily% + {\mkbibnameprefix{\namepartprefix}\addspace}% + \mkbibnamefamily{\namepartfamily}% \ifgiveninits - {\ifdefvoid{\namepartgiveni}{}{\revsdnamepunct\addspace\namepartgiveni\addspace}}% - {\ifdefvoid{\namepartgiven}{}{\revsdnamepunct\addspace\namepartgiven\isdot\addspace}}% + {\ifdefvoid{\namepartgiveni}{}{\revsdnamepunct\addspace\mkbibnamegiven{\namepartgiveni}\addspace}}% + {\ifdefvoid{\namepartgiven}{}{\revsdnamepunct\addspace\mkbibnamegiven{\namepartgiven}\isdot\addspace}}% \fi }% \ifnumequal{\value{listcount}}{\value{liststop}}{}{\usebibmacro{bpl:name:andothers}}% @@ -1217,20 +1218,20 @@ \ifnumgreater{\value{listcount}}{\value{realliststop}}{}{% \if@givenfirst% given name first \ifgiveninits - {\ifdefvoid{\namepartgiveni}{}{\namepartgiveni\addspace}}% - {\ifdefvoid{\namepartgiven}{}{\namepartgiven\addspace}}% + {\ifdefvoid{\namepartgiveni}{}{\mkbibnamegiven{\namepartgiveni}\addspace}}% + {\ifdefvoid{\namepartgiven}{}{\mkbibnamegiven{\namepartgiven}\addspace}}% \ifdefvoid{\namepartprefix}% {}% - {\namepartprefix\addspace}% - \namepartfamily% + {\mkbibnameprefix{\namepartprefix}\addspace}% + \mkbibnamefamily{\namepartfamily}% \else% family name first \ifdefvoid{\namepartprefix}% {}% - {\namepartprefix\addspace}% - \namepartfamily% + {\mkbibnameprefix{\namepartprefix}\addspace}% + \mkbibnamefamily{\namepartfamily}% \ifgiveninits - {\ifdefvoid{\namepartgiveni}{}{\revsdnamepunct\addspace\namepartgiveni\addspace}}% - {\ifdefvoid{\namepartgiven}{}{\revsdnamepunct\addspace\namepartgiven\isdot\addspace}}% + {\ifdefvoid{\namepartgiveni}{}{\revsdnamepunct\addspace\mkbibnamegiven{\namepartgiveni}\addspace}}% + {\ifdefvoid{\namepartgiven}{}{\revsdnamepunct\addspace\mkbibnamegiven{\namepartgiven}\isdot\addspace}}% \fi }% \usebibmacro{bpl:name:andothers}% @@ -1270,9 +1271,9 @@ }% \ifnumgreater{\value{listcount}}{\value{realliststop}}{}{% \ifgiveninits - {\ifdefvoid{\namepartgiveni}{}{\namepartgiveni\addspace}}% - {\ifdefvoid{\namepartgiven}{}{\namepartgiven\addspace}}% - \ifdefvoid{\namepartprefix}{}{\namepartprefix\addspace}% + {\ifdefvoid{\namepartgiveni}{}{\mkbibnamegiven{\namepartgiveni}\addspace}}% + {\ifdefvoid{\namepartgiven}{}{\mkbibnamegiven{\namepartgiven}\addspace}}% + \ifdefvoid{\namepartprefix}{}{\mkbibnameprefix{\namepartprefix}\addspace}% \global\togglefalse{plauthorprecedes}% \namepartfamily% }% @@ -1296,16 +1297,16 @@ \DeclareNameFormat{bookauthor}{% \if@givenfirst% given name first \ifgiveninits - {\ifdefvoid{\namepartgiveni}{}{\namepartgiveni\addspace}}% - {\ifdefvoid{\namepartgiven}{}{\namepartgiven\addspace}}% - \ifdefvoid{\namepartprefix}{}{\namepartprefix\addspace}% - \namepartfamily% + {\ifdefvoid{\namepartgiveni}{}{\mkbibnamegiven{\namepartgiveni}\addspace}}% + {\ifdefvoid{\namepartgiven}{}{\mkbibnamegiven{\namepartgiven}\addspace}}% + \ifdefvoid{\namepartprefix}{}{\mkbibnameprefix{\namepartprefix}\addspace}% + \mkbibnamefamily{\namepartfamily}% \else% family name first - \ifdefvoid{\namepartprefix}{}{\namepartprefix\addspace}% - \namepartfamily% + \ifdefvoid{\namepartprefix}{}{\mkbibnameprefix{\namepartprefix}\addspace}% + \mkbibnamefamily{\namepartfamily}% \ifgiveninits - {\ifdefvoid{\namepartgiveni}{}{\revsdnamepunct\addspace\namepartgiveni\addspace}}% - {\ifdefvoid{\namepartgiven}{}{\revsdnamepunct\addspace\namepartgiven\isdot\addspace}}% + {\ifdefvoid{\namepartgiveni}{}{\revsdnamepunct\addspace\mkbibnamegiven{\namepartgiveni}\addspace}}% + {\ifdefvoid{\namepartgiven}{}{\revsdnamepunct\addspace\mkbibnamegiven{\namepartgiven}\isdot\addspace}}% \fi \ifthenelse{\value{listcount}<\value{liststop}} {\ifnumless{\value{listcount}}{\value{liststop}-1}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.cbx index 3aaaedacf7..0bb41b4d71 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.cbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.cbx @@ -26,8 +26,8 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\bpl@version{2.0} -\def\bpl@rdate{2022/10/24} +\def\bpl@version{2.1} +\def\bpl@rdate{2022/12/03} \ProvidesFile{publist.cbx}[\bpl@rdate\space v.\bpl@version\space biblatex citation style (JSP)] diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.dbx b/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.dbx index afffa069cb..2cf23eaab8 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.dbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-publist/publist.dbx @@ -1,5 +1,5 @@ % publist.dbx, biblatex data model specification for the biblatex-publist -% package, version 2.0 (2022/10/24). +% package, version 2.1 (2022/12/03). % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/ppt-slides/DEPENDS.txt b/macros/latex/contrib/ppt-slides/DEPENDS.txt index db184dd263..74961c7a1d 100644 --- a/macros/latex/contrib/ppt-slides/DEPENDS.txt +++ b/macros/latex/contrib/ppt-slides/DEPENDS.txt @@ -1,13 +1,20 @@ hard pgfopts hard xcolor -hard ifthen hard href-ul hard pagecolor hard varwidth hard qrcode -hard tikz +hard pgf hard tikzpagenodes hard enumitem hard crumbs -hard tabularx hard seqsplit +hard hardwrap +hard ifoddpage +hard textpos +hard anyfontsize +hard fontsize +hard changepage +hard soul +hard lastpage +hard titling
\ No newline at end of file diff --git a/macros/latex/contrib/ppt-slides/LICENSE.txt b/macros/latex/contrib/ppt-slides/LICENSE.txt new file mode 100644 index 0000000000..463e7d252d --- /dev/null +++ b/macros/latex/contrib/ppt-slides/LICENSE.txt @@ -0,0 +1,21 @@ +(The MIT License) + +Copyright (c) 2022 Yegor Bugayenko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the 'Software'), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/macros/latex/contrib/ppt-slides/README.md b/macros/latex/contrib/ppt-slides/README.md index 9543ebc462..46758695fc 100644 --- a/macros/latex/contrib/ppt-slides/README.md +++ b/macros/latex/contrib/ppt-slides/README.md @@ -25,11 +25,10 @@ and then use in preamble: \end{document} ``` -The full example and all commands are available in -[`ppt-slides.tex`](https://github.com/yegor256/ppt-slides/blob/master/ppt-slides.tex) file. +Otherwise, you can download [`ppt-slides.sty`](https://raw.githubusercontent.com/yegor256/ppt-slides/gh-pages/ppt-slides/ppt-slides.sty) and add to your project. -If you want to contribute yourself, make a fork, create a branch, -then run `make` in root directory. +If you want to contribute yourself, make a fork, then create a branch, +then run `l3build ctan` in the root directory. It should compile everything without errors. If not, submit an issue and wait. -Otherwise, make your changes and then run `make` again. If the build is +Otherwise, make your changes and then run `l3build ctan` again. If the build is still clean, submit a pull request. diff --git a/macros/latex/contrib/ppt-slides/ppt-slides.dtx b/macros/latex/contrib/ppt-slides/ppt-slides.dtx new file mode 100644 index 0000000000..5f21146d16 --- /dev/null +++ b/macros/latex/contrib/ppt-slides/ppt-slides.dtx @@ -0,0 +1,662 @@ +% \iffalse meta-comment +% (The MIT License) +% +% Copyright (c) 2021-2022 Yegor Bugayenko +% +% Permission is hereby granted, free of charge, to any person obtaining a copy +% of this software and associated documentation files (the 'Software'), to deal +% in the Software without restriction, including without limitation the rights +% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +% copies of the Software, and to permit persons to whom the Software is +% furnished to do so, subject to the following conditions: +% +% The above copyright notice and this permission notice shall be included in all +% copies or substantial portions of the Software. +% +% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +% SOFTWARE. +% \fi + +% \CheckSum{0} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} + +% \GetFileInfo{ppt-slies.dtx} +% \DoNotIndex{\endgroup,\begingroup,\let,\else,\s,\n,\r,\\,\1,\fi} + +% \iffalse +%<*driver> +\ProvidesFile{ppt-slides.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{ppt-slides} +%<*package> +[2022-12-03 0.2.0 Slide Decks a la Power Point] +%</package> +%<*driver> +\documentclass{ltxdoc} +\usepackage[T1]{fontenc} +\usepackage[tt=false, type1=true]{libertine} +\usepackage{microtype} +\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}} +\usepackage{graphicx} +\usepackage{xcolor} +\usepackage[runs=2,dtx,margin=0,small]{docshots} +\usepackage{href-ul} +\PageIndex +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{ppt-slides.dtx} + \PrintChanges + \PrintIndex +\end{document} +%</driver> +% \fi + +% \title{|ppt-slides|: \LaTeX{} Package for \\ Slide Decks \`{a} la Power Point\thanks{The sources are in GitHub at \href{https://github.com/yegor256/ppt-slides}{yegor256/ppt-slides}}} +% \author{Yegor Bugayenko \\ \texttt{yegor256@gmail.com}} +% \date{\filedate, \fileversion} +% +% \maketitle +% +% \section{Introduction} +% +% This package helps you render slide decks in PowerPoint\texttrademark{} style: +% \begin{docshot} +% \documentclass{article} +% \usepackage[template,scheme=dark]{ppt-slides} +% \begin{document} +% \pptMiddle{\pptTitle{Hello, world!}{How are you?}} +% \end{document} +% \end{docshot} + +% It is recommended to use this package together with +% \href{https://github.com/yegor256/clicks}{clicks}: +% \begin{docshot} +% \documentclass{article} +% \usepackage[template,scheme=dark]{ppt-slides} +% \usepackage[static]{clicks} +% \begin{document} +% We help you make slide decks in \LaTeX: +% \plick{\pptBanner{Making Slides Is Easy}} +% \plick{Just use this package...} +% \plush{together with 'clicks' package.} +% They will look similar to what PowerPoint can +% make, but with the precision of \LaTeX. We +% recommend using us together with ``clicks.'' +% \end{document} +% \end{docshot} + +% \section{Layout} + +% \DescribeMacro{\pptToc} +% \DescribeMacro{\pptChapter} +% First, split your story into chapters: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\documentclass{article} +\usepackage{clicks} +\usepackage[template,scheme=light]{ppt-slides} +\begin{document} +\pptToc +\plush{\pptChapter{About Me}} +... +\plush{\pptChapter[Idea]{My Idea Is Novel}} +... +\plush{\pptChapter[FAQ]{Discussion \& Questions}} +... +\end{document} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% |\pptToc| will render the table of contents in an interactive ``clickable'' format. +% Thanks to the use of \href{https://github.com/yegor256/crumbs}{crumbs}, there will +% be a navigation at the top left corner. + +% \DescribeMacro{\pptSection} +% Then, put sections inside chapters: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\begin{document} +\pptToc +\plush{\pptChapter{About Me}} +\plush{\pptSection[Student]{I'm a Student}} +... +\plush{\pptSection[Athlete]{Also, I'm an Athlete}} +... +\plush{\pptChapter[Idea]{My Idea Is Novel}} +\plush{\pptSection{Novelty}} +\plush{\pptSection{Impact}} +\end{document} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% The |\pptChapter| and |\pptSection| commands used together will render +% nice two-level nagivation menu at the top left corner. + +% \DescribeMacro{\pptLeft} +% \DescribeMacro{\pptRight} +% You can place the title of the presentation and your name at the bottom +% of each slide, on the left and on the right respectively: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\documentclass{article} +\usepackage{clicks} +\usepackage[template,scheme=light]{ppt-slides} +\pptLeft{How Did I Spend Last Summer} +\pptRight{Yegor Bugayenko} +\begin{document} +... +\end{document} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% If you don't use the |\pptLeft| or |\pptRight| commands, nothing will +% be printed at the bottom. + +% \section{Commands} + +% \DescribeMacro{\pptPic} +% You can add an image to the slide (the first argument is the width +% of the image in relation to |\textwidth|, +% while the second one is the path of it): +% \begin{docshot} +% \documentclass{article} +% \usepackage[template,scheme=dark]{ppt-slides} +% \begin{document} +% \pptPic{0.2}{socrates.jpg} \\ +% This is Socrates, a Greek philosopher. +% \end{document} +% \end{docshot} + +% \DescribeMacro{\pptHeader} +% You can add a piece of code to the slide (we recommend using \href{https://github.com/yegor256/ffcode}{ffcode}): +% \begin{docshot} +% \documentclass{article} +% \usepackage[template,scheme=dark]{ppt-slides} +% \usepackage{ffcode} +% \begin{document} +% \pptHeader{This is How You Print to Console:} +% \begin{ffcode} +% void main(char** args) { +% printf("Hello, world!"); +% } +% \end{ffcode} +% \end{document} +% \end{docshot} +% Don't use |\plick| or |\plush|, they won't work with code snippets. +% The |\pptHeader| command prints a header similar to what the |\pptSection| command prints, but +% doesn't start a new section. + +% \DescribeMacro{\pptQuote} +% \DescribeMacro{\pptBanner} +% You can put a quote next to the image, by using the |\pptQuote| command: +% \begin{docshot} +% \documentclass{article} +% \usepackage[template,scheme=dark]{ppt-slides} +% \begin{document} +% \pptBanner{My Favorite Quote} +% \pptQuote{socrates.jpg}{The only true wisdom +% is in knowing you know nothing}{Socrates} +% \end{document} +% \end{docshot} + +% \DescribeMacro{\pptThought} +% For an interesting thought in the middle of the slide, use |\pptThought|: +% \begin{docshot} +% \documentclass{article} +% \usepackage[template,scheme=dark]{ppt-slides} +% \begin{document} +% \pptThought{Socrates said that the only true +% wisdom is in knowing you know nothing. Was he +% a wise man?...} +% \end{document} +% \end{docshot} + +% \DescribeMacro{\pptQR} +% Sometimes it's convenient to show a QR code to your audience instead of +% a URL, since it's easier to use --- they can scan it: +% \begin{docshot} +% \documentclass{article} +% \usepackage[template,scheme=dark]{ppt-slides} +% \begin{document} +% Check my blog post by this link: \\ +% \pptQR{https://www.yegor256.com} +% \end{document} +% \end{docshot} +% The code will look like this, thanks to \href{https://ctan.org/pkg/qrcode}{qrcode} package that +% we use behind the scene. + +% \DescribeMacro{pptWide} +% \DescribeMacro{pptWideOne} +% Sometimes you need your slide content to take all visible horizontal space: +% \begin{docshot} +% \documentclass{article} +% \usepackage[template,scheme=dark]{ppt-slides} +% \begin{document} +% \begin{pptWideOne} +% This paragraph is too long for some reasons, +% that's why must take all visible horizontal +% space, while normally the content has a wide +% margin on the left side of the page. +% \end{pptWideOne} +% \end{document} +% \end{docshot} +% You can also use |\begin{pptWide}{X}|, +% where |X| is the number of columns to render. + +% \section{Package Options} + +% \DescribeMacro{template} +% You start with a template for your slide deck: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\documentclass{article} +\usepackage[template=9x6]{ppt-slides} +\begin{document} +... +\end{document} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% There is only one template, which is used by default: |9x6|. If you don't +% specify the name, it will be used. If you don't use the |template| option at all, +% the default |article| will be rendered, which is not what you want. + +% \DescribeMacro{scheme} +% You can choose a color scheme for your slides, using the |scheme| option +% of the package: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\usepackage[template,scheme=light]{ppt-slides} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% There are a few out-of-the-box schemes available: |light|, |dark|, +% |light-mono|, and |dark-mono|. You can design your own, using +% |ppt-light.tex| file as an example: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\usepackage[template,scheme=/usr/local/my-colors.tex]{ppt-slides} +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \DescribeMacro{directory} +% You can change the location of the templates and schemes by means of the |directory| package option: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\usepackage[directory=/tmp,template=foo]{ppt-slides} +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \DescribeMacro{nominutes} +% By default, if you render your slide deck in non-static mode (the |static| option for the ``clicks'' package), +% there will be minutes tracking in the right top corner of each slide. You can turn this off +% by using the |nominutes| option of the package: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\usepackage[nominutes]{ppt-slides} +\end{verbatim} +%\iffalse +%</verb> +%\fi + +% \StopEventually{} + +% \section{Implementation} +% \changes{0.0.1}{2022/09/11}{First draft.} +% \changes{0.1.4}{2022/09/15}{The \texttt{nominutes} package option added.} +% \changes{0.1.5}{2022/09/19}{The default directory fixed.} +% \changes{0.2.0}{2022/12/03}{We migrated to the \texttt{ltxdoc} format and \texttt{.dtx} file.} + +% First, we parse the package options: +% \begin{macrocode} +\RequirePackage{pgfopts} +\makeatletter +\pgfkeys{ + /ppt-slides/.is family, + /ppt-slides, + template/.estore in = \ppt@template, + template/.default = 9x6, + scheme/.estore in = \ppt@scheme, + directory/.estore in = \ppt@directory, + directory/.default = , + nominutes/.estore in = \ppt@nominutes, + directory +} +\ProcessPgfPackageOptions{/ppt-slides} +\makeatother +% \end{macrocode} + +% Then, we include the template: +% \begin{macrocode} +\makeatletter\ifdefined\ppt@template + \input{\ppt@directory ppt-templates/ppt-\ppt@template.tex} +\else + \message{^^Jppt: No template is loaded, because + the 'template' option is not specified} +\fi\makeatother +% \end{macrocode} + +% Then, we include the scheme: +% \begin{macrocode} +\makeatletter\ifdefined\ppt@scheme + \RequirePackage{xcolor} + \input{\ppt@directory ppt-schemes/ppt-\ppt@scheme.tex} +\else + \message{^^Jppt: No color scheme is loaded, because + the 'scheme' option is not specified} +\fi\makeatother +% \end{macrocode} + +% Then, we include a few packages: +% \begin{macrocode} +\RequirePackage{ifthen} % for if/then/else in LaTeX +\RequirePackage{href-ul} % for nice hyperlinks +\RequirePackage{pagecolor} % to change page color +\RequirePackage{varwidth} % for pptWide +\RequirePackage{qrcode} % to print QR codes +\RequirePackage{tikz} % for drawings in TOC + \usetikzlibrary{calc} % for positioning of pinned boxes +\RequirePackage{tikzpagenodes} % for pptPin +\RequirePackage[inline]{enumitem} % for lists in crumbs +\RequirePackage{crumbs} % for crumbs +% \end{macrocode} + +% \begin{macro}{\pptMiddle} +% Then, we define the |\pptMiddle| command: +% \begin{macrocode} +\newcommand\pptMiddle[1]{% + \vspace*{\fill}#1\vspace*{\fill}% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptBanner} +% Then, we define the |\pptBanner| command: +% \begin{macrocode} +\newcommand\pptBanner[2][green]{% + \par% + {\setlength{\fboxsep}{6pt}% + \colorbox{#1}{\color{\thepagecolor}\large #2}} + \par% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptChapter} +% Then, we define the |\pptChapter| command: +% \begin{macrocode} +\newcommand\pptChapter[2][]{% + \crumbection[#1]{#2}% + \pptMiddle{% + {\large\ttfamily Chapter \#\the\value{section}:}% + \newline% + \rotatebox{1}{\pptBanner[blue]{\LARGE#2}}% + }% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptSection} +% Then, we define the |\pptSection| command: +% \begin{macrocode} +\newcommand\pptSection[2][]{% + \subcrumbection[#1]{#2}% + \pptHeader{#2}% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptHeader} +% Then, we define the |\pptHeader| command: +% \begin{macrocode} +\newcommand\pptHeader[1]{% + \vspace*{-0.75in}\hspace*{-0.5in}% + \rotatebox{1}{\pptBanner[orange]{\Large #1}}\vspace*{0.15in}% + \par% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptTitle} +% Then, we define the |\pptTitle| command: +% \begin{macrocode} +\newcommand\pptTitle[2]{% + {\pptBanner{\Huge #1}}% + {\pptBanner{\large #2}}% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptToc} +% Then, we define the |\pptToc| command: +% \begin{macrocode} +\newcommand*\pptTOC{} +\newcommand\pptToc[1][]{% + \renewcommand*\pptTOC{}% + \print{% + \def\param{#1}% + \ifx\param\empty\else% + \pptBanner{#1}% + \fi% + \tikz{% + \node (z) {% + \begin{varwidth}{\textwidth}% + \ifx\pptTOC\empty\else% + \begin{itemize}[label={}] + \pptTOC + \end{itemize} + \fi% + \end{varwidth}% + };% + \path [draw=blue,line width=4pt] (z.north west) -- (z.south west);% + }% + }% + \begin{@empty}% + \renewcommand\crumb[2]{% + \ifx\pptTOC\empty\else\ifdefined\click\click[0]\fi\fi + \gappto\pptTOC{\item ##2} + } + \crumbs + \end{@empty}% + \ifdefined\flush\flush[1]\fi% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptQuote} +% Then, we define the |\pptQuote| command: +% \begin{macrocode} +\RequirePackage{tabularx} +\newcommand\pptQuote[3]{% + \begin{tabularx}{\columnwidth}{c>{\raggedright\arraybackslash}X}% + \raisebox{\dimexpr-\height+\ht\strutbox}{\pptPic{0.25}{#1}}% + &% + ``#2''% + \def\param{#3}% + \ifx\param\empty\else% + \newline\newline% + \small% + --- #3% + \fi% + \\% + \end{tabularx}% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptPic} +% Then, we define the |\pptPic| command: +% \begin{macrocode} +\newcommand\pptPic[2]{% + {% + \setlength{\fboxsep}{0pt}% + \setlength{\fboxrule}{1pt}% + \fcolorbox{gray}{white}{% + \includegraphics[width=#1\columnwidth]{#2}% + }% + }% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptPin} +% Then, we define the |\pptPin| command: +% \begin{macrocode} +\newcommand\pptPin[2][right]{% + \begin{tikzpicture}[remember picture,overlay]% + \ifthenelse{\equal{#1}{left}}% + {% + \node[anchor=north east] at + ($(current page text area.north west) - (24pt, 18pt)$) {% + \begin{minipage}{0.25\textwidth}% + \raggedleft #2% + \end{minipage}% + };% + }% + {% + \node[anchor=north east] at (current page text area.north east) {% + \begin{minipage}{0.25\textwidth}% + \raggedright #2% + \end{minipage}% + };% + }% + \end{tikzpicture}% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptThought} +% Then, we define the |\pptThought| command: +% \begin{macrocode} +\newcommand\pptThought[1]{% + \pptMiddle{% + \tikz{% + \node [inner sep=18pt] (z) {% + \begin{varwidth}{0.8\textwidth} + \Large + #1 + \end{varwidth} + }; + \path [draw=green,line width=8pt] (z.north west) -- (z.south west); + }% + }% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptSnippet} +% Then, we define the |\pptSnippet| command: +% \begin{macrocode} +\newcommand\pptSnippet[2][\small]{% + \begin{samepage}% + #1\verbatiminput{#2}% + \end{samepage}% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptQR} +% Then, we define the |\pptQR| command: +% \begin{macrocode} +\newcommand\pptQR[2][2in]{% + \tikz{% + \node[draw=white]{% + \href{#2}{% + \qrcode[height=#1]{#2}% + }% + }% + }% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\pptPinQR} +% Then, we define the |\pptPinQR| command: +% \begin{macrocode} +\RequirePackage{seqsplit} +\newcommand\pptPinQR[2][right]{% + \pptPin[#1]{% + \begin{minipage}{1.4in}% + \raggedleft% + \pptQR[1in]{#2}% + \\[3pt] + \ttfamily\fontsize{8pt}{10pt}\selectfont% + \seqsplit{#2} \href{#2}{$\rightarrow$}% + \\ + \end{minipage}% + }% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{pptWide} +% Finally, we define the |pptWide| and |pptWideOne| environments: +% \begin{macrocode} +\newenvironment{pptWideOne} + {\begin{adjustwidth}{-2in}{-1in}} + {\end{adjustwidth}} +\newenvironment{pptWide}[1] + {\begin{pptWideOne}\begin{multicols}{#1}} + {\end{multicols}\end{pptWideOne}} +% \end{macrocode} +% \end{macro} + +\endinput + +% \Finale + +% \clearpage +% \printbibliography +% \clearpage + +% \PrintChanges +% \clearpage +% \PrintIndex diff --git a/macros/latex/contrib/ppt-slides/ppt-slides.ins b/macros/latex/contrib/ppt-slides/ppt-slides.ins new file mode 100644 index 0000000000..5dfdeca0b5 --- /dev/null +++ b/macros/latex/contrib/ppt-slides/ppt-slides.ins @@ -0,0 +1,55 @@ +%% (The MIT License) +%% +%% Copyright (c) 2021-2022 Yegor Bugayenko +%% +%% Permission is hereby granted, free of charge, to any person obtaining a copy +%% of this software and associated documentation files (the 'Software'), to deal +%% in the Software without restriction, including without limitation the rights +%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +%% copies of the Software, and to permit persons to whom the Software is +%% furnished to do so, subject to the following conditions: +%% +%% The above copyright notice and this permission notice shall be included in all +%% copies or substantial portions of the Software. +%% +%% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +%% SOFTWARE. + +\input docstrip.tex +\keepsilent +\usedir{macros/latex/contrib/ppt-slides} +\preamble +(The MIT License) + +Copyright (c) 2021-2022 Yegor Bugayenko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the 'Software'), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +\endpreamble +\generate{\file{ppt-slides.sty}{\from{ppt-slides.dtx}{package}}} +\obeyspaces +\Msg{To finish the installation you have to move the ".sty"} +\Msg{file into a directory searched by TeX. To produce the} +\Msg{documentation run the file ".dtx" through LaTeX. If any} +\Msg{questions, submit a new GitHub issue.} +\endbatchfile diff --git a/macros/latex/contrib/ppt-slides/ppt-slides.pdf b/macros/latex/contrib/ppt-slides/ppt-slides.pdf Binary files differindex 3b357352bf..c256214d9b 100644 --- a/macros/latex/contrib/ppt-slides/ppt-slides.pdf +++ b/macros/latex/contrib/ppt-slides/ppt-slides.pdf diff --git a/macros/latex/contrib/ppt-slides/ppt-slides.sty b/macros/latex/contrib/ppt-slides/ppt-slides.sty deleted file mode 100644 index beb1e866d2..0000000000 --- a/macros/latex/contrib/ppt-slides/ppt-slides.sty +++ /dev/null @@ -1,227 +0,0 @@ -% (The MIT License) -% -% Copyright (c) 2022 Yegor Bugayenko -% -% Permission is hereby granted, free of charge, to any person obtaining a copy -% of this software and associated documentation files (the 'Software'), to deal -% in the Software without restriction, including without limitation the rights -% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -% copies of the Software, and to permit persons to whom the Software is -% furnished to do so, subject to the following conditions: -% -% The above copyright notice and this permission notice shall be included in all -% copies or substantial portions of the Software. -% -% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -% SOFTWARE. - -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ppt-slides}[2022/09/19 0.1.5 Slide Decks à la Power Point] - -\RequirePackage{pgfopts} -\makeatletter -\pgfkeys{ - /ppt-slides/.is family, - /ppt-slides, - template/.estore in = \ppt@template, - template/.default = 9x6, - scheme/.estore in = \ppt@scheme, - directory/.estore in = \ppt@directory, - directory/.default = , - nominutes/.estore in = \ppt@nominutes, - directory -} -\ProcessPgfOptions* -\makeatother - -\makeatletter\ifdefined\ppt@template - \input{\ppt@directory ppt-templates/ppt-\ppt@template.tex} -\else - \message{^^Jppt: No template is loaded, because 'template' option is not specified} -\fi\makeatother - -\makeatletter\ifdefined\ppt@scheme - \RequirePackage{xcolor} - \input{\ppt@directory ppt-schemes/ppt-\ppt@scheme.tex} -\else - \message{^^Jppt: No color scheme is loaded, because 'scheme' option is not specified} -\fi\makeatother - -\RequirePackage{ifthen} % for if/then/else in LaTeX -\RequirePackage{href-ul} % for nice hyperlinks -\RequirePackage{pagecolor} % to change page color -\RequirePackage{varwidth} % for pptWide -\RequirePackage{qrcode} % to print QR codes -\RequirePackage{tikz} % for drawings in TOC -\RequirePackage{tikzpagenodes} % for pptPin -\RequirePackage[inline]{enumitem} % for lists in crumbs -\RequirePackage{crumbs} % for crumbs - -\newcommand\pptMiddle[1]{% - \vspace*{\fill}#1\vspace*{\fill}% -} - -\newcommand\pptBanner[2][green]{% - \par - {\setlength{\fboxsep}{6pt}\colorbox{#1}{\color{\thepagecolor}\large #2}} - \par -} - -\newcommand\pptChapter[2][]{% - \crumbection[#1]{#2}% - \pptMiddle{% - {\large\ttfamily Chapter \#\the\value{section}:}% - \newline% - \rotatebox{1}{\pptBanner[blue]{\LARGE#2}}% - }% -} - -\newcommand\pptSection[2][]{% - \subcrumbection[#1]{#2}% - \pptHeader{#2}% -} - -\newcommand\pptHeader[1]{% - \vspace*{-0.75in}\hspace*{-0.5in}% - \rotatebox{1}{\pptBanner[orange]{\Large #1}}\vspace*{0.15in}% - \par% -} - -\newcommand\pptTitle[2]{% - {\pptBanner{\Huge #1}}% - {\pptBanner{\large #2}}% -} - -\newcommand*\pptTOC{} -\newcommand\pptToc[1][]{% - \renewcommand*\pptTOC{}% - \print{% - \def\param{#1}% - \ifx\param\empty\else% - \pptBanner{#1}% - \fi% - \tikz{% - \node (z) {% - \begin{varwidth}{\textwidth}% - \ifx\pptTOC\empty\else% - \begin{itemize}[label={}] - \pptTOC - \end{itemize} - \fi% - \end{varwidth}% - };% - \path [draw=blue,line width=4pt] (z.north west) -- (z.south west);% - }% - }% - \begin{@empty}% - \renewcommand\crumb[2]{% - \ifx\pptTOC\empty\else\ifdefined\click\click[0]\fi\fi - \gappto\pptTOC{\item ##2} - } - \crumbs - \end{@empty}% - \ifdefined\flush\flush[1]\fi% -} - -\RequirePackage{tabularx} -\newcommand\pptQuote[3]{% - \begin{tabularx}{\columnwidth}{c>{\raggedright\arraybackslash}X}% - \raisebox{\dimexpr-\height+\ht\strutbox}{\pptPic{0.25}{#1}}% - &% - ``#2''% - \def\param{#3}% - \ifx\param\empty\else% - \newline\newline% - \small% - --- #3 - \fi% - \\% - \end{tabularx}% -} - -\newcommand\pptPic[2]{% - {% - \setlength{\fboxsep}{0pt}% - \setlength{\fboxrule}{1pt}% - \fcolorbox{gray}{white}{% - \includegraphics[width=#1\columnwidth]{#2}% - }% - }% -} - -\newcommand\pptPin[2][right]{% - \begin{tikzpicture}[remember picture,overlay]% - \ifthenelse{\equal{#1}{left}} - { - \node[anchor=north east] at ($(current page text area.north west) - (24pt, 18pt)$) {% - \begin{minipage}{0.25\textwidth}% - \raggedleft #2 - \end{minipage}% - }; - } - { - \node[anchor=north east] at (current page text area.north east) {% - \begin{minipage}{0.25\textwidth}% - \raggedright #2 - \end{minipage}% - };% - } - \end{tikzpicture}% -} - -\newcommand\pptThought[1]{% - \pptMiddle{% - \tikz{% - \node [inner sep=18pt] (z) {% - \begin{varwidth}{0.8\textwidth} - \Large - #1 - \end{varwidth} - }; - \path [draw=green,line width=8pt] (z.north west) -- (z.south west); - } - } -} - -\newcommand\pptSnippet[2][\small]{% - \begin{samepage}% - #1\verbatiminput{#2}% - \end{samepage}% -} - -\newcommand\pptQR[2][2in]{% - \tikz{% - \node[draw=white]{% - \href{#2}{% - \qrcode[height=#1]{#2}% - }% - }% - } -} - -\RequirePackage{seqsplit} -\newcommand\pptPinQR[2][right]{% - \pptPin[#1]{% - \begin{minipage}{1.4in}% - \raggedleft% - \pptQR[1in]{#2}% - \\[3pt] - \ttfamily\fontsize{8pt}{10pt}\selectfont\seqsplit{#2} \href{#2}{$\rightarrow$} - \\ - \end{minipage}% - }% -} - -\newenvironment{pptWideOne} - {\begin{adjustwidth}{-2in}{-1in}} - {\end{adjustwidth}} -\newenvironment{pptWide}[1] - {\begin{pptWideOne}\begin{multicols}{#1}} - {\end{multicols}\end{pptWideOne}} - -\endinput diff --git a/macros/latex/contrib/ppt-slides/ppt-slides.tex b/macros/latex/contrib/ppt-slides/ppt-slides.tex deleted file mode 100644 index 5be0b6029f..0000000000 --- a/macros/latex/contrib/ppt-slides/ppt-slides.tex +++ /dev/null @@ -1,262 +0,0 @@ -% (The MIT License) -% -% Copyright (c) 2022 Yegor Bugayenko -% -% Permission is hereby granted, free of charge, to any person obtaining a copy -% of this software and associated documentation files (the 'Software'), to deal -% in the Software without restriction, including without limitation the rights -% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -% copies of the Software, and to permit persons to whom the Software is -% furnished to do so, subject to the following conditions: -% -% The above copyright notice and this permission notice shall be included in all -% copies or substantial portions of the Software. -% -% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -% SOFTWARE. - -\documentclass{article} -\usepackage[increment]{crumbs} -\usepackage[static]{clicks} -\usepackage[template,scheme=dark]{ppt-slides} -\usepackage[nonumbers]{ffcode} -\usepackage{titling} -\usepackage{textcomp} -\title{\LaTeX{} Package for Slide Decks \`a la PowerPoint\texttrademark} -\author{Yegor Bugayenko} -\date{0.1.5 2022/09/19} -\pptLeft{\thetitle} -\pptRight{\href{https://github.com/yegor256}{@yegor256}} - -\begin{document} - -\plush{ - \pptMiddle{ - \pptTitle{ppt-slides}{\thetitle}\par - {\scshape Made by \href{https://www.yegor256.com}{\theauthor}}\par - \thedate - } -} - -\clearpage -This package helps you make slide decks in \LaTeX: -\begin{ffcode*}{fontsize=\small} -\documentclass{article} -\usepackage{clicks} -\usepackage[template,scheme=dark]{ppt-slides} -\begin{document} -\plick{\pptBanner{Making Slides Is Easy}} -\plick{Just use this package...} -\plush{together with 'clicks' package.} -\end{document} -\end{ffcode*} -They will look similar to what PowerPoint\texttrademark{} can make, -but with the precision of \LaTeX. We recommend to use this package -together with \href{https://github.com/yegor256/clicks}{clicks}. - -\clearpage -\pptToc[Table of Contents] - -\clearpage -\plush{\pptChapter[Layout]{Scaffolding and Layout}} - -\clearpage -\pptSection{Template} -You start with a template for your slide deck: -\begin{ffcode*}{fontsize=\scriptsize} -\documentclass{article} -\usepackage{clicks} -\usepackage[template=9x6]{ppt-slides} -\begin{document} -... -\end{document} -\end{ffcode*} -There is only one template, which is used by default: \ff{9x6}. If you don't -specify the name, it will be used. If you don't use \ff{template} option at all, -the default \ff{article} will be rendered, which is not what you want. - -\clearpage -\pptSection[Scheme]{Color Schemes} -You can choose a color scheme for your slides, using \ff{scheme} option -of the package: -\begin{ffcode*}{fontsize=\scriptsize} -\documentclass{article} -\usepackage{clicks} -\usepackage[template,scheme=light]{ppt-slides} -\begin{document} -... -\end{document} -\end{ffcode*} -There are a few out-of-the-box schemes available: \ff{light}, \ff{dark}, -\ff{light-mono}, and \ff{dark-mono}. You can design your own, using -\ff{ppt-light.text} file as an example: -{\scriptsize\begin{ffcode} -\usepackage[template,scheme=/usr/local/my-colors.tex]{ppt-slides} -\end{ffcode} -} - -\clearpage -\pptSection{Chapters} -First, split your story into Chapters: -\begin{ffcode*}{fontsize=\scriptsize} -\documentclass{article} -\usepackage{clicks} -\usepackage[template,scheme=light]{ppt-slides} -\begin{document} -\pptToc -\plush{\pptChapter{About Me}} -... -\plush{\pptChapter[Idea]{My Idea Is Novel}} -... -\plush{\pptChapter[FAQ]{Discussion \& Questions}} -... -\end{document} -\end{ffcode*} -\ff{\char`\\pptToc} will render the table of contents in an interactive ``clickable'' format. -Thanks to the use of \href{https://github.com/yegor256/crumbs}{crumbs}, there will -be a navigation at the top left corner. - -\clearpage -\pptSection{Sections} -Put Sections inside Chapters: -\begin{ffcode*}{fontsize=\scriptsize} -\begin{document} -\pptToc -\plush{\pptChapter{About Me}} -\plush{\pptSection[Student]{I'm a Student}} -... -\plush{\pptSection[Athlete]{Also, I'm an Athlete}} -... -\plush{\pptChapter[Idea]{My Idea Is Novel}} -\plush{\pptSection{Novelty}} -\plush{\pptSection{Impact}} -\end{document} -\end{ffcode*} -\ff{\char`\\pptChapter} and \ff{\char`\\pptSection} used together will render -nice two-level nagivation menu at the top left corner. - -\clearpage -\pptSection[Signatures]{Signatures at the Bottom of Each Page} -You can place the title of the presentation and your name at the bottom -of each slide, on the left and on the right respectively: -\begin{ffcode*}{fontsize=\scriptsize} -\documentclass{article} -\usepackage{clicks} -\usepackage[template,scheme=light]{ppt-slides} -\pptLeft{How Did I Spend Last Summer} -\pptRight{Yegor Bugayenko} -\begin{document} -... -\end{document} -\end{ffcode*} -If you don't use \ff{\char`\\pptLeft} or \ff{\char`\\pptRight}, nothing will -be printed at the bottom. - -\clearpage -\pptSection[Minutes]{Tracking Minutes} -By default, if you render your slide deck in non-static mode (option \ff{static} for clicks package), -there will be minutes tracking in the right top corner of each slide. You can turn this off -by using \ff{nominutes} option of the package: -\begin{ffcode*}{fontsize=\small} -\documentclass{article} -\usepackage{clicks} -\usepackage[template,scheme=light,nominutes]{ppt-slides} -\begin{document} -... -\end{document} -\end{ffcode*} - -\clearpage -\pptSection[Wide]{Wide Slides} -Sometimes you need your slide content to take all visible horizontal space: -\begin{ffcode*}{fontsize=\scriptsize} -\begin{document} -\begin{pptWideOne} -This paragraph is too long for some reasons, -that's why must take all visible horizontal space. -\end{pptWideOne} -\end{document} -\end{ffcode*} -\begin{pptWideOne} -This paragraph is too long for some reasons, that's why must take all visible horizontal space. -\end{pptWideOne} -You can also use \ff{\char`\\begin\char`\{pptWide\char`\}\char`\{X\char`\}}, -where \ff{X} is the number of columns to render. - -\clearpage -\plush{\pptChapter[Elements]{Content Elements}} - -\clearpage -\pptSection{Images} -You can add an image to the slide (the first argument is the width -of the image in relation to \ff{\char`\\textwidth}, -while the second one is the path of it): -\begin{ffcode*}{fontsize=\scriptsize} -\begin{document} -\plush{\pptPic{0.2}{socrates.jpg}} -\end{document} -\end{ffcode*} -\pptPic{0.2}{socrates.jpg} - -\clearpage -\pptSection[Snippets]{Code Snippets} -You can add a piece of code to the slide (we recommend using \href{https://github.com/yegor256/ffcode}{ffcode}): -{\scriptsize -\begin{verbatim} -\begin{document} -\clearpage -\pptHeader{This is How You Print to Console:} -\begin{ffcode} -System.out.println("Hello, world!"); -\end{ffcode} -\end{document} -\end{verbatim} -} -Don't use \ff{\char`\\plick} or \ff{\char`\\plush}, they won't work with code snippets. - -\ff{\char`\\pptHeader} prints a header similar to what \ff{\char`\\pptSection} prints, but -doesn't start a new section. - -\clearpage -\pptSection{Quotes} -\pptQuote{socrates.jpg}{The only true wisdom is in knowing you know nothing}{Socrates} -\begin{ffcode*}{fontsize=\scriptsize} -\begin{document} -\plush{\pptQuote{socrates.jpg} - {The only true wisdom is in knowing you know nothing}{Socrates}} -\end{document} -\end{ffcode*} - -\clearpage -\pptSection{Thoughts} -\plush{\pptThought{Socrates said that the only true wisdom is in knowing you know nothing. Was he a wise man?... By the way, I'm using \ff{\char`\\pptThought} in this slide.}} - -\clearpage -\pptSection[QR]{QR Codes} -Sometimes it's convenient to show a QR code to your audience instead of -a URL, since it's easier to use --- they can scan it: -\begin{ffcode*}{fontsize=\scriptsize} -\begin{document} -\plick{Check my blog post by this link:} -\plush{\pptQR{https://www.yegor256.com}} -\end{document} -\end{ffcode*} -The code will look like this, thanks to \href{https://ctan.org/pkg/qrcode}{qrcode} package that -we use behind the scene:\par -\pptQR[1in]{https://www.yegor256.com} - -\clearpage -\plush{ - \crumbection{Sources} - \pptMiddle{ - More details about this package you can find\\ - in \href{https://github.com/yegor256/ppt-slides}{yegor256/ppt-slides} GitHub repository. - } -} - -\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/ppt-slides/ppt-templates/ppt-9x6.tex b/macros/latex/contrib/ppt-slides/ppt-templates/ppt-9x6.tex index 3c7afa2bb2..10cf2a6f8d 100644 --- a/macros/latex/contrib/ppt-slides/ppt-templates/ppt-9x6.tex +++ b/macros/latex/contrib/ppt-slides/ppt-templates/ppt-9x6.tex @@ -26,6 +26,7 @@ \TPGrid{16}{16} \RequirePackage[tt=false,type1=true]{libertine} % the font we use \RequirePackage{microtype} % just to make rendering smooth +\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}} \RequirePackage{anyfontsize} % to support all sizes \RequirePackage{multicol} % for pptWide environment \RequirePackage[fontsize=24pt]{fontsize} % to make fonts larger diff --git a/macros/latex/contrib/semantex/semantex.pdf b/macros/latex/contrib/semantex/semantex.pdf Binary files differindex 64e0bae6cf..62ad68d435 100644 --- a/macros/latex/contrib/semantex/semantex.pdf +++ b/macros/latex/contrib/semantex/semantex.pdf diff --git a/macros/latex/contrib/semantex/semantex.sty b/macros/latex/contrib/semantex/semantex.sty index 1937f4e5c4..0543e3c030 100644 --- a/macros/latex/contrib/semantex/semantex.sty +++ b/macros/latex/contrib/semantex/semantex.sty @@ -1,5 +1,5 @@ \RequirePackage{xparse,l3keys2e,leftindex,semtex} -\ProvidesExplPackage{semantex}{2022/10/04}{0.522}{} +\ProvidesExplPackage{semantex}{2022/12/03}{0.523}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % @@ -10,7 +10,7 @@ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\tl_set:Nn\SemantexVersion{0.522} +\tl_set:Nn\SemantexVersion{0.523} \cs_set_eq:NN \semantex_keyval_parse:NNn \keyval_parse:NNn \cs_set:Npn \semantex_singlekey_parse:Nn#1#2 { \clist_map_function:nN { #2 } #1 } @@ -7072,6 +7072,7 @@ {dots}{sep~i~dots}, {...}{dots}, {slot}{sep~i~slot}, + {---}{slot}, {*}{sep~d~*}, {**}{sep~d~**}, }, @@ -7101,12 +7102,14 @@ data~provide=pre~arg, data~provide=post~arg, define~keys={ - {arg~dots}{set~arg~keys={...}}, - {arg~...}{set~arg~keys={dots}}, + {arg~dots}{set~arg~keys={dots}}, + {arg~...}{set~arg~keys={...}}, {comma~arg~dots}{set~arg~keys={comma~dots}}, {comma~arg~...}{set~arg~keys={comma~...}}, {arg~slot}{set~arg~keys={slot}}, + {arg~---}{set~arg~keys={---}}, {comma~arg~slot}{set~arg~keys={comma~slot}}, + {comma~arg~---}{set~arg~keys={comma~---}}, {clear~arg}{ execute={ \semantex_data_tl_clear:nn { ##1 } { arg } \semantex_data_int_clear:nn { ##1 } { number~of~arguments } @@ -7303,8 +7306,9 @@ {sep~arg}{set~arg~keys={sep={#1}}}, {comma~arg}{set~arg~keys={comma={#1}}}, {arg~dots~with~other~sep}{set~arg~keys={dots~with~other~sep={#1}}}, - {arg~...~with~other~sep}{set~arg~keys={dots~with~other~sep={#1}}}, + {arg~...~with~other~sep}{set~arg~keys={...~with~other~sep={#1}}}, {arg~slot~with~other~sep}{set~arg~keys={slot~with~other~sep={#1}}}, + {arg~---~with~other~sep}{set~arg~keys={---~with~other~sep={#1}}}, }, define~keys[2]={ {arg~with~other~sep}{set~arg~keys={other~sep={#1}{#2}}}, @@ -7380,8 +7384,11 @@ data~provide=post~upper, define~keys={ {upper~slot}{ set~keys~x={ upper=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~slot } } }, + {upper~---}{upper~slot}, {sep~upper~slot}{ set~keys~x={ sep~upper=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~slot } } }, + {sep~upper~---}{sep~upper~slot}, {comma~upper~slot}{ set~keys~x={ comma~upper=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~slot } } }, + {comma~upper~---}{comma~upper~slot}, {upper~dots}{ set~keys~x={ upper=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~dots } } }, {upper~...}{upper~dots}, {sep~upper~dots}{ set~keys~x={ sep~upper=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~dots } } }, @@ -7503,6 +7510,15 @@ } }, }, + {upper~---~with~other~sep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { upper~with~other~sep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upper~slot } } + } + }, + }, {set~upper~dots}{ execute={ \semantex_data_tl_set:nnn { ##1 } { upper~dots } { #1 } }, }, @@ -7567,8 +7583,11 @@ data~provide=post~lower, define~keys={ {lower~slot}{ set~keys~x={ lower=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~slot } } }, + {lower~---}{lower~slot}, {sep~lower~slot}{ set~keys~x={ sep~lower=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~slot } } }, + {sep~lower~---}{sep~lower~slot}, {comma~lower~slot}{ set~keys~x={ comma~lower=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~slot } } }, + {comma~lower~---}{comma~lower~slot}, {lower~dots}{ set~keys~x={ lower=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~dots } } }, {lower~...}{lower~dots}, {sep~lower~dots}{ set~keys~x={ sep~lower=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~dots } } }, @@ -7689,6 +7708,15 @@ } }, }, + {lower~---~with~other~sep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lower~with~other~sep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lower~slot } } + } + }, + }, {set~lower~dots}{ execute={ \semantex_data_tl_set:nnn { ##1 } { lower~dots } { #1 } }, }, @@ -7753,8 +7781,11 @@ data~provide=post~upper~left, define~keys={ {upper~left~slot}{ set~keys~x={ upper~left=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~left~slot } } }, + {upper~left~---}{upper~left~slot}, {sep~upper~left~slot}{ set~keys~x={ sep~upper~left=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~left~slot } } }, + {sep~upper~left~---}{sep~upper~left~slot}, {comma~upper~left~slot}{ set~keys~x={ comma~upper~left=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~left~slot } } }, + {comma~upper~left~---}{comma~upper~left~slot}, {upper~left~dots}{ set~keys~x={ upper~left=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~left~dots } } }, {upper~left~...}{upper~left~dots}, {sep~upper~left~dots}{ set~keys~x={ sep~upper~left=\semantex_data_tl_get_exp_not:nn { ##1 } { upper~left~dots } } }, @@ -7875,6 +7906,15 @@ } }, }, + {upper~left~---~with~other~sep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { upper~left~with~other~sep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { upper~left~slot } } + } + }, + }, {set~upper~left~dots}{ execute={ \semantex_data_tl_set:nnn { ##1 } { upper~left~dots } { #1 } }, }, @@ -7939,8 +7979,11 @@ data~provide=post~lower~left, define~keys={ {lower~left~slot}{ set~keys~x={ lower~left=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~left~slot } } }, + {lower~left~---}{lower~left~slot}, {sep~lower~left~slot}{ set~keys~x={ sep~lower~left=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~left~slot } } }, + {sep~lower~left~---}{sep~lower~left~slot}, {comma~lower~left~slot}{ set~keys~x={ comma~lower~left=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~left~slot } } }, + {comma~lower~left~---}{comma~lower~left~slot}, {lower~left~dots}{ set~keys~x={ lower~left=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~left~dots } } }, {lower~left~...}{lower~left~dots}, {sep~lower~left~dots}{ set~keys~x={ sep~lower~left=\semantex_data_tl_get_exp_not:nn { ##1 } { lower~left~dots } } }, @@ -8061,6 +8104,15 @@ } }, }, + {lower~left~---~with~other~sep}{ + execute={ + \semantex_valuekey:nnx { ##1 } { lower~left~with~other~sep } + { + { \exp_not:n { #1 } } + { \semantex_data_tl_get_exp_not:nn { ##1 } { lower~left~slot } }, + } + }, + }, {set~lower~left~dots}{ execute={ \semantex_data_tl_set:nnn { ##1 } { lower~left~dots } { #1 } }, }, @@ -8124,16 +8176,19 @@ { upper~slot } { lower~slot }, }, + {d~---}{d~slot}, {sep~d~slot}{ bool~if~TF={upper~grading} { sep~upper~slot } { sep~lower~slot }, }, + {sep~d~---}{sep~d~slot}, {comma~d~slot}{ bool~if~TF={upper~grading} { comma~upper~slot } { comma~lower~slot }, }, + {comma~d~---}{comma~d~slot}, {d~dots}{ bool~if~TF={upper~grading} { upper~dots } @@ -8283,6 +8338,15 @@ lower~slot~with~other~sep={#1}, }, }, + {d~---~with~other~sep}{ + bool~if~TF={upper~grading} + { + upper~---~with~other~sep={#1}, + } + { + lower~---~with~other~sep={#1}, + }, + }, {set~d~dots}{ bool~if~TF={upper~grading} { @@ -8302,7 +8366,13 @@ }, }, {d~...~with~other~sep}{ - d~dots~with~other~sep={#1}, + bool~if~TF={upper~grading} + { + upper~...~with~other~sep={#1}, + } + { + lower~...~with~other~sep={#1}, + }, }, {d~*~with~other~sep}{ bool~if~TF={upper~grading} @@ -8369,16 +8439,19 @@ { lower~slot } { upper~slot }, }, + {i~---}{i~slot}, {sep~i~slot}{ bool~if~TF={upper~grading} { sep~lower~slot } { sep~upper~slot }, }, + {sep~i~---}{sep~i~slot}, {comma~i~slot}{ bool~if~TF={upper~grading} { comma~lower~slot } { comma~upper~slot }, }, + {comma~i~---}{comma~i~slot}, {i~dots}{ bool~if~TF={upper~grading} { lower~dots } @@ -8527,6 +8600,15 @@ upper~slot~with~other~sep={#1}, }, }, + {i~---~with~other~sep}{ + bool~if~TF={upper~grading} + { + lower~---~with~other~sep={#1}, + } + { + upper~---~with~other~sep={#1}, + }, + }, {set~i~dots}{ bool~if~TF={upper~grading} { @@ -8546,7 +8628,13 @@ }, }, {i~...~with~other~sep}{ - i~dots~with~other~sep={#1}, + bool~if~TF={upper~grading} + { + lower~...~with~other~sep={#1}, + } + { + upper~...~with~other~sep={#1}, + }, }, {i~*~with~other~sep}{ bool~if~TF={upper~grading} @@ -8712,7 +8800,6 @@ {set~arg~without~keyval~x}{ execute={ \semantex_arg_without_keyval:nx { ##1 } { #1 } } }, {arg~without~keyval~set~x}{ execute={ \semantex_arg_without_keyval:nx { ##1 } { #1 } } }, {default}{sep={#1}}, - {...~with~other~sep}{dots~with~other~sep={#1}}, {sep}{ execute={ \semantex_data_bool_get:nnTF { ##1 } { next~arg~with~sep } @@ -8752,6 +8839,7 @@ } }, }, + {...~with~other~sep}{dots~with~other~sep={#1}}, {slot~with~other~sep}{ execute={ \semantex_arg_valuekey:nnx { ##1 } { other~sep } @@ -8761,6 +8849,7 @@ } }, }, + {---~with~other~sep}{slot~with~other~sep={#1}}, }, define~arg~keys={ {dots}{ @@ -8789,6 +8878,7 @@ } }, }, + {---}{slot}, {comma~slot}{ execute={ \semantex_arg_valuekey:nnx { ##1 } { comma } @@ -8797,6 +8887,7 @@ } }, }, + {comma~---}{comma~slot}, }, define~arg~keys[2]={ {other~sep}{ diff --git a/macros/latex/contrib/semantex/semantex.tex b/macros/latex/contrib/semantex/semantex.tex index 08587d1ad8..5868300ec0 100644 --- a/macros/latex/contrib/semantex/semantex.tex +++ b/macros/latex/contrib/semantex/semantex.tex @@ -1952,7 +1952,7 @@ on \( \vn \)~elements. ] \NewObject\MyVar\inner[left par=\langle, right par=\rangle] -In this chapter, se show how to define delimiter commands like \( \norm{slot} \) and~\( \inner{slot,slot} \). +In this chapter, se show how to define delimiter commands like \( \norm{---} \) and~\( \inner{---,---} \). This is easy to do via the keys \lstinline!left par! and~\lstinline!right par!: \begin{lstlisting} \NewObject\MyVar\norm[left par=\lVert, right par=\rVert] @@ -1962,10 +1962,10 @@ Indeed: \begin{LTXexample} $\norm{\va}$, $\inner{\va,\vb}$, -$\inner{slot,slot}$ +$\inner{---,---}$ \end{LTXexample} In the case where you want to use different kinds of -norms, say \( \norm[2]{slot} \) or~\( \norm[\infty]{slot} \), +norms, say \( \norm[2]{---} \) or~\( \norm[\infty]{---} \), you can use the key~\mylst!output options={$\<options\>$}!. This allows you to pass the~\<options\> to the output class (in this case,~\lstinline!\MyVar!): @@ -3706,12 +3706,12 @@ In the following sections, we include the full list. Adds a double bullet to the \lstinline!d!-index. \item - \mylst!slot! + \mylst!---!, \mylst!slot! Adds a slot to the \lstinline!i!-index. \item - \mylst!dots!, \mylst!...! + \mylst!...!, \mylst!dots! Adds three dots to the \lstinline!i!-index. @@ -4034,33 +4034,35 @@ In the following sections, we include the full list. argument by the \<separator\>. \item + \mylst!arg --- with other sep={$\<separator\>$}!, \mylst!arg slot with other sep={$\<separator\>$}! Adds a slot to the argument, separated from any previous argument by the \<separator\>. \item - \mylst!arg dots!, \mylst!arg ...! + \mylst!arg ...!, \mylst!arg dots! Adds three dots to the argument, separated from any previous arguments by the standard separator. \item - \mylst!comma arg dots!, \mylst!comma arg ...! + \mylst!comma arg ...!, \mylst!comma arg dots! Adds three dots to the argument, separated from any previous arguments by a comma. \item - \mylst!arg slot! + \mylst!arg ---!, \mylst!arg slot! Adds a slot to the argument, separated from any previous arguments by the standard separator. \item + \mylst!comma arg ---!, \mylst!comma arg slot! Adds a slot to the argument, @@ -4156,12 +4158,14 @@ In the following sections, we include the full list. any prevous upper index by~\<separator\>. \item + \mylst!upper ---!, \mylst!upper slot! Adds a slot to the upper index, with no separator from any previous upper index. \item + \mylst!sep upper ---!, \mylst!sep upper slot! Adds a slot to the upper index, @@ -4169,6 +4173,7 @@ In the following sections, we include the full list. index by the default separator. \item + \mylst!comma upper ---!, \mylst!comma upper slot! Adds a slot to the upper index, @@ -4182,6 +4187,7 @@ In the following sections, we include the full list. By default, this is~\lstinline!{-}!. \item + \mylst!upper --- with other sep={$\<separator\>$}!,\\ \mylst!upper slot with other sep={$\<separator\>$}! @@ -4364,20 +4370,20 @@ In the following sections, we include the full list. any prevous lower index by~\<separator\>. \item - \mylst!lower slot! + \mylst!lower ---!, \mylst!lower slot! Adds a slot to the lower index, with no separator from any previous lower index. \item - \mylst!sep lower slot! + \mylst!sep lower ---!, \mylst!sep lower slot! Adds a slot to the lower index, separated from any previous lower index by the default separator. \item - \mylst!comma lower slot! + \mylst!comma lower ---!, \mylst!comma lower slot! Adds a slot to the lower index, separated from any previous lower @@ -4390,6 +4396,7 @@ In the following sections, we include the full list. By default, this is~\lstinline!{-}!. \item + \mylst!lower --- with other sep={$\<separator\>$}!,\\ \mylst!lower slot with other sep={$\<separator\>$}! @@ -4572,20 +4579,20 @@ In the following sections, we include the full list. any prevous upper left index by~\<separator\>. \item - \mylst!upper left slot! + \mylst!upper left ---!, \mylst!upper left slot! Adds a slot to the upper left index, with no separator from any previous upper left index. \item - \mylst!sep upper left slot! + \mylst!sep upper left ---!, \mylst!sep upper left slot! Adds a slot to the upper left index, separated from any previous upper left index by the default separator. \item - \mylst!comma upper left slot! + \mylst!comma upper left ---!, \mylst!comma upper left slot! Adds a slot to the upper left index, separated from any previous upper left @@ -4598,6 +4605,7 @@ In the following sections, we include the full list. By default, this is~\lstinline!{-}!. \item + \mylst!upper left --- with other sep={$\<separator\>$}!,\\ \mylst!upper left slot with other sep={$\<separator\>$}! @@ -4780,20 +4788,20 @@ In the following sections, we include the full list. any prevous lower left index by~\<separator\>. \item - \mylst!lower left slot! + \mylst!lower left ---!, \mylst!lower left slot! Adds a slot to the lower left index, with no separator from any previous lower left index. \item - \mylst!sep lower left slot! + \mylst!sep lower left ---!, \mylst!sep lower left slot! Adds a slot to the lower left index, separated from any previous lower left index by the default separator. \item - \mylst!comma lower left slot! + \mylst!comma lower left ---!, \mylst!comma lower left slot! Adds a slot to the lower left index, separated from any previous lower left @@ -4806,6 +4814,7 @@ In the following sections, we include the full list. By default, this is~\lstinline!{-}!. \item + \mylst!lower left --- with other sep={$\<separator\>$}!,\\ \mylst!lower left slot with other sep={$\<separator\>$}! @@ -4988,20 +4997,20 @@ In the following sections, we include the full list. any prevous \lstinline!d!-index by~\<separator\>. \item - \mylst!d slot! + \mylst!d ---!, \mylst!d slot! Adds a slot to the \lstinline!d!-index, with no separator from any previous \lstinline!d!-index. \item - \mylst!sep d slot! + \mylst!sep d ---!, \mylst!sep d slot! Adds a slot to the \lstinline!d!-index, separated from any previous \lstinline!d!-index by the default separator. \item - \mylst!comma d slot! + \mylst!comma d ---!, \mylst!comma d slot! Adds a slot to the \lstinline!d!-index, separated from any previous \lstinline!d!-index @@ -5014,6 +5023,7 @@ In the following sections, we include the full list. By default, this is~\lstinline!{-}!. \item + \mylst!d --- with other sep={$\<separator\>$}!, \mylst!d slot with other sep={$\<separator\>$}! Adds a slot to the \lstinline!d!-index, separated @@ -5195,20 +5205,20 @@ In the following sections, we include the full list. any prevous \lstinline!i!-index by~\<separator\>. \item - \mylst!i slot! + \mylst!i ---!, \mylst!i slot! Adds a slot to the \lstinline!i!-index, with no separator from any previous \lstinline!i!-index. \item - \mylst!sep i slot! + \mylst!sep i ---!, \mylst!sep i slot! Adds a slot to the \lstinline!i!-index, separated from any previous \lstinline!i!-index by the default separator. \item - \mylst!comma i slot! + \mylst!comma i ---!, \mylst!comma i slot! Adds a slot to the \lstinline!i!-index, separated from any previous \lstinline!i!-index @@ -5221,6 +5231,7 @@ In the following sections, we include the full list. By default, this is~\lstinline!{-}!. \item + \mylst!i --- with other sep={$\<separator\>$}!, \mylst!i slot with other sep={$\<separator\>$}! @@ -5445,14 +5456,14 @@ These are the predefined keys that work inside the argument. by a comma. \item - \mylst!slot! + \mylst!---!, \mylst!slot! Adds a slot to the argument, separated from any previous argument by the default separator. \item - \mylst!comma slot! + \mylst!comma ---!, \mylst!comma slot! Adds a slot to the argument, separated from any previous argument @@ -5480,6 +5491,7 @@ These are the predefined keys that work inside the argument. by~\<separator\>. \item + \mylst!--- with other sep={$\<separator\>$}!, \mylst!slot with other sep={$\<separator\>$}! Adds a slot to the argument, separated diff --git a/macros/latex/contrib/semantex/stripsemantex.lua b/macros/latex/contrib/semantex/stripsemantex.lua index d0eb5d1963..30d4c58be6 100644 --- a/macros/latex/contrib/semantex/stripsemantex.lua +++ b/macros/latex/contrib/semantex/stripsemantex.lua @@ -1,311 +1,311 @@ --- aliases for protected environments
-local assert, io_open
- = assert, io.open
-
--- load the ltn12 module
-local ltn12 = require("ltn12")
-
--- No more global accesses after this point
-if _VERSION == "Lua 5.2" then _ENV = nil end
-
--- copy a file
-copy_file = function(path_src, path_dst)
- ltn12.pump.all(
- ltn12.source.file(assert(io_open(path_src, "rb"))),
- ltn12.sink.file(assert(io_open(path_dst, "wb")))
- )
-end
-
-openFile = function(file)
- f = io.open(file, "r")
- filecontent = f:read("*all")
- local beginDocPosition = filecontent:find('\\begin{document}')
- if not beginDocPosition then
- tex.sprint( [[\begingroup\ExplSyntaxOn
- \msg_fatal:nnn { stripsemantex } { begin_document_not_found } { ]] .. file .. [[ }
- \endgroup]] )
- return
- end
- precontent = filecontent:sub(1,beginDocPosition-1)
- content = filecontent:sub(beginDocPosition,-1)
- f:close()
-end
-
-closeFile = function(file)
- f = io.open(file, "w")
- f:write(precontent .. content)
- f:close()
-end
-
-removeStricttexFormatting = function(str)
- -- We do this in case the package "stricttex" was used
- str = str:gsub('numberZERO','0')
- str = str:gsub('numberONE','1')
- str = str:gsub('numberTWO','2')
- str = str:gsub('numberTHREE','3')
- str = str:gsub('numberFOUR','4')
- str = str:gsub('numberFIVE','5')
- str = str:gsub('numberSIX','6')
- str = str:gsub('numberSEVEN','7')
- str = str:gsub('numberEIGHT','8')
- str = str:gsub('numberNINE','9')
- str = str:gsub('symbolPRIME','\'')
- return str
-end
-
-addIDsToRegisters = function(str)
- str = removeStricttexFormatting(str)
- content = content:gsub('\\' .. str .. '([^%a])' ,'\\SemantexID{}\\' .. str .. '%1')
- -- '%f[^%a]' does not work here, as it will not react if the last character of str is a number,
- -- which stricttex allows.
- -- Because of this choice, there will be an issue if you use stricttex and let
- -- \<command> by a SemanTeX command and \<command>' be a non-SemanTeX command.
- -- So simply *don't do that*.
-end
-
-removeSuperfluousIDs = function()
- local p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)')
- while p do
- content = content:gsub('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)','%1%2')
- p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)')
- end
- content = content:gsub('parent(%s*)=(%s*)\\SemantexID{}','parent%1=%2')
- content = content:gsub('class(%s*)=(%s*)\\SemantexID{}','class%1=%2')
- content = content:gsub('clone(%s*)=(%s*)\\SemantexID{}','clone%1=%2')
- content = content:gsub('copy(%s*)=(%s*)\\SemantexID{}','copy%1=%2')
- content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexID{}','\\New%1Class%2')
- content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexID{}(\\%w+%s*}?%s*{?%s*)\\SemantexID{}', '\\NewObject%1%2')
- content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexID{}', '\\SetupClass%1')
- content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexID{}', '\\SetupObject%1')
-end
-
-addNumbersToIDs = function()
- local n = 0
- local p,q = string.find(content,'\\SemantexID{}')
- while q do
- n = n + 1
- content = content:sub(1,q-1) .. n .. content:sub(q,-1)
- p, q = string.find(content,'\\SemantexID{}')
- end
-end
-
-semantexIDluacommand = function(id, source, output)
- local p, q = string.find(content, '\\SemantexID{' .. id .. '}')
-
- while p do
- content = content:sub(1,p-1) .. content:sub(q+1,-1)
-
- source = source:gsub('%s+', '')
-
- -- We do this in case the package "stricttex" was used
- source = removeStricttexFormatting(source)
-
- -- This is because #1's in the code becomes ##1
- -- in the .semtex file.
- source = source:gsub('#(%d)', '%1')
-
- local length = source:len()
-
- local i = 1
-
- local s
-
- while i <= length do
- s = content:sub(p,p)
- if s == source:sub(i,i) then
- content = content:sub(1 , p-1) .. content:sub(p+1, -1)
- i = i + 1
- elseif s:match('%s') then
- content = content:sub(1, p-1) .. content:sub(p+1, -1)
- elseif s == '%' then
- content = content:sub(1 , p-1) .. content:sub(p,-1):gsub('%%.-\n','',1)
- elseif s == '{' then
- -- In this case, we remove the corresponding right brace,
- -- once we find it
- local netto = 1 -- The current brace group level
- local q = 0 -- The position we have moved forward so far
- while netto > 0 do
- q = q + 1
- local e = content:sub(p+q,p+q)
- if e == '}' then
- netto = netto - 1
- elseif e == '{' then
- netto = netto + 1
- elseif e == '\\' then
- q = q + 1
- elseif e == '%' then
- content = content:sub(1, p+q-1) .. content:sub(p+q,-1):gsub('%%.-\n','',1)
- q = q - 1
- end
- end
- content = content:sub(1,p-1) .. content:sub(p+1,p+q-1) .. content:sub(p+q+1,-1)
- elseif s == '<' and content:sub(p+1,p+2) == '[>' then
- content = content:sub(1,p-1) .. content:sub(p+3,-1)
- i = i + 1
- elseif s == '<' and content:sub(p+1,p+2) == ']>' then
- content = content:sub(1,p-1) .. content:sub(p+3,-1)
- i = i + 1
- elseif source:sub(i,i) == '{' then
- -- In this case, we remove the corresponding right brace,
- -- once we find it
- local netto = 1 -- The current brace group level
- local q = 0 -- The position we have moved forward so far
- while netto > 0 do
- q = q + 1
- local e = source:sub(i+q,i+q)
- if e == '}' then
- netto = netto - 1
- elseif e == '{' then
- netto = netto + 1
- elseif e == '\\' then
- q = q + 1
- -- there is no chance that the source contains an unescaped %, so we do not
- -- check for this
- end
- end
- source = source:sub(1,i-1) .. source:sub(i+1,i+q-1) .. source:sub(i+q+1,-1)
- length = source:len()
- else
- tex.sprint( [[\begingroup\ExplSyntaxOn
- \msg_fatal:nnnn { stripsemantex } { source_not_expected } { ]] .. source:sub(i,i) .. [[ } { ]] .. s .. [[ }
- \endgroup]] )
- break
- end
- end
-
-
- output = output:gsub('%s*\\sp {', '^{')
- output = output:gsub('%s*\\sb {', '_{')
- output = output:gsub('\\mathopen \\big ', '\\bigl')
- output = output:gsub('\\mathclose \\big ', '\\bigr')
- output = output:gsub('\\mathopen \\Big ', '\\Bigl')
- output = output:gsub('\\mathclose \\Big ', '\\Bigr')
- output = output:gsub('\\mathopen \\bigg ', '\\biggl')
- output = output:gsub('\\mathclose \\bigg ', '\\biggr')
- output = output:gsub('\\mathopen \\Bigg ', '\\Biggl')
- output = output:gsub('\\mathclose \\Bigg ', '\\Biggr')
- output = output:gsub('\\mathopen %(', '(')
- output = output:gsub('\\mathclose %)', ')')
- output = output:gsub('\\mathopen %[', '[')
- output = output:gsub('\\mathclose %]', ']')
- output = output:gsub('\\mathopen \\{', '\\{')
- output = output:gsub('\\mathclose \\}', '\\}')
- output = output:gsub('\\mathopen \\lbrace', '\\lbrace')
- output = output:gsub('\\mathclose \\rbrace', '\\rbrace')
- output = output:gsub('\\mathopen \\lbrack', '\\lbrack')
- output = output:gsub('\\mathclose \\rbrack', '\\rbrack')
- output = output:gsub('\\mathopen \\langle', '\\langle')
- output = output:gsub('\\mathclose \\rangle', '\\rangle')
- output = output:gsub('\\mathopen \\lvert', '\\lvert')
- output = output:gsub('\\mathclose \\rvert', '\\rvert')
- output = output:gsub('\\mathopen \\vert', '\\lvert')
- output = output:gsub('\\mathclose \\vert', '\\rvert')
- output = output:gsub('\\mathopen \\lVert', '\\lVert')
- output = output:gsub('\\mathclose \\rVert', '\\rVert')
- output = output:gsub('\\mathopen \\Vert', '\\lVert')
- output = output:gsub('\\mathclose \\Vert', '\\rVert')
- output = output:gsub('%^{\\prime }', '\'')
- output = output:gsub('%^{\\prime \\prime }', '\'\'')
- output = output:gsub('%^{\\prime \\prime \\prime }', '\'\'\'')
- output = output:gsub('%^{\\prime \\prime \\prime \\prime }', '\'\'\'\'')
- output = output:gsub('%^{\\prime \\prime \\prime \\prime \\prime }', '\'\'\'\'\'')
-
- output = output:gsub('%s+%f[{}%[%]%(%)%$,]','')
- output = output:gsub('([}%]%)])%f[\\%w%+%-%(%[=]', '%1 ')
- output = output:gsub(',',', ')
- output = output:gsub('%s+$', '')
-
-
- -- We now check whether the string we add will follow right
- -- after a control sequence, causing it to be interpreted
- -- as part of that control sequence.
- -- Because we want to allow the user to use stricttex, we
- -- check for alphanumerical control sequences rather than
- -- just alphabetic ones. This could add spaces that
- -- the user might not have intended, but it's a minor issue.
- if output:sub(1,1):match('%w') and content:sub(1, p-1):match('\\%w+$') then
- content = content:sub(1,p-1) .. ' ' .. output .. content:sub(p,-1)
- else
- content = content:sub(1,p-1) .. output .. content:sub(p,-1)
- end
- p, q = string.find(content, '\\SemantexID{' .. id .. '}')
- end
-end
-
-stripRemainingSemantexIDs = function()
- content = content:gsub('\\SemantexID{%d+}', '')
-end
-
-removeParenthesisCommands = function()
- content = content:gsub('\\SemantexMathOpen \\bigg%s?', '\\biggl')
- content = content:gsub('\\SemantexMathClose \\bigg%s?', '\\biggr')
- content = content:gsub('\\SemantexMathOpen \\Bigg%s?', '\\Biggl')
- content = content:gsub('\\SemantexMathClose \\Bigg%s?', '\\Biggr')
- content = content:gsub('\\SemantexMathOpen \\big%s?', '\\bigl')
- content = content:gsub('\\SemantexMathClose \\big%s?', '\\bigr')
- content = content:gsub('\\SemantexMathOpen \\Big%s?', '\\Bigl')
- content = content:gsub('\\SemantexMathClose \\Big%s?', '\\Bigr')
- content = content:gsub('\\SemantexMathOpen{} %(', '(')
- content = content:gsub('%s*\\SemantexMathClose{}%)', ')')
- content = content:gsub('\\SemantexMathOpen{} %[', '[')
- content = content:gsub('%s*\\SemantexMathClose{}%]', ']')
- content = content:gsub('\\SemantexMathOpen{} \\{', '\\{')
- content = content:gsub('%s*\\SemantexMathClose{} \\}', '\\}')
- content = content:gsub('\\SemantexMathOpen{} \\lbrace', '\\lbrace')
- content = content:gsub('\\SemantexMathClose{} \\rbrace', '\\rbrace')
- content = content:gsub('\\SemantexMathOpen{} \\lbrack', '\\rbrack')
- content = content:gsub('\\SemantexMathClose{} \\rbrack', '\\rbrack')
- content = content:gsub('\\SemantexMathOpen{} \\langle', '\\langle')
- content = content:gsub('\\SemantexMathClose{} \\rangle', '\\rangle')
- content = content:gsub('\\SemantexMathOpen{} \\lvert', '\\lvert')
- content = content:gsub('\\SemantexMathClose{} \\rvert', '\\rvert')
- content = content:gsub('\\SemantexMathOpen{} \\vert', '\\lvert')
- content = content:gsub('\\SemantexMathClose{} \\vert', '\\rvert')
- content = content:gsub('\\SemantexMathOpen{} \\lVert', '\\lVert')
- content = content:gsub('\\SemantexMathClose{} \\rVert', '\\rVert')
- content = content:gsub('\\SemantexMathOpen{} \\Vert', '\\lVert')
- content = content:gsub('\\SemantexMathClose{} \\Vert', '\\rVert')
- content = content:gsub('\\SemantexMathOpen{} .%s?', '')
- content = content:gsub('\\SemantexMathClose{} .%s?', '')
- content = content:gsub('\\SemantexMathOpen{}', '\\mathopen ')
- content = content:gsub('\\SemantexMathClose{}', '\\mathclose ')
- content = content:gsub('\\SemantexMathOpenAuto%s?', '\\SemantexLeft')
- content = content:gsub('\\SemantexMathCloseAuto%s?', '\\SemantexRight')
- content = content:gsub('\\SemantexMathOpenNoPar%s?', '')
- content = content:gsub('\\SemantexMathCloseNoPar%s?', '')
- content = content:gsub('\\SemantexMathOpen%s?', '\\mathopen')
- content = content:gsub('\\SemantexMathClose%s?', '\\mathclose')
-end
-
-stripComments = function()
- content = content:gsub('\\%%', '\\StripSemantexEscapedPercent')
- content = content:gsub('(\\%w+)%%.-\n%s*', '%1 ')
- content = content:gsub('%%.-\n%s*', '')
- content = content:gsub('\\StripSemantexEscapedPercent', '\\%%')
-end
-
-addSemtexPackageToFile = function()
- content = [[% The following was added by "stripsemantex":
-
-\usepackage{semtex,leftindex,graphicx}
-
-\providecommand\SemantexLeft{%
- \mathopen{}\mathclose\bgroup\left
-}
-
-\providecommand\SemantexRight{%
- \aftergroup\egroup\right
-}
-
-\makeatletter
-\DeclareRobustCommand\SemantexBullet{%
- \mathord{\mathpalette\SemantexBullet@{0.5}}%
-}
-\newcommand\SemantexBullet@[2]{%
- \vcenter{\hbox{\scalebox{#2}{$\m@th#1\bullet$}}}%
-}
-\DeclareRobustCommand\SemantexDoubleBullet{\SemantexBullet \SemantexBullet}
-\makeatother
-
-]] .. content
+-- aliases for protected environments +local assert, io_open + = assert, io.open + +-- load the ltn12 module +local ltn12 = require("ltn12") + +-- No more global accesses after this point +if _VERSION == "Lua 5.2" then _ENV = nil end + +-- copy a file +copy_file = function(path_src, path_dst) + ltn12.pump.all( + ltn12.source.file(assert(io_open(path_src, "rb"))), + ltn12.sink.file(assert(io_open(path_dst, "wb"))) + ) +end + +openFile = function(file) + f = io.open(file, "r") + filecontent = f:read("*all") + local beginDocPosition = filecontent:find('\\begin{document}') + if not beginDocPosition then + tex.sprint( [[\begingroup\ExplSyntaxOn + \msg_fatal:nnn { stripsemantex } { begin_document_not_found } { ]] .. file .. [[ } + \endgroup]] ) + return + end + precontent = filecontent:sub(1,beginDocPosition-1) + content = filecontent:sub(beginDocPosition,-1) + f:close() +end + +closeFile = function(file) + f = io.open(file, "w") + f:write(precontent .. content) + f:close() +end + +removeStricttexFormatting = function(str) + -- We do this in case the package "stricttex" was used + str = str:gsub('numberZERO','0') + str = str:gsub('numberONE','1') + str = str:gsub('numberTWO','2') + str = str:gsub('numberTHREE','3') + str = str:gsub('numberFOUR','4') + str = str:gsub('numberFIVE','5') + str = str:gsub('numberSIX','6') + str = str:gsub('numberSEVEN','7') + str = str:gsub('numberEIGHT','8') + str = str:gsub('numberNINE','9') + str = str:gsub('symbolPRIME','\'') + return str +end + +addIDsToRegisters = function(str) + str = removeStricttexFormatting(str) + content = content:gsub('\\' .. str .. '([^%a])' ,'\\SemantexID{}\\' .. str .. '%1') + -- '%f[^%a]' does not work here, as it will not react if the last character of str is a number, + -- which stricttex allows. + -- Because of this choice, there will be an issue if you use stricttex and let + -- \<command> by a SemanTeX command and \<command>' be a non-SemanTeX command. + -- So simply *don't do that*. +end + +removeSuperfluousIDs = function() + local p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)') + while p do + content = content:gsub('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)','%1%2') + p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)') + end + content = content:gsub('parent(%s*)=(%s*)\\SemantexID{}','parent%1=%2') + content = content:gsub('class(%s*)=(%s*)\\SemantexID{}','class%1=%2') + content = content:gsub('clone(%s*)=(%s*)\\SemantexID{}','clone%1=%2') + content = content:gsub('copy(%s*)=(%s*)\\SemantexID{}','copy%1=%2') + content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexID{}','\\New%1Class%2') + content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexID{}(\\%w+%s*}?%s*{?%s*)\\SemantexID{}', '\\NewObject%1%2') + content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexID{}', '\\SetupClass%1') + content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexID{}', '\\SetupObject%1') +end + +addNumbersToIDs = function() + local n = 0 + local p,q = string.find(content,'\\SemantexID{}') + while q do + n = n + 1 + content = content:sub(1,q-1) .. n .. content:sub(q,-1) + p, q = string.find(content,'\\SemantexID{}') + end +end + +semantexIDluacommand = function(id, source, output) + local p, q = string.find(content, '\\SemantexID{' .. id .. '}') + + while p do + content = content:sub(1,p-1) .. content:sub(q+1,-1) + + source = source:gsub('%s+', '') + + -- We do this in case the package "stricttex" was used + source = removeStricttexFormatting(source) + + -- This is because #1's in the code becomes ##1 + -- in the .semtex file. + source = source:gsub('#(%d)', '%1') + + local length = source:len() + + local i = 1 + + local s + + while i <= length do + s = content:sub(p,p) + if s == source:sub(i,i) then + content = content:sub(1 , p-1) .. content:sub(p+1, -1) + i = i + 1 + elseif s:match('%s') then + content = content:sub(1, p-1) .. content:sub(p+1, -1) + elseif s == '%' then + content = content:sub(1 , p-1) .. content:sub(p,-1):gsub('%%.-\n','',1) + elseif s == '{' then + -- In this case, we remove the corresponding right brace, + -- once we find it + local netto = 1 -- The current brace group level + local q = 0 -- The position we have moved forward so far + while netto > 0 do + q = q + 1 + local e = content:sub(p+q,p+q) + if e == '}' then + netto = netto - 1 + elseif e == '{' then + netto = netto + 1 + elseif e == '\\' then + q = q + 1 + elseif e == '%' then + content = content:sub(1, p+q-1) .. content:sub(p+q,-1):gsub('%%.-\n','',1) + q = q - 1 + end + end + content = content:sub(1,p-1) .. content:sub(p+1,p+q-1) .. content:sub(p+q+1,-1) + elseif s == '<' and content:sub(p+1,p+2) == '[>' then + content = content:sub(1,p-1) .. content:sub(p+3,-1) + i = i + 1 + elseif s == '<' and content:sub(p+1,p+2) == ']>' then + content = content:sub(1,p-1) .. content:sub(p+3,-1) + i = i + 1 + elseif source:sub(i,i) == '{' then + -- In this case, we remove the corresponding right brace, + -- once we find it + local netto = 1 -- The current brace group level + local q = 0 -- The position we have moved forward so far + while netto > 0 do + q = q + 1 + local e = source:sub(i+q,i+q) + if e == '}' then + netto = netto - 1 + elseif e == '{' then + netto = netto + 1 + elseif e == '\\' then + q = q + 1 + -- there is no chance that the source contains an unescaped %, so we do not + -- check for this + end + end + source = source:sub(1,i-1) .. source:sub(i+1,i+q-1) .. source:sub(i+q+1,-1) + length = source:len() + else + tex.sprint( [[\begingroup\ExplSyntaxOn + \msg_fatal:nnnn { stripsemantex } { source_not_expected } { ]] .. source:sub(i,i) .. [[ } { ]] .. s .. [[ } + \endgroup]] ) + break + end + end + + + output = output:gsub('%s*\\sp {', '^{') + output = output:gsub('%s*\\sb {', '_{') + output = output:gsub('\\mathopen \\big ', '\\bigl') + output = output:gsub('\\mathclose \\big ', '\\bigr') + output = output:gsub('\\mathopen \\Big ', '\\Bigl') + output = output:gsub('\\mathclose \\Big ', '\\Bigr') + output = output:gsub('\\mathopen \\bigg ', '\\biggl') + output = output:gsub('\\mathclose \\bigg ', '\\biggr') + output = output:gsub('\\mathopen \\Bigg ', '\\Biggl') + output = output:gsub('\\mathclose \\Bigg ', '\\Biggr') + output = output:gsub('\\mathopen %(', '(') + output = output:gsub('\\mathclose %)', ')') + output = output:gsub('\\mathopen %[', '[') + output = output:gsub('\\mathclose %]', ']') + output = output:gsub('\\mathopen \\{', '\\{') + output = output:gsub('\\mathclose \\}', '\\}') + output = output:gsub('\\mathopen \\lbrace', '\\lbrace') + output = output:gsub('\\mathclose \\rbrace', '\\rbrace') + output = output:gsub('\\mathopen \\lbrack', '\\lbrack') + output = output:gsub('\\mathclose \\rbrack', '\\rbrack') + output = output:gsub('\\mathopen \\langle', '\\langle') + output = output:gsub('\\mathclose \\rangle', '\\rangle') + output = output:gsub('\\mathopen \\lvert', '\\lvert') + output = output:gsub('\\mathclose \\rvert', '\\rvert') + output = output:gsub('\\mathopen \\vert', '\\lvert') + output = output:gsub('\\mathclose \\vert', '\\rvert') + output = output:gsub('\\mathopen \\lVert', '\\lVert') + output = output:gsub('\\mathclose \\rVert', '\\rVert') + output = output:gsub('\\mathopen \\Vert', '\\lVert') + output = output:gsub('\\mathclose \\Vert', '\\rVert') + output = output:gsub('%^{\\prime }', '\'') + output = output:gsub('%^{\\prime \\prime }', '\'\'') + output = output:gsub('%^{\\prime \\prime \\prime }', '\'\'\'') + output = output:gsub('%^{\\prime \\prime \\prime \\prime }', '\'\'\'\'') + output = output:gsub('%^{\\prime \\prime \\prime \\prime \\prime }', '\'\'\'\'\'') + + output = output:gsub('%s+%f[{}%[%]%(%)%$,]','') + output = output:gsub('([}%]%)])%f[\\%w%+%-%(%[=]', '%1 ') + output = output:gsub(',',', ') + output = output:gsub('%s+$', '') + + + -- We now check whether the string we add will follow right + -- after a control sequence, causing it to be interpreted + -- as part of that control sequence. + -- Because we want to allow the user to use stricttex, we + -- check for alphanumerical control sequences rather than + -- just alphabetic ones. This could add spaces that + -- the user might not have intended, but it's a minor issue. + if output:sub(1,1):match('%w') and content:sub(1, p-1):match('\\%w+$') then + content = content:sub(1,p-1) .. ' ' .. output .. content:sub(p,-1) + else + content = content:sub(1,p-1) .. output .. content:sub(p,-1) + end + p, q = string.find(content, '\\SemantexID{' .. id .. '}') + end +end + +stripRemainingSemantexIDs = function() + content = content:gsub('\\SemantexID{%d+}', '') +end + +removeParenthesisCommands = function() + content = content:gsub('\\SemantexMathOpen \\bigg%s?', '\\biggl') + content = content:gsub('\\SemantexMathClose \\bigg%s?', '\\biggr') + content = content:gsub('\\SemantexMathOpen \\Bigg%s?', '\\Biggl') + content = content:gsub('\\SemantexMathClose \\Bigg%s?', '\\Biggr') + content = content:gsub('\\SemantexMathOpen \\big%s?', '\\bigl') + content = content:gsub('\\SemantexMathClose \\big%s?', '\\bigr') + content = content:gsub('\\SemantexMathOpen \\Big%s?', '\\Bigl') + content = content:gsub('\\SemantexMathClose \\Big%s?', '\\Bigr') + content = content:gsub('\\SemantexMathOpen{} %(', '(') + content = content:gsub('%s*\\SemantexMathClose{}%)', ')') + content = content:gsub('\\SemantexMathOpen{} %[', '[') + content = content:gsub('%s*\\SemantexMathClose{}%]', ']') + content = content:gsub('\\SemantexMathOpen{} \\{', '\\{') + content = content:gsub('%s*\\SemantexMathClose{} \\}', '\\}') + content = content:gsub('\\SemantexMathOpen{} \\lbrace', '\\lbrace') + content = content:gsub('\\SemantexMathClose{} \\rbrace', '\\rbrace') + content = content:gsub('\\SemantexMathOpen{} \\lbrack', '\\rbrack') + content = content:gsub('\\SemantexMathClose{} \\rbrack', '\\rbrack') + content = content:gsub('\\SemantexMathOpen{} \\langle', '\\langle') + content = content:gsub('\\SemantexMathClose{} \\rangle', '\\rangle') + content = content:gsub('\\SemantexMathOpen{} \\lvert', '\\lvert') + content = content:gsub('\\SemantexMathClose{} \\rvert', '\\rvert') + content = content:gsub('\\SemantexMathOpen{} \\vert', '\\lvert') + content = content:gsub('\\SemantexMathClose{} \\vert', '\\rvert') + content = content:gsub('\\SemantexMathOpen{} \\lVert', '\\lVert') + content = content:gsub('\\SemantexMathClose{} \\rVert', '\\rVert') + content = content:gsub('\\SemantexMathOpen{} \\Vert', '\\lVert') + content = content:gsub('\\SemantexMathClose{} \\Vert', '\\rVert') + content = content:gsub('\\SemantexMathOpen{} .%s?', '') + content = content:gsub('\\SemantexMathClose{} .%s?', '') + content = content:gsub('\\SemantexMathOpen{}', '\\mathopen ') + content = content:gsub('\\SemantexMathClose{}', '\\mathclose ') + content = content:gsub('\\SemantexMathOpenAuto%s?', '\\SemantexLeft') + content = content:gsub('\\SemantexMathCloseAuto%s?', '\\SemantexRight') + content = content:gsub('\\SemantexMathOpenNoPar%s?', '') + content = content:gsub('\\SemantexMathCloseNoPar%s?', '') + content = content:gsub('\\SemantexMathOpen%s?', '\\mathopen') + content = content:gsub('\\SemantexMathClose%s?', '\\mathclose') +end + +stripComments = function() + content = content:gsub('\\%%', '\\StripSemantexEscapedPercent') + content = content:gsub('(\\%w+)%%.-\n%s*', '%1 ') + content = content:gsub('%%.-\n%s*', '') + content = content:gsub('\\StripSemantexEscapedPercent', '\\%%') +end + +addSemtexPackageToFile = function() + content = [[% The following was added by "stripsemantex": + +\usepackage{semtex,leftindex,graphicx} + +\providecommand\SemantexLeft{% + \mathopen{}\mathclose\bgroup\left +} + +\providecommand\SemantexRight{% + \aftergroup\egroup\right +} + +\makeatletter +\DeclareRobustCommand\SemantexBullet{% + \mathord{\mathpalette\SemantexBullet@{0.5}}% +} +\newcommand\SemantexBullet@[2]{% + \vcenter{\hbox{\scalebox{#2}{$\m@th#1\bullet$}}}% +} +\DeclareRobustCommand\SemantexDoubleBullet{\SemantexBullet \SemantexBullet} +\makeatother + +]] .. content end
\ No newline at end of file diff --git a/macros/latex/contrib/semantex/stripsemantex.sty b/macros/latex/contrib/semantex/stripsemantex.sty index 5a98435644..1778ac29ec 100644 --- a/macros/latex/contrib/semantex/stripsemantex.sty +++ b/macros/latex/contrib/semantex/stripsemantex.sty @@ -1,5 +1,5 @@ \RequirePackage{xparse} -\ProvidesExplPackage{stripsemantex}{2022/10/04}{0.522}{} +\ProvidesExplPackage{stripsemantex}{2022/12/03}{0.523}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % |