# Plot symbols from R as latex symbols

In a LaTeX document, I am including an image showing a plot generated by R, for example the result of a plot(x=1:5,y=1:5,pch=13). Is there a way to use this nice little symbol as a LaTaX character to use it in the regular text? It's #13 from this list.

To clarify, I am not looking for \otimes, which is a nice workaround. I am rather wondering if there is some package which has all the standard R symbols, including, say #14.

• possible duplicate of How to look up a symbol or identify a math alphabet? – m0nhawk Nov 22 '13 at 16:13
• Not a duplicate, as I was using pch=13 as an example. If I ever want to use #11 or #14, would I have to sift through the 168 pages of the symbols list? – Roland Nov 22 '13 at 16:23
• Actually, there are info about Detexify. And if you want some particular symbol - than create another question. – m0nhawk Nov 22 '13 at 16:31
• I read the part with Detexify, and gave it a try. Maybe your drawing skills are better than mine, but I wasn't able to get #11 or #14 from Detexify. Additionally, if you look at the symbol #13, you'll notice that it's not quite \otimes, which is what Detexify suggests. I don't get it why I should create another question - I am looking for a package, not a symbol. – Roland Nov 22 '13 at 16:52
• not all these symbols are in unicode or in fonts, as far as i know, in particular the bicolor versions. is color important? if so, i think this question could be answered to specify a method of obtaining a desired symbol using some (perhaps non-tex) mechanism, saving it, perhaps as a small graphic, and using that. this question deals with including an icon as a graphic. adjustments would have to be made for color, perhaps using packages, if that is required. – barbara beeton Nov 22 '13 at 17:10

Another not-very-elegant solution, but you could save just the symbol in a small file and import it where needed. It seems likely that each different symbol might need tweaking, but here's an example in knitr format.

\documentclass{article}
\usepackage[margin=0.1in, paperwidth=2.3in, paperheight=2.6in]{geometry}
\parindent 0pt
\begin{document}
<<fig.width=2, fig.height=2, echo=FALSE>>=
par(mar=c(1,1,1,1))
plot(x=1:5,y=1:5, pch=13)
@

<<echo=FALSE, results="hide">>=
pdf('test.pdf', width=.2, height=.2)
par(mar=c(0,0,0,0))
plot.new()
plot.window(xlim=c(-1,1),ylim=c(-1,1), xaxs="i", yaxs="i")
points(0, -0.5, pch=13, cex=1)
dev.off()
@

Note that the \includegraphics[height=12pt]{test.pdf} used in this graphic is a circle with an X through it.
\end{document}


This is probably not the most elegant solution to your problem, but there is a package called tikzDevice for R (if you use R 3.0 or newer, you have to install it by hand). It exports R plots to TikZ Code. You could look into the created code to find what symbol that package uses.

I do all my plots for LaTeX with tikzDevice, since it allows you to use TeX code in axis-descriptions, legends, titles etc. It also has the advantage, that the font in the plot and in your document is the same.

You can find an example for the usage of tikzDevice here: http://www.texample.net/tikz/examples/tikzdevice-demo/

Hope that helps!

• Nice idea, but for more complex symbols like this, it uses several commands to build the symbol; it's unfortunately not just a single symbol code. – Aaron left Stack Overflow Nov 22 '13 at 18:16