texprlcount icon indicating copy to clipboard operation
texprlcount copied to clipboard

Respect TC:ignore for fig and table counts

Open andrewfowlie opened this issue 2 years ago • 1 comments

I noticed that figures and tables (and possibly inline math and equations, not sure) are still counted even when they are inside

  %TC:ignore
  ...
  %TC:endignore

blocks. I put my appendices/supplemental material inside a block, and whilst the words weren't counted, the figures and tables were. It would be nice for them to be ignored.

andrewfowlie avatar Apr 13 '22 05:04 andrewfowlie

One possible solution would be to write a wrapper script to preprocess the file using sed before calling texprlcount, e.g.,

#!/bin/sh

[ "$*" ] || {
    echo >&2 "usage: ${0##*/}: file.tex"
    exit 1
}

# rm temporary files on exit.
trap 'rm -rf "_$1" >/dev/null 2>&1' EXIT
trap 'exit 2' HUP INT QUIT TERM

sed '/^[ \t]*%TC:ignore/,/^[ \t]*%TC:endignore/d' "$1" >"_$1"
exec .../path/to/texprlcount.pl "_$1"

manu-mannattil avatar May 06 '22 14:05 manu-mannattil