This worked for me today, June 2022.
Apparently, arxiv is smart enough to detect when you are importing the entire PDF using pdfpages
as in here https://tex.stackexchange.com/a/186206/272006. However, you are free to import ypur PDF file, page by page, using graphicx
and its \includegraphics
command. I would speculate that this approach would be harder for arxiv to guard against for a few reasons:
- correct LaTeX source is being uploaded, and detecting issues in it is not as easy as looking for TeX macros in PDF
\includegraphics
is a legitimate command, used by almost any submission, so flagging the submission for just using it is impractical
- even if arxiv detects the for-loop (which is also a legitimate command), one is free to simply regenerate
include
statements and even obfuscate them
The code is below and here is its explanation and advantages:
- I tested it myself (for a 173 pages thesis), arxiv has accepted the submission and PDF looks correct
- it preserves internal and external PDF links if you use PAX
- it generates a generic PDF document from the file you supply for any number of pages
- it does not produce any extra blank pages
- it produces the .blg file that arxiv uses for better biblipgraphy processing
To preserve links, follow the PAX approach (arxiv works correctly with it, and why wouldn't it, pax file is simply a map that is read by the pax
package). Install PAX using their instructions, or use one in my (large) docker image (the perl script is in the root). At the end of installation you should have pdfannotextractor.pl
script, and you should be able to generate the .pax file with pdfannotextractor.pl path/to/file.pdf
, the file will be at path/to/file.pax
. If the .pax is in the same directory and the same name as the PDF, pax
package will pick it up, and links will magically work.
To generate .blg file, it is enough to load biblatex
, load you .bib file and use \nocite{*}
command.
Also, because we place an image to fit the page entirely, LaTeX reasonably assumes that the image does not fit and places it on the next page, resulting in an extra first blank page. \vspace*{-4ex}
hack seems to fix it without a negative effect on the included image.
Finally, I do support the arxiv idea of generating PDF from source, although, possibly not as such a strict requirement. In my case the thesis document was so complex and it relied on newer TeX distribution, that I simply couldn't compile it using arxiv engine. Please, use this hack wisely.
% cSpell:disable
\documentclass[letter]{report}
\usepackage{graphicx}
\usepackage{pgffor}
\usepackage[margin=0in]{geometry} % remove all margins
\usepackage{pax} % process .pax file to bring back internal links
\newcounter{pdfpages}
\newcommand*{\getpdfpages}[1]{%
\begingroup
\sbox0{%
\includegraphics{#1}%%
\setcounter{pdfpages}{\pdflastximagepages}%
}%
\endgroup
}
\usepackage[hidelinks]{hyperref} % remove ugly link borders
% Add metadata to resulting file.
\hypersetup{
pdfauthor = {Dmytro Bogatov <[email protected]>},
pdftitle = {Secure and Efficient Query Processing in Outsourced Databases},
pdfsubject = {Doctoral Dissertation},
pdfkeywords = {OPE, ORE, Range Query Protocols, Epsolute, kNN},
pdfcreator = {LaTeX with hyperref package},
pdfproducer = {dvips + ps2pdf}
}
% Adapt to your case.
\usepackage[
backend=biber,
style=alphabetic,
giveninits=false,
sorting=nyt,
maxbibnames=1000,
maxalphanames=4
]{biblatex}
\bibliography{bibfile}
\begin{document}
% This is to remove the first blank page. Feel free to improve.
\vspace*{-4ex}
\getpdfpages{file}
\foreach\x in {1,...,\value{pdfpages}} { % chktex 11
\begin{center}
\includegraphics[width=\paperwidth,keepaspectratio,page=\x]{file}
\end{center}
}
% This is to generate all the citations from your bib-file to *.blg.
\nocite{*}
\end{document}