Re: Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)]
Hello again Jack, I am trying to use ob-session-async as a workaround for this problem. In my R :session, the correct output is printed to screen, followed by a UUID if I use :results output html, which is printed as, e.g., [1] "ob_comint_async_R_end_4d2e818b7c2544da6f026d0413c7ac6c" Alternatively, if I use :results value html then the tempfile path is printed as: [1] "ob_comint_async_R_file_/tmp/babel-6BGHQK/R-QNasco" The problem, however, is that what is exported to html and displayed in the exported block is either the actual UUID or the tempfile path and not the results from evaluating the R code. In the case of the tempfile, the tempfile exists but is empty. Any advice as to how to resolve this would be greatly appreciated, thanks. Best regards, Steve On Wed, 11 Mar 2020 13:37:01 +1030 Steven Delean wrote: > Hi Jack, > > Thanks for your response. > > Yes, I am using :session evaluation here, set using #+PROPERTY: > > However, ":results value html" does not work for me. In fact, this produces no > table output at all in the resulting exported html file. > > The output sent to the R :session buffer is printed correctly (when using > either :results value html or :results output html). As you say, it is the > exporter that is removing ">" from the output. > > If I remove :session evaluation, I also get no output at all from these code > blocks in the exported html. > > The change has been introduced within the last 12 months, as my scripts > exported with correct html formatting when I used them for last years' > classes. > > Best regards, > Steve > > On Tue, 10 Mar 2020 17:17:48 -0700 > Jack Kamm wrote: > > > Hi Steve, > > > > Steven Delean writes: > > > > > HTML table produced from a source code block (using R code) does not > > > display because html code is not formatted correctly in the exported html > > > output. > > > > I believe this is the same issue as reported here: > > https://lists.gnu.org/archive/html/emacs-orgmode/2020-02/msg00267.html > > > > Though, that thread was for ":session" blocks, and it's unclear whether > > you're using session or non-session evaluation here. > > > > Anyways, that thread suggests that ":results value html" works > > correctly, does switching to that work for you? > > > > If I'm correct, the basic problem is that ob-R tries to remove > > interactive shell prompts like ">" from the output. This can also cause > > other problems. I think it can be fixed by changing ob-R to use > > `ess-eval-region' to evaluate code, I'll try to submit a patch for this > > after 9.4 is released.
Re: Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)]
Hi Jack, Thanks for your response. Yes, I am using :session evaluation here, set using #+PROPERTY: However, ":results value html" does not work for me. In fact, this produces no table output at all in the resulting exported html file. The output sent to the R :session buffer is printed correctly (when using either :results value html or :results output html). As you say, it is the exporter that is removing ">" from the output. If I remove :session evaluation, I also get no output at all from these code blocks in the exported html. The change has been introduced within the last 12 months, as my scripts exported with correct html formatting when I used them for last years' classes. Best regards, Steve On Tue, 10 Mar 2020 17:17:48 -0700 Jack Kamm wrote: > Hi Steve, > > Steven Delean writes: > > > HTML table produced from a source code block (using R code) does not display > > because html code is not formatted correctly in the exported html output. > > I believe this is the same issue as reported here: > https://lists.gnu.org/archive/html/emacs-orgmode/2020-02/msg00267.html > > Though, that thread was for ":session" blocks, and it's unclear whether > you're using session or non-session evaluation here. > > Anyways, that thread suggests that ":results value html" works > correctly, does switching to that work for you? > > If I'm correct, the basic problem is that ob-R tries to remove > interactive shell prompts like ">" from the output. This can also cause > other problems. I think it can be fixed by changing ob-R to use > `ess-eval-region' to evaluate code, I'll try to submit a patch for this > after 9.4 is released.
Bug: HTML not formatted correctly from R source code block [9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)]
Hi, HTML table produced from a source code block (using R code) does not display because html code is not formatted correctly in the exported html output. The source code block uses: #+begin_src R :results output html :exports both zd <- data.frame(a = 1:3, b = letters[1:3]) knitr:::kable(zd) #+end_src Each line in the html table that is produced is broken mid-line where a > symbol is replaced with a line feed. The html code that is produced shows that there is a line feed where there should be a > symbol after the ;" for each th header tag in the table. Thanks for your time, Best regards, Steve Emacs : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-09-17 Package: Org mode version 9.3.6 (9.3.6-23-g01ee25-elpaplus @ /home/opdfa/.emacs.d/elpa/org-plus-contrib-20200309/)
[Orgmode] Color of exported R code results using LaTeX listings
Hi everyone, I am using org-mode to make a beamer presentation that includes blocks of R code and wish to export the source code and results to pdf in color (using the listings package). The source code block syntax is highlighted successfully, but the output results of the executed R code are not colored at all. The results are presented in \begin{verbatim}...\end{verbatim}, whereas the source code is presented within \begin{lstlisting}...\end{lstlisting}. I can affect changes to the fontsize and color of the source code using \lstset in the .org document header, but not the results output from evaluating the code. Is there some way I can export these results in color? Thanks for any suggestions, Regards, Steve PS I have the follwing in my .emacs (require 'org-latex) (setq org-export-latex-listings t) (add-to-list 'org-export-latex-packages-alist '( listings)) (add-to-list 'org-export-latex-packages-alist '( color)) ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Color of exported R code results using LaTeX listings
Hi Rainer, Yes, you will need to provide arguments to the \lstset listings variable (i.e. add these arguments to a #+BEAMER_HEADER_EXTRA: line). Below are the subset of arguments that I am using so far, though greater customisation is available (see listings.pdf www.ctan.org/tex-archive/macros/latex/contrib/listings/listings.pdf). \lstset{ keywordstyle=\color{blue}, commentstyle=\color{red}, stringstyle=\color{green}, basicstyle=\ttfamily\small, columns=fullflexible, basewidth={0.5em,0.4em} } Cheers, Steve On Fri, 2010-09-17 at 10:00 +0200, Rainer M Krug wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 17/09/10 09:31, Steven Delean wrote: Hi everyone, I am using org-mode to make a beamer presentation that includes blocks of R code and wish to export the source code and results to pdf in color (using the listings package). The source code block syntax is highlighted successfully, but the output results of the executed R code are not colored at all. Hi This is not an answer to your question, but rather a question to you: I added your settings to my .emacs file, and I get fontification in the pdf output, but no color. Do I need any additional settings to get coloring of the source code? Cheers, Rainer The results are presented in \begin{verbatim}...\end{verbatim}, whereas the source code is presented within \begin{lstlisting}...\end{lstlisting}. I can affect changes to the fontsize and color of the source code using \lstset in the .org document header, but not the results output from evaluating the code. Is there some way I can export these results in color? Thanks for any suggestions, Regards, Steve PS I have the follwing in my .emacs (require 'org-latex) (setq org-export-latex-listings t) (add-to-list 'org-export-latex-packages-alist '( listings)) (add-to-list 'org-export-latex-packages-alist '( color)) ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Tel:+33 - (0)9 53 10 27 44 Cell: +27 - (0)8 39 47 90 42 Fax (SA): +27 - (0)8 65 16 27 82 Fax (D) : +49 - (0)3 21 21 25 22 44 Fax (FR): +33 - (0)9 58 10 27 44 email: rai...@krugs.de Skype: RMkrug -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyTIAIACgkQoYgNqgF2egrfiwCeNk5+mduTj/HamQs9lAQG5CEE zeIAn2kc+F+yL9XGyQu771zEKyFSxxin =/jMz -END PGP SIGNATURE- ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Re: Color of exported R code results using LaTeX listings
Thanks very much Rainer and Sébastien for your comments and information. However, I am still unable to get color output for the _result_ of evaluating R code blocks. #+source: Rcode #+begin_src R :results output :exports both x - 1:5 square - function(x) { x^2 } square(x) #+end_src ## below is the .tex code generated which results in fontified and colored source code (code within lstlisting), but non-colored results (within verbatim). \lstset{language=R} Rcode() $\equiv$ \begin{lstlisting} x - 1:5 square - function(x) { x^2 } square(x) \end{lstlisting} \begin{verbatim} [1] 1 4 9 16 25 \end{verbatim} So the question is how to color the output of text within \begin{verbatim} ...\end{verbatim} in an exported pdf (just a single color is fine)? Thanks for your time, Steve On Fri, 2010-09-17 at 11:13 +0200, Rainer M Krug wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 17/09/10 10:52, Sébastien Vauban wrote: Hi Steven and Rainer, Steven Delean wrote: This is not an answer to your question, but rather a question to you: I added your settings to my .emacs file, and I get fontification in the pdf output, but no color. Do I need any additional settings to get coloring of the source code? Yes, you will need to provide arguments to the \lstset listings variable See http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28251.html for examples of pretty-printed code. Thanks - that looks really nice. Nice example. As I said in the other email, that should go to worg. Instead of #+begin_LaTeX #+end_LaTeX I use #+LATEX_HEADER: \lstset{ #+LATEX_HEADER: keywordstyle=\color{blue}, #+LATEX_HEADER: commentstyle=\color{red}, #+LATEX_HEADER: stringstyle=\color{green}, #+LATEX_HEADER: basicstyle=\ttfamily\small, #+LATEX_HEADER: columns=fullflexible, #+LATEX_HEADER: basewidth={0.5em,0.4em} #+LATEX_HEADER: } And it also works. Cheers, Rainer Best regards, Seb - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Tel:+33 - (0)9 53 10 27 44 Cell: +27 - (0)8 39 47 90 42 Fax (SA): +27 - (0)8 65 16 27 82 Fax (D) : +49 - (0)3 21 21 25 22 44 Fax (FR): +33 - (0)9 58 10 27 44 email: rai...@krugs.de Skype: RMkrug -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEUEARECAAYFAkyTMS4ACgkQoYgNqgF2egp8egCggtSGTzSGjx3IICnt6AM0ibsV irYAmL73loKjAanP5pEg79LbcXZbccQ= =C9VB -END PGP SIGNATURE- ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Color of exported R code results using LaTeX listings
Hi Eric, Rainer and Sébastien, Thanks again for all your assistance. I was not able to achieve the results I was after exactly using any proposed solutions, but have found a way forward and outline my solution below in case it benefits others. The following allows fontification and syntax highlighting for source code and a single color for exported output, and works both for latex documents and beamer slides. NB: A single color for source code in exported documents can be acheived by adding e.g. \color{blue} to basicstyle. 1. The following must appear in your .emacs (require 'org-latex) (setq org-export-latex-listings t) (add-to-list 'org-export-latex-packages-alist '( listings)) (add-to-list 'org-export-latex-packages-alist '( color)) 2. Add the following to your .org document header to allow colors and 'nice' font #+LATEX_HEADER: \lstset{ #+LATEX_HEADER: keywordstyle=\color{blue}, #+LATEX_HEADER: commentstyle=\color{red}, #+LATEX_HEADER: stringstyle=\color{green}, #+LATEX_HEADER: basicstyle=\ttfamily\small, #+LATEX_HEADER: columns=fullflexible, #+LATEX_HEADER: basewidth={0.5em,0.4em} #+LATEX_HEADER: } 3. Also add the following to your .org document header to allow the output results of evaluating R (or other language) code to be in color #+LATEX_HEADER: \RequirePackage{fancyvrb} #+LATEX_HEADER: \DefineVerbatimEnvironment{verbatim}{Verbatim}{fontsize= \small,formatcom = {\color[rgb]{0.5,0,0}}} Hope it helps, Regards, Steve On Fri, 2010-09-17 at 08:24 -0400, Eric Schulte wrote: Hi Steven, If your R blocks are outputting actual R code, then you can use the code argument to the :results header argument to have the output exported as R code under listings instead of within verbatim blocks. --8---cut here---start-8--- #+begin_src R :results code 8 #+end_src #+results: #+BEGIN_SRC R 8 #+END_SRC --8---cut here---end---8--- Alternately if your output is some other language you could use the :results latex header argument and explicitly provide the listings wrapper yourself. Hope this Helps -- Eric Steven Delean steven.del...@adelaide.edu.au writes: Hi everyone, I am using org-mode to make a beamer presentation that includes blocks of R code and wish to export the source code and results to pdf in color (using the listings package). The source code block syntax is highlighted successfully, but the output results of the executed R code are not colored at all. The results are presented in \begin{verbatim}...\end{verbatim}, whereas the source code is presented within \begin{lstlisting}...\end{lstlisting}. I can affect changes to the fontsize and color of the source code using \lstset in the .org document header, but not the results output from evaluating the code. Is there some way I can export these results in color? Thanks for any suggestions, Regards, Steve PS I have the follwing in my .emacs (require 'org-latex) (setq org-export-latex-listings t) (add-to-list 'org-export-latex-packages-alist '( listings)) (add-to-list 'org-export-latex-packages-alist '( color)) ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode