summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-09-05 22:16:03 +0000
committerKarl Berry <karl@freefriends.org>2015-09-05 22:16:03 +0000
commit458ae81ef20dbea77877876c44a0de359afd55de (patch)
tree9a307a71a169b831bd2dff1f1408638a86218e8a /Master/texmf-dist/doc/latex
parent412a3bd77bd76014472d93aa65ce8d7b75809ebb (diff)
checklistings (3sep15)
git-svn-id: svn://tug.org/texlive/trunk@38300 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex')
-rw-r--r--Master/texmf-dist/doc/latex/checklistings/Makefile42
-rw-r--r--Master/texmf-dist/doc/latex/checklistings/README.md56
-rw-r--r--Master/texmf-dist/doc/latex/checklistings/checklistings.hva188
-rw-r--r--Master/texmf-dist/doc/latex/checklistings/checklistings.pdfbin0 -> 286631 bytes
-rw-r--r--Master/texmf-dist/doc/latex/checklistings/example.html74
-rw-r--r--Master/texmf-dist/doc/latex/checklistings/example.pdfbin0 -> 73949 bytes
-rw-r--r--Master/texmf-dist/doc/latex/checklistings/example.tex56
7 files changed, 416 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/checklistings/Makefile b/Master/texmf-dist/doc/latex/checklistings/Makefile
new file mode 100644
index 00000000000..15126e2aba6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/checklistings/Makefile
@@ -0,0 +1,42 @@
+
+all: checklistings.sty checklistings.pdf
+
+checklistings.pdf: checklistings.dtx checklistings.ind checklistings.sty \
+ checklistings.chkl
+ ./checklistings.sh checklistings.chkl
+ pdflatex $<
+ pdflatex $<
+
+checklistings.ind: checklistings.idx
+ makeindex -s gind.ist -o $@ $<
+
+checklistings.idx checklistings.chkl: checklistings.dtx
+ pdflatex $<
+
+checklistings.sty: checklistings.dtx
+ latex checklistings.ins
+
+example.pdf: example.tex example.chkl checklistings.sty
+ ./checklistings.sh example.chkl
+ pdflatex $<
+ pdflatex $<
+
+example.html: example.tex example.chkl checklistings.hva
+ ./checklistings.sh example.chkl
+ hevea -fix example
+
+example.chkl: example.tex
+ pdflatex $<
+
+clean:
+ -@rm -rf chklisting0*.tex chklisting0*.ml Withopen*
+ -@rm -rf chklisting0*.msg chklisting0*.err
+ -@rm -rf checklistings.aux checklistings.glo checklistings.idx
+ -@rm -rf checklistings.ilg checklistings.ind checklistings.log
+ -@rm -rf checklistings.chkl checklistings.tmp
+ -@rm -rf checklistings.hd checklistings.out
+ -@rm -rf example0*.tex example0*.ml
+ -@rm -rf example0*.msg example0*.err example0*.html
+ -@rm -rf example.aux example.log
+ -@rm -rf example.chkl example.tmp
+
diff --git a/Master/texmf-dist/doc/latex/checklistings/README.md b/Master/texmf-dist/doc/latex/checklistings/README.md
new file mode 100644
index 00000000000..70f6c7fcabe
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/checklistings/README.md
@@ -0,0 +1,56 @@
+checklistings
+=============
+
+By [Timothy Bourke](http://www.tbrk.org)
+and [Marc Pouzet](http://www.di.ens.fr/~pouzet).
+
+User manuals and papers about programming languages usually contain many
+code samples, often with accompanying compiler messages giving the types
+of declarations or error messages explaining why certain declarations are
+invalid.
+
+The `checklistings` package augments the
+[fancyvrb](http://www.ctan.org/pkg/fancyvrb) and
+[listings](http://www.ctan.org/pkg/listings) packages for including source
+code in LaTeX documents with a way to pass the source code through a
+compiler and also include the resulting messages in the document.
+
+The motivation is to check the code samples in a document for syntax and
+typing errors and to facilitate the inclusion of inferred types and compiler
+warnings or errors in a text. This package is intentionally very lightweight
+and unlike packages like [python](http://www.ctan.org/pkg/python) it is not
+intended for interacting with an interpretor or including the execution
+traces of code. While `checklistings` does not focus on a specific
+programming language, it is designed to work well with ML-like languages.
+
+Using the package involves three elements:
+
+1. The declaration `\usepackage{checklistings}`.
+2. The verbatim environment `\begin{chklisting}...\end{chklisting}`.
+3. The shell script `checklistings.sh`.
+
+In a first pass, `latex`/`pdflatex` outputs code samples into files.
+The second pass is performed by `checklistings.sh` which passes each file
+through a compiler to generate corresponding output files.
+In a third pass, `latex`/`pdflatex` reads from the generated files to
+incorporate the results into the document.
+
+A `checklistings.hva` file is provided for interoperability with
+[HeVeA](http://hevea.inria.fr).
+
+The `checklistings` package may be distributed and/or modified under the
+conditions of the
+[LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
+either version 1.2 of this license or (at your option) any later version.
+
+Please send comments, suggestions, and bug reports (with version number and
+the keyword "checklistings" in the subject of the message) to
+<tim@tbrk.org>. Please keep in mind that we prefer to keep `checklistings`
+simple and lightweight rather than to incorporate many different
+configuration and customization options. The source code is hosted on
+[GitHub](https://github.com/tbrk/checklistings).
+
+This package was developed within the
+[PARKAS](http://www.di.ens.fr/ParkasTeam.html) at
+[Inria](http://www.inria.fr) and the [ENS](http://www.di.ens.fr).
+
diff --git a/Master/texmf-dist/doc/latex/checklistings/checklistings.hva b/Master/texmf-dist/doc/latex/checklistings/checklistings.hva
new file mode 100644
index 00000000000..8e3a95563bb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/checklistings/checklistings.hva
@@ -0,0 +1,188 @@
+%% HeVeA support for checklistings.
+%%
+%% Limitations / caveats
+%%
+%% * checklistings.hva requires all the intermediate generated by latex and
+%% checklistings.sh (*.<ext>, *.tex, *.msg, *.err).
+%%
+%% * The options 'codestyle', 'msgstyle', 'errstyle', 'codelst', 'msglst',
+%% and 'errlst' cannot be set as in LaTeX, e.g.,
+%% \checklistings{codelst={language=caml}}
+%% Since HeVeA eliminates the grouping braces and passes 'language' to
+%% the handler for 'codelst' (rather than 'language=caml').
+%%
+%% One workaround is to \usepackage{hevea} and use \ifhevea to select
+%% the most appropriate of the two forms.
+%%
+%% * fancyvrb and the package options codestyle, msgstyle, and errstyle are
+%% not supported.
+%% Alternative 1: use the codelst, msglst, and errlst options.
+%% Alternative 2: use css for formatting code, messages, and errors.
+%%
+%% * Non-empty labels in the arguments of \chklistingmsg and
+%% \chklistingerr are not supported.
+%%
+\ProvidesPackage{checklistings}
+\RequirePackage{keyval}
+\RequirePackage{listings}
+
+\newcounter{chklisting}
+\setcounter{chklisting}{-1}
+
+\newif\ifCHKL@fileexists
+\newif\ifCHKL@showcode\CHKL@showcodetrue
+\newif\ifCHKL@shouldfail\CHKL@shouldfailfalse
+\newif\ifCHKL@withresult\CHKL@withresultfalse
+\newif\ifCHKL@showerrors\CHKL@showerrorstrue
+\newif\ifCHKL@loadhtml\CHKL@loadhtmlfalse
+\def\CHKL@pkg@skipopts{}
+
+% % % Declare Options % % %
+
+\DeclareOption{withresult}{\CHKL@withresulttrue}
+\DeclareOption{withoutresult}{\CHKL@withresultfalse}
+\DeclareOption{skipone}{\def\CHKL@pkg@skipopts{firstline=2}}
+\DeclareOption{skiptwo}{\def\CHKL@pkg@skipopts{firstline=3}}
+\DeclareOption{showproblems}{\CHKL@showproblemstrue}
+\DeclareOption{hideproblems}{\CHKL@showproblemsfalse}
+
+\def\CHKL@codestyle{}
+\def\CHKL@msgstyle{}
+\def\CHKL@errstyle{}
+\define@key{CHKL@pkgkeys}{codestyle}[]{\def\CHKL@codestyle{#1}}
+\define@key{CHKL@pkgkeys}{msgstyle}[]{\def\CHKL@msgstyle{#1}}
+\define@key{CHKL@pkgkeys}{errstyle}[]{\def\CHKL@errstyle{#1}}
+
+\def\CHKL@codelst{}
+\def\CHKL@msglst{}
+\def\CHKL@errlst{}
+\define@key{CHKL@pkgkeys}{codelst}[]{\def\CHKL@codelst{#1}}
+\define@key{CHKL@pkgkeys}{msglst}[]{\def\CHKL@msglst{#1}}
+\define@key{CHKL@pkgkeys}{errlst}[]{\def\CHKL@errlst{#1}}
+
+\def\CHKL@subdir{.}
+\def\CHKL@prefix{chklisting}
+\def\CHKL@prompt{\#}
+\def\CHKL@ext{.ml}
+\define@key{CHKL@pkgkeys}{prompt}[]{\def\CHKL@prompt{#1}}
+\define@key{CHKL@pkgkeys}{subdir}[]{\def\CHKL@subdir{#1}}
+\define@key{CHKL@pkgkeys}{prefix}[]{\def\CHKL@prefix{#1}}
+\define@key{CHKL@pkgkeys}{ext}[]{\def\CHKL@ext{#1}}
+\define@key{CHKL@pkgkeys}{html}[]{\CHKL@loadhtmltrue}
+
+% Unused options
+\define@key{CHKL@pkgkeys}{compiler}[]{}
+\define@key{CHKL@pkgkeys}{compilerflags}[]{}
+\define@key{CHKL@pkgkeys}{lastflags}[]{}
+\define@key{CHKL@pkgkeys}{includecmd}[]{}
+
+% % % Process Options % % %
+
+% Work around the lack of \DeclareOption* in package.hva
+\renewcommand{\@process@option}[1]%
+ {\def\pkg@opt{{\@nostyle\@callprim{\@eatspaces}{#1,}}}%
+ \ifu\csname\@pkg@opt@name{\pkg@opt}\endcsname
+ \setkeys{CHKL@pkgkeys}{#1}
+ \else
+ \csname\@pkg@opt@name{\pkg@opt}\endcsname\fi}%
+
+\ProcessOptions*
+\newcommand{\checklistings}[1]{\ExecuteOptions{#1}}
+
+% % % Macros used in files generated by checklistings.sh % % %
+
+\newif\ifchklisting
+\newcommand{\setchklistingcmd}[1]{%
+ \global\def\chklistingcmd{\emph{\CHKL@prompt{#1}}}}
+
+\newenvironment{ChkListingMsg}{\verblatex}{\endverblatex}
+\newenvironment{ChkListingErr}{\verblatex}{\endverblatex}
+
+\newcommand{\chklistingfile}{\CHKL@prefix\CHKL@ext}
+
+% % % Checklistings user macros % % %
+
+\define@key{CHKL@envkeys}{continue}[]{}
+\define@key{CHKL@envkeys}{include}[]{}
+\define@key{CHKL@envkeys}{label}[]{}
+\define@key{CHKL@envkeys}{showproblems}[]{\CHKL@showproblemstrue}
+\define@key{CHKL@envkeys}{hideproblems}[]{\CHKL@showproblemsfalse}
+\define@key{CHKL@envkeys}{skipnone}[]{\def\CHKL@pkg@skipopts{firstline=1}}
+\define@key{CHKL@envkeys}{skipone}[]{\def\CHKL@pkg@skipopts{firstline=2}}
+\define@key{CHKL@envkeys}{skiptwo}[]{\def\CHKL@pkg@skipopts{firstline=3}}
+\define@key{CHKL@envkeys}{hide}[]{\CHKL@showcodefalse}
+\define@key{CHKL@envkeys}{withresult}[]{\CHKL@withresulttrue}
+\define@key{CHKL@envkeys}{withoutresult}[]{\CHKL@withresultfalse}
+\define@key{CHKL@envkeys}{fail}[]{\CHKL@shouldfailtrue}
+
+% Work around the lack of \edef and \expandafter
+\def\CHKL@lstset#1{\lstset{#1}}
+\def\elstset#1{\@callprim{\CHKL@lstset}{\{#1\}}}
+
+\newcommand{\chklistingmsg}{\bgroup%
+ \setenvclass{lstlisting}{lstlisting chklistingmsg}%
+ \elstset{\CHKL@msgstyle}%
+ \elstset{\CHKL@msglst}%
+ \lstinputlisting{\CHKL@subdir/\CHKL@prefix\CHKL@num.msg}%
+ \egroup}%
+
+\newcommand{\chklistingerr}{\bgroup%
+ \setenvclass{lstlisting}{lstlisting chklistingerr}%
+ \elstset{\CHKL@errstyle}%
+ \elstset{\CHKL@errlst}%
+ \lstinputlisting{\CHKL@subdir/\CHKL@prefix\CHKL@num.err}%
+ \egroup}%
+
+\newenvironment{chklisting}[1][]
+ {%
+ \setenvclass{lstlisting}{lstlisting chklisting}%
+ \stepcounter{chklisting}%
+ \def\@currentlabel{\thechklisting}%
+ \@setkeys{CHKL@envkeys}{#1}%
+ \global\def\CHKL@num{%
+ \ifthenelse{\value{chklisting}<1000}{0}{}%
+ \ifthenelse{\value{chklisting}<100}{0}{}%
+ \ifthenelse{\value{chklisting}<10}{0}{}%
+ \arabic{chklisting}}%
+ \global\def\CHKL@file{\CHKL@subdir/\CHKL@prefix\CHKL@num}%
+ \global\let\chklistingcmd\relax%
+ \ifCHKL@showcode%
+ \bgroup%
+ \ifCHKL@loadhtml%
+ \@open{div}{class="chklisting"}%
+ \rawinput{\CHKL@file{}.html}%
+ \@close{div}%
+ \else%
+ \elstset{\CHKL@pkg@skipopts}%
+ \elstset{\CHKL@codestyle}%
+ \elstset{\CHKL@codelst}%
+ \lstinputlisting{\CHKL@file\CHKL@ext}%
+ \fi%
+ \egroup%
+ \input{\CHKL@file.tex}%
+ \ifCHKL@shouldfail%
+ \ifchklisting%
+ \ifCHKL@showproblems%
+ \begin{divstyle}{checklistingserror}%
+ Unexpected success: \chklistingmsg{}
+ \end{divstyle}%
+ \fi%
+ \else%
+ \ifCHKL@withresult{\chklistingerr{}}\fi%
+ \fi%
+ \else
+ \ifchklisting%
+ \ifCHKL@withresult{\chklistingmsg{}}\fi%
+ \else%
+ \ifCHKL@showproblems%
+ \begin{divstyle}{checklistingserror}%
+ Unexpected failure: \chklistingerr{}
+ \end{divstyle}%
+ \fi%
+ \fi%
+ \fi
+ \fi%
+ \verblatex%
+ }
+ {\endverblatex}%
+\endinput
diff --git a/Master/texmf-dist/doc/latex/checklistings/checklistings.pdf b/Master/texmf-dist/doc/latex/checklistings/checklistings.pdf
new file mode 100644
index 00000000000..49f1aa917c9
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/checklistings/checklistings.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/checklistings/example.html b/Master/texmf-dist/doc/latex/checklistings/example.html
new file mode 100644
index 00000000000..5a78714da5a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/checklistings/example.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<meta name="generator" content="hevea 2.16">
+<style type="text/css">
+.li-itemize{margin:1ex 0ex;}
+.li-enumerate{margin:1ex 0ex;}
+.dd-description{margin:0ex 0ex 1ex 4ex;}
+.dt-description{margin:0ex;}
+.toc{list-style:none;}
+.footnotetext{margin:0ex; padding:0ex;}
+div.footnotetext P{margin:0px; text-indent:1em;}
+.thefootnotes{text-align:left;margin:0ex;}
+.dt-thefootnotes{margin:0em;}
+.dd-thefootnotes{margin:0em 0em 0em 2em;}
+.footnoterule{margin:1em auto 1em 0px;width:50%;}
+.caption{padding-left:2ex; padding-right:2ex; margin-left:auto; margin-right:auto}
+.title{margin:2ex auto;text-align:center}
+.titlemain{margin:1ex 2ex 2ex 1ex;}
+.titlerest{margin:0ex 2ex;}
+.center{text-align:center;margin-left:auto;margin-right:auto;}
+.flushleft{text-align:left;margin-left:0ex;margin-right:auto;}
+.flushright{text-align:right;margin-left:auto;margin-right:0ex;}
+div table{margin-left:inherit;margin-right:inherit;margin-bottom:2px;margin-top:2px}
+td table{margin:auto;}
+table{border-collapse:collapse;}
+td{padding:0;}
+.cellpadding0 tr td{padding:0;}
+.cellpadding1 tr td{padding:1px;}
+pre{text-align:left;margin-left:0ex;margin-right:auto;}
+blockquote{margin-left:4ex;margin-right:4ex;text-align:left;}
+td p{margin:0px;}
+.boxed{border:1px solid black}
+.textboxed{border:1px solid black}
+.vbar{border:none;width:2px;background-color:black;}
+.hbar{border:none;height:2px;width:100%;background-color:black;}
+.hfill{border:none;height:1px;width:200%;background-color:black;}
+.vdisplay{border-collapse:separate;border-spacing:2px;width:auto; empty-cells:show; border:2px solid red;}
+.vdcell{white-space:nowrap;padding:0px; border:2px solid green;}
+.display{border-collapse:separate;border-spacing:2px;width:auto; border:none;}
+.dcell{white-space:nowrap;padding:0px; border:none;}
+.dcenter{margin:0ex auto;}
+.vdcenter{border:solid #FF8000 2px; margin:0ex auto;}
+.minipage{text-align:left; margin-left:0em; margin-right:auto;}
+.marginpar{border:solid thin black; width:20%; text-align:left;}
+.marginparleft{float:left; margin-left:0ex; margin-right:1ex;}
+.marginparright{float:right; margin-left:1ex; margin-right:0ex;}
+.theorem{text-align:left;margin:1ex auto 1ex 0ex;}
+.part{margin:2ex auto;text-align:center}
+.lstlisting{font-family:monospace;white-space:pre;margin-right:auto;margin-left:0pt;text-align:left}
+.chklistingerr{font-style: italic; color: red;}
+.chklistingmsg{font-style: italic;}
+</style>
+<title>example</title>
+</head>
+<body >
+<!--HEVEA command line is: /usr/bin/hevea -fix example -->
+<!--CUT STYLE article--><!--CUT DEF section 1 --><p>Two simple declarations:
+</p><div class="lstlisting chklisting"><span style="font-family:sans-serif"><span style="font-weight:bold">let</span></span><span style="font-family:sans-serif"> </span><span style="font-family:sans-serif">x</span><span style="font-family:sans-serif"> = 3</span><span style="font-family:sans-serif">
+</span><span style="font-family:sans-serif"><span style="font-weight:bold">let</span></span><span style="font-family:sans-serif"> </span><span style="font-family:sans-serif">f</span><span style="font-family:sans-serif"> </span><span style="font-family:sans-serif">x</span><span style="font-family:sans-serif"> = </span><span style="font-family:sans-serif">x</span><span style="font-family:sans-serif"> + 1</span></div><p>and, after compilation with <em>ocamlc -i example.ml</em>, their types:
+</p><div class="lstlisting chklistingmsg">val x : int
+val f : int -&gt; int</div><p>Then, building on these definitions:
+</p><div class="lstlisting chklisting"><span style="font-family:sans-serif"><span style="font-weight:bold">let</span></span><span style="font-family:sans-serif"> </span><span style="font-family:sans-serif">y</span><span style="font-family:sans-serif"> = </span><span style="font-family:sans-serif">f</span><span style="font-family:sans-serif"> 3</span></div><div class="lstlisting chklistingmsg">val y : int</div><p>What about compiler error messages?:
+</p><div class="lstlisting chklisting"><span style="font-family:sans-serif"><span style="font-weight:bold">let</span></span><span style="font-family:sans-serif"> </span><span style="font-family:sans-serif">z</span><span style="font-family:sans-serif"> = 3 + </span><span style="font-family:sans-serif"><span style="font-family:sans-serif">"four"</span></span></div><p>They are also detected:
+</p><div class="lstlisting chklistingerr">File "example.ml", line 1, characters 12-18:
+Error: This expression has type string but an expression was expected of type
+ int</div><p>We can continue on from earlier examples:</p><div class="lstlisting chklisting"><span style="font-family:sans-serif"><span style="font-weight:bold">let</span></span><span style="font-family:sans-serif"> </span><span style="font-family:sans-serif">z</span><span style="font-family:sans-serif"> = </span><span style="font-family:sans-serif">f</span><span style="font-family:sans-serif"> </span><span style="font-family:sans-serif">y</span></div><div class="lstlisting chklistingmsg">val z : int</div><!--CUT END -->
+<!--HTMLFOOT-->
+<!--ENDHTML-->
+<!--FOOTER-->
+<hr style="height:2"><blockquote class="quote"><em>This document was translated from L<sup>A</sup>T<sub>E</sub>X by
+</em><a href="http://hevea.inria.fr/index.html"><em>H</em><em><span style="font-size:small"><sup>E</sup></span></em><em>V</em><em><span style="font-size:small"><sup>E</sup></span></em><em>A</em></a><em>.</em></blockquote></body>
+</html>
diff --git a/Master/texmf-dist/doc/latex/checklistings/example.pdf b/Master/texmf-dist/doc/latex/checklistings/example.pdf
new file mode 100644
index 00000000000..37def76c622
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/checklistings/example.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/checklistings/example.tex b/Master/texmf-dist/doc/latex/checklistings/example.tex
new file mode 100644
index 00000000000..88980097a9f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/checklistings/example.tex
@@ -0,0 +1,56 @@
+\documentclass[a4paper]{article}
+
+\usepackage[T1]{fontenc}
+\usepackage[prompt=,prefix=example]{checklistings}
+\usepackage{listings}
+
+\lstdefinestyle{camlstyle}{%
+ language=caml,
+ basicstyle=\sffamily,
+ keywordstyle=\bf,
+ literate={"}{\textquotedbl}1,
+}
+%BEGIN LATEX
+\checklistings{codelst={style=camlstyle}}
+%END LATEX
+%HEVEA \newstyle{.chklistingerr}{font-style: italic; color: red;}
+%HEVEA \newstyle{.chklistingmsg}{font-style: italic;}
+%HEVEA \checklistings{codelst=\{style=camlstyle\}}
+
+\begin{document}
+
+\noindent
+Two simple declarations:
+\begin{chklisting}
+let x = 3
+let f x = x + 1
+\end{chklisting}
+
+\noindent
+and, after compilation with \chklistingcmd, their types:
+\chklistingmsg{}
+
+\noindent
+Then, building on these definitions:
+\begin{chklisting}[continue,withresult,label=early]
+let y = f 3
+\end{chklisting}
+
+\noindent
+What about compiler error messages?:
+\begin{chklisting}[fail]
+let z = 3 + "four"
+\end{chklisting}
+
+\noindent
+They are also detected:
+\chklistingerr{}
+
+\noindent
+We can continue on from earlier examples:
+
+\begin{chklisting}[withresult,include=early]
+let z = f y
+\end{chklisting}
+
+\end{document}