Re: Refresher on including R/ggplot2 output via latex/pdf?
> This is with emacs -Q and loading the minimal config from the initial > email. Any ideas on where I might look next? Sorry, I don't have many ideas here. Have you checked that ggplot works fine in a regular R session? I tried again with emacs -Q and the minimal config below and it still worked fine for me: ;; set load paths ;; set load dirs and global config options (add-to-list 'load-path "~/.emacs.d/elpa/org-plus-contrib-20190729/") (add-to-list 'load-path "~/.emacs.d/elpa/ess-20190627.1806/") (require 'ess) (require 'ess-r-mode) ; setup babel languages (org-babel-do-load-languages 'org-babel-load-languages '((R . t)))
Re: Refresher on including R/ggplot2 output via latex/pdf?
On Mon, Oct 28, 2019 at 12:02 AM Jack Kamm wrote: > > John Hendy writes: > > > On Sun, Oct 27, 2019 at 11:31 PM Jack Kamm wrote: > >> > >> Your code block looks fine to me. The typical R code block headers I use > >> is as follows: > > > > Did you try to reproduce my example, by chance? > > I've just now tried executing/exporting your example code blocks, and > they worked fine for me. > > When I execute them I get a link to a result png inserted into the > buffer, and when I export to latex/pdf I get the plot image inserted > correctly into the PDF. > > This is for the example code blocks in both the original and reply > emails, with and without the :session header. Wow, I'm stumped then. I just did a git pull and make clean/make and still get the same results. Org mode version 9.2.6 (release_9.2.6-559-ga01a8f @ /home/jwhendy/.elisp/org/lisp/) This is my full file after C-c C-c on the block: - * test #+begin_src R :session :results output graphics :file foo.png :exports results :eval never-export library(ggplot2) df <- data.frame(x=c(1, 2), y=c(2, 4)) p <- ggplot(df, aes(x = x, y = y)) + geom_point() print(p) #+end_src #+RESULTS: - This is with emacs -Q and loading the minimal config from the initial email. Any ideas on where I might look next? John
Re: Refresher on including R/ggplot2 output via latex/pdf?
John Hendy writes: > On Sun, Oct 27, 2019 at 11:31 PM Jack Kamm wrote: >> >> Your code block looks fine to me. The typical R code block headers I use is >> as follows: > > Did you try to reproduce my example, by chance? I've just now tried executing/exporting your example code blocks, and they worked fine for me. When I execute them I get a link to a result png inserted into the buffer, and when I export to latex/pdf I get the plot image inserted correctly into the PDF. This is for the example code blocks in both the original and reply emails, with and without the :session header.
Re: Refresher on including R/ggplot2 output via latex/pdf?
On Sun, Oct 27, 2019 at 11:31 PM Jack Kamm wrote: > > Your code block looks fine to me. The typical R code block headers I use is > as follows: Did you try to reproduce my example, by chance? > :session :results output graphics :file path/to/file.png :exports results > :eval never-export Using this: - #+begin_src R :session :results output graphics :file foo.png :exports results :eval never-export library(ggplot2) df <- data.frame(x=c(1, 2), y=c(2, 4)) p <- ggplot(df, aes(x = x, y = y)) + geom_point() print(p) #+end_src - I get an empty #+RESULTS: header, but no inserted file link. The plot is not in the exported PDF either. If I make it this: - #+begin_src R :session :results file graphics :file foo.png :exports results :eval never-export - I get the expected results, and the plot is in the output PDF. - #+RESULTS: [[file:foo.png]] - > One thing I've noticed, if I have an existing graphics device open, it > can mess up plots when executing an org-babel cell. Calling dev.off() a > few times fixes this for me. > > Note I pretty much always use R blocks with the :session argument, > things might be pretty different without it. I usually use :session as well (and have it in my actual document, but left it off for this test case). Still, using your header (minus changing the file path/type) didn't work for me. Thanks for taking a look, John
Re: Refresher on including R/ggplot2 output via latex/pdf?
Your code block looks fine to me. The typical R code block headers I use is as follows: :session :results output graphics :file path/to/file.png :exports results :eval never-export One thing I've noticed, if I have an existing graphics device open, it can mess up plots when executing an org-babel cell. Calling dev.off() a few times fixes this for me. Note I pretty much always use R blocks with the :session argument, things might be pretty different without it.
Refresher on including R/ggplot2 output via latex/pdf?
Greetings, I used to use orgmode + R/ggplot2 for some time, but for various reasons I've been using python almost exclusively for a couple years. I just went to use what I think is how I used to include ggplot2 results in PDF experts, but it's not working. In referring to the documentation, this is listed as an example: - https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html#org046a0ff * does produce a file, by using :results output #+begin_src R :file 3.png :results output graphics library(lattice) xyplot(1:10 ~ 1:10) #+end_src My test file: - * test #+begin_src R :results output graphics :exports results :file foo.png library(ggplot2) df <- data.frame(x=c(1, 2), y=c(2, 4)) p <- ggplot(df, aes(x = x, y = y)) + geom_point() print(p) #+end_src - I'm using emacs -Q, followed by M-x load-file RET path/to/min-config: - ;; set load paths ;; set load dirs and global config options (add-to-list 'load-path "~/.elisp/org/lisp/") (add-to-list 'load-path "~/.elisp/org/contrib/lisp/") (add-to-list 'load-path "~/.elisp/ess/lisp/") (require 'ess-site) ; setup babel languages (org-babel-do-load-languages 'org-babel-load-languages '((R . t))) - M-x org-version: Org mode version 9.2.4 (release_9.2.4-381-g226363 @ /home/jwhendy/.elisp/org/lisp/) When I run the code, the #+RESULTS: output is just blank. foo.png *is* generated, but the file link ([[foo.png]]) I'd expect is not getting inserted. It also, unsurprisingly, does not show in the file. Hmmm. One last hail Mary google incantation before I sent this off suggests that perhaps it's :results file now? Or :results graphics file? - https://stackoverflow.com/questions/50054520/python-vs-r-in-org-mode-babel-output-graphics Thanks for any pointers. I'd be happy to assist with updated documentation if the earlier link is now outdated/incorrect. Best regards, John
Re: Good way to pre/view LaTeX-lines?
* Suggest reviewing these free software packages: https://itsfoss.com/latex-editors-linux/ ** LyX and/or Kile are my faves ** Suggest trying these free software packages too apt-get install imaxima apt-get install maxima apt-get install maxima-emacs apt-get install texlive apt-get install texlive-math-extra On Sun, Oct 27, 2019 at 3:29 PM Dmitrii Korobeinikov wrote: > > https://orgmode.org/org.html#Previewing-LaTeX-fragments > > Thank you, William! This is great. > > After some digging, I still gotta wonder about a few things though. > 1. Is there some sort of live-editing feature? By that I mean, being able > to view the result (in a seperate buffer or minibuffer or even on the next > line) as you type out the expression. In particular, it would be nice to > know how to show an image in the minibuffer (and if possible at all) and > how to effectively feed what's under cursor to the latex backend and get > the image. > 2. It would be handy to autoremove the image overlay when the cursor is on > the fragment (and restore it when goes outside). I think no redraw should > be necessary unless the the formula is edited. > > I guess I would have to dig into org-toggle-latex-fragment to know how to > do these, but any help/pointers would be appreciated. > > Regards, > Dmitrii > > вс, 27 окт. 2019 г. в 21:07, William Denton : > >> On 27 October 2019, Dmitrii Korobeinikov wrote: >> >> > I am looking for a comfortable way to view LaTeX (for math formulas) in >> > org-mode. >> >> This shows how: >> >> https://orgmode.org/org.html#Previewing-LaTeX-fragments >> >> I don't use it often, but it works very nicely. >> >> Bill >> -- >> William Denton :: Toronto, Canada --- Listening to Art: >> https://listeningtoart.org/ >> https://www.miskatonic.org/ --- GHG.EARTH: https://ghg.earth/ >> Caveat lector. --- STAPLR: https://staplr.org/ >> >
Re: org-refile-target-verify-function - use inherited tag & todo
Hi Nate, On Sun, Oct 27 2019, Nathan Neff wrote: > 1) My org-agenda-files show up in the list. For example, foo.org and bar.org > show up in the refile targets, despite the > function should return nil if a heading does not contain "Tasks" Curiously, I’ve been scratching this itch just today. So I might as well share. I presume you are using some of the specific values of `org-refile-use-outline-path'. If that’s the case, the file level as a refile target is hardcoded in `org-refile-get-targets', independently of what you might have in `org-refile-target-verify-function'. We have somewhere in `org-refile-get-targets': #+begin_src emacs-lisp (when (eq org-refile-use-outline-path 'file) (push (list (file-name-nondirectory f) f nil nil) tgs)) (when (eq org-refile-use-outline-path 'buffer-name) (push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs)) (when (eq org-refile-use-outline-path 'full-file-path) (push (list (file-truename (buffer-file-name (buffer-base-buffer))) f nil nil) tgs)) #+end_src (`tgs' is the local variable which is collecting candidates for return). So, you might not use `org-refile-use-outline-path'. In this case the file info will be provided in the end of the refile target in parentheses (for targets outside the current buffer). And the file level will not be offered as a target. I, however like `org-refile-use-outline-path' and set it to 'file. But I also want to not be able to refile to the file level. So I advised `org-refile-get-targets' with: #+begin_src emacs-lisp (defun my/org-refile-filter-targets (orig-fun &rest args) (let ((targets (apply orig-fun args)) (agenda-files (mapcar #'file-name-nondirectory org-agenda-files))) (cl-remove-if (lambda (x) (member (car x) agenda-files)) targets))) (advice-add 'org-refile-get-targets :around #'my/org-refile-filter-targets) #+end_src This presumes (setq org-refile-use-outline-path 'file). If you use any other value, you should probably adjust the function’s let bound variables for the case. This is also sort of hackish, so exert your own due caution in choosing whether or not to use it. HTH, Gustavo.
Re: Discrepancy between documentation and implementation regarding comments
beware # at eob with no newline. On 10/27/19, Adam Porter wrote: > I agree with Robert that "whitespace" includes newlines in "Emacsland." > For example, with this document (the second "#" has a newline > immediately after, no spaces or tabs): > > #+BEGIN_SRC org > foo > > # comment > > bar > > # > > buzz > #+END_SRC > > This code matches both lines that begin with "#": > > (re-search-forward (rx bol "#" (1+ space))) > > But this code only matches the first one, because "blank" only matches > "horizontal whitespace": > > (re-search-forward (rx bol "#" (1+ blank))) > > So I think Pandoc is technically at fault here. However, outside of > Emacs's own context, I can see how the the documentation could be > misinterpreted in this case, so it's hard to fault them too much. :) > > > -- The Kafka Pandemic What is misopathy? https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html The disease DOES progress. MANY people have died from it. And ANYBODY can get it at any time.
Re: Discrepancy between documentation and implementation regarding comments
I agree with Robert that "whitespace" includes newlines in "Emacsland." For example, with this document (the second "#" has a newline immediately after, no spaces or tabs): #+BEGIN_SRC org foo # comment bar # buzz #+END_SRC This code matches both lines that begin with "#": (re-search-forward (rx bol "#" (1+ space))) But this code only matches the first one, because "blank" only matches "horizontal whitespace": (re-search-forward (rx bol "#" (1+ blank))) So I think Pandoc is technically at fault here. However, outside of Emacs's own context, I can see how the the documentation could be misinterpreted in this case, so it's hard to fault them too much. :)
org-refile-target-verify-function - use inherited tag & todo
Hi all, I want to filter my refile targets to "Tasks" headings. This snippet works: https://lists.gnu.org/r/emacs-orgmode/2016-02/msg00088.html There's a few things I'd like to improve on: 1) My org-agenda-files show up in the list. For example, foo.org and bar.org show up in the refile targets, despite the function should return nil if a heading does not contain "Tasks" 2) I would like to limit the "Task" headings to those that have a parent heading with a tag :project: I have :project: tag as exclude-from-inheritance, so this might be tricky 3) I would like the parent heading with :project: tag to have a TODO state that is not "done" and is not "cancelled". Can anyone help me improve on this? I think I'm missing some really easy documentation / examples. As an aside, is there a definitive "Org Mode API" doc that shows the functions that would assist me in writing a function to perform the above filtering? Something like a Javadoc for Org-Mode? There's great articles, etc. but I think it would be cool to have a "public" API defined / documented - otherwise it seems that I'm simply going through existing blogs, documentation etc and of course the source code. When going through source code, there's many functions that are named similarly and yes there's docs but I found myself wanting some kind of Javadoc-ish API documentation :) Thanks, --Nate
Re: Good way to pre/view LaTeX-lines?
> https://orgmode.org/org.html#Previewing-LaTeX-fragments Thank you, William! This is great. After some digging, I still gotta wonder about a few things though. 1. Is there some sort of live-editing feature? By that I mean, being able to view the result (in a seperate buffer or minibuffer or even on the next line) as you type out the expression. In particular, it would be nice to know how to show an image in the minibuffer (and if possible at all) and how to effectively feed what's under cursor to the latex backend and get the image. 2. It would be handy to autoremove the image overlay when the cursor is on the fragment (and restore it when goes outside). I think no redraw should be necessary unless the the formula is edited. I guess I would have to dig into org-toggle-latex-fragment to know how to do these, but any help/pointers would be appreciated. Regards, Dmitrii вс, 27 окт. 2019 г. в 21:07, William Denton : > On 27 October 2019, Dmitrii Korobeinikov wrote: > > > I am looking for a comfortable way to view LaTeX (for math formulas) in > > org-mode. > > This shows how: > > https://orgmode.org/org.html#Previewing-LaTeX-fragments > > I don't use it often, but it works very nicely. > > Bill > -- > William Denton :: Toronto, Canada --- Listening to Art: > https://listeningtoart.org/ > https://www.miskatonic.org/ --- GHG.EARTH: https://ghg.earth/ > Caveat lector. --- STAPLR: https://staplr.org/ >
Re: Discrepancy between documentation and implementation regarding comments
> On Sun, 27 Oct 2019 11:07:20 +0100, Thibault Polge said: Thibault> Hello, Thibault> According to Org-Mode documentation[1], >> Lines starting with zero or more whitespace characters followed by one >> ‘#’ and a whitespace are treated as comments and, as such, are not >> exported. 'whitespace' in emacs normally covers newline as well. Of course org might mean 'at least one space or tab', but as you say, thatʼs not what the implementation does. eg in org 9.2.6, org-fill-element does (re-search-backward "^[ \t]*#[ \t]*$" begin t) However org-at-comment-p does (looking-at "^[ \t]*# ") so thereʼs some possible inconsistency there. FWIW, Iʼd vote for expressing it as 'zero or more whitespace followed by one # followed by zero or more whitespace' Robert
Re: Good way to pre/view LaTeX-lines?
On 27 October 2019, Dmitrii Korobeinikov wrote: I am looking for a comfortable way to view LaTeX (for math formulas) in org-mode. This shows how: https://orgmode.org/org.html#Previewing-LaTeX-fragments I don't use it often, but it works very nicely. Bill -- William Denton :: Toronto, Canada --- Listening to Art: https://listeningtoart.org/ https://www.miskatonic.org/ --- GHG.EARTH: https://ghg.earth/ Caveat lector. --- STAPLR: https://staplr.org/
Good way to pre/view LaTeX-lines?
Hi, I am looking for a comfortable way to view LaTeX (for math formulas) in org-mode. I am not working with whole LaTeX files however, but rather with occasional lines of LaTeX inside an org-mode file. Good possibilities could be: 1. rendering a LaTeX-line *in the minibuffer* (when a cursor is placed on that line), or 2. rendering right there in the buffer. Emacs can show images, so these can't be too hard, right? Anyone know how to make this work? Best, Dmitrii
Discrepancy between documentation and implementation regarding comments
Hello, According to Org-Mode documentation[1], > Lines starting with zero or more whitespace characters followed by one > ‘#’ and a whitespace are treated as comments and, as such, are not > exported. The actual implementation differs on a subtle detail: Org-Mode will treat a line where the pound sign is immediatly followed by \n as a comment. I believe this is expected behavior, since it allows to comment out multiple paragraphs, and behaves as expected even when using `delete-trailing-whitespace`. I'm asking this because Pandoc follows strictly the org documentation, and treats a line containing only a pound sign as text. I opened a bug about this[2], where I've been asked –reasonably– to first make sure the bug isn't actually in Org Mode. [1] https://orgmode.org/manual/Comment-lines.html [2] https://github.com/jgm/pandoc/issues/5856 All the best, -- Thibault signature.asc Description: PGP signature