[CHNOSZ-commits] r126 - in pkg/CHNOSZ: . R inst vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 4 03:51:28 CET 2017


Author: jedick
Date: 2017-02-04 03:51:27 +0100 (Sat, 04 Feb 2017)
New Revision: 126

Added:
   pkg/CHNOSZ/vignettes/elementa.csl
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/basis.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/vignettes/EOSregress.Rmd
   pkg/CHNOSZ/vignettes/anintro.Rnw
   pkg/CHNOSZ/vignettes/anintro.lyx
   pkg/CHNOSZ/vignettes/newintro.Rmd
   pkg/CHNOSZ/vignettes/vig.bib
   pkg/CHNOSZ/vignettes/wjd.Rnw
   pkg/CHNOSZ/vignettes/wjd.lyx
Log:
work on newintro.Rmd; add elementa.csl


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-02-02 17:17:22 UTC (rev 125)
+++ pkg/CHNOSZ/DESCRIPTION	2017-02-04 02:51:27 UTC (rev 126)
@@ -1,6 +1,6 @@
-Date: 2017-02-02
+Date: 2017-02-04
 Package: CHNOSZ
-Version: 1.0.8-15
+Version: 1.0.8-16
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/basis.R
===================================================================
--- pkg/CHNOSZ/R/basis.R	2017-02-02 17:17:22 UTC (rev 125)
+++ pkg/CHNOSZ/R/basis.R	2017-02-04 02:51:27 UTC (rev 126)
@@ -27,7 +27,7 @@
   if( nrow(comp) < ncol(comp) ) stop("underdetermined system; square stoichiometric matrix needed")
   # the second test: matrix is invertible
   if(class(try(solve(comp), silent=TRUE))=='try-error') 
-    stop("singular stoichiometric matrix; invertible one needed")
+    stop("singular stoichiometric matrix")
   # store the basis definition in thermo$basis, including
   # both numeric and character data, so we need to use a data frame
   comp <- cbind(as.data.frame(comp), ispecies, logact, state, stringsAsFactors=FALSE)

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-02-02 17:17:22 UTC (rev 125)
+++ pkg/CHNOSZ/inst/NEWS	2017-02-04 02:51:27 UTC (rev 126)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.8-15 (2017-02-02)
+CHANGES IN CHNOSZ 1.0.8-16 (2017-02-04)
 ---------------------------------------
 
 - Add "AA" as a keyword for preset species in basis() (cysteine,

Modified: pkg/CHNOSZ/vignettes/EOSregress.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/EOSregress.Rmd	2017-02-02 17:17:22 UTC (rev 125)
+++ pkg/CHNOSZ/vignettes/EOSregress.Rmd	2017-02-04 02:51:27 UTC (rev 126)
@@ -19,6 +19,7 @@
   \usepackage[utf8]{inputenc}
 bibliography: vig.bib
 link-citations: yes
+csl: elementa.csl
 ---
 
 ```{r setup, include=FALSE}

Modified: pkg/CHNOSZ/vignettes/anintro.Rnw
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rnw	2017-02-02 17:17:22 UTC (rev 125)
+++ pkg/CHNOSZ/vignettes/anintro.Rnw	2017-02-04 02:51:27 UTC (rev 126)
@@ -1,8 +1,9 @@
-%% LyX 2.1.3 created this file.  For more info, see http://www.lyx.org/.
+%% LyX 2.2.2 created this file.  For more info, see http://www.lyx.org/.
 %% Do not edit unless you really know what you are doing.
 \documentclass[english,noae,round]{article}
 \usepackage{mathpazo}
 \usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
 \usepackage[letterpaper]{geometry}
 \geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
 \usepackage{color}
@@ -48,7 +49,6 @@
 
 \title{An introduction to CHNOSZ}
 
-
 \author{Jeffrey M. Dick}
 
 \maketitle
@@ -81,13 +81,12 @@
 species using very similar commands. Examples below are intended to
 demonstrate basic usage to new users.
 
-
 \subsection{Outline of workflow}
 
 CHNOSZ is made up of a set of functions and supporting datasets. The
 major components of the package are shown in the figure below, which
 is an updated version of the flowchart from \citet{Dic08} (boxes
--- functions; ellipses -- datasets; bold text -- major user functions).
+– functions; ellipses – datasets; bold text – major user functions).
 
 \includegraphics[bb=0bp 440bp 612bp 792bp,clip,width=0.75\columnwidth]{flowchart}
 
@@ -119,7 +118,6 @@
 results. The results can then be reproduced on demand by yourself
 or others with whom you might share your scripts.
 
-
 \subsection{Installing and loading CHNOSZ}
 
 If you have just installed R, and you are online, installing the CHNOSZ
@@ -150,7 +148,6 @@
 The rest of this document assumes that the CHNOSZ package and data
 are loaded.
 
-
 \section{Thermodynamic database}
 
 
@@ -168,7 +165,7 @@
 experimental. If there is any doubt about the accuracy or suitability
 of data for a particular problem, please \emph{consult the primary
 sources} (which can be located using \texttt{browse.refs()}; see Section
-\ref{sub:thermo_refs}). Do not assume that by adding any species
+\ref{subsec:thermo_refs}). Do not assume that by adding any species
 to your calculation (or to any of the examples), you will necessarily
 obtain a reasonable answer. Do not assume that the examples are correct,
 or that they can be applied to your problem. As with the data, please
@@ -219,7 +216,7 @@
 @
 
 
-\subsection{\texttt{\label{sub:thermo_refs}thermo\$refs}}
+\subsection{\texttt{\label{subsec:thermo_refs}thermo\$refs}}
 
 The thermodynamic data and other parameters used by the functions,
 as well as system definitions provided by the user in an interactive
@@ -329,7 +326,6 @@
 the first call to\texttt{ info()} just above had a side effect of
 adding the computed properties and parameters to \texttt{thermo\$obigt}.
 
-
 \section{Reaction properties}
 
 
@@ -362,7 +358,6 @@
 package uses a Fortran subroutine taken from SUPCRT for these calculations.
 See \texttt{help(water)} for more information.
 
-
 \subsection{A reaction}
 
 To calculate the properties of a reaction, enter the stoichiometric
@@ -404,7 +399,6 @@
 an unbalanced reaction). In the next section we'll see how to use
 another feature of CHNOSZ to automatically balance reactions.
 
-
 \section{Basis species}
 
 
@@ -425,6 +419,7 @@
 <<basis_not,eval=FALSE>>=
 basis(c("CO2","H2O","NH3","H2S","H+"))
 @
+
 \begin{lyxcode}
 Error~in~put.basis(basis,~mystates)~:~
 
@@ -450,7 +445,6 @@
 name. These represent the elements in the commonly-occurring amino
 acids, together with charge, denoted by ``Z''.
 
-
 \subsection{Auto-balancing a reaction}
 
 Now that the basis species are defined, try the unbalanced reaction
@@ -503,7 +497,6 @@
 coming up with a useful basis definition is in relating the species
 to observable quantities.
 
-
 \subsection{It works for proteins too!}
 
 Let's set the basis definition again, this time using a keyword that
@@ -588,7 +581,6 @@
 directory where CHNOSZ is installed) to change the calculation from
 calcite to $\mathrm{CO_{2}}$.
 
-
 \subsection{Stability diagram for proteins}
 
 Suppose that we are asked to calculate the relative stabilities of
@@ -622,8 +614,8 @@
 formation reactions. The chemical affinity is the negative of the
 Gibbs energy change of a reaction per unit of reaction progress; it
 is calculated in CHNOSZ using $\boldsymbol{A}=2.303RT\log(K/Q)$ ($R$
--- gas constant, $T$ -- temperature, $K$ -- equilibrium constant,
-$Q$ -- activity product).
+– gas constant, $T$ – temperature, $K$ – equilibrium constant, $Q$
+– activity product).
 
 \texttt{affinity()} can accept arguments describing the range of chemical
 conditions we're interested in. The names of the arguments can refer
@@ -654,7 +646,6 @@
 Notably, the protein from the organism found at the highest temperatures
 is relatively stable at more reduced conditions.
 
-
 \subsection{More proteins, more dimensions}
 
 Now let's add some bacterial surface-layer proteins. They are in some
@@ -720,7 +711,7 @@
 \setkeys{Gin}{width=1.0\textwidth}
 
 The 999's in the assignment of logarithms of activities of basis species
-could be any number -- these settings do not affect the outcome of
+could be any number – these settings do not affect the outcome of
 the calculation. This is so because 1) $\mathrm{HCl}$, $\mathrm{CO_{2}}$
 and $\mathrm{O_{2}}$ have zero stoichiometric coefficients in the
 species, 2) the activities of $\mathrm{Ca}^{+2}$ and $\mathrm{Mg}^{+2}$
@@ -743,7 +734,6 @@
 diagrams for organic and inorganic species. Try it for your favorite
 system!
 
-
 \section{Where to go from here}
 
 You can explore the package documentation through R's help system;
@@ -765,7 +755,7 @@
 Or you can use the following to run \emph{all} of the examples provided
 in the documentation for the package. You will see a lot of text fly
 by on the screen, as well as a variety of plots. The examples will
-take about 5--10 minutes to run, depending on your machine. 
+take about 5–10 minutes to run, depending on your machine. 
 
 <<examples,eval=FALSE>>=
 examples()
@@ -787,7 +777,6 @@
 
 Have fun!
 
-
 \section{More activity diagrams}
 
 The following pages contain activity diagrams created with more complex
@@ -815,7 +804,7 @@
 of difference.
 
 Toward the end of the script, points are added for Eh-pH values from
-soils \citep{BKM60} and hot springs in Yellowstone ($+$) \citep{SWM+05}
+soils \citep{BKM60} and hot springs in Yellowstone ($+$) \citep{SWM_05}
 and Iceland ($\blacktriangle$) \citep{SA02}. The symbols identifying
 the latter two sources were swapped in the figure caption of \citet{DLH06}.
 Finally legends are drawn to identify the lines and symbols. The \texttt{describe.property()}
@@ -851,7 +840,7 @@
 
 \subsection{Subcellular proteins}
 
-Localizations and abundances of proteins from YeastGFP \citep{HFG+03,GHB+03}
+Localizations and abundances of proteins from YeastGFP \citep{HFG_03,GHB_03}
 are used here to calculate an abundance-weighted average of amino
 acid compositions of proteins in different subcellular compartments
 of yeast. The relative stabilities of these 23 model proteins are
@@ -907,7 +896,7 @@
 both $\mathrm{S_{2}}$ and $\mathrm{O_{2}}$ by pyrite-pyrrhotite-magnetite,
 and the buffers have effects on equilibrium activity diagrams) while
 the latter is more convenient (no need to set up the buffer in \texttt{thermo\$buffer}
--- the buffers come from the species of interest). The plot below,
+– the buffers come from the species of interest). The plot below,
 based on Fig. 6 of \citet{SS95}, shows values of $\log f_{\mathrm{H_{2}}_{\left(g\right)}}$
 buffered by minerals and in equilibrium with different activities
 of organic species that are calculated using these two methods.
@@ -1065,7 +1054,6 @@
 it remains a matter of discussion what the optimized chemical activities
 of the basis species and the amino acids signify.
 
-
 \section{Document information}
 
 Revision history:

Modified: pkg/CHNOSZ/vignettes/anintro.lyx
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.lyx	2017-02-02 17:17:22 UTC (rev 125)
+++ pkg/CHNOSZ/vignettes/anintro.lyx	2017-02-04 02:51:27 UTC (rev 126)
@@ -1,7 +1,9 @@
-#LyX 2.1 created this file. For more info see http://www.lyx.org/
-\lyxformat 474
+#LyX 2.2 created this file. For more info see http://www.lyx.org/
+\lyxformat 508
 \begin_document
 \begin_header
+\save_transient_properties true
+\origin unavailable
 \textclass article
 \begin_preamble
 %\VignetteIndexEntry{An introduction to CHNOSZ}
@@ -17,18 +19,18 @@
 \maintain_unincluded_children false
 \language english
 \language_package default
-\inputencoding default
+\inputencoding utf8
 \fontencoding global
-\font_roman palatino
-\font_sans default
-\font_typewriter default
-\font_math auto
+\font_roman "palatino" "default"
+\font_sans "default" "default"
+\font_typewriter "default" "default"
+\font_math "auto" "auto"
 \font_default_family default
 \use_non_tex_fonts false
 \font_sc false
 \font_osf false
-\font_sf_scale 100
-\font_tt_scale 100
+\font_sf_scale 100 100
+\font_tt_scale 100 100
 \graphics default
 \default_output_format default
 \output_sync 0
@@ -211,7 +213,7 @@
 
 \end_inset
 
- (boxes -- functions; ellipses -- datasets; bold text -- major user functions).
+ (boxes – functions; ellipses – datasets; bold text – major user functions).
 \end_layout
 
 \begin_layout Standard
@@ -509,7 +511,7 @@
 ; see Section 
 \begin_inset CommandInset ref
 LatexCommand ref
-reference "sub:thermo_refs"
+reference "subsec:thermo_refs"
 
 \end_inset
 
@@ -738,7 +740,7 @@
 \family typewriter
 \begin_inset CommandInset label
 LatexCommand label
-name "sub:thermo_refs"
+name "subsec:thermo_refs"
 
 \end_inset
 
@@ -2196,7 +2198,7 @@
 
 \begin_layout Standard
 \begin_inset Branch stuff
-status collapsed
+status open
 
 \begin_layout Standard
 \begin_inset ERT
@@ -2501,19 +2503,19 @@
 \begin_inset Formula $R$
 \end_inset
 
- -- gas constant, 
+ – gas constant, 
 \begin_inset Formula $T$
 \end_inset
 
- -- temperature, 
+ – temperature, 
 \begin_inset Formula $K$
 \end_inset
 
- -- equilibrium constant, 
+ – equilibrium constant, 
 \begin_inset Formula $Q$
 \end_inset
 
- -- activity product).
+ – activity product).
 \end_layout
 
 \begin_layout Standard
@@ -2970,8 +2972,8 @@
 
 \begin_layout Standard
 The 999's in the assignment of logarithms of activities of basis species
- could be any number -- these settings do not affect the outcome of the
- calculation.
+ could be any number – these settings do not affect the outcome of the calculati
+on.
  This is so because 1) 
 \begin_inset Formula $\mathrm{HCl}$
 \end_inset
@@ -3137,7 +3139,7 @@
  of the examples provided in the documentation for the package.
  You will see a lot of text fly by on the screen, as well as a variety of
  plots.
- The examples will take about 5--10 minutes to run, depending on your machine.
+ The examples will take about 5–10 minutes to run, depending on your machine.
  
 \end_layout
 
@@ -3398,7 +3400,7 @@
 ) 
 \begin_inset CommandInset citation
 LatexCommand citep
-key "SWM+05"
+key "SWM_05"
 
 \end_inset
 
@@ -3617,7 +3619,7 @@
 Localizations and abundances of proteins from YeastGFP 
 \begin_inset CommandInset citation
 LatexCommand citep
-key "HFG+03,GHB+03"
+key "HFG_03,GHB_03"
 
 \end_inset
 
@@ -3870,7 +3872,7 @@
 \family typewriter
 thermo$buffer
 \family default
- -- the buffers come from the species of interest).
+ – the buffers come from the species of interest).
  The plot below, based on Fig.
  6 of 
 \begin_inset CommandInset citation

Added: pkg/CHNOSZ/vignettes/elementa.csl
===================================================================
--- pkg/CHNOSZ/vignettes/elementa.csl	                        (rev 0)
+++ pkg/CHNOSZ/vignettes/elementa.csl	2017-02-04 02:51:27 UTC (rev 126)
@@ -0,0 +1,453 @@
+<?xml version="1.0" encoding="utf-8"?>
+<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US">
+  <info>
+    <title>Elementa</title>
+    <title-short>Elementa</title-short>
+    <id>http://www.zotero.org/styles/elementa</id>
+    <link href="http://www.zotero.org/styles/elementa" rel="self"/>
+    <link href="http://www.zotero.org/styles/council-of-science-editors-author-date" rel="template"/>
+    <link href="http://www.zotero.org/styles/apa" rel="template"/>
+    <link href="https://home.elementascience.org/for-authors/style-guide/" rel="documentation"/>
+    <link href="http://lynn-library.libguides.com/cse" rel="documentation"/>
+    <link href="http://writing.wisc.edu/Handbook/DocCSE_CitationSystems.html" rel="documentation"/>
+    <author>
+      <name>Akos Kokai</name>
+      <email>akokai at berkeley.edu</email>
+    </author>
+    <category citation-format="author-date"/>
+    <category field="science"/>
+    <eissn>2325-1026</eissn>
+    <summary>Based on The Council of Science Editors style, Name-Year system: author-date in text, sorted in alphabetical order by author.</summary>
+    <updated>2016-07-26T01:00:00+00:00</updated>
+    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
+  </info>
+  <locale xml:lang="en">
+    <terms>
+      <term name="editortranslator" form="long">
+        <single>editor and translator</single>
+        <multiple>editors and translators</multiple>
+      </term>
+      <term name="collection-editor" form="long">
+        <single>editor</single>
+        <multiple>editors</multiple>
+      </term>
+      <term name="no date">n.d.</term>
+    </terms>
+  </locale>
+  <macro name="author">
+    <names variable="author" delimiter="; ">
+      <name name-as-sort-order="all" sort-separator=" " initialize-with="" delimiter=", " delimiter-precedes-last="always"/>
+      <label form="long" prefix=", " strip-periods="true"/>
+      <substitute>
+        <names variable="editor translator"/>
+        <names variable="editor"/>
+        <names variable="collection-editor"/>
+        <names variable="translator"/>
+        <choose>
+          <if type="report">
+            <text variable="publisher"/>
+            <text macro="title"/>
+          </if>
+          <else>
+            <text macro="title"/>
+          </else>
+        </choose>
+      </substitute>
+    </names>
+  </macro>
+  <macro name="author-short">
+    <names variable="author">
+      <name form="short" delimiter=", " initialize-with="" and="text"/>
+      <substitute>
+        <names variable="editor"/>
+        <names variable="collection-editor"/>
+        <names variable="translator"/>
+        <choose>
+          <if type="report">
+            <text variable="publisher"/>
+            <text macro="title"/>
+          </if>
+          <else>
+            <text macro="title"/>
+          </else>
+        </choose>
+      </substitute>
+    </names>
+  </macro>
+  <macro name="container-contributors">
+    <names variable="editor translator" delimiter="; ">
+      <name delimiter-precedes-last="always" initialize-with="" name-as-sort-order="all" sort-separator=" "/>
+      <label prefix=", "/>
+    </names>
+  </macro>
+  <macro name="year">
+    <choose>
+      <if variable="issued">
+        <date variable="issued" delimiter=" ">
+          <date-part name="year"/>
+        </date>
+      </if>
+      <else>
+        <text term="no date"/>
+      </else>
+    </choose>
+  </macro>
+  <macro name="year-date">
+    <choose>
+      <if variable="issued">
+        <group delimiter=" ">
+          <date variable="issued" delimiter=" ">
+            <date-part name="year"/>
+          </date>
+          <choose>
+            <if type="patent article-newspaper webpage" match="any">
+              <date variable="issued" delimiter=" ">
+                <date-part name="month" form="short" strip-periods="true"/>
+                <date-part name="day"/>
+              </date>
+            </if>
+            <else-if type="article-journal article-magazine" match="any">
+              <choose>
+                <if variable="volume issue" match="none">
+                  <date variable="issued" delimiter=" ">
+                    <date-part name="month" form="short" strip-periods="true"/>
+                    <date-part name="day"/>
+                  </date>
+                </if>
+              </choose>
+            </else-if>
+          </choose>
+        </group>
+      </if>
+      <else>
+        <text term="no date"/>
+      </else>
+    </choose>
+  </macro>
+  <macro name="title">
+    <group delimiter=" ">
+      <choose>
+        <if type="book">
+          <text variable="title" font-style="italic" text-case="title"/>
+        </if>
+        <else>
+          <text variable="title"/>
+        </else>
+      </choose>
+      <choose>
+        <if type="thesis dataset speech interview broadcast" match="any">
+          <text variable="genre" form="long" prefix="[" suffix="]"/>
+        </if>
+      </choose>
+      <choose>
+        <!-- Book reviews -->
+        <if variable="reviewed-author">
+          <choose>
+            <if variable="reviewed-title">
+              <group delimiter=" ">
+                <text variable="title"/>
+                <group delimiter=", " prefix="[" suffix="]">
+                  <text variable="reviewed-title" font-style="italic" prefix="Review of "/>
+                  <names variable="reviewed-author" delimiter=", ">
+                    <label form="verb-short" suffix=" "/>
+                    <name and="text" initialize-with="" delimiter=", "/>
+                  </names>
+                </group>
+              </group>
+            </if>
+            <else>
+              <!-- assume `title` is title of reviewed work -->
+              <group delimiter=", " prefix="[" suffix="]">
+                <text variable="title" font-style="italic" prefix="Review of "/>
+                <names variable="reviewed-author" delimiter=", ">
+                  <label form="verb-short" suffix=" "/>
+                  <name and="text" initialize-with="" delimiter=", "/>
+                </names>
+              </group>
+            </else>
+          </choose>
+        </if>
+      </choose>
+    </group>
+  </macro>
+  <macro name="container-title">
+    <choose>
+      <if type="chapter">
+        <text variable="container-title" font-style="italic" text-case="title"/>
+      </if>
+      <else-if type="article-magazine article-newspaper">
+        <text variable="container-title" font-style="italic"/>
+      </else-if>
+      <else-if type="article-journal">
+        <text variable="container-title" form="short" font-style="italic" strip-periods="true"/>
+      </else-if>
+      <else>
+        <text variable="container-title"/>
+      </else>
+    </choose>
+  </macro>
+  <macro name="container">
+    <group>
+      <choose>
+        <if type="chapter entry-dictionary entry-encyclopedia" match="any">
+          <text term="in" text-case="capitalize-first" suffix=": "/>
+        </if>
+      </choose>
+      <choose>
+        <if type="bill legal_case legislation" match="none">
+          <group delimiter=". ">
+            <text macro="container-contributors"/>
+            <text macro="container-title"/>
+          </group>
+        </if>
+      </choose>
+    </group>
+  </macro>
+  <macro name="edition">
+    <choose>
+      <if is-numeric="edition">
+        <group delimiter=" ">
+          <number variable="edition" form="ordinal"/>
+          <label variable="edition" form="short"/>
+        </group>
+      </if>
+      <else>
+        <text variable="edition"/>
+      </else>
+    </choose>
+  </macro>
+  <macro name="pages">
+    <choose>
+      <if type="chapter entry-dictionary entry-encyclopedia" match="any">
+        <group delimiter="; ">
+          <group>
+            <label variable="page" form="short" suffix=" " plural="never"/>
+            <text variable="page"/>
+          </group>
+          <group>
+            <text variable="number-of-pages"/>
+            <choose>
+              <if is-numeric="number-of-pages">
+                <label variable="number-of-pages" form="short" prefix=" " plural="never"/>
+              </if>
+            </choose>
+          </group>
+        </group>
+      </if>
+    </choose>
+  </macro>
+  <macro name="journal-locators">
+    <group suffix=".">
+      <choose>
+        <if variable="volume issue page" match="none">
+          <choose>
+            <if type="article-journal review review-book">
+              <text term="in press" prefix=", "/>
+            </if>
+          </choose>
+        </if>
+        <else>
+          <group>
+            <text variable="volume" prefix=" " font-weight="bold"/>
+            <text variable="issue" prefix="(" suffix=")"/>
+            <text variable="page" prefix=": "/>
+          </group>
+        </else>
+      </choose>
+    </group>
+  </macro>
+  <macro name="locators">
+    <choose>
+      <if type="article-journal article-magazine article-newspaper review review-book" match="any">
+        <text macro="journal-locators"/>
+      </if>
+      <else-if type="paper-conference">
+        <choose>
+          <if variable="container-title">
+            <text macro="journal-locators"/>
+          </if>
+          <else>
+            <date variable="issued" delimiter=" " suffix=".">
+              <date-part name="year"/>
+              <date-part name="month" form="short" strip-periods="true"/>
+              <date-part name="day"/>
+            </date>
+          </else>
+        </choose>
+      </else-if>
+      <else-if type="bill legal_case legislation" match="none">
+        <text macro="edition" suffix="."/>
+      </else-if>
+    </choose>
+  </macro>
+  <macro name="legal-cites">
+    <!-- Bluebook style; adapted from apa.csl -->
+    <choose>
+      <if type="bill legal_case legislation" match="any">
+        <group delimiter=" ">
+          <choose>
+            <if variable="container-title">
+              <text variable="volume"/>
+              <text variable="container-title"/>
+              <group delimiter=" ">
+                <!--change to label variable="section" as that becomes available -->
+                <text term="section" form="symbol"/>
+                <text variable="section"/>
+              </group>
+              <text variable="section"/>
+              <text variable="page"/>
+            </if>
+            <else>
+              <choose>
+                <if type="legal_case">
+                  <text variable="number" prefix="No. "/>
+                </if>
+                <else>
+                  <text variable="number" prefix="Pub. L. No. "/>
+                  <group delimiter=" ">
+                    <!--change to label variable="section" as that becomes available -->
+                    <text term="section" form="symbol"/>
+                    <text variable="section"/>
+                  </group>
+                  <text variable="section"/>
+                </else>
+              </choose>
+            </else>
+          </choose>
+        </group>
+      </if>
+    </choose>
+  </macro>
+  <macro name="event">
+    <choose>
+      <if variable="event">
+        <choose>
+          <if variable="container-title" match="none">
+            <!-- Don't give event info if part of a publication
+               (e.g., conference proceedings) -->
+            <choose>
+              <if type="paper-conference" match="none">
+                <group delimiter=" ">
+                  <text variable="genre" text-case="capitalize-first"/>
+                  <text term="presented at" text-case="capitalize-first"/>
+                </group>
+              </if>
+            </choose>
+            <group prefix=" " suffix="." delimiter="; ">
+              <text variable="event"/>
+              <text variable="event-place"/>
+            </group>
+          </if>
+        </choose>
+      </if>
+    </choose>
+  </macro>
+  <macro name="publisher">
+    <group delimiter=": ">
+      <choose>
+        <if type="thesis">
+          <text variable="publisher-place" prefix="[" suffix="]"/>
+        </if>
+        <else-if variable="event" match="none">
+          <text variable="publisher-place"/>
+        </else-if>
+      </choose>
+      <text variable="publisher"/>
+    </group>
+  </macro>
+  <macro name="collection">
+    <!-- This is to appear at the end of the citation:
+         after publisher, before access. -->
+    <choose>
+      <if type="report">
+        <group prefix=" " suffix="." delimiter=" ">
+          <text variable="collection-title"/>
+          <text variable="number" prefix="Report No.: "/>
+        </group>
+      </if>
+      <else-if type="book">
+        <group prefix=" (" suffix=")." delimiter=" ">
+          <names variable="collection-editor" suffix=". ">
+            <name delimiter-precedes-last="always" initialize-with="" name-as-sort-order="all" sort-separator=" "/>
+            <label prefix="; "/>
+          </names>
+          <group delimiter="; ">
+            <text variable="collection-title"/>
+            <choose>
+              <if variable="collection-number">
+                <group>
+                  <text term="volume" form="short" text-case="capitalize-first" suffix=". "/>
+                  <text variable="collection-number"/>
+                </group>
+              </if>
+              <else>
+                <group>
+                  <label variable="volume" form="short" text-case="capitalize-first" suffix=". "/>
+                  <text variable="volume"/>
+                </group>
+              </else>
+            </choose>
+          </group>
+        </group>
+      </else-if>
+      <!-- Add other types that need collection info after publisher. -->
+    </choose>
+  </macro>
+  <macro name="access">
+    <choose>
+      <if variable="DOI">
+        <text variable="DOI" prefix="doi: "/>
+      </if>
+      <else-if variable="URL">
+        <group suffix=". " delimiter=" ">
+          <text term="available at" text-case="capitalize-first"/>
+          <text variable="URL"/>
+        </group>
+        <group suffix=". " delimiter=" ">
+          <text term="accessed" text-case="capitalize-first"/>
+          <date variable="accessed" delimiter=" ">
+            <date-part name="year"/>
+            <date-part name="month" form="short" strip-periods="true"/>
+            <date-part name="day"/>
+          </date>
+        </group>
+      </else-if>
+    </choose>
+  </macro>
+  <citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true">
+    <sort>
+      <key macro="year-date"/>
+      <key macro="author-short"/>
+    </sort>
+    <layout prefix="(" suffix=")" delimiter="; ">
+      <group delimiter=", ">
+        <text macro="author-short"/>
+        <text macro="year"/>
+      </group>
+      <text variable="locator" prefix=": "/>
+    </layout>
+  </citation>
+  <bibliography hanging-indent="true" et-al-min="11" et-al-use-first="10">
+    <sort>
+      <key macro="author"/>
+      <key macro="year-date"/>
+    </sort>
+    <layout>
+      <group delimiter=". " suffix=".">
+        <text macro="author"/>
+        <text macro="year-date"/>
+        <text macro="title"/>
+        <group delimiter="">
+          <text macro="container"/>
+          <text macro="locators"/>
+        </group>
+        <text macro="legal-cites"/>
+        <text macro="event"/>
+        <text macro="publisher"/>
+        <text macro="pages"/>
+        <text macro="collection"/>
+      </group>
+      <text prefix=" " macro="access"/>
+    </layout>
+  </bibliography>
+</style>

Modified: pkg/CHNOSZ/vignettes/newintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/newintro.Rmd	2017-02-02 17:17:22 UTC (rev 125)
+++ pkg/CHNOSZ/vignettes/newintro.Rmd	2017-02-04 02:51:27 UTC (rev 126)
@@ -19,6 +19,7 @@
   \usepackage[utf8]{inputenc}
 bibliography: vig.bib
 link-citations: yes
+csl: elementa.csl
 ---
 
 ```{r options, include=FALSE}
@@ -31,8 +32,11 @@
 knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
 options(htmltools.dir.version = FALSE)
 knitr::knit_hooks$set(small.mar = function(before, options, envir) {
-    if (before) par(mar = c(4, 4, .1, .1))  # smaller margin on top and right
+    if (before) par(mar = c(4.2, 4.2, .1, .1))  # smaller margin on top and right
 })
+knitr::knit_hooks$set(tiny.mar = function(before, options, envir) {
+    if (before) par(mar = c(.1, .1, .1, .1))  # tiny margin all around
+})
 ```
 
 # About
@@ -47,7 +51,7 @@
 
 ## Installing and loading CHNOSZ
 
-If you have just installed R for the first time, and you have an internet connection, installing CHNOSZ should be as simple as selecting the "Install packages from CRAN" or similar menu item in the R GUI or using the following command to start the package installation process:^[Or, install the package from a local package file, which you can download from [CRAN](http://cran.r-project.org) or from the [CHNOSZ website](http://chnosz.net).
+If you have just installed R for the first time, and you have an Internet connection, installing CHNOSZ should be as simple as selecting the "Install packages from CRAN" or similar menu item in the R GUI or using the following command to start the package installation process:^[Or, install the package from a local package file, which you can download from [CRAN](http://cran.r-project.org) or from the [CHNOSZ website](http://chnosz.net).
 ][]()
 ```{r install_CHNOSZ, eval=FALSE}
 install.packages("CHNOSZ")
@@ -239,7 +243,7 @@
 ```
 
 <p> <!--- needed to make the citation appear correction 20170202 -->
-In order to make a plot like that shown by Manning et al. [- at MSS13, Figure 18], let's run more calculations and store the results.
+In order to make a plot like Figure 18 of @MSS13, let's run more calculations and store the results.
 In addition to the reaction definition, we specify a greater number of temperature points than the default:
 ```{r dissolution, echo=FALSE, message=FALSE}
 T <- seq(0, 350, 10)
@@ -262,15 +266,149 @@
 
 ## Unbalanced reactions
 
+A balanced chemical reaction conserves mass.
+`subcrt()` won't stop you from running an unbalanced reaction, but it will give you a warning:
+```{r subcrt_unbalanced, results="hide"}
+subcrt(c("CO2", "CH4"), c(-1, 1))
+```
+
+In other words, to balance the reaction, we should add exactly 4 H to the left and 2 O to the right.
+That could be done manually be redefining the reaction with the appropriate species.
+There is another option: balancing the reaction automatically using basis species.
+
 ## Setting the basis species
 
+_Basis species_ are a minimal number of chemical species that represent the compositional variation in a system.
+The basis species are similar to thermodynamic components, but can include charged species. 
+You might want to use basis species to automatically balance reactions.
+A basis setting is also required for making chemical activity diagrams.
+
+Let's start with an example that **doesn't** work:
+```{r basis_singular, error=TRUE}
+basis(c("CO2", "H2", "H2CO2"))
+```
+
+That set of species has a singular (non-invertible) stoichiometric matrix.
+An error would also result from either an underdetermined or overdetermined system.
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/chnosz -r 126


More information about the CHNOSZ-commits mailing list