[O] subscript on a table caption
dear all! I have a strange problem now with org-mode (I don't know whether I had that with previous org-versions because I never paid attention): any _ I have in a caption is automatically formatted as a subscript, independently of using #+OPTIONS: ^:nil or #+OPTIONS: ^:{}. Is there any other way I can force org-mode to export captions as-is? For plain text it works nicely, but not for caption (and export to latex or html). The test org-file I used contains the following: #+TITLE:TestTest #+OPTIONS: ^:nil - * Test tables just in plain text: bla_blu, bla\_blu; both works nicely. #+CAPTION: Some bla bla and an underscore: bla_blu. The same escaped: bla\_blu. Doesn't work for either of them; blu is always used as subscript. || agegp | alcgp |tobgp | ncases | ncontrols | |+---+---+--++---| | 1 | 25-34 | 0-39g/day | 0-9g/day | 0.00 | 40.00 | | 2 | 25-34 | 0-39g/day |10-19 | 0.00 | 10.00 | | 3 | 25-34 | 0-39g/day |20-29 | 0.00 | 6.00 | --- The _ in the plain text are exported as expected, but not the caption. I'm using org-mode 8.3.1 (release_8.3.1-166-g5bfdfc) any suggestions?
Re: [O] using subscripts in table captions
great! thanks Nicolas! On 25 Aug 2015, at 14:49, Nicolas Goaziou m...@nicolasgoaziou.fr wrote: Hello, Johannes Rainer johannes.rai...@gmail.com writes: I have a strange problem now with org-mode (I don't know whether I had that with previous org-versions because I never paid attention): any _ I have in a caption is automatically formatted as a subscript, independently of using #+OPTIONS: ^:nil or #+OPTIONS: ^:{}. Is there any other way I can force org-mode to export captions as-is? For plain text it works nicely, but not for caption (and export to latex or html). This is fixed. Thank you. Regards, -- Nicolas Goaziou
[O] using subscripts in table captions
dear all! I have a strange problem now with org-mode (I don't know whether I had that with previous org-versions because I never paid attention): any _ I have in a caption is automatically formatted as a subscript, independently of using #+OPTIONS: ^:nil or #+OPTIONS: ^:{}. Is there any other way I can force org-mode to export captions as-is? For plain text it works nicely, but not for caption (and export to latex or html). The test org-file I used contains the following: #+TITLE:TestTest #+OPTIONS: ^:nil - * Test tables just in plain text: bla_blu, bla\_blu; both works nicely. #+CAPTION: Some bla bla and an underscore: bla_blu. The same escaped: bla\_blu. Doesn't work for either of them; blu is always used as subscript. || agegp | alcgp |tobgp | ncases | ncontrols | |+---+---+--++---| | 1 | 25-34 | 0-39g/day | 0-9g/day | 0.00 | 40.00 | | 2 | 25-34 | 0-39g/day |10-19 | 0.00 | 10.00 | | 3 | 25-34 | 0-39g/day |20-29 | 0.00 | 6.00 | --- The _ in the plain text are exported as expected, but not the caption. I'm using org-mode 8.3.1 (release_8.3.1-166-g5bfdfc) any suggestions?
Re: [O] using subscripts in table captions
well, kind of helps. At least I know it's reproducible... although I would like to have that fixed somehow. On 25 Aug 2015, at 09:57, Suvayu Ali fatkasuvayu+li...@gmail.com wrote: On Tue, Aug 25, 2015 at 08:09:55AM +0200, Johannes Rainer wrote: The test org-file I used contains the following: #+TITLE:TestTest #+OPTIONS: ^:nil * Test tables just in plain text: bla_blu, bla\_blu; both works nicely. #+CAPTION: Some bla bla and an underscore: bla_blu. The same escaped: bla\_blu. Doesn't work for either of them; blu is always used as subscript. || agegp | alcgp |tobgp | ncases | ncontrols | |+---+---+--++---| | 1 | 25-34 | 0-39g/day | 0-9g/day | 0.00 | 40.00 | | 2 | 25-34 | 0-39g/day |10-19 | 0.00 | 10.00 | | 3 | 25-34 | 0-39g/day |20-29 | 0.00 | 6.00 | --- The _ in the plain text are exported as expected, but not the caption. Using your example file, I get the following. I guess that confirms your bug. I'm using release_8.3.1-129-g526927. Hope this helps, \section{Test tables} \label{sec:orgheadline1} just in plain text: bla\_blu, bla$\backslash$\_blu; both works nicely. \begin{table}[htb] \caption{Some bla bla and an underscore: bla\(_{\text{blu}}\). The same escaped: bla$\backslash$\(_{\text{blu}}\). Doesn't work for either of them; blu is always used as subscript.} \centering \begin{tabular}{rrlrrr} agegp alcgp tobgp ncases ncontrols\\ \hline 1 25-34 0-39g/day 0-9g/day 0.00 40.00\\ 2 25-34 0-39g/day 10-19 0.00 10.00\\ 3 25-34 0-39g/day 20-29 0.00 6.00\\ \end{tabular} \end{table} -- Suvayu Open source is the future. It sets us free.
Re: [O] Difference between eval and export
I tried to make an example that does not need a lot of input data but without success. never mind, it works if I run the code on a single cpu, or if I run it on a linux machine. On 30 Sep 2014, at 01:32, Grant Rettke g...@wisdomandwonder.com wrote: How painful would it be to pare it down to the minimal example of the behavior? On Mon, Sep 29, 2014 at 6:14 AM, Johannes Rainer johannes.rai...@gmail.com wrote: I checked the environment variables in Emacs and also in R (using Sys.getenv). all environment variables are set correctly (I am now also using “exec-path-from-shell” to make sure that Emacs is reading system environment variables). It is absolutely strange. I only get the error when I export the org file, but not if I execute R code chunk by code chunk sequentially. best, jo On 26 Sep 2014, at 21:58, Grant Rettke g...@wisdomandwonder.com wrote: On Fri, Sep 26, 2014 at 1:44 PM, Rainer M Krug rai...@krugs.de wrote: Grant Rettke g...@wisdomandwonder.com writes: My eye is on you post about that topic because I would also like to know. As you are using R, and if you are using sessions, what about setting them from within R[1]? Footnotes: [1] http://stat.ethz.ch/R-manual/R-devel/library/base/html/Sys.setenv.html Yes indeed. I am quite interested in the general mechanism of how the environment exists for when exports occur and in particular whether or not it is different somehow. Right now I've delegated things between [1] and .Renviron. -- Grant Rettke g...@wisdomandwonder.com | http://www.wisdomandwonder.com/ “Wisdom begins in wonder.” --Socrates ((λ (x) (x x)) (λ (x) (x x))) “Life has become immeasurably better since I have been forced to stop taking it seriously.” --Thompson
Re: [O] passing LC_ALL environment variable to org export call
hi Rasmus, thanks for your hint. I checked Sys.getenv before and after the failing code, but LC_ALL was always properly set. I’m afraid my problem relates to some Mac LLVM and GCC gfortran compiler thing, since I’m using a R version compiled against the Mac Accelerate framework (vecLib)… it is just so strange that I only get the error in Emacs org-mode upon exporting the org file, but not, if I evaluate each code chunk separately. to set all environment variables I’m using the “exec-path-from-shell” extension, so, all environment settings from the shell are available in Emacs. On 26 Sep 2014, at 15:56, Rasmus ras...@gmx.us wrote: Hi Johannes, Johannes Rainer johannes.rai...@gmail.com writes: I stumbled across a strange problem. I’m using org-mode to perform analyses in R and I have one block of R-code in which I use mclapply to perform parallel calculations. evaluating this code block using C-c C-c works fine, but I get a segfault error when I export the org file. This has to do something with the LC_ALL environment variable as I can reproduce the same error above in R in a terminal after “unset LC_ALL”. Is there a way to pass environment variables to the export call? Check the two functions `getenv' and `setenv' and the variable `org-export-async-init-file'. You should be able to cook something up. It sound like there's an issue with your system-setup. I'd look into that before. Hope it helps, Rasmus -- Lasciate ogni speranza, voi che leggete questo.
Re: [O] Difference between eval and export
I checked the environment variables in Emacs and also in R (using Sys.getenv). all environment variables are set correctly (I am now also using “exec-path-from-shell” to make sure that Emacs is reading system environment variables). It is absolutely strange. I only get the error when I export the org file, but not if I execute R code chunk by code chunk sequentially. best, jo On 26 Sep 2014, at 21:58, Grant Rettke g...@wisdomandwonder.com wrote: On Fri, Sep 26, 2014 at 1:44 PM, Rainer M Krug rai...@krugs.de wrote: Grant Rettke g...@wisdomandwonder.com writes: My eye is on you post about that topic because I would also like to know. As you are using R, and if you are using sessions, what about setting them from within R[1]? Footnotes: [1] http://stat.ethz.ch/R-manual/R-devel/library/base/html/Sys.setenv.html Yes indeed. I am quite interested in the general mechanism of how the environment exists for when exports occur and in particular whether or not it is different somehow. Right now I've delegated things between [1] and .Renviron.
Re: [O] passing LC_ALL environment variable to org export call
On 29 Sep 2014, at 14:06, Rasmus ras...@gmx.us wrote: Johannes Rainer johannes.rai...@gmail.com writes: thanks for your hint. I checked Sys.getenv before and after the failing code, but LC_ALL was always properly set. I’m afraid my problem relates to some Mac LLVM and GCC gfortran compiler thing, since I’m using a R version compiled against the Mac Accelerate framework (vecLib)… it is just so strange that I only get the error in Emacs org-mode upon exporting the org file, but not, if I evaluate each code chunk separately. But are you using .C, .Fortran or Rcpp in your code-block? If not, why would your compilers matter? (I'm not an expert on R internals, so my comment may be naïve). no I’m not using .C in the code-block, the code block contains only R-code, however, one of the R functions is using (like most R functions) either C or fortran code to do the actual calculation. I suspect the loess function in R causing the problem and that this function uses some code from the optimized BLAS (i.e. library for numeric calculation) library from Apple (i.e. the Accelerate, or vecLib framework). So, if I run the code (exporting the org buffer to latex) in parallel processing mode I get a segfault. the same without parallel processing is fine. Strangely enough, the code block evaluated (C-c C-c) in parallel processing mode runs also fine. also, if I tangle the R-code and run the R-code in R it also works fine. It just doesn’t with org-mode export... so, in the end I give up. I think there is some very mystic thing going on. I also tried to understand what the difference between org-mode export and org-mode eval is... without success. I thought that the R-process is somehow started differently, but that doesn’t seem to be the case. As a short turn solution try to add this to the top of your file #+PROPERTY: session *R* These days you might even get away with just #+PROPERTY: session I'm not sure. This should run your code from the same session. [This should be equivalent to adding :session to babel blocks, but check the manual if it ain't working] to set all environment variables I’m using the “exec-path-from-shell” extension, so, all environment settings from the shell are available in Emacs. Are you exporting async or normally? If async, do you get the error when exporting normally? —Rasmus -- Hvor meget poesi tror De kommer ud af et glas isvand?
[O] passing LC_ALL environment variable to org export call
dear all, I stumbled across a strange problem. I’m using org-mode to perform analyses in R and I have one block of R-code in which I use mclapply to perform parallel calculations. evaluating this code block using C-c C-c works fine, but I get a segfault error when I export the org file. This has to do something with the LC_ALL environment variable as I can reproduce the same error above in R in a terminal after “unset LC_ALL”. Is there a way to pass environment variables to the export call? thanks!
[O] Difference between eval and export
hi all! I am wondering what the difference between the eval of a source block and the export of a buffer is in terms of the process in which the code is evaluated. Is the org-export call starting a new process? Is there a way to specify environment variables for the export process? thanks in advance for any information! best, jo
Re: [O] Difference between eval and export
thanks Grant for this information. I was just wondering, because it seemed to me that some environment variables (from the shell) are present in the, while they some (LC_ALL) are not present in the export process. In my case, the export call fails with an error message, while there is no problem if I evaluate source block per source block from the buffer. At present I am therefore looking for a way to specify environment variables in the export process, but I have no idea how to do that... On 26 Sep 2014, at 15:11, Grant Rettke g...@wisdomandwonder.com wrote: On Fri, Sep 26, 2014 at 5:43 AM, Johannes Rainer johannes.rai...@gmail.com wrote: I am wondering what the difference between the eval of a source block and the export of a buffer is in terms of the process in which the code is evaluated. When you evaluate a source block, it executes in the processed defined by your configuration. Then the results of that evaluation are stored according to your configuration. For example store the results in an example block. Exporting is the conversion for the org file content into and file format. During that process, you can configure whether or not you want evaluation of source blocks to occur during that process.
[O] R source code, break long lines
dear all, I'm extensively using org-mode in combination with R source code blocks. The only thing I miss is the possibility to break long lines of R code in the exported pdf. Is there a way to tell org, or the latex exporter, to have automatic line breaks for long lines? thanks in advance! cheers, jo
Re: [O] R source code, break long lines
On Tue, May 13, 2014 at 6:16 PM, John Hendy jw.he...@gmail.com wrote: On Tue, May 13, 2014 at 1:04 AM, Johannes Rainer johannes.rai...@gmail.com wrote: dear all, I'm extensively using org-mode in combination with R source code blocks. The only thing I miss is the possibility to break long lines of R code in the exported pdf. Is there a way to tell org, or the latex exporter, to have automatic line breaks for long lines? I think these are treated as verbatim... so what's in your buffer is what you'll get in PDF. You might consider editing the block with C-c ' (Ctrl + C, then single quote). From there, when you hit a reasonable point (=80 characters), press return and Org will auto-indent things pretty nicely, at least in my experience with R. right, that's the way I'm doing it now. just thought I missed some automatic way to do that. thanks! If you get odd results, perhaps check this thread, as I was having issues with Org exporting the code blocks exactly as I'd typed them: - https://www.mail-archive.com/emacs-orgmode@gnu.org/msg81100.html Tl;dr is that you should check the variables org-src-preserve-indentation, and possibly the variable indent-tabs-mode. so far, ess/org or however formatted the code nicely for me after pressing return in the ess mode buffer Best regards, John thanks in advance! cheers, jo
[O] MobileOrg changes not showing in local agenda
dear all, I am trying to use MobileOrg, and successfully set up the sync to my WebDAV. Also, my agenda is nicely synced to the ipad, however, any changes that I make to the agenda on the iPad, while being stored into the file mobileorg.org on the server and saved into from-mobile.org locally, are not further processed locally. This means, from-mobile.org contains the information about the changes to the agenda, but the e.g. TODO status changes are not written back to the local org files. any solutions? is there something I miss, or is there a log file or anything where I could check what is happening, or actually, is not happening? thanks in advance! jo
Re: [O] MobileOrg changes not showing in local agenda
hi Alex, I did that, and my emacs tells me that he pulled stuff from the webdav. but that's all, no changes at all in my local TODOs. actually, I checked the content of my local from-mobile.org file: * F(edit:todo) [[(null)][(null)]] ** Old value TODO ** New value DONE ** End of edit I suppose the problem is the [[(null)]][(null)]. I suppose there should be something like the TODO ID or something like that... On Fri, Sep 20, 2013 at 11:36 AM, Alexander Baier lexi.ba...@gmail.comwrote: Hello jo, Johannes Rainer johannes.rai...@gmail.com writes: dear all, I am trying to use MobileOrg, and successfully set up the sync to my WebDAV. Also, my agenda is nicely synced to the ipad, however, any changes that I make to the agenda on the iPad, while being stored into the file mobileorg.org on the server and saved into from-mobile.org locally, are not further processed locally. AFAIK, you have to run `org-mobile-pull` to further process your edits. This means, from-mobile.org contains the information about the changes to the agenda, but the e.g. TODO status changes are not written back to the local org files. any solutions? is there something I miss, or is there a log file or anything where I could check what is happening, or actually, is not happening? thanks in advance! jo Regards, Alex -- Johannes Rainer, PhD Applied Bioinformatics Group, Division Molecular Pathophysiology, Biocenter, Medical University Innsbruck, Innrain 80/82 II, 6020 Innsbruck, Austria and Tyrolean Cancer Research Institute Innrain 66, 6020 Innsbruck, Austria Tel.: +43 (0)512 9003 70961 Email: johannes.rai...@i-med.ac.at johannes.rai...@tcri.at URL: http://bioinfo.i-med.ac.at
[O] macro expansion not working in #+ATTR_LATEX
hi all! while working nicely for plain text I realized that macros are not expanded if put in #+ATTR_LATEX: e.g. I defined #+MACRO: image_width 16 and wanted to use this macro like #+ATTR_LATEX: :center :placement [H] :width {{{image_width}}}cm however, in the exported tex file I get: \includegraphics[width={{{image_width}}}cm]{test.png} is that intentional that macro expansion works only for plain text? thanks, jo
Re: [O] asynchronous code evaluation
On Wed, Sep 4, 2013 at 10:00 AM, Suvayu Ali fatkasuvayu+li...@gmail.comwrote: On Wed, Sep 04, 2013 at 07:27:01AM +0200, Johannes Rainer wrote: hi all! I have some pretty calculation intense R code in a code block and when I execute the code (C-c C-c) my emacs freezes and waits for the code to finish. Is there a way to evaluate the code asynchronously, so that I could edit the file (obviously not the code block itself) while the code is being evaluated? Not sure that is a possibility yet. For the moment you could try asynchronous export as a workaround. yes, I will do that. I just realized that I have to set ess-ask-for-ess-directory to nil, otherwise the async export hangs because it tries to ask where to start R. That said, I am curious why you are knowingly tying a computationally intensive (possibly buggy, during development i.e.) process with your editor. I have to work on some fairly computationally intensive analysis with Python. I always keep them in separate modules and scripts run from the shell. well, I'm using emacs/org for my data analyses in R. I thus combine documentation (i.e. the conclusions drawn from e.g. plots created in R) and the R code to perform the analysis in my org file. Since I'm analysing high throughput data some tasks to handle the data are quite time consuming. cheers, jo Hope this helps, -- Suvayu Open source is the future. It sets us free. -- Johannes Rainer, PhD Applied Bioinformatics Group, Division Molecular Pathophysiology, Biocenter, Medical University Innsbruck, Innrain 80/82 II, 6020 Innsbruck, Austria and Tyrolean Cancer Research Institute Innrain 66, 6020 Innsbruck, Austria Tel.: +43 (0)512 9003 70961 Email: johannes.rai...@i-med.ac.at johannes.rai...@tcri.at URL: http://bioinfo.i-med.ac.at
[O] mixed orgmode installation
hi all! is there a clean way to disable the built in org from emacs? I'm loading org mode from git externally, but newer emacs always come with org mode included. would just deleting the org folder in the emacs (am using Emacs.app on mac) installation help? thanks in advance!
Re: [O] mixed orgmode installation
On Wed, Sep 4, 2013 at 4:19 PM, Thorsten Jolitz tjol...@gmail.com wrote: Johannes Rainer johannes.rai...@gmail.com writes: hi all! is there a clean way to disable the built in org from emacs? I'm loading org mode from git externally, but newer emacs always come with org mode included. would just deleting the org folder in the emacs (am using Emacs.app on mac) installation help? thanks in advance! Using the git version too, I had lots of trouble with mixed installs. Therefore the first thing I do is deleting the org folder in the emacs installation, although I have been told on this list this would be a recipe for desaster (since autoloads will be messed up or so ...). But desaster never happened, in fact I did not have any misterious problems with (multiple) org-mode(s) on my machine anymore since then. I just replace the installation org-mode folder with a symlink to the git folder and add a 'subdirs.el' to the git folder, then it works. hm, that's an option. based on your suggestion I created now my own little makefile to install the git org-mode and directly over-write the one located in /Applications/Emacs.app/Resources/lisp/org . actually, I first delete all files in this org directory and install the one from git into the dir again. thanks! -- cheers, Thorsten
[O] asynchronous code evaluation
hi all! I have some pretty calculation intense R code in a code block and when I execute the code (C-c C-c) my emacs freezes and waits for the code to finish. Is there a way to evaluate the code asynchronously, so that I could edit the file (obviously not the code block itself) while the code is being evaluated? thanks, jo
Re: [O] export tex file to different directory
thanks, I will give it a try. On Sun, Sep 1, 2013 at 8:47 PM, Suvayu Ali fatkasuvayu+li...@gmail.comwrote: On Sun, Sep 01, 2013 at 07:58:42PM +0200, Johannes Rainer wrote: Hi all, is there a way that I could export the generated tex files to a different directory upon export? If you are using subtree export, you can set the EXPORT_FILE_NAME property to dir/file.pdf. If you are exporting the whole file, take a look at the publishing facility in the manual. Hope this helps, -- Suvayu Open source is the future. It sets us free.
[O] export tex file to different directory
Hi all, is there a way that I could export the generated tex files to a different directory upon export? thanks, jo
[O] org mode R remote code evaluation
dear all, I have some computation intense R-code that I want to run remotely on my server, and, according to the org manual that should be possible with the :dir parameter. so I went on and tried the following (user/server masked): #+BEGIN_SRC R :dir /xx@xxx: system(hostname) #+END_SRC when I execute it I get the error: Tramp: Encoding region using function `base64-encode-region'...done Tramp: Decoding region into remote file /ssh:xx@xxx :/var/folders/ny/6kbb36310wz2kww8y8ctry60gn/T/R-46345BQs...done byte-code: Couldn't write region to `/ssh:xx@xxx:/var/folders/ny/6kbb36310wz2kww8y8ctry60gn/T/R-46345BQs', decode using `base64 -d -i %s' failed apparently, this temp folder does not exist on the linux server, it is actually the temp folder from my local machine. I get the same error when I try to execute remote shell code, so it's not R related. I also tried to start a ssh session using M-x ssh and used the source block #+BEGIN_SRC R :exports both :session *ssh xxx* system(hostname) #+END_SRC on the server it executes the command but it can not write the results: xxx Warning message: In file.rename(tfile, transfer.file) : cannot rename file '/tmp/RtmpsirjGl/file51c8f6ce4ec' to '/var/folders/ny/6kbb36310wz2kww8y8ctry60gn/T/babel-46345zSH/R-46345a4N', reason 'No such file or directory' I am using emacs 24.3 and Org-mode version 8.0.7 (release_8.0.7-384-g6fdc23) I would be helpful for any suggestions how I could solve this problem. thanks in advance
Re: [O] org mode R remote code evaluation
thanks! so the :results output does the trick. On Thu, Aug 29, 2013 at 10:25 AM, Loris Bennett loris.benn...@fu-berlin.dewrote: Johannes Rainer johannes.rai...@gmail.com writes: dear all, I have some computation intense R-code that I want to run remotely on my server, and, according to the org manual that should be possible with the :dir parameter. so I went on and tried the following (user/server masked): #+BEGIN_SRC R :dir /xx@xxx: system(hostname) #+END_SRC when I execute it I get the error: Tramp: Encoding region using function `base64-encode-region'...done Tramp: Decoding region into remote file /ssh:xx@xxx :/var/folders/ny/6kbb36310wz2kww8y8ctry60gn/T/R-46345BQs...done byte-code: Couldn't write region to `/ssh:xx@xxx :/var/folders/ny/6kbb36310wz2kww8y8ctry60gn/T/R-46345BQs', decode using `base64 -d -i %s' failed apparently, this temp folder does not exist on the linux server, it is actually the temp folder from my local machine. I get the same error when I try to execute remote shell code, so it's not R related. I also tried to start a ssh session using M-x ssh and used the source block #+BEGIN_SRC R :exports both :session *ssh xxx* system(hostname) #+END_SRC on the server it executes the command but it can not write the results: xxx Warning message: In file.rename(tfile, transfer.file) : cannot rename file '/tmp/RtmpsirjGl/file51c8f6ce4ec' to '/var/folders/ny/6kbb36310wz2kww8y8ctry60gn/T/babel-46345zSH/R-46345a4N', reason 'No such file or directory' I am using emacs 24.3 and Org-mode version 8.0.7 (release_8.0.7-384-g6fdc23) I would be helpful for any suggestions how I could solve this problem. thanks in advance The following works for me: #+BEGIN_SRC R :results output :dir /xxx@x: system(hostname) #+END_SRC with Emacs 24.2.1 and 8.0.7 (8.0.7-6-g13cb28-elpaplus) Cheers, Loris -- This signature is currently under construction. -- Johannes Rainer, PhD Applied Bioinformatics Group, Division Molecular Pathophysiology, Biocenter, Medical University Innsbruck, Innrain 80/82 II, 6020 Innsbruck, Austria and Tyrolean Cancer Research Institute Innrain 66, 6020 Innsbruck, Austria Tel.: +43 (0)512 9003 70961 Email: johannes.rai...@i-med.ac.at johannes.rai...@tcri.at URL: http://bioinfo.i-med.ac.at
[O] macro expansion in source code
hi, I was just wondering if there is a way to use macro expansion also in source code blocks or headers. I tried this, but the macro was never expanded, but rather the {{{image_width}}} was exported. could the expansion be done by calling the macro expansion before export (e.g. using a hook)? something like this: #+MACRO: image_width 16 #+BEGIN_SRC R :results silent :exports code IMAGE - test.png WIDTH - {{{image_width}}} HEIGHT - 6 png( file=IMAGE, width=WIDTH, height=HEIGHT, units=cm, res=600, pointsize=6 ) library( RColorBrewer ) display.brewer.all() dev.off() #+END_SRC or #+BEGIN_SRC R :results file :exports results :width {{{image_width}}} display.brewer.all() #+END_SRC cheers, jo
Re: [O] macro expansion in source code
thanks for that solution! I will give it a try! On Thu, Aug 29, 2013 at 5:15 PM, Charles Berry ccbe...@ucsd.edu wrote: Johannes Rainer johannes.rainer at gmail.com writes: hi, I was just wondering if there is a way to use macro expansion also in source code blocks or headers. I tried this, but the macro was never expanded, but rather the {{{image_width}}} was exported. could the expansion be done by calling the macro expansion before export (e.g. using a hook)? something like this: [snip] I think the answer is no. But you can accomplish much the same thing with properties and/or noweb references. Like this * header :PROPERTIES: :image_width: 16 :END: #+NAME: imwide #+HEADER: :var iw=(org-entry-get (point) image_width) #+BEGIN_SRC R :results value iw #+END_SRC #+RESULTS: imwide : 16 #+BEGIN_SRC R :noweb yes :results output image.width - imwide() image.width #+END_SRC #+RESULTS: : [1] 16 -- Johannes Rainer, PhD Applied Bioinformatics Group, Division Molecular Pathophysiology, Biocenter, Medical University Innsbruck, Innrain 80/82 II, 6020 Innsbruck, Austria and Tyrolean Cancer Research Institute Innrain 66, 6020 Innsbruck, Austria Tel.: +43 (0)512 9003 70961 Email: johannes.rai...@i-med.ac.at johannes.rai...@tcri.at URL: http://bioinfo.i-med.ac.at