Dear List, I'm trying to typeset some chemical ions in axis labels. These have both super and subscript components, and for some, I need a superscript "-". In LaTeX I might use $NO_3^-$ to do the typesetting, but I'm having a problem getting the correct invocation for expression:> expression(NO^{-}[3])Error: syntax error, unexpected '}' in "expression(NO^{-}"> expression(NO^-[3])Error: syntax error, unexpected '[' in "expression(NO^-["> expression(NO^-)Error: syntax error, unexpected ')' in "expression(NO^-)"> expression(NO^{-})Error: syntax error, unexpected '}' in "expression(NO^{-}" This is with R 2.5.1 (exact version info below). I suspect this is something to do with my use of the "-", which has some special meaning. Is there a way to achieve a superscript "-" (or similar looking character) using the plotmath routines in R? Thanks in advance, G> version_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status Patched major 2 minor 5.1 year 2007 month 07 day 05 svn rev 42131 language R version.string R version 2.5.1 Patched (2007-07-05 r42131) -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Try: plot(0,0,"n") text(0,0,expression( {NO[3]}^'-'))
Gavin Simpson wrote:> Dear List, > > I'm trying to typeset some chemical ions in axis labels. These have both > super and subscript components, and for some, I need a superscript "-". > In LaTeX I might use $NO_3^-$ to do the typesetting, but I'm having a > problem getting the correct invocation for expression: > > >> expression(NO^{-}[3]) >> > Error: syntax error, unexpected '}' in "expression(NO^{-}" > >> expression(NO^-[3]) >> > Error: syntax error, unexpected '[' in "expression(NO^-[" > >> expression(NO^-) >> > Error: syntax error, unexpected ')' in "expression(NO^-)" > >> expression(NO^{-}) >> > Error: syntax error, unexpected '}' in "expression(NO^{-}" > > This is with R 2.5.1 (exact version info below). > > I suspect this is something to do with my use of the "-", which has some > special meaning. > > Is there a way to achieve a superscript "-" (or similar looking > character) using the plotmath routines in R? > >It's an operator, it needs something to operate on. Try plot(0,main=quote(NO^-{}))> Thanks in advance, > > G > > >> version >> > _ > platform i686-pc-linux-gnu > arch i686 > os linux-gnu > system i686, linux-gnu > status Patched > major 2 > minor 5.1 > year 2007 > month 07 > day 05 > svn rev 42131 > language R > version.string R version 2.5.1 Patched (2007-07-05 r42131) > >-- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907