From b90e3db7f33fec4598e155d820951f823a0721a1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 3 Jan 2011 23:45:17 +0000 Subject: new latex package aomart 1.1 (2jan11) git-svn-id: svn://tug.org/texlive/trunk@20919 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/aomart/fullref.pl | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Master/texmf-dist/doc/latex/aomart/fullref.pl (limited to 'Master/texmf-dist/doc/latex/aomart/fullref.pl') diff --git a/Master/texmf-dist/doc/latex/aomart/fullref.pl b/Master/texmf-dist/doc/latex/aomart/fullref.pl new file mode 100644 index 00000000000..0414089ea00 --- /dev/null +++ b/Master/texmf-dist/doc/latex/aomart/fullref.pl @@ -0,0 +1,62 @@ +#!/usr/bin/perl +# +# Convert the refences to \fullref. Usage: +# perl fullref.pl original.tex > converted.tex +# +# +# Copyright (C) 2010 Annals of Mathematics. Public domain. +# +# Author: Boris Veytsman +# +# Version: 0.9, 2010/12/04 + +use strict; + +# List of patterns for 'equation' words +my @eqsynonyms = ('\S*equa\S*', 'relat\S*', 'item\S*', + 'condition\S*', + '\S*propert\S*'); + +# First we skip preamble +while(<>) { + print; + last if (/\\begin\{document\}/); +} + +# This is a trick to catch \ref being the first word on the line +my $prevline = ""; + +# Processing document +while (<>) { + if ((/^[\s~]*\(?\\ref/) || (/^[\s~]*\\eqref/)) { + chomp $prevline; + $_ = "$prevline $_"; + } else { + print $prevline; + } + + # Now the meat of the substitutions + # We add initial space, so all words have space before them. + $_ = " $_"; + foreach my $synonym (@eqsynonyms) { + s/(\s)($synonym)[\s~]*\(\\ref\{([^\}]+)\}\)/$1\\pfullref{$2}{$3}/gi; + s/(\s)($synonym)[\s~]*\\eqref\{([^\}]+)\}/$1\\eqfullref{$2}{$3}/gi; + } + s/(\s)([^\s\\]\S*[^~\s\(\)\[\]])[\s~]*\[\\ref\{([^\}]+)\}\]/$1\\bfullref{$2}{$3}/g; + s/(\s)([^\s\\]\S*[^~\s\(\)\[\]])[\s~]*\\ref\{([^\}]+)\}/$1\\fullref{$2}{$3}/g; + + # Now delete the extra space + s/^ //; + $prevline=$_; + if (/\\end\{document\}/) { + print; + last; + } +} + +# And processing whatever is left +while (<>) { + print; +} + +exit 0; -- cgit v1.2.3