summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/numberedblock/testnumberedblock.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/numberedblock/testnumberedblock.tex
Initial commit
Diffstat (limited to 'macros/latex/contrib/numberedblock/testnumberedblock.tex')
-rw-r--r--macros/latex/contrib/numberedblock/testnumberedblock.tex66
1 files changed, 66 insertions, 0 deletions
diff --git a/macros/latex/contrib/numberedblock/testnumberedblock.tex b/macros/latex/contrib/numberedblock/testnumberedblock.tex
new file mode 100644
index 0000000000..0e66a6a262
--- /dev/null
+++ b/macros/latex/contrib/numberedblock/testnumberedblock.tex
@@ -0,0 +1,66 @@
+\documentclass[10pt]{article}
+\usepackage{numberedblock}
+\textheight 7.7in
+\begin{document}
+%DEFAULTS:
+%\setlength\maxblocklabelsize{-.4in}
+%\setlength\blockindent{0.2in}
+%\renewcommand\blocklabel[1]{[\textit{\arabic{#1}}]}
+
+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
+(or is already a box), 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 as used in the verbatim environment:
+
+\numblock{This text is the\\argument to the command\\where double
+slashes have been\\used for line breaks\nblabel{nb:A}}
+
+Most useful, however, there is also the \verb,numVblock, environment,
+which handles verbatim text, as seen in the next example:
+
+\begin{numVblock}[\nbVlabel{nb:B}]
+This is a labeled 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, and I can
+{\bfseries (NEW!!)} even reference
+the numbered blocks~\ref{nb:A} and \ref{nb:B}. 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}