summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-03-20 21:39:32 +0000
committerKarl Berry <karl@freefriends.org>2013-03-20 21:39:32 +0000
commit9e911023afe015ce7f305faa22f558745289096a (patch)
treec680f1ee8b7d0f6a50f6f2366949d7d2ebff1b30
parentd8babc4954624c4f019bfc69f90273dbb0ea6c35 (diff)
numberedblock (20mar13)
git-svn-id: svn://tug.org/texlive/trunk@29447 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/numberedblock/README13
-rw-r--r--Master/texmf-dist/doc/latex/numberedblock/testnumberedblock.pdfbin0 -> 35138 bytes
-rw-r--r--Master/texmf-dist/doc/latex/numberedblock/testnumberedblock.tex64
-rw-r--r--Master/texmf-dist/tex/latex/numberedblock/numberedblock.sty102
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check3
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/numberedblock.tlpsrc0
7 files changed, 182 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/numberedblock/README b/Master/texmf-dist/doc/latex/numberedblock/README
new file mode 100644
index 00000000000..32533fb5b53
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/numberedblock/README
@@ -0,0 +1,13 @@
+The style file numberedblock has been created for the report writer's
+convenience.
+
+Do you need to include various small inline blocks of code in your
+documents? It can be a pain to refer to them if they are not labeled.
+This style package allows you to include and sequentially label
+code-block snippets in your document, so that they can be subsequently
+refered to in an unambiguous fashion.
+
+Sorry I don't have a separate documentation file, but it's very simply
+documented in the style file itself, and the testnumberedblock example.
+
+ -Steven Segletes
diff --git a/Master/texmf-dist/doc/latex/numberedblock/testnumberedblock.pdf b/Master/texmf-dist/doc/latex/numberedblock/testnumberedblock.pdf
new file mode 100644
index 00000000000..cdfd2713b3f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/numberedblock/testnumberedblock.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/numberedblock/testnumberedblock.tex b/Master/texmf-dist/doc/latex/numberedblock/testnumberedblock.tex
new file mode 100644
index 00000000000..b12dc3c6725
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/numberedblock/testnumberedblock.tex
@@ -0,0 +1,64 @@
+\documentclass[10pt]{article}
+\usepackage{numberedblock}
+
+\begin{document}
+
+\parindent 0.3in
+%\setlength\maxblocklabelsize{-.4in}
+\setlength\blockindent{0.0in}
+
+This is a test of the \textsf{numberedblock} style packcage, which is
+specially designed to produce sequentially numbered BLOCKS of code (note
+the individual code lines are not numbered, but the whole block gets a
+single number, for later reference (much in the same way that equations
+can get numbered in a document). While specialized for numbering code
+blocks, the commands can actually number other items, as well, in fact
+anything that fits in a \LaTeX{} box.
+
+If the code block contains no special characters, one can simply use the
+command form, called \verb,\numblock,. It cannot handle verbatim text,
+but must use standard \LaTeX{} escape sequences (for line breaks,
+contiguous spaces, special characters, etc.). It puts the output in a
+tt font , which is the same used in the verbatim environment:
+
+\numblock{This text is the\\argument to the command\\where double
+slashes have been\\used for line breaks}
+
+Most useful, however, there is also the \verb,numVblock, environment,
+which handles verbatim text, as seen in the next example:
+
+\begin{numVblock}
+This is the numVblock
+environment, which (<--see contiguous spaces here)
+succeeds in
+incorporating verbatim text like
+@##$%*$%$()||}{?><\\\
+\end{numVblock}
+
+As envisioned the \verb,numVblock, environment would be ideally suited
+for displaying small code blocks as part of documentation. The code can
+contain contiguous spaces and special characters:
+
+\begin{numVblock}
+ program test
+ implicit none
+ integer a, x
+c$$$$$$$$$$$$$$$$$$$$$$$$$
+ a = 0
+ x = 1
+ 10 a = a + x
+ if (a .eq. 100) stop
+ goto 10
+ end
+\end{numVblock}
+
+Below, I test the \verb,\numblock, command with the argument as a
+box, rather than as formatted text.
+
+\numblock{\fbox{Testing, 1,2,3 testing a box}}
+
+Don't forget, there are settable parameters to define the block
+left-indent, the format of the label, and (if needed) the labels' max
+width/placement.
+
+\end{document}
diff --git a/Master/texmf-dist/tex/latex/numberedblock/numberedblock.sty b/Master/texmf-dist/tex/latex/numberedblock/numberedblock.sty
new file mode 100644
index 00000000000..b093da67942
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/numberedblock/numberedblock.sty
@@ -0,0 +1,102 @@
+\ProvidesPackage {numberedblock} [2007/03/16 v1.01]
+%
+% by Steven B. Segletes, for the public domain.
+%
+% numberedblock provides several routines
+% intended to print out a block of code with a unique,
+% sequentially indexed label. The code block is printed to the left,
+% with the block label printed centered vertically on the code block,
+% horizontally right-justified. Each line of code is not numbered...
+% rather, the block of code gets a single label.
+%
+% There are three parameters with which the user may freely alter:
+% 1) maxblocklabelsize is a length set aside for the code-block labels.
+% If it is too small, the label will run off the right margin; too large
+% and it limits the width of the code block itself. However, by setting
+% this parameter to a negative value, it will force the label to be
+% offset into the right margin, which may be a desirable feature.
+% 2) blockindent is a length defining the left-side indent to be used
+% for the code block to be printed.
+% 3) blocklabel is the command that actually formats the block label to
+% the desired appearance. Currently, italicized numbers are used within
+% non-italicized square brackets to comprise the block label.
+%
+% There is a command-line version called numblock, which cannot
+% handle verbatim input. And there is an environment called numVblock
+% which handles cases invloving verbatim input
+%
+% An example of how to use numberedblock is given below. The
+% double-backslash is used for linebreaks in the code. Tildes need to
+% be used for hard spaces under two conditions: when the code contains
+% multiple sequential spaces; and if a space follows a period (which
+% would otherwise invoke end-of-sentence spacing considerations). In
+% addition, special LaTeX characters need to be quoted in the
+% appropriate manner of LaTeX.
+%
+% \numblock{Line 1 of code\\Line 2 of code\\Line 3...}
+%
+% In contrast, the numVblock environment is a verbatim environment:
+%
+% \begin{numVblock}{
+% program test
+% implicit none
+% integer a, x
+% a = 0
+% x = 1
+% 10 a = a + x
+% if (a .eq. 100) stop
+% goto 10
+% end
+% \end{numVblock}
+%
+% The font used for the code block itself is the ttfamily (typewriter)
+% of fixed-width characters. The counter named blocknum is used to
+% index the code block sequence.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NeedsTeXFormat{LaTeX2e}
+\@ifundefined{verbatim@processline}{\RequirePackage{verbatim}}{}
+\usepackage{verbatimbox}
+
+\newsavebox{\@savedverbbox}
+\newlength\maxblocklabelsize
+\newlength\blockindent
+ \setlength\maxblocklabelsize{-0.4in}
+ \setlength\blockindent{0.2in}
+ \newcommand\blocklabel[1]{[\textit{\arabic{#1}}]}
+\newcounter{blocknum}
+\setcounter{blocknum}{0}
+\newlength\codeblockwidth
+\newlength\parindentsave
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\numVblock{%
+ \sbox\@savedverbbox{\usebox{\savedverbbox}}
+ \verbbox
+}
+\def\endnumVblock{
+ \endverbbox
+ \numblock{\theverbbox[t]}
+ \global\sbox{\savedverbbox}{\usebox{\@savedverbbox}}
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand\numblock[1]{
+ \setlength\codeblockwidth{\textwidth}
+ \addtolength\codeblockwidth{-\maxblocklabelsize}
+ \addtolength\codeblockwidth{-\blockindent}
+ \setlength\parindentsave{\parindent}
+ \parindent 0in
+ \addtocounter{blocknum}{1}
+ \vspace{\abovecaptionskip}
+ \begin{tabular}{@{\hspace{\blockindent}} l @{} r @{}}
+ {\tt
+ \begin{tabular*}{\codeblockwidth}{@{} l @{}}
+ #1
+ \end{tabular*}%
+ }
+ & \makebox[\maxblocklabelsize]{\hfill\blocklabel{blocknum}}\\
+ \end{tabular}
+ \vspace{\belowcaptionskip}
+ \setlength{\parindent}{\parindentsave}
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\endinput
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index b0073820c0d..21f98a40282 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -304,7 +304,8 @@ my @TLP_working = qw(
noitcrul nolbreaks
nomencl nomentbl nonfloat nonumonpart nopageno nostarch notes
notes2bib notoccite nowidow
- nrc ntgclass ntheorem ntheorem-vn nuc numericplots numname numprint
+ nrc ntgclass ntheorem ntheorem-vn nuc
+ numberedblock numericplots numname numprint
oberdiek objectz ocg-p ocgx ocherokee ocr-b ocr-b-outline ocr-latex octavo
odsfile ofs
ogham oinuit oldlatin oldstandard oldstyle
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index 7b172c9baad..0bd3148511e 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -548,6 +548,7 @@ depend notes
depend notoccite
depend nowidow
depend ntheorem
+depend numberedblock
depend numname
depend numprint
depend ocg-p
diff --git a/Master/tlpkg/tlpsrc/numberedblock.tlpsrc b/Master/tlpkg/tlpsrc/numberedblock.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/numberedblock.tlpsrc