% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/latex-grob.R
\name{grobMark}
\alias{grobMark}
\title{Look up a named anchor inside a LaTeX grob}
\usage{
grobMark(grob, name)
}
\arguments{
\item{grob}{A \code{latexgrob} returned by \code{\link{latex_grob}}.}

\item{name}{The mark name (the argument to \code{\\mark\{...\}}).}
}
\value{
A list with elements \code{x} and \code{y}, each a
\code{\link[grid]{unit}}. Mark coordinates are evaluated in the
grob's parent viewport. They assume an unrotated grob: with
\code{rot != 0} the returned position does not account for the
rotation.
}
\description{
Resolves a \code{\\mark\{name\}} that was placed inside the LaTeX
source to a pair of \pkg{grid} units in the grob's parent viewport.
The returned units already account for the grob's viewport position
and \code{hjust}/\code{vjust}, so you can pass them directly to grid
drawing functions to anchor other graphics on parts of the formula.
}
\examples{
\donttest{
  g <- latex_grob(r"($a\mark{eq}^2 = b + c^2$)",
                  x = grid::unit(0.5, "npc"),
                  y = grid::unit(0.5, "npc"))
  grid::grid.newpage(); grid::grid.draw(g)
  mk <- grobMark(g, "eq")
  grid::grid.points(mk$x, mk$y, pch = 19,
                    gp = grid::gpar(col = "red"))
}
}
\seealso{
\code{\link{latex_grob}}
}
