Skip to content

Commit 5e37db9

Browse files
First attempt at arxiv posting
1 parent 3d3c7d9 commit 5e37db9

1 file changed

Lines changed: 138 additions & 0 deletions

File tree

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#!/bin/tcsh
2+
#=======================================================================
3+
#+
4+
# NAME:
5+
# gen_arxiv_submission
6+
#
7+
# PURPOSE:
8+
# Make a gzipped tarball that can be accepted by the arxiv
9+
#
10+
# COMMENTS:
11+
# Takes the current whitepaper directory, including thisversin.tex,
12+
# and prepares a folder of source files, reducing figure sizes where
13+
# needed, and checks that it compiles with pdflatex.
14+
#
15+
# INPUTS:
16+
# None
17+
#
18+
# OPTIONAL INPUTS:
19+
# -h --help Print this header
20+
# --clobber Overwrite submission folder
21+
#
22+
# OUTPUTS:
23+
# arxiv/lsst-obs-str-vX.X.tar.gz
24+
#
25+
# EXAMPLES:
26+
#
27+
# BUGS:
28+
#
29+
#-
30+
# ======================================================================
31+
32+
set help = 0
33+
set fromscratch = 0
34+
35+
while ( $#argv > 0 )
36+
switch ($argv[1])
37+
case -h:
38+
shift argv
39+
set help = 1
40+
breaksw
41+
case --{help}:
42+
shift argv
43+
set help = 1
44+
breaksw
45+
case --{clobber}:
46+
shift argv
47+
set fromscratch = 1
48+
breaksw
49+
endsw
50+
end
51+
52+
if ($help) then
53+
more $0
54+
goto FINISH
55+
endif
56+
57+
# Get the version number out of thisversion.tex (which was made last
58+
# time the paper was built)
59+
60+
if ( ! -e thisversion.tex ) then
61+
make
62+
endif
63+
64+
set Num = `cat thisversion.tex | grep Version | cut -d'}' -f1 | cut -d'n' -f2`
65+
set folder = arxiv/lsst-obs-str-v${Num}
66+
67+
# Make a folder if one doesn't exist (or clobber what's there):
68+
69+
if ( $fromscratch ) then
70+
rm -f $folder/*.* $folder/*/*.*
71+
rmdir $folder/*
72+
rmdir $folder
73+
endif
74+
75+
mkdir -p $folder
76+
77+
echo "Copying source files to ${folder}:"
78+
79+
# Get tex files from log:
80+
set texfiles = `grep '\.tex' LSST_Observing_Strategy_White_Paper.log | cut -d'(' -f2- | sed s/')'//g | sed s/'('//g`
81+
set texfiles = `ls $texfiles |& grep -v 'No such file' | sort | uniq`
82+
foreach texfile ( $texfiles )
83+
set texfolder = $folder/$texfile:h
84+
mkdir -p $texfolder
85+
cp -v $texfile $texfolder
86+
end
87+
88+
# Do style files etc by hand
89+
cp -v LSST_Observing_Strategy_White_Paper.sty $folder/.
90+
cp -v LSST_Observing_Strategy_White_Paper.bbl $folder/.
91+
cp -v deluxetable.sty $folder/.
92+
cp -v yahapj.bst $folder/.
93+
94+
# Get figures from log:
95+
set fignames = `grep 'File:' LSST_Observing_Strategy_White_Paper.log | grep figs | cut -d' ' -f2`
96+
set figfiles = ()
97+
foreach figname ( $fignames )
98+
set thesefigfiles = `ls -1 ${figname}*`
99+
if ( $#thesefigfiles > 1 ) echo "Warning: copying multiple files $thesefigfiles"
100+
set figfiles = ( $figfiles $thesefigfiles )
101+
end
102+
foreach figfile ( $figfiles )
103+
set figfolder = $folder/$figfile:h
104+
mkdir -p $figfolder
105+
cp -v $figfile $figfolder
106+
end
107+
108+
# Compile paper, to check:
109+
mv $folder/LSST_Observing_Strategy_White_Paper.tex $folder/ms.tex
110+
cd $folder
111+
pdflatex ms.tex
112+
pdflatex ms.tex
113+
cd -
114+
115+
echo ""
116+
echo "Successfully compiled paper:"
117+
du -h $folder/ms.pdf
118+
119+
# Clean up before archiving:
120+
set types = ( out ent pdf log tod toc )
121+
foreach ext ( $types )
122+
rm -vf $folder/ms.*$ext
123+
end
124+
\rm rm -vf $folder/*.aux
125+
126+
# Now make tarball
127+
cd $folder:h
128+
tar cvfz ${folder:t}.tar.gz $folder:t
129+
set tarball = $folder:h/${folder:t}.tar.gz
130+
cd -
131+
132+
echo ""
133+
echo "Successfully made tarball:"
134+
du -h $tarball
135+
136+
# ======================================================================
137+
FINISH:
138+
# ======================================================================

0 commit comments

Comments
 (0)