IACR / latex-submit

Web server to receive uploaded LaTeX and execute it in a docker container.
GNU Affero General Public License v3.0
11 stars 0 forks source link

The use of page numbers #27

Closed kmccurley closed 2 months ago

kmccurley commented 1 year ago

As mentioned in a separate issue for the iacrcc style, page numbers for a bibliographic record of a paper will always be of the form 1-x. The value of x needs to be extracted from the compiled PDF, and we don't currently extract this into the metadata. I intend to add this as part of the compilation of the final version, probably using some code to parse the PDF and extract the number of pages.

There are several ways to do this from python:

  1. use pdfplumber. There is code that uses this in the tests for iacrcc.
  2. use the pypdf library (there are several versions including this.
  3. execute a shell to run pdfinfo.
jwbos commented 1 year ago

Why do we need this from Python? Why not use the lastpage package to get the total page number? (see: https://mirror.koddos.net/CTAN/macros/latex/contrib/lastpage/lastpage.pdf)

kmccurley commented 1 year ago

Apparently we load the totpages package, which is incompatible with lastpage. The hyperxmp package used to load totpages, but that no longer seems to be true, although the hyperxmp documentation refers to totpages as a way to generate \pdfpagerange automatically.

One way to solve this is to do it the way the authorarchive package does it:

\@ifpackageloaded{totpages}{%                                                                        
  \def\IACR@lastpage{TotPages}                                                                         
}{%                                                                                                  
  \RequirePackage{lastpage}                                                                          
  \def\IACR@lastpage{LastPage}                                                                         
}

Then we could write \IACR@lastpage to the meta file.

jwbos commented 1 year ago

Yes, this makes perfect sense.