Skip to content

Commit

Permalink
Fixed latexMatrix documentation re issue #69
Browse files Browse the repository at this point in the history
  • Loading branch information
friendly committed Nov 19, 2024
1 parent 77c07c6 commit 9730d54
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 23 deletions.
36 changes: 24 additions & 12 deletions R/latexMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#' by the function can also be manipulated, e.g., with standard arithmetic functions and operators:
#' See \code{\link{latexMatrixOperations}}.
#'
#' The \code{latexMatrix()} function can construct the LaTeX code for a symbolic matrix, whose elements are a \code{symbol}, with row and column subscripts.
#' For example:
#' The \code{latexMatrix()} function can construct the LaTeX code for a symbolic matrix
#' whose elements are a \code{symbol}, like \eqn{x}, with row and column subscripts.
#' For example, with no arguments, the call \code{latexMatrix()} generates this LaTeX representation
#' of an \eqn{n \times m} matrix with elements \eqn{x_{ij}}.
#' \preformatted{
#' \\begin{pmatrix}
#' x_{11} & x_{12} & \\dots & x_{1m} \\
Expand All @@ -31,10 +33,12 @@
#' % \figure{man/figures/symbMat-x.png}{options: width=150 alt="LaTeX result for the symbolic n x m matrix"}.
#'
#' Alternatively, instead of characters,
#' the number of rows and/or columns can be \bold{integers}, generating a matrix of given size.
#' the number of rows and/or columns can be \bold{integers}, generating a matrix of given size,
#' as in \code{latexMatrix(nrow = 2, ncol = 3)}.
#'
#' As well, instead of a character for the matrix \code{symbol}, you can supply a \bold{matrix} of arbitrary character
#' strings (in LaTeX notation) or numbers, and these will be used as the elements of the matrix.
#' strings (in LaTeX notation) or numbers, and these will be used as the elements of the matrix,
#' as in \code{latexMatrix(matrix(1:6, nrow = 2, ncol = 6))}.
#'
#' The resulting LaTeX code is printed to the console by default. When the result is assigned to a variable,
#' you can send it to the clipboard using \code{\link[clipr]{write_clip}()}. Perhaps most convenient of all,
Expand Down Expand Up @@ -89,6 +93,11 @@
#' \code{getDim()}, \code{getNrow()}, and \code{getNcol()} may be used to retrieve
#' components of the returned object.
#'
#' Various arithmetic functions and operators (like \code{+}, \code{-}, matrix product \code{\%*\%}, ...) for \code{"latexMatrix"} objects are
#' documented separately; see, \code{\link{latexMatrixOperations}}.
#'
#'
#'
#' \bold{print.latexMatrix options}
#'
#' Some LaTeX typesetting details are controlled by the \code{"print.latexMatrix"} option,
Expand All @@ -105,12 +114,13 @@
#' Most of these have to do with the display of matrices which have row and/or column labels
#' in their \code{\link[base]{dimnames}} or by being set with the \code{rownames} and \code{rownames}
#' arguments to \code{latexMatrix}.
#' You can turn off their display using
#' \code{options(print.latexMatrix = list(display.labels=FALSE))}.
#'
#' Various functions and operators for \code{"latexMatrix"} objects are
#' documented separately; see, \code{\link{latexMatrixOperations}}.
#'
#' You can turn off their display using:
#'
#' \preformatted{options(print.latexMatrix = list(display.labels=FALSE))}
#'
#' and similarly you can change any other of these options.
#'
#' @param symbol name for matrix elements, character string. For LaTeX symbols,
#' the backslash must be doubled because it is an escape character in R.
#' That is, you must use \code{symbol = "\\\\beta"} to get \eqn{\beta}. Alternatively, this can be an
Expand Down Expand Up @@ -174,14 +184,16 @@
#' @param onConsole if \code{TRUE}, the default, print the LaTeX code for
#' the matrix on the R console.
#'
#' @returns \code{latexMatrix()} returns an object of class \code{"latexMatrix"}
#' which contains the LaTeX representation of the matrix as a character string,
#' in the returned object are named:
#' @returns \code{latexMatrix()} returns an object of class \code{"latexMatrix"}.
#' This is a list which contains the LaTeX representation of the matrix as a character string
#' and other information.
#' The elements in the returned object are named:
#' \itemize{
#' \item \code{"matrix"} (the LaTeX representation of the matrix);
#' \item \code{"dim"} (\code{nrow} and \code{ncol});
#' \item \code{"body"} (a character matrix of LaTeX expressions for the cells of the matrix);
#' \item \code{"wrapper"}(the beginning and ending lines for the LaTeX matrix environment).
#' \item \code{"dimnames"}(the rownames and colnames for the matrix, if specified)
#' }
#'
#' \code{partition()}, \code{rbind()}, \code{cbind()}, and indexing of
Expand Down
34 changes: 23 additions & 11 deletions man/latexMatrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9730d54

Please sign in to comment.