latex2exp: Use LaTeX Expressions in Plots

LaTeX風の表記をRのプロットに取り込む

> library(latex2exp)

バージョン: 0.3.3


関数名 概略
latex2exp Converts a LaTeX string to a 'plotmath' expression.
latex2exp_examples Plots a number of example LaTeX string, as parsed by 'latex2exp'.
latex2exp_supported Returns a list of all supported LaTeX symbols and expressions that can be converted with 'latex2exp'.
plot.expression Plots an expression on the current graphical device.
print.latextoken Prints out a parsed LaTeX object, as returned by latex2exp(..., output='ast').
toString.latextoken Converts a token created by latex2exp to a string, later to be parsed into an expression (for internal use).

latex2exp

Arguments

  • string
  • output
> latex2exp("$\\alpha$")
expression(`$\alpha$` = paste("", "", alpha, , , , ""))
> latex2exp("The ratio of 1 and 2 is $\\frac{1}{2}$")
expression(`The ratio of 1 and 2 is $\frac{1}{2}$` = paste("The ratio of 1 and 2 is ", 
    "", frac(paste("1"), paste("", "2")), ""))

latex2exp_examples()

> latex2exp_examples()

latex2exp_supported

> latex2exp_supported(plot = FALSE)
 [1] "\\div"         "\\pm"          "\\neq"         "\\geq"        
 [5] "\\leq"         "\\approx"      "\\sim"         "\\propto"     
 [9] "\\equiv"       "\\cong"        "\\in"          "\\notin"      
[13] "\\cdot"        "\\times"       "\\subset"      "\\subseteq"   
[17] "\\nsubset"     "\\supset"      "\\supseteq"    "\\rightarrow" 
[21] "\\leftarrow"   "\\Rightarrow"  "\\Leftarrow"   "\\forall"     
[25] "\\exists"      "\\%"           "\\ast"         "\\perp"       
[29] "\\bullet"      "\\Im"          "\\Re"          "\\wp"         
[33] "\\otimes"      "\\oplus"       "\\oslash"      "\\surd"       
[37] "\\neg"         "\\vee"         "\\wedge"       "\\sqrt"       
[41] "\\sum"         "\\prod"        "\\int"         "\\frac"       
[45] "\\bigcup"      "\\bigcap"      "\\lim"         "\\overset"    
[49] "\\normalsize"  "\\small"       "\\tiny"        "\\textbf"     
[53] "\\textit"      "\\mathbf"      "\\mathit"      "\\mathrm"     
[57] "\\infty"       "\\partial"     "\\cdots"       "\\ldots"      
[61] "\\degree"      "\\clubsuit"    "\\diamondsuit" "\\heartsuit"  
[65] "\\spadesuit"   "\\aleph"       "\\prime"       "\\LaTeX"      
[69] "\\TeX"         "\\tilde"       "\\hat"         "\\widehat"    
[73] "\\widetilde"   "\\bar"         "\\dot"         "\\underline"  
[77] "\\,"           "\\;"