texlive[67200] Master/texmf-dist: latexdemo (23may23)
commits+karl at tug.org
commits+karl at tug.org
Tue May 23 21:48:23 CEST 2023
Revision: 67200
http://tug.org/svn/texlive?view=revision&revision=67200
Author: karl
Date: 2023-05-23 21:48:22 +0200 (Tue, 23 May 2023)
Log Message:
-----------
latexdemo (23may23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/latexdemo/README
trunk/Master/texmf-dist/doc/latex/latexdemo/latexdemo.pdf
trunk/Master/texmf-dist/source/latex/latexdemo/latexdemo.dtx
trunk/Master/texmf-dist/tex/latex/latexdemo/latexdemo.sty
Modified: trunk/Master/texmf-dist/doc/latex/latexdemo/README
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/latexdemo/latexdemo.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/latexdemo/latexdemo.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/latexdemo/latexdemo.dtx 2023-05-23 19:48:13 UTC (rev 67199)
+++ trunk/Master/texmf-dist/source/latex/latexdemo/latexdemo.dtx 2023-05-23 19:48:22 UTC (rev 67200)
@@ -2,11 +2,11 @@
% !TeX spellcheck = en-US
%
% File: latexdemo.sty
-% Version: 2014/06/27 v0.1
+% Version: 2023/03/26 v0.2
% Author: Matthias Pospiech
% Email: <matthias at pospiech.eu>
%
-% Copyright (C) 2014 by Matthias Pospiech (matthias at pospiech.eu)
+% Copyright (C) 2023 by Matthias Pospiech (matthias at pospiech.eu)
% ---------------------------------------------------------------------------
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -32,7 +32,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{latexdemo}
%<*package>
- [2014/06/27 v0.1 typeset code and resulting output]
+ [2023/03/26 v0.2 typeset code and resulting output]
%</package>
%
%<*driver>
@@ -116,7 +116,7 @@
% code must be written to an external file.
%
% The commands provided by this package are based on the packages
-% \package{listings}, \package{mdframed} and \package{filecontents}.
+% \package{listings}, \package{mdframed} and the enviroment \environment{filecontents}.
%
% \section{Basic example}
% \label{sec:example:basic}
@@ -127,12 +127,12 @@
% \iffalse
%<*example>
% \fi
-\begin{filecontents*}{\democodefile}
+\begin{DefineCode}
\so{letterspacing}, \\
\ul{underlining}, \\
\st{overstriking} \\
and \hl{highlighting}.
-\end{filecontents*}
+\end{DefineCode}
% \iffalse
%</example>
% \fi
@@ -146,12 +146,12 @@
%<*example>
% \fi
\begin{lstlisting}[style=demostyle]
-\begin{filecontents*}{\democodefile}
+\begin{DefineCode}
\so{letterspacing}, \\
\ul{underlining}, \\
\st{overstriking} \\
and \hl{highlighting}.
-\end{filecontents*}
+\end{DefineCode}
\ifcsdef{so}{%
%
@@ -173,15 +173,15 @@
% \subsection{Define code}
% This package requires the example code to be written to an external file. The
% filename is saved in the command sequence \cs{democodefile}. The output is done
-% with the \environment{filecontents} environment:
+% with the \environment{DefineCode} environment:
%
% \iffalse
%<*example>
% \fi
\begin{lstlisting}[style=demostyle]
-\begin{filecontents*}{\democodefile}
+\begin{DefineCode}
... code ...
-\end{filecontents*}
+\end{DefineCode}
\end{lstlisting}
% \iffalse
%</example>
@@ -228,14 +228,14 @@
%<*example>
% \fi
\begin{lstlisting}[style=demostyle]
-\begin{filecontents*}{\democodefile}
+\begin{DefineCode}
This code shows some basic math: $a^2 + b^2 = c^2$.
-\end{filecontents*}
+\end{DefineCode}
\end{lstlisting}
%
-\begin{filecontents*}{\democodefile}
+\begin{DefineCode}
This code shows some basic math: $a^2 + b^2 = c^2$.
-\end{filecontents*}
+\end{DefineCode}
% \iffalse
%</example>
% \fi
@@ -341,8 +341,6 @@
%% Programming
\RequirePackage{xspace}
\RequirePackage{etoolbox}
-%% Write contents to files
-\RequirePackage{filecontents}
%% Packages for frames
\RequirePackage{mdframed}
\RequirePackage{framed}
@@ -457,6 +455,16 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{environment}{DefineCode}
+% Define code for demonstration using the enviroment \environment{DefineCode} which is based on the enviroment \environment{filecontents*}.
+% \begin{macrocode}
+ \newenvironment{DefineCode}{%
+ \csname filecontents*\endcsname[overwrite]{\democodefile}%
+}{%
+ \csname endfilecontents*\endcsname%
+}
+% \end{macrocode}
+% \end{environment}
%
% \begin{macro}{\PrintDemo}
% Print code and result using the key-value syntax
Modified: trunk/Master/texmf-dist/tex/latex/latexdemo/latexdemo.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/latexdemo/latexdemo.sty 2023-05-23 19:48:13 UTC (rev 67199)
+++ trunk/Master/texmf-dist/tex/latex/latexdemo/latexdemo.sty 2023-05-23 19:48:22 UTC (rev 67200)
@@ -37,8 +37,6 @@
%% Programming
\RequirePackage{xspace}
\RequirePackage{etoolbox}
-%% Write contents to files
-\RequirePackage{filecontents}
%% Packages for frames
\RequirePackage{mdframed}
\RequirePackage{framed}
@@ -96,6 +94,11 @@
}{}%
\fi\fi\fi\fi\fi%
}%
+\newenvironment{DefineCode}{%
+\csname filecontents*\endcsname[overwrite]{\democodefile}%
+}{%
+\csname endfilecontents*\endcsname%
+}
\newcommand{\PrintDemo}[1]{%
\begingroup
\setkeys{demo}{#1}%
More information about the tex-live-commits
mailing list.