From ce124d96f4bfa21c13a9803a0c4c9eecdf11c130 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 9 Feb 2020 03:01:29 +0000 Subject: CTAN sync 202002090301 --- .../latex/contrib/acmart/ACM-Reference-Format.bst | 42 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'macros/latex/contrib/acmart/ACM-Reference-Format.bst') diff --git a/macros/latex/contrib/acmart/ACM-Reference-Format.bst b/macros/latex/contrib/acmart/ACM-Reference-Format.bst index fa5273282a..8b97b18812 100644 --- a/macros/latex/contrib/acmart/ACM-Reference-Format.bst +++ b/macros/latex/contrib/acmart/ACM-Reference-Format.bst @@ -426,6 +426,44 @@ FUNCTION { output.coden } % UTAH if$ } +% +% Sometimes articleno starts with the word 'Article' or 'Paper. +% (this is a bug of acmdl, sigh) +% We strip them. We assume eid or articleno is already on stack +% + +FUNCTION { strip.articleno.or.eid } +{ + 't := + t #1 #7 substring$ "Article" = + {t #8 t text.length$ substring$ 't :=} + { } + if$ + t #1 #7 substring$ "article" = + {t #8 t text.length$ substring$ 't :=} + { } + if$ + t #1 #5 substring$ "Paper" = + {t #6 t text.length$ substring$ 't :=} + { } + if$ + t #1 #5 substring$ "paper" = + {t #6 t text.length$ substring$ 't :=} + { } + if$ + % Strip any left trailing space or ~ + t #1 #1 substring$ " " = + {t #2 t text.length$ substring$ 't :=} + { } + if$ + t #1 #1 substring$ "~" = + {t #2 t text.length$ substring$ 't :=} + { } + if$ + t +} + + FUNCTION { format.articleno } { articleno empty.or.unknown not eid empty.or.unknown not and @@ -441,8 +479,8 @@ FUNCTION { format.articleno } { } if$ eid empty.or.unknown - { "Article \bibinfo{articleno}{" articleno * "}" * } - { "Article \bibinfo{articleno}{" eid * "}" * } + { "Article \bibinfo{articleno}{" articleno strip.articleno.or.eid * "}" * } + { "Article \bibinfo{articleno}{" eid strip.articleno.or.eid * "}" * } if$ } if$ -- cgit v1.2.3