Re: ob-async

2023-03-20 Thread Roger Mason
Hello again,

Roger Mason  writes:


...snip...

> Is ob-async known to be broken?

No.  The user is broken.

It seems ob-async must be required in the file in which it is to be used
(I had it in my init file).  I ran into a further problem that is
resolved using:

(defun no-hide-overlays (orig-fun &rest args)
(setq org-babel-hide-result-overlays nil))
(advice-add 'ob-async-org-babel-execute-src-block :before
#'no-hide-overlays)

See:
https://www.reddit.com/r/emacs/comments/v2p4q9/orgbabel_problems_with_obasync/

Sorry for the noise.
Roger



ob-async

2023-03-20 Thread Roger Mason
Hello,

I installed ob-async from MELPA.  It does not seem to work.  For example
the following simple source block is run synchronously, i.e., emacs
shows the cursor as a watch and it is not possible to move point, or to
type, until the source block completes.

#+begin_src ruby :tangle test.rb
sleep 30
puts "Hello World"
#+end_src

#+begin_src sh :results output :async
ruby test.rb
#+end_src

#+RESULTS:
: Hello World


Is ob-async known to be broken?  I'm using

GNU Emacs 27.2 (build 1, amd64-portbld-freebsd12.2, X toolkit, cairo version 
1.17.4, Xaw3d scroll bars)
Org mode version 9.5.4 (release_9.5.4-602-g381a2a.dirty @ 
/home/rmason/.emacs.d/org-git/lisp/)

Thanks for any help.
Roger



Re: Compiling a C++ source block

2022-09-27 Thread Roger Mason
Hello,

tbanelwebmin  writes:

> You may try:
> #+header: :includes '("" "")
>
> Also, you have this commented line:
> # #+header: :var table= 
> It seems to break the #+header: chain
> Just remove it.
>
> By the way, to figure out future compilation problems, you may click on the 
> error:
> /tmp/babel-eqG2i0/C-src-3zG2ec.cpp:16:1: error: unknown type name 'ex' 
> This will open the source file actually being compiled.
>
> Have fun!

Thank you.  For the record, this works:

#+name: gnc_cav
#+header: :includes  '("" "")
#+header: :libs -I/usr/local/include -L/usr/local/lib -lginac -lcln
#+header: :flags -std=c++17
#+header: :namespaces std GiNaC
#+header: :var job="vectors" :var vol=113.13115406160385926 :var 
r=1.0995524816924328312
#+header: :var a=4.916 :var c=5.4054
#+header: :main no

Note the :libs line specifies an include path.  A bit unintuitive, but
it does the job.  Specifying a path in the :includes does not work (and
nothing in the docs suggests that it should).

By the way, 'C-c C-v v' also provides access to the file sent for compilation.

Thanks again,
Roger



Compiling a C++ source block

2022-09-26 Thread Roger Mason
Hello,

I wish to compile & run this source block in org-mode:

#+name: gnc_cav
#+header: :includes   
#+header: :libs -L/usr/local/lib -lginac -lcln
#+header: :flags -std=c++17
#+header: :namespaces std GiNaC
# #+header: :var table=
#+header: :var job="vectors" :var vol=113.13115406160385926 :var 
r=1.0995524816924328312
#+header: :var a=4.916 :var c=5.4054
#+header: :main no
#+begin_src  C++
ex vol(symbol a, symbol c)
{
  ex v = a*a * c * sin(60*Pi/180);

  return v;
}

ex coa(symbol a, symbol c) {
  ex covera = c/a;

  return covera;
}

ex scl(symbol a, symbol c, double ad, double cd) {

  //  symbol v("v");
  // symbol r("r");
  ex v = vol(a,c);

  ex r = coa(a,c);
  numeric three(3);

  //  ex s = 
power(v.subs(lst{a==ad,c==cd})),1/three)/(power(sin(60*Pi/180),1/three) * 
power(r.subs(lst{a==ad,c==cd}),1/three));
  ex s = 
power(v.subs(lst{a==ad,c==cd}),1/three)/(power(sin(60*Pi/180),1/three) * 
power(r.subs(lst{a==ad,c==cd}),1/three));

  return s;
}

ex scl(double vd, double rd) {

  numeric three(3);

  ex s = power(vd,1/three)/(power(sin(60*Pi/180),1/three) * 
power(rd,1/three));

  return s;
}

int main () {
  if ( strncmp(job, "volume", 6) == 0) { // ./v volume a c, calculate volume

symbol as("as");
symbol cs("cs");

ex v = vol(as, cs);
cout << "Volume = " << v.subs(lst{as == a, cs == c}).evalf() << "\n";

ex r = coa(as, cs);
cout << "c/a = " << r.subs(lst{as == a, cs == c}).evalf() << "\n";

ex a_calc = scl(as, cs, a, c);
cout << "a_calc = " << a_calc.evalf() << "\n";
cout << "c_calc = "
 << a_calc.evalf() * r.subs(lst{as == a, cs == c}).evalf() << "\n";

  } else if ( job,"vectors",5) == 0 ) { // ./v vectors vol c/a

//double vd = stod(argv[2]);
//double rd = stod(argv[3]);
ex a_calc = scl(v,r);
cout << "a_calc = " << a_calc.evalf() << "\n";
cout << "c_calc = " << a_calc.evalf() * rd << "\n";

//double a_scale = a;
  } // vectors
} // main

#+end_src

When I attempt compilation using 'C-c C-c' I get:

/tmp/babel-eqG2i0/C-src-3zG2ec.cpp:16:1: error: unknown type name 'ex'
ex vol(symbol a, symbol c)

and lots of similar errors.  I infer this is because ginac.h is not
found.  I have tried specifying  in ':includes' to no
avail.  I have tried specifying the full path to ginac.h:
 and specifying -I/usr/local/lib/ginac/ as
part of ':includes', but the error persists.

Maybe the C++ support is not set up to handle this use case, but perhaps
I am missing something.

Any help will be much appreciated.

Thanks,
Roger



Re: org-plot/gnuplot

2022-08-19 Thread Roger Mason
Hello Ihor,

Ihor Radchenko  writes:

> You need to have "gnuplot" Emacs package installed to be able to use
> org-plot and ob-gnuplot.

I had checked those were installed before posting.  What I had not
checked (duh) was that gnuplot would start and run.  There was a simple
linkage problem preventing that.  Now fixed.

Thanks,
Roger



org-plot/gnuplot

2022-08-18 Thread Roger Mason
Hello,

I want to plot energy against variable from this table.

#+plot: title "Final energy vs nkpt" ind:5 deps:(6) type:2d with:points 
|   workdir   |   calcdir|   volume| iscl |coa 
| variable | energy |
|-+--+-+--++--+|
| 1x1x1_220813_134036 | Elk.60s0z6oO | 763.4468395 |   29 | 1.0995524815439035 
|8 | -1322.63944536|
| 1x1x1_220813_134038 | Elk.KOuCkl6t | 763.4468395 |   43 | 1.0995524815439035 
|  8.1 | -1322.64008007|
| 1x1x1_220813_134039 | Elk.l2x2cHDI | 763.4468395 |  117 | 1.0995524815439035 
|  8.2 | -1322.64061753|
| 1x1x1_220813_134041 | Elk.tq49FwF2 | 763.4468395 |  200 | 1.0995524815439035 
|  8.3 | -2011.46480036|
| 1x1x1_220813_134042 | Elk.pz5sOddm | 763.4468395 |  200 | 1.0995524815439035 
|  8.4 | -1112.46462452|
| 1x1x1_220813_134043 | Elk.NpW1FMQf | 763.4468395 |   94 | 1.0995524815439035 
|  8.5 | -1322.64153726|
| 1x1x1_220813_134045 | Elk.V5uUKC7x | 763.4468395 |   36 | 1.0995524815439035 
|  8.6 |  -1322.6412902|
| 1x1x1_220813_134046 | Elk.o3ImwmnC | 763.4468395 |   39 | 1.0995524815439035 
|  8.7 | -1322.64159122|
| 1x1x1_220813_134048 | Elk.1Zujwhut | 763.4468395 |   45 | 1.0995524815439035 
|  8.8 | -1322.64182813|
| 1x1x1_220813_134049 | Elk.MqAyPaDJ | 763.4468395 |   48 |1.0995524815439035 | 
 8.9 | -1322.64200892|

I think the #+plot: invocation is correct for org-plot/gnuplot but when
run I just get "user-error: Current buffer has no process".

I appreciate any help offered.

Cheers,
Roger



Re: using org from git

2022-07-01 Thread Roger Mason
Hello Ihor,

Ihor Radchenko  writes:

> Roger Mason  writes:
>
>> File is missing: Cannot open load file, No such file or directory, org
>
> So, your elpa.el config file is loading helm-org-rifle, which loads org
> before you set load-path to the new version of Org. You need to put
> load-path setting somewhere before loading anything else.

Bingo!  Fixed.

Many thanks,
Roger



using org from git

2022-07-01 Thread Roger Mason
Hello,

I indvertently issued 'rm -rf *' in my home directory an lost some files
a couple of days ago.  I was able to restore most from backup, but
something is missing (or not working) in my org setup.

I have an org-git directory in .emacs.d that reports as 'org-version:
9.5.4 (release_9.5.4-602-g381a2a.dirty)' when I issue 'gmake'.  I have
this in my emacs init file (~/.emacs):

;;; Configuration Directory
(defconst ram:emacs-config-dir "~/.emacs.d/ModularConfigFiles/" "")

;; Utility to auto-load config files
  ;; utility function to auto-load my package configurations
  (defun ram:load-config-file (filelist)
(dolist (file filelist)
  (load (expand-file-name 
 (concat ram:emacs-config-dir file)))
   (message "Loaded config file:%s" file)
   ))

  ;; load my configuration files
(ram:load-config-file '(
"elpa.el"   ; Comment this if m(elpa) plays up.
"console.el"
"extra-paths.el"
"templates.el"
"org-config.el"
"org-ox-koma-config.el"

snip

In ~/.emacs.d/ModularConfigFiles/org-config.el I have, at the top:

(add-to-list 'load-path "/home/rmason/.emacs.d/org-git/lisp")
(add-to-list 'load-path "/home/rmason/.emacs.d/org-git/contrib/lisp")

When I start emacs and run 'org-version' it reports: 'Org mode version
9.4.4 (release_9.4.4 @ /home/rmason/.emacs.d/org-git/lisp/)'.  Notice
that the version (9.4.4) does not match what I have in the org-git
directory.  Thinking that the org that comes with emacs (27.2 in my
case) was interfering with the git version I tried moving
/usr/local/share/emacs/27.2/lisp/org out of the way.  That then causes
this error at startup:

File is missing: Cannot open load file, No such file or directory, org

This is the backtrace from emacs --debug-init:

Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such 
file or directory" "org")
  require(org)
  
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\207"
 [require cl-lib dash f helm org s] 2)
  require(helm-org-rifle)
  (lambda (pkg) (if (package-installed-p pkg) nil (package-install pkg)) 
(require pkg))(helm-org-rifle)
  mapc((lambda (pkg) (if (package-installed-p pkg) nil (package-install pkg)) 
(require pkg)) (auto-complete caml slime scad-mode ess helm-org-rifle 
haskell-mode lua-mode wisp-mode gnuplot meson-mode yasnippet tuareg muse iedit 
google-c-style geiser flymake-cursor ecb bbdb auto-complete-c-headers lsp-mode 
lsp-ui yasnippet lsp-java lsp-python-ms lsp-haskell helm-lsp lsp-treemacs 
dap-mode lsp-origami lsp-dart company flycheck lsp-pyright rust-mode php-mode 
scala-mode dart-mode clojure-mode typescript-mode))
  (let* ((pkg-list '(auto-complete caml slime scad-mode ess helm-org-rifle 
haskell-mode lua-mode wisp-mode gnuplot meson-mode yasnippet tuareg muse iedit 
google-c-style geiser flymake-cursor ecb bbdb auto-complete-c-headers lsp-mode 
lsp-ui yasnippet lsp-java lsp-python-ms lsp-haskell helm-lsp lsp-treemacs 
dap-mode lsp-origami lsp-dart company flycheck lsp-pyright rust-mode php-mode 
scala-mode dart-mode clojure-mode typescript-mode))) (package-initialize) 
(package-refresh-contents) (mapc #'(lambda (pkg) (if (package-installed-p pkg) 
nil (package-install pkg)) (require pkg)) pkg-list) (yas-global-mode) (add-hook 
'prog-mode-hook 'lsp))
  eval-buffer(# nil 
"/home/rmason/.emacs.d/ModularConfigFiles/elpa.el" nil t)  ; Reading at buffer 
position 2468
  load-with-code-conversion("/home/rmason/.emacs.d/ModularConfigFiles/elpa.el" 
"/home/rmason/.emacs.d/ModularConfigFiles/elpa.el" nil nil)
  load("/home/rmason/.emacs.d/ModularConfigFiles/elpa.el")
  (while --dolist-tail-- (setq file (car --dolist-tail--)) (load 
(expand-file-name (concat ram:emacs-config-dir file))) (message "Loaded config 
file:%s" file) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (let ((--dolist-tail-- filelist) file) (while --dolist-tail-- (setq file (car 
--dolist-tail--)) (load (expand-file-name (concat ram:emacs-config-dir file))) 
(message "Loaded config file:%s" file) (setq --dolist-tail-- (cdr 
--dolist-tail--
  ram:load-config-file(("elpa.el" "console.el" "extra-paths.el" "templates.el" 
"org-config.el" "org-ox-koma-config.el" "yasnippet.el" "utilities.el" 
"customisations.el" "haskell.el" "smtp.el" "kill-emacs.el" "science.el" 
"browser.el" "document-systems.el" "languages.el" "mu4e.el" "lsp-mode.el"))
  eval-buffer(# nil "/home/rmason/.emacs" nil t)  ; Reading at 
buffer position 960
  load-with-code-conversion("/home/rmason/.emacs" "/home/rmason/.emacs" t t)
  load("~/.emacs" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #) 
#f(compiled-function () #) t)
  command-line()
  normal-top-level()

Sorry for the long post, any help will be much appreciated.

Thanks,
Roger
emacs 27.2 on FreeBSD 12.3



Re:

2022-01-20 Thread Roger Mason


Immanuel Litzroth  writes:

> Just going by what I see, not having tried it:
> (setq haskell-process-args-stack-ghci (list "--ghci-options"
> "-XFlexibleContexts"))
>
> In your version the process gets 1 argument (with a space in it). In
> my version it gets 2 args.
> Immanuel

Indeed, that was it.  Many thanks,
Roger



[no subject]

2022-01-20 Thread Roger Mason
Hello,

I want to run stack ghci from haskell blocks in org-mode.  For the
task at I need to start ghci with command line option
-XFlexibleContexts.  I have this in my org-mode buffer:

#+begin_src emacs-lisp :results none
(setq haskell-process-type 'stack-ghci)
(setq haskell-process-args-stack-ghci (list "--ghci-options 
-XFlexibleContexts"))
#+end_src

but I get

Process haskell exited abnormally with code 1
Invalid option `--ghci-options -XFlexibleContexts'

in the inferior haskell buffer.

Does anyone know how to do what I want?

Thanks,
Roger



Re: return column from table as a column

2021-08-17 Thread Roger Mason
Hello,

Maxim Nikulin writes:

> Notice that you can get vertical representation of results as a list
> #+begin_src emacs-lisp :results list
>
> The following is a variation of a recipe suggested by Juan Manuel:
>
> #+name: to-column
> #+begin_src emacs-lisp :var lst=()
>(mapcar #'list lst)
> #+end_src
>
> #+begin_src emacs-lisp :var data=s1[,3] :post to-column(lst=*this*)
>data
> #+end_src
>
> To transform more than one column, the following idea may be useful
>
> (defun rotate (list-of-lists)
>(apply #'mapcar #'list list-of-lists))
>
> https://stackoverflow.com/questions/3513128/transposing-lists-in-common-lisp

Thank you very much.  I should really make the effort to re-learn
e-lisp.  Not having written anything in it for 10+ years has eroded my
abilities.

Best wishes,
Roger



Re: Plotting with R

2021-08-15 Thread Roger Mason
Hello Pedro,

Pedro Bruel writes:

> There's a typo on your source block header, it should be "output graphics",
> this would probably produce the output you're getting now.

Thank you!  You saved my sanity!

Roger



Plotting with R

2021-08-15 Thread Roger Mason
Hello,

I want graphics output from R:

#+begin_src R :results output grahics file :file coa_vs_a.pdf :exports results 
library(tidyverse)
library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user="rmason",dbname="test")
rs <- dbSendQuery(con,"with CTE as (select split_part(split_part(lattice_out, 
E'\n', 13), ' ', 18) as c,
 split_part(split_part(lattice_out, E'\n', 11), ' ', 11) as a
 from results where timestamp like '20210814-071%' order by a)
 select cast(a as double precision), cast(c as double precision)/ cast(a as 
float) as coa from CTE;")
df <- fetch(rs)
theplot <- ggplot(df,aes(x=a,y=coa)) + geom_point()
theplot
#+end_src

What I expect is a file 'coa_vs_a.pdf' on my filesystem & a link to it
in the org buffer.  What I get is a file 'Rplots.pdf' and an empty file
'coa_vs_a.pdf' with a link to the latter in the org buffer.

I've searched this topic and I _think_ the invocation above, one of many
I've tried, should work.

GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo
version 1.16.0, Xaw3d scroll bars)

Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
/home/rmason/.emacs.d/org-git/lisp/)

Thanks for your help.

Roger



Re: return column from table as a column

2021-08-14 Thread Roger Mason
Hello Juan,

Juan Manuel Macías writes:

> You're welcome. Just a minor fix: although the code works fine,
> naturally the asterisk in `let' was unnecessary. This is a new version
> with the code explained, in case you find it useful:
>
> #+begin_src emacs-lisp :var data=s1 col=3
>   (let* (
>;; return a list from elemens in column number `col'
>(list-from-column (mapcar (lambda (r) (format "%s" (nth col r))) data))
>;; make a list of lists = a new table that contains one single column
>(new-table (mapcar 'list list-from-column)))
> new-table)
> #+end_src

Many thanks for this.  A looong time ago I was capable of programming in
emacs-lisp.  Alas I have not maintained my skills.

Best wishes,
Roger



Re: return column from table as a column

2021-08-13 Thread Roger Mason


Hello Juan,

Juan Manuel Macías writes:

> #+name: s1
> | scale |  scale1 |   scale3 |  jid |
> | - | 1.00402 | 0.952329 | 1632 |
> | - | 1.00402 | 0.962247 | 1633 |
>
> #+begin_src emacs-lisp :var data=s1 col=3
> (let* ((column (mapcar (lambda (r) (format "%s" (nth col r))) data)))
>  (mapcar 'list column))
> #+end_src
>
> #+RESULTS:
> |  jid |
> | 1632 |
> | 1633 |

Thank you, I think I may be able to get this to work.

Roger



Re: return column from table as a column

2021-08-13 Thread Roger Mason
Hello Greg,

Greg Minshall writes:

> Roger,
>
>> Is there some means of changing 'data=s1[,3]' to accomplish this?
>
> there may be some more formal way (and i think some of the
> data.frame.alternative packages, like data.table:: or dplyr::, have
> their own ways), but you might try transposing
>
>> t(data=s1[,3])

I think you are implying that I should do this in R.  Please correct me
if I'm wrong.  I was hoping to avoid using a call to an external
library.

Thanks,
Roger



return column from table as a column

2021-08-13 Thread Roger Mason
Hello,

I need to extract a column from a table to use as input to a source
block.  I want the extracted column to be returned as a column but it is
returned as a row.  The following illustrates the problem:

#+name: s1
| scale |  scale1 |   scale3 |  jid |
| - | 1.00402 | 0.952329 | 1632 |
| - | 1.00402 | 0.962247 | 1633 |

#+begin_src emacs-lisp :var data=s1[,3]
data
#+end_src

#+RESULTS:
| jid | 1632 | 1633 |

I want:

|  jid |
| 1632 |
| 1633 |

Is there some means of changing 'data=s1[,3]' to accomplish this?

Thanks,
Roger

GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo
version 1.16.0, Xaw3d scroll bars)

Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
/home/rmason/.emacs.d/org-git/lisp/)



Re: how to avoid 0.0 in an org-table

2021-07-06 Thread Roger Mason
Hello Uwe,

Uwe Brauer writes:

> I obtain 0.0 in the last column, this looks bad, any idea how to avoid
> it?

I think you can use a printf format specification in the formula.

Cheers,
Roger



Re: Hiding results using :post

2021-06-08 Thread Roger Mason
Hello,

John Kitchin writes:

> This is doable with a hook and advice I think. The hook will hide the
> results if you use :results hide in the header.
>
> I had to use the advice to remove the results before hand, so that you
> toggle the visibility off. This is pretty lightly tested. you could
> eliminate
>
> (defun hide-results (&optional &rest args)
>   (let ((results (cdr (assoc :results (third (org-babel-get-src-block-info
> 'light))
> (when (string-match "hide" results)
>   (org-babel-hide-result-toggle t
>
> (add-hook 'org-babel-after-execute-hook 'hide-results)
>
> (advice-add 'org-babel-execute-src-block :before (lambda (&rest args)
> (org-babel-remove-result)))
>
> I guess there are other ways that might work too.
>
> #+BEGIN_SRC jupyter-python :results hide
> print(5)
> #+END_SRC
>
> #+RESULTS:
> : 5

That works very well.

Many thanks.

Roger



Hiding results using :post

2021-06-07 Thread Roger Mason
Hello,

I'd like to be able to hide results, for example when I expect the
them to span many lines.  I know I can hit =tab= on the #+RESULTS: line,
but I'd like to be able to set this automatically.

My most recent effort:

#+name: hideresults
#+begin_src emacs-lisp :results none :exports none
(add-to-invisibility-spec '(org-babel-hide-result . t))
#+end_src

run like this

#+header: :engine postgresql :dbhost "localhost"  :dbuser "rmason" :database 
"test" :colnames yes
#+header: :post hideresults
#+name: pgquery
#+begin_src sql
select timestamp,nempty0 from settings where timestamp like '%20210528%'
#+end_src

produces

#+RESULTS: pgquery
: nil

I'm sure there is a way to do this, but I need some pointers as to how.

Thanks for any help.

Roger

Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
/home/rmason/.emacs.d/org-git/lisp/)

GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo version 
1.16.0, Xaw3d scroll bars)



Re: Passing a variable into an R source block.

2021-05-29 Thread Roger Mason
Hello Charles & William,

Berry, Charles writes:

> data.frame($data) is not valid R syntax. If you are new to R doing some 
> tutorials will help.
>
> I suggest you use C-c C-v C-v (org-babel-expand-src-block) to see what the R 
> code is and debug the result given in the the *Org Babel Preview...* buffer.

You are correct, my R skills are _very_ rusty.  I did not know of
org-babel-expand-src-block, thanks for the pointer.  Very useful.

William Denton writes:

> The Org table is passed in to R as a data.frame, so all you need is this at 
> the 
> start (with stringr loaded in previously):

Thanks William, that got me going in the right direction.

Roger





Passing a variable into an R source block.

2021-05-28 Thread Roger Mason
Hello,

I have an SQL source block that returns this:

#+RESULTS: query

|date | jid   | te   | rgkmax | 
time | elapsed   |
|-+---+--++--+---|
| 20210528-053900 | 647_1 | 20210528-053900 1 -1333.58106425 |  7 | 
01:00:00 | Job Wall-clock time: 00:03:16 |
| 20210528-053900 | 647_1 | 20210528-053900 2 -1333.25006295 |  7 | 
01:00:00 | Job Wall-clock time: 00:03:16 |
| 20210528-053900 | 647_1 | 20210528-053900 3 -1332.40596663 |  7 | 
01:00:00 | Job Wall-clock time: 00:03:16 |
| 20210528-053900 | 647_1 | 20210528-053900 4 -1327.18802970 |  7 | 
01:00:00 | Job Wall-clock time: 00:03:16 |
| 20210528-053900 | 647_1 | 20210528-053900 5 -1320.63944318 |  7 | 
01:00:00 | Job Wall-clock time: 00:03:16 |


I would like to pass this into R for further processing.  At the moment
I have this:

#+begin_src R :session :colnames yes :var data=query
  r <- data.frame($data)
  t <- data.frame( str_split_fixed(r$te, " ", 3) )
  colnames(t) <- c('date','cycle','energy')
  df <- data.frame(r$date,r$jid,t$cycle,t$energy,r$x,r$time,r$elapsed)
  # colnames(df) <- c('date','jid','cycle','energy','time','elapsed')
  # df <- transmute(df,date,jid,cycle,energy,time,elapsed = 
str_remove(elapsed,"Job Wall-clock time: "))
  # tail(filter(df,jid == '$jid'),1)$energy
#+end_src

and the output is:

  /tmp/unknown!4fCXoM:20:17: unexpected '$'
19:})
20: r <- data.frame($

I presume that is because R uses '$' to select a column from a data
frame.

I tried quoting like this:

r <- data.frame("$data")

but the output is then:

#+RESULTS:
| t.cycle | t.energy |
|-+--|

whereas I was expecting 7 columns of data from data frame 'df'.

I don't know if this is an org problem or an R problem, but if someone
can cast light on it, please do.

Thanks,
Roger

GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo
version 1.16.0, Xaw3d scroll bars)
Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @ 
/home/rmason/.emacs.d/org-git/lisp/)



raw replace not working

2020-03-11 Thread Roger Mason
Hello,

I using Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
/home/rmason/.emacs.d/org-git/lisp/) in GNU Emacs 26.3 (build 1,
amd64-portbld-freebsd11.3, X toolkit, Xaw3d scroll bars).

Here is an ECM:

#+begin_src shell :results raw replace
#!/usr/bin/env zsh

mkdir -p Supercell
for i in 1 2 3
do
touch Supercell/111_stuff.cif
done
ls Supercell

#+end_src

#+RESULTS:
111_stuff.cif
111_stuff.cif
111_stuff.cif

Is there something I'm doing wrong or is this a limitation of org 9.2.3?

Cheers,
Roger



Re: [O] Output result of source block to a file

2019-06-08 Thread Roger Mason
Hello John,

John Kitchin  writes:

> you probably figured out the "import io" and "f = io..." line are not
> necessary here.

Indeed.

> I couldn't figure out a reasonable way to use :results graphics link
> that didn't result in repeating the filename more than desired. These
> also both work, but seem to both require repeating the filename twice.
>
> #+BEGIN_SRC python :results graphics link :var fname="test.png" :file 
> "test.png"
> import matplotlib.pyplot as plt
>
> plt.plot([1, 2, 3, 1])
> plt.savefig(fname)
> #+END_SRC
>
> #+BEGIN_SRC python :results graphics link :file "test.png"
> import matplotlib.pyplot as plt
>
> plt.plot([1, 2, 3])
> plt.savefig("test.png")
> #+END_SRC
>
> Something like this should work, but there seem to be some extra bytes
> getting put in the png file from the decoding, and latin-1 is the only
> one I can get to work. If anyone knows how to get this to work, I am
> interested in seeing it!
>
> #+BEGIN_SRC python :results value :file "io.png"
> import matplotlib.pyplot as plt
> import io
> buf = io.BytesIO()
>
> plt.plot([1, 2, 3])
> plt.savefig(buf, format='png')
>
> s = buf.getvalue()
> return s.decode('latin-1')
> #+END_SRC
>
>
> In general though, all of these are much more work than using
> ob-ipython, which just puts images in the buffer for you.

I will investigate that, thanks for the tip.  I began this bit of work
using gnuplot for making x-y plots, but I find that gnuplot syntax gets
messy for anything but simple data.  I am not a particular fan
of python so I'm also looking into guile & racket for plotting.

Thanks for your help, it is much appreciated.

Roger



Re: [O] Output result of source block to a file

2019-06-07 Thread Roger Mason
Hello John,

John Kitchin  writes:

> I think you can use something like this:
>
> #+BEGIN_SRC python :results output file :var fname="test.png"
> import matplotlib.pyplot as plt
> import io
>
> f = io.StringIO()
> plt.plot([1, 2, 3, 17])
> plt.savefig(fname)
> print(fname, end='')
> #+END_SRC
>
> It is in Python3.

Thank you.  That works.

Best wishes,
Roger



Re: [O] Output result of source block to a file

2019-06-06 Thread Roger Mason
Hello again,

stardiviner  writes:

> Roger Mason  writes:
>
>> Hello,
>>
>> I want to output the result of the evaluation of a (python) source block
>> to a (graphics) file and have a link to the file inserted in the buffer.
>
> For this, you should try updated header arguments like ":results graphics 
> link"
> or ":results file link".

I updated to Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @ 
/home/rmason/.emacs.d/org-git/lisp/)

This works but sets the results to verbatim, hence the exported &
compiled code does not include the graphic.

#+name: scaleplot03
#+begin_src python :results output graphics link :exports results :var 
data=test :var file="scaleplot03.pdf"
  import matplotlib.pyplot as plt
  import csv

  scale = []
  lescale = []
  cdscale = []

  energy = []
  leenergy = []
  cdenergy = []

  for row in data:
  scale.append(float(row[0]))
  energy.append(float(row[1]))
  if int(row[2]) != 0:
 lescale.append(float(row[0]))
 leenergy.append(float(row[1]))
  if int(row[3]) != 0:
 cdscale.append(float(row[0]))
 cdenergy.append(float(row[1]))

  plt.plot(scale,energy, 'r+')
  plt.plot(lescale,leenergy, 'go')
  plt.plot(cdscale,cdenergy, 'bo')
  plt.xlabel('scale')
  plt.ylabel('energy (Ha)')
  plt.title('Energy vs scale')
  plt.legend()
  plt.savefig(file)
  print ("./%s" % file)
#+end_src

#+RESULTS: scaleplot03
: ./scaleplot03.pdf

This header does not work either:
#+name: scaleplot04
#+begin_src python :results file link :exports results :var data=test :var 
file="scaleplot04.pdf"
( same pythone code here)

#+RESULTS: scaleplot04
[[file:None]]
]]
#+end_src

Thank you for your help.

Roger





Re: [O] Output result of source block to a file

2019-06-06 Thread Roger Mason
Hello,
Ken Mankoff  writes:

>
> What about :var file="scaleplot02.pdf".

That was my starting point, but the resulting link is prefixed by ':'

Perhaps I should upgrade org.

Cheers,
Roger




Re: [O] Output result of source block to a file

2019-06-06 Thread Roger Mason
Hello,

stardiviner  writes:

> Roger Mason  writes:
>
>> Hello,
>>
>> I want to output the result of the evaluation of a (python) source block
>> to a (graphics) file and have a link to the file inserted in the buffer.

>> #+begin_src python :results value file :file scaleplot02.pdf :exports 
>> results :var data=test

...snip...

>>   plt.savefig(file)
>>   print ("[[./%s]]" % file)
>> #+end_src

> For this, you should try updated header arguments like ":results graphics 
> link"
> or ":results file link".

Thanks for your reply.

The current incarnation:

#+begin_src python :results graphics link :exports results :var data=test :var 
file="scaleplot2.pdf"

The output:
#+RESULTS: scaleplot02
: None

I'm guessing I have the syntax wrong.  Is it documented somewhere?  I'm
on Org mode version 9.1.13 (release_9.1.13-784-ged7d1d @
/home/rmason/.emacs.d/org-git/lisp/).

Cheers,
Roger



[O] Output result of source block to a file

2019-06-05 Thread Roger Mason
Hello,

I want to output the result of the evaluation of a (python) source block
to a (graphics) file and have a link to the file inserted in the buffer.

Here is the code:

#+begin_src python :results value file :file scaleplot02.pdf :exports results 
:var data=test
  import matplotlib.pyplot as plt
  import csv

  scale = []
  lescale = []
  cdscale = []

  energy = []
  leenergy = []
  cdenergy = []

  for row in data:
  scale.append(float(row[0]))
  energy.append(float(row[1]))
  if int(row[2]) != 0:
 lescale.append(float(row[0]))
 leenergy.append(float(row[1]))
  if int(row[3]) != 0:
 cdscale.append(float(row[0]))
 cdenergy.append(float(row[1]))

  plt.plot(scale,energy, 'r+')
  plt.plot(lescale,leenergy, 'go')
  plt.plot(cdscale,cdenergy, 'bo')
  plt.xlabel('scale')
  plt.ylabel('energy (Ha)')
  plt.title('Energy vs scale')
  plt.legend()
  plt.savefig(file)
  print ("[[./%s]]" % file)
#+end_src

This is the error:

NameError: name 'file' is not defined

Obviously the syntax on the begin_src line is wrong, but what should it
be instead?

Thanks,
Roger



Re: [O] Mean of a column in a remote table

2018-12-13 Thread Roger Mason
Hello Eric,

Eric S Fraga  writes:

> Umm, I think you want to do the mean of the remote entries so try:
> vmean(remote($1,@2..@>)) but I also wonder whether you need to specify
> the column as well for remote references?  At least, when I have done
> this, I have specified both rows and columns,
> e.g. vmean(remote(xxx,@<$>..@>$>)).

Yes!  That was it.

Many thanks for your help.

Roger



Re: [O] Mean of a column in a remote table

2018-12-13 Thread Roger Mason
Hello Eric,

Eric S Fraga  writes:

> That should have been @>, not @<.

| Data  | a  |
|---+|
| mic_2_in_648_cell | #ERROR |
#+tblfm: $2=remote($1,vmean(@2..@>))

and 'Cells in the region copied, use M-x org-table-paste-rectangle to
paste them in a table.' in the Message buffer.

Thanks,
Roger



[O] Mean of a column in a remote table

2018-12-13 Thread Roger Mason
Hello,

I _think_ this question has a simple answer, but I cannot find it.

I need the mean of a column in a remote table.  My current attempt looks
like this:

| Data  | a |
|---+---|
| mic_2_in_648_cell |   |
#+tblfm: $2=remote($1,vmean(@2..@-1))

#+name: mic_2_in_648_cell
| a |
|---|
| 28.886207 |
| 28.900981 |
| 28.886101 |
| 28.900659 |
| 28.900526 |
| 28.886694 |
| 28.886559 |
|  28.90024 |
| 28.900524 |
| 28.900583 |
| 28.886496 |

The second column of the upper table is intended to receive the mean of
table 'mic_2_in_648_cell'.  Instead I get the error 'Row descriptor -1
leads outside table'.

This is a cut down example that captures the essence.

Thanks for any help.

Roger
GNU Emacs 26.1 (build 1, i386-portbld-freebsd11.2, GTK+ Version 3.22.29)
Org mode version 9.1.13 (release_9.1.13-784-ged7d1d @ 
/home/rmason/.emacs.d/org-git/lisp/)



Re: [O] Koma letter fails [SOLVED]

2018-07-16 Thread Roger Mason
Hello,

Roger Mason writes:

> I just attempted to use the koma-letter module but it fails:
>
> concat: Symbol’s function definition is void: org-latex--make-preamble
>
> I'm guessing some other symbol has replaced it, but what?
>

Found I was using  version of ox-koma-letter.el that did not come with
org-mode.  The problem has been resolved.  Sorry for the noise.

Roger



[O] Koma letter fails

2018-07-16 Thread Roger Mason
Hello,

I just attempted to use the koma-letter module but it fails:

concat: Symbol’s function definition is void: org-latex--make-preamble

I'm guessing some other symbol has replaced it, but what?

Cheers,
Roger

GNU Emacs 25.3.1 (amd64-portbld-freebsd11.1, GTK+ Version 3.22.29) of
2018-04-24
Org mode version 9.1.13 (release_9.1.13-890-g76e38e @
/home/rmason/.emacs.d/org-mode/lisp/)



Re: [O] Symbol’s value as variable is void: haskell-prompt-regexp

2018-06-04 Thread Roger Mason
Hello,

Nick Dokos  writes:

> Please provide a backtrace. 

This source block:

#+begin_src haskell :exports results 
nanmol=[1,1,3,2,1,2,3]
ncatmol=[2,1,2,1,2,1,2]
#+end_src
produces the error in the attached backtrace

Steps to reproduce:

1. emacs -Q -l init

with init being:

 Org-mode
(add-to-list 'load-path "/home/rmason/.emacs.d/org-git/lisp")
(add-to-list 'load-path "/home/rmason/.emacs.d/org-git/contrib/lisp")
(add-to-list 'load-path "/home/rmason/.emacs.d/elpa/haskell-mode-20180601.143")
(org-babel-do-load-languages
 'org-babel-load-languages
 '((shell . t)
   (emacs-lisp . t)
   (haskell . t)
   ))

2. evaluste the source block

GNU Emacs 25.3.1 (i386-portbld-freebsd11.1, GTK+ Version 3.22.29) of 2018-04-26
Org mode version 9.1.13 (release_9.1.13-784-ged7d1d @
/home/rmason/.emacs.d/org-git/lisp/)

Cheers,
Roger



haskell_error.debug
Description: Binary data


Re: [O] Symbol’s value as variable is void: haskell-prompt-regexp

2018-06-04 Thread Roger Mason
Hello,

Nick Dokos  writes:

> Try evaluating
>
> (require 'inf-haskell)
>
> and then try evaluating the source code block again.
>
> Untested.

That seems to have helped, but now I'm getting:

‘org-babel-script-escape’ expects a string

Many thanks,
Roger




[O] Symbol’s value as variable is void: haskell-prompt-regexp

2018-06-04 Thread Roger Mason
Hello,

GNU Emacs 25.3.1 (i386-portbld-freebsd11.1, GTK+ Version
3.22.29) of 2018-04-26

Org mode version 9.1.13 (release_9.1.13-784-ged7d1d @ 
/home/rmason/.emacs.d/org-git/lisp/)

Attempting to run a haskell code block:

#+begin_src haskell :exports results 
cations=["Na","Mg","Al","Si","K","Ti","Fe"]
atwt=[22.9897,24.305,26.9815,28.0855,39.0983,47.867,55.845]
nanmol=[1,1,3,2,1,2,3]
ncatmol=[2,1,2,1,2,1,2]
anwt= replicate (length atwt) 15.9994
#+end_src

gives this message:
executing Haskell code block...
run-hooks: Symbol’s value as variable is void: haskell-prompt-regexp

Any help in solving this will be most appreciated.

Thanks,
Roger



[O] [OT] nobody (none)

2018-03-26 Thread Roger Mason
Hello,

An off topic problem.  I'm asking here because I noticed this problem
first in this list, but it has spread.

I read e-mail using gnus (v5.13) in emacs (25.3.1) on FreeBSD (10.3).
Some months ago I noticed some messages in this list displaying with
sender 'nobody' and subject '(none)' in gnus.  As the months have passed
the number of such messages has increased many-fold and spread to other
lists.  On opening the offending e-mail it is usual that the message has
both sender and subject fields with plausible contents.  Often, but not
exclusively, the 'nobody' messages originate from gmail accounts.

I have not changed any settings at my end so I assume some commonly used
component of the chain of email applications has changed settings and
that I need to respond to that change.  But where? and what?

Any hints on where to look would be most helpful.

Again, sorry for the OT message.

Roger



Re: [O] C++ code block not linked [SOLVED]

2017-11-29 Thread Roger Mason
Hello,

Nick Dokos  writes:

> All very good info, but why did the OP not have a g++?  Using a
> non-linux operating system? Using a non-GNU tool chain? Inquiring
> minds want to know...

Running on FreeBSD 10.3, which uses clang/clang++ by default.  That
said, I _do_ have gcc 5.4.0 installed and accessible as gcc/g++, so I
don't know why it did not work.

Cheers,
Roger



Re: [O] C++ code block not linked [SOLVED]

2017-11-28 Thread Roger Mason
Hello,

Roger Mason  writes:

> It compiles fine:
>
> c++ -std=c++11 -I/usr/local/include -L/usr/local/lib -lginac
> C-src-1053hn1.cpp

Solved by setting:

(setq org-babel-C++-compiler "c++")

I don't recall having had to do this before.

Phew! Very glad to have this working again.  I'm not aware of any other tool
that is as good as org-mode for literate programming and reproducible
research.  A big thank you to those who created and maintain it.

Cheers,
Roger



Re: [O] C++ code block not linked

2017-11-27 Thread Roger Mason
Hello Thierry,

Thierry Banel  writes:

> You may try to mimic org-babel in a shell, and see what happens.
>
> cd /tmp/babel-29466ws7
> g++ -std=c++11 -I/usr/local/include C-src-29466moy.cpp -L/usr/local/lib 
> -lginac
>
> (of course you need to change the random names like babel-29466ws7 by the 
> actual ones as generated
> on your system).

It compiles fine:

c++  -std=c++11 -I/usr/local/include -L/usr/local/lib -lginac C-src-1053hn1.cpp

C-src-1053hn1.cpp:16:10: warning: 'operator=' is deprecated 
[-Wdeprecated-declarations]
eqns = a*x+b*y==3, x-y==b;
 ^
/usr/local/include/ginac/container.h:199:27: note: 'operator=' declared here
container_init operator=(const ex & x) attribute_deprecated;
 ^
C-src-1053hn1.cpp:17:10: warning: 'operator=' is deprecated 
[-Wdeprecated-declarations]
vars = x, y;
 ^
/usr/local/include/ginac/container.h:199:27: note: 'operator=' declared here
container_init operator=(const ex & x) attribute_deprecated;
 ^
2 warnings generated.

Thanks for your help
Roger



Re: [O] C++ code block not linked

2017-11-26 Thread Roger Mason
Hello,

Thierry Banel  writes:

> On 25/11/2017 15:59, Roger Mason wrote:
>> This code compiles fine on command line but org-babel can't link it.
>>
>> #+BEGIN_SRC C++ :flags "-std=c++11 -I/usr/local/include" :libs  
>> "-L/usr/local/lib -lginac"
>> #include 
>> #include 
>> using namespace std;
>> using namespace GiNaC;
>>
>> int main () {
>>  symbol a("a"), b("b"), x("x"), y("y");
>>  lst eqns, vars;
>>  eqns = a*x+b*y==3, x-y==b;
>>  vars = x, y;
>>  cout << lsolve(eqns, vars) << endl;
>>   // -> {x==(3+b^2)/(b+a),y==(3-b*a)/(b+a)
>>
>> return 0;
>> }
>> #+END_SRC
>>
>> The error buffer contains many lines like this:
>>
>> /tmp//ccv5YYn1.o: In function `main':
>> C-src-1046xti.cpp:(.text+0x67): undefined reference to 
>> `GiNaC::symbol::symbol(std::__cxx11::basic_string> std::char_traits, std::allocator > const&)'
>>
>
> I get the correct result:
>
> #+RESULTS:
> | {x==(3+b^2)*(a+b)^(-1) | y==-(-3+a*b)*(a+b)^(-1)} |
>
> I use Or mode version 9.1.1

I just upgraded to Org mode version 9.1.3 (release_9.1.3-185-g579fa1 @
/home/rmason/.emacs.d/org-git/lisp/) and I'm still getting the link
error.

Cheers,
Roger



[O] C++ code block not linked

2017-11-25 Thread Roger Mason
Hello,

This code compiles fine on command line but org-babel can't link it.

#+BEGIN_SRC C++ :flags "-std=c++11 -I/usr/local/include" :libs  
"-L/usr/local/lib -lginac"
#include 
#include 
using namespace std;
using namespace GiNaC;

int main () {
symbol a("a"), b("b"), x("x"), y("y");
lst eqns, vars;
eqns = a*x+b*y==3, x-y==b;
vars = x, y;
cout << lsolve(eqns, vars) << endl;
 // -> {x==(3+b^2)/(b+a),y==(3-b*a)/(b+a)

return 0;
}
#+END_SRC

The error buffer contains many lines like this:

/tmp//ccv5YYn1.o: In function `main':
C-src-1046xti.cpp:(.text+0x67): undefined reference to 
`GiNaC::symbol::symbol(std::__cxx11::basic_string, 
std::allocator > const&)'


Org mode version 9.0.3 (release_9.0.3-170-gfed1cf @
/home/rmason/.emacs.d/org-git/org-mode/lisp/)

GNU Emacs 25.3.1 (i386-portbld-freebsd10.3, GTK+ Version 3.22.15) of
2017-11-22

Thanks for any help.

Roger



[O] Troublesome python block

2017-10-11 Thread Roger Mason
hello,

This python block:

#+BEGIN_SRC python :session true :results output
  import numpy as np
  from ase import Atoms
  from ase.calculators.gulp import GULP, Conditions

  quartz = Atoms(symbols='Si3O6', pbc=np.array([True,True,True], dtype=bool),
   cell=np.array([[4.916, 0.0, 0.0], [-2.4573, 
4.257380885004301, 0.0], [0.0, 0.0, 5.4054]]),
   positions=np.array([[ 2.3016712,   0.,  1.80161982],
  [-1.1508356, 1.99330573, 3.60341982],
  [ 1.3071644, 2.26407515, 5.40521982],
  [ 1.3767258, 1.13288905, 1.15189074],
  [ 3.2465264, 0.62583499, 2.95369074],
  [ 2.7507478, 2.49865684, 4.75549074],
  [ 0.2927478, 1.75872404, 4.25350926],
  [-1.0812742, 3.12449183, 2.45170926],
  [ 0.7885264, 3.63154589, 0.64990926]]))
#+END_SRC

produces this output:

#+RESULTS:
#+begin_example
Python 2.7.13 (default, Jul  2 2017, 01:20:25) 
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] 
on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
python.el: native completion setup loaded
and
as
assert
break
class
continue
def
del
elif
else
[SNIPPED]
AttributeError
OverflowError

0__dummy_completion__  1__dummy_completion__
#+end_example

The same python script produces no errors in a python interpreter
started from the command line and it reports no errors when run as
'python twaddle.py'.

Any help in debugging this will be much appreciated.

Roger

Org mode version 9.0.3 (release_9.0.3-170-gfed1cf @
/home/rmason/.emacs.d/org-git/org-mode/lisp/)
GNU Emacs 25.2.1 (i386-portbld-freebsd10.3, GTK+ Version 3.22.15) of 2017-07-03
Python 2.7.13 (default, Jul  2 2017, 01:20:25) 
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] 
on freebsd10



Re: [O] including an image in LaTeX export

2017-04-26 Thread Roger Mason
Hi Nicolas,

Nicolas Goaziou  writes:
> Roger Mason  writes:
>>
>> I need to include an image in a document to be exported to LaTeX.

> It should be:
>
>   [[file:macstuff.jpg]]

Many thanks.  As I said earlier, been away from Org for a while.

Cheers,
Roger



Re: [O] including an image in LaTeX export

2017-04-26 Thread Roger Mason

John Kitchin  writes:

> You aren't using a path. Try [[./macstuff.jpg]] instead.
>

That was it.  Must have been away from Org for too long.

Thanks,
Roger



[O] including an image in LaTeX export

2017-04-26 Thread Roger Mason
Hello,

I need to include an image in a document to be exported to LaTeX.
Minimal example:

#+TITLE: test

* test section

[[macstuff.jpg]]

When running the export I get "user-error: Unable to resolve link:
nil".  I've tried including the image as eps, to no avail.

Can someone tell me what I'm doing wrong?

Thanks,
Roger
GNU Emacs 25.1.1 (i386-portbld-freebsd10.1, GTK+ Version 2.24.29) of
2016-11-04
Org mode version 9.0.3 (release_9.0.3-170-gfed1cf @
/home/rmason/.emacs.d/org-git/org-mode/lisp/)



Re: [O] Table formula from code block

2017-01-24 Thread Roger Mason
Hello Roland and Michael,

Thank you both for looking at this.

Roland Everaert  writes:

> I will try to look at how I used org-sbe, but I do remind that I had to do 
> the following (exerpt from a post on
> the list by me on the same subjet):
>
> "It works. But I had to set some headers in the code block itself as 
> following:
>
> :exports results :results value"

I will give that a try, thank you.

Michael Welle  writes:

> I think there are several problems, starting with BEGIN_SRC sh and some
> more. But fixing them doesn't bring success. I even have trouble to get
> a minimal example to work:
>
> #+NAME: foo
> #+BEGIN_SRC emacs-lisp
>
> (+ 4 4)
> #+END_SRC
>
>
> |  bar   | foo|
> |+|
> | 42 | #ERROR |
>
> #+TBLFM: $2='(org-sbe "foo")::$1=42
>
> I'm not sure, what the problem is. Looking at org-sbe there is
> something, I don't understand. In the end org-babel-execute-src-block is
> called. That executes the _current_ source code block. But I don't
> understand, how foo (in this example) becomes the current source code
> block. Can someone explain, please? Is there a side effect, I don't see?
> Or maybe a regression?

I have experimented some more and discovered that I can get the code to
work if I wrap the table entries in quotes, i.e. making them into
explicit strings:

#+tblname: display-results
| skribilo path   | infile | engine| To Engine | To 
Typeset |
|-++---+---+|
| "/opt/skribilo-git/bin" | "skribilo-input-1" | "context" | Success   | 
Success|
#+TBLFM: $4='(org-sbe "skribilo_to_engine" (path $1) (infile $2) (engine  $3) 
)::$5='(org-sbe "engine_to_typeset" (path $1) (infile $2) (engine  $3) )

Maybe emacs has a means of doing that wrapping, but the things I tried
(like concatenating the quotes with the table entry with (concat...)) did
not work.

I see that in your example you refer to the column heading in the
#+TBLFM line.  In my working code I refer to the columns by number ($1,
$2 etc).

I'm appending the current version of the code, in case anyone is
interested.

Cheers,
Roger

===
# RunTests.org --- 

# Author: rma...@cryptoperthite.esd.mun.ca
# Version: $Id: Results.org,v 0.0 2016/12/07 15:01:38 rmason Exp$

#+TITLE: Skribe Input Format: Whatever

#+OPTIONS: toc:nil num:nil author:nil
#+LATEX_HEADER: \usepackage{natbib}  \usepackage{apalike} \usepackage{lineno}
#+LATEX_HEADER: \usepackage{sectsty} \usepackage{setspace}  \usepackage{parskip}
# Turned OFF #+LATEX: \linenumbers \doublespacing \usepackage{ulem} 
\usepackage{titlecaps} 
#+LATEX: \subsubsectionfont{\itshape}
# #+LATEX: \subsectionfont{\titlecap} -- buggers up en-dashes in
# subsection titles
#+LATEX: \sectionfont{\MakeUppercase}

* Setup :exports none
#+BEGIN_SRC emacs-lisp :results none :exports none
(setq org-confirm-babel-evaluate nil)
#+END_SRC

I'd like a default input filename, but I could not get this to do anything.
#+PROPERTY: infile "skribilo-input"

* The input document
When I call this with name =skribilo-input= rather than tangling the
file, Org opens a Geiser REPL and the processing fails.  I'm not sure
Guile can process the Skribe syntax.

#+NAME: skribilo-input
#+BEGIN_SRC scheme :tangle "skribilo-input.skb"
; Whatever.skb

#+END_SRC

* The scripts
** Skribilo to supported engine format
#+NAME: skribilo_to_engine
#+BEGIN_SRC bash :results output replace :var path="" :var engine="" :var 
infile=""
  skribilo=$path/skribilo

  rm -rf $engine; mkdir -p $engine

  result="Failed"
  $skribilo  -t $engine -o $engine/$infile.$engine $infile.skb
  [ "$(ls -A $engine)" ] && result="Success"

  if [ -e "setup.tex" ]
  then
  mv setup.tex $engine/
  fi
  echo "$result"
#+END_SRC

*** Example
#+CALL: skribilo_to_engine(engine="context", path="/opt/skribilo-git/bin", 
infile="skribilo-input")

** Engine to typeset document
#+NAME: engine_to_typeset
#+BEGIN_SRC bash :results output replace :var engine="" :var infile=""
  outfile=$infile"_"$engine
  wd=$(pwd)
  result="Failure"
  if [ $engine = "context" ]; then
  cd context
  source /opt/context/tex/setuptex 2>&1 > /tmp/log 
  context --purgeall --result="$outfile.pdf" "$infile.$engine" 2>&1 > 
/tmp/log
  [ -e  "$outfile.pdf" ] && result="Success"
  elif [ $engine = "latex" ]; then
  cd latex
  pdflatex $infile.$engine 2>&1 > /tmp/log
  mv $infile.pdf $outfile.pdf
  [ -e  "$outfile.pdf" ] && result="Success"
  elif [ $engine = "lout" ];then
  cd lout
  lout $infile.$engine > $outfile.ps
  ps2pdf $outfile.ps
  [ -e  "$outfile.pdf" ] && result="Success"
  else
  result="n.a."
  fi

  cd $wd
  echo "$result"
#+END_SRC

*** Example
#+CALL: engine_to_typeset(engine="context", infile="skribilo-input")

* The result table
Should be able to run the tests from the table.  See
http://orgmode.org/worg/org-contrib/babel/intro.html#argume

[O] Table formula from code block

2017-01-22 Thread Roger Mason
Hello,

I have these code blocks:



#+BEGIN_SRC sh :tangle "skribilo_to_engine.sh"
#!/usr/local/bin/bash
infile=$3
engine=$2
skribilo=$1/skribilo

rm -rf $engine; mkdir -p $engine

result="Failed"
$skribilo  -t $engine -o $engine/$infile.$engine $infile.skb
[ "$(ls -A $engine)" ] && result="Success"

if [ -e "setup.tex" ]
then
mv setup.tex $engine/
fi

echo "$result"

#+END_SRC

#+BEGIN_SRC sh :results none
chmod u+x skribilo_to_engine.sh
#+END_SRC

#+NAME: skribilo_to_engine
#+BEGIN_SRC sh :results output replace :var path="/opt/skribilo-git/bin" :var 
engine="" :var infile="Author_7960"
./skribilo_to_engine.sh $path $engine $infile
#+END_SRC
===


I tangle the code block and make it executable.  I think it should be
possible to run the code blocks from the table, but it errors out:

#+tblname: summaries
| engine  | To Engine |
|-+---|
| context | #ERROR|
#+TBLFM: $2='(org-sbe "skribilo_to_engine" (engine $1) )

(See
http://orgmode.org/worg/org-contrib/babel/intro.html#arguments-to-source-code-blocks).

What am I doing wrong?

Thanks,
Roger

GNU Emacs 25.1.1 (i386-portbld-freebsd10.1, GTK+ Version 2.24.29) of
2016-11-04

Org mode version 9.0.3 (release_9.0.3-170-gfed1cf)



Re: [O] editing scheme fragments

2017-01-04 Thread Roger Mason
Hello Nick,

Nick Dokos  writes:

> Try with a minimal init file, avoiding all your customizations (other than 
> loadin
> org and enabling scheme):
>
>  emacs -q -l /path/to/minimal/init/file
>
> Does it still fail?

Yes, but in trying this out I discovered that the keybinding I read as
"C-c `" (i.e. backtick) should be "C-c '" (i.e. apostrophe).  When I use
the correct keybinding it works as advertised.  Gosh.

I apologise for wasting the time of those who read my post and offered
their suggestions.  Maybe I'm just too old and stunned and in need of
new spectacles.

Thanks for your help,
Roger



Re: [O] editing scheme fragments

2017-01-04 Thread Roger Mason
Hi Eric,

Eric S Fraga  writes:

> Works fine for me with later version of org (and emacs).

Unfortunately, updating to Org mode version 9.0.3
(release_9.0.3-170-gfed1cf) did not make any difference.

Cheers,
Roger



Re: [O] editing scheme fragments

2017-01-04 Thread Roger Mason
Hello Marco,

Marco Wahl  writes:

> Guess: You should add scheme to org-babel-load-languages.  E.g. use M-x
> customize-variable.

Sorry, i should have mentioned that I tried that customisation without
success.

Cheers,
Roger



Re: [O] editing scheme fragments

2017-01-04 Thread Roger Mason
Hello John,

John Kitchin  writes:

> I can't reproduce that. I wonder if you should try running 
> org-element-cache-reset Sometimes I
> have seen org get confused when the cache is out of date. this usually 
> happens when I have code
> that generates parts of the file.

Thanks for the suggestion.  Unfortunately there is no change after
running that command.

Cheers,
Roger



[O] editing scheme fragments

2017-01-04 Thread Roger Mason
Hello,

When I try to edit a scheme fragment such this

Header:
#+BEGIN_SRC scheme :tangle "header.skb" 
(document :title [A First Skribilo Block]
  :author [Roger Mason]
#+END_SRC

using C-c ', org thinks it is an org table.

I am using GNU Emacs 25.1.1 (i386-portbld-freebsd10.1, GTK+ Version
2.24.29) of 2016-11-04 and Org mode version 9.0.1
(release_9.0.1-47-gb06259)

Any help in tracking this down would be much appreciated.

Thanks,
Roger



Re: [O] List restarts numbering at 1 after table

2016-11-25 Thread Roger Mason
hello,

Roger Mason  writes:

> On export, the list numbering after the table reverts to 1.  Is there a
> way to avoid this?

Found it.  Sorry for the noise.

Roger



[O] List restarts numbering at 1 after table

2016-11-25 Thread Roger Mason
Hello,

I have a table in a list, like this:

2. Write stuff in the empty table:
# See http://orgmode.org/manual/LaTeX-specific-attributes.html to get
# predetermined width on export.
#+ATTR_LATEX: :align |p{2cm}|p{2cm}|
|--+|
| This | That   |
|--+|
|  ||
|--+|
|  ||
|--+|
|  ||
|--+|
|  ||
|--+|
|  ||
|--+|
3. Write the answer to another question here


On export, the list numbering after the table reverts to 1.  Is there a
way to avoid this?

GNU Emacs 25.1.1 (i386-portbld-freebsd10.1, GTK+ Version 2.24.29) of
2016-11-04

Org mode version 9.0.1 (release_9.0.1-47-gb06259 @
/home/rmason/.emacs.d/org-git/org-mode/lisp/)

Thanks for any help.

Roger



Re: [O] second line for author field in org-mode to latex?

2016-05-11 Thread Roger Mason
Hi Sharon,

Sharon Kimble  writes:

> How can I have a second line for the author field in an org-mode export
> to latex please? For example -
>
> #+AUTHOR: Sharon
> #+AUTHOR2: Kimble
>
> But that doesn't work. I tried "#+AUTHOR: Sharon \n Kimble" but that
> doesn't work either. So how can I do it please?
>
> Thanks
> Sharon.

Does something like this work:

#+TITLE: Executive Meeting January 18 2016 @@latex:\\@@ via Skype
 @@latex:\\ 1pm eastern time @@

Cheers,
Roger



Re: [O] Is there an easy way converting html -> orgmode?

2016-04-24 Thread Roger Mason
Hello,

Martin Weigele  writes:

> Hi, the subject line says it all, is there an easy way converting html to 
> orgmode (not the other way round).

I think pandoc (http://pandoc.org/) can do that.

Cheers,
Roger



Re: [O] How to add left superscripts

2016-02-29 Thread Roger Mason
童俊翔  writes:

> How to add left superscripts without using additional packages in org-mode?

I use \nbsp{}^{1}.

Cheers,
Roger



Re: [O] Preserve tabs in tangled babel output

2015-03-11 Thread Roger Mason
Thank you Charles Berry and John Kitchin for your replies.

John Kitchin  writes:

> I have org-src-preserve-indentation set to t.
>
> Charles C. Berry writes:
>
>> On Wed, 11 Mar 2015, Roger Mason wrote:
>>
>>> Hello,
>>>
>>> This code:
>>>
>>> #+BEGIN_SRC makefile :tangle Makefile
>>>  hello:  hello.f90
>>>  gfortran hello.f90
>>>
>>>  execute: hello
>>>  ./a.out
>>>
>>>  clean:
>>>  rm -f a.out *.o
>>> #+END_SRC
>>>
>>> (stolen from John Kitchin) produces a Makefile with spaces instead of
>>> tabs.  I created the content in makefile mode, with tabs, but emacs
>>> untabifies the output.  How can I prevent this?
>>
>> Use the `-i' results switch:
>>
>>   #+BEGIN_SRC makefile -i :tangle Makefile
>>
>> or set `org-src-preserve-indentation' non-nil.

The -i switch did not work for me but setting
org-src-preserve-indentation did.

Thanks again,
Roger



[O] Preserve tabs in tangled babel output

2015-03-11 Thread Roger Mason
Hello,

This code:

#+BEGIN_SRC makefile :tangle Makefile
  hello:  hello.f90
  gfortran hello.f90

  execute: hello
  ./a.out

  clean:
  rm -f a.out *.o
#+END_SRC

(stolen from John Kitchin) produces a Makefile with spaces instead of
tabs.  I created the content in makefile mode, with tabs, but emacs
untabifies the output.  How can I prevent this?

Thanks,
Roger
Org-mode 8.2.6



[O] Capturing output from C/C++

2015-03-05 Thread Roger Mason

Hello,

I have a short C++ program:

#+BEGIN_SRC cpp :flags -lm :results output
#include 
#include 
#include // for ceil
#include   // for atof

  double f (double fv, double o, int i) {
return fv / 2.0 + (1.0 - o) * fv * i;
  }

int num (double d, double fv, double o) {
  return (int)ceil( d / ((1.0 - o) * fv ));
  }

int main (int argc, char* argv[]) {
if ( argc < 6 ) {
  std::cout << "Usage:\n" << std::endl;
  std::cout << "grid w fovx ox h fovy oy\n" << std::endl;
  return 1;
}
...
#+END_SRC

that outputs some data to stdout.

So far I have not been able to capture the output of the program back
into to my org buffer.

Is that possible and, if so, how?

Thanks,
Roger
Org-mode version 8.2.6



Re: [O] Change default latex packages

2014-05-06 Thread Roger Mason


Thanks!  Dunno why I was too stunned to try the obvious.

Cheers,
Roger

On 05/06/14 13:53, John Kitchin wrote:
just delete the packages you don't what from (setq 
org-latex-default-packages-ali

st
  '(("AUTO" "inputenc" t)
("" "lmodern" nil)
("T1" "fontenc" nil)

("" "fixltx2e" nil)
;("" "charter" nil) ;; a decent font
;("expert" "mathdesign" nil)
("" "graphicx" t)
("" "longtable" nil)
("" "float" nil)
("" "wrapfig" nil)
("" "rotating"  nil)
("normalem" "ulem" t)
("" "amsmath" t)
("" "textcomp" nil)
("" "marvosym" t)
("" "wasysym" t)
("" "amssymb" t)
("" "amsmath" t)
("version=3" "mhchem" t)
("numbers,super,sort&compress" "natbib" t)
("" "natmove" nil)
("" "url" t)
("" "minted" nil)
("" "underscore" t)
("linktocpage,pdfstartview=Fit
H,colorlinks,
linkcolor=blue,anchorcolor=blue,
citecolor=blue,filecolor=blue,menucolor=blue,urlcolor=blue"
 "hyperref" nil)
("" "attachfile" nil)))

John






Re: [O] Change default latex packages

2014-05-06 Thread Roger Mason

hello,

On 05/06/14 11:48, John Kitchin wrote:
no, I think nil means it is not needed to make latex fragments  of 
equations.


John
OK, thanks.  So, back to my original question: how do I control the list 
of packages exported into a LaTeX document?


Thanks,
Roger



Re: [O] Change default latex packages

2014-05-06 Thread Roger Mason

Hello again,

On 05/05/14 12:31, John Kitchin wrote:

(setq org-latex-default-packages-alist


I thought I had this fixed, but apparently not.

Here's what I have in my .emacs:

(setq org-latex-default-packages-alist
  '(("AUTO" "inputenc" t)
("" "lmodern" nil)
("T1" "fontenc" nil)
("" "fixltx2e" nil)
;("" "charter" nil) ;; a decent font
;("expert" "mathdesign" nil)
("" "graphicx" t)
("" "longtable" nil)
("" "float" nil)
("" "wrapfig" nil)
("" "rotating"  nil)
("normalem" "ulem" t)
("" "amsmath" t)
("" "textcomp" nil)
("" "marvosym" t)
("" "wasysym" t)
("" "amssymb" t)
("" "amsmath" t)
("version=3" "mhchem" t)
("numbers,super,sort&compress" "natbib" t)
("" "natmove" nil)
("" "url" t)
("" "minted" nil)
("" "underscore" t)
("linktocpage,pdfstartview=FitH,colorlinks,
linkcolor=blue,anchorcolor=blue,
citecolor=blue,filecolor=blue,menucolor=blue,urlcolor=blue"
 "hyperref" nil)
("" "attachfile" nil)))

Notice ("T1" "fontenc" nil) and ("" "textcomp" nil).

Here's the latex output:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\usepackage[numbers,super,sort&compress]{natbib}
\usepackage{natmove}
\usepackage{url}
\usepackage{minted}
\usepackage{underscore}
\usepackage[linktocpage,pdfstartview=FitH,colorlinks,
linkcolor=blue,anchorcolor=blue,
citecolor=blue,filecolor=blue,menucolor=blue,urlcolor=blue]{hyperref}
\usepackage{attachfile}
\usepackage{parskip}

Notice the \usepackage[T1]{fontenc} and \usepackage{textcomp}.

What am I doing wrong?

Thanks,
Roger







Re: [O] enumerate in LaTeX export

2014-05-05 Thread Roger Mason
Many thanks, Eric.  That did indeed fix the problem.

Roger



[O] enumerate in LaTeX export

2014-05-05 Thread Roger Mason
Hello,

I don't understand why this text:

===
case. The University requests that all medical notes be on letterhead,
be signed by the physician and include details on the following:

  1.  confirmation of the specific dates on which the student visited
  the physician.
  2.  the degree to which the illness (or treatment, in the case of
  medication, for example) is likely to have affected the student's
  ability to study, attend classes, or sit examination.
==

Results in this LaTeX output:

==
\begin{enumerate}
\item confirmation of the specific dates on which the student visited
\end{enumerate}
the physician.
\begin{enumerate}
\item the degree to which the illness (or treatment, in the case of
\end{enumerate}
medication, for example) is likely to have affected the student's
ability to study, attend classes, or sit examination.
\begin{enumerate}
==

I'm running release_8.2.6-937-g60502a in GNU Emacs 24.3.1
(amd64-portbld-freebsd10.0, GTK+ Version 2.24.22).

Thanks for any help.

Roger



Re: [O] Change default latex packages

2014-05-05 Thread Roger Mason
Thanks Eric.  Filed away for future reference.

Roger



Re: [O] Change default latex packages

2014-05-05 Thread Roger Mason

Thanks John, I now have what I want.

Roger



[O] Change default latex packages

2014-05-05 Thread Roger Mason

Hello,

How can I change the default packages that are used in LaTeX export?  
I'm running Org-mode version 8.2.6 (release_8.2.6-937-g60502a).


Thanks,
Roger



Re: [O] Italicise block of text

2014-01-19 Thread Roger Mason

Hello,

On 01/15/2014 01:20 PM, Alexander Baier wrote:

Hello Roger,

when answering a mail/post from the list, please Cc the list in your
response, so other members of the list can see your mail to.

On 2014-01-15 14:30 Roger Mason wrote:

But this does not:

/Perhaps, but [...] to replacement./
I just get a block of text bounded by / and / in the resulting pdf.

Maybe the markup gets escaped somehow by special characters in the text.
I do not know enough about the markup of org to help you here.  I think
Nicolas can give you a more satisfying answer.

Regards,
--
  Alexander Baier
Thanks again for your help.  It is easy to fix using a regex to insert / 
at line beginnings and ends, so not a big deal for me.


Sorry about the botched reply-to-list: twitchy trigger-finger.

Roger



[O] Italicise block of text

2014-01-14 Thread Roger Mason

Hello,

Is there a way to italicise a block of text rather that just single 
words? (org-mode 8.0.3).


Thanks,
Roger



Re: [O] Exams with Org?

2013-12-08 Thread Roger Mason

Hello,

On 12/06/2013 03:53 PM, Roger Mason wrote:

Hello,

Has anyone used Org to create exams?  It would be useful to have the 
value per question totalled to provide the total per section etc and 
to be able to embed the answers in the exam and expose them in the 
final document using some kind of conditional processing.


If anyone has done this kind of thing I'd be interested to see an 
example file.


Thanks,
Roger


Thanks Suvayu Ali, John Kitchin, Marvin Doyley and Alan Schmitt for your 
suggestions, which I will try out.  I may not have time to implement a 
complete solution for the upcoming exam (Wednesday morning), so I will 
wait until the new year.  In the meantime, may I ask John if he is 
willing to share an example file as a starting point?  I read through 
the blog but my experience with org is too short for me to see how it 
all works.


Thanks again,
Roger




[O] Exams with Org?

2013-12-06 Thread Roger Mason

Hello,

Has anyone used Org to create exams?  It would be useful to have the 
value per question totalled to provide the total per section etc and to 
be able to embed the answers in the exam and expose them in the final 
document using some kind of conditional processing.


If anyone has done this kind of thing I'd be interested to see an 
example file.


Thanks,
Roger





[O] Superscript before character

2013-09-06 Thread Roger Mason

Hello,

I'd like to create a superscript that preceeds a letter.  I tried 
^1Fred, ^1 Fred, ^{1}Fred and ^{1} Fred, to no avail.


Can this be done in org (8.0.3)?  If so how?

Thanks,
Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



Re: [O] Superscript before character

2013-09-06 Thread Roger Mason

Hello,

On 09/06/2013 03:33 PM, Charles Berry wrote:

Roger Mason  mun.ca> writes:


Hello,

I'd like to create a superscript that preceeds a letter.  I tried
^1Fred, ^1 Fred, ^{1}Fred and ^{1} Fred, to no avail.

Can this be done in org (8.0.3)?  If so how?

[snip]

\nbsp{}^{1}Fred

exports to ~$^{\text{1}}$Fred in latex and  1Fred in html

HTH,

Chuck


yes, that helps - it works perfectly.

Many thanks,
Roger


This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



Re: [O] Filter not working (org 8.0.3)

2013-09-05 Thread Roger Mason

Hello,

On 09/05/2013 04:15 PM, Nicolas Goaziou wrote:

#+LATEX_HEADER: \usepackage[right=2in,left=0.5in]{geometry}
   #+LATEX_HEADER: \usepackage{parskip}

   * Setup 
:noexport:
   #+BEGIN_SRC emacs-lisp :exports both
   (defun margin-graphics (contents backend info)
   (when (eq backend 'latex)
 (replace-regexp-in-string "\\`includegraphics.*?\\({.+}\\)"
   "marginpar{includegraphics[width=0.9marginparwidth]\\1} "
   contents)))

   (add-to-list (make-local-variable 'org-export-filter-link-functions) 
'margin-graphics)
   #+END_SRC

That got rid of the verbatim output.  Thanks.

Unfortunately the replacement of \includegraphics... by \marginpar... 
still does not work:


#+CAPTION: Acicular
[[../images/acicular.eps]]

produces

\begin{figure}[htb]
\centering
\includegraphics[width=.9\linewidth]{../images/acicular.eps}
\caption{Acicular}
\end{figure}

I'm using org Emacs 24.3.1 (Org mode 8.0.3).

Please don't spend any more time on this on my account:  I'll use 
ConTeXt instead.


Cheers,
Roger


This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



[O] Filter not working (org 8.0.3)

2013-09-05 Thread Roger Mason

Hello,

I have this at the top of an org file in order to put graphics in the 
margin:


#+LATEX_HEADER: \usepackage[right=2in,left=0.5in]{geometry} 
\usepackage{parskip}


#+BEGIN_SRC emacs-lisp
(defun margin-graphics (contents backend info)
  (when (eq backend 'latex)
(replace-regexp-in-string "\\`includegraphics.+\\({.+}\\)"
"marginpar{includegraphics[width=0.9marginparwidth]\\1} " 
contents)))


(add-to-list 'org-export-filter-link-functions 'margin-graphics)
#+END_SRC

C-e lp produces a pdf document, but the filter is not applied (org 8.0.3).

Can someone show me what I'm doing wrong?

Thanks,
Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



Re: [O] Filter not working (org 8.0.3)

2013-09-05 Thread Roger Mason

Hello,

On 09/05/2013 04:39 PM, Nicolas Goaziou wrote:
In this case, you need to remove "\\`" from your regexp. Regards, 

That fixed it.

Many thanks.

Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



Re: [O] Filter not working (org 8.0.3)

2013-09-05 Thread Roger Mason

Hello again,

On 09/05/2013 01:48 PM, Nicolas Goaziou wrote:

Hello,

Roger Mason  writes:


I have this at the top of an org file in order to put graphics in the
margin:

#+LATEX_HEADER: \usepackage[right=2in,left=0.5in]{geometry}
\usepackage{parskip}

#+BEGIN_SRC emacs-lisp
(defun margin-graphics (contents backend info)
(when (eq backend 'latex)
  (replace-regexp-in-string "\\`includegraphics.+\\({.+}\\)"
"marginpar{includegraphics[width=0.9marginparwidth]\\1} "
contents)))

(add-to-list 'org-export-filter-link-functions 'margin-graphics)
#+END_SRC

C-e lp produces a pdf document, but the filter is not applied (org 8.0.3).

Can someone show me what I'm doing wrong?

I think you need to tell Babel to actually execute the code (e.g.
with :exports both). You may also want to make
`org-export-filter-link-functions' local to the buffer, too.


Regards,


Thanks for the reply.

Unfortunately, :exports both does not make any difference.  Looking at 
the generated LaTeX file I see that it contains:


\begin{verbatim}
(defun margin-graphics (contents backend info)
  (when (eq backend 'latex)
(replace-regexp-in-string "\\`includegraphics.+\\({.+}\\)"
"marginpar{includegraphics[width=0.9marginparwidth]\\1} " 
contents)))


(add-to-list 'org-export-filter-link-functions 'margin-graphics)
\end{verbatim}

which seems odd.

Thanks for the help.

Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



Re: [O] LaTeX export: images in margin

2013-08-16 Thread Roger Mason

Hello once more,

On 08/16/2013 11:34 AM, Roger Mason wrote:


(defun margin-graphics (contents backend info)
  (when (eq backend 'latex)
(replace-regexp-in-string "\\`includegraphics.+\\({.+}\\)"
   "marginpar{includegraphics\1} " contents)))

(add-to-list 'org-export-filter-link-functions 'margin-graphics)

However, the LaTeX file contains this:

\marginpar{\includegraphics^A}

rather than the expected

\marginpar{\includegraphics[]{filename}}

This line:

(replace-regexp-in-string "\\`includegraphics.+\\({.+}\\)"
   "marginpar{includegraphics\1} " contents)))

should be:

(replace-regexp-in-string "\\`includegraphics.+\\({.+}\\)"
   "marginpar{includegraphics\\1} " contents)))

Note the double backslash before the '1' in the replacement text.

Cheers,
Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



Re: [O] LaTeX export: images in margin

2013-08-16 Thread Roger Mason

Hello again,

On 08/16/2013 10:45 AM, Suvayu Ali wrote:
You can adapt this to your needs: 
 

It's in the FAQ now: 

Cheers,


Thanks for your response.  I have it working somewhat:

(defun margin-graphics (contents backend info)
  (when (eq backend 'latex)
(replace-regexp-in-string "\\`includegraphics.+\\({.+}\\)"
   "marginpar{includegraphics\1} " contents)))

(add-to-list 'org-export-filter-link-functions 'margin-graphics)

However, the LaTeX file contains this:

\marginpar{\includegraphics^A}

rather than the expected

\marginpar{\includegraphics[]{filename}}

Something is wrong with my regexp, but what?

Thanks,
Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



[O] LaTeX export: images in margin

2013-08-16 Thread Roger Mason

Hello,

I'd like to have images in the margin when exporting to LaTeX (or 
creating a pdf via LaTeX).  I see from a message on one of the TeX 
mailing lists that this can be done like this:


\marginpar{\includegraphics[]{../images/Walkthrough_1-001.jpg}}

How can I get org (8.0.3 on linux) to wrap calls to \includegraphics 
with a call to \marginpar?  Maybe this is in the FAQ or a mailing list 
message, but if so, I did not find it.


Thanks,
Roger


This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



Re: [O] LaTeX figure export - no \begin{figure} \end{figure}

2013-07-15 Thread Roger Mason

Hello Nicolas,

On 07/15/2013 07:52 AM, Nicolas Goaziou wrote:

Hello,


You need to put your caption on the same line as the #+CAPTION keyword.
You may also use multiple CAPTION keywords for better readability:

   #+CAPTION: Microstructures of contact-metamorphism related melting
   #+CAPTION: and crystallisation in K-feldspar-quartz domains
   #+NAME: fig:microstructure-montage
   [[./microstructure-montage.eps]]


Regards,


Thankyou, that is now working.

Cheers,
Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



[O] LaTeX figure export - no \begin{figure} \end{figure}

2013-07-15 Thread Roger Mason

Hello,

This:

#+CAPTION:
Microstructures of contact-metamorphism related melting and
crystallisation in K-feldspar-quartz domains
#+NAME: fig:microstructure-montage
[[./microstructure-montage.eps]]

produces this on export to LaTeX (org 8.0.3):

Microstructures of contact-metamorphism related melting and
crystallisation in K-feldspar-quartz domains
\includegraphics[width=.9\linewidth]{./microstructure-montage.eps}

There is no figure environment or label and cross-references to the 
figure do not work.  As far as I can see, the org formatting is as per 
the manual. What must I do to get floats, with labels, in the LaTeX output?


Cheers,
Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



Re: [O] Bibliography and ODT

2013-07-14 Thread Roger Mason

hello Christian,

On 07/14/2013 05:07 PM, Christian Moe wrote:

Hi,

What seems to work for most people is exporting to latex, running
bibtex, and using one of these tools to convert to ODT:

- TeX4ht (the usual recommendation)
- Pandoc

or to convert to a format that ODT imports reasonably well:

- LaTeX2RTF (and import RTF into LibreOffice)
- LaTeX2HTML (and copy-paste or import HTML into LibreOffice)

If you're feeling adventurous, you may want to try a half-baked solution
of mine:
http://lists.gnu.org/archive/html/emacs-orgmode/2012-01/msg00128.html
Feedback is appreciated.

Yours,
Christian


Thanks.  I'll try one (or more) of those.

Cheers,
Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



[O] Bibliography and ODT

2013-07-14 Thread Roger Mason

Hello,

I'm finishing a paper that will need to be submitted to the publisher as 
MS Word. I use neither Word nor Libre/OpenOffice. I need to have a 
bibliography with cross-references from the text and intended to export 
from org to ODT then Word.  My bibliography file is in bibtex format.  
After a search I see various messages discussing bibliographies but I'm 
unsure what the current situation is with respect to exporting to 
ODT.Can someone enlighten me? If direct export to ODT of a document 
with a bibliography is not currently implemented, can someone suggest a 
workflow to get from org -> ODT?


Thanks,
Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



Re: [O] C code block: no return values

2013-04-16 Thread Roger Mason

Hello Eric,

On 04/16/2013 04:15 PM, Eric Schulte wrote:

Roger Mason  writes:


Hello,

I'm working through examples in "A Multi-Language Computing Environment for
Literate Programming and Reproducible Research" by Shulte et al. J.
Stat. Software, 46/3, 2012.

This example compiles but results are not returned to the Org-mode buffer:

Hi Roger,

Since the publication of that paper, the code block execution engine has
begun checking the return value of the invoked program to ensure it
exits with success before parsing the output.  The C program in this
example actually returns the value of the final printf, which is
non-zero and looks like a return.

To get this example working with the latest version of Org-mode, one
needs to added a "return 0;" to the end of the last code block, yielding
the following.

#+name: main
#+begin_src C
int main(int argc, char *argv[]) {
int lst[argc-1];
int i;
for(i=1;i
Thank you.  It works here too.

Best wishes,
Roger


This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php



[O] C code block: no return values

2013-04-16 Thread Roger Mason

Hello,

I'm working through examples in "A Multi-Language Computing Environment for
Literate Programming and Reproducible Research" by Shulte et al. J. 
Stat. Software, 46/3, 2012.


This example compiles but results are not returned to the Org-mode buffer:

#+name: cocktail.c
#+begin_src C :noweb yes :tangle cocktail.c
#include 
<>
<>
#+end_src

#+name: main
#+begin_src C
int main(int argc, char *argv[]) {
int lst[argc-1];
int i;
for(i=1;i>
}
if ( swapped == 0 ) break;
swapped = 0;
for(i= l - 2; i >= 0; i--) {
<>
}
} while(swapped > 0);
}
#+end_src

#+name: swap
#+begin_src C
if ( a[i] > a[i+1] ) {
int temp = a[i];
a[i] = a[i+1];
a[i+1] = temp;
swapped = 1;
}
#+end_src

#+call: cocktail.c[:cmdline 8 7 6 3 2 4 78]()
===

Running C-c on the "call" line above produces:

===
#+RESULTS: cocktail.c[:cmdline 8 7 6 3 2 4 78]()


The answers should be here.  But they aren't.

Thanks for any help.

Roger

This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php