Skip to content

In order to submit LaTeX preprint papers to arXiv you need to submit the sources. This python code reads the dependencies of you LaTeX code and copies only the necessary files into a new folder. Furthermore, comments in your tex sources will be deleted.

Notifications You must be signed in to change notification settings

ChrGri/Latex2Arxiv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Latex2Arxiv

Submitting preprints to arXiv requires submission of the LaTeX sources. This python code will create a copy of your existing document containing only the necessary depenedencies to build the project. Furthermore, comments in the latex sources will be deleted in the copy.

Prerequisites in the latex main document

In order to read the dependencies, you need to add the Snapshot package to you latex main document.

\RequirePackage{snapshot}

After compiling your latex document a new *.dep file should have been created listing all the dependencies.

Prerequisites in the latex main document

In the main.py document you need to parametrize

  • the source directory
  • the destination directory
  • the name of the main latex document.
root = 'C:/Data/SOURCE_DIRECTORY'
destFolder = root + '_reduced'
texFileName = 'bare_jrnl.tex'
depFileName = root + '/' + texFileName[:-4] + '.dep'

Additional operation

Python code to reduce file size of all images in the destination directory has been added to the main.py file. This file compression has been deactivated by default and must be activated by removing the line comments:

# find all image files in directory and subdirectories
types = ('*.png', '*.jpg')
imageFiles = []
for files in types:
    imageFiles = [f for f in glob.glob(destFolder + "/**/" + files, recursive=True)]
    for f in imageFiles:
        #b = f.objects.get(title='Into the wild')
        image = Image.open(f)
        image.save(f,quality=10,optimize=True)

PDF compression

When you are only intrested in PDF file compression, have a look at "pdf_compressor_ghostscript.py". You'll have to install some packages like pdf2image. And adapt the in and out files:

f = "C:\Data\Paper_in.pdf"
f_out_1 = "C:\Data\Paper_in.pdf"

About

In order to submit LaTeX preprint papers to arXiv you need to submit the sources. This python code reads the dependencies of you LaTeX code and copies only the necessary files into a new folder. Furthermore, comments in your tex sources will be deleted.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages