emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* R src block not highlighted in pdf
@ 2014-06-27 17:23 Shiyuan
  2014-06-27 18:38 ` Grant Rettke
  2014-06-27 18:39 ` Thomas S. Dye
  0 siblings, 2 replies; 6+ messages in thread
From: Shiyuan @ 2014-06-27 17:23 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 583 bytes --]

Hi,
    I have a R code src block in a org file. When exported to html, the R
code is correctly syntax highlighted. But when exported to pdf(latex), the
R code is not highlighted. I found this thread
https://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00379.html
<https://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00379.html> which
suggests setting the variable org-export-latex-listings. This variable
seems no longer exist in Org 8.2.6.  What variables shall I set so that the
R code is syntax highlighted when exported to pdf in Org mode 8.2.6?
Thanks.

Shiyuan

[-- Attachment #2: Type: text/html, Size: 792 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R src block not highlighted in pdf
  2014-06-27 17:23 R src block not highlighted in pdf Shiyuan
@ 2014-06-27 18:38 ` Grant Rettke
  2014-06-27 21:46   ` Shiyuan
  2014-06-27 18:39 ` Thomas S. Dye
  1 sibling, 1 reply; 6+ messages in thread
From: Grant Rettke @ 2014-06-27 18:38 UTC (permalink / raw)
  To: Shiyuan; +Cc: emacs-orgmode@gnu.org

Just ran apropos and it looks like org-latex-listings might be the one.
Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson


On Fri, Jun 27, 2014 at 12:23 PM, Shiyuan <gshy2014@gmail.com> wrote:
> Hi,
>     I have a R code src block in a org file. When exported to html, the R
> code is correctly syntax highlighted. But when exported to pdf(latex), the R
> code is not highlighted. I found this thread
> https://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00379.html
> which suggests setting the variable org-export-latex-listings. This variable
> seems no longer exist in Org 8.2.6.  What variables shall I set so that the
> R code is syntax highlighted when exported to pdf in Org mode 8.2.6? Thanks.
>
> Shiyuan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R src block not highlighted in pdf
  2014-06-27 17:23 R src block not highlighted in pdf Shiyuan
  2014-06-27 18:38 ` Grant Rettke
@ 2014-06-27 18:39 ` Thomas S. Dye
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas S. Dye @ 2014-06-27 18:39 UTC (permalink / raw)
  To: Shiyuan; +Cc: emacs-orgmode

Aloha Shiyuan,

Shiyuan <gshy2014@gmail.com> writes:

> Hi,
>     I have a R code src block in a org file. When exported to html, the R
> code is correctly syntax highlighted. But when exported to pdf(latex), the
> R code is not highlighted. I found this thread
> https://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00379.html
> <https://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00379.html> which
> suggests setting the variable org-export-latex-listings. This variable
> seems no longer exist in Org 8.2.6.  What variables shall I set so that the
> R code is syntax highlighted when exported to pdf in Org mode 8.2.6?
> Thanks.
>
> Shiyuan
> Hi, 
> I have a R code src block in a org file. When exported to html, the R
> code is correctly syntax highlighted. But when exported to pdf(latex),
> the R code is not highlighted. I found this thread
> https://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00379.html
> which suggests setting the variable org-export-latex-listings. This
> variable seems no longer exist in Org 8.2.6. What variables shall I
> set so that the R code is syntax highlighted when exported to pdf in
> Org mode 8.2.6? Thanks. 

That variable was renamed org-latex-listings in v. 8.

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R src block not highlighted in pdf
  2014-06-27 18:38 ` Grant Rettke
@ 2014-06-27 21:46   ` Shiyuan
  2014-06-27 22:37     ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Shiyuan @ 2014-06-27 21:46 UTC (permalink / raw)
  To: Grant Rettke, tsd; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]

I use the following setting. The keywords are correctly recognized and are
in bold face, but not in color. Are there any other steps for colors.

(require 'ox-latex)
  (add-to-list 'org-latex-packages-alist '("" "listings"))
  (add-to-list 'org-latex-packages-alist '("" "color"))

Also, thank you for reminding me of the `apropos`.


On Fri, Jun 27, 2014 at 11:38 AM, Grant Rettke <gcr@wisdomandwonder.com>
wrote:

> Just ran apropos and it looks like org-latex-listings might be the one.
> Grant Rettke | ACM, ASA, FSF, IEEE, SIAM
> gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
> “Wisdom begins in wonder.” --Socrates
> ((λ (x) (x x)) (λ (x) (x x)))
> “Life has become immeasurably better since I have been forced to stop
> taking it seriously.” --Thompson
>
>
> On Fri, Jun 27, 2014 at 12:23 PM, Shiyuan <gshy2014@gmail.com> wrote:
> > Hi,
> >     I have a R code src block in a org file. When exported to html, the R
> > code is correctly syntax highlighted. But when exported to pdf(latex),
> the R
> > code is not highlighted. I found this thread
> > https://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00379.html
> > which suggests setting the variable org-export-latex-listings. This
> variable
> > seems no longer exist in Org 8.2.6.  What variables shall I set so that
> the
> > R code is syntax highlighted when exported to pdf in Org mode 8.2.6?
> Thanks.
> >
> > Shiyuan
>

[-- Attachment #2: Type: text/html, Size: 2313 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R src block not highlighted in pdf
  2014-06-27 21:46   ` Shiyuan
@ 2014-06-27 22:37     ` Nick Dokos
  2014-06-29  5:57       ` Shiyuan
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2014-06-27 22:37 UTC (permalink / raw)
  To: emacs-orgmode

Shiyuan <gshy2014@gmail.com> writes:

> I use the following setting. The keywords are correctly recognized and are in bold face, but not in color. Are there any other
> steps for colors. 
>
> (require 'ox-latex)
>   (add-to-list 'org-latex-packages-alist '("" "listings"))
>   (add-to-list 'org-latex-packages-alist '("" "color"))
>

Not sure what version of listings I have, but I get the same behaviour:
bold face but no color. You have to modify the settings. For example:

\lstset{ %
  ...
  commentstyle=\color{green},      % comment style
  ...}

will colour comments green. See the listings manual for more details:

   http://mirror.hmc.edu/ctan/macros/latex/contrib/listings/listings.pdf

You might want to try pygments and minted instead. It's a bit fiddly
to set up but does give you colour out of the  box.

Nick

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: R src block not highlighted in pdf
  2014-06-27 22:37     ` Nick Dokos
@ 2014-06-29  5:57       ` Shiyuan
  0 siblings, 0 replies; 6+ messages in thread
From: Shiyuan @ 2014-06-29  5:57 UTC (permalink / raw)
  Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]

Thank you for the pointers. I got minted-pygments working using the
following setup:
(setq org-latex-listings 'minted)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-pdf-process
  '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o
%f" "pdflatex -shell-escape -interaction nonstopmode -output-directory %o
%f"  "pdflatex -shell-escape -interaction nonstopmode -output-directory %o
%f"))



On Fri, Jun 27, 2014 at 3:37 PM, Nick Dokos <ndokos@gmail.com> wrote:

> Shiyuan <gshy2014@gmail.com> writes:
>
> > I use the following setting. The keywords are correctly recognized and
> are in bold face, but not in color. Are there any other
> > steps for colors.
> >
> > (require 'ox-latex)
> >   (add-to-list 'org-latex-packages-alist '("" "listings"))
> >   (add-to-list 'org-latex-packages-alist '("" "color"))
> >
>
> Not sure what version of listings I have, but I get the same behaviour:
> bold face but no color. You have to modify the settings. For example:
>
> \lstset{ %
>   ...
>   commentstyle=\color{green},      % comment style
>   ...}
>
> will colour comments green. See the listings manual for more details:
>
>    http://mirror.hmc.edu/ctan/macros/latex/contrib/listings/listings.pdf
>
> You might want to try pygments and minted instead. It's a bit fiddly
> to set up but does give you colour out of the  box.
>
> Nick
>
>
>

[-- Attachment #2: Type: text/html, Size: 2274 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-29  5:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-27 17:23 R src block not highlighted in pdf Shiyuan
2014-06-27 18:38 ` Grant Rettke
2014-06-27 21:46   ` Shiyuan
2014-06-27 22:37     ` Nick Dokos
2014-06-29  5:57       ` Shiyuan
2014-06-27 18:39 ` Thomas S. Dye

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).