From 33e00f02d4ecd28ea5084fc553d2ad182a11ca52 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Wed, 6 Feb 2019 02:45:41 +0000 Subject: Better management for .tex directories to build from tarball In order to collaborate effectively in the project, even project members that don't necessarily want (or have the capacity) to do the whole analysis must be able to contribute to the project. Until now, the users of the distributed tarball could only modify the text and not the figures (built with PGFPlots) of the paper. With this commit, the management of TeX source files in the pipeline was slightly modified to allow this as cleanly as I could think of now! In short, the hand-written TeX files are now kept in `tex/src' and for the pipeline's generated TeX files (in particular the old `tex/pipeline.tex'), we now have a `tex/pipeline' symbolic-link/directory that points to the `tex' directory under the build directory. When packaging the project, `tex/pipeline' will be a full directory with a copy of all the necessary files. Therefore as far as LaTeX is concerned, having a build-directory is no longer relevant. Many other small changes were made to do this job cleanly which will just make this commit message too long! Also, the old `tarball' and `zip' targets are now `dist' and `dist-zip' (as in the standard GNU Build system). --- tex/src/delete-me-demo.tex | 34 ++++++++++ tex/src/delete-me.tex | 17 +++++ tex/src/preamble-biblatex.tex | 116 ++++++++++++++++++++++++++++++++++ tex/src/preamble-header.tex | 86 ++++++++++++++++++++++++++ tex/src/preamble-necessary.tex | 75 ++++++++++++++++++++++ tex/src/preamble-pgfplots.tex | 107 ++++++++++++++++++++++++++++++++ tex/src/preamble-style.tex | 137 +++++++++++++++++++++++++++++++++++++++++ tex/src/references.tex | 45 ++++++++++++++ 8 files changed, 617 insertions(+) create mode 100644 tex/src/delete-me-demo.tex create mode 100644 tex/src/delete-me.tex create mode 100644 tex/src/preamble-biblatex.tex create mode 100644 tex/src/preamble-header.tex create mode 100644 tex/src/preamble-necessary.tex create mode 100644 tex/src/preamble-pgfplots.tex create mode 100644 tex/src/preamble-style.tex create mode 100644 tex/src/references.tex (limited to 'tex/src') diff --git a/tex/src/delete-me-demo.tex b/tex/src/delete-me-demo.tex new file mode 100644 index 0000000..8174bc8 --- /dev/null +++ b/tex/src/delete-me-demo.tex @@ -0,0 +1,34 @@ +\begin{tikzpicture} + + %% The displayed WFPC2 image. + \node[anchor=south west] (img) at (0,0) + {\includegraphics[width=0.5\linewidth] + {tex/pipeline/delete-me-demo/wfpc2.pdf}}; + + %% Its label + \node[anchor=south west] at (0.45\linewidth,0.45\linewidth) + {\textcolor{white}{a}}; + + %% This histogram. + \begin{axis}[at={(0.52\linewidth,0.1\linewidth)}, + no markers, + axis on top, + xmode=normal, + ymode=normal, + yticklabels={}, + scale only axis, + xlabel=Pixel value, + width=0.5\linewidth, + height=0.412\linewidth, + enlarge y limits=false, + enlarge x limits=false, + ] + \addplot [const plot mark mid, fill=red] + table [x index=0, y index=1] + {tex/pipeline/delete-me-demo/wfpc2-hist.txt} + \closedcycle; + \end{axis} + + %% The histogram's label + \node[anchor=south west] at (0.95\linewidth,0.45\linewidth) {b}; +\end{tikzpicture} diff --git a/tex/src/delete-me.tex b/tex/src/delete-me.tex new file mode 100644 index 0000000..fc1a1f9 --- /dev/null +++ b/tex/src/delete-me.tex @@ -0,0 +1,17 @@ +%% PGFPlots code to plot a random set of numbers as demo + +\begin{tikzpicture} + + %% Settings of the plotted axis + \begin{axis}[ + width=\linewidth, + xlabel=$X$, + ylabel=$X^2$, + ] + + %% A particular plot. + \addplot+[scatter, only marks] + table {tex/pipeline/delete-me/data.txt}; + + \end{axis} +\end{tikzpicture} diff --git a/tex/src/preamble-biblatex.tex b/tex/src/preamble-biblatex.tex new file mode 100644 index 0000000..bd99502 --- /dev/null +++ b/tex/src/preamble-biblatex.tex @@ -0,0 +1,116 @@ +%% Biblatex settings. +%% +%% Settings necessary to make the bibliography with Biblatex. Keeping all +%% BibLaTeX settings in a separate preamble was done in the spirit of +%% modularity to 1) easily managable, 2) If a similar BibLaTeX +%% configuration is necessary in another LaTeX compilation, this file can +%% just be copied there and used. +%% +%% USAGE: +%% - `tex/src/references.tex': the file containing Bibtex source of each +%% reference. The file suffix doesn't have to be `.bib'. This naming +%% helps in clearly identifying the files and avoiding places that +%% complain about `.bib' files. + + + + + +%% To break up highlighted text (for example texttt when some it is on the +%% line break) and also to no underline emphasized words (like journal +%% titles in the references). +\usepackage[normalem]{ulem} + + + + + +% Basic BibLaTeX settings +\usepackage[ + doi=false, + url=false, + dashed=false, + eprint=false, + maxbibnames=4, + minbibnames=1, + hyperref=true, + maxcitenames=2, + mincitenames=1, + style=authoryear, + uniquelist=false, + backend=biber,natbib]{biblatex} +\DeclareFieldFormat[article]{pages}{#1} +\DeclareFieldFormat{pages}{\mkfirstpage[{\mkpageprefix[bookpagination]}]{#1}} +\addbibresource{tex/src/references.tex} +\renewbibmacro{in:}{} +\renewcommand*{\bibfont}{\footnotesize} +\DefineBibliographyStrings{english}{references = {References}} + +%% Include the adsurl field key into those that are recognized: +\DeclareSourcemap{ + \maps[datatype=bibtex]{ + \map{ + \step[fieldsource=adsurl,fieldtarget=iswc] + \step[fieldsource=gbkurl,fieldtarget=iswc] + } + } +} + +%% Set the color of the doi link to mymg (magenta) and the ads links +%% to mypurp (or purple): +\definecolor{mypurp}{cmyk}{0.75,1,0,0} +\newcommand{\doihref}[2]{\href{#1}{\color{magenta}{#2}}} +\newcommand{\adshref}[2]{\href{#1}{\color{mypurp}{#2}}} +\newcommand{\blackhref}[2]{\href{#1}{\color{black}{#2}}} + +%% Define a format for the printtext commands in +%% DeclareBibliographyDriver to make links for the doi, ads link and +%% arxiv link: +\DeclareFieldFormat{doilink}{ + \iffieldundef{doi}{#1}{\doihref{http://dx.doi.org/\thefield{doi}}{#1}}} +\DeclareFieldFormat{adslink}{ + \iffieldundef{iswc}{#1}{\adshref{\thefield{iswc}}{#1}}} +\DeclareFieldFormat{arxivlink}{ + \iffieldundef{eprint}{#1}{\href{http://arxiv.org/abs/\thefield{eprint}}{#1}}} + +\DeclareListFormat{doiforbook}{ + \iffieldundef{doi}{#1}{\doihref{http://dx.doi.org/\thefield{doi}}{#1}}} +\DeclareFieldFormat{googlebookslink}{ + \iffieldundef{iswc}{#1}{\adshref{\thefield{iswc}}{#1}}} + +%% Set the formatting to make the last three values into the +%% appropriate link. Note that the % signs are necessary. Without +%% them, the items will be indented. +\DeclareBibliographyDriver{article}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% + \newunit% + \ifdefined\makethesis\printtext{\usebibmacro{title}}\fi% + \newunit% + \printtext[doilink]{\usebibmacro{journal}}% + \addcomma% + \printtext[adslink]{\printfield{volume}}% + \addcomma% + \printtext[arxivlink]{\printfield{pages}}% + \addperiod% +} + +\DeclareBibliographyDriver{book}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/translator+others}% + \newunit% + \printtext{\usebibmacro{title}}% + \addperiod% + \addspace% + \printlist[doiforbook]{publisher}% + \addcomma% + \addspace% + \printfield[googlebookslink]{edition}% + \printtext{ ed.}% + \addperiod% +} + +%% In order to have et al. instead of et al.,: +\renewcommand*{\nameyeardelim}{\addspace} diff --git a/tex/src/preamble-header.tex b/tex/src/preamble-header.tex new file mode 100644 index 0000000..eb83c27 --- /dev/null +++ b/tex/src/preamble-header.tex @@ -0,0 +1,86 @@ +%% The headers: title, authors, top of pages and section title formatting +%% of the final LaTeX file are configured here. + + + + + +%% General page header settings. +\usepackage{fancyhdr} +\pagestyle{fancy} +\lhead{\footnotesize{\scshape Draft paper}, {\footnotesize nnn:i (pp), Year Month day}} +\rhead{\scshape\footnotesize YOUR-NAME et al.} +\cfoot{\thepage} +\setlength{\voffset}{0.75cm} +\setlength{\headsep}{0.2cm} +\setlength{\footskip}{0.75cm} +\renewcommand{\headrulewidth}{0pt} + + + + + +%% Specific style for first page. +\fancypagestyle{firststyle} +{ + \lhead{\footnotesize{\scshape Draft paper}, nnn:i (pp), YYYY Month day\\ + \scriptsize \textcopyright YYYY, Your name. All rights reserved.} + \rhead{\footnotesize \footnotesize \today, \currenttime\\} +} + + + + + +%To set the style of the titles: +\usepackage{titlesec} +\titleformat{\section} + {\centering\normalfont\uppercase} + {\thesection.} + {0em} + { } +\titleformat{\subsection} + {\centering\normalsize\slshape} + {\thesubsection.} + {0em} + { } +\titleformat{\subsubsection} + {\centering\small\slshape} + {\thesubsubsection.} + {0em} + { } + + + + + +% Basic Document information that goes into the PDF meta-data. +\hypersetup +{ + pdfauthor={YOUR NAME}, + pdfsubject={A SHORT DESCRIPTION OF THE WORK}, + pdftitle={THE TITLE OF THIS PROJECT}, + pdfkeywords={SOME, KEYWORDS, FOR, THE, PDF} +} + + + + + +%% Title and author information +\usepackage{authblk} +\renewcommand\Authfont{\small\scshape} +\renewcommand\Affilfont{\footnotesize\normalfont} +\setlength{\affilsep}{0.2cm} + +\title{\large \uppercase{The paper's title goes here}} + +\author[1]{Your name} +\author[2]{Coauthor one} +\author[1,3]{Coauthor two} + +\affil[1]{The first affiliation in the list.; \url{your@email.address}} +\affil[2]{Another affilation can be put here.} +\affil[3]{And generally as many affiliations as you like. +\par \emph{Received YYYY MM DD; accepted YYYY MM DD; published YYYY MM DD}} +\date{} diff --git a/tex/src/preamble-necessary.tex b/tex/src/preamble-necessary.tex new file mode 100644 index 0000000..e6ac18e --- /dev/null +++ b/tex/src/preamble-necessary.tex @@ -0,0 +1,75 @@ +%% Necessary (independent of style) macros for this project. +%% +%% These are a set of packages that have been commonly necessary in most +%% LaTeX usages. However, if any are not needed in your work, please feel +%% free to remove them. + + + + + +%% Values from the analysis. +\input{tex/pipeline/macros/pipeline.tex} + + + + + +% Macros for to help in typing, remove them if you don't need them, but +% this can help as a demo on how you can simply writing of commonly used +% words that need special formatting (like software names). +\newcommand{\snsign}{{\small S}/{\small N}} +\newcommand{\originsoft}{\textsf{ORIGIN}} +\newcommand{\sextractor}{\textsf{SE\-xtractor}} +\newcommand{\noisechisel}{\textsf{Noise\-Chisel}} +\newcommand{\makecatalog}{\textsf{Make\-Catalog}} + + + + + +%% For highlighting updates. When this is set, text marked as \new +%% will be colored in dark green and text that is marked wtih \tonote +%% will be marked in dark red. +\ifdefined\highlightchanges +\newcommand{\new}[1]{\textcolor{green!60!black}{#1}} +\newcommand{\tonote}[1]{\textcolor{red!60!black}{[#1]}} +\else +\newcommand{\new}[1]{\textcolor{black}{#1}} +\newcommand{\tonote}[1]{{}} +\fi + + + + + +% Better than verbatim for displaying typed text. +\usepackage{alltt} + + + + + +% For arithmetic opertions within LaTeX +\usepackage[nomessages]{fp} + + + + + +%To add a code font to the text: +\usepackage{courier} + + + + + +%To add some enumerating styles +\usepackage{enumerate} + + + + + +%Including images if necessary +\usepackage{graphicx} diff --git a/tex/src/preamble-pgfplots.tex b/tex/src/preamble-pgfplots.tex new file mode 100644 index 0000000..4999656 --- /dev/null +++ b/tex/src/preamble-pgfplots.tex @@ -0,0 +1,107 @@ +%% PGFPlots settings +%% ----------------- +%% +%% PGFPLOTS is a package in (La)TeX for making plots internally. It fits +%% nicely with the purpose of a reproduction pipeline. But it isn't +%% mandatory. Therefore if you don't need it, just comment/delete the line +%% that includes this file in the top LaTeX source (`paper.tex'). +%% +%% However, TiKZ and PGFPlots are the recommended way to include figures +%% and plots in your paper. There are two main reasons: 1) it follows the +%% same LaTeX settings as the text of the paper, so the figures will be in +%% the exact same settings (for example font or lines) as the main body of +%% the papers. 2) It doesn't require any extra dependency (it is +%% distributed as part of TeX-live). Adding specific programs/libraries for +%% plots can greatly increase the number of dependencies for the +%% pipeline. For example Python's Matplotlib library is indeed very good, +%% but it requires Python and Numpy. The latter is not easy to build from +%% source, so after a few years, installing the required version can be +%% very frustrating. +%% +%% Keeping all BibLaTeX settings in a separate preamble was done in the +%% spirit of modularity to 1) easily managable, 2) If a similar BibLaTeX +%% configuration is necessary in another LaTeX compilation, this file can +%% just be copied there and used. +%% +%% PGFPlots uses the (La)TeX TiKZ package to build plots. So we will first +%% do the settings that are necessary in TiKZ, and then go onto the actual +%% PGFPlots package. +%% +%% USAGE: +%% +%% - All plots are made within a `tikz' directory (that must already be +%% present in the location LaTeX is run). +%% +%% - Use `\includetikz{XXXX}' to make/use the figure. If a `makepdf' LaTeX +%% macro is not defined, then \includetikz will assume a `XXXX.pdf' file +%% exists in `tex/tikz' and simply import it. If `makepdf' is defined, +%% then TiKZ/PGFPlot will be called to (possibly) build the plot based +%% on `tex/XXXX.tex'. Note that if the contents of `tex/src/XXXX.tex' +%% hasn't changed since the last build. TiKZ/PGFPlots won't rebuild the +%% plot. + + + + + +%% Very general TiKZ settings. In particular, to allow faster processing +%% (not having to re-build the plots on every run), we are using the +%% externalization feature of TiKZ. With this option, TiKZ will build every +%% figure independently in a special directory afterwards it will include +%% the built figure in the final file. This has many advantages: 1) if the +%% code for the plot hasn't changed, then the plot won't be re-made (can be +%% slow with detailed plots). 2) You can use the PDFs of the individual +%% plots for other purposes (for example to include in slides) cleanly. +\usepackage{tikz} +\usetikzlibrary{external} +\tikzexternalize +\tikzsetexternalprefix{tikz/} + + + + + +%% The following rule will cause the name of the files keeping a figure's +%% external PDF to be set based on the file that the TiKZ commands are +%% from. Without this, TiKZ will use numbers based on the order of +%% figures. These numbers can be hard to manage and they will also depend +%% on order in the final PDF, so it will be very buggy to manage them. +\newcommand{\includetikz}[1]{% + \ifdefined\makepdf% + \tikzsetnextfilename{#1}% + \input{tex/src/#1.tex}% + \else + \includegraphics[width=\linewidth]{tex/tikz/#1.pdf} + \fi +} + + + + + +%% Uncomment the following lines for EPS and PS images. Note that you still +%% have to use the `pdflatex' executable and also add a `[dvips]' option to +%% graphicx. + +%% \tikzset{external/system call={rm -f "\image".eps "\image".ps +%% "\image".dvi; latex \tikzexternalcheckshellescape -halt-on-error +%% -interaction=batchmode -jobname "\image" "\texsource"; +%% dvips -o "\image".ps "\image".dvi; +%% ps2eps "\image.ps"}} + + + + + +%% Inport and configure PGFPlots. +\usepackage{pgfplots} +\pgfplotsset{compat=newest} +\usepgfplotslibrary{groupplots} +\pgfplotsset{ + axis line style={thick}, + tick style={semithick}, + tick label style = {font=\footnotesize}, + every axis label = {font=\footnotesize}, + legend style = {font=\footnotesize}, + label style = {font=\footnotesize} + } diff --git a/tex/src/preamble-style.tex b/tex/src/preamble-style.tex new file mode 100644 index 0000000..fb08df7 --- /dev/null +++ b/tex/src/preamble-style.tex @@ -0,0 +1,137 @@ +%% General paper's style settings. +%% +%% This preamble can be completely ignored when including this TeX file in +%% another style. This is done because this LaTeX build is meant to be an +%% initial/internal phase or part of a larger effort, so it has a basic +%% style defined here as a preamble. To ignore it, uncomment or delete the +%% respective line in `paper.tex'. + + + + + +%% Font. +\usepackage[T1]{fontenc} +\usepackage{newtxtext} +\usepackage{newtxmath} + + + + + +%% Print size +\usepackage[a4paper, includeheadfoot, body={18.7cm, 24.5cm}]{geometry} + + + + + +%% Set the distance between the columns if two columns: +\setlength{\columnsep}{0.75cm} + + + + + +% To allow figures to take up more space on the top of the page: +\renewcommand{\topfraction}{.99} +\renewcommand{\bottomfraction}{.7} +\renewcommand{\textfraction}{.05} +\renewcommand{\floatpagefraction}{.99} +\renewcommand{\dbltopfraction}{.99} +\renewcommand{\dblfloatpagefraction}{.99} +\setcounter{topnumber}{1} +\setcounter{bottomnumber}{0} +\setcounter{totalnumber}{2} +\setcounter{dbltopnumber}{1} + + + + + +%% Color related settings: +\usepackage{xcolor} +\color{black} % Text color +\definecolor{DarkBlue}{RGB}{0,0,90} + + + + + + +% figure and figure* ordering correction: +\usepackage{fixltx2e} + + + + + +%% 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} +\setlength{\belowcaptionskip}{-1.25em} + + + + + + +%% To make the footnotes align: +\usepackage[hang]{footmisc} +\setlength\footnotemargin{10pt} + + + + + +%For including time in the title: +\usepackage{datetime} + + + + + +%To make links to webpages and include document information in the +%properties of the PDF +\usepackage[ + colorlinks, + urlcolor=blue, + citecolor=blue, + linkcolor=blue, + linktocpage]{hyperref} +\renewcommand\UrlFont{\rmfamily} + + + + + +%% Define the abstract environment +\renewenvironment{abstract} + {\vspace{-0.5cm}\small% + \list{}{% + \setlength{\leftmargin}{2cm}% + \setlength{\rightmargin}{\leftmargin}% + }% + \item\relax} + {\endlist} + + + + + +%% To keep the main page's code clean. +\newcommand{\includeabstract}[1]{% +\twocolumn[% + \begin{@twocolumnfalse}% + \maketitle% + \begin{abstract}% + #1% + \end{abstract}% + \vspace{1cm}% + \end{@twocolumnfalse}% + ]% +} diff --git a/tex/src/references.tex b/tex/src/references.tex new file mode 100644 index 0000000..b3998a2 --- /dev/null +++ b/tex/src/references.tex @@ -0,0 +1,45 @@ +@ARTICLE{bacon17, + author = {{Bacon}, R. and {Conseil}, S. and {Mary}, D. and {Brinchmann}, J. and + {Shepherd}, M. and {Akhlaghi}, M. and {Weilbacher}, P.~M. and + {Piqueras}, L. and {Wisotzki}, L. and {Lagattuta}, D. and {Epinat}, B. and + {Guerou}, A. and {Inami}, H. and {Cantalupo}, S. and {Courbot}, J.~B. and + {Contini}, T. and {Richard}, J. and {Maseda}, M. and {Bouwens}, R. and + {Bouch{\'e}}, N. and {Kollatschny}, W. and {Schaye}, J. and + {Marino}, R.~A. and {Pello}, R. and {Herenz}, C. and {Guiderdoni}, B. and + {Carollo}, M.}, + title = "{The MUSE Hubble Ultra Deep Field Survey. I. Survey description, data reduction, and source detection}", + journal = {A\&A}, +archivePrefix = "arXiv", + eprint = {1710.03002}, + keywords = {galaxies: distances and redshifts, galaxies: high-redshift, cosmology: observations, methods: data analysis, techniques: imaging spectroscopy, galaxies: formation}, + year = 2017, + month = nov, + volume = 608, + eid = {A1}, + pages = {A1}, + doi = {10.1051/0004-6361/201730833}, + adsurl = {http://adsabs.harvard.edu/abs/2017A\%26A...608A...1B}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} + + + + + +@ARTICLE{ai15, + author = {{Akhlaghi}, M. and {Ichikawa}, T.}, + title = "{Noise-based Detection and Segmentation of Nebulous Objects}", + journal = {ApJS}, +archivePrefix = "arXiv", + eprint = {1505.01664}, + primaryClass = "astro-ph.IM", + keywords = {galaxies: irregular, galaxies: photometry, galaxies: structure, methods: data analysis, techniques: image processing, techniques: photometric}, + year = 2015, + month = sep, + volume = 220, + eid = {1}, + pages = {1}, + doi = {10.1088/0067-0049/220/1/1}, + adsurl = {http://adsabs.harvard.edu/abs/2015ApJS..220....1A}, + adsnote = {Provided by the SAO/NASA Astrophysics Data System} +} -- cgit v1.2.1