[R] Printing from R Console in colour

Greg Snow 538280 at gmail.com
Wed Jul 4 20:51:58 CEST 2012

As has been mentioned, the windows GUI will not do this for you, but
here are some options.

You can save or copy the transcript file and load it into an R syntax
aware editor (e.g. emacs with ess and others) which will do the
coloring/formatting for you and may be able to print with the

You can create the transcript using the etxtStart function in the
TeachingDemos package which can then be converted to a file with the
coloring (future versions will aslo create rtf or pandoc markdown
files to do something similar).

You can use the knitr package (or relatives) to run your code and have
the input vs. output nicely formatted.

On Wed, Jul 4, 2012 at 12:46 AM, amarjit chandhial
<a.chandhial at btinternet.com> wrote:
> Hi,I
> want to be able to print in colour from the R console i.e. commands (in navy) with
> results (in red) as on the console.
> From
> the console if I click on File -> Print, the commands with results print
> on my printer but only in monochrome, not in colour. Similarly, if I Edit ->
> Select All, Edit -> Copy --- and paste into Word, the commands and results
> are only in monochrome, not in colour.
> How
> do I enable R to print commands and results in colour? Thanks
>         [[alternative HTML version deleted]]
> ______________________________________________
> 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.

Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com

More information about the R-help mailing list