diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/xsim/examples/xsim.code-and-output.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/examples/xsim.code-and-output.tex | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.code-and-output.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.code-and-output.tex new file mode 100644 index 00000000000..f753f13939e --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.code-and-output.tex @@ -0,0 +1,53 @@ +\documentclass{article} +\usepackage{xsimverb,listings,xcolor} + +\lstdefinestyle{mystyle}{ + language = [AlLaTeX]TeX , + basicstyle = \ttfamily , + columns = fullflexible , + commentstyle = \color{gray!70} , + keywordstyle = \color{red!70!black} +} + +\makeatletter +\NewDocumentEnvironment{example}{o} + {% + \XSIMgobblechars{2}% + \XSIMsetfilebegin{\@percentchar\space file `\jobname.tmp'}% + \XSIMsetfileend{\@percentchar\space bye bye}% + \IfNoValueTF{#1} + {\XSIMfilewritestart*{\jobname.tmp}} + {\XSIMfilewritestart{\jobname.tmp}}% + } + {% + \XSIMfilewritestop + \lstinputlisting[style=mystyle]{\jobname.tmp}% + \input{\jobname.tmp} + } + +\NewDocumentEnvironment{code}{o} + {% + \XSIMgobblechars{2}% + \IfNoValueTF{#1} + {\XSIMfilewritestart*{\jobname.tmp}} + {\XSIMfilewritestart{\jobname.tmp}}% + } + {% + \XSIMfilewritestop + \lstinputlisting[style=mystyle]{\jobname.tmp}% + } +\makeatother + +\begin{document} + +\begin{example} + bla bla \LaTeX +\end{example} + +\bigskip + +\begin{code} + blubber \LaTeX +\end{code} + +\end{document} |