% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/format_nucl.R
\name{format_nucl}
\alias{format_nucl}
\title{Format isotopes in nuclear notation}
\usage{
format_nucl(
  x,
  face = "plain",
  ...,
  Z = formatdown_options("Z"),
  warn = formatdown_options("warn"),
  delim = formatdown_options("delim")
)
}
\arguments{
\item{x}{Character. Hyphenated form of chemical elements or isotopes.
Can be a single character string or a vector of strings. Must
include a single hyphen between the element symbol and the mass
number. For example, carbon 12 in hyphenated notation is the
character string \code{"C-12"}.}

\item{face}{Font face. Determines the font face macro inside the math
delimiters. Possible values are \code{"plain"} (default), \code{"italic"},
\code{"bold"}, \code{"sans"}, or \code{"mono"}. One may assign instead the
corresponding LaTeX-style markup itself, e.g., \verb{\\mathrm},
\verb{\\mathit}, \verb{\\mathbf}, \verb{\\mathsf}, or \verb{\\mathtt}.}

\item{...}{Not used for values; forces subsequent arguments to be
referable only by name.}

\item{Z}{T/F add the atomic number. For details,
see the help page for \code{formatdown_options()}.}

\item{warn}{T/F issue warning for incorrect input \code{x}. For details,
see the help page for \code{formatdown_options()}.}

\item{delim}{The math-delimiter. For details, see the help page for
\code{formatdown_options()}.}
}
\value{
A character vector of isotopes in nuclear notation with elements
delimited as inline math markup in plain, italic, sans serif,
bold, or monospace font face.
}
\description{
Convert chemical element or isotope from from hyphenated notation to
nuclear notation.
}
\details{
We start with a character string in hyphenated form \emph{X-A} where \emph{X} is the
chemical symbol of an element and \emph{A} is its mass number.
For example, carbon 12 would be written as the string \code{"C-12"}.

Given a character scalar, vector, or data frame column of isotopes in
this form, \code{format_nucl()} constructs the form \code{"$\\\\mathxx{^{A}X}$"} where
\verb{\\\\mathxx} determines the font face: plain type is set by \verb{\\\\mathrm}; italic
by \verb{\\\\mathit}; bold by \verb{\\\\mathbf}; sans serif by \verb{\\\\mathsf}; and monospace
(typewriter text) by \verb{\\\\mathtt}. The result includes markup delimiters \verb{$...$}
for rendering (in an R markdown or Quarto markdown document) as an inline
code chunk.

Unlike other functions in formatdown, \code{format_nucl()} does not support a
\code{size} argument.
}
\examples{
# default arguments
x <- "C-12"
format_nucl(x)

# add atomic number
format_nucl(x, Z = TRUE)

# vector of isotopes
x <- c("C-12", "Fe-54", "U-238")
format_nucl(x, Z = TRUE)

# turn off the warning when using symbols
x <- "X-A"
format_nucl(x, Z = TRUE, warn = FALSE)

# change the typeface
x <- "C-12"
format_nucl(x, face = "bold")

# obtain all possible mass numbers for an element
element_set[symbol == "Ca"]
}
\seealso{
Other format_*: 
\code{\link{format_dcml}()},
\code{\link{format_engr}()},
\code{\link{format_numbers}()},
\code{\link{format_sci}()},
\code{\link{format_text}()}
}
\concept{format_*}
