diff options
author | Norbert Preining <norbert@preining.info> | 2022-06-28 03:01:06 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-06-28 03:01:06 +0000 |
commit | 2ef43af0215fc52966c9bbd8d5df6db6d6af224b (patch) | |
tree | f4575d7d44d673aef7008af7e6f14037472d4587 /dviware/dvisirule/dvisirule-pgnum.awk | |
parent | 2f80535c778eacefb7c73b39d2cb4f877f3d3341 (diff) |
CTAN sync 202206280301
Diffstat (limited to 'dviware/dvisirule/dvisirule-pgnum.awk')
-rw-r--r-- | dviware/dvisirule/dvisirule-pgnum.awk | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/dviware/dvisirule/dvisirule-pgnum.awk b/dviware/dvisirule/dvisirule-pgnum.awk new file mode 100644 index 0000000000..2e0e2ea2c0 --- /dev/null +++ b/dviware/dvisirule/dvisirule-pgnum.awk @@ -0,0 +1,45 @@ +# +# Copyright (C) 2012-2022 Jiro Senju +# +# This package is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# This package is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this package. If not, see <http://www.gnu.org/licenses/>. +# + +# Parses '.sirule' file which is generated at latex compile-time, and generates +# the page-numbered DVI filenames. +# The sequential pages which don't contain "sitabular" are concatenated and such +# filename will be "PG-PG.dvi". Otherwise the filename will be "PG.dvi". + +function pr(begin, end) +{ + if (!begin) + begin = 1; + if (begin == end) + print begin ".dvi"; + else + print begin "-" end ".dvi"; +} +BEGIN { + lastpg = 0; +} +{ + pg = $0; + if (lastpg+1 < pg) + pr(lastpg+1, pg-1); + print pg ".sidvi"; + lastpg = pg; +} +END { + if (lastpg+1 < npages) + pr(lastpg+1, npages); +} |