diff options
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2021-01-12 16:15:47 +0000
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2021-01-12 16:17:18 +0000
commitecbaadcc88ae38adb34e08755459318372ec13b8 (patch)
parentcbe30304c50c659b088a698c148b86a24da6b7d6 (diff)
Default LaTeX preamble: some packages moved to preamble-project.tex
Until now, important LaTeX packages like 'caption' (for managing figure captions), 'hyperref' (for managing links) and 'xcolor' (for managing colors) were being loaded inside the optional 'tex/src/preamble-maneagge-defualt-style.tex' file. We recommend to remove this file from loading when you use custom journal sytels. However, these packages will often be necessary after loading special journal styles also. With this commit, these packages are now loaded into LaTeX as part of the 'tex/src/preamble-project.tex' file. This file is in charge of LaTeX settings that are custom to the project and independent of its style. Several other small corrections are made with this commit: - I noticed that './project make texclean' crashes if no PDF exists in the working directory! So a '-f' was added to the 'rm' command of the 'texclean' rule. - As part of the LaTeX Hyperref, we can set general metadata or properties for the PDF (that aren't written into the printable PDF, but into the file metadata). They can be viewed in many PDF viewers as PDF properties. Until now, we were only using the '\projecttitle' macro here to write the paper's title. However, thanks to the recently added 'reproduce/analysis/config/metadata.conf', we now have a lot of useful information that can also go here. So the 'metadata-copyright-owner' is now used to define the PDF author, and the project's 'metadata-git-repository' and commit hash are written into the PDF subject. But to import these, it was necessary to define them as LaTeX macros, hence the addition of these macros in 'initialize.mk'. - Some extra packages that aren't necessary to build the default PDF were removed in 'preamble-project.tex'.
3 files changed, 42 insertions, 70 deletions
diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk
index 81943db..886c0a7 100644
--- a/reproduce/analysis/make/initialize.mk
+++ b/reproduce/analysis/make/initialize.mk
@@ -237,7 +237,7 @@ clean-mmap:; rm -f reproduce/config/gnuastro/mmap*
# ------------------------------------------
- rm *.pdf
+ rm -f *.pdf
rm -rf $(texdir)/build/*
mkdir $(texdir)/build/tikz # 'tikz' is assumed to already exist.
@@ -505,6 +505,8 @@ $(mtexdir)/initialize.tex: | $(mtexdir)
echo "\newcommand{\projectdate}{$$d}" > $@
echo "\newcommand{\projecttitle}{$(metadata-title)}" >> $@
echo "\newcommand{\projectversion}{$(project-commit-hash)}" >> $@
+ echo "\newcommand{\projectgitrepo}{$(metadata-git-repository)}" >> $@
+ echo "\newcommand{\projectcopyrightowner}{$(metadata-copyright-owner)}" >> $@
# Calculate the latest Maneage commit used to build this
# project:
diff --git a/tex/src/preamble-maneage-default-style.tex b/tex/src/preamble-maneage-default-style.tex
index 4e294a5..0f1c84a 100644
--- a/tex/src/preamble-maneage-default-style.tex
+++ b/tex/src/preamble-maneage-default-style.tex
@@ -64,37 +64,6 @@
-%% Color related settings:
-\color{black} % Text color
-% figure and figure* ordering correction:
-%% For editing the caption appearence. The `setspace' package defines
-%% the `stretch' variable. `abovecaptionskip' is the distance between
-%% the figure and the caption.
-\usepackage{setspace, caption}
-\captionsetup{font=footnotesize, labelfont={color=DarkBlue,bf}, skip=1pt}
-\captionsetup[figure]{font={stretch=1, small}}
-\setlength{\abovecaptionskip}{3pt plus 1pt minus 1pt}
%% To make the footnotes align:
@@ -110,20 +79,6 @@
-%To make links to webpages and include document information in the
-%properties of the PDF
- colorlinks,
- urlcolor=blue,
- citecolor=blue,
- linkcolor=blue,
- linktocpage]{hyperref}
%% Define the abstract environment
@@ -199,15 +154,6 @@
{ }
-% Basic Document information that goes into the PDF meta-data.
- pdfauthor={YOUR NAME},
- pdfsubject={\projecttitle},
- pdftitle={\projecttitle},
- pdfkeywords={SOME, KEYWORDS, FOR, THE, PDF}
%% Title and author information
diff --git a/tex/src/preamble-project.tex b/tex/src/preamble-project.tex
index 2a3dd0e..98e797d 100644
--- a/tex/src/preamble-project.tex
+++ b/tex/src/preamble-project.tex
@@ -24,27 +24,51 @@
-%% Packages you need in your project
-%% ---------------------------------
+%% Packages you may need in your project
+%% -------------------------------------
%% Here you can add/remove any custom LaTeX package that you need for this
%% project that aren't provided by the journal's style.
-% Better than verbatim for displaying typed text.
-% For arithmetic opertions within LaTeX
-%To add a code font to the text:
-%To add some enumerating styles
-%Including images if necessary
+%% For loading images into the output (with '\includegraphics').
+%% Ordering correction between 'figure' and 'figure*' ('figure*' is
+%% commonly used in two-column documents, where the figure should span both
+%% columns).
+%% Color management.
+\color{black} % Color of main text.
+%% Caption management: The `setspace' package defines the `stretch'
+%% variable. `abovecaptionskip' is the distance between the figure and the
+%% caption. You can use 'captionof{figure}{...}' to use these custom
+%% 'figure' caption that is defined here.
+\usepackage{setspace, caption}
+\captionsetup{font=footnotesize, labelfont={color=DarkBlue,bf}, skip=1pt}
+\captionsetup[figure]{font={stretch=1, small}}
+\setlength{\abovecaptionskip}{3pt plus 1pt minus 1pt}
+%% Manage links in the produced paper (for example their colors), and
+%% include document information in the "Properties" of the PDF.
+ colorlinks,
+ urlcolor=blue,
+ citecolor=blue,
+ linkcolor=blue,
+ linktocpage]{hyperref}
+ pdftitle={\projecttitle},
+ pdfauthor={\projectcopyrightowner},
+ pdfsubject={\projectgitrepo{} (commit \projectversion)},
+ pdfkeywords={Reproducible research, Maneage, ADD YOUR OWN}