diff options
author | Karl Berry <karl@freefriends.org> | 2014-03-06 22:10:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-03-06 22:10:33 +0000 |
commit | 3731208d7fb52ead680b0a31cae7e086b536a97b (patch) | |
tree | 3e639885dc67904ab8a3867ec9b17a7ebeae3705 /Master/texmf-dist/tex/latex/numberedblock | |
parent | dce368d510dc3ccdacfd71146a8fbd05bb74f82d (diff) |
numberedblock (6mar14)
git-svn-id: svn://tug.org/texlive/trunk@33109 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/numberedblock')
-rw-r--r-- | Master/texmf-dist/tex/latex/numberedblock/numberedblock.sty | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/latex/numberedblock/numberedblock.sty b/Master/texmf-dist/tex/latex/numberedblock/numberedblock.sty index b093da67942..1c2cf01cd9a 100644 --- a/Master/texmf-dist/tex/latex/numberedblock/numberedblock.sty +++ b/Master/texmf-dist/tex/latex/numberedblock/numberedblock.sty @@ -1,6 +1,14 @@ -\ProvidesPackage {numberedblock} [2007/03/16 v1.01] +\ProvidesPackage {numberedblock} [2014/02/24 v1.10] % -% by Steven B. Segletes, for the public domain. +% by Steven B. Segletes +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. % % numberedblock provides several routines % intended to print out a block of code with a unique, @@ -33,11 +41,15 @@ % 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...} +% \numblock{Line 1 of code\\Line 2 of code\\Line 3...\nblabel{mylabel}} +% +% A label may set to the code block with \nblabel{}. % -% In contrast, the numVblock environment is a verbatim environment: +% In contrast, the numVblock environment is a verbatim environment. +% A label may be passed to numVblock through an optional argument, via +% \nbVlabel{}. % -% \begin{numVblock}{ +% \begin{numVblock}[\nbVlabel{mylabel}] % program test % implicit none % integer a, x @@ -53,11 +65,23 @@ % of fixed-width characters. The counter named blocknum is used to % index the code block sequence. % +% V1.1 - Added the hyperref-compatible capability to label and +% reference numbered blocks. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} \@ifundefined{verbatim@processline}{\RequirePackage{verbatim}}{} \usepackage{verbatimbox} +%%%%% LABELING CAPABILITY +% See: http://tex.stackexchange.com/questions/160466/ +% how-can-one-refer-to-a-part-of-an-equation +\AtBeginDocument{\let\nb@label\label} +\newcounter{nb@counter} +\newcommand{\nblabel}[1]{\def\@currentlabel{\theblocknum}\nb@label{#1}} +\newcommand{\nbVlabel}[1]{\setcounter{nb@counter}{\theblocknum}\stepcounter{nb@counter}% + \def\@currentlabel{\thenb@counter}\nb@label{#1}} +%%%%% + \newsavebox{\@savedverbbox} \newlength\maxblocklabelsize \newlength\blockindent |