From 5478c1fa78a414cfb750e635090130537e0040e0 Mon Sep 17 00:00:00 2001 From: philchalmers Date: Thu, 21 Nov 2024 22:12:03 -0500 Subject: [PATCH] fix underbrace copy --- dev/under-over.R | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dev/under-over.R b/dev/under-over.R index 2fff959..05f5efe 100644 --- a/dev/under-over.R +++ b/dev/under-over.R @@ -75,7 +75,7 @@ underbrace <- function(x, ) { if(is.matrix(x)) x <- latexMatrix(x) - res <- paste0("\\overbrace{", + res <- paste0("\\underbrace{", ifelse(inherits(x, 'latexMatrix'), getLatex(x), x), "}") if (!is.null(label)) { @@ -115,10 +115,12 @@ if (FALSE) { Eqn(Lambda) # fails miserably Eqn(overset(Lambda, "\\Lambda")) + Eqn(underset(Lambda, "\\Lambda")) # over/underbrace Eqn(overbrace(A, "A")) + Eqn(underbrace(A, "A")) # data(dogfood, package = "heplots") -- not yet on CRAN load(here::here("dev", "dogfood.RData")) @@ -169,10 +171,10 @@ if (FALSE) { ## -------Underbrace: # I want to generate the equation \hat{y} = X (X'X)^{-1} X' y with a brace underneath showing the H matrix # This manual LaTeX works: - eqn <- " - \mathbf{\hat{y}} - = \underbrace{\mathbf{X}(\mathbf{X}^{\top}\mathbf{X})^{-1}\mathbf{X}^{\top}}_\mathbf{H}\mathbf{y} - " + # eqn <- " + # \mathbf{\hat{y}} + # = \underbrace{\mathbf{X}(\mathbf{X}^{\top}\mathbf{X})^{-1}\mathbf{X}^{\top}}_\mathbf{H}\mathbf{y} + # " # generate this with underbrace() H <- "\\mathbf{X}(\\mathbf{X}^{\\top}\\mathbf{X})^{-1}\\mathbf{X}^{\\top}"