summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ydoc/ydoc-expl.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-01-11 00:40:15 +0000
committerKarl Berry <karl@freefriends.org>2011-01-11 00:40:15 +0000
commita91307c2f17b5b11a02a758bae9548f24ea3e844 (patch)
tree124f70c8668c3f03d0d467b1e87fe7c8bfaec399 /Master/texmf-dist/tex/latex/ydoc/ydoc-expl.sty
parent69b48db5779580145aee8c957250d4556a2c5d91 (diff)
ydoc (10jan11)
git-svn-id: svn://tug.org/texlive/trunk@21019 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ydoc/ydoc-expl.sty')
-rw-r--r--Master/texmf-dist/tex/latex/ydoc/ydoc-expl.sty38
1 files changed, 29 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/latex/ydoc/ydoc-expl.sty b/Master/texmf-dist/tex/latex/ydoc/ydoc-expl.sty
index c22dc70ef11..6247f8bd527 100644
--- a/Master/texmf-dist/tex/latex/ydoc/ydoc-expl.sty
+++ b/Master/texmf-dist/tex/latex/ydoc/ydoc-expl.sty
@@ -29,13 +29,13 @@
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackageSVN
[ydoc-expl]
- {$Id: ydoc.dtx 2004 2011-01-03 22:51:32Z martin $}
- [v0.3alpha]
+ {$Id: ydoc.dtx 2035 2011-01-09 17:22:24Z martin $}
+ [v0.4alpha]
[ydoc package to insert live examples of LaTeX code]
\RequirePackage{listings}
\lst@RequireAspects{writefile}
\def\ydoc@exafile{\jobname.exa}
-\def\exampleprintsettings{frame=lines}%
+\def\exampleprintsettings{numbers=left,numberstyle=\tiny\color{gray}\sffamily,numbersep=5pt}%
\newbox\examplecodebox
\newbox\exampleresultbox
\def\BoxExample{%
@@ -44,17 +44,33 @@
\expandafter\expandafter\expandafter[%
\expandafter\exampleprintsettings\expandafter,\thisexampleprintsettings]%
{\ydoc@exafile}%
- \color@endgroup}%
+ \unskip\color@endgroup}%
\setbox\exampleresultbox\hbox{\color@setgroup
\@@input\ydoc@exafile\relax
- \color@endgroup}%
+ \unskip\color@endgroup}%
}
-\RequirePackage{showexpl}
\def\PrintExample{%
\begingroup
- \lstset{basicstyle=\ttfamily}%
- \MakePercentComment
- \LTXinputExample[varwidth]{\ydoc@exafile}%
+ \BoxExample
+ \@tempdima=\textwidth
+ \advance\@tempdima by -\wd\examplecodebox\relax
+ \advance\@tempdima by -\wd\exampleresultbox\relax
+ \advance\@tempdima by -15pt\relax
+ \ifdim\@tempdima>\bigskipamount
+ \hbox to \textwidth{%
+ \null\hss
+ \minipage[c]{\wd\exampleresultbox}\fbox{\usebox\exampleresultbox}\endminipage
+ \hfill\hfill\hskip\bigskipamount\hskip15pt\hfill\hfill
+ \minipage[c]{\wd\examplecodebox}\usebox\examplecodebox\endminipage
+ \hss\null
+ }%
+ \else
+ \vbox{%
+ \centerline{\fbox{\usebox\exampleresultbox}}%
+ \vspace{\bigskipamount}%
+ \centerline{\usebox\examplecodebox}%
+ }%
+ \fi
\endgroup
}
\def\examplecodesettings{gobble=4}
@@ -67,7 +83,11 @@
{%
\lst@EndWriteFile
\egroup
+ \begingroup
+ \MakePercentComment
+ \catcode`\^^M=5\relax
\PrintExample
+ \endgroup
}
\RequirePackage{float}
\floatstyle{plain}