355/113 - pi
# small number
foo <- cfrac(355,113)
#[1] 3 7 16
bar <- cf2latex(foo)
# $eqn
# [1] "3 + 1/(7 + 1/16)"
# $texeqn #Paste into your LaTeX source file
# [1] "3 + \frac{1}{7 + \frac{1}{16}}"
# $texexpr # use in an R plot window
# [1] "$3 + \frac{1}{7 + \frac{1}{16}}$"
##not run
# library( latex2exp)
# plot(NA,NA,xlim = c(1,10),ylim=c(1,5),axes=FALSE,xlab='',ylab='')
# text(2,4,TeX(bar$texexpr))
Run the code above in your browser using DataLab