Hi, I am using R and latex for generating report. I need R result to be in bold face. For instance. x<-c(1,0,2,4) I need to print its output in bold face. x *1 2 3 4* I attempted to use textbf{} but can not write R output inside it. How can i implement it. Thanks in advance. Regards -- View this message in context: http://r.789695.n4.nabble.com/R-Bold-font-and-Latex-tp4487535p4487535.html Sent from the R help mailing list archive at Nabble.com.
For a small number of elements you could use \Sexpr{}, i.e. <<echo= FALSE>>x<-c(1,0,2,4) @ x\\ \textbf{\Sexpr{x[1]}}\\ \textbf{\Sexpr{x[2]}}\\ \textbf{\Sexpr{x[3]}}\\ \textbf{\Sexpr{x[4]}}\\ Rgds, Rainer On Monday 19 March 2012 20:03:47 Manish Gupta wrote:> Hi, > > I am using R and latex for generating report. I need R result to be in bold > face. > > For instance. > x<-c(1,0,2,4) > > I need to print its output in bold face. > x > *1 > 2 > 3 > 4* > > I attempted to use textbf{} but can not write R output inside it. How can i > implement it. Thanks in advance. > > Regards > > -- > View this message in context: > http://r.789695.n4.nabble.com/R-Bold-font-and-Latex-tp4487535p4487535.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Or, with a little less typing: <<echo= FALSE>>x<-c(1,0,2,4) @ x\\ \begin{textbf} \Sexpr{x[1]}\\ \Sexpr{x[2]}\\ \Sexpr{x[3]}\\ \Sexpr{x[4]}\\ \end{textbf} On Tuesday 20 March 2012 10:14:38 Rainer Schuermann wrote:> For a small number of elements you could use \Sexpr{}, > i.e. > > <<echo= FALSE>>> x<-c(1,0,2,4) > @ > x\\ > \textbf{\Sexpr{x[1]}}\\ > \textbf{\Sexpr{x[2]}}\\ > \textbf{\Sexpr{x[3]}}\\ > \textbf{\Sexpr{x[4]}}\\ > > Rgds, > Rainer > > On Monday 19 March 2012 20:03:47 Manish Gupta wrote: > > Hi, > > > > I am using R and latex for generating report. I need R result to be in > > bold > > face. > > > > For instance. > > x<-c(1,0,2,4) > > > > I need to print its output in bold face. > > x > > *1 > > 2 > > 3 > > 4* > > > > I attempted to use textbf{} but can not write R output inside it. How can > > i > > implement it. Thanks in advance. > > > > Regards > > > > -- > > View this message in context: > > http://r.789695.n4.nabble.com/R-Bold-font-and-Latex-tp4487535p4487535.html > > Sent from the R help mailing list archive at Nabble.com. > > > > ______________________________________________ > > R-help at r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html and provide commented, > > minimal, self-contained, reproducible code. > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Great it works! But in my case i have to use text bf in loop (R). Since x is variable (row from file) which keeps on changing. How can i implement the above logic in loop. Regards -- View this message in context: http://r.789695.n4.nabble.com/R-Bold-font-and-Latex-tp4487535p4497610.html Sent from the R help mailing list archive at Nabble.com.