## zootaxa.bst: A reference style for authoring manuscript for zootaxa with LaTeX

Inspired by my last post and mostly because I have in the past contributed manuscripts to Zootaxa (e.g., descriptions of Farlowella and Chaetostoma), I noted that one of the issues for creating manuscripts in $\LaTeX$ for this journal is because we lack a reference style package, something that takes care of the bibliography and in-text references according to the instructions for authors by Zootaxa and let us concentrate in the work, that is, doing taxonomy and systematics. So far as I am aware there are two options for managing references related to zootaxa: A package for Endnote (by Paulo Petry), and a plugin for Mendeley-desktop. None of these work with $\LaTeX$, and therefore for any manuscript to be submitted to Zootaxa we had to either use the licensed MS Word or an open-source alternative such as libreoffice or openoffice.

I developed an alternative that allows to write a manuscript in $\LaTeX$ and takes care of the references automatically; it is a fork of a pre-existing reference style package (apa.bst) that resembled the most the rules by Zootaxa. Basically, zootaxa.bst will format your in-text references such as Smith & Smith (1990) and (Author, 1990) and also will include them as you cite them under References cited, formatted also according to the rules of Zootaxa. All of this, by using natbib‘s functions \citet, \citep, and friends (see my last blog post for details).

Filling this gap, what we will need for a working instance of a manuscript to be submitted is:

1) To convert/compile a $\LaTeX$ file to MS Word/RTF format
2) Convince Zootaxa to accept submissions in $\LaTeX$

I have been used the former for sharing documents with my PhD advisor that likes MS Word for reviewing with adequate results (a blog post on this later). The second may not be feasible depending on the internal editorial workflow of Zootaxa, that I ignore. For the time being, and while it eventually happens (if ever) we can author documents in $\LaTeX$ without worrying about the references anymore.

The stable releases can be found in CTAN while the development version can be found on github. There you will find the details on how to install it an use it.

# Motivation

During the preparation of a manuscript using $\LaTeX$ I came across an issue with references for authors of taxonomic entities (e.g., species and genus names). Initially I started writing taxonomic authors as plain text hoping to solve the cross-referencing later by citing elsewhere the same work or so. However, for some references there was no need at all to cite them elsewhere but only at the name, and this pushed me to look for a solution. Initially I considered to code a variant of the commands \citet and \citep of the natbib package that results way useful for handling bibliographies and text references.

The problem of referencing authors of names is that the International Code on Zoological Nomenclature (ICZN) has specific rules for citing such information in taxonomic works, and they may mimic regular in-text references to the uninitiated. Also, several pre-ICZN works handled variably these cases as there was no Code to rule them all (fortunately now we do have one).

This case will be specific to zoological nomenclature and may not be directly useful for botanical nomenclature because they use author abbreviations (e.g., Planch. for Planchon, or even L. for Linnaeus); therefore, the instructions below would need modification for rendering the author in abbreviated form but retaining the full name in the bibliography. I don’t even know if it is possible at all.

Please note that all instances of Author1990 are examples of a reference key that you need to define in your bibtex bibliography file (in this example, manuscript.bib). A typical bibtex entry would look like this:

@article{Author1990,
author = {Author, Bob A},
journal = {Tertiary Research},
number = {4},
pages = {131--137},
title = {{Fossils from the Bracklesham Group exposed in the M27 Motorway excavations, Southampton, Hampshire}},
volume = {12},
year = {1990}
}


# Regular citations

Basically, textual references from natbib are cited depending on whether they are intended to be textual citations where the author is part of the sentence, or whether both author and year are to be part of the citation:

• Reference between parentheses: \citep{Author1990}. Example: Author (1990) suggested that this genus resembles the other genus.
• Reference without parentheses: \citet{Author1990}. Example: Genus A resembles genus B (Author, 1990).

# Taxonomic authorship

The ICNZ (Chapter 11, Article 51, p.54) considers two cases: Either we want to cite the author of the name but not the year of publication, or we want to cite in full the author and year of publication; for the latter case the separation between author name and year must have a comma and a space, and there must be no mark or character between specific epithet name and the author. Also, the style of citation will depend on whether the name is to be used as first proposed by the author, that is, a species combined with its original genus, or whether the specific epithet underwent allocation to a genus other than the original. In the first case, the author (or author-and-year) are never to be put between parentheses (Article 51.2), whereas in the latter, the use of parentheses around the author (or again, author-and-year) is mandatory (Article 51.3). This latter usage leads to confusion for persons unaware of the correct citation of authors in zoological nomenclature that tend to view these as bibliographical citations, that is, everywhere put between parentheses. As is clear form the Code, the parentheses indicate that such specific name underwent some allocation from its original genus, that is, someone proposed a new combination with another genus.

The proper way to get the desired, ICNZ-compliant results are as follows:

• Only the author without year, as originally proposed (sensu Art. 51.1): \citeauthor*{Author1990}. Please note that for multi-authored names the Code requires to write in full all the author names (i.e., without abbreviating to the et al. for three or more authors). For one or two authors there is no difference between \citeauthor{Author1990} and \citeauthor*{Author1990}, both will produce the author name lacking parentheses and year.
• Both author and year, as originally proposed (sensu Art. 51.2): \citealp{Author1990} and \citealp*{Author1990}. In this case, the author and year are to be produced without parentheses, hence the “al” in the command. These are identical to \citep{Author1990} and \citep*{Author1990} except that they remove the parentheses around parenthetical citations.
• Only the author without year, for a name that underwent some sort of recombination or allocation to a genus other than the original one (sensu Arts. 51.1 and 51.3): Just use \citeauthor{Author1990} or \citeauthor*{Author1990} but place manually the parentheses around the command. This will render the desired output from the \citeauthor command but between parentheses. Example: (\citeauthor*{Author1990}) will produce (Author) instead of just Author.
• Both the author and year, recombined or allocated to a genus other than the original one (sensu Art. 51.3): \citealp{Author1990} and \citealp*{Author1990} but between parentheses. As above, manual parentheses around the command will produce the desired output. Example: (\citealp*{Author1990}) will produce (Author, 1990) instead of just Author, 1990.

It is noteworthy that this way you will not need to worry with journals that ask you to cite all of the name authorships in taxonomic works (e.g., Neotropical Ichthyology). With this approach you can produce a document with cross-references and formatted authorship citations, without need of manual insertion of these into the document (that for $\LaTeX$ happens to be impossible as far as I know). Once you use any of the natbib commands, the reference will be inserted and formatted automatically.

# A hypothetical example

The $\LaTeX$ code block will generate the PDF below showing the regular citations and taxonomic references properly handling the use cases discussed above.


\documentclass{article}

\usepackage{natbib} % this package will manage the citations and provides the \citeX commands
\usepackage[utf8]{inputenc} % allows to input with other encodings
\usepackage[colorlinks=true,citecolor=blue]{hyperref} % this colors the references and links
\usepackage[noblocks]{authblk} % for the affil block in authorships

\author{Gustavo A. Ballen}
\affil{Museu de Zoologia da Universidade de São Paulo, gaballench@gmail.com}
\title{On the genus \textit{Sphyraena}}

\begin{document}

\maketitle

This article reviews the nomenclatorial status of \textit{Sphyraena bolcensis}
\citealp{Agassiz1843}, or alternatievely if we want, of \textit{Sphyraena bolcensis}
\citeauthor{Agassiz1843} without the year. A species originally described in
\textit{Sphyraena} but currently removed from it by \citet{Woodward1901} is
\textit{Sphyraenodus speciosus} (\citeauthor{Leidy1877}), or with the year,
\textit{Sphyraenodus speciosus} (\citealp{Leidy1877}).

These usages are compliant with the relevant articles of the \citet{ICZN1999}. This
kind of bibliographical reference has been used erroneously in the past, specially
in pre-ICZN works \citep[e.g.,][p.]{Rapp1946}. In the latter example,
\textit{Sphyraenodus silovianus} (\citeauthor{Cope1875}) should have been written
down as \textit{Sphyraenodus silovianus} \citeauthor{Cope1875} instead as this
species was originally described in \textit{Sphyraenodus} and not
\textit{Sphyraena}.

\bibliographystyle{apa} % type of citation style to be used, here 'APA'
\bibliography{manuscript.bib}  % the bibtex file 'manuscript.bib'

\end{document}


# Final comment

As we have seen this blog post reinforces the idea that we can use $\LaTeX$ for successfully preparing a taxonomic manuscript that is compliant with the ICZN and also makes use of the automation power of this typesetting system and its huge package ecosystem. Now we need to convince both publishers and scientific societies that edit and publish scientific periodicals to better support (or just support, to begin with) $\LaTeX$ submissions. In the end, most (if not all) manuscript submission systems will send a PDF to the reviewers and not the Word version submitted by the authors. This would be a step further towards support of free software by avoiding the restriction to use a commercial package such as MS Office.

## Merry Christmas!

It’s Christmas time, and I decided to enter the mood by making a Christmas tree representing my current interests. Back in 2015 I constructed a Christmas tree based on the shape of an arbitrary cladogram and then added color and shapes in order to represent a Christmas tree. Below I describe how I did it long with the final output. Then I describe the process for constructing another Christmas tree, this time using a random walk stochastic process and some automatic additions to the plot of several realizations of such process. As with the cladistic Christmas tree, I present below the output along with the script for constructing it. These two graphics represent my shift from a hard-core parsimony guy to a fanatic of all quantitative things.

# Cladistic, manual version

First thing is to create a taxon-only matrix in mesquite, and then to manually create the relationships and also to transpose the daughter branches for each node. The output would be something like this:

#NEXUS
[written Wed Dec 23 14:54:24 BRST 2015 by Mesquite  version 3.04 (build 725) at ware/127.0.1.1]

BEGIN TAXA;
TITLE Taxa;
DIMENSIONS NTAX=20;
TAXLABELS
taxon_1 taxon_2 taxon_3 taxon_4 taxon_5 taxon_6 taxon_7 taxon_8 taxon_9 taxon_10 taxon_11 taxon_12 taxon_13 taxon_14 taxon_15 taxon_16 taxon_17 taxon_18 taxon_19 taxon_20
;

END;

BEGIN TREES;
Title Trees;
LINK Taxa = Taxa;
TRANSLATE
[0] 		1 taxon_1,
[1] 		2 taxon_2,
[2] 		3 taxon_3,
[3] 		4 taxon_4,
[4] 		5 taxon_5,
[5] 		6 taxon_6,
[6] 		7 taxon_7,
[7] 		8 taxon_8,
[8] 		9 taxon_9,
[9] 		10 taxon_10,
[10] 		11 taxon_11,
[11] 		12 taxon_12,
[12] 		13 taxon_13,
[13] 		14 taxon_14,
[14] 		15 taxon_15,
[15] 		16 taxon_16,
[16] 		17 taxon_17,
[17] 		18 taxon_18,
[18] 		19 taxon_19,
[19] 		20 taxon_20;
TREE tree1 = (20,(18,((1,((3,((15,((4,((5,((7,((11,((9,10),12)),8)),6)),13)),14)),16)),2)),17)),19)[% ] [% ] [%  setBetweenBits = selected ];

END;


Then I manually edited it in figtree, mostly making the branches thicker, and fixing the fonts, resulting in the following file:

#NEXUS
begin taxa;
dimensions ntax=20;
taxlabels
taxon_1
taxon_10
taxon_11
taxon_12
taxon_13
taxon_14
taxon_15
taxon_16
taxon_17
taxon_18
taxon_19
taxon_2
taxon_20
taxon_3
taxon_4
taxon_5
taxon_6
taxon_7
taxon_8
taxon_9
;
end;

begin trees;
tree tree_1 = [&R] (taxon_20:1.0,(taxon_18:1.0,((taxon_1:1.0,((taxon_3:1.0,((taxon_15:1.0,((taxon_4:1.0,((taxon_5:1.0,((taxon_7:1.0,((taxon_11:1.0,((taxon_9:1.0,taxon_10:1.0):1.0,taxon_12:1.0):1.0):1.0,taxon_8:1.0):1.0):1.0,taxon_6:1.0):1.0):1.0,taxon_13:1.0):1.0):1.0,taxon_14:1.0):1.0):1.0,taxon_16:1.0):1.0):1.0,taxon_2:1.0):1.0):1.0,taxon_17:1.0):1.0):1.0,taxon_19:1.0);
end;

begin figtree;
set appearance.backgroundColorAttribute="Default";
set appearance.backgroundColour=#ffffff;
set appearance.branchColorAttribute="User selection";
set appearance.branchLineWidth=7.0;
set appearance.branchMinLineWidth=0.0;
set appearance.branchWidthAttribute="Fixed";
set appearance.foregroundColour=#000000;
set appearance.selectionColour=#2d3680;
set branchLabels.colorAttribute="User selection";
set branchLabels.displayAttribute="Branch times";
set branchLabels.fontName="Abyssinica SIL";
set branchLabels.fontSize=8;
set branchLabels.fontStyle=0;
set branchLabels.isShown=false;
set branchLabels.significantDigits=4;
set layout.expansion=642;
set layout.layoutType="RECTILINEAR";
set layout.zoom=0;
set legend.attribute=null;
set legend.fontSize=10.0;
set legend.isShown=false;
set legend.significantDigits=4;
set nodeBars.barWidth=4.0;
set nodeBars.displayAttribute=null;
set nodeBars.isShown=false;
set nodeLabels.colorAttribute="User selection";
set nodeLabels.displayAttribute="Node ages";
set nodeLabels.fontName="Abyssinica SIL";
set nodeLabels.fontSize=8;
set nodeLabels.fontStyle=0;
set nodeLabels.isShown=false;
set nodeLabels.significantDigits=4;
set nodeShape.colourAttribute=null;
set nodeShape.isShown=false;
set nodeShape.minSize=10.0;
set nodeShape.scaleType=Width;
set nodeShape.shapeType=Circle;
set nodeShape.size=4.0;
set nodeShape.sizeAttribute=null;
set polarLayout.alignTipLabels=false;
set polarLayout.angularRange=0;
set polarLayout.rootAngle=0;
set polarLayout.rootLength=100;
set polarLayout.showRoot=true;
set rectilinearLayout.alignTipLabels=false;
set rectilinearLayout.curvature=0;
set rectilinearLayout.rootLength=100;
set scale.offsetAge=0.0;
set scale.rootAge=1.0;
set scale.scaleFactor=1.0;
set scale.scaleRoot=false;
set scaleAxis.automaticScale=true;
set scaleAxis.fontSize=8.0;
set scaleAxis.isShown=false;
set scaleAxis.lineWidth=1.0;
set scaleAxis.majorTicks=1.0;
set scaleAxis.origin=0.0;
set scaleAxis.reverseAxis=false;
set scaleAxis.showGrid=true;
set scaleBar.automaticScale=true;
set scaleBar.fontSize=10.0;
set scaleBar.isShown=true;
set scaleBar.lineWidth=1.0;
set scaleBar.scaleRange=0.0;
set tipLabels.colorAttribute="User selection";
set tipLabels.displayAttribute="Names";
set tipLabels.fontName="Abyssinica SIL";
set tipLabels.fontSize=16;
set tipLabels.fontStyle=2;
set tipLabels.isShown=true;
set tipLabels.significantDigits=4;
set trees.order=false;
set trees.orderType="increasing";
set trees.rooting=false;
set trees.rootingType="User Selection";
set trees.transform=false;
end;


We can save the file above in svg vectorial format so that then we can do a bit of edition in Inkscape I ended up with this:

The process is fairly manual, but it pleased both my contacts in social networks and myself, and it was funny to tweak things so that an evolutionary construct based on graph theory could mimic a Christmas tree. It is noteworthy that all was carried out with open source programs, so you can try it yourself without need to pay for the programs 🙂

# Stochastic, automated Christmas tree

Stochastic processes are models that describe phenomena incorporating uncertainty across time, that is, where the final result and the trajectory of a sequence of events can not be determined, however, they can be characterized so that we can build expectations about them. A big deal of real-world phenomena can be described using stochastic processes, from time series analysis (including financial applications, medical imaging, and world-scale phenomena such as global warming) to modeling of evolution (e.g., Brownian motion, the birth-death process).

One of these is often called random walk, and says that for a given variable, the values it takes through time are allowed to show variation (or to show uncertainty) between certain admissible values, so that the change in the value from a step 1 to a step 2 can not be predicted exactly and can change if we repeat the realization of the events. Mathematically we then say that, for a time step $t$ and its previous step $t - 1$ in variable $x$, the value of $x$ at time step $t$ would depend on the previous value $t - 1$ plus or minus an uncertain quantity that applies to the current step $w_t$:

$x_{t} = x_{t - 1} + w_{t}$

Oftentimes, we use the normal distribution for describing $w_t$ centered at $\mu = 0$ and with variance $\sigma^2$ taking smaller or larger values depending on whether we want the process to vary a lot or just a little; the larger the variance, the larger the likely values that $w_t$ can sum or rest from the previous value.

$w_t = N(\mu,\sigma^2)$

If we repeat a lot of times such stochastic processes we can consider a whole bunch of possible trajectories, that once plotted together, can produce the shape of a pine with tip on the origin.

Using unicode characters we can plot a point with a colored star to the plot area with the points function, and choose colors with finer control with the function RGB that combines values of the colors red, green, and blue, along with a transparency value alpha. We can use this source for picking a color visually and then look for the adequate amounts of red, green, and blue.

# set seed for repeatable results
set.seed(1985)
# initialize the plot with the tip star
plot(x = 0, y = 0, xlim = c(-60, 60), ylim = c(-500, 0),
xlab = NA, ylab = NA, pch = -9733, cex = 3,
col = rgb(red = 255/255, green = 191/255, blue = 0/255))
# set initial values
x <- 0
y <- x
# design a data frame for saving the values from each realization
allPoints <- data.frame(x, y, stringsAsFactors = FALSE)
# iterate over realizations and numbers of steps for producing
# 1000 different trajectories, each with 500 steps
for (j in 1:1000) {
x <- 0
y <- x
for (i in 1:500) {
# x to the left of the arrow is x_t and the one to the right is x_{t-1}
# plus or minus an amount drawn at random from a normal(0,0.7)
x <- x + rnorm(1, sd = 0.7)
# append the value to the series
y <- c(y, x)
}
# plot the line with the values saved before
lines(x = y, y = -seq_along(y),
col = rgb(green = 128/255,
red = 22/255,
blue = 20/255,
alpha = 0.3))
# save the data to the data frame
allPoints <- rbind(allPoints, data.frame(x = y, y = -seq_along(y)))
}
# plot the star again
points(x = 0, y = 0, pch = -9733, cex = 3,
col = rgb(red = 255/255, green = 191/255, blue = 0/255))
# red balls
# red balls, y axis
redY <- seq(from = 0, to = 500, by = 80)[-1]
# sequence for calculating the values of each x component for a given y in red balls
for (i in redY) {
redX <- c(seq(from = min(allPoints[allPoints$y == -i, "x"]), to = max(allPoints[allPoints$y == -i, "x"]),
by = 20),
max(allPoints[allPoints$y == -i, "x"])) points(x = redX, y = rep(x = -i, times = length(redX)), pch = 21, bg = "red", cex = 2) } # yellow balls # yellow balls, y axis yellowY <- (seq(from = 0, to = 500, by = 80) + 40)[-length(seq(from = 0, to = 500, by = 80) + 40)] # sequence for calculating the values of each x component for a given y in red balls for (i in yellowY) { yellowX <- c(seq(from = min(allPoints[allPoints$y == -i, "x"]),
to = max(allPoints[allPoints$y == -i, "x"]), by = 20), max(allPoints[allPoints$y == -i, "x"]))
points(x = yellowX, y = rep(x = -i, times = length(yellowX)),
pch = 21, bg = "yellow", cex = 2)
}


A couple of tricks were needed in order to produce the orientation of trajectories and position of red and yellow balls: explicit transposition of variables where the values of x were flipped to its negative -x and the y as the independent variable and x as the dependent one. Also, the coordinate points for the balls were automated and therefore they may look weird to the right, since I did not found a way to automatically calculate coordinates and variable distance among points so that the initial and final ones were always on the largest or smallest point. It might be possible but I just got tired of thinking about an alternative, in the end, a script that builds the whole thing seems fair enough.

That’s all for now, happy holidays to everybody!

## The tntphylo-mode Emacs package

Since approximately mid-year I started developing an Emacs package for doing interactive work with RevBayes, a program for bayesian phylogenetic inference. Since then the project has grown steadily and now it’s in a better shape, with a cleaner setup and execution, and is about to be submitted to Melpa. However, this post is not about that package but instead concerns a new one more or less forked from rev-mode but this time to allow interactive work with TNT, a program for phylogenetic analysis using parsimony.

This first release ‘just works’ in the sense that some features are still unavailable; however, up to now the package is able to start a TNT process whenever there is a command for text redirection and there is still no process available, and if so, it redirects text from the active buffer (e.g., a TNT script) to the buffer with the process.

Font locking is still derived from sh-mode and thus most of syntax formatting is not as nice as if it was deriving from c-mode; alternatively, at its current state, the package inherits the sh-mode redirection capabilities that are absent in c-mode (and with all reason, since C is a compiled language where you can’t carry out interactive work as opposed to interpreted languages). Long story short, we need the text redirection from sh-mode and syntax font locking from c-mode; and I’m still trying to figure out how to manage to accomplish such hybrid.

## How to use it

1. Get tntphylo-mode from https://github.org/gaballench/tntphylo-mode.
2. Add the following to your .emacs
(add-to-list 'load-path "path/to/tntphylo-mode")
(require 'tntphylo-mode)

1. Open a TNT script.
2. Call the function tntphylo-mode. It will load the package on the active buffer.
3. Step on a line with a TNT command (e.g., mxram) and press C-c C-n for redirecting just one line. It will send the text to the TNT process that will execute it and print output to the TNT buffer.
4. Rinse and repeat.

You might be wondering why the odd “tntphylo” part of the name instead of just “tnt” as the program; it happens that there is already a package called tnt for Emacs and I didn’t want to mess things up in the remote case that somebody needs such package. Please note that it is customary in Emacs to start the function names with the package name (e.g., tntphylo-next-code-line) and therefore it will be confusing whether a given function starting with tnt- belongs to this package or to the earlier tnt.el package, unrelated to this one.

A few other functions are planned for this package, among others, inspection and maybe visualization of the objects produced through the interactive section, autocompletion of commands, and interactive help.

Please note that TNT is NOT open source (unfortunately) but instead freeware with a license agreement. You can call the TNT process only after agreeing with such license during the first time you launch the program. In order to work properly, your copy of TNT must be in your PATH, that is, in a directory where your operative system can look for executables.

## Emacs as an Operating System

Please note that in the present document, “operating system” does not refer to the full implementation of software that controls the hardware, boots the system, and runs tasks tasks for the user, but instead as the last part.

# Introduction

In my early years of immersion into computing I had the advantage of having access to a friend that was really good at it and ended up doing a PhD. in bioinformatics. At the time I barely had a first-try of installing Ubuntu on a desktop computer that happened to be shared with other members of my family (failing miserably and loosing during the process all of the data therein saved). Talking to this knowledgeable friend as well as reading about good editors for using R (that was not as popular at the time in my university as it is today), I heard about this weird editor with an African ruminant in his logo, called Emacs. The very first thing I heard was that it was a very good R editor that it was worth giving a try, probably from some online free course or such; and the second came from my friend, who described the editor as basically “an operating system that was also useful as a coding editor, but so hard to learn that it was basically pointless to even give it a try!”. I decided that I wanted to give it a try, just to perceive that I could not even understand its most basic commands, and that I could not even create or open a file. I dropped immediately and ended up using the built-in R’s script editor, concluding that the editor was basically beyond my reach and that I did not want to try harder.

I continued learning, next focusing on GNU/Linux and learning R along the way, writing code in RStudio and concluding that I found was just everything I needed for code production. As the time passed (several years, actually), I started perceiving some weird behaviors on RStudio’s side (specially concerning graphics) that made me look for another code editor. Then I tried sublime, and sticked to it for a while just to detect some other nuances
but nothing so serious as to make me look for some other editor. At the time I was starting my PhD. and had some “free” time, so that I started learning other “useful” tools such as LaTeX. I then decided to try again Emacs, as I was more familiar to coding and computing in general. This time I just sticked to it, learning quickly the small details that made its learning curve somewhat steep in the beginning but that were funny to learn; actually, the very same thing happened with LaTeX, so that with time it become my main editor. As a side note I did not touch again a computer running with Windows in years, so that I even forgot where to find things and such. GNU/Linux with Emacs was just wonderland I was happy, and had no reason to change something about. However, what if I had to interact with a machine running Windows?

I have to use such machines sometimes out of both my lab and home, where all machines run GNU/Linux. I found myself also using Windows machines when doing an internship abroad in a lab that did not have GNU/Linux available and had the urgency to compile a LaTeX document, and that time had to ask my sister to do it for me at home. What if I could just bring with me a mini-laptop with all my beloved GNU/Linux tools ready to use so that situations like that could not happen again? Something like a tablet with laptop capabilities, eventually capable of running code, compiling stuff and still being portable in the sense that I could bring it with me all the time. I already knew that USB sticks were useful as booting devices for computer administration or just for installing GNU/Linux, so in theory a small device such as a USB stick could behave as a full-featured system capable of turning a sad machine suffering with Windows into a powerful computing beast using GNU/Linux as its operating system. Would it be possible of having something similar for emergency situations?

I recalled the conversation with my old friend on Emacs and after some thoughts concluded that it was already a sub-operating system in my computers, where I spent most of the time when logged in, but my experience was mostly restricted to GNU/Linux, and I had no clue about whether it ran on Windows and how. Luckily I discovered that Emacs’ install process was just to unzip the directory into the desired location, and it happened to run also from a USB. It was possible to bring the Windows version of Emacs in the USB stick and even to install things on it! Then an extension seemed natural: Provided that a program can be executed from the USB without the need for any component outside the device, was it possible to make Emacs to interact with such programs? To what extent? Could I use portable versions of things such as a LaTeX distribution, R, git, and pandoc inside a USB that I could execute in any Windows computer? The short answer is: Yes (up to now), and below I describe step by step how I managed to do it. Nearly half of the process was carried out in a virtual machine with Windows 8.1 using virtualbox on GNU/Linux, and the other on a Windows machine with Windows 10. There was no perceivable difference in execution. Please note that I “name” files in the code blocks with an underline consisting of lines of equal signs (====) so that it is clear that the text below should be located in the file name.

# Setting the scene

The first thing we need to do is to format the USB stick with a file system compatible with Windows. The USB stick was an old one with a couple years of use and 16 Gb of capacity. For this case I used the NTFS filesystem (following this source) and a single partition. whether you format it on Windows or GNU/Linux the result should be the same, or at least I could not find any difference as used both approaches. As a result you should have a device completely blank and mountable on Windows machines. Now we need to get some programs and decide how will we organize the files in the device.

Cluttering can easily happen when installing a bunch of programs into any device in the same directory, so that a special directory called miniOS (after mini-operating-system) was created for this purpose. There we will put all the programs that compose our “operating system.” Next thing is to download the first and most important program -Emacs-, and to set some things up on it. Please note that I will refer to the USB initial point as \ or \\ (or /, or even //) throughout the text. The last important directory will be user, where Emacs will install stuff that usually goes in .emacs.d because Windows doesn’t like dots in file and directory names.

# Installing emacs and setting things up for real portability

Emacs can be found here for any platform, we will need to download the Windows version and then unzip the content into miniOS. I chose version 25 for this.

## Some notes on portability

There is an issue when running Emacs on a USB stick: Every time you plug it into a machine the device can potentially be named differently, despite most of the time its name is E:\. Otherwise, our “root” and other paths can not be used if we explicitly call them E and they happen to be mounted as F or whatever. Inspired in this thread on StackExchange I found that creating a DOS script that calls emacs with a specific init file can overcome this issue, since Emacs reads the location from where it was called at startup and seizing on this we can create “relative” paths to our different directories, specially to those bearing the executable files.

## Starting up Emacs

There is an special directory in the emacs directory that was unzipped: dir. It contains the executable files for running emacs under several situations. Keep it in mind when preparing the scripts.

First, create the script that sets the basic HOME and PATH variables (don’t know what do these weird guys are? take a look here), and then call Emacs from the binary that we should be using, called runemacs.exe. Why this file if there are other executables in the same directory, one of them even called just emacs.exe? See the reasons here. Our startup script will be called Emacs.cmd, and we will double-click it every time we want to open Emacs. Its content will be:

\Emacs.cmd
==========
set "HOME=%~dp0"
set PATH="%PATH%;\miniOS\emacs\bin"
miniOS\emacs\bin\runemacs.exe   -q   --load \miniOS\emacs\init.el %*


The first two lines set the HOME environment variable and then use it in order to set the PATH variable that Emacs will remember them as the starting execution point, and where to find programs for execution, respectively. The third line runs Emacs with the -q option that starts Emacs faster (with the cost of not running some startup code, see here again). The first line is where magic happens: It sets the path to the USB whatever the name of the device: E, F, G, whatever. This script makes out Emacs instance fully portable. Please note that each directory put in the PATH must be separated by a semicolon (;).

Next thing to do is to create an init script so that Emacs Lisp code is run at startup. Important code that should always be run at startup goes here:

\miniOS\emacs\init.el
=====================
(setenv "HOME"
(expand-file-name (concat invocation-directory "../../..")))
(setq user-emacs-directory
(expand-file-name (concat (getenv "HOME") "user/")))
(setq abbrev-file-name
(locate-user-emacs-file "abbrev_defs"))
(setq auto-save-list-file-prefix
(locate-user-emacs-file "auto-save-list/.saves-"))
(cd "~")


The third important file is the so-called .emacs file (or dot-emacs), that we will call instead _emacs and place in \ so that Windows does not complain about having dots in the file name:

\_emacs
=======


This small elisp code tells us that Emacs is loading appropriately the dot-emacs file, and therefore we should see the text “.emacs loading” in the minibuffer. Next we will need to tell Emacs to use also the MELPA repository in order to install packages with the following code in _emacs:

\_emacs
=======
;; setting up melpa
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when ( setwd('e:/')
>


# Installing git

Git has a portable version called “thumbdrive edition” under the windows release that will install everything in the specified location. Just download it into \miniOS and let it install everything in the default folder called PortableGit.

## Interacting with git: The magit package

We will use magit in order to interact with git and install it with M-x package-install and then magit. After a lot of times trying I could not make magit to find the executables and ended up modifying the magit-git-executable variable in _emacs:

\_emacs
==========
;; set magit git executable from portable git
(setq magit-git-executable "\\miniOS\\PortableGit\\mingw64\\bin\\git")


We can test that everything works properly by cloning any repo from github, and it simultaneously will tell us if we can access the internet from Emacs: M-x magit-clone and then type the repo address: http://github.com/user/repository.git. Please note that sometimes secure protocols can give problems, so maybe it’s better to type http and not https.

# Installing LaTeX

The recommended approach at installing a LaTeX distribution was found to be MiKTeX. This distribution has a portable version that we will use for our case. Please note that rmarkdown will have problems interacting with MiKTeX (see here) and you should choose the “Install missing packages” option as “Yes” during install. After installing it into \miniOS\miktex-portable, we will modify the PATH in Emacs.cmd:

\Emacs.cmd
==========
set PATH="%PATH%;\miniOS\emacs\bin;\miniOS\R-3.4.4\bin\x64;\miniOS\miktex-portable\texmfs\install\miktex\bin"


I also did it in init.el because Emacs was struggling with the windows backslashes and just found the executables when using unix slashes:

\miniOS\emacs\init.el
=====================
(setenv "PATH" (concat
(getenv "PATH")
";"
"/miniOS/miktex-portable/texmfs/install/miktex/bin"))


I actually got the inspiration when seeing that MiKTeX itself uses both kinds of slash in order to avoid problems depending on the platform.

## Interacting with LaTeX: The AUCTeX package

The AUCTeX package is another marvel from Emacs that offers a full-featured system for compiling LaTeX documents from inside Emacs. This is the responsible of allowing us to use Emacs as ourur LaTeX platform provided that it finds the executables for compilation of such documents that we can used for authoring papers, theses, and even presentations. We can install it with M-x package-install and then auctex. if the PATH was properly set, AUCTeX should not have problems finding the LaTeX compilers (e.g., pdflatex or bibtex). We can test that everything is in place creating a test LaTeX file and compiling it with C-c C-c and choosing LaTeX from the list of compilers:

\documentclass{article}
\begin{document}
Hello world!
\end{document}


If everything is OK we would compile our first LaTeX document to pdf in the USB stick.

# Some games

## Sudoku

Install the sudoku package as already indicated for other Emacs packages.

## Go

We can use the GNU Go engine for such wonderful game. Install gnugo as we did with sudoku, and also install the program from here in miniOS. We will need to add it to the path both in Emacs.cmd and init.el as well as to set the variable gnugo-program to point to the path in _emacs. Maybe just one of these three will suffice, but so far I wanted to guarantee it:

\Emacs.cmd
==========
set PATH="%PATH%;\miniOS\emacs\bin;\miniOS\R-3.4.4\bin\x64;\miniOS\miktex-portable\texmfs\install\miktex\bin;\miniOS\gnugo-3.8"

\miniOS\emacs\init.el
=====================
(setenv "PATH" (concat
(getenv "PATH")
";"
"/miniOS/miktex-portable/texmfs/install/miktex/bin"
";"
"/miniOS/gnugo-3.8"))

\_emacs
=======
;; set gnugo executable explicit path
(setq gnugo-program "\\miniOS\\gnugo-3.8\\gnugo")


# Portable Pandoc

Pandoc is a program for converting text files between a wide array of formats, and is the battelhorse of packages such as knitr and rmarkdown, so if we want to author markdown and/or rmarkdown files we must guarantee that it can be used from the USB. We can install it from here. Please note that we want the .zip compressed file that acts as a portable version and not the .msi file.

Then we need to add pandoc to the PATH in init.el as already mentioned:

\miniOS\emacs\init.el
=======
(setenv "PATH" (concat
(getenv "PATH")
";"
"/miniOS/miktex-portable/texmfs/install/miktex/bin"
";"
"/miniOS/gnugo-3.8"
";"
"/miniOS/pandoc-2.4-windows-x86_64"))


Please remember the warning when discussing MiKTeX: Pick the auto-install option during install of the latter package. If you try to run the render function of rmarkdown you will have problems.

# Authoring markdown

There is an Emacs package that I like to use for markdown, called markdown-mode. You can install it as already described for other packages. Another package is polymode, also available as already described. Finally, you may want to take a look at rmarkdown-goodies, my own Emacs package for extending markdown specifically for providing some functionality that I was missing from other packages more general in scope (such as markdown-mode). I plan to describe such package in more detail in the future (as well as to submit it to melpa), but for the time being you can clone it from Emacs with magit-clone and htttp://github.com/gaballench/rmarkdown-goodies.git. As a comment, I prepared the present document with these three packages directly from Emacs.

The final chunk of software we will need in order to author markdown documents from Emacs is the rmarkdown R package. Open R with M-x R and then install it from CRAN with:

install.packages("rmarkdown", repos = "http://cran.us.r-project.org")


Please note the explicit use of the repos argument in install.packages. Since we are using http instead of https, we try to avoid problems with this protocol, and also, we avoid the X emergent window asking us to specify a repository; it may not work from within Emacs!

There is a number of functionalities I like in Emacs, and all of them can be specified in _emacs. First install the packages mc and undo-tree as usual and then add the following to the _emacs file:

\_emacs
=======
;; set save abbrevs to silent
(setq save-abbrevs 'silent)        ;; save abbrevs when files are saved

;; deal with temporary files
;; store all backup and autosave files in the tmp dir
(setq temporary-file-directory "\\miniOS\\tmp")
;(setq backup-directory-alist
;      ((".*" . ,temporary-file-directory)))
;(setq auto-save-file-name-transforms
;      ((".*" ,temporary-file-directory t)))

;; use count-words instead of count-words-region as it works on buffer
;; if no region is selected
(global-set-key (kbd "M-=") 'count-words)

;; multiple cursors
;; first install mc with package-install' and also install libgnutls
;; see the following https://emacs.stackexchange.com/questions/27202/how-do-i-install-gnutls-for-emacs-25-1-on-windows
;; http://gnu.c3sl.ufpr.br/ftp/emacs/windows/emacs-25/emacs25-x86_64-deps.zip
;; extract in e:/miniOS/emacs so that binaries are properly included in its directory (i.e., emacs/bin)
(global-set-key (kbd "C-c m c") 'mc/edit-lines)

;;; undo tree mode
;;turn on everywhere
(global-undo-tree-mode 1)
;; make ctrl-z undo
(global-set-key (kbd "C-z") 'undo)
;; make ctrl-Z redo
(defalias 'redo 'undo-tree-redo)
(global-set-key (kbd "C-S-z") 'redo)

;; maximized at startup
(add-to-list 'initial-frame-alist '(fullscreen . maximized))


Please note that in order to use the multiple cursors you will need to install the emacs25 dependencies by downloading the file and unzipping it into \miniOS\emacs so that binaries are properly included in its directory (i.e., emacs\bin).

# Closing summary of scripts

All of the important scripts are transcribed below for further reference. The system runs adequately and I hope to prepare a zipped file for sharing the current state of the USB portable software. Please drop me a note if you want it before I release it publicly.

\Emacs.cmd
==========
set "HOME=%~dp0"
set PATH="%PATH%;\miniOS\emacs\bin;\miniOS\R-3.4.4\bin\x64;\miniOS\miktex-portable\texmfs\install\miktex\bin;\miniOS\gnugo-3.8"
miniOS\emacs\bin\runemacs.exe   -q   --load \miniOS\emacs\init.el %*

\_emacs
=======

;; setting up melpa
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)

;; set save abbrevs to silent
(setq save-abbrevs 'silent)        ;; save abbrevs when files are saved

;; set magit git executable from portable git
(setq magit-git-executable "\\miniOS\\PortableGit\\mingw64\\bin\\git")

;; deal with temporary files
;; store all backup and autosave files in the tmp dir
(setq temporary-file-directory "\\miniOS\\tmp")
;(setq backup-directory-alist
;      ((".*" . ,temporary-file-directory)))
;(setq auto-save-file-name-transforms
;      ((".*" ,temporary-file-directory t)))

;; use count-words instead of count-words-region as it works on buffer
;; if no region is selected
(global-set-key (kbd "M-=") 'count-words)

;; multiple cursors
;; first install mc with package-install' and also install libgnutls
;; see the following https://emacs.stackexchange.com/questions/27202/how-do-i-install-gnutls-for-emacs-25-1-on-windows
;; http://gnu.c3sl.ufpr.br/ftp/emacs/windows/emacs-25/emacs25-x86_64-deps.zip
;; extract in e:/miniOS/emacs so that binaries are properly included in its directory (i.e., emacs/bin)
(global-set-key (kbd "C-c m c") 'mc/edit-lines)

;;; undo tree mode
;;turn on everywhere
(global-undo-tree-mode 1)
;; make ctrl-z undo
(global-set-key (kbd "C-z") 'undo)
;; make ctrl-Z redo
(defalias 'redo 'undo-tree-redo)
(global-set-key (kbd "C-S-z") 'redo)

;; maximized at startup
(add-to-list 'initial-frame-alist '(fullscreen . maximized))

;; set gnugo executable explicit path
(setq gnugo-program "\\miniOS\\gnugo-3.8\\gnugo")

\miniOS\emacs\init.el
=====================
(setenv "HOME"
(expand-file-name (concat invocation-directory "../../..")))
(setq user-emacs-directory
(expand-file-name (concat (getenv "HOME") "user/")))
(setq abbrev-file-name
(locate-user-emacs-file "abbrev_defs"))
(setq auto-save-list-file-prefix
(locate-user-emacs-file "auto-save-list/.saves-"))
(cd "~")
(setenv "PATH" (concat
(getenv "PATH")
";"
"/miniOS/miktex-portable/texmfs/install/miktex/bin"
";"
"/miniOS/gnugo-3.8"
";"
"/miniOS/pandoc-2.4-windows-x86_64"))


## First “release” of the rev-mode package

A week or so ago I attended a workshop on the RevBayes platform on graphic probabilistic models for evolutionary biology held at the Museo Argentino de Ciencias Naturales. There is abundant literature documenting the theory behind the design of RevBayes, that can be thought as MrBayes with steroids with a completely-different design based on the theory of probabilistic graphs; an appealing theory of model specification with a big deal of application in phylogenetics and related fields.

One major drawback of it is that it lacks an interpreter with code redirection capabilities (mostly for MS Windows, where the batch mode does not support copy-paste capabilities); however, Dr. Höhna has just released RevStudio, an IDE for the Rev language with code redirection (for Windows and Mac), pretty much the same thing as RStudio is for the R language. Although its design targets Windows users (and maybe MacOS ones too), it still lacks support for Linux, and therefore, I started to develop a linux-based interpreter with IDE capabilities under a GNU-based system.

As I already use Emacs, I decided that it was pretty simple to develop a major mode for the Rev language with all the basic features for an IDE, that is, an interpreter, code redirection, and (soon to be implemented) syntax aesthetics. I basically constructed a Frankenstein of julia-mode (for the rb process) as well as essh (mostly for code redirection). With these tools at hand, a Rev IDE could be set up “nearly” running smoothly.

Syntax highlight (feature pending, actually), auto-completion (pending, too), and command redirection features are expected to work in this mode to provide a development environment for RevBayes.

At this moment it just runs, provided that you include the following in your .emacs file or wherever appropriate:

(add-to-list 'load-path "/path/to/rev-mode")
(require 'rev-mode)                                                    ;;
(defun rev-mode-sh-hook ()                                             ;;
(define-key sh-mode-map "\C-c\C-r" 'pipe-region-to-rev)        ;;
(define-key sh-mode-map "\C-c\C-b" 'pipe-buffer-to-rev)        ;;
(define-key sh-mode-map "\C-c\C-j" 'pipe-line-to-rev)          ;;
(define-key sh-mode-map "\C-c\C-n" 'pipe-line-to-rev-and-step) ;;
(define-key sh-mode-map "\C-c\C-f" 'pipe-function-to-rev))      ;;
;; setup files ending in “.rev” to open in rev-mode
(add-to-list 'auto-mode-alist '("\\.rev\\'" . rev-mode))


# How to use

First of all be sure that RevBayes is already installed in your system and that it is in your path so that you can call it from the command line. At present rev-mode does run automatically so first you will need to open a .rev file (it will be recognized as rev-mode); this unfortunately opens a terminal buffer that is unnecessary but also harmless as all the code redirection goes directly to the rb process. You will need to start a RevBayes process with M-x run-rev; this will open a command line interpreter of the rb program. Afterwards just use the keystroke combinations described above.

You can download rev-mode from https://github.com/gaballench/rev-mode

## Troubleshooting installation of the mpi version of revbayes

I’ll be attending a workshop in Buenos Aires next week on revbayes, a program for bayesian inference in evolutionary biology that looks very promising for divergence time estimation, an area in which I have particular interest. When preparing the software for the workshop, I noted that the single-thread version compiled without problems. However, when trying to build the mpi version (multi-thread, revbayes with steroids), release 1.0.7 (master branch) I found the error (see line 90, highlighted):

user@computer:~/programs/revbayes/projects/cmake$./build.sh -mpi true /home/user/programs/revbayes/projects/cmake/build<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;">﻿</span> Building boost libraries you can turn this of with argument "-boost false" Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2 Unicode/ICU support for Boost.Regex?... not found. Generating Boost.Build configuration in project-config.jam... Bootstrapping is done. To build, run: ./b2 To adjust configuration, edit 'project-config.jam'. Further information: - Command line help: ./b2 --help - Getting started guide: http://www.boost.org/more/getting_started/unix-variants.html - Boost.Build documentation: http://www.boost.org/build/doc/html/index.html Performing configuration checks - 32-bit : no (cached) - 64-bit : yes (cached) - arm : no (cached) - mips1 : no (cached) - power : no (cached) - sparc : no (cached) - x86 : yes (cached) Building the Boost C++ Libraries. - symlinks supported : yes (cached) - gcc visibility : yes (cached) - long double support : yes (cached) - has_icu builds : yes (cached) - lockfree boost::atomic_flag : yes (cached) Component configuration: - atomic : building - chrono : building - container : not building - context : not building - coroutine : not building - coroutine2 : not building - date_time : building - exception : not building - filesystem : building - graph : not building - graph_parallel : not building - iostreams : not building - locale : not building - log : not building - math : building - mpi : not building - program_options : building - python : not building - random : not building - regex : building - serialization : building - signals : building - system : building - test : not building - thread : building - timer : not building - type_erasure : not building - wave : not building ...patience... ...patience... ...patience... ...found 3944 targets... The Boost C++ Libraries were successfully built! The following directory should be added to compiler include paths: /home/user/programs/revbayes/boost_1_60_0 The following directory should be added to linker library paths: /home/user/programs/revbayes/boost_1_60_0/stage/lib CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find MPI_C (missing: MPI_C_LIBRARIES MPI_C_INCLUDE_PATH) Call Stack (most recent call first): /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.5/Modules/FindMPI.cmake:614 (find_package_handle_standard_args) CMakeLists.txt:26 (find_package) -- Configuring incomplete, errors occurred! See also "/home/user/programs/revbayes/projects/cmake/build/CMakeFiles/CMakeOutput.log". See also "/home/user/programs/revbayes/projects/cmake/build/CMakeFiles/CMakeError.log". CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find MPI_C (missing: MPI_C_LIBRARIES MPI_C_INCLUDE_PATH) Call Stack (most recent call first): /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.5/Modules/FindMPI.cmake:614 (find_package_handle_standard_args) CMakeLists.txt:26 (find_package) -- Configuring incomplete, errors occurred! See also "/home/user/programs/revbayes/projects/cmake/build/CMakeFiles/CMakeOutput.log". See also "/home/user/programs/revbayes/projects/cmake/build/CMakeFiles/CMakeError.log". Makefile:218: recipe for target 'cmake_check_build_system' failed make: *** [cmake_check_build_system] Error 1  The error message looked somewhat obscure and finding that there was something wrong with the mpi library I looked how to install it for Ubuntu. I ended up installing everything labeled openmpi with apt-get. However, this did NOT solve my problem as the installation process still was unable to find the mpi component. Most of the day was spent trying unsuccessfully to switch paths to libraries, edit bash profile files, try to switch flags for the build.sh file, and a long list of other useless and desperate options. Once at home I decided to give it a try again and noted that the installation process makes reference to the ‘boost’ library and its ‘mpi’ component. The compilation of the mpi version of revbayes actually complains about being unable to find MPI_C, and since the component configuration mpi is said to be not building (see highlighted line 60 in the first code block), I ended up looking for something related to the boost library (actually called libboost) and mpi with apt-cache (actually, apt-cache search libboost gives a list of components that matches the components listed during the preparation for compiling): user@computer:~$ apt-cache search libboost-mpi # look for the mpi component of the boost library
libboost-mpi-dev - C++ interface to the Message Passing Interface (MPI) (default version)
libboost-mpi-python-dev - C++ interface to the Message Passing Interface (MPI), Python Bindings (default version)
libboost-mpi-python1.58-dev - C++ interface to the Message Passing Interface (MPI), Python Bindings
libboost-mpi-python1.58.0 - C++ interface to the Message Passing Interface (MPI), Python Bindings
libboost-mpi1.58-dev - C++ interface to the Message Passing Interface (MPI)
libboost-mpi1.58.0 - C++ interface to the Message Passing Interface (MPI)

user@computer:~$sudo apt-get install libboost-mpi-dev # install the first one in the results  Afterwards, we can try to compile revbayes with the -mpi true flag (last compilation lines show for a positive case of successful compilation): user@computer:~/programs/revbayes/projects/cmake$ ./build.sh -mpi true
/home/user/programs/revbayes/projects/cmake/build
Building boost libraries
...
... # compilation takes some time and is quite verbose
...
[100%] Linking CXX static library librb-parser.a
[100%] Built target rb-parser
Scanning dependencies of target rb-mpi
[100%] Building CXX object CMakeFiles/rb-mpi.dir/home/balleng/programs/revbayes/src/revlanguage/main.cpp.o
[100%] Linking CXX executable ../rb-mpi
[100%] Built target rb-mpi


Then we can try to check whether the revbayes mpi can be found and then run it with rb-mpi:

user@computer:~$whereis rb-mpi rb-mpi: /home/user/programs/revbayes/projects/cmake/rb-mpi user@computer:~$ rb-mpi

RevBayes version (1.0.7)
Build from master (31efda) on Wed Apr 11 01:21:44 -03 2018