aps-length icon indicating copy to clipboard operation
aps-length copied to clipboard

Trouble calculating figure word-length

Open joseraulgonzalez opened this issue 5 years ago • 17 comments

Dear James,

Thank you very much for your useful script. I am having trouble getting the script to recognize any figures and to count their word length equivalents. I have all of my figures in their own folder and I use graphicspath in my document to point LaTeX to their location. However, when running aps-length I get that the figures have a length of 0. Do you have any recommendations? Could you please help me count the length of my figures?

Best regards.

joseraulgonzalez avatar Jul 24 '19 03:07 joseraulgonzalez

The script needs to be able to find the figure files to compute their word count, and it doesn’t understand the graphicspath command. I suggest giving the relative path to the file for each figure, e.g. includegraphics{figures/figure1.eps}.

jameskermode avatar Jul 24 '19 05:07 jameskermode

Thanks for your reply! I have already tried this and I still get zero for word count of the figures.

joseraulgonzalez avatar Jul 24 '19 05:07 joseraulgonzalez

Are you using Ghostscript or ImageMagick figure option? Could you try the other one?

jameskermode avatar Jul 24 '19 05:07 jameskermode

I have tried both with the same results.

joseraulgonzalez avatar Jul 24 '19 05:07 joseraulgonzalez

What format are your figure files?

jameskermode avatar Jul 24 '19 05:07 jameskermode

EPS

joseraulgonzalez avatar Jul 24 '19 05:07 joseraulgonzalez

Can you try moving them into the same directory as the tex file, to exclude the possibility they can’t be found?

jameskermode avatar Jul 24 '19 05:07 jameskermode

Just had a quick look at the code. There’s a commented out print statement on line 430 you could put back in to check filenames that are being detected.

jameskermode avatar Jul 24 '19 06:07 jameskermode

Thanks for the suggestion. I tired it and am still getting zero.

joseraulgonzalez avatar Jul 24 '19 06:07 joseraulgonzalez

Hmmm. Odd. I did uncomment this line "print filename, tex_lines[inc_fig_line_no], tex_lines[fig_line_no]" but did not get any printout. Seems to me the program is not even entering the loop where figure are counted.

joseraulgonzalez avatar Jul 24 '19 06:07 joseraulgonzalez

Ok, I’m out of suggestions for now. If you want to debug further I’d suggest running the gs or identify commands invoked by the script yourself and checking the output matches the expected form.

jameskermode avatar Jul 24 '19 06:07 jameskermode

Maybe detex is not finding the figures, you could run that manually and look for ‘<Picture’ as the code does

jameskermode avatar Jul 24 '19 06:07 jameskermode

This might be the case. If I run detex manuscript.tex | egrep "<Picture" the output is empty.

joseraulgonzalez avatar Jul 24 '19 07:07 joseraulgonzalez

You could try the wordcount mode instead with aps-length -m wordcount (although I think this is actually the default)

jameskermode avatar Jul 24 '19 07:07 jameskermode

Still no luck.

joseraulgonzalez avatar Jul 24 '19 07:07 joseraulgonzalez

Strange, it's been working fairly reliably for me but I have to admit I haven't tried it for quite a while

jameskermode avatar Jul 24 '19 07:07 jameskermode

I think I had the same problem but then I looked into the tmp log file generated by the script and at least for me it was a revtex article class that was causing the problem. I guess I was using revtex4-2 which was not present in my texlive or something. When I switched back to revtex4-1, it worked flawlessly. Hope it helps.

P.S. Just wanted to confirm, the word count does not include references, right ?

anshu957 avatar Nov 25 '19 23:11 anshu957