summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/showexpl
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-05-05 21:32:38 +0000
committerKarl Berry <karl@freefriends.org>2020-05-05 21:32:38 +0000
commit5033b0a46ad21995a992442c4ca73580ed7e0c58 (patch)
tree43fe9f2cdccbf13c5de6a73080429f3d79f3debc /Master/texmf-dist/tex/latex/showexpl
parent9299899dc8277cdf25748ef0f2320593441e0a71 (diff)
showexpl (5may20)
git-svn-id: svn://tug.org/texlive/trunk@55030 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/showexpl')
-rw-r--r--Master/texmf-dist/tex/latex/showexpl/showexpl.sty63
1 files changed, 36 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/showexpl/showexpl.sty b/Master/texmf-dist/tex/latex/showexpl/showexpl.sty
index f236f704e0b..7a54531d0fc 100644
--- a/Master/texmf-dist/tex/latex/showexpl/showexpl.sty
+++ b/Master/texmf-dist/tex/latex/showexpl/showexpl.sty
@@ -22,7 +22,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{showexpl}
- [2016/12/11 v0.3o Typesetting example code (RN)]
+ [2020/05/04 v0.3p Typesetting example code (RN)]
\DeclareOption{final}{%
\PassOptionsToPackage{\CurrentOption}{graphicx}%
\PassOptionsToPackage{\CurrentOption}{listings}%
@@ -37,7 +37,7 @@
}%
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{listings}}
\ProcessOptions\relax
-\RequirePackage{listings,calc,ifthen,graphicx,varwidth}
+\RequirePackage{refcount,listings,graphicx,varwidth,float}
\lst@RequireAspects{writefile}
\newcommand*\SX@defaultWD[2]{%
\afterassignment\SX@def@WD\dimen@#2\linewidth\relax{#1}}
@@ -89,8 +89,6 @@
\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
@@ -109,11 +107,23 @@
\newcommand*\SX@eat@version[1][]{}
\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
\newcounter{ltxexample}
\newcommand*{\SX@IDENT}{SX@\number\value{ltxexample}}
@@ -125,20 +135,20 @@
}
\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]{%
@@ -148,12 +158,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}}%
@@ -192,12 +201,9 @@
\newcommand*\SX@put@code@result{%
\begingroup
\expandafter\lstset\expandafter{\SX@explpreset}%
- \let\lst@float=\relax\let\SX@float=\relax
\expandafter\lstset\expandafter{\SX@@explpreset}%
\ifx\lst@float\relax\else
- \let\SX@float=\lst@float\let\lst@float=\relax
- \g@addto@macro\SX@@explpreset{,float=false}%
- \edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\SX@float]}%
+ \edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\lst@float]}
\expandafter\@tempa
\fi
\ifx\lst@caption\@empty
@@ -213,7 +219,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
@@ -221,17 +227,15 @@
\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}{%
\let\@addtofilelist\@gobble
\let\lst@ifdisplaystyle=\iftrue
\SX@KillAboveCaptionskip\lst@MakeCaption{t}%
- \let\SX@MakeCaption\lst@MakeCaption
- \let\lst@MakeCaption\@gobble{}
\setbox\SX@ResBox\hbox{%
\fboxsep=\ResultBoxSep
\fboxrule=\ResultBoxRule
@@ -247,12 +251,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
}
@@ -354,6 +357,12 @@
\def\SX@tempb##1{\scalebox{\SX@scaled}{##1}}%
\fi
\fi
+ \let\SX@lst@Init=\lst@Init
+ \def\@xfloat##1[##2]{\@float@HH{##1}[H]}%
+ \def\lst@Init{%
+ \let\lst@float=\relax
+ \SX@lst@Init
+ }
\SX@tempb{\SX@tempa{\SX@codefile}}\par
\endgroup
\else
@@ -370,7 +379,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
}%
\newcommand*\LTXinputExample[2][]{%