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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 14 11:53:33 CET 2023


Author: jedick
Date: 2023-11-14 11:53:32 +0100 (Tue, 14 Nov 2023)
New Revision: 809

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/subcrt.R
   pkg/CHNOSZ/inst/tinytest/test-subcrt.R
   pkg/CHNOSZ/vignettes/FAQ.Rmd
   pkg/CHNOSZ/vignettes/OBIGT.Rmd
   pkg/CHNOSZ/vignettes/anintro.Rmd
   pkg/CHNOSZ/vignettes/custom_data.Rmd
   pkg/CHNOSZ/vignettes/eos-regress.Rmd
   pkg/CHNOSZ/vignettes/multi-metal.Rmd
Log:
Update FAQ for what is T in OBIGT


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2023-11-14 02:47:44 UTC (rev 808)
+++ pkg/CHNOSZ/DESCRIPTION	2023-11-14 10:53:32 UTC (rev 809)
@@ -1,6 +1,6 @@
 Date: 2023-11-14
 Package: CHNOSZ
-Version: 2.0.0-28
+Version: 2.0.0-29
 Title: Thermodynamic Calculations and Diagrams for Geochemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/R/subcrt.R
===================================================================
--- pkg/CHNOSZ/R/subcrt.R	2023-11-14 02:47:44 UTC (rev 808)
+++ pkg/CHNOSZ/R/subcrt.R	2023-11-14 10:53:32 UTC (rev 809)
@@ -352,24 +352,24 @@
         # Name and state
         myname <- reaction$name[i]
         mystate <- reaction$state[i]
-        # If we are considering multiple polymorphs, and if this polymorph is cr2 or higher, check if we're below the transition temperature
-        if(length(iphases) > length(ispecies) & i > 1) {
-          if(!(reaction$state[i] %in% c("liq", "cr", "gas")) & reaction$name[i-1] == reaction$name[i]) {
-            # After add.OBIGT("SUPCRT92"), quartz cr and cr2 are not next to each other in thermo()$OBIGT,
-            # so use iphases[i-1] here, not iphases[i]-1  20181107
-            Ttr <- Ttr(iphases[i-1], iphases[i], P = P, dPdT = dPdTtr(iphases[i-1], iphases[i]))
-            if(all(is.na(Ttr))) next
-            if(any(T <= Ttr)) {
-              status.Ttr <- "(extrapolating G)"
-              if(!exceed.Ttr) {
-                # put NA into the value of G
-                p.cgl[[ncgl[i]]]$G[T <= Ttr] <- NA
-                status.Ttr <- "(using NA for G)"
-              } 
-              #message(paste("subcrt: some points below transition temperature for", myname, mystate, status.Ttr))
-            }
-          }
-        }
+#        # If we are considering multiple polymorphs, and if this polymorph is cr2 or higher, check if we're below the transition temperature
+#        if(length(iphases) > length(ispecies) & i > 1) {
+#          if(!(reaction$state[i] %in% c("liq", "cr", "gas")) & reaction$name[i-1] == reaction$name[i]) {
+#            # After add.OBIGT("SUPCRT92"), quartz cr and cr2 are not next to each other in thermo()$OBIGT,
+#            # so use iphases[i-1] here, not iphases[i]-1  20181107
+#            Ttr <- Ttr(iphases[i-1], iphases[i], P = P, dPdT = dPdTtr(iphases[i-1], iphases[i]))
+#            if(all(is.na(Ttr))) next
+#            if(any(T <= Ttr)) {
+#              status.Ttr <- "(extrapolating G)"
+#              if(!exceed.Ttr) {
+#                # put NA into the value of G
+#                p.cgl[[ncgl[i]]]$G[T <= Ttr] <- NA
+#                status.Ttr <- "(using NA for G)"
+#              } 
+#              #message(paste("subcrt: some points below transition temperature for", myname, mystate, status.Ttr))
+#            }
+#          }
+#        }
         # Check if we're above the temperature limit or transition temperature
         # T limit (or Ttr) from the database
         warn.above <- TRUE
@@ -385,13 +385,12 @@
         }
         if(any(is.na(Ttr))) next
         if(!all(Ttr == 0) & any(T > Ttr)) {
-          status.Ttr <- "(extrapolating G)"
           if(!exceed.Ttr) {
             p.cgl[[ncgl[i]]]$G[T > Ttr] <- NA
-            status.Ttr <- "(using NA for G)"
+            if(warn.above) message(paste0("subcrt: G is shown as NA for ", myname, "(", mystate, ") above its transition temperature of ", Ttr, " K (use exceed.Ttr = TRUE to output G)"))
+          } else {
+            if(warn.above) message(paste0("subcrt: extrapolating G for ", myname, "(", mystate, ") above its transition temperature of ", Ttr, " K (use exceed.Ttr = FALSE to prevent this)"))
           }
-          Tmax <- min(T[T > Ttr])
-          if(warn.above) message(paste("subcrt: temperature(s) of", Tmax, "K and above exceed limit for", myname, mystate, status.Ttr))
         }
         # Use variable-pressure standard Gibbs energy for gases if varP is TRUE (not the default)
         if(mystate == "gas" & thermo$opt$varP) p.cgl[[ncgl[i]]]$G <- p.cgl[[ncgl[i]]]$G - convert(log10(P), "G", T = T)

Modified: pkg/CHNOSZ/inst/tinytest/test-subcrt.R
===================================================================
--- pkg/CHNOSZ/inst/tinytest/test-subcrt.R	2023-11-14 02:47:44 UTC (rev 808)
+++ pkg/CHNOSZ/inst/tinytest/test-subcrt.R	2023-11-14 10:53:32 UTC (rev 809)
@@ -54,7 +54,7 @@
 
 info <- "Phase transitions of minerals give expected messages and results"
 iacanthite <- info("acanthite", "cr2")
-expect_message(subcrt(iacanthite), "subcrt: temperature\\(s\\) of 623.15 K and above exceed limit for acanthite cr2 \\(using NA for G\\)", info = info)
+expect_message(subcrt(iacanthite), "subcrt: G is shown as NA for acanthite\\(cr2\\)", info = info)
 expect_equal(subcrt("acanthite")$out$acanthite$polymorph, c(1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3), info = info)
 # The reaction coefficients in the output should be unchanged 20171214
 expect_equal(subcrt(c("bunsenite", "nickel", "oxygen"), c(-1, 1, 0.5))$reaction$coeff, c(-1, 1, 0.5), info = info) 

Modified: pkg/CHNOSZ/vignettes/FAQ.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/FAQ.Rmd	2023-11-14 02:47:44 UTC (rev 808)
+++ pkg/CHNOSZ/vignettes/FAQ.Rmd	2023-11-14 10:53:32 UTC (rev 809)
@@ -128,6 +128,35 @@
 )
 ```
 
+```{r echo = F, cache = F}
+# Merge consecutive messages into a single div 20231114
+knitr::knit_hooks$set(document = function(x){
+
+  # Not sure why this is needed, but simply computing on 'x' doesn't work
+  file <- tempfile()
+  writeLines(x, file)
+  x <- readLines(file)
+
+  # Line numbers of the document with </div>
+  enddiv <- which(x == "</div>")
+  # Line numbers with <div class="alert alert-info">
+  beginalert <- which(x == '<div class="alert alert-info">')
+  # Find </div> followed <div class="alert alert-info"> (skip empty lines)
+  removediv <- (enddiv + 2) %in% beginalert
+  if(any(removediv)) {
+    # Lines to remove
+    rmlines1 <- enddiv[removediv]
+    rmlines2 <- enddiv[removediv] + 1
+    rmlines3 <- enddiv[removediv] + 2
+    # Do the removing
+    x <- x[-c(rmlines1, rmlines2, rmlines3)]
+  }
+
+  x
+
+})
+```
+
 ```{r HTML, include = FALSE}
 NOTE <- '<span style="background-color: yellow;">NOTE</span>'
 # CHNOSZ functions
@@ -275,7 +304,7 @@
 ```
 </div>
 
-```{r DEW_Ctot, echo = FALSE, message = FALSE, results = "hide", fig.width = 8, fig.height = 4, out.width = "100%", fig.align = "center", pngquant = pngquant}
+```{r DEW_Ctot, echo = FALSE, message = FALSE, results = "hide", fig.width = 8, fig.height = 4, out.width = "100%", fig.align = "center", pngquant = pngquant, cache = TRUE}
 ```
 
 *Answered on 2023-05-17.*
@@ -615,41 +644,64 @@
 
 Here are the three plots that we made:
 
-```{r trisulfur, echo = FALSE, message = FALSE, results = "hide", fig.width = 10, fig.height = 3.33, out.width = "100%", out.extra='class="full-width"', pngquant = pngquant}
+```{r trisulfur, echo = FALSE, message = FALSE, results = "hide", fig.width = 10, fig.height = 3.33, out.width = "100%", out.extra='class="full-width"', pngquant = pngquant, cache = TRUE}
 ```
 
 *Answered on 2023-09-08.*
 
-### What is purpose of the "T" column for minerals and solid and liquid organic species?
+## In OBIGT, what is the meaning of `T` for minerals and solid and liquid organic species?
 
-The purposes of this column are 1) to list the temperature(s) of transition(s) between polymorphs of a mineral (^) and 2) to indicate the temperature above which a phase is not stable (i.e., melting of a solid or vaporization of a liquid).
-This column does not list the T limit for the Maier-Kelley equation (see Historical Remarks below).
+This column lists 1) the temperature(s) of transition(s) between polymorphs of a mineral or 2) for the highest-temperature polymorph, the temperature above which the phase is not stable (i.e., melting or decomposition of a solid or vaporization of a liquid).
+This column does not list the *T* limit for the Maier-Kelley equation (see Historical Remarks below).
 
-These cases are handled by subcrt() as follows (note that the units of T in the OBIGT database are Kelvin, but subcrt() by default uses °C):
-- For polymorphic transitions, the properties of specific polymorphs are returned:
+These cases are handled by `subcrt()` as follows (the units of `T` in OBIGT are Kelvin, but `subcrt()` by default uses °C):
 
-(^) In both SUPCRT92 and OBIGT, quicksilver, tin, sulfur, and selenium are each listed as minerals with one or more polymorphic transitions, but the highest-temperature polymorph actually represents the liquid state.
+1. For polymorphic transitions, the properties of specific polymorphs are returned:
 
-- For phase transitions, G of the requested phase is set to NA above the transition temperature:
+```{r pyrrhotite_polymorphs, collapse = TRUE}
+subcrt("pyrrhotite", T = c(25, 150, 350), property = "G")$out
+```
 
-- If T for a phase is set to NA, then no upper temerature limit is imposed by subcrt().
+Note: In both SUPCRT92 and OBIGT, quicksilver, tin, sulfur, and selenium are listed as minerals with one or more polymorphic transitions, but the highest-temperature polymorph actually represents the liquid state.
 
-Historial Remarks:
-Data for minerals from Helgeson et al. (1978) are provided in the default OBIGT database (if they don't conflict with Berman (1988)) and optional SUPCRT92 database.
+2. For melting or other phase change, G of the low-temperature phase is set to NA above the transition temperature:
+
+The purpose of this behavior is to make it harder to obtain potentially unreliable results at temperatures higher than listed transition temperatures.
+If you want `subcrt()` to output the extrapolated Δ*G*°~*f*~ of a phase above its listed transition temperature, then add `exceed.Ttr = TRUE` to the function call.
+
+```{r pyrite_limit}
+subcrt("pyrite", T = seq(200, 1000, 200), P = 1)
+```
+
+3. Finally, if `T` for a phase is set to NA, then no upper temerature limit is imposed by `subcrt()`.
+
+
+Historical Remarks:
+Data for minerals from @HDNB78 are provided in the default OBIGT database (if they don't conflict with @Ber88) and optional SUPCRT92 database.
 The original SUPCRT92 package included "Tmax" values to indicate the (estimated) maximum temperature of validity of the Maier-Kelley equation for heat capacity.
 Calculations at temperatures higher than Tmax produced the warning "CAUTION: BEYOND T LIMIT OF CP COEFFS FOR A MINERAL OR GAS", but the calculated values of thermodynamnic properties were still output by SUPCRT92.
 It follows that "Tmax" in SUPCRT92 does not necessarily correspond to the melting or decomposition temperature of the mineral.
 Except as described below, Tmax values have been *removed* from OBIGT in the development version of CHNOSZ, with the result that subcrt() no longer imposes an uppper temperature limit for the majority of minerals.
 
-OBIGT's T column non-exhaustively lists melting temperatures for minerals, some of which were taken from SUPCRT92's Tmax values while others were taken from RH95 or other sources.
-The minerals with available temperatures of melting (or decomposition or other phase transition, not including polymorphs) include anhydrite, bunsenite, bromellite, chalcocite, chlorargyrite, cinnabar, copper, covellite, cuprite, galena, gold, halite, iron, nickel, pyrite, pyrrhotite, silver, sphalerite, strontianite, sylvite, cassiterite, uraninite, zincite, manganosite, wustite, cobalt monoxide, and zinc.
-Many organic solids and liquids have melting and vaporization temperatures listed as well.
-However, no melting temperatures are listed for minerals represented by the Berman (1988) equations.
+OBIGT has a non-exhaustive list of temperatures of melting (or decomposition or other phase change), some of which were taken from SUPCRT92 while others were taken from @RH95 or other sources.
+These minerals are listed below:
 
-If subcrt() is run at temperatures above the melting or vaporization temperature, then values of G and logK are reported as NA and a message is produced (e.g. "XXX").
-This is a design decision that is intended to discourage the user from choosing unrealistic physical states.
-If you want to calculate the extrapolated properties of a phase above its listed transition temperature, then set exceed.Ttr to TRUE.
+```{r mineral_Ttr, collapse = TRUE}
+file <- system.file("extdata/OBIGT/inorganic_cr.csv", package = "CHNOSZ")
+dat <- read.csv(file)
+# Reverse rows so highest-T polymorph for each mineral is listed first
+dat <- dat[nrow(dat):1, ]
+# Remove low-T polymorphs
+dat <- dat[!duplicated(dat$name), ]
+# Keep minerals with T of phase change
+dat <- dat[!is.na(dat$z.T), ]
+# Get names of minerals and put into original order
+rev(dat$name)
+```
 
+Many organic solids and liquids have melting or vaporization temperatures listed as well.
+However, no melting temperatures are listed for minerals that use the `Berman` model.
+
 In general, the removal of Tmax values from SUPCRT92 makes CHNOSZ more permissive with respect to the temperature range of calculations.
 However, OBIGT now uses the decomposition temperature of covellite (780 K from Robie and Hemingway, 1995) in contrast to the previous Tmax from SUPCRT92 (1273 K, which is referenced to an "estimated" Cp equation on p. 62 of Kelley (1960)).
 

Modified: pkg/CHNOSZ/vignettes/OBIGT.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/OBIGT.Rmd	2023-11-14 02:47:44 UTC (rev 808)
+++ pkg/CHNOSZ/vignettes/OBIGT.Rmd	2023-11-14 10:53:32 UTC (rev 809)
@@ -8,7 +8,7 @@
   %\VignetteEngine{knitr::rmarkdown}
   %\VignetteEncoding{UTF-8}
 bibliography: OBIGT.bib
-# so that these appear in the bibliography
+# So that these appear in the bibliography
 nocite: | 
   @SPRONS92, @SLOP98, @SLOP07, @SLOP16, @JOH92, @WP02, @CWM89, @PRPG97, @TH88, @Kul06, @Sho09, @HKF81
 csl: elementa.csl
@@ -105,15 +105,15 @@
 ```
 
 ```{r setfile, include=FALSE}
-# assign the file name to a variable and print the file name and number of species
+# Assign the file name to a variable and print the file name and number of species
 setfile <- function(csvfile, dat=NULL) {
-  # assign csvfile outside this function
+  # Assign csvfile outside this function
   assign("csvfile", csvfile, parent.frame())
   file <- system.file(paste0("extdata/OBIGT/", csvfile), package="CHNOSZ")
   dat <- read.csv(file, as.is=TRUE)
-  ## exclude entries for phase transitions
+  ## Exclude entries for phase transitions
   #dat <- dat[!dat$state %in% c("cr2", "cr3", "cr4", "cr5", "cr6", "cr7", "cr8", "cr9"), ]
-  # the state and class of substance (used as section header), followed by number of species
+  # The state and class of substance (used as section header), followed by number of species
   basename <- gsub(".csv", "", csvfile)
   class <- strsplit(basename, "_")[[1]][1]
   substr(class, 1, 1) <- toupper(substr(class, 1, 1))
@@ -129,42 +129,42 @@
 
 ```{r filerefs, include=FALSE}
 filerefs <- function(csvfile, dat=NULL, message=FALSE) {
-  # with dat, look for ref2 in dat
+  # With dat, look for ref2 in dat
   whichref <- "ref2"
-  # without dat, look for ref1 in csvfile
+  # Without dat, look for ref1 in csvfile
   if(is.null(dat)) {
     file <- system.file(paste0("extdata/OBIGT/", csvfile), package="CHNOSZ")
     dat <- read.csv(file, as.is=TRUE)
     whichref <- "ref1"
   }
-  ## exclude entries for phase transitions
+  ## Exclude entries for phase transitions
   #dat <- dat[!dat$state %in% c("cr2", "cr3", "cr4", "cr5", "cr6", "cr7", "cr8", "cr9"), ]
-  # count number of times each reference is used
+  # Count number of times each reference is used
   tab <- table(dat[, whichref])
-  # in case there are not references (previously for H2O_aq.csv) we return the species here
+  # In case there are not references (previously for H2O_aq.csv) we return the species here
   if(length(tab)==0) return(paste(dat$name, dat$state))
-  # the reference keys
+  # The reference keys
   keys <- names(tab)
-  # warn if any keys aren't in thermo()$ref$key
+  # Warn if any keys aren't in thermo()$ref$key
   ikey <- match(keys, thermo()$ref$key)
   ina <- is.na(ikey)
   if(any(ina)) cat(paste("**WARNING: key(s)", paste(names(tab)[ina], collapse=" "), "not found in `thermo()$ref$key`**\n\n"))
-  # put the table in chronological order, according to thermo()$ref
+  # Put the table in chronological order, according to thermo()$ref
   ikey <- order(match(keys, thermo()$ref$key))
   tab <- tab[ikey]
   keys <- keys[ikey]
   xxx <- lapply(seq_along(tab), function(i){
     thiskey <- keys[i]
-    # read thermo()$ref$note
+    # Read thermo()$ref$note
     iref <- match(thiskey, thermo()$ref$key)
     note <- thermo()$ref$note[iref]
-    # show the note in italics
+    # Show the note in italics
     if(!identical(note, "")) note <- paste0(" *", note, "* ")
-    # use bullets for ref2
+    # Use bullets for ref2
     if(whichref=="ref2") bullet <- "- " else bullet <- ""
-    # convert key (e.g. LD12.2) to ref in OBIGT.bib (e.g. LD12)
+    # Convert key (e.g. LD12.2) to ref in OBIGT.bib (e.g. LD12)
     thisref <- gsub("\\..*$", "", thiskey)
-    # replace SLOP98 with slop98.dat, etc.
+    # Replace SLOP98 with slop98.dat, etc.
     # (we don't actually cite them here to keep the year from showing -- it's annoying to see e.g. "slop98.dat (1998)")
     citemark <- "@"
     if(thisref=="SLOP16") { thisref <- "slop16.dat"; citemark <- "" }
@@ -173,18 +173,18 @@
     if(thisref=="SPRONS92") { thisref <- "sprons92.dat"; citemark <- "" }
     if(thisref=="OBIGT") { thisref <- paste0("OBIGT (", thermo()$ref$year[iref], ")"); citemark <- "" }
     cat(bullet, citemark, thisref, " -- ", tab[i], note, "\n\n", sep="")
-    # get ref2 if we're in the outer list
+    # Get ref2 if we're in the outer list
     if(whichref!="ref2") filerefs(dat=dat[dat$ref1==names(tab)[i], ])
   })
-  # return all the species listed
+  # Return all the species listed
   paste(dat$name, dat$state)
 }
 ```
 
 ```{r used, include=FALSE}
-# initialize the list of used species
+# Initialize the list of used species
 used <- character()
-# initialize the list of used optional species
+# Initialize the list of used optional species
 optused <- character()
 ```
 
@@ -206,7 +206,7 @@
 ### Gases <button id="B-gas-inorganic" onclick='ToggleDiv("gas-inorganic")'>Inorganic</button> <button id="B-gas-organic" onclick='ToggleDiv("gas-organic")'>Organic</button>    Liquids <button id="B-liquid-organic" onclick='ToggleDiv("liquid-organic")'>Organic</button>
 ### Optional Data <button id="B-optional-SUPCRT92" onclick='ToggleDiv("optional-SUPCRT92")'>SUPCRT92</button> <button id="B-optional-SLOP98" onclick='ToggleDiv("optional-SLOP98")'>SLOP98</button> <button id="B-optional-AD" onclick='ToggleDiv("optional-AD")'>AD</button> <button id="B-optional-AS04" onclick='ToggleDiv("optional-AS04")'>AS04</button> <button id="B-optional-DEW" onclick='ToggleDiv("optional-DEW")'>DEW</button> <button id="B-optional-GEMSFIT" onclick='ToggleDiv("optional-GEMSFIT")'>GEMSFIT</button>
 
-<!-- normal or "all open" footer message --> 
+<!-- Normal or "all open" footer message --> 
 
 <div id="footer" style="display: block">
 *Press a button above to show the citations in that data file.*

Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd	2023-11-14 02:47:44 UTC (rev 808)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd	2023-11-14 10:53:32 UTC (rev 809)
@@ -45,9 +45,9 @@
 ```
 
 ```{r HTML, include=FALSE}
-## some frequently used HTML expressions
+## Some frequently used HTML expressions
 logfO2 <- "log<i>f</i><sub>O<sub>2</sub></sub>"
-# use lowercase here because these tend to be variable names in the examples
+# Use lowercase here because these tend to be variable names in the examples
 zc <- "<i>Z</i><sub>C</sub>"
 o2 <- "O<sub>2</sub>"
 h2o <- "H<sub>2</sub>O"
@@ -58,13 +58,13 @@
 ```{r setup, include=FALSE}
 library(knitr)
 
-## from "Tufte Handout" example dated 2016-12-27
-# invalidate cache when the tufte version changes
+## From "Tufte Handout" example dated 2016-12-27
+# Invalidate cache when the tufte version changes
 opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
 options(htmltools.dir.version = FALSE)
 
-## adjust plot margins
-## first one from https://yihui.name/knitr/hooks/
+## Adjust plot margins
+## First one from https://yihui.name/knitr/hooks/
 knit_hooks$set(small.mar = function(before, options, envir) {
     if (before) par(mar = c(4.2, 4.2, .1, .1))  # smaller margin on top and right
 })
@@ -75,14 +75,14 @@
     if (before) par(mar = c(4.2, 4.2, 0.9, 0.9))  # smallish margins on top and right
 })
 
-## use pngquant to optimize PNG images
+## Use pngquant to optimize PNG images
 knit_hooks$set(pngquant = hook_pngquant)
 pngquant <- "--speed=1 --quality=0-25"
 # pngquant isn't available on R-Forge ...
 if (!nzchar(Sys.which("pngquant"))) pngquant <- NULL 
 
-## use a low resolution to save space in the package
-# change this to 72 to make higher-resolution images for the CHNOSZ web page
+## Use a low resolution to save space in the package
+# Change this to 72 to make higher-resolution images for the CHNOSZ web page
 dpi <- 50
 
 ## http://stackoverflow.com/questions/23852753/knitr-with-gridsvg
@@ -89,7 +89,7 @@
 ## Set up a chunk hook for manually saved plots.
 knit_hooks$set(custom.plot = hook_plot_custom)
 
-## hook to change <img /> to <embed /> -- required for interactive SVG
+## Hook to change <img /> to <embed /> -- required for interactive SVG
 hook_plot <- knit_hooks$get("plot")
 knit_hooks$set(plot = function(x, options) {
   x <- hook_plot(x, options)
@@ -107,8 +107,8 @@
 })
 timeit <- NULL
 
-## colorize messages 20171031
-## adapted from https://gist.github.com/yihui/2629886#file-knitr-color-msg-rnw
+## Colorize messages 20171031
+## Adapted from https://gist.github.com/yihui/2629886#file-knitr-color-msg-rnw
 color_block = function(color) {
   function(x, options) sprintf('<pre style="color:%s">%s</pre>', color, x)
 }

Modified: pkg/CHNOSZ/vignettes/custom_data.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/custom_data.Rmd	2023-11-14 02:47:44 UTC (rev 808)
+++ pkg/CHNOSZ/vignettes/custom_data.Rmd	2023-11-14 10:53:32 UTC (rev 809)
@@ -17,7 +17,7 @@
 ```{r setup, include = FALSE}
 library(CHNOSZ)
 options(width = 80)
-## use pngquant to optimize PNG images
+## Use pngquant to optimize PNG images
 library(knitr)
 knit_hooks$set(pngquant = hook_pngquant)
 pngquant <- "--speed=1 --quality=0-25"

Modified: pkg/CHNOSZ/vignettes/eos-regress.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/eos-regress.Rmd	2023-11-14 02:47:44 UTC (rev 808)
+++ pkg/CHNOSZ/vignettes/eos-regress.Rmd	2023-11-14 10:53:32 UTC (rev 809)
@@ -34,7 +34,7 @@
 li {
   padding: 0.25rem 0;
 }
-/* zero margin around pre blocks (looks more like R console output) */
+/* Zero margin around pre blocks (looks more like R console output) */
 pre {
   margin-top: 0;
   margin-bottom: 0;
@@ -49,7 +49,7 @@
 ```
 
 ```{r HTML, include=FALSE}
-## some frequently used HTML expressions
+## Some frequently used HTML expressions
 V0 <- "<i>V</i>°"
 Cp0 <- "<i>C<sub>P</sub></i>°"
 c1 <- "<i>c</i><sub>1</sub>"
@@ -67,19 +67,19 @@
 
 ```{r setup, include=FALSE}
 library(knitr)
-# invalidate cache when the tufte version changes
+# Invalidate cache when the tufte version changes
 opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
 options(htmltools.dir.version = FALSE)
-# adjust plot margins
+# Adjust plot margins
 knit_hooks$set(small.mar = function(before, options, envir) {
     if (before) par(mar = c(4.2, 4.2, .3, .3))  # smaller margin on top and right
 })
-# use pngquant to optimize PNG images
+# Use pngquant to optimize PNG images
 knit_hooks$set(pngquant = hook_pngquant)
 # pngquant isn't available on R-Forge ...
 if (!nzchar(Sys.which("pngquant"))) {
   pngquant <- NULL 
-  # save space by using a lower resolution
+  # Save space by using a lower resolution
   dpi <- 50
 } else {
   pngquant <- "--speed=1 --quality=0-50"
@@ -86,8 +86,8 @@
   dpi <- 72
 }
 
-## colorize messages 20171031
-## adapted from https://gist.github.com/yihui/2629886#file-knitr-color-msg-rnw
+## Colorize messages 20171031
+## Adapted from https://gist.github.com/yihui/2629886#file-knitr-color-msg-rnw
 color_block = function(color) {
   function(x, options) sprintf('<pre style="color:%s">%s</pre>', color, x)
 }

Modified: pkg/CHNOSZ/vignettes/multi-metal.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/multi-metal.Rmd	2023-11-14 02:47:44 UTC (rev 808)
+++ pkg/CHNOSZ/vignettes/multi-metal.Rmd	2023-11-14 10:53:32 UTC (rev 809)
@@ -35,7 +35,7 @@
     padding:10px;
   }
 }
-/* zero margin around pre blocks (looks more like R console output) */
+/* Zero margin around pre blocks (looks more like R console output) */
 pre {
   margin-top: 0;
   margin-bottom: 0;
@@ -59,7 +59,7 @@
 
 ```{r setup, include=FALSE}
 options(width = 80)
-## use pngquant to optimize PNG images
+## Use pngquant to optimize PNG images
 library(knitr)
 knit_hooks$set(pngquant = hook_pngquant)
 pngquant <- "--speed=1 --quality=0-25"



More information about the CHNOSZ-commits mailing list