summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/latex4wp/exa.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-14 22:53:37 +0000
committerKarl Berry <karl@freefriends.org>2010-09-14 22:53:37 +0000
commitd31e3cb2cb89121da9afc55e82d64ad45c6d6c86 (patch)
treeec3ba5d1b869806e876804b90fe7a370083a18ba /Master/texmf-dist/doc/latex/latex4wp/exa.sty
parent5e7679b3fae60cad87c935a8753cbc929b337f22 (diff)
new manual latex4wp 1.0.7 (14sep10)
git-svn-id: svn://tug.org/texlive/trunk@19730 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/latex4wp/exa.sty')
-rw-r--r--Master/texmf-dist/doc/latex/latex4wp/exa.sty118
1 files changed, 118 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/latex4wp/exa.sty b/Master/texmf-dist/doc/latex/latex4wp/exa.sty
new file mode 100644
index 00000000000..1e1cbe5e652
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/latex4wp/exa.sty
@@ -0,0 +1,118 @@
+% exa.sty
+% modified after example.sty by J.Schrod, xitijsch@ddathd21.bitnet
+% Guido Gonzato, guido.gonzato@univr.it
+
+\chardef\escape=0
+\chardef\open=1
+\chardef\close=2
+\chardef\letter=11
+\chardef\other=12
+%\chardef\active=13 % is defined in Plain already
+
+\chardef\uscode=\catcode`\_ % top level macro file!
+
+\catcode`\_=\letter
+
+\oddsidemargin=0pt
+\evensidemargin=\oddsidemargin
+
+\newwrite\example_file
+\def\example_name{\jobname.tmp } % <-- space!
+
+\newdimen\ExampleWidth
+ \ExampleWidth=\textwidth
+ \advance\ExampleWidth by \marginparwidth % stick into margins
+ \advance\ExampleWidth by \columnsep % between columns
+ \divide\ExampleWidth by 2
+
+\def\ExampleSet{%
+ \begin{boxedminipage}[c]{0.5\textwidth}%
+ \hrule height\z@
+ \def\markboth##1##2{}%
+ \def\markright##1{}%
+ \def\addcontentsline##1##2##3{}%
+ \input \example_name
+ \par
+ \hrule height\z@
+ \end{boxedminipage}%
+ }
+
+\begingroup
+ \catcode`\^^I=\active
+ \gdef\@vobeytabs{\catcode`\^^I\active \let^^I\@xobeytab}
+ \global\let^^I=\@xobeytab% % for \write's
+\endgroup
+\def\@xobeytab{\space\space\space\space\space\space\space\space}
+
+\def\ExampleVerb{%
+ \begin{minipage}[c]{0.5\textwidth}%
+ \hrule height\z@
+ \begingroup
+ \small
+ \parindent\z@
+ \rightskip\@flushglue
+ \@makeother\"\@verbatim
+ \frenchspacing \@vobeyspaces \@vobeytabs
+ \input \example_name
+ \endverbatim
+ \endgroup
+ %\hrule height\z@
+ \end{minipage}%
+ }
+
+\def\example{
+ \par
+ \immediate\openout\example_file\example_name
+ \begingroup
+ \@makeother\"\let\do\@makeother \dospecials
+ \obeylines \obeyspaces
+ \@ignoretrue \copy_line
+ }
+
+\begingroup
+ \catcode`\|=\escape % | is temporary escape character
+ \catcode`\[=\open % [ and ] are temporary grouping symbols
+ \catcode`\]=\close
+ \catcode`\{=\other % these are `other' in verbatim mode
+ \catcode`\}=\other
+ \catcode`\\=|other
+ |gdef|end_of_example[\end{example}]
+|endgroup
+
+\begingroup
+ \obeylines \gdef\copy_line#1^^M{\write_line{#1}}%
+\endgroup
+
+\def\write_line#1{%
+ \def\Next{#1}%
+ \ifx \Next\end_of_example
+ \def\Next{\end{example}}% % finish example
+ \else
+ \ifx \Next\empty
+ \if@ignore % ignore empty lines at the beginning
+ \else % but write them out later
+ \immediate\write\example_file{\Next}%
+ \fi
+ \else
+ \immediate\write\example_file{\Next}%
+ \@ignorefalse % at least one non-empty line written
+ \fi
+ \let\Next\copy_line % next line of example
+ \fi
+ \Next
+ }
+
+\def\endexample{%
+ \endgroup
+ \immediate\closeout\example_file
+ \penalty \predisplaypenalty
+ \vskip \abovedisplayskip
+ % \leftline{\ExampleVerb \hskip\columnsep \ExampleSet}%
+ \leftline{\ExampleVerb \hfill \ExampleSet}%
+ \penalty \postdisplaypenalty
+ \vskip \belowdisplayskip
+ }
+
+\catcode`\_=\uscode
+
+\endinput