aboutsummaryrefslogtreecommitdiff
path: root/reproduce
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2023-09-24 22:20:46 +0200
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2023-09-24 22:20:46 +0200
commit2db584a6a42c93ab4f99dfc0d05c11e94171b8b4 (patch)
tree3b744e2094886af9c914f8e3541e8faa1e9b2aab /reproduce
parent8161194d68665648b93389adb333e741ba230497 (diff)
Maneage'd AASTeX for American Astronomical Society journals
Until now, the core Maneage branch was very generic and customizing for each separate journal required some time to prepare the LaTeX style. With this commit, a first attempt at customization of Maneage for the LaTeX styles of the AAS journals (AASTeX) has been implemented.
Diffstat (limited to 'reproduce')
-rw-r--r--reproduce/analysis/config/delete-me-squared-num.conf9
-rw-r--r--reproduce/analysis/config/verify-outputs.conf2
-rw-r--r--reproduce/analysis/make/delete-me.mk60
-rw-r--r--reproduce/analysis/make/initialize.mk76
-rw-r--r--reproduce/analysis/make/paper.mk13
-rw-r--r--reproduce/software/config/texlive-packages.conf15
6 files changed, 65 insertions, 110 deletions
diff --git a/reproduce/analysis/config/delete-me-squared-num.conf b/reproduce/analysis/config/delete-me-squared-num.conf
deleted file mode 100644
index c2fa79c..0000000
--- a/reproduce/analysis/config/delete-me-squared-num.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-# Number of samples in the demonstration analysis (to be deleted).
-#
-# Copyright (C) 2019-2023 Mohammad Akhlaghi <mohammad@akhlaghi.org>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice and
-# this notice are preserved. This file is offered as-is, without any
-# warranty.
-delete-me-squared-num = 50
diff --git a/reproduce/analysis/config/verify-outputs.conf b/reproduce/analysis/config/verify-outputs.conf
index db7751d..449f8a8 100644
--- a/reproduce/analysis/config/verify-outputs.conf
+++ b/reproduce/analysis/config/verify-outputs.conf
@@ -6,4 +6,4 @@
# permitted in any medium without royalty provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any
# warranty.
-verify-outputs = yes
+verify-outputs = no
diff --git a/reproduce/analysis/make/delete-me.mk b/reproduce/analysis/make/delete-me.mk
index 325280d..6db0bf9 100644
--- a/reproduce/analysis/make/delete-me.mk
+++ b/reproduce/analysis/make/delete-me.mk
@@ -19,48 +19,6 @@
-# Dummy dataset
-# -------------
-#
-# Just as a demonstration(!): we will use AWK to generate a table showing X
-# and X^2 and draw its plot.
-#
-# Note that this dataset is directly read by LaTeX to generate a plot, so
-# we need to put it in the $(tex-publish-dir) directory.
-dm-squared = $(tex-publish-dir)/squared.txt
-$(dm-squared): $(pconfdir)/delete-me-squared-num.conf | $(tex-publish-dir)
-
-# When the plotted values are re-made, it is necessary to also delete
-# the TiKZ externalized files so the plot is also re-made by
-# PGFPlots.
- rm -f $(tikzdir)/delete-me-squared.pdf
-
-# Write the column metadata in a temporary file name (appending
-# '.tmp' to the actual target name). Once all steps are done, it is
-# renamed to the final target. We do this because if there is an
-# error in the middle, Make will not consider the job to be complete
-# and will stop here.
- echo "# Data for demonstration plot of default Maneage (MANaging data linEAGE)." > $@.tmp
- echo "# It is a simple plot, showing the power of two: y=x^2! " >> $@.tmp
- echo "# " >> $@.tmp
- echo "# Column 1: X [arbitrary, f32] The horizontal axis numbers." \
- >> $@.tmp
- echo "# Column 2: X_POW2 [arbitrary, f32] The horizontal axis to the power of two." \
- >> $@.tmp
- echo "# " >> $@.tmp
- $(call print-general-metadata, $@.tmp)
-
-# Generate the table of random values.
- awk 'BEGIN {for(i=1;i<=$(delete-me-squared-num);i+=0.5) \
- printf("%-8.1f%.2f\n", i, i*i); }' >> $@.tmp
-
-# Write it into the final target
- mv $@.tmp $@
-
-
-
-
-
# Demo image PDF
# --------------
#
@@ -140,28 +98,12 @@ $(dm-img-stats): $(dm-histdir)/%-stats.txt: $(indir)/%.fits \
#
# NOTE: In LaTeX you cannot use any non-alphabetic character in a variable
# name.
-$(mtexdir)/delete-me.tex: $(dm-squared) $(dm-img-pdf) $(dm-img-histogram) \
+$(mtexdir)/delete-me.tex: $(dm-img-pdf) $(dm-img-histogram) \
$(dm-img-stats)
# Write the number of random values used.
echo "\newcommand{\deletemenum}{$(delete-me-squared-num)}" > $@
-# Note that since Make variables start with a '$(', if you want to
-# use '$' within the shell (not Make), you have to quote any
-# occurance of '$' with another '$'. That is why there are '$$' in
-# the AWK command below.
-#
-# Here, we are first using AWK to find the minimum and maximum
-# values, then using it again to read each separately to use in the
-# macro definition.
- mm=$$(awk 'BEGIN{min=99999; max=-min}
- !/^#/{if($$2>max) max=$$2; if($$2<min) min=$$2;}
- END{print min, max}' $(dm-squared));
- v=$$(echo "$$mm" | awk '{printf "%.3f", $$1}');
- echo "\newcommand{\deletememin}{$$v}" >> $@
- v=$$(echo "$$mm" | awk '{printf "%.3f", $$2}');
- echo "\newcommand{\deletememax}{$$v}" >> $@
-
# Write the statistics of the demo image as a macro.
mean=$$(awk '{printf("%.2f", $$1)}' $(dm-img-stats))
echo "\newcommand{\deletemewfpctwomean}{$$mean}" >> $@
diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk
index 9e8db4a..bce828a 100644
--- a/reproduce/analysis/make/initialize.mk
+++ b/reproduce/analysis/make/initialize.mk
@@ -49,7 +49,9 @@ installdir = $(bsdir)/installed
bashdir = reproduce/analysis/bash
pconfdir = reproduce/analysis/config
-
+# Project-specific directories.
+figdir = $(texdir)/figures
+$(figdir):; mkdir $@
@@ -248,7 +250,8 @@ project-package-contents = $(texdir)/$(project-package-name)
# the project version which may change between two separate runs, even when
# no file actually differs.
.PHONY: all clean dist dist-zip dist-lzip texclean distclean \
- $(project-package-contents) $(mtexdir)/initialize.tex
+ $(project-package-contents) $(mtexdir)/initialize.tex \
+ dist-singledir-onlypaper
texclean:
rm -f *.pdf
@@ -313,7 +316,8 @@ $(project-package-contents): paper.pdf | $(texdir)
printf "\tpdflatex -shell-escape -halt-on-error paper\n" >> $$m
echo "paper.bbl: tex/src/references.tex" >> $$m
printf "\tpdflatex -shell-escape -halt-on-error paper\n" >> $$m
- printf "\tbiber paper\n" >> $$m
+ printf "\tbibtex paper\n" >> $$m
+ printf "\tpdflatex -shell-escape -halt-on-error paper\n" >> $$m
echo ".PHONY: clean" >> $$m
echo "clean:" >> $$m
printf "\trm -f *.aux *.auxlock *.bbl *.bcf\n" >> $$m
@@ -367,21 +371,9 @@ $(project-package-contents): paper.pdf | $(texdir)
cp tex/tikz/*.pdf $$dir/tex/tikz
fi
-# When submitting to places like arXiv, they will just run LaTeX once
-# and won't run 'biber'. So we need to also keep the '.bbl' file into
-# the distributing tarball. However, BibLaTeX is particularly
-# sensitive to versioning (a '.bbl' file has to be read by the same
-# BibLaTeX version that created it). This is hard to do with
-# non-up-to-date places like arXiv. Therefore, we thus just copy the
-# whole of BibLaTeX's source (the version we are using) into the top
-# tarball directory. In this way, arXiv's LaTeX engine will use the
-# same BibLaTeX version to interpret the '.bbl' file. TIP: you can
-# use the same strategy for other LaTeX packages that may cause
-# problems on the arXiv server.
+# The 'bbl' file is produced by BibTeX; and having it allows the user
+# of the tarball to not have to re-create the bibliography.
cp tex/build/build/paper.bbl $$dir/
- tltopdir=.local/texlive/maneage/texmf-dist/tex/latex
- find $$tltopdir/biblatex/ -maxdepth 1 -type f -print0 \
- | xargs -0 cp -t $$dir
# Just in case the package users want to rebuild some of the figures
# (manually un-comment the 'makepdf' command we commented above),
@@ -393,7 +385,7 @@ $(project-package-contents): paper.pdf | $(texdir)
# PROJECT SPECIFIC
# ----------------
# Put any project-specific distribution steps here.
-
+ cp tex/src/aasjournal.bst tex/src/aastex631.cls $$dir/
# ----------------
# Clean temporary files that may have been created by text editors.
@@ -437,6 +429,42 @@ dist-software:
cd $(curdir)
mv $(bsdir)/$$dirname.tar.gz ./
+# Build a distribution directory with all the files in a single directory.
+dist-singledir-onlypaper:
+
+# Set the output directory and if it exists delete it (so we can
+# start with a clean directory).
+ outdir=$(badir)/dist-single-directory
+ if [ -d $$outdir ]; then rm -r $$outdir; fi
+ mkdir $$outdir
+
+# Copy all the necessary files into the output directory.
+ cp paper.tex \
+ tex/tikz/*.pdf \
+ tex/src/aastex631.cls \
+ tex/build/build/paper.bbl \
+ tex/build/macros/project.tex \
+ tex/src/preamble-maneage.tex \
+ tex/src/preamble-project.tex \
+ tex/src/preamble-pgfplots.tex \
+ $$outdir/
+
+# Copy all the macros from 'project.tex' into the output directory.
+ macros=$$(sed -e's|\\input{||' -e's|}||' \
+ tex/build/macros/project.tex)
+ for m in $$macros; do cp $$m $$outdir/; done
+
+# Correct the contents of the files.
+ sed -i -e's|\\newcommand{\\makepdf}{}|%\\newcommand{\\makepdf}{}|' \
+ -e's|tex/src/preamble-maneage.tex|preamble-maneage.tex|' \
+ -e's|tex/src/preamble-project.tex|preamble-project.tex|' \
+ -e's|tex/build/macros/project.tex|project.tex|' \
+ $$outdir/paper.tex
+ sed -i -e's|tex/src/preamble-pgfplots.tex|preamble-pgfplots.tex|' \
+ $$outdir/preamble-project.tex
+ sed -i -e's|tex/build/macros/||' $$outdir/project.tex
+ sed -i -e's|tex/tikz/||' $$outdir/preamble-pgfplots.tex
+
@@ -685,6 +713,10 @@ $(mtexdir)/initialize.tex: | $(mtexdir)
echo "\newcommand{\projectgitrepo}{$(metadata-git-repository)}" >> $@
echo "\newcommand{\projectcopyrightowner}{$(metadata-copyright-owner)}" >> $@
+# Gnuastro's version
+ v=$$(asttable --version | awk 'NR==1{print $$NF}')
+ echo "\newcommand{\gnuastroversion}{$$v}" >> $@
+
# Calculate the latest Maneage commit used to build this project:
# - The project may not have the 'maneage' branch (for example
# after cloning from a fork that didn't include it!). In this
@@ -714,11 +746,3 @@ $(mtexdir)/initialize.tex: | $(mtexdir)
fi
echo "\newcommand{\maneagedate}{$$d}" >> $@
echo "\newcommand{\maneageversion}{$$v}" >> $@
-
-# ----------------- delete the lines below this -------------------
-# These lines are only intended for the default template's output, to
-# demonstrate that is it important to put links in the PDF (for
-# showing where your input data came from). Remove these lines as
-# part of the initial customization of Maneage for your project.
- echo "\\newcommand{\\wfpctwourl}{$(INPUT-wfpc2.fits-url)}" >> $@
-# ----------------- delete the lines above this -------------------
diff --git a/reproduce/analysis/make/paper.mk b/reproduce/analysis/make/paper.mk
index 791108b..d770d8c 100644
--- a/reproduce/analysis/make/paper.mk
+++ b/reproduce/analysis/make/paper.mk
@@ -122,6 +122,15 @@ $(texbdir)/paper.bbl: tex/src/references.tex $(mtexdir)/dependencies-bib.tex \
# will be built anyway once this rule is done.
rm -f $@
+# Link the AASTeX LaTex and bibliography style here.
+ ln -sf $$p/tex/src/aastex631.cls ./
+ ln -sf $$p/tex/src/aasjournal.bst ./
+
+# Fill the 'references.bib' (in Maneage, the software dependencies
+# are in 'tex/build/macros/dependencies-bib.tex'
+ cat $$p/tex/src/references.tex \
+ $$p/tex/build/macros/dependencies-bib.tex > references.bib
+
# The pdflatex option '-shell-escape' is "normally disallowed for
# security reasons" according to the 'info pdflatex' manual, but is
# enabled here in order to allow the use of PGFPlots. If you do not
@@ -129,8 +138,8 @@ $(texbdir)/paper.bbl: tex/src/references.tex $(mtexdir)/dependencies-bib.tex \
# for better security. See https://savannah.nongnu.org/task/?15694
# for details.
pdflatex -shell-escape -halt-on-error "$$p"/paper.tex
- biber paper
-
+ bibtex paper
+ pdflatex -shell-escape -halt-on-error "$$p"/paper.tex
fi
diff --git a/reproduce/software/config/texlive-packages.conf b/reproduce/software/config/texlive-packages.conf
index 250a4e6..4e80bcb 100644
--- a/reproduce/software/config/texlive-packages.conf
+++ b/reproduce/software/config/texlive-packages.conf
@@ -11,16 +11,5 @@
# this notice are preserved. This file is offered as-is, without any
# warranty.
-
-# Note on 'tex' and 'fancyhdr': These two packages are installed along with
-# the basic installation scheme that we used to install tlmgr, they will be
-# ignored in the 'tlmgr install' command, but will be used later when we
-# want their versions.
-#
-# fancyvrb: Needed by R.
-texlive-packages = tex fancyhdr ec newtx fontaxes xkeyval etoolbox xstring \
- xcolor setspace caption footmisc datetime fmtcount \
- titlesec preprint ulem biblatex biber logreq pgf pgfplots \
- fp courier tex-gyre txfonts times csquotes kastrup \
- trimspaces pdftexcmds pdfescape letltxmacro bitset \
- mweights fancyvrb
+texlive-packages = tex pgf pgfplots revtex4-1 textcase helvetic lineno \
+ courier epsf etoolbox ulem times