% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ctModelLatex.R
\name{ctModelLatex}
\alias{ctModelLatex}
\title{Generate and optionally compile latex equation of subject level ctsem model.}
\usage{
ctModelLatex(
  x,
  matrixnames = TRUE,
  digits = 3,
  linearise = class(x) \%in\% "ctStanFit",
  textsize = "normalsize",
  folder = tempdir(),
  filename = paste0("ctsemTex", as.numeric(Sys.time())),
  tex = TRUE,
  equationonly = FALSE,
  compile = TRUE,
  open = TRUE,
  includeNote = TRUE,
  minimal = FALSE,
  splitDynamics = TRUE,
  splitMeasurement = TRUE,
  savepng = FALSE
)
}
\arguments{
\item{x}{ctsem model object or ctStanFit object.}

\item{matrixnames}{Logical. If TRUE, includes ctsem matrix names such as DRIFT and DIFFUSION under the matrices.}

\item{digits}{Precision of decimals for numeric values.}

\item{linearise}{Logical. Show the linearised normal approximation for subject parameters and 
covariate effects, or the raw parameters?}

\item{textsize}{Standard latex text sizes -- 
tiny scriptsize footnotesize small normalsize large Large LARGE huge Huge. 
Useful if output overflows page.}

\item{folder}{Character string specifying folder to save to, defaults to temporary directory, use "./" for working directory.}

\item{filename}{filename, without suffix, to output .tex and .pdf files too.}

\item{tex}{Save .tex file? Otherwise latex is simply returned within R as a string.}

\item{equationonly}{Logical. If TRUE, output is only the latex relevant to the equation, not a compileable document.}

\item{compile}{Compile to .pdf? (Depends on \code{tex = TRUE})}

\item{open}{Open after compiling? (Depends on \code{compile = TRUE})}

\item{includeNote}{Include text describing matrix transformations and subject notation?
triangular matrices (which results in a covariance or Cholesky matrix) is shown -- 
the latter is a more direct representation of the model, while the former is often simpler to convey.}

\item{minimal}{if TRUE, outputs reduced form version displaying matrix dimensions and equation structure only.}

\item{splitDynamics}{Logical. If TRUE, split latent process dynamics across deterministic and random change lines.
If FALSE, show the full dynamics equation on one line.}

\item{splitMeasurement}{Logical. If TRUE, split measurement equations across observation and observation noise lines.
If FALSE, show the full measurement equation on one line.}

\item{savepng}{Logical. If TRUE, renders the equation as a png file instead of a pdf, viewing the png in RStudio viewer when available.}
}
\value{
character string of latex code. Side effects include saving a .tex, .pdf, and displaying the pdf.
}
\description{
Generate and optionally compile latex equation of subject level ctsem model.
}
\examples{
ctmodel <- ctModel(type='ct', 
n.latent=2, n.manifest=1, 
manifestNames='sunspots', 
latentNames=c('ss_level', 'ss_velocity'),
LAMBDA=matrix(c( 1, 'ma1' ), nrow=1, ncol=2),
DRIFT=matrix(c(0, 1,   'a21', 'a22'), nrow=2, ncol=2, byrow=TRUE),
MANIFESTMEANS=matrix(c('m1'), nrow=1, ncol=1),
CINT=matrix(c(0, 0), nrow=2, ncol=1),
DIFFUSION=matrix(c(
  0, 0,
  0, "diffusion"), ncol=2, nrow=2, byrow=TRUE))
  
l=ctModelLatex(ctmodel,compile=FALSE, open=FALSE)
cat(l)
}
