summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2025-01-08 21:19:18 +0000
committerKarl Berry <karl@freefriends.org>2025-01-08 21:19:18 +0000
commit89ac34cc6ec02d6d438afdeb069fce9358a6a7e5 (patch)
tree0aac856dac1a7448f6a50c6010ff56c7575bb60c /Master/texmf-dist/scripts
parent1f5fb799d4bfcab222359c810e9b4bee4ca4eccd (diff)
aomart (8jan25)
git-svn-id: svn://tug.org/texlive/trunk@73378 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-xMaster/texmf-dist/scripts/aomart/aom-fullref.pl62
1 files changed, 62 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/aomart/aom-fullref.pl b/Master/texmf-dist/scripts/aomart/aom-fullref.pl
new file mode 100755
index 00000000000..0eba808aa84
--- /dev/null
+++ b/Master/texmf-dist/scripts/aomart/aom-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-2021 Annals of Mathematics. Licenses under CC0
+#
+# 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;
+ s/(\s)([^\s\\]\S*[^~\s\(\)\[\]])[\s~]*\\pageref\{([^\}]+)\}/$1\\fullpageref[$2]{$3}/g;
+ # Now delete the extra space
+ s/^ //;
+ $prevline=$_;
+ if (/\\end\{document\}/) {
+ print;
+ last;
+ }
+}
+
+# And processing whatever is left
+while (<>) {
+ print;
+}
+
+exit 0;