diff options
author | Norbert Preining <norbert@preining.info> | 2023-03-22 03:01:52 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-03-22 03:01:52 +0000 |
commit | cbbc6dbdbf08b70a7e7d8d184ca51c57c835415a (patch) | |
tree | 97ded8ca7095c54f6ff9b661be6b93f80bf792c4 /macros/latex/contrib/stex/doc/stex-docheader.tex | |
parent | de9a0afa47c2ee09e1d4704821cad2b231d36b3f (diff) |
CTAN sync 202303220301
Diffstat (limited to 'macros/latex/contrib/stex/doc/stex-docheader.tex')
-rw-r--r-- | macros/latex/contrib/stex/doc/stex-docheader.tex | 531 |
1 files changed, 276 insertions, 255 deletions
diff --git a/macros/latex/contrib/stex/doc/stex-docheader.tex b/macros/latex/contrib/stex/doc/stex-docheader.tex index c6bea9b3da..b8b6313be8 100644 --- a/macros/latex/contrib/stex/doc/stex-docheader.tex +++ b/macros/latex/contrib/stex/doc/stex-docheader.tex @@ -1,164 +1,168 @@ \RequirePackage{paralist} -\ifcsname libfolder\endcsname\else\def\libfolder#1{../lib/#1}\fi -\documentclass[full,kernel]{l3doc} -\usepackage[dvipsnames]{xcolor} -\usepackage[utf8]{inputenc} -\usepackage[T1]{fontenc} -\RequirePackage{morewrites} -\RequirePackage{tikzinput} -\usetikzlibrary{fit} - -\usepackage[lang=en, mathhub=./tests,debug=sref]{stex} -\usepackage{url,array,float} -\usepackage[show]{ed} +\ifcsname stexdocpath\endcsname\else\def\stexdocpath{.}\fi +\documentclass[full]{l3doc} +%\RequirePackage{document-structure} \usepackage[hyperref=auto,style=alphabetic]{biblatex} -\addbibresource{\libfolder{bib/kwarcpubs.bib}} -\addbibresource{\libfolder{bib/extpubs.bib}} -\addbibresource{\libfolder{bib/kwarccrossrefs.bib}} -\addbibresource{\libfolder{bib/extcrossrefs.bib}} -\usepackage{amssymb} -\usepackage{amsfonts} -\usepackage{xspace} -\usepackage{hyperref} - -\makeindex -\floatstyle{boxed} -\newfloat{exfig}{thp}{lop} -\floatname{exfig}{Example} - -\usepackage{listings} -\usepackage{lststex} - -\lstdefinelanguage{sTeX}{ - sensitive=true, - numbers=left, - numbersep=3pt, - xleftmargin=3pt, - alsodigit={\$}, - %gobble=4, - alsoletter={\\}, - %moredelim = [s][\itshape]{$}{$}, - %moredelim = [s][\itshape\bfseries]{\\[}{\\]}, - classoffset=0,keywordstyle=\bfseries,morekeywords={ - \\begin,\\end,\\ExplSyntaxOn,\\ExplSyntaxOff,\\documentclass, - \\usepackage,\\def,\\[,\\],\\else,\\fi,$\iffalse$\fi, - \\newcommand, \\renewcommand, \\let - }, - classoffset=1,keywordstyle=\itshape\color{OliveGreen},morekeywords={ - \\defeq,\\geometricSeries,\\infinitesum,\\realdivide, - \\realpower, - \\symbolname,\\binarysymbol,\\newbinarysymbol,\\addition, - \\summation,\\ascendingchain,\\quantforall,\\set,\\funtype, - \\Nat,\\successor,\\multiplication,\\Int,\\zero,\\uminus, - \\intmonoid,\\divides,\\intpow,\\ratfrac,\\ratpow,\\inttimes, - \\inset,\\eq,\\rational,\\irrational,\\coprime,\\PosInt, - \\realroot - }, - classoffset=2,keywordstyle=\color{blue},morekeywords={ - \\symdecl,\\symdef,\\notation,\\vardef,\\varseq,\\instantiate, - \\varinstantiate, \\renamedecl, \\assign, \\setnotation, - \\STEXexport - }, - classoffset=3,keywordstyle=\color{BurntOrange},morekeywords={ - \\importmodule,\\usemodule,\\libinput,\\inputref,\\mhinput, - \\libusepackage,\\addmhbibresource,\\ifinputref - }, - classoffset=4,keywordstyle=\color{Purple},morekeywords={ - \\definiendum,\\definame,\\symref,\\symname,\\comp, - \\compemph,\\definiens,\\svar,\\infprec,\\neginfprec,\\ellipses, - \\Symname,\\arg,\\yield,\\assumption,\\spfstep,\\eqstep,\\conclude - }, - classoffset=5,keywordstyle=\color{magenta},morekeywords={ - smodule,sdefinition,sassertion,sparagraph,sexample, - sproof,subproof,spfcases,spfcase,spfstep,spfcomment,spfblock, - \\spfidea,\\spfsketch,\\spfcasesketch,\\sproofend, - \\spfjust,\\premise,\\justarg, - copymodule,interpretmodule,mathstructure,sexample - }, - classoffset=6,keywordstyle=\color{cyan},morekeywords={ - sfragment,blindfragment,\\skipfragment, - \\currentsectionlevel,\\Currentsectionlevel - \\prematurestop,\\afterprematurestop, - \\setSGvar,\\useSGvar,\\ifSGvar - }, - classoffset=7,keywordstyle=\color{brown},morekeywords={ - frame,note,\\ifnotes,\\setslidelogo,\\setsource,\\setlicensing - slides,notes,sectocframes,frameimages,fiboxed, - nparagraph, nparagraph, ndefinition, nexample, nsproof, nassertion, - \\frameimage,\\mhframeimage,\\textwarning, - \\activateexcursion,\\printexcursion,\\excursionref,\\excursiongroup - }, - classoffset=8,keywordstyle=\color{red},morekeywords={ - frame,note - }, - classoffset=9,keywordstyle=\color{gray},morekeywords={ - \\vara,\\varb,\\varc - } -} +%\usepackage[mathhub=\stexdocpath/mh,usedeps]{stex} +\usepackage[lang={en,de}]{stex} -\lstnewenvironment{latexcode}[1][]{\lstset{language=sTeX,#1}}{} +\usepackage{rustex} +\usepackage{stex-highlighting,stexthm} -\def\stexcode{\lstinline[language=sTeX]} +\srefsetin[sTeX/Documentation]{documentation}{the \stex Documentation} -\usepackage{mdframed,realboxes} -\usepackage[most]{tcolorbox} -\usepackage{caption} +\makeatletter +\providecommand{\HTML}{\textsc{html}\xspace}% +\providecommand{\XML}{\textsc{xml}\xspace}% +\providecommand{\PDF}{\textsc{pdf}\xspace}% +\providecommand\openmath{\textsc{OpenMath}\xspace} +\providecommand\OMDoc{\textsc{OMDoc}\xspace} +\DeclareRobustCommand\LaTeXML{L\kern-.36em% + {\sbox\z@ T% + \vbox to\ht\z@{\hbox{\check@mathfonts + \fontsize\sf@size\z@ + \math@fontsfalse\selectfont + A}% + \vss}% + }% + \kern-.15em% +% T\kern-.1667em\lower.5ex\hbox{E}\kern-.125em\relax +% {\tt XML}} + T\kern-.1667em\lower.4ex\hbox{E}\kern-0.05em\relax + {\scshape xml}\xspace}% +\def\mmt{\textsc{Mmt}\xspace} +\makeatother -\newenvironment{framed}{\begin{mdframed}\begin{center}}{\end{center}\end{mdframed}} -\newcommand{\scaled}[2][0.9\hsize]{\begin{center}\resizebox{#1}{!}{\begin{minipage}{\textwidth} #2 \end{minipage}}\end{center}} -\newenvironment{stextest@output} -{ - \begin{mdframed}[linewidth=1pt,backgroundcolor=white]\small -} -{\end{mdframed}} +\newif\ifhadtitle\hadtitlefalse -\newenvironment{stextest@input} -{ - \begin{mdframed}[linewidth=1pt,backgroundcolor=white]\small +\def\stexversion{3.3.0} +\def\changedate{\today} +\def\stextoptitle#1#2{\title{#1\thanks{Version {\stexversion} (last revised {\changedate})} }\def\thispkg{#2}} + +\author{Michael Kohlhase, Dennis Müller\\ + FAU Erlangen-Nürnberg\\ + \url{http://kwarc.info/} } -{\end{mdframed}} -\makeatletter +\def\stexmaketitle{\ifhadtitle\else\hadtitletrue\maketitle\fi} -\newcount\test@counter\test@counter=0 -\newcount\example@counter\example@counter=0 +\ExplSyntaxOn -\newtcolorbox{exampleborderbox}{ - empty, - title={Example \the\example@counter}, - attach boxed title to top left, - minipage boxed title, - boxed title style={empty,size=minimal,toprule=0pt,top=1pt,left=3mm,overlay={}}, - coltitle=blue,fonttitle=\bfseries, - parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm, - before upper=\csname @totalleftmargin\endcsname0pt, - overlay unbroken={\draw[blue,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); }, - overlay first={\draw[blue,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); }, - overlay middle={\draw[blue,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); }, - overlay last={\draw[blue,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); }, - outer arc=4pt + \def\docmodule{ + \begin{document} + \EnableManual + \EnableDocumentation + \EnableImplementation + \stexmaketitle + \tableofcontents + \int_gincr:N \l_stex_docheader_sect + \exp_args:Ne \__stex_mathhub_find_manifest:n {\stex_file_use:N \c_stex_mathhub_file / sTeX / Documentation} + \str_if_empty:NF \l__stex_mathhub_manifest_str { + \usemodule[sTeX/Documentation]{macros?AllMacros} + } + \DocInput{\jobname.dtx} + \clearpage + \PrintIndex + \printbibliography + \end{document} + } + + \bool_new:N \g_stexdoc_typeset_manual_bool + \NewDocumentCommand \EnableManual {}{ + \bool_gset_true:N \g_stexdoc_typeset_manual_bool + } + \NewDocumentCommand \DisableManual {}{ + \bool_gset_false:N \g_stexdoc_typeset_manual_bool + } + \NewDocumentEnvironment {stexmanual} {} { + \bool_if:NTF \g_stexdoc_typeset_manual_bool + {\bool_set_false:N \l__codedoc_in_implementation_bool} + {\comment} + }{ + \bool_if:NF \g_stexdoc_typeset_manual_bool {\endcomment} + } +\ExplSyntaxOff + +%\usepackage{makeidx} +%\makeindex + +%\usepackage{document-structure} + + +\usepackage{lststex,mdframed} +\usepackage[most]{tcolorbox} + +\lstset{literate=% + {Ö}{{\"O}}1 + {Ä}{{\"A}}1 + {Ü}{{\"U}}1 + {ß}{{\ss}}1 + {ü}{{\"u}}1 + {ä}{{\"a}}1 + {ö}{{\"o}}1 + {~}{{\textasciitilde}}1 } -\newenvironment{example@border} -{ - \global\advance\example@counter by 1 -%^^A\refstepcounter{remark} -\begin{exampleborderbox} +\newenvironment{framed}[1][]{ + \ifstexhtml\par\vbox\bgroup + \csname exp_args:Nne\endcsname\begin{stex_annotate_env}{% + style:border=solid 1px black,% + style:width=var(--this-width),% + style:min-width=var(--this-width),% + style:--this-width=calc(var(--current-width) - 6px),% + style:padding=3px,% + style:margin-top=5px,% + style:margin-bottom=5px% + } + \csname stex_annotate_invisible:n\endcsname{ }% + \begin{stex_annotate_env}{% + style:--current-width=var(--this-width);% + }\csname stex_annotate_invisible:n\endcsname{ } + \else\begin{mdframed}[#1]\fi + %\begin{center}% +}{% + %\end{center}% + \ifstexhtml + \end{stex_annotate_env}\end{stex_annotate_env}\egroup\par + \else\end{mdframed}\fi } -{\end{exampleborderbox}} +\newcommand{\scaled}[2][0.9\hsize]{\begin{center}\resizebox{#1}{!}{\begin{minipage}{\textwidth} #2 \end{minipage}}\end{center}} - \makeatother - -\def\present#1{\texttt{>>\meaning#1<<}} -\def\printltx#1{\texttt{\detokenize{#1}}} +\makeatletter +\ExplSyntaxOn -\newwrite\testoutfile -\def\testfile{0} +\def\doc_exbox:nnn#1#2#3{ + \begin{sexample}[#3] + Input: + \begin{framed}[linewidth=1pt,backgroundcolor=white]\small + #1 + \end{framed} + Output: + \begin{framed}[linewidth=1pt,backgroundcolor=white]\small + #2 + \end{framed} + \end{sexample} +} -\ExplSyntaxOn -\def\stexexample{ +\NewDocumentCommand\stexexamplefile{O{} m O{} O{}}{ + \stex_resolve_path_pair:Nxx \l_@@_filepath_str {\tl_to_str:n{#1}} {\tl_to_str:n{#2}} + \doc_exbox:nnn{ + \hfill File~\str_if_empty:nTF{#1}{ + \prop_if_exist:NT \l_stex_current_archive_prop { + [\texttt{\prop_item:Nn \l_stex_current_archive_prop {id}}] + } + }{[#1]}\texttt{\tl_to_str:n{#2}} + \_lststex_parse_args:n{#3} + \exp_args:Nno \use:nn{\lstinputlisting[} \l_lststex_return_tl ]{\l_@@_filepath_str} + }{ + \inputref[#1]{#2} + }{#4} +} + +\newwrite\testoutfile +\NewDocumentCommand\stexexample{O{} O{}}{ \begingroup \catcode`\\=12\relax \catcode`\#=12\relax @@ -171,38 +175,65 @@ \endlinechar=`^^J \newlinechar=-1 %^^A \everyeof{\noexpand} - \example_a:n + \example_a:nnn{#1}{#2} } -\long\def\example_a:n #1 { +\long\def\example_a:nnn #1 #2 #3 { \endgroup - \begin{example@border} - \immediate\openout\testoutfile=stextest.tex - \immediate\write\testoutfile{ - \c_backslash_str begin{latexcode} - \detokenize{^^J}#1 - \c_backslash_str end{latexcode} - } + \immediate\openout\testoutfile=\jobname.exmpl + \immediate\write\testoutfile{ + \c_backslash_str begin{stexcode}[#1] + \detokenize{^^J}#3 + \c_backslash_str end{stexcode} + } + \immediate\closeout\testoutfile + \doc_exbox:nnn{ + \catcode`\#=12\relax + \csname @ @ input\endcsname{\jobname.exmpl} + }{ + \immediate\openout\testoutfile=\jobname.exmpl + \immediate\write\testoutfile{#3} \immediate\closeout\testoutfile + \csname @ @ input\endcsname \jobname.exmpl\relax + }{#2} + \peek_charcode_remove:NT ^^J +} - Input: +\ExplSyntaxOff +\makeatother - \begin{stextest@input} - \catcode`\#=12\relax - \input{stextest.tex} - \end{stextest@input} - \immediate\openout\testoutfile=stextest.tex - \immediate\write\testoutfile{#1} - \immediate\closeout\testoutfile +\makeatletter +\newcount\example@counter\example@counter=0 +\newtcolorbox{exampleborderbox}[1][]{ + empty, + title={Example \the\example@counter #1}, + attach boxed title to top left, + minipage boxed title, + boxed title style={empty,size=minimal,toprule=0pt,top=1pt,left=3mm,overlay={}}, + coltitle=blue,fonttitle=\bfseries, + parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm, + before upper=\csname @totalleftmargin\endcsname0pt, + overlay unbroken={\draw[blue,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); }, + overlay first={\draw[blue,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); }, + overlay middle={\draw[blue,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); }, + overlay last={\draw[blue,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); }, + outer arc=4pt% +} - Output: - - \begin{stextest@output} - \csname @ @ input\endcsname{stextest.tex} - \end{stextest@output} - \end{example@border} +\ExplSyntaxOn +\stexstyleexample{ + \global\advance\example@counter by 1 + \tl_if_empty:NTF\thistitle{ + \begin{exampleborderbox} + }{ + \begin{exampleborderbox}[ (\thistitle)] + } +}{ + \end{exampleborderbox} } -\ExplSyntaxOff +\ExplSyntaxOff\makeatother + +\usetikzlibrary{calc} \def\textwarning{\includegraphics[width=1.2em]{stex-dangerous-bend}\xspace} \newtcolorbox{dangerbox}{ @@ -226,6 +257,62 @@ {\includegraphics[width=1cm,height=1cm]{stex-dangerous-bend}};} } +\protected\def\TODO#1{\textcolor{red}{TODO}\footnote{\textcolor{red}{TODO: #1}}} + +\definecolor{darkgreen}{rgb}{0.0, 0.5, 0.0} + +\usepackage[solutions]{problem} +\usepackage{hwexam} +\newtcolorbox{problemborderbox}[1][]{ + empty, + title={Exercise #1}, + attach boxed title to top left, + minipage boxed title, + boxed title style={empty,size=minimal,toprule=0pt,top=1pt,left=3mm,overlay={}}, + coltitle=darkgreen,fonttitle=\bfseries, + parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm, + before upper=\csname @totalleftmargin\endcsname0pt, + overlay unbroken={\draw[darkgreen,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); }, + overlay first={\draw[darkgreen,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); }, + overlay middle={\draw[darkgreen,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); }, + overlay last={\draw[darkgreen,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); }, + outer arc=4pt% +} + +\ExplSyntaxOn +\stexstyleproblem{ + \tl_if_empty:NTF\thistitle{ + \begin{problemborderbox} + }{ + \begin{problemborderbox}[ (\thistitle)] + } +}{ + \end{problemborderbox} +} +\ExplSyntaxOff + +\newtcolorbox{experimental}{ + breakable, + enhanced, + left=0pt, + right=0pt, + top=8pt, + bottom=8pt, + colback=white, + colframe=gray, + width=\textwidth, + enlarge left by=0mm, + boxsep=5pt, + fontupper=\small, + arc=4pt, + outer arc=4pt, + leftupper=1.5cm, + overlay={ + \node[anchor=west] at ([xshift=10pt]$(frame.north west)!0.5!(frame.south west)$) + {\includegraphics[height=1cm]{stex-experimental}};} +} + + \usetikzlibrary{decorations.pathmorphing,shapes,arrows,calc} % Taken from pgflibrarytikzmmt.code.tex \newcommand{\mmtarrowtip}{angle 45} @@ -239,6 +326,7 @@ post=lineto,post length=5pt}, thick] \tikzstyle{view}=[preview,-\mmtarrowtip] + % TIKZ RULES \def\mmtlogo{ \begin{tikzpicture} @@ -287,98 +375,31 @@ {\mmtlogo};} } - -\MakeShortVerb{\|} - -\def\scsys#1{{{\sc #1}}\index{#1@{\sc #1}}\xspace} -\def\mmt{\textsc{Mmt}\xspace} -\def\xml{\scsys{Xml}} -\def\mathml{\scsys{MathML}} -\def\omdoc{\scsys{OMDoc}} -\def\openmath{\scsys{OpenMath}} -\def\latexml{\scsys{LaTeXML}} -\def\perl{\scsys{Perl}} -\def\cmathml{Content-{\sc MathML}\index{Content {\sc MathML}}\index{MathML@{\sc MathML}!content}} -\def\activemath{\scsys{ActiveMath}} -\def\twin#1#2{\index{#1!#2}\index{#2!#1}} -\def\twintoo#1#2{{#1 #2}\twin{#1}{#2}} -\def\atwin#1#2#3{\index{#1!#2!#3}\index{#3!#2 (#1)}} -\def\atwintoo#1#2#3{{#1 #2 #3}\atwin{#1}{#2}{#3}} -\def\cT{\mathcal{T}}\def\cD{\mathcal{D}} - -\def\fileversion{3.2} -\def\filedate{\today} - -\RequirePackage{pdfcomment} - -\ExplSyntaxOn\makeatletter -\cs_set_protected:Npn \@comp #1 #2 { - \pdftooltip { - \textcolor{blue}{#1} - } { #2 } -} - -\cs_set_protected:Npn \@defemph #1 #2 { - \pdftooltip { - \textbf{\textcolor{magenta}{#1}} - } { #2 } -} - -\def\__omtext_lec#1{#1} -\cs_new_protected:Npn \lec #1 { - \strut\hfil\strut\null\hfill\__omtext_lec{#1} +\newtcolorbox{defibox}{ + breakable, + enhanced, + left=0pt, + right=0pt, + top=8pt, + bottom=8pt, + colback=white, + colframe=orange, + width=\textwidth, + enlarge left by=0mm, + boxsep=5pt, + fontupper=\small, + leftupper=1.5cm, + arc=4pt, + outer arc=4pt, + overlay={\node[anchor=west] at ([xshift=10pt]$(frame.north west)!0.5!(frame.south west)$) + {\textcolor{orange}{\Large\sTeX}};} } -\makeatother\ExplSyntaxOff - -\makeatletter -\let\@stex@oldcomment\comment -\let\@stex@oldendcomment\endcomment - -%\RequirePackage{comment} -\RequirePackage{document-structure} -\RequirePackage[hints,solutions,notes]{problem} -\RequirePackage{hwexam} - -\let\comment\@stex@oldcomment -\let\endcomment\@stex@oldendcomment - -\newif\ifinfulldoc\infulldocfalse -\makeatother - -\def\basedocurl{https://github.com/slatex/sTeX/blob/main/doc} -\newcounter{module} -\NewDocumentEnvironment {module}{}{ - \stepcounter{module} - \textbf{Module \themodule: \smoduletitle} +\stexstyleparagraph[defibox]{ + \begin{defibox} }{ - + \end{defibox} } -\stexpatchmodule[visible]{\begin{module}}{\end{module}} - -\usepackage{stexthm} - -\newtcolorbox{remarkbox}[1][]{ - empty, - title={Remark \theremark: #1}, - attach boxed title to top left, - minipage boxed title, - boxed title style={empty,size=minimal,toprule=0pt,top=4pt,left=3mm,overlay={}}, - fonttitle=\bfseries,coltitle=black, - before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm, - before upper=\csname @totalleftmargin\endcsname0pt, - overlay unbroken={\draw[black,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); }, - overlay first={\draw[black,line width=2pt] ([xshift=-0pt]title.north west) -- ([xshift=-0pt]frame.south west); }, - overlay middle={\draw[black,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); }, - overlay last={\draw[black,line width=2pt] ([xshift=-0pt]frame.north west) -- ([xshift=-0pt]frame.south west); }, -} - -\renewenvironment{remark}[1][]{ - \refstepcounter{remark}\begin{remarkbox}[#1] - \begin{mdframed}[linewidth=1pt,backgroundcolor=lightgray!33!white] -}{ -\end{mdframed}\end{remarkbox}\endlist -} -\usepackage{rustex}
\ No newline at end of file +\AtBeginDocument{\catcode`_=8}
\ No newline at end of file |