diff --git a/.gitignore b/.gitignore index 8242ee1c6..76dbd8c11 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ Meta -doc +/doc # History files .Rhistory .Rapp.history @@ -80,4 +80,3 @@ dkms.conf *~ *.bak .Rproj.user -inst/doc diff --git a/R/ergm-package.R b/R/ergm-package.R index cb090a248..ffa7bc6cd 100644 --- a/R/ergm-package.R +++ b/R/ergm-package.R @@ -305,6 +305,8 @@ NULL #' also available via `vignette('ergm-term-crossRef')` and terms #' can also be searched via [`search.ergmTerms`]. #' +#' \ergmCSS +#' #' ## Term index (plain) #' \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexLatex(ergm:::.buildTermsDataframe("ergmTerm", keywords = ~!"operator"%in%.))}} #' \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexText(ergm:::.buildTermsDataframe("ergmTerm", keywords = ~!"operator"%in%.))}} @@ -469,6 +471,8 @@ NULL #' #' @section Constraints visible to the package: #' +#' \ergmCSS +#' #' \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexLatex(ergm:::.buildTermsDataframe("ergmConstraint"))}} #' \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexText(ergm:::.buildTermsDataframe("ergmConstraint"))}} #' \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexHtml(ergm:::.buildTermsDataframe("ergmConstraint"))}} @@ -556,6 +560,8 @@ NULL #' #' The following hints are known to \CRANpkg{ergm} at this time: #' +#' \ergmCSS +#' #' \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexLatex(ergm:::.buildTermsDataframe("ergmHint"))}} #' \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexText(ergm:::.buildTermsDataframe("ergmHint"))}} #' \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexHtml(ergm:::.buildTermsDataframe("ergmHint"))}} @@ -606,6 +612,9 @@ NULL #' typically as the `reference` argument. #' #' @section Reference measures visible to the package: +#' +#' \ergmCSS +#' #' \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexLatex(ergm:::.buildTermsDataframe("ergmReference"))}} #' \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexText(ergm:::.buildTermsDataframe("ergmReference"))}} #' \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexHtml(ergm:::.buildTermsDataframe("ergmReference"))}} @@ -650,6 +659,9 @@ NULL #' the algorithm, and in other cases to constrain the sample space. Proposals can also be searched via [`search.ergmProposals`], and help for an individual proposal can be obtained with `ergmProposal?` or `help("-ergmProposal")`. #' #' @section Implemented proposals for ergm models: +#' +#' \ergmCSS +#' #' \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsHtml(ergm:::.buildProposalsList(), keepProposal=TRUE)}} #' \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsText(ergm:::.buildProposalsList(), keepProposal=TRUE)}} #' \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsLatex(ergm:::.buildProposalsList(), keepProposal=TRUE)}} diff --git a/R/ergm-terms-index.R b/R/ergm-terms-index.R index 6ad2cc74a..64e8eaac1 100644 --- a/R/ergm-terms-index.R +++ b/R/ergm-terms-index.R @@ -352,8 +352,7 @@ PROPOSAL_NOT_IN_TABLE <- "This proposal is not referenced in the lookup table." df <- df[,colnames(df)!="Proposal"] } - css <- '' - sprintf("\\out{%s%s}", css, knitr::kable(df, 'html', escape=FALSE, row.names=FALSE)) + sprintf("\\out{%s}", knitr::kable(df, 'html', escape=FALSE, row.names=FALSE, table.attr='class="proptable"')) } .formatProposalsLatex <- function(df, keepProposal=FALSE) { @@ -524,8 +523,7 @@ PROPOSAL_NOT_IN_TABLE <- "This proposal is not referenced in the lookup table." sprintf('
%s
', df$Link, .) df$Link <- NULL - css <- '' - sprintf('\\out{%s%s}', css, knitr::kable(df, 'html', escape=FALSE, row.names=FALSE, table.attr='class="striped"')) + sprintf('\\out{%s}', knitr::kable(df, 'html', escape=FALSE, row.names=FALSE, table.attr='class="termtable"')) } .formatMatrixHtml <- function(df, wrapRdTags=TRUE) { @@ -537,7 +535,7 @@ PROPOSAL_NOT_IN_TABLE <- "This proposal is not referenced in the lookup table." df[[c]] <- ifelse(df[[c]], '✔', '') } - out <- knitr::kable(df, 'html', escape=FALSE, row.names=FALSE, table.attr='class="matrix"') + out <- knitr::kable(df, 'html', escape=FALSE, row.names=FALSE, table.attr='class="termmatrix"') if(wrapRdTags) { out <- sprintf('\\out{%s}', out) } diff --git a/R/ergm_keyword.R b/R/ergm_keyword.R index 44dbf7d1e..177df48fa 100644 --- a/R/ergm_keyword.R +++ b/R/ergm_keyword.R @@ -97,8 +97,7 @@ ergm_keyword <- local({ } .formatKeywordsHtml <- function(df) { - css <- '' - sprintf('\\out{%s%s}', css, knitr::kable(df, 'html', escape=FALSE, table.attr='class="striped"')) + sprintf('\\out{%s}', knitr::kable(df, 'html', escape=FALSE, table.attr='class="termtable"')) } #' Keywords defined for Exponential-Family Random Graph Models @@ -109,6 +108,9 @@ ergm_keyword <- local({ #' @description This collects all defined keywords defined for the ERGM and derived packages #' #' @section Possible keywords defined by the ERGM and derived packages: +#' +#' \ergmCSS +#' #' \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatKeywordsLatex(ergm::ergm_keyword())}} #' \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatKeywordsText(ergm::ergm_keyword())}} #' \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatKeywordsHtml(ergm::ergm_keyword())}} diff --git a/inst/doc/ergm.css b/inst/doc/ergm.css new file mode 100644 index 000000000..6bddb9856 --- /dev/null +++ b/inst/doc/ergm.css @@ -0,0 +1,24 @@ +.proptable th, .proptable td { + padding: 3px 10px; +} + +.termtable th, .termtable td { + padding: 3px 10px; +} + +.termtable tbody tr:nth-child(odd), .termmatrix tbody tr:nth-child(odd) { + background: #eee; +} + +.termtable .code { + font-family: monospace; +} + +.termmatrix td { + align: center; +} + +.termmatrix th, .termmatrix td { + padding-right:5px; + width: 75px; +} diff --git a/man/ergmConstraint.Rd b/man/ergmConstraint.Rd index e3b3b5f33..531e10c6a 100644 --- a/man/ergmConstraint.Rd +++ b/man/ergmConstraint.Rd @@ -73,6 +73,8 @@ formula will suppress the inherited formula altogether. \section{Constraints visible to the package}{ +\ergmCSS + \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexLatex(ergm:::.buildTermsDataframe("ergmConstraint"))}} \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexText(ergm:::.buildTermsDataframe("ergmConstraint"))}} \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexHtml(ergm:::.buildTermsDataframe("ergmConstraint"))}} diff --git a/man/ergmHint.Rd b/man/ergmHint.Rd index 11b118c52..57e1cfbc2 100644 --- a/man/ergmHint.Rd +++ b/man/ergmHint.Rd @@ -52,6 +52,8 @@ be substituted in its place. The following hints are known to \CRANpkg{ergm} at this time: +\ergmCSS + \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexLatex(ergm:::.buildTermsDataframe("ergmHint"))}} \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexText(ergm:::.buildTermsDataframe("ergmHint"))}} \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexHtml(ergm:::.buildTermsDataframe("ergmHint"))}} diff --git a/man/ergmKeyword.Rd b/man/ergmKeyword.Rd index d65694696..51c2e60f4 100644 --- a/man/ergmKeyword.Rd +++ b/man/ergmKeyword.Rd @@ -13,6 +13,9 @@ This collects all defined keywords defined for the ERGM and derived packages } \section{Possible keywords defined by the ERGM and derived packages}{ + +\ergmCSS + \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatKeywordsLatex(ergm::ergm_keyword())}} \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatKeywordsText(ergm::ergm_keyword())}} \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatKeywordsHtml(ergm::ergm_keyword())}} diff --git a/man/ergmProposal.Rd b/man/ergmProposal.Rd index aefbbcf5f..209b0da74 100644 --- a/man/ergmProposal.Rd +++ b/man/ergmProposal.Rd @@ -22,6 +22,9 @@ the algorithm, and in other cases to constrain the sample space. Proposals can a } \section{Implemented proposals for ergm models}{ + +\ergmCSS + \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsHtml(ergm:::.buildProposalsList(), keepProposal=TRUE)}} \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsText(ergm:::.buildProposalsList(), keepProposal=TRUE)}} \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatProposalsLatex(ergm:::.buildProposalsList(), keepProposal=TRUE)}} diff --git a/man/ergmReference.Rd b/man/ergmReference.Rd index 8cc467693..d6e95c2a6 100644 --- a/man/ergmReference.Rd +++ b/man/ergmReference.Rd @@ -23,6 +23,9 @@ typically as the \code{reference} argument. \section{Reference measures visible to the package}{ + +\ergmCSS + \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexLatex(ergm:::.buildTermsDataframe("ergmReference"))}} \if{text}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexText(ergm:::.buildTermsDataframe("ergmReference"))}} \if{html}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexHtml(ergm:::.buildTermsDataframe("ergmReference"))}} diff --git a/man/ergmTerm.Rd b/man/ergmTerm.Rd index 9aa5112ea..b9a708335 100644 --- a/man/ergmTerm.Rd +++ b/man/ergmTerm.Rd @@ -161,6 +161,8 @@ terms available from all loaded packages. As noted above, a cross-referenced HTML version of the term documentation is also available via \code{vignette('ergm-term-crossRef')} and terms can also be searched via \code{\link{search.ergmTerms}}. + +\ergmCSS \subsection{Term index (plain)}{ \if{latex}{\Sexpr[results=rd,stage=render]{ergm:::.formatIndexLatex(ergm:::.buildTermsDataframe("ergmTerm", keywords = ~!"operator"\%in\%.))}} diff --git a/man/macros/ergmCSS.Rd b/man/macros/ergmCSS.Rd new file mode 100644 index 000000000..d971335b5 --- /dev/null +++ b/man/macros/ergmCSS.Rd @@ -0,0 +1 @@ +\newcommand{\ergmCSS}{\if{html}{\out{}}}