From 36d8a5cd45b5a96007208a0d5b1f52e708d0fec8 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 6 May 2020 03:02:30 +0000 Subject: CTAN sync 202005060302 --- macros/latex/contrib/showexpl/README | 16 ---- macros/latex/contrib/showexpl/README.md | 24 ++++++ .../latex/contrib/showexpl/doc/showexpl-test.pdf | Bin 332458 -> 350530 bytes .../latex/contrib/showexpl/doc/showexpl-test.tex | 39 +++++---- macros/latex/contrib/showexpl/doc/showexpl.pdf | Bin 243219 -> 250331 bytes macros/latex/contrib/showexpl/showexpl.dtx | 90 ++++++++++++--------- macros/latex/contrib/showexpl/showexpl.ins | 2 +- 7 files changed, 96 insertions(+), 75 deletions(-) delete mode 100644 macros/latex/contrib/showexpl/README create mode 100644 macros/latex/contrib/showexpl/README.md (limited to 'macros/latex/contrib/showexpl') diff --git a/macros/latex/contrib/showexpl/README b/macros/latex/contrib/showexpl/README deleted file mode 100644 index f16e1bc655..0000000000 --- a/macros/latex/contrib/showexpl/README +++ /dev/null @@ -1,16 +0,0 @@ -showexpl -======== - -The LaTeX package 'showexpl' provides a way to typeset LaTeX source code and -the related result in the same document. The `listings' package is required. -See 'doc/showexpl-test.tex' for the details. - -Recommended TDS locations: - - showexpl.sty: tex/latex/showexpl - README, showexpl.pdf, showexpl-test.pdf, - showexpl-test.tex, result-picture.pdf: doc/latex/showexpl - -For general installation advice, see -http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages - diff --git a/macros/latex/contrib/showexpl/README.md b/macros/latex/contrib/showexpl/README.md new file mode 100644 index 0000000000..0c2fb4d52f --- /dev/null +++ b/macros/latex/contrib/showexpl/README.md @@ -0,0 +1,24 @@ +showexpl +======== + +The LaTeX package `showexpl` provides a way to typeset LaTeX source code and +the related result in the same document. The `listings` package is required. +See `doc/showexpl-test.tex` for the details. + +Recommended TDS locations: + +```text + showexpl.sty: tex/latex/showexpl + README, showexpl.pdf, showexpl-test.pdf, + showexpl-test.tex, result-picture.pdf: doc/latex/showexpl +``` + +For general installation advice, see + + +The showexpl package is also on +CTAN:[macros/latex/contrib/showexpl](http://www.ctan.org/tex-archive/macros/latex/contrib/showexpl) + +Rolf Niepraschk, +email: Rolf.Niepraschk@gmx.de, +2020-05-03 diff --git a/macros/latex/contrib/showexpl/doc/showexpl-test.pdf b/macros/latex/contrib/showexpl/doc/showexpl-test.pdf index ed08ca09e9..a645e087ae 100644 Binary files a/macros/latex/contrib/showexpl/doc/showexpl-test.pdf and b/macros/latex/contrib/showexpl/doc/showexpl-test.pdf differ diff --git a/macros/latex/contrib/showexpl/doc/showexpl-test.tex b/macros/latex/contrib/showexpl/doc/showexpl-test.tex index 316049f555..75b4664a5b 100644 --- a/macros/latex/contrib/showexpl/doc/showexpl-test.tex +++ b/macros/latex/contrib/showexpl/doc/showexpl-test.tex @@ -1,36 +1,33 @@ -% Rolf Niepraschk, 2005-07-16, Rolf.Niepraschk@ptb.de +% Rolf Niepraschk, 2020-05-03, Rolf.Niepraschk@gmx.de \listfiles\errorcontextlines=100 \documentclass[a4paper,draft,twoside]{article} \usepackage[dvipsnames]{xcolor} \usepackage[textwidth=12cm,marginparwidth=4cm]{geometry} - \usepackage[final]{showexpl} -\usepackage[T1]{fontenc} +\usepackage{iftex} -\IfFileExists{luximono.sty}% -{% - \usepackage[scaled]{luximono}% -} -{% - \IfFileExists{beramono.sty}% - {% - \usepackage[scaled]{beramono}% - }{} -} +\iftutex % LuaTeX, XeTeX + \usepackage{fontspec} + \setmonofont{DejaVuSansMono}[Scale=MatchUppercase] +\else % old engines + \usepackage[T1]{fontenc} + \usepackage{lmodern} + \usepackage[scaled]{DejaVuSansMono} +\fi \lstset{% - basicstyle=\ttfamily\small, - commentstyle=\itshape\ttfamily\small, - showspaces=false, - showstringspaces=false, - breaklines=true, - backgroundcolor=\color{lightgray}, - breakautoindent=true, - captionpos=t + basicstyle=\ttfamily\small, + commentstyle=\itshape\ttfamily\small, + showspaces=false, + showstringspaces=false, + breaklines=true, + backgroundcolor=\color{lightgray}, + breakautoindent=true, + captionpos=t } \iftrue diff --git a/macros/latex/contrib/showexpl/doc/showexpl.pdf b/macros/latex/contrib/showexpl/doc/showexpl.pdf index 31c82aad6d..31c0ffac2e 100644 Binary files a/macros/latex/contrib/showexpl/doc/showexpl.pdf and b/macros/latex/contrib/showexpl/doc/showexpl.pdf differ diff --git a/macros/latex/contrib/showexpl/showexpl.dtx b/macros/latex/contrib/showexpl/showexpl.dtx index a7c3c96677..4102c6b8dd 100644 --- a/macros/latex/contrib/showexpl/showexpl.dtx +++ b/macros/latex/contrib/showexpl/showexpl.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2004 -- 2016 by Rolf Niepraschk +% Copyright (C) 2004 -- by Rolf Niepraschk % -------------------------------------------------------------------- % % This file may be distributed and/or modified under the @@ -22,7 +22,7 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{showexpl} %<*package> - [2016/12/11 v0.3o Typesetting example code (RN)] + [2020/05/04 v0.3p Typesetting example code (RN)] % % %<*driver> @@ -39,7 +39,7 @@ % % \fi % -% \CheckSum{887} +% \CheckSum{880} % % \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 @@ -206,6 +206,7 @@ % % \section{Implementation} % \changes{v0.1e}{2004/11/24}{Loading of |showexpl.cfg| added (RN).} +% \changes{v0.3p}{2020/05/04}{Remove package `calc' (RN).} % \begin{macrocode} \DeclareOption{final}{% \PassOptionsToPackage{\CurrentOption}{graphicx}% @@ -224,7 +225,7 @@ }% \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{listings}} \ProcessOptions\relax -\RequirePackage{listings,calc,ifthen,graphicx,varwidth} +\RequirePackage{refcount,listings,graphicx,varwidth,float} % \end{macrocode} % We must aktivate code from package \textsf{listings} for writing files. % \begin{macrocode} @@ -316,13 +317,12 @@ % typesetting the result of the example code. More can be added with % the user key ``|preset=...|''. % \changes{v0.3e}{2006/04/05}{More redefinitions added (RN).} +% \changes{v0.3p}{2020/05/04}{Remove extra treatment of `figure'/`table' (RN).} % \begin{macrocode} \newcommand*\SX@@preset{% \renewcommand\documentclass[2][]{\SX@eat@version}% \renewcommand\usepackage[2][]{\SX@eat@version}% \renewenvironment{document}{}{}% - \renewenvironment{figure}[1][]{\def\@captype{figure}}{}% - \renewenvironment{table}[1][]{\def\@captype{table}}{}% \renewcommand\cite[1][]{}% \let\tableofcontens\relax \let\listoffigures\relax \let\listoftables\relax \let\printindex\relax @@ -344,14 +344,28 @@ % \begin{macro}{\isSX@odd} % Parameter |#1| is executed on odd pages, parameter |#2| on % even pages. +% \changes{v0.3p}{2020/05/04}{Replace \cmd{\isodd} with +% \cmd{\ifodd}\cmd{\getpagerefnumber} (remove package `ifthen') (RN).} % \begin{macrocode} \newif\ifSX@wasodd \if@twoside - \newcommand*{\isSX@odd}[2]{% - \ifthenelse{\isodd{\pageref{\SX@IDENT}}}% - {\SX@wasoddtrue #1}{\SX@wasoddfalse #2}} + \newcommand*\isSX@odd{% + \begingroup + \ifodd\getpagerefnumber{\SX@IDENT}% + \aftergroup\SX@wasoddtrue + \else + \aftergroup\SX@wasoddfalse + \fi + \endgroup + \ifSX@wasodd + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + } \else - \newcommand*{\isSX@odd}[2]{#1}\SX@wasoddtrue + \SX@wasoddtrue + \newcommand*\isSX@odd[2]{#1} \fi % \end{macrocode} % The call of \cmd{\isSX@odd} sets also \cmd{\ifSX@wasodd} to true or @@ -388,20 +402,20 @@ % \begin{macrocode} \newcommand*\SX@put@t[3]{% \SX@ResultArea{\linewidth}{#2}\endgraf\pagebreak[2]% - \setlength\@tempdima{\SX@vsep}\vskip\@tempdima + \@tempdima=\dimexpr\SX@vsep\vskip\@tempdima \SX@CodeArea{\linewidth}{#3}% } \newcommand*\SX@put@b[3]{% \SX@CodeArea{\linewidth}{#3}\endgraf\pagebreak[2]% - \setlength\@tempdima{\SX@vsep}\vskip\@tempdima + \@tempdima=\dimexpr\SX@vsep\vskip\@tempdima \SX@ResultArea{\linewidth}{#2}% } \newcommand*\SX@put@l[3]{% - \setlength\@tempdimc{\linewidth-#1-\SX@hsep}% + \@tempdimc=\dimexpr\linewidth-#1-\SX@hsep % \SX@ResultArea{#1}{#2}\hfill\SX@CodeArea{\@tempdimc}{#3}% } \newcommand*\SX@put@r[3]{% - \setlength\@tempdimc{\linewidth-#1-\SX@hsep}% + \@tempdimc=\dimexpr\linewidth-#1-\SX@hsep % \SX@CodeArea{\@tempdimc}{#3}\hfill\SX@ResultArea{#1}{#2}% } \newcommand*\SX@put@o[3]{% @@ -411,12 +425,11 @@ \@nameuse{SX@put@\ifSX@wasodd l\else r\fi}{#1}{#2}{#3}% } \newcommand\SX@ResultArea[2]{% - \SX@justification\setlength\@tempdima{#1}% - %\minipage\@tempdima#2\endminipage + \SX@justification\@tempdima=\dimexpr #1 % \parbox\@tempdima{#2}% } \newcommand\SX@CodeArea[2]{% - \setlength\@tempdima{#1}% + \@tempdima=\dimexpr #1 % \sbox\@tempboxa{\parbox\@tempdima{#2}}% \@tempdima=\dp\@tempboxa\usebox\@tempboxa \rlap{\raisebox{-\@tempdima}[0pt][0pt]{\SX@attachfile}}% @@ -477,19 +490,12 @@ \newcommand*\SX@put@code@result{% \begingroup \expandafter\lstset\expandafter{\SX@explpreset}% - \let\lst@float=\relax\let\SX@float=\relax -% \end{macrocode} -% Without the following call \cmd{\lst@beginfloat} is undefined. -% \begin{macrocode} \expandafter\lstset\expandafter{\SX@@explpreset}% - \ifx\lst@float\relax\else % \end{macrocode} -% \cmd{\lst@float} must be \cmd{\relax} because the whole ``example'' -% should float but not the listings part in addition. +% Use listings floating procedure if necessary. % \begin{macrocode} - \let\SX@float=\lst@float\let\lst@float=\relax - \g@addto@macro\SX@@explpreset{,float=false}% - \edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\SX@float]}% + \ifx\lst@float\relax\else + \edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\lst@float]} \expandafter\@tempa \fi \ifx\lst@caption\@empty @@ -511,7 +517,7 @@ \ifx\@tempa\SX@pos\@tempswafalse\fi \def\@tempa{b}% \ifx\@tempa\SX@pos\@tempswafalse\fi - \setlength\@tempdima{\linewidth+\SX@overhang}% + \@tempdima=\dimexpr\linewidth+\SX@overhang % \if@tempswa\@tempdima=.5\@tempdima\fi% \edef\SX@width{\the\@tempdima}% \fi @@ -523,12 +529,12 @@ \long\def\SX@frame##1{##1}% \else \let\SX@frame\ResultBox - \setlength\@tempdima{\SX@width-2\ResultBoxSep-2\ResultBoxRule}% + \@tempdima=\dimexpr\SX@width-2\ResultBoxSep-2\ResultBoxRule % \edef\SX@width{\the\@tempdima}% \fi \isSX@odd{\def\@tempa{l}}{\def\@tempa{r}}% \makebox[\linewidth][\@tempa]{% - \parbox{\linewidth+\SX@overhang}{% + \parbox{\dimexpr\linewidth+\SX@overhang}{% % \end{macrocode} % \cmd{\SX@codefile} (|\jobname.tmp|) is not nessesary for the filelist. % \changes{v0.3m}{2016/08/05}{Wrong assignement for \cmd{\lst@belowskip} (RN).} @@ -541,10 +547,7 @@ % true. % \changes{v0.3k}{2013/03/21}{Setting \cmd{\lst@MakeCaption} to \cmd{\@gobble} % again (prevent multiply defined labels; label key)}. -% \begin{macrocode} - \let\SX@MakeCaption\lst@MakeCaption - \let\lst@MakeCaption\@gobble{} -% \end{macrocode} +% \changes{v0.3p}{2020/05/04}{Let's leave \cmd{\lst@MakeCaption} untouched (RN).} % \changes{v0.3j}{2012/09/22}{Setting \cmd{\lst@MakeCaption} to % was a bad idea for hyperlinks. Group added to % varwidth environment. (Suggestions by Ulrike Fischer.).} @@ -564,12 +567,11 @@ {\@latex@error{Parameter `\SX@pos' undefined}\@ehd}% {\@nameuse{SX@put@\SX@pos}% {\SX@width}{\box\SX@ResBox}{\SX@codeInput}}% - \let\lst@MakeCaption\SX@MakeCaption \lst@MakeCaption{b}\SX@KillBelowCaptionskip }% }% \endtrivlist - \ifx\SX@float\relax\else\expandafter\lst@endfloat\fi + \ifx\lst@float\relax\else\expandafter\lst@endfloat\fi \gdef\SX@@explpreset{}% \endgroup } @@ -693,6 +695,20 @@ \def\SX@tempb##1{\scalebox{\SX@scaled}{##1}}% \fi \fi + \let\SX@lst@Init=\lst@Init +% \end{macrocode} +% Prevents float environments from floating. This is not enough for floating +% listing environments! Why? +% \changes{v0.3p}{2020/05/04}{Better handling of floats (RN).} +% \begin{macrocode} + \def\@xfloat##1[##2]{\@float@HH{##1}[H]}% +% \end{macrocode} +% Special handling of floating listing environments. +% \begin{macrocode} + \def\lst@Init{% + \let\lst@float=\relax + \SX@lst@Init + } \SX@tempb{\SX@tempa{\SX@codefile}}\par \endgroup \else @@ -726,7 +742,7 @@ \fi \SX@Info \expandafter\lstinputlisting\expandafter[\SX@@explpreset,nolol=true,% - caption={},belowskip=\z@,aboveskip=\z@]{\SX@codefile}% + caption={},belowskip=\z@,aboveskip=\z@,float=false]{\SX@codefile}% \endgroup }% % \end{macrocode} diff --git a/macros/latex/contrib/showexpl/showexpl.ins b/macros/latex/contrib/showexpl/showexpl.ins index 98548e0467..773270fdd0 100644 --- a/macros/latex/contrib/showexpl/showexpl.ins +++ b/macros/latex/contrib/showexpl/showexpl.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2004 by Rolf Niepraschk +%% Copyright (C) 2004 -- by Rolf Niepraschk %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.2 of this license -- cgit v1.2.3