Re: Has VISIBILITY property become case-sensitive?

2024-04-04 Thread Richard Stanton
Actually, it didn’t!

But now I’m not seeing the original behavior either, though I haven’t changed 
anything. Don’t spend any more time on this - I’ll report back if I learn 
anything else.

Best

Richard




> On Apr 4, 2024, at 12:42 PM, Richard Stanton  wrote:
> 
> Here’ s a very simple org file that exhibits the behavior I describe
> 
> -
> 
> #+STARTUP: overview
> 
> * Hidden
> - This should not initially appear
> - Nor this
> 
> * Visible
> :PROPERTIES:
> :VISIBILITY: content
> :END:
> - This should appear
> - And this
> 
> ———
> 
> Change the case of the word “VISIBILILTY” and the file's behavior on first 
> loading changes.
> 
> When I load this file using emacs -Q (which loads org 9.6.15), both sections 
> appear folded regardless of the case of “visibility”…! Is there some 
> configuration variable I need to set?
> 
> 
> 
> 
> 
>> On Apr 4, 2024, at 12:34 PM, Ihor Radchenko > <mailto:yanta...@posteo.net>> wrote:
>> 
>> Richard Stanton mailto:rhstan...@berkeley.edu>> 
>> writes:
>> 
>>> My org file has the header line 
>>> 
>>> #+STARTUP: overview
>>> 
>>> One section contains the properties drawer
>>> 
>>> :PROPERTIES:
>>> :Visibility: content
>>> :END:
>>> 
>>> This used to show the contents of that subtree on first loading the file, 
>>> but it no longer does. Experimentation shows that it works if I change 
>>> “Visibility” to “VISIBILITY”. Is it a deliberate change to require upper 
>>> case here? By the way, this is using org version 9.7pre
>> 
>> I am unable to reproduce.
>> Please provide more details, preferably starting from emacs -Q.
>> See https://orgmode.org/manual/Feedback.html#Feedback 
>> <https://orgmode.org/manual/Feedback.html#Feedback>
>> 
>> -- 
>> Ihor Radchenko // yantar92,
>> Org mode contributor,
>> Learn more about Org mode at <https://orgmode.org/ <https://orgmode.org/>>.
>> Support Org development at <https://liberapay.com/org-mode 
>> <https://liberapay.com/org-mode>>,
>> or support my work at <https://liberapay.com/yantar92 
>> <https://liberapay.com/yantar92>>
> 



Re: Has VISIBILITY property become case-sensitive?

2024-04-04 Thread Richard Stanton
Here’ s a very simple org file that exhibits the behavior I describe

-

#+STARTUP: overview

* Hidden
- This should not initially appear
- Nor this

* Visible
:PROPERTIES:
:VISIBILITY: content
:END:
- This should appear
- And this

———

Change the case of the word “VISIBILILTY” and the file's behavior on first 
loading changes.

When I load this file using emacs -Q (which loads org 9.6.15), both sections 
appear folded regardless of the case of “visibility”…! Is there some 
configuration variable I need to set?





> On Apr 4, 2024, at 12:34 PM, Ihor Radchenko  wrote:
> 
> Richard Stanton mailto:rhstan...@berkeley.edu>> 
> writes:
> 
>> My org file has the header line 
>> 
>> #+STARTUP: overview
>> 
>> One section contains the properties drawer
>> 
>> :PROPERTIES:
>> :Visibility: content
>> :END:
>> 
>> This used to show the contents of that subtree on first loading the file, 
>> but it no longer does. Experimentation shows that it works if I change 
>> “Visibility” to “VISIBILITY”. Is it a deliberate change to require upper 
>> case here? By the way, this is using org version 9.7pre
> 
> I am unable to reproduce.
> Please provide more details, preferably starting from emacs -Q.
> See https://orgmode.org/manual/Feedback.html#Feedback 
> <https://orgmode.org/manual/Feedback.html#Feedback>
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/ <https://orgmode.org/>>.
> Support Org development at <https://liberapay.com/org-mode 
> <https://liberapay.com/org-mode>>,
> or support my work at <https://liberapay.com/yantar92 
> <https://liberapay.com/yantar92>>



Has VISIBILITY property become case-sensitive?

2024-04-04 Thread Richard Stanton
My org file has the header line 

#+STARTUP: overview

One section contains the properties drawer

:PROPERTIES:
:Visibility: content
:END:

This used to show the contents of that subtree on first loading the file, but 
it no longer does. Experimentation shows that it works if I change “Visibility” 
to “VISIBILITY”. Is it a deliberate change to require upper case here? By the 
way, this is using org version 9.7pre

Best,

Richard Stanton





Re: How to export a single subtree but include document preamble?

2024-04-04 Thread Richard Stanton
On Apr 4, 2024, at 11:11 AM, Richard Stanton  wrote:
> 
>> I don't know if this does what you want, but I use a ‘PROPERTIES’ drawer 
>> right below the subtree's headline and in that drawer, I put the following 
>> code:
>> 
>> :EXPORT_LATEX_HEADER_EXTRA: \input{latex-preamble.tex}
>> 
>> Scott Randby
> 
> Thanks for the suggestion! 
> 
> It would still be nice (i.e., you wouldn’t have to do this for every section 
> you ever want to export) to have a way of specifying a line that gets 
> executed for EVERY (say) LaTeX export. Or else an option to do something like 
> include everything in the file before the first section header.

That capability does (if you’re careful) seem to exist. In my case, I just had 
to replace

#+include: setup.org <http://setup.org/>

with 

#+setupfile: setup.org

and now exporting includes the macro definitions in setup.org 
<http://setup.org/> even when I’m only exporting a subtree.

Re: How to export a single subtree but include document preamble?

2024-04-04 Thread Richard Stanton
> I don't know if this does what you want, but I use a ‘PROPERTIES’ drawer 
> right below the subtree's headline and in that drawer, I put the following 
> code:
> 
> :EXPORT_LATEX_HEADER_EXTRA: \input{latex-preamble.tex}
> 
> Scott Randby

Thanks for the suggestion! 

It would still be nice (i.e., you wouldn’t have to do this for every section 
you ever want to export) to have a way of specifying a line that gets executed 
for EVERY (say) LaTeX export. Or else an option to do something like include 
everything in the file before the first section header.





Re: LaTeX export ignores caption if table is in a drawer

2023-05-26 Thread Richard Stanton
Thanks, Ihor.

":results raw replace" seems to do what I need.

Best,

Richard


> On May 25, 2023, at 11:33 PM, Ihor Radchenko  wrote:
> 
> "Richard H. Stanton"  writes:
> 
>> I often create tables programatically from within an org code block. To make 
>> sure I don’t produce multiple copies of the output, I like to enclose the 
>> results in a drawer. However, the exporter seems to ignore any caption I 
>> might assign if the table itself is inside a drawer. For example, if you 
>> export the sample org file below to LaTeX, the first table gets exported 
>> with caption, the second without. Would it be possible for the exporter to 
>> keep the caption in the second case as well? 
>> ...
>> #+caption: Small table
>> | C1 | C2 |
>> |+|
>> 
>> #+caption: Small table
>> :results:
>> | C1 | C2 |
>> |+|
>> :end:
> 
> The second example has a drawer with caption, not a table with caption.
> Captions in drawers are ignored (or rather it is undefined behaviour).
> 
> I recommend not wrapping tables into drawers in your use case - it is
> not necessary if you just have a table in the output. If you have
> multiple things, with table coming first, it would be unclear which part
> you want to assign the caption to; so you would need to arrange yourself
> to create table result with caption inside the drawer.
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 




Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version

2022-05-26 Thread Richard Stanton
I’d be happy to do a live debug, but since this seems to involve an interaction 
between three packages, only one of which is org, and it’s quite easy to find 
an alternative way to achieve what I’m trying to do, I‘d probably suggest just 
ignoring this for now.

> On May 25, 2022, at 9:27 PM, Ihor Radchenko  wrote:
> 
> Richard Stanton  writes:
> 
>> Odd. Invoking it as you do on my Mac, I get the same results I noted 
>> earlier. 
> 
> Then, can you ask some other Mac user to reproduce? It is hard to fix
> something not reproducible on my system :(
> 
> Or maybe we can arrange a live screensharing to directly debug the issue
> on your system.
> 
> Best,
> Ihor




Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version

2022-05-22 Thread Richard Stanton
Odd. Invoking it as you do on my Mac, I get the same results I noted earlier. 

> On May 20, 2022, at 1:57 AM, Ihor Radchenko  wrote:
> 
> "Richard H. Stanton"  writes:
> 
>> Here’s a simple init.el that shows the problem (most of it is just 
>> boilerplate code to use straight.el to manage packages, and you may need to 
>> edit the python executable path).
>> ...
>> ——
>> 
>> Now execute the following source block and you’ll see the misaligned table.
>> 
>> #+begin_src jupyter-python :async yes :session py
>> [['aaa', 'a'], None, ['b', 'b']]
>> #+end_src
> 
> I am unable to reproduce the problem using Emacs 28.1 on Linux.
> I ran Emacs in a clean .emacs.d environment using
> https://github.com/alphapapa/with-emacs.sh:
> 
> $ with-emacs.sh -e emacs -OPR -- -Q -l /tmp/bug.el /tmp/bug.org
> 
> with bug.el containing your script with latest Org line uncommented and
> built-in Org line commented and bug.org containing the example source
> block.
> 
> Best,
> Ihor




Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version

2022-05-18 Thread Richard Stanton
A bit more experimenting shows that asynchronous execution is actually a part 
of my original problem. By default, I have jupyter-python blocks running 
asynchronously. In that case, the tables don’t format quite right, as I noted. 
But if I add the header ":async nil", the table comes out fine. Table 
formatting is OK in python blocks with or without asynchronous execution. 

> On May 18, 2022, at 2:00 PM, John Kitchin  wrote:
> 
> I would guess it could. I don't do anything asynchronous, and I am not sure 
> when org-babel-after-execute-hook runs, if it is immediately there is no 
> table to clean up I suppose. It is not necessary to run on  a subtree, but on 
> a very large document you probably don't want to do org-element-parse often.
> 
> 
> John
> 
> ---
> Professor John Kitchin (he/him/his)
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/>
> 
> 
> 
> On Wed, May 18, 2022 at 4:57 PM Richard Stanton  <mailto:rhstan...@berkeley.edu>> wrote:
> Thanks for the suggestion, John. I’ve tried playing around with this, and am 
> I right that it seems to have trouble when execution is asynchronous?
> 
>> On May 18, 2022, at 1:16 PM, John Kitchin > <mailto:jkitc...@andrew.cmu.edu>> wrote:
>> 
>> I use a function in an after execute hook for this: 
>> https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205 
>> <https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205>
>> 
>> This works on a subtree, which has been fine for me. You could adapt it to 
>> only work in the results section.
>> 
>> John
>> 
>> ---
>> Professor John Kitchin (he/him/his)
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/>
>> 
>> 
>> 
>> On Wed, May 18, 2022 at 4:07 PM Richard Stanton > <mailto:rhstan...@berkeley.edu>> wrote:
>> I’m running Emacs 28.1 under macOS 12.4 and want to create tables from 
>> Python code blocks that can be exported to either LaTeX or HTML. The 
>> simplest way to do this seems to be to generate the output as an org table, 
>> and using the built-in version of org (9.4.6 
>> (9.4.6-798-g738759.dirty-elpaplus @ 
>> /Users/stanton/.emacs.d/elpa/org-plus-contrib-20210929/)), this works fine 
>> using either a python or emacs-jupyter code block:
>> 
>> #+begin_src jupyter-python
>> [
>> ["Wide a", "b", "c"],
>> None,
>> [1, 2, 3],
>> [4, 5, 6],
>> None,
>> [7, 8, 9]
>> ]
>> #+end_src
>> 
>> #+RESULTS:
>> | Wide a | b | c |
>> |+---+---|
>> |  1 | 2 | 3 |
>> |  4 | 5 | 6 |
>> |+---+---|
>> |  7 | 8 | 9 |
>> 
>> #+begin_src python 
>> return [
>> ["Wide a", "b", "c"],
>> None,
>> [1, 2, 3],
>> [4, 5, 6],
>> None,
>> [7, 8, 9]
>> ]
>> #+end_src
>> 
>> #+RESULTS:
>> | Wide a | b | c |
>> |+---+---|
>> |  1 | 2 | 3 |
>> |  4 | 5 | 6 |
>> |+---+---|
>> |  7 | 8 | 9 |
>> 
>> 
>> To use the latest version of org, I change just two lines in my init.el from
>> 
>> (straight-use-package '(org :type built-in))
>> (straight-use-package '(org-contrib :type built-in))
>> 
>> to
>> 
>> (straight-use-package '(org :type git :repo 
>> "https://code.orgmode.org/bzg/org-mode.git 
>> <https://code.orgmode.org/bzg/org-mode.git>"))
>> (straight-use-package '(org-contrib :type git :repo 
>> "https://git.sr.ht/~bzg/org-contrib <https://git.sr.ht/~bzg/org-contrib>”))
>> 
>> Having done this, the python block still works fine, but the horizontal 
>> lines in the jupyter-python block are no longer properly aligned with the 
>> text:
>> 
>> #+begin_src jupyter-python
>> [
>> ["Wide a", "b", "c"],
>> None,
>> [1, 2, 3],
>> [4, 5, 6],
>> None,
>> [7, 8, 9]
>> ]
>> #+end_src
>> 
>> #+RESULTS:
>> | Wide a | b | c |
>> |---+---+---|
>> | 1 | 2 | 3 |
>> | 4 | 5 | 6 |
>> |---+---+---|
>> | 7 | 8 | 9 |
>> 
>> #+begin_src python 
>> return [
>> ["Wide a", "b", "c"],
>> None,
>> [1, 2, 3],
>> [4, 5, 6],
>> None,
>> [7, 8, 9]
>> ]
>> #+end_src
>> 
>> #+RESULTS:
>> | Wide a | b | c |
>> |+---+---|
>> |  1 | 2 | 3 |
>> |  4 | 5 | 6 |
>> |+---+---|
>> |  7 | 8 | 9 |
>> 
>> By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @ 
>> /Users/stanton/.emacs.d/straight/build/org/).
>> 
>> The table exports OK, but isn’t much fun to look at in the org file itself.
>> 
>> Since I like to use emacs-jupyter, any suggestions would be appreciated. I 
>> know this worked fine just a few weeks ago.
>> 
>> Thanks!
>> 
>> Richard Stanton
>> 
>> 
>> 
>> 
>> 
> 



Re: Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version

2022-05-18 Thread Richard Stanton
Thanks for the suggestion, John. I’ve tried playing around with this, and am I 
right that it seems to have trouble when execution is asynchronous?

> On May 18, 2022, at 1:16 PM, John Kitchin  wrote:
> 
> I use a function in an after execute hook for this: 
> https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205 
> <https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L205>
> 
> This works on a subtree, which has been fine for me. You could adapt it to 
> only work in the results section.
> 
> John
> 
> ---
> Professor John Kitchin (he/him/his)
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu <http://kitchingroup.cheme.cmu.edu/>
> 
> 
> 
> On Wed, May 18, 2022 at 4:07 PM Richard Stanton  <mailto:rhstan...@berkeley.edu>> wrote:
> I’m running Emacs 28.1 under macOS 12.4 and want to create tables from Python 
> code blocks that can be exported to either LaTeX or HTML. The simplest way to 
> do this seems to be to generate the output as an org table, and using the 
> built-in version of org (9.4.6 (9.4.6-798-g738759.dirty-elpaplus @ 
> /Users/stanton/.emacs.d/elpa/org-plus-contrib-20210929/)), this works fine 
> using either a python or emacs-jupyter code block:
> 
> #+begin_src jupyter-python
> [
> ["Wide a", "b", "c"],
> None,
> [1, 2, 3],
> [4, 5, 6],
> None,
> [7, 8, 9]
> ]
> #+end_src
> 
> #+RESULTS:
> | Wide a | b | c |
> |+---+---|
> |  1 | 2 | 3 |
> |  4 | 5 | 6 |
> |+---+---|
> |  7 | 8 | 9 |
> 
> #+begin_src python 
> return [
> ["Wide a", "b", "c"],
> None,
> [1, 2, 3],
> [4, 5, 6],
> None,
> [7, 8, 9]
> ]
> #+end_src
> 
> #+RESULTS:
> | Wide a | b | c |
> |+---+---|
> |  1 | 2 | 3 |
> |  4 | 5 | 6 |
> |+---+---|
> |  7 | 8 | 9 |
> 
> 
> To use the latest version of org, I change just two lines in my init.el from
> 
> (straight-use-package '(org :type built-in))
> (straight-use-package '(org-contrib :type built-in))
> 
> to
> 
> (straight-use-package '(org :type git :repo 
> "https://code.orgmode.org/bzg/org-mode.git 
> <https://code.orgmode.org/bzg/org-mode.git>"))
> (straight-use-package '(org-contrib :type git :repo 
> "https://git.sr.ht/~bzg/org-contrib <https://git.sr.ht/~bzg/org-contrib>”))
> 
> Having done this, the python block still works fine, but the horizontal lines 
> in the jupyter-python block are no longer properly aligned with the text:
> 
> #+begin_src jupyter-python
> [
> ["Wide a", "b", "c"],
> None,
> [1, 2, 3],
> [4, 5, 6],
> None,
> [7, 8, 9]
> ]
> #+end_src
> 
> #+RESULTS:
> | Wide a | b | c |
> |---+---+---|
> | 1 | 2 | 3 |
> | 4 | 5 | 6 |
> |---+---+---|
> | 7 | 8 | 9 |
> 
> #+begin_src python 
> return [
> ["Wide a", "b", "c"],
> None,
> [1, 2, 3],
> [4, 5, 6],
> None,
> [7, 8, 9]
> ]
> #+end_src
> 
> #+RESULTS:
> | Wide a | b | c |
> |+---+---|
> |  1 | 2 | 3 |
> |  4 | 5 | 6 |
> |+---+---|
> |  7 | 8 | 9 |
> 
> By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @ 
> /Users/stanton/.emacs.d/straight/build/org/).
> 
> The table exports OK, but isn’t much fun to look at in the org file itself.
> 
> Since I like to use emacs-jupyter, any suggestions would be appreciated. I 
> know this worked fine just a few weeks ago.
> 
> Thanks!
> 
> Richard Stanton
> 
> 
> 
> 
> 



Trouble producing nicely aligned org tables from emacs-jupyter code blocks using latest org version

2022-05-18 Thread Richard Stanton
I’m running Emacs 28.1 under macOS 12.4 and want to create tables from Python 
code blocks that can be exported to either LaTeX or HTML. The simplest way to 
do this seems to be to generate the output as an org table, and using the 
built-in version of org (9.4.6 (9.4.6-798-g738759.dirty-elpaplus @ 
/Users/stanton/.emacs.d/elpa/org-plus-contrib-20210929/)), this works fine 
using either a python or emacs-jupyter code block:

#+begin_src jupyter-python
[
["Wide a", "b", "c"],
None,
[1, 2, 3],
[4, 5, 6],
None,
[7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|+---+---|
|  1 | 2 | 3 |
|  4 | 5 | 6 |
|+---+---|
|  7 | 8 | 9 |

#+begin_src python 
return [
["Wide a", "b", "c"],
None,
[1, 2, 3],
[4, 5, 6],
None,
[7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|+---+---|
|  1 | 2 | 3 |
|  4 | 5 | 6 |
|+---+---|
|  7 | 8 | 9 |


To use the latest version of org, I change just two lines in my init.el from

(straight-use-package '(org :type built-in))
(straight-use-package '(org-contrib :type built-in))

to

(straight-use-package '(org :type git :repo 
"https://code.orgmode.org/bzg/org-mode.git;))
(straight-use-package '(org-contrib :type git :repo 
"https://git.sr.ht/~bzg/org-contrib”))

Having done this, the python block still works fine, but the horizontal lines 
in the jupyter-python block are no longer properly aligned with the text:

#+begin_src jupyter-python
[
["Wide a", "b", "c"],
None,
[1, 2, 3],
[4, 5, 6],
None,
[7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|---+---+---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
|---+---+---|
| 7 | 8 | 9 |

#+begin_src python 
return [
["Wide a", "b", "c"],
None,
[1, 2, 3],
[4, 5, 6],
None,
[7, 8, 9]
]
#+end_src

#+RESULTS:
| Wide a | b | c |
|+---+---|
|  1 | 2 | 3 |
|  4 | 5 | 6 |
|+---+---|
|  7 | 8 | 9 |

By the way, the org version loaded this time is 9.5.3 (9.5.3-g277897 @ 
/Users/stanton/.emacs.d/straight/build/org/).

The table exports OK, but isn’t much fun to look at in the org file itself.

Since I like to use emacs-jupyter, any suggestions would be appreciated. I know 
this worked fine just a few weeks ago.

Thanks!

Richard Stanton







Re: How to stop results being hidden when using ":results drawer"?

2022-05-11 Thread Richard Stanton
It works fine when I use emacs -Q, so I did some hunting around and discovered 
that it’s a bad interaction with the xenops package. A shame, as this package 
does a great job of almost-real-time previewing of LaTeX equations, figure and 
tables.


> On May 11, 2022, at 10:51 AM, Richard Stanton  wrote:
> 
> I see that the same question was asked by John Kitchin in 2016. The accepted 
> answer back then was either to put
> 
> #+STARTUP: showeverything
> 
> at the top of the org file or to use (setq org-startup-folded 
> "showeverything”).
> 
> I don’t know if something has changed in org since then, but neither of these 
> seems to work for me at the moment. All of my :results: drawers start out and 
> remain hidden until I click on them and press TAB.
> 
> 
>> On May 11, 2022, at 9:52 AM, Richard Stanton  wrote:
>> 
>> I’m creating documents where I run Python code blocks that create LaTeX 
>> mathematical output that I want to be able to export to either LaTeX/PDF or 
>> HTML. 
>> 
>> Using :wrap in the header works fine, except that LaTeX complains about the 
>> unknown environment “results” (it still compiles the file to PDF fine).
>> 
>> Using :wrap export latex works fine for LaTeX export, but I can’t get HTML 
>> that way.
>> 
>> The recommended method seems to be to use :results drawer. This works fine 
>> from an export perspective to both LaTeX/PDF and to HTML. However, it has 
>> one significant drawback when I’m actually creating the document: the 
>> results drawer starts out hidden and to see what’s there I have to click on 
>> it. This makes debugging the code in the first place a lot less convenient.
>> 
>> Is there a way to use :results drawer and have the results NOT hidden by 
>> default?
>> 
>> Thanks for any suggestions!
>> 
>> Richard Stanton
>> 
>> 
> 




Re: How to stop results being hidden when using ":results drawer"?

2022-05-11 Thread Richard Stanton
I see that the same question was asked by John Kitchin in 2016. The accepted 
answer back then was either to put

#+STARTUP: showeverything

at the top of the org file or to use (setq org-startup-folded "showeverything”).

I don’t know if something has changed in org since then, but neither of these 
seems to work for me at the moment. All of my :results: drawers start out and 
remain hidden until I click on them and press TAB.


> On May 11, 2022, at 9:52 AM, Richard Stanton  wrote:
> 
> I’m creating documents where I run Python code blocks that create LaTeX 
> mathematical output that I want to be able to export to either LaTeX/PDF or 
> HTML. 
> 
> Using :wrap in the header works fine, except that LaTeX complains about the 
> unknown environment “results” (it still compiles the file to PDF fine).
> 
> Using :wrap export latex works fine for LaTeX export, but I can’t get HTML 
> that way.
> 
> The recommended method seems to be to use :results drawer. This works fine 
> from an export perspective to both LaTeX/PDF and to HTML. However, it has one 
> significant drawback when I’m actually creating the document: the results 
> drawer starts out hidden and to see what’s there I have to click on it. This 
> makes debugging the code in the first place a lot less convenient.
> 
> Is there a way to use :results drawer and have the results NOT hidden by 
> default?
> 
> Thanks for any suggestions!
> 
> Richard Stanton
> 
> 




How to stop results being hidden when using ":results drawer"?

2022-05-11 Thread Richard Stanton
I’m creating documents where I run Python code blocks that create LaTeX 
mathematical output that I want to be able to export to either LaTeX/PDF or 
HTML. 

Using :wrap in the header works fine, except that LaTeX complains about the 
unknown environment “results” (it still compiles the file to PDF fine).

Using :wrap export latex works fine for LaTeX export, but I can’t get HTML that 
way.

The recommended method seems to be to use :results drawer. This works fine from 
an export perspective to both LaTeX/PDF and to HTML. However, it has one 
significant drawback when I’m actually creating the document: the results 
drawer starts out hidden and to see what’s there I have to click on it. This 
makes debugging the code in the first place a lot less convenient.

Is there a way to use :results drawer and have the results NOT hidden by 
default?

Thanks for any suggestions!

Richard Stanton





Re: Exporting to LaTeX versus Beamer: how to take different actions depending on export format?

2021-07-03 Thread Richard Stanton
I’ve found a few partial solutions:

1) 

#+begin_src emacs-lisp :results raw :exports (if (eq org-export-current-backend 
'beamer) "results" "none")
  (eval (concat "#+begin_src python\n  print('Hello, world')\n#+end_src"))
#+end_src

This prints the python code if exporting to Beamer and not if exporting to 
LaTeX, but the code is not now live, which rather undermines the best feature 
of org-mode!

2) Include the code twice, with conditional statements around it each time, so 
you can export one version to LaTeX and another version to Beamer. OK, but 
inelegant

3) Instead of trying to modify the listing options, surround the code block 
with some scaling statements that are called only in Beamer, e..g,

#+beamer: \begin{adjustbox}{height=0.5\textheight}
#+begin_src python
  print('Hello, world’)
#+end_src
#+beamer: \end{adjustbox}

None of these is quite perfect, but they mostly do what I want, especially #3.



> On Jul 2, 2021, at 12:56 PM, Richard Stanton  wrote:
> 
> I’ve been experimenting with using a single org file to generate an article 
> when exported to LaTeX (or HTML) and a Beamer presentation when exported to 
> Beamer, without requiring any edits to the org file itself. 
> 
> For this to be really useful, the exporter has to be able to do different 
> things depending on which output format you’ve asked for. 
> 
> 1) At a minimum, you need to be able to have text included in the article 
> that is not included in the Beamer presentation and vice versa, so that you 
> can have, say, a paragraph in the article vs. an itemized list in the Beamer 
> presentation. This can be taken care of relatively easily using one of 
> several conditional-compilation packages available for LaTeX. If people are 
> interested, I’ve uploaded a simple example to 
> https://faculty.haas.berkeley.edu/stanton/orgLatexBeamer/ 
> <https://faculty.haas.berkeley.edu/stanton/orgLatexBeamer/>
> 
> 2) However, some things are not so easy. For example, suppose I’m using the 
> listings package to include some code in my document, e.g.,
> 
> #+begin_src python
>   print(“Hello, world”)
> #+end_src
> 
> This works fine as long as I’m OK with the default output format. But suppose 
> this listing is too long for my slide so I want to make the text smaller than 
> normal. I can do that quite easily for both article and presentation output 
> by putting a line like
> 
> #+attr_latex: :options basicstyle=\tiny
> 
> immediately before the source block. But suppose I only want to do this in 
> the Beamer output and not in the LaTeX article output? I’ve tried 
> 
> #+attr_beamer: :options basicstyle=\tiny
> 
> but this doesn’t seem to work. And even if it did, what if I wanted the 
> change in font size to occur only when I’m exporting to LaTeX but not Beamer? 
> How can I do conditional things like this at the org-file level based on 
> whether I’m exporting to LaTeX or Beamer?
> 
> Thanks for any suggestions.
> 
> Richard Stanton
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 



Exporting to LaTeX versus Beamer: how to take different actions depending on export format?

2021-07-02 Thread Richard Stanton
I’ve been experimenting with using a single org file to generate an article 
when exported to LaTeX (or HTML) and a Beamer presentation when exported to 
Beamer, without requiring any edits to the org file itself. 

For this to be really useful, the exporter has to be able to do different 
things depending on which output format you’ve asked for. 

1) At a minimum, you need to be able to have text included in the article that 
is not included in the Beamer presentation and vice versa, so that you can 
have, say, a paragraph in the article vs. an itemized list in the Beamer 
presentation. This can be taken care of relatively easily using one of several 
conditional-compilation packages available for LaTeX. If people are interested, 
I’ve uploaded a simple example to 
https://faculty.haas.berkeley.edu/stanton/orgLatexBeamer/ 
<https://faculty.haas.berkeley.edu/stanton/orgLatexBeamer/>

2) However, some things are not so easy. For example, suppose I’m using the 
listings package to include some code in my document, e.g.,

#+begin_src python
  print(“Hello, world”)
#+end_src

This works fine as long as I’m OK with the default output format. But suppose 
this listing is too long for my slide so I want to make the text smaller than 
normal. I can do that quite easily for both article and presentation output by 
putting a line like

#+attr_latex: :options basicstyle=\tiny

immediately before the source block. But suppose I only want to do this in the 
Beamer output and not in the LaTeX article output? I’ve tried 

#+attr_beamer: :options basicstyle=\tiny

but this doesn’t seem to work. And even if it did, what if I wanted the change 
in font size to occur only when I’m exporting to LaTeX but not Beamer? How can 
I do conditional things like this at the org-file level based on whether I’m 
exporting to LaTeX or Beamer?

Thanks for any suggestions.

Richard Stanton













Re: [BUG] New error: (void-function org-url-p) when exporting to LaTeX [9.4.6 (9.4.6-gc5573b @ /Users/stanton/.emacs.d/straight/build/org/)]

2021-05-29 Thread Richard Stanton
On May 28, 2021, at 11:41 PM, Ihor Radchenko  wrote:
> 
> Richard Stanton  writes:
>> I currently load org using straight.el as follows:
>> ...
>> (use-package org-contrib
>>  :after org
>> ...
>> (use-package org
>>  :after (jupyter)
> 
> I suspect that something else is pulling built-in org version before
> jupyter gets loaded. To make sure that the straight version of Org mode
> is loaded, I recommend putting the following at the beginning of your
> init.el:
> 
> (straight-use-package '(org :type git :repo 
> "https://code.orgmode.org/bzg/org-mode.git;))
> (straight-use-package '(org-contrib :type git :repo 
> "https://git.sr.ht/~bzg/org-contrib;))
> 
> To debug similar issues, you might set use-package-verbose to t at the
> beginning of your init.el and examine the *Messages* buffer after
> startup.

Thanks for the suggestion, Ihor. I’ll experiment.


Re: [BUG] New error: (void-function org-url-p) when exporting to LaTeX [9.4.6 (9.4.6-gc5573b @ /Users/stanton/.emacs.d/straight/build/org/)]

2021-05-27 Thread Richard Stanton
Thanks, Tim. 

I deleted all org-related files and started again, with the same result. 

Oddly, I do find reference to org-url-p in my basic org setup:

Richards-Mac-Pro:~/.emacs.d/straight/repos/org/lisp stanton$ grep -i org-url-p 
*.el  
org-compat.el:(define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.5")
org-lint.el:  (and (not (org-url-p file))
org-macs.el:(defun org-url-p (s)
org.el:   (uri-is-url (org-url-p uri))
org.el:  (let* ((is-url (org-url-p file))
org.el:(when (org-url-p file)
Richards-Mac-Pro:~/.emacs.d/straight/repos/org/lisp stanton$ 

I currently load org using straight.el as follows:

(setq package-archives
'(("melpa" . "http://melpa.org/packages/;)
  ("gnu" . "http://elpa.gnu.org/packages/;)
  ("nongnu" . "http://elpa.gnu.org/nongnu/;)))
;;;  ("org" . "http://orgmode.org/elpa/;)))

(use-package org-contrib
  :after org
  :config
  (require 'ox-extra)
  (ox-extras-activate '(ignore-headlines))
)

(use-package org
  :after (jupyter)
  :straight t
  :mode (("\\.org$" . org-mode))
;  :ensure org-plus-contrib
  :config
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((jupyter . t)))
  :bind
  ("C-c l" . org-store-link)
  ("C-c a" . org-agenda)
  :init
  (add-hook 'org-mode-hook (lambda () (setq-local company-minimum-prefix-length 
0)))

Best,

Richard



> From: Tim Cross 
> To: emacs-orgmode@gnu.org
> Subject: Re: [BUG] New error: (void-function org-url-p) when exporting
>   to LaTeX [9.4.6 (9.4.6-gc5573b @
>   /Users/stanton/.emacs.d/straight/build/org/)]
> Message-ID: <87tumomy05@gmail.com>
> Content-Type: text/plain
> 
> 
> OK, think I've worked out what the problem is.
> 
> The function org-url-p is defined in org 9.5, but not org 9.4. Your
> running org 9.4.6, which does not have that function. The fact something
> in your install is trying to call org-url-p would indicate you have a
> mixed or messed up installation of org (i.e. your setup is loading code
> from 2 different versions).
> 
> It is very important when upgrading or installing org that no org
> functionality is yet loaded to avoid this type of issue. Your best bet
> is to remove all org related packages and then try installing org again.
> If your using package.el to install org, make sure the call to install
> it is early in your init file (before any functionality is loaded which
> depends on org). I also find the use-pacakge macro very useful in this
> regard as you can also setup things so that no org functionality is
> loaded until you try to use something which depends on org. This means
> you can typically start Emacs and immediately install/upgrade org
> without any issues. Where people tend to come undone is when they have
> been running Emacs for a while, have been using org and then to a
> package update and the system tries to install a new version of org
> (usually only an issue with new major versions rather than patch fix
> version updates). 
> 
> Richard Stanton  writes:
> 
>> Remember to cover the basics, that is, what you expected to happen and
>> what in fact did happen.  You don't know how to make a good report?  See
>> 
>> https://orgmode.org/manual/Feedback.html#Feedback
>> 
>> Your bug report will be posted to the Org mailing list.
>> 
>> 
>> Everything worked fine until yesterday, but today when I try to export an 
>> org file that contains the line
>> 
>> #+SETUPFILE: 
>> https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup
>> 
>> I get the following error:
>> 
>> Debugger entered--Lisp error: (void-function org-url-p)
>>  org-url-p("https://fniessen.github.io/org-html-themes/org/the...;)
>>  org--collect-keywords-1(("SETUPFILE" "FILETAGS" "TAGS" "ARCHIVE" "CATEGORY" 
>> "COLUMNS" "CONSTANTS" "LINK" "OPTIONS" "PRIORITIES"
>> "PROPERTY" "SEQ_TODO" "STARTUP" "TODO" "TYP_TODO") ("ARCHIVE" "CATEGORY" 
>> "COLUMNS" "PRIORITIES") nil nil nil)
>>  org-collect-keywords(("FILETAGS" "TAGS" "ARCHIVE" "CATEGORY" "COLUMNS" 
>> "CONSTANTS" "LINK" "OPTIONS" "PRIORITIES" "PROPERTY" "SEQ_TODO"
>> "STARTUP" "TODO" "TYP_TODO") ("ARCHIVE" "CATEGORY" "COLUMNS" "PRIORITIES"))
>>  org-set-regexps-and-options()
>> 

[BUG] New error: (void-function org-url-p) when exporting to LaTeX [9.4.6 (9.4.6-gc5573b @ /Users/stanton/.emacs.d/straight/build/org/)]

2021-05-26 Thread Richard Stanton
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Everything worked fine until yesterday, but today when I try to export an org 
file that contains the line

#+SETUPFILE: 
https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup 


I get the following error:

Debugger entered--Lisp error: (void-function org-url-p)
  org-url-p("https://fniessen.github.io/org-html-themes/org/the...;)
  org--collect-keywords-1(("SETUPFILE" "FILETAGS" "TAGS" "ARCHIVE" "CATEGORY" 
"COLUMNS" "CONSTANTS" "LINK" "OPTIONS" "PRIORITIES" "PROPERTY" "SEQ_TODO" 
"STARTUP" "TODO" "TYP_TODO") ("ARCHIVE" "CATEGORY" "COLUMNS" "PRIORITIES") nil 
nil nil)
  org-collect-keywords(("FILETAGS" "TAGS" "ARCHIVE" "CATEGORY" "COLUMNS" 
"CONSTANTS" "LINK" "OPTIONS" "PRIORITIES" "PROPERTY" "SEQ_TODO" "STARTUP" 
"TODO" "TYP_TODO") ("ARCHIVE" "CATEGORY" "COLUMNS" "PRIORITIES"))
  org-set-regexps-and-options()
  org-mode()
  org-export--prepare-file-contents("/Users/stanton/.org/setup" nil 0 1 1 
# 
"/Users/stanton/teaching/MFE230I/mfe230i.org")
  org-export-expand-include-keyword()
  org-export-as(latex nil nil nil (:output-file "mfe230i.tex"))
  org-export-to-file(latex "mfe230i.tex" nil nil nil nil nil 
#f(compiled-function (file) #))
  org-latex-export-to-pdf(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)

Thanks for any suggestions.


Emacs  : GNU Emacs 27.2 (build 1, x86_64-apple-darwin20.3.0, Carbon Version 164 
AppKit 2022.3)
 of 2021-04-06
Package: Org mode version 9.4.6 (9.4.6-gc5573b @ 
/Users/stanton/.emacs.d/straight/build/org/)





Re: How to create a macro that inserts multiline text with :B_ignoreheading: tag?

2021-04-30 Thread Richard Stanton
That works. Thanks Juan Manuel!

> On Apr 30, 2021, at 1:40 PM, Juan Manuel Macías  
> wrote:
> 
> Hi Richard,
> 
> Richard Stanton  writes:
> 
>> I’d like to define a macro called, say, articletext, to insert this
>> header into my document before exporting to LaTeX, so the org file
>> would look something like this:
>> 
>> {{{article text}}}
>> This text appears only in the article version.
> 
> Macro definitions do not allow spaces.
> 
> You can try something like:
> 
> #+MACRO: article_text (eval (concat "*** More explanation coming" "\s" 
> ":B_ignoreheading:\n:PROPERTIES:\n:BEAMER_env: ignoreheading\n:END:"))
> 
> {{{article_text}}}
> 
> Best regards,
> 
> Juan Manuel 




How to create a macro that inserts multiline text with :B_ignoreheading: tag?

2021-04-30 Thread Richard Stanton
I’m using org mode to create Beamer presentations, also using beamerarticle so 
I can create an article version of my slides with extra text. This article by 
James Harkins was very helpful in getting started:

https://orgmode.org/worg/exporters/beamer/beamer-dual-format.html 
<https://orgmode.org/worg/exporters/beamer/beamer-dual-format.html>

One issue, noted in the article, is that text you want to have appear in 
article mode but not in a slide needs to be outside the frame environment, 
which means you need to tell org to end one slide without starting another. 
This can be achieved by inserting a header like this into the org file before 
the article text:

*** More explanation coming :B_ignoreheading:
:PROPERTIES:
:BEAMER_env: ignoreheading
:END:

I’d like to define a macro called, say, articletext, to insert this header into 
my document before exporting to LaTeX, so the org file would look something 
like this:

{{{article text}}}
This text appears only in the article version.

However, I can’t find any way to actually define this macro and get it to work 
as I want. From my experiments so far, it seems that including 
:B_ignoreheading: in the macro definition causes problems, but I’m not 100% 
sure. Anyway, I’d be very grateful if anyone can see an obvious way to get this 
to happen.

Thanks for any suggestions!

Richard Stanton

Re: Parentheses in section titles interfere with on-screen font choice

2020-04-27 Thread Richard Stanton
Much dissection of init.el later, it seems the problem was caused by an 
interaction with (an outdated version of) another package, rainbow-delimiters. 
Updating this seems to solve the problem.

Best,

Richard

> On Apr 27, 2020, at 3:00 AM, Nicolas Goaziou  wrote:
> 
> Hello,
> 
> Richard Stanton mailto:rhstan...@berkeley.edu>> 
> writes:
> 
>> When using org mode (9.3.6), I’ve noticed that putting parentheses
>> into a section title seems to change the font used to display the
>> title on the screen. So, for example, on my machine
>> 
>> * Heading
>> 
>> displays in a red font.
>> 
>> If I add something in parentheses, e.g.,
>> 
>> * Heading (with parentheses)
>> 
>> the title now displays in grey. As I’m typing, the font change occurs the 
>> moment I type the first character after the open parenthesis.
>> 
>> The behavior is similar for lower level headers too. Is this
>> deliberate? And if so, is there a way to put parentheses into section
>> titles without interfering with the display font?
> 
> I cannot reproduce it. Is there something in your config?
> 
> Regards,
> 
> -- 
> Nicolas Goaziou



Re: Parentheses in section titles interfere with on-screen font choice

2020-04-27 Thread Richard Stanton
I’ll investigate further...

> On Apr 27, 2020, at 3:00 AM, Nicolas Goaziou  wrote:
> 
> Hello,
> 
> Richard Stanton mailto:rhstan...@berkeley.edu>> 
> writes:
> 
>> When using org mode (9.3.6), I’ve noticed that putting parentheses
>> into a section title seems to change the font used to display the
>> title on the screen. So, for example, on my machine
>> 
>> * Heading
>> 
>> displays in a red font.
>> 
>> If I add something in parentheses, e.g.,
>> 
>> * Heading (with parentheses)
>> 
>> the title now displays in grey. As I’m typing, the font change occurs the 
>> moment I type the first character after the open parenthesis.
>> 
>> The behavior is similar for lower level headers too. Is this
>> deliberate? And if so, is there a way to put parentheses into section
>> titles without interfering with the display font?
> 
> I cannot reproduce it. Is there something in your config?
> 
> Regards,
> 
> -- 
> Nicolas Goaziou



Parentheses in section titles interfere with on-screen font choice

2020-04-27 Thread Richard Stanton
When using org mode (9.3.6), I’ve noticed that putting parentheses into a 
section title seems to change the font used to display the title on the screen. 
So, for example, on my machine

* Heading

displays in a red font.

If I add something in parentheses, e.g.,

* Heading (with parentheses)

the title now displays in grey. As I’m typing, the font change occurs the 
moment I type the first character after the open parenthesis.

The behavior is similar for lower level headers too. Is this deliberate? And if 
so, is there a way to put parentheses into section titles without interfering 
with the display font? 

Thanks.

Richard Stanton






[O] New bug in org-agenda?

2019-03-01 Thread Richard Stanton
Using Org mode version 9.2.1 (9.2.1-33-g029cf6-elpaplus), I get an error 
message when I run org-agenda:

Debugger entered--Lisp error: (error "Wrong number of arguments")
  propertize("WAITING" nil face org-warning)
  org-agenda-get-restriction-and-command(nil)
  org-agenda(nil)
  funcall-interactively(org-agenda nil)
  call-interactively(org-agenda record nil)
  command-execute(org-agenda record)
  execute-extended-command(nil "org-agenda" #("org-agenda" 0 1 (fontified t) 1 
2 (fontified t) 2 3 (fontified t) 3 4 (fontified t) 4 5 (fontified t) 5 6 
(fontified t) 6 7 (fontified t) 7 8 (fontified t) 8 9 (fontified t) 9 10 
(fontified nil)))
  funcall-interactively(execute-extended-command nil "org-agenda" 
#("org-agenda" 0 1 (fontified t) 1 2 (fontified t) 2 3 (fontified t) 3 4 
(fontified t) 4 5 (fontified t) 5 6 (fontified t) 6 7 (fontified t) 7 8 
(fontified t) 8 9 (fontified t) 9 10 (fontified nil)))
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

This has only started in the last few days and my init.el file has not changed, 
so it seems to be something in the latest update.

Richard Stanton




Re: [O] Bug: Setting org-export-use-babel to nil causes exporting to ignore :exports header

2017-09-14 Thread Richard Stanton
Thanks, Nicolas. It looks like the default behavior changed at some point but 
it could have been some while ago...

Sent from my iPad

> On Sep 14, 2017, at 5:58 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:
> 
> Hello,
> 
> Richard Stanton <stan...@haas.berkeley.edu> writes:
> 
>> Emacs  : GNU Emacs 25.2.1 (x86_64-apple-darwin16.7.0, Carbon Version 157 
>> AppKit 1504.83)
>> of 2017-08-28
>> Package: Org mode version 9.1 (9.1-20-ga4f139-elpa @ 
>> /Users/stanton/.emacs.d/elpa/org-20170911/)
>> 
>> I typically set org-export-use-babel to nil, to prevent all the code
>> cells being executed on export. However, if this variable is set, org
>> export both code and results for each cell, regardless of the setting of
>> the :exports header option. Withoput this variable being set, exporting
>> correctly obeys the :exports directives in the cell headers.
> 
> Here is `org-export-use-babel' docstring:
> 
>  Switch controlling code evaluation and header processing during
>  export. When set to nil no code will be evaluated as part of the
>  export process and no header arguments will be obeyed. Users who wish
>  to avoid evaluating code on export should use the header argument
>  ‘:eval never-export’.
> 
> So you need to use ":eval never-export", not that variable.
> 
> Regards,
> 
> -- 
> Nicolas Goaziou



[O] Bug: Setting org-export-use-babel to nil causes exporting to ignore :exports header

2017-09-13 Thread Richard Stanton

Emacs  : GNU Emacs 25.2.1 (x86_64-apple-darwin16.7.0, Carbon Version 157 AppKit 
1504.83)
 of 2017-08-28
Package: Org mode version 9.1 (9.1-20-ga4f139-elpa @ 
/Users/stanton/.emacs.d/elpa/org-20170911/)

I typically set org-export-use-babel to nil, to prevent all the code
cells being executed on export. However, if this variable is set, org
export both code and results for each cell, regardless of the setting of
the :exports header option. Withoput this variable being set, exporting
correctly obeys the :exports directives in the cell headers.

Richard Stanton




[O] Trouble exporting inline code blocks

2017-04-10 Thread Richard Stanton
Here’s a very simple org file:



Some inline Python code: 2 plus 2 is src_python[:session]{2+2}

-

If I put the cursor on the code block and type C-c C-c, I get  nice results 
block containing the answer, 4. So far so good.

I’d like to export just the results to PDF via LaTeX. However, no matter what 
options I pass, the exported PDF file shows both the source and the output. 
E.g.,

src_python[:session :exports results]{2+2}
src_python[:session :exports none]{2+2}

Am I missing something? Thanks. By the way, I’m using org mode v. 9.0.5. 

Richard Stanton







[O] LaTeX math doesn't always export to HTML as math

2017-02-17 Thread Richard Stanton
I created the following very simple org file:




#+TITLE: *Math example*

\[ w_j = \nu_j \prod_{l

Re: [O] Problems exporting simple LaTeX math to HTML

2017-02-14 Thread Richard Stanton
That works. Thanks.

> On Feb 14, 2017, at 12:24 PM, Charles C. Berry <ccbe...@ucsd.edu> wrote:
> 
> On Tue, 14 Feb 2017, Richard Stanton wrote:
> 
>> [My apologies if this is a repeat. I tried posting this 4 days ago and 
>> didn’t see if appear on the list.]
>> 
>> I created the following very simple org file:
>> 
>> 
>> 
>> 
>> #+TITLE: *Math example*
>> 
>> \[ w_j = \nu_j \prod_{l<j} (1-\nu_l), \]
>> 
>> 
>> 
>> 
>> This exports to LaTeX fine, but when I export to HTML, the equation comes 
>> out as plain text
> 
> Seems like a bug.
> 
> To work around it, put a space between `<' and `j'.
> 
> HTH,
> 
> Chuck




[O] Problems exporting simple LaTeX math to HTML

2017-02-14 Thread Richard Stanton
[My apologies if this is a repeat. I tried posting this 4 days ago and didn’t 
see if appear on the list.]

I created the following very simple org file:




#+TITLE: *Math example*

\[ w_j = \nu_j \prod_{l

[O] Can't save file with latest version of org

2015-04-30 Thread Richard Stanton
I just ran git pull to update to the latest version of org-mode. Now, when I 
try to save an org file, I get the error message:

user-error: Not in a sub-editing buffer





[O] How to get inline python code to work with :session option?

2015-03-30 Thread Richard Stanton
:session doesn't seem to play well with inline code blocks. For example, if I 
press C-c C-c with the cursor in the middle of  the following inline code, 

src_python[]{return 2+3} 

it gets expanded to

src_python[]{return 2+3} {{{results(=5=)}}}   

However, if I do the same with this code block, 

src_python[:session]{return 2+3} 

no results appear in the text buffer, and the mini-buffer displays the message 
Code block produced no output.

How can I get inline code to work with :session? 

Thanks.

Richard Stanton




Re: [O] Emacs-orgmode Digest, Vol 109, Issue 35

2015-03-30 Thread Richard Stanton
 Date: Sun, 29 Mar 2015 23:41:52 -0700
 From: Richard Stanton stan...@haas.berkeley.edu
 To: emacs-orgmode@gnu.org
 Subject: [O] How to get inline python code to work with :session
   option?
 Message-ID: 438abcf3-a5e3-4743-92de-6b85e3e2e...@haas.berkeley.edu
 Content-Type: text/plain; charset=us-ascii
 
 :session doesn't seem to play well with inline code blocks. For example, if I 
 press C-c C-c with the cursor in the middle of  the following inline code, 
 
 src_python[]{return 2+3} 
 
 it gets expanded to
 
 src_python[]{return 2+3} {{{results(=5=)}}}   
 
 However, if I do the same with this code block, 
 
 src_python[:session]{return 2+3} 
 
 no results appear in the text buffer, and the mini-buffer displays the 
 message Code block produced no output.
 
 How can I get inline code to work with :session? 
 
 Thanks.
 
 Richard Stanton

An answer to my own question, in case it’s useful to others: With the :session 
option, you need to drop the “return”.


[O] :ignoreheading: works with LaTeX export, but not HTML

2015-03-26 Thread Richard Stanton
I want to put some headers in my org file that don't get exported. If I put 
:ignoreheading: after the title, it correctly does not get exported to LaTeX, 
but it still appears when I export to HTML (with the text :ignoreheading: on 
the same line). Am I missing something? In my setup I have the lines

(defun sa-ignore-headline (contents backend info)
  Ignore headlines with tag `ignoreheading'
  (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii)
  (string-match \\`.*ignoreheading.*\n
(downcase contents)))
(replace-match  nil nil contents)))

(defun headline-nonumber (contents backend info)
  Make headlines with nonumber.
  (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii)
  (string-match \\`.*nonumber.*\n
(downcase contents)))
(let ((output contents))
  (setq output (replace-regexp-in-string section{ section*{ contents))
  (setq output (replace-regexp-in-string hfill{}textsc{nonumber} 
 output))
  output)))

(add-to-list 'org-export-filter-headline-functions 'sa-ignore-headline)
(add-to-list 'org-export-filter-headline-functions 'headline-nonumber)

Thanks for any suggestions.

By the way, this is with org-mode release_8.3beta-951-g2f58e3

Richard Stanton


Re: [O] Babel language support for Mathematica

2015-03-15 Thread Richard Stanton
Thanks. After a bit of experimentation, I found that you can have a block 
outputting several lines, but you need to manually add commas and carriage 
returns, e.g.,

#+BEGIN_SRC mathematica :results output
f[x_] := 3*x^2+3;
f[8], \n,
D[f[x],x]
#+END_SRC

#+RESULTS:
: 195
: 6*x





 On Mar 13, 2015, at 4:16 PM, Yi Wang tririverwan...@gmail.com wrote:
 
 Dear Richard,
 
 You can do:
 
 #+BEGIN_SRC mathematica
 f[x_] := x+3;
 f[5]
 #+END_SRC
 
 Here are explanations: I actually put everything in the SRC block into a 
 Print[...].
 
 So in the second example, what actually runs is
 
 Print[f[x_] := x+3
 f[5]]
 
 This does not return any value. Because what it really does is print the 
 value of f[x_] := x+3 f[5]
 
 Here is the code:
 
 (concat
  (mapconcat ;; define any variables
   (lambda (pair)
   (format %s=%s;
   (car pair)
   (org-babel-mathematica-var-to-mathematica (cdr pair
   vars \n) \nPrint[\n body \n]\n)
 
 If anybody has idea to improve it, I will be happy to see and work it out!
 
 Best,
 Yi
 
 
 
 
 On Sat, Mar 14, 2015 at 7:09 AM John Kitchin jkitc...@andrew.cmu.edu 
 mailto:jkitc...@andrew.cmu.edu wrote:
 I wonder if this is an output vs value issue on the return of the
 block. If you set :results output does anything change? or, is there a
 way to specify a return value? or specifically print something?
 
 Richard Stanton writes:
 
  I recently saw this posting about org support for Mathematica. Thanks for 
  writing this!
 
  Unfortunately, while I can get it to work for simple things (e.g., 2+3), 
  even slightly more complex things don't seem to work. For example, suppose 
  I'd like to define a function f(x) = x + 3, and then calculate f(5). In a 
  MMA notebook, if I type
 
  f[x_] := x+3
  f[5]
 
  I get the answer 8. If I try the same code in an org-mode code block, 
  here's what happens:
 
  #+BEGIN_SRC mathematica
  f[x_] := x+3
  f[5]
  #+END_SRC
 
  #+RESULTS:
  : Null
 
  Am I missing something obvious here?
 
  Thanks very much.
 
  Richard Stanton
 
 --
 Professor John Kitchin
 Doherty Hall A207F
 Department of Chemical Engineering
 Carnegie Mellon University
 Pittsburgh, PA 15213
 412-268-7803
 @johnkitchin
 http://kitchingroup.cheme.cmu.edu http://kitchingroup.cheme.cmu.edu/



Re: [O] Babel language support for Mathematica

2015-03-13 Thread Richard Stanton
I recently saw this posting about org support for Mathematica. Thanks for 
writing this! 

Unfortunately, while I can get it to work for simple things (e.g., 2+3), even 
slightly more complex things don't seem to work. For example, suppose I'd like 
to define a function f(x) = x + 3, and then calculate f(5). In a MMA notebook, 
if I type

f[x_] := x+3
f[5]

I get the answer 8. If I try the same code in an org-mode code block, here's 
what happens:

#+BEGIN_SRC mathematica 
f[x_] := x+3
f[5]
#+END_SRC

#+RESULTS:
: Null

Am I missing something obvious here?

Thanks very much.

Richard Stanton


Re: [O] Extraneous output from Python code blocks using :session option

2015-03-12 Thread Richard Stanton
This looks great. While we're patching this code, why does having blank lines 
inside function definitions cause such problems in :session mode? It would be 
nice if you could just type any valid Python code and have it execute (like you 
can in an IPython notebook cell)


 On Mar 12, 2015, at 8:17 AM, John Kitchin jkitc...@andrew.cmu.edu wrote:
 
 Nice. I hope this makes it into org-mode one day.
 
 In the mean time, I crafted an approach with another hook function that
 is described here:
 
 http://kitchingroup.cheme.cmu.edu/blog/2015/03/12/Making-org-mode-Python-sessions-look-better/
 
 This can be done in an init file.
 
 Kyle Meyer writes:
 
 Richard Stanton stan...@haas.berkeley.edu wrote:
 I'm trying to use the :session option so I can import modules, etc.,
 just once at the beginning of my document, like with am IPython
 notebook. Unfortunately, the output from these code blocks contains
 some extraneous characters. For example:
 
 #+BEGIN_SRC python :session :results output
 a = 2
 b = 3
 c = 4
 print 'a=  ', a
 print 'b = ', b
 print 'a + b = ', a+b
 #+END_SRC
 
 #+RESULTS:
 :
 :   a=   2
 : b =  3
 : a + b =  5
 
 I also see this behavior.  I asked the list some time ago [1], but I
 didn't follow up beyond the initial email.
 
 How can I stop the production of all those  signs (sometimes
 they're dots), which don't appear if I run the same code block without
 the :session option?
 
 I've attached a patch that seems to fix the example you gave and the
 cases from my earlier email.  I don't know enough about babel's
 internals to know if it is a good way to fix it, but at least it might
 serve as a quick fix for you until there is a better solution.
 
 [1] http://thread.gmane.org/gmane.emacs.orgmode/79014
 
 --
 Professor John Kitchin
 Doherty Hall A207F
 Department of Chemical Engineering
 Carnegie Mellon University
 Pittsburgh, PA 15213
 412-268-7803
 @johnkitchin
 http://kitchingroup.cheme.cmu.edu




[O] Extraneous output from Python code blocks using :session option

2015-03-10 Thread Richard Stanton
I'm trying to use the :session option so I can import modules, etc., just once 
at the beginning of my document, like with am IPython notebook. Unfortunately, 
the output from these code blocks contains some extraneous characters. For 
example:

#+BEGIN_SRC python :session :results output
a = 2
b = 3
c = 4
print 'a=  ', a
print 'b = ', b
print 'a + b = ', a+b
#+END_SRC

#+RESULTS:
: 
:   a=   2
: b =  3
: a + b =  5

How can I stop the production of all those  signs (sometimes they're dots), 
which don't appear if I run the same code block without the :session option?

Thanks.

Richard Stanton


[O] How to get LATEX_HEADER items to appear *after* default packages?

2015-03-10 Thread Richard Stanton
When I export an org file to LaTeX using the class rhs-article, defined as 
follows:

 ‘(rhs-article  
   \\documentclass{article}
\\usepackage[top=1in, bottom=1.in, left=1in, right=1in]{geometry}
 [PACKAGES]
 [EXTRA] ;;header-string
   (\\section{%s} . \\section*{%s})
   (\\subsection{%s} . \\subsection*a{%s})
   (\\subsubsection{%s} . \\subsubsection*{%s})
   (\\paragraph{%s} . \\paragraph*{%s})
   (\\subparagraph{%s} . \\subparagraph*{%s})))

I see that my headers defined using #+LATEX_HEADER appear in the resulting 
LaTeX file before the default packages defined in 
org-latex-default-packages-alist. How can I get the default packages to appear 
BEFORE the LATEX_HEADER items? Or better yet, how can I control things so that 
I can choose whether a LATEX_HEADER item appears before or after the default 
packages in the LaTeX file?

Thanks for any suggestions.

Richard Stanton


Re: [O] Plotting in Python block won't over-write existing file

2015-03-08 Thread Richard Stanton
 Date: Fri, 06 Mar 2015 14:21:54 -0500
 From: Nick Dokos ndo...@gmail.com
 To: emacs-orgmode@gnu.org
 Subject: Re: [O] Plotting in Python block won't over-write existing
   file
 Message-ID: 87sidi9bjh@alphaville.usersys.redhat.com
 Content-Type: text/plain; charset=utf-8
 
 Richard Stanton stan...@haas.berkeley.edu writes:
 
 Here?s a sample Python code block:
 
 #+begin_src python :results file :exports both
 import matplotlib
 matplotlib.use('Agg')
 import matplotlib.pyplot as plt
 import pandas as pd
 
 df = pd.DataFrame({'date': [1900, 1901, 1902], 'x1' : [3, 4, 5], 'x2' : [6, 
 7, 9]})
 df.set_index('date', inplace=True, drop=True)
 df.plot()
 plt.savefig('x4.png')
 return 'x4.png' # return filename to org-mode
 #+End_src
 
 When I run it, the graph appears on the screen and in the named file, as 
 desired.
 
 However, if I go back, change one of the numbers, and rerun the block,
 while it claims to have run OK, the graph is not updated. I only get a
 new plot if I also change the file name (e.g., to x5.png). It looks
 like it?s refusing to over-write an existing file. Is there a reason
 for this, and is there a way to change this behavior?
 
 By the way, this is with org-mode 8.3beta-884-g9ed426
 
 
 IIUC, you eval the code, hit the resulting link (which opens a buffer with the
 graph), change a number and reeval the code - do you hit the link again?
 That should ask you whether you want to read the changed file again and
 show the updated graph.

Thanks, Nick. After MUCH investigation, and a lot of help from John Kitchen, I 
worked out that

a. The file was changing fine on disk, just not redisplaying in Emacs.

b. The problem seems to be related to the version of Emacs I'm using (24.4 for 
OS X), downloaded from http://emacsformacosx.com/builds. After going back there 
and downloading and installing Emacs 24.4.90 pretest, org-mode now updates 
graphs just fine. 

I don't know what the problem was, or why changing the Emacs version solved it 
(with no other changes), but maybe this will be helpful to someone else.

Best,

RIchard Stanton


[O] Plotting in Python block won't over-write existing file

2015-03-06 Thread Richard Stanton
Here’s a sample Python code block:

#+begin_src python :results file :exports both
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd

df = pd.DataFrame({'date': [1900, 1901, 1902], 'x1' : [3, 4, 5], 'x2' : [6, 7, 
9]})
df.set_index('date', inplace=True, drop=True)
df.plot()
plt.savefig('x4.png')
return 'x4.png' # return filename to org-mode
#+End_src

When I run it, the graph appears on the screen and in the named file, as 
desired.

However, if I go back, change one of the numbers, and rerun the block, while it 
claims to have run OK, the graph is not updated. I only get a new plot if I 
also change the file name (e.g., to x5.png). It looks like it’s refusing to 
over-write an existing file. Is there a reason for this, and is there a way to 
change this behavior?

By the way, this is with org-mode 8.3beta-884-g9ed426

Thanks.

Richard Stanton


[O] Error when running org-babel-tangle

2015-03-05 Thread Richard Stanton
I’m experimenting with tangling files in org-mode, and have found that certain 
files cause org-babel-tangle to die with an error (Org-mode version 8.3beta 
(release_8.3beta-884-g9ed426). Here’s a small example:



* Sample code

#+BEGIN_SRC makefile :tangle makefile-main
circle:
@gfortran -c circle.f90

main: circle
@gfortran -c main.f90
@gfortran circle.o main.o -o main

clean:
@rm -f *.o main
#+END_SRC

Run this block to tangle out the new files.

#+BEGIN_SRC emacs-lisp
(org-babel-tangle)
#+END_SRC

#+RESULTS:
| makefile-main |

In this block I use this header:
#+BEGIN_EXAMPLE
#+BEGIN_SRC sh :results raw 
#+END_EXAMPLE

#+BEGIN_SRC sh :results raw replace
make -f makefile-main clean main
./main
#+END_SRC

  

When I run org-babel-tangle on this file (or press C-c C-c in the emacs-lisp 
block), I get the following error:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match(-l \\\(.+\\)\ nil)
  org-babel-tangle-single-block(5)
  org-babel-tangle-collect-blocks(nil nil)
  org-babel-tangle()
  (progn (org-babel-tangle))
  eval((progn (org-babel-tangle)))
  org-babel-execute:emacs-lisp((org-babel-tangle) ((:comments . ) (:shebang 
. ) (:cache . no) (:padline . ) (:noweb . no) (:tangle . no) 
(:exports . code) (:results . replace) (:session . none) (:hlines . no) 
(:result-type . value) (:result-params replace) (:rowname-names) 
(:colname-names)))
  org-babel-execute-src-block(nil)
  org-babel-execute-src-block-maybe()
  org-babel-execute-maybe()
  org-babel-execute-safely-maybe()
  run-hook-with-args-until-success(org-babel-execute-safely-maybe)
  org-ctrl-c-ctrl-c(nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)


Any ideas what’s going on? If I delete either of the two blocks at the bottom 
of the file (the EXAMPLE block or the final SRC block), it works fine.

Thanks.

Richard Stanton





Re: [O] Error when running org-babel-tangle

2015-03-05 Thread Richard Stanton
Aha! Thanks, Chuck.

 On Mar 5, 2015, at 5:08 PM, Charles C. Berry ccbe...@ucsd.edu wrote:
 
 On Thu, 5 Mar 2015, Richard Stanton wrote:
 
 I’m experimenting with tangling files in org-mode, and have found
 that certain files cause org-babel-tangle to ie with an error
 (Org-mode version 8.3beta (release_8.3beta-884-g9ed426). Here’s a
 small example:
 
 
 
 
 * Sample code
 
 #+BEGIN_SRC makefile :tangle makefile-main
 circle:
  @gfortran -c circle.f90
 
 main: circle
  @gfortran -c main.f90
  @gfortran circle.o main.o -o main
 
 clean:
  @rm -f *.o main
 #+END_SRC
 
 Run this block to tangle out the new files.
 
 #+BEGIN_SRC emacs-lisp
 (org-babel-tangle)
 #+END_SRC
 
 #+RESULTS:
 | makefile-main |
 
 In this block I use this header:
 #+BEGIN_EXAMPLE
 #+BEGIN_SRC sh :results raw
 #+END_EXAMPLE
 
 
 [rest deleted]
 
 ===
 
 #+BEGIN_EXAMPLE
  ,#+BEGIN_SRC sh :results raw #+END_EXAMPLE
 
 will work. The comma is stripped on export.
 
 If you use org-edit-src (C-c C-c) on your original example block, it
 will format it in that way automagically.
 
 HTH,
 
 Chuck




[O] ox-bibtex: How to use Bib file in a different directory?

2014-02-17 Thread Richard Stanton
I've just discovered ox-bibtex, which is great for generating
bibliographies in both PDF and HTML documents. I have it working fine when
the Bib file is in the current directory, but how do I get it to use a Bib
file in a different directory (for HTML output - PDF is fine)?

Thanks a lot.

Richard Stanton





[O] Problems exporting LaTeX source code

2013-03-19 Thread Richard Stanton
Using org mode version 8.0-pre (release_8.0-pre-91-g437c62), I'm having
trouble exporting LaTeX lists (itemize, description). Here's a sample file:

#+title: Sample org file
* Section 1
Some LaTeX source:
#+begin_src latex :exports source
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
#+end_src



1) When I export this to HTML, I get a box showing \begin{itemize} but
the rest of the box is blank.

2) When I export to LaTeX/PDF, I get something like (this is cut and
pasted from the PDF file):

Some LATEX source: 
[frame=lines,fontsize=,linenos]latex
€ Item 1 
€ Item 2


In other words, it looks like the LaTeX source is actually being compiled,
and some internal org-mode exporter options look like they're being
exported to the PDF file.

Am I doing something wrong here?

Thanks.

Richard Stanton




Re: [O] Problems exporting LaTeX source code

2013-03-19 Thread Richard Stanton
Thanks for the suggestion, Thomas.

I changed source to code and tried again. The results were exactly the
same as with source.

Best,

Richard Stanton


On 3/19/13 10:04 AM, Thomas S. Dye t...@tsdye.com wrote:

Richard Stanton stan...@haas.berkeley.edu writes:

 Using org mode version 8.0-pre (release_8.0-pre-91-g437c62), I'm having
 trouble exporting LaTeX lists (itemize, description). Here's a sample
file:

 #+title: Sample org file
 * Section 1
 Some LaTeX source:
 #+begin_src latex :exports source
 \begin{itemize}
 \item Item 1
 \item Item 2
 \end{itemize}
 #+end_src



 1) When I export this to HTML, I get a box showing \begin{itemize} but
 the rest of the box is blank.

 2) When I export to LaTeX/PDF, I get something like (this is cut and
 pasted from the PDF file):

 Some LATEX source:
 [frame=lines,fontsize=,linenos]latex
 € Item 1 
 € Item 2


 In other words, it looks like the LaTeX source is actually being
compiled,
 and some internal org-mode exporter options look like they're being
 exported to the PDF file.

 Am I doing something wrong here?

Perhaps.  I don't see =source= on the list of :exports header arguments.
If you change =source= to =code= does it work?

hth,
Tom

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



Re: [O] Extra space after listings in LaTeX export with minted

2013-03-15 Thread Richard Stanton
You'd think so, but it actually doesn't make a difference. It's indented
even when there's no blank line in the LaTeX file. It's a minted
feature, I think. I did email the minted author about it, so maybe one
day it'll be fixed.

On 3/15/13 10:45 AM, Nicolas Goaziou n.goaz...@gmail.com wrote:

Hello,

Aaron Ecay aarone...@gmail.com writes:

 I am not sure there is a way to automate the \noindent: LaTeX indents
 the beginning of paragraphs, and in org there is no way to have a
 paragraph that contains a source listing.  (In latex there is: don¹t
 leave a blank line after the \end{minted}.  But I don¹t think org has a
 way to represent/output such a thing.

Don't leave a blank line after the #+END_SRC.


Regards,

-- 
Nicolas Goaziou




[O] Width always inserted with LaTeX figures

2013-03-14 Thread Richard Stanton
At least with today's version (8.0-pre release_8.0-pre-67-gd3361c), if I 
include a figure and then export to LaTeX, the resulting TeX file insists on 
including its own width specification, even when I tell it the width I want. 
For example, the org text

#+ATTR_LaTeX: :options width=1.7in
[[file:images/RS_head_cropped.png]]

results in the following LaTeX source:

\includegraphics[width=1.7in,width=.9\linewidth]{images/RS_head_cropped.png}

The second width specification (which I didn't ask for) seems to override the 
one I ask for, so the figure ends up a lot bigger than I want.



Re: [O] Width always inserted with LaTeX figures

2013-03-14 Thread Richard Stanton
Thanks, Aaron.

-Original Message-
From: Aaron Ecay [mailto:aarone...@gmail.com] 
Sent: Wednesday, March 13, 2013 11:47 PM
To: Richard Stanton
Cc: emacs-orgmode@gnu.org
Subject: Re: [O] Width always inserted with LaTeX figures

Hi Richard,

You should use
#+ATTR_LATEX: :width 1.7in
instead of the version with :options.

This is a recent change, to make LaTeX image width consistent with LaTeX tables 
and HTML images, both of which use a :width argument.
(It also allows the support of more types of images in LaTeX).

Aaron


[O] Extra space after listings in LaTeX export with minted

2013-03-14 Thread Richard Stanton
Using the minted package, I get very nice colored listings in the PDF
files generated by exporting to LaTeX, but there's always a lot of extra
space after each listing and before any text that immediately follows.
This seems to be an issue with the minted package itself, but I'm
wondering if anyone has come up with a  simple work-around (short of
inserting negative space after each listing).

Thanks.

Richard Stanton




Re: [O] Extra space after listings in LaTeX export with minted

2013-03-14 Thread Richard Stanton
Thanks, Aaron. I ended up adding the line

#+LaTeX_HEADER: \addtolength\partopsep{-0.9cm}

to my org file. Not too complicated...


There's still one more (even more) minor problem, which is that minted
always indents the text immediately after a listing, but this I can
probably live with.

On 3/14/13 11:30 AM, Aaron Ecay aarone...@gmail.com wrote:

Hi Richard,

2013ko martxoak 14an, Richard Stanton-ek idatzi zuen:
 
 Using the minted package, I get very nice colored listings in the PDF
 files generated by exporting to LaTeX, but there's always a lot of extra
 space after each listing and before any text that immediately follows.
 This seems to be an issue with the minted package itself, but I'm
 wondering if anyone has come up with a  simple work-around (short of
 inserting negative space after each listing).

It looks like the answer to your question is ³sort of²: there are
workarounds, though whether they qualify as simple is largely a matter
of taste.  Check out these two StackOverflow discussions on the topic
(including solutions):

http://stackoverflow.com/questions/2318598/how-to-reduce-the-seperation-fr
om-other-text-using-latex-minted
http://tex.stackexchange.com/questions/37117/belowskip-on-minted

In general, the TeX StackExchange site (the second link) is a marvelous
resource for LaTeX-related questions.  Many questions are already
answered there (with a usable search interface), and the community is
very friendly and helpful for new questions/users.

-- 
Aaron Ecay




[O] Word nil appears after figures in HTML export

2013-03-12 Thread Richard Stanton
Starting some time in the last few days, when I export an org file to HTML
I find the word nil appearing right after the figure. Here's an example
of the HTML code generated:

div class=figure
pimg src=images/RS_head_cropped.png
alt=RS_head_cropped.png//pnil
/div

Just to be clear, there's no word nil in my org file...






Re: [O] Code blocks (partially) inherit buffer colors

2013-03-04 Thread Richard Stanton
Hi Bastien:

I just had the same thought, and found that it appears in a package I load
called popup. Uninstalling this package allows
org-html-htmlize-generate-css to run to completion (though this seems a
bit of a heavy-handed way to get it to run!)

Best,

Richard

On 3/4/13 9:48 AM, Bastien b...@altern.org wrote:

Hi Richard,

Richard Stanton stan...@haas.berkeley.edu writes:

 Thanks for the suggestion, Eric. Following the instructions, I fired
 up Emacs, loaded files of various types, then ran the command

 org-html-htmlize-generate-css

 Unfortunately, this resulted in an error dump:

 Debugger entered--Lisp error: (error Invalid face
 popup-mouse-face)

I don't see any trace of popup-mouse-face in Emacs or in Org,
so my guess is that it must come from a downloaded package?

Just a shot in the dark, of course.

HTH,

-- 
 Bastien




Re: [O] Code blocks (partially) inherit buffer colors

2013-03-02 Thread Richard Stanton
-variables) (goto-char (point-min)) (when 
htmlize-html-major-mode (funcall htmlize-html-major-mode)) (set 
(make-local-variable (quote htmlize-buffer-places)) (symbol-plist places)) 
(run-hooks (quote htmlize-after-hook)) (buffer-enable-undo)) (setq completed t) 
htmlbuf) (when (not completed) (kill-buffer htmlbuf)) 
(htmlize-delete-tmp-overlays
  htmlize-buffer-1()
  (save-restriction (narrow-to-region beg end) (htmlize-buffer-1))
  (let ((htmlbuf (save-restriction (narrow-to-region beg end) 
(htmlize-buffer-1 (when (interactive-p) (switch-to-buffer htmlbuf)) htmlbuf)
  htmlize-region(1 209)
  org-html-htmlize-generate-css()
  call-interactively(org-html-htmlize-generate-css t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

-Original Message-
From: Eric Schulte [mailto:schulte.e...@gmail.com] 
Sent: Thursday, February 28, 2013 9:29 PM
To: Richard Stanton
Cc: emacs-orgmode@gnu.org
Subject: Re: [O] Code blocks (partially) inherit buffer colors

Richard Stanton stan...@haas.berkeley.edu writes:

 When I export a code block to HTML, I've noticed that some (but not
 all) of the characters in the resulting HTML file have the same 
 background color as my Emacs buffer at the time I exported. For 
 example, if I export

 ---

 #+begin_src python
 a = 5
 #+end_src

 

 the code block in the resulting HTML file has a very pale background, 
 except for the characters a and 5, both of which are displayed 
 with a dark blue background that looks like it's the same as the 
 background color in my Emacs buffer. This looks rather odd...

 I can work around this problem by changing the color-theme in my Emacs 
 buffer before exporting, but is there a better solution?

 Thanks.

 Richard Stanton

See the documentation of the `org-export-htmlize-output-type' variable.

--
Eric Schulte
http://cs.unm.edu/~eschulte



[O] Code blocks (partially) inherit buffer colors

2013-02-28 Thread Richard Stanton
When I export a code block to HTML, I've noticed that some (but not all) of the 
characters in the resulting HTML file have the same background color as my 
Emacs buffer at the time I exported. For example, if I export

---

#+begin_src python
a = 5
#+end_src



the code block in the resulting HTML file has a very pale background, except 
for the characters a and 5, both of which are displayed with a  dark blue 
background that looks like it's the same as the background color in my Emacs 
buffer. This looks rather odd...

I can work around this problem by changing the color-theme in my Emacs buffer 
before exporting, but is there a better solution?

Thanks.

Richard Stanton


Re: [O] Code blocks (partially) inherit buffer colors

2013-02-28 Thread Richard Stanton
Thanks, Eric.

-Original Message-
From: Eric Schulte [mailto:schulte.e...@gmail.com] 
Sent: Thursday, February 28, 2013 9:29 PM
To: Richard Stanton
Cc: emacs-orgmode@gnu.org
Subject: Re: [O] Code blocks (partially) inherit buffer colors

Richard Stanton stan...@haas.berkeley.edu writes:

 When I export a code block to HTML, I've noticed that some (but not
 all) of the characters in the resulting HTML file have the same 
 background color as my Emacs buffer at the time I exported. For 
 example, if I export

 ---

 #+begin_src python
 a = 5
 #+end_src

 

 the code block in the resulting HTML file has a very pale background, 
 except for the characters a and 5, both of which are displayed 
 with a dark blue background that looks like it's the same as the 
 background color in my Emacs buffer. This looks rather odd...

 I can work around this problem by changing the color-theme in my Emacs 
 buffer before exporting, but is there a better solution?

 Thanks.

 Richard Stanton

See the documentation of the `org-export-htmlize-output-type' variable.

--
Eric Schulte
http://cs.unm.edu/~eschulte



[O] Problem with code blocks and new exporter

2013-02-27 Thread Richard Stanton
I'm having trouble exporting code blocks with the new exporter. I'm sure
I've missed something obvious, but can anyone tell me why the following
file doesn't work exporting to LaTeX or HTML?

---

Code snippet:

#+begin_src python
a = 5
#+end_src python



When I export this, I don't get a code block displayed. Instead, I get a
single line that includes the text #+begin_src, which is not what I
wanted (or what I was expecting). What am I doing wrong...?

Thanks very much.

Richard Stanton





Re: [O] Problem with code blocks and new exporter

2013-02-27 Thread Richard Stanton
I thought I was probably being stupid. Thanks!

-Original Message-
From: Bastien Guerry [mailto:bastiengue...@gmail.com] On Behalf Of Bastien
Sent: Wednesday, February 27, 2013 3:32 PM
To: Richard Stanton
Cc: emacs-orgmode@gnu.org
Subject: Re: Problem with code blocks and new exporter

Hi Richard,

Richard Stanton stan...@haas.berkeley.edu writes:

 Code snippet:

 #+begin_src python
 a = 5
 #+end_src python
^^

You don't need this.  Use this:

#+begin_src python
a = 5
#+end_src

-- 
 Bastien



[O] New HTML exporter: Oddities with figure placement

2013-02-25 Thread Richard Stanton
It seems that figure placement has changed in HTML files generated by the
new (compared with the old) exporter.

For example, here's a simple org file:

-

This is an org file

[[file:figure.png]]

* Abstract
This is an abstract

-

When I export, all looks fine, except that the figure is centered (left to
right) rather than being left-justified, which I could have sworn it used
to be. Since I prefer left justification by default, I tried adding the
line

#+ATTR_HTML: align=left

immediately before the figure link. Now when I export to HTML, the figure
is left justified as I want, but the following text appears to the right
of the figure, not below it, which isn't what I want. It seems odd that
this would happen even when I have a blank line separating the figure link
from the following text. Am I missing something?

Thanks.

Richard Stanton




[O] HTML export: no date in postamble unless set manually

2013-02-25 Thread Richard Stanton
I have  org-export-html-postamble set to t. When I export a simple org
file that has no explicit #+date line (using the new exporter), I get a
line that says Date: at the bottom of the resulting HTML file, but
there's no date listed next to it. If I add an explicit #+date line, it is
correctly transferred to the bottom of the HTML file, but wouldn't it make
sense to have today's date listed if no explicit alternative is provided?
At any rate, adding a line that says Date: with nothing after the colon
doesn't seem like the optimal default setting.

Thanks.

Richard Stanton





[O] New exporter doesn't like #+LaTeX_CLASS

2012-09-24 Thread Richard Stanton
To get my favorite default sty files loaded with org mode, I have a set of 
LaTeX commands defined  as rhs in org-export-latex-classes. This has always 
worked fine in the past, and continues to work fine with the old exporter, but 
when I include the line

#+LaTeX_CLASS: rhs

And process using org-export-dispatch, not only does it not load in the 
preamble I want, but it doesn't seem even to load most of the default packages, 
resulting in error messages like

 ! Undefined control sequence.
l.6 \hypersetup
   {

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H return  for immediate help.
 ...  

By the way, this is with Org-mode version 7.9.1 (release_7.9.1-325-g2150a9 @ 
/Applications/Emacs.app/Contents/Resources/site-lisp/org-mode/lisp/)

Thanks. 

Richard Stanton



Re: [O] Extra space between list items in HTML export

2012-09-19 Thread Richard Stanton
 From: Bastien Guerry [mailto:bastiengue...@gmail.com] On Behalf Of
 Bastien
 Sent: Tuesday, September 18, 2012 11:53 PM
 To: Richard Stanton
 Cc: nicholas.do...@hp.com; emacs-orgmode@gnu.org
 Subject: Re: Extra space between list items in HTML export
 
 Hi Richard,
 
 Richard Stanton stan...@haas.berkeley.edu writes:
 
  To work around this, I use h:2 (say) so that I can make my TODO items
  third-level headers and have them printed as an itemized list, as
  desired. With the new behavior, this seems impossible, but I can't
  believe I'm the only person for whom this is a useful capability.
 
 Using the new HTML exporter with this file:
 
 #+OPTIONS: H:2 num:t toc:nil
 
 * one
 ** two
 *** three
 *** three (bis)
 
 
 I get an enumerated list for three and three (bis) -- maybe I lost track 
 of
 what the problem was, but this looks like what you are looking for, doesn't
 it?

Yes - I thought you were advocating changing this behavior, but rereading your 
message, I now don't think you were...



Re: [O] Extra space between list items in HTML export

2012-09-19 Thread Richard Stanton
 From: Bastien Guerry [mailto:bastiengue...@gmail.com] On Behalf Of
 Bastien
 Sent: Wednesday, September 19, 2012 9:45 AM
 To: Richard Stanton
 Cc: nicholas.do...@hp.com; emacs-orgmode@gnu.org
 Subject: Re: Extra space between list items in HTML export
 
 Richard Stanton stan...@haas.berkeley.edu writes:
 
  Yes - I thought you were advocating changing this behavior, but
  rereading your message, I now don't think you were...
 
 Okay, looks good, sorry if I was unclear!

What you wrote was perfectly clear. It was my reading that had problems...



Re: [O] Extra space between list items in HTML export

2012-09-18 Thread Richard Stanton

Hi Nick,

Nick Dokos nicholas.do...@hp.com writes:

 The old exporter does that: it breaks the second up into three lists,
each with a single
 element. The first is a single list with three elements.

Which is wrong IMO.

 The new exporter produces a single list with three elements, although
it includes
 the section number for each entry - this might be a bug.

Which is right.

1 to 0 for the new exporter!

-- 
 Bastien

I prefer the old behavior. Let me explain why, in case there's another way
to achieve what I want.

Often I want to create a simple list of TODO items, where I don't want
each item to start a new section, with all the extra space, bold fonts,
etc., that entails. I'd do this using a standard itemized list, except
that (at least last time I checked) org mode insists on TODO items being
headers. To work around this, I use h:2 (say) so that I can make my TODO
items third-level headers and have them printed as an itemized list, as
desired. With the new behavior, this seems impossible, but I can't believe
I'm the only person for whom this is a useful capability.

Richard




Re: [O] Question on latex source block

2012-09-10 Thread Richard Stanton
Date: Sun, 09 Sep 2012 13:39:32 -0600
From: Eric Schulte eric.schu...@gmx.com
To: nicholas.do...@hp.com
Cc: Richard Stanton stan...@haas.berkeley.edu,
   emacs-orgmode@gnu.org emacs-orgmode@gnu.org
Subject: Re: [O] Question on latex source block
Message-ID: 87ligj6l57@gmx.com
Content-Type: text/plain

Nick Dokos nicholas.do...@hp.com writes:

 Eric Schulte eric.schu...@gmx.com wrote:

 
  Nothing - it's a bug introduced by commit
a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b:
 
  ,
  | commit a9d3ce0bcd3492eb0cd2aa7b0d1f6ee93276114b
  | Author: Feng Shu tuma...@gmail.com
  | Date:   Fri Apr 20 19:21:43 2012 +0200
  | 
  | Allow to use imagemagick for previewing LaTeX fragements.
  | 
  | * org.el (org-latex-create-formula-image-program): New option
  | to use either dvipng or imagemagick to convert and preview
  | LaTeX fragments.
  | (org-preview-latex-fragment, org-format-latex): Handle the new
  | option.
  | (org-create-formula-image-with-dvipng): Rename from
  | `org-create-formula-image'.
  | (org-create-formula-image-with-imagemagick): New defun to
  | handle LaTeX preview with imagemagick.
  | (org-latex-color, org-latex-color-format): New defuns to
  | handle color conversions.
  | 
  | * org-latex.el (org-latex-to-pdf-process, org-export-as-pdf):
  | Allow to use imagemagick to convert LaTeX fragments.
  | 
  | * org-html.el (org-export-html-preprocess): Ditto.
  | 
  | * org-exp.el (org-export-with-LaTeX-fragments): Ditto.
  | 
  | * org.texi (@LaTeX{} fragments): Document imagemagick as an
  | alternative to dvipng.
  | 
  `
 
  org-create-formula-image got renamed, but the reference in
ob-latex.el
  to the original name was not changed.
 
  The quick-and-dirty fix is to change the reference in ob-latex.el
to
  org-create-formula-image-dvipng or
org-create-formula-image-imagemagick,
  depending on which method you happen to be using. But one would
resort
  to that only in the direst emergency in order to get something
working
  as quickly as possible.
 
  IMO, it would be better to have split the dvipng/imagemagick
decision at
  a lower level in the code. That way, both org-format-latex and
  org-babel-execute:latex would use the common function. As it is,
  org-format-latex is a fairly dirty function and with the split, it
got
  even dirtier.
 
  But there may be difficulties that my quick glance through the code
has
  not uncovered: it needs a deeper look.
 
 
 So, what would you recommend as a full fix in ob-latex.el?  The
attached
 commit selects an alternate function based on the value of the
 `org-latex-create-formula-image-program' variable.  Does this seem like
 an appropriate fix to the problem?
 

 For the time being, yes: I think this fix is entirely appropriate (nb:
 haven't tested it yet though).

 In the longer run, I would like to see a single function
 (org-create-formula-image redux) be called from the two call sites
 (org-format-latex and org-babel-execute:latex) and have the
 dvipng/imagemagick/etc split be entirely within that function. It's
 bound to happen that more methods of creating images (the etc part
 above) will need to be added in the future and it behooves one to
 arrange it so that only one place in the code is affected.

 Thanks,
 Nick


Alright,

I've just committed a patch which gets part-way to your suggest
solution.  While the two backend-specific functions are still separate
(I agree they should be combined), I have brought back the
`org-create-formula-image' function, which now dispatches to the backend
specific functions.

Additionally there are some problems in the `org-format-latex' function.
It lists mandatory arguments as optional, and appears to create
variables which are not required or properly set.

These function should probably be cleaned at some point up by whoever is
maintaining Org-mode's LaTeX interfaces.

Cheers,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte


Thanks. Things now get a lot further, but I'm still not quite getting what
I was hoping for. In particular, this source:

#+begin_src latex :file test.png
\frac{1}{2}
#+end_src

results in this output:

#+Results:
#+BEGIN_LaTeX
[[file:test.png]]
#+END_LaTeX

There are two problems here.


1) I'd like the graphic file to be displayed inline in the org file
buffer, so I don't think I want those #+BEGIN_LaTeX ... #+END_LaTeX lines

2) There is no file test.png in the current working directory.

It may well be that I'm missing something, but I can't quite see what...

Thanks.

Richard Stanton






Re: [O] Question on latex source block

2012-09-10 Thread Richard Stanton


On 9/10/12 12:07 PM, Nick Dokos nicholas.do...@hp.com wrote:

Richard Stanton stan...@haas.berkeley.edu wrote:


 Thanks. Things now get a lot further, but I'm still not quite getting
what
 I was hoping for. In particular, this source:
 
 #+begin_src latex :file test.png
 \frac{1}{2}
 #+end_src
 
 results in this output:
 
 #+Results:
 #+BEGIN_LaTeX
 [[file:test.png]]
 #+END_LaTeX
 
 There are two problems here.
 
 
 1) I'd like the graphic file to be displayed inline in the org file
 buffer, so I don't think I want those #+BEGIN_LaTeX ... #+END_LaTeX
lines
 

If you add org-redisplay-inline-images to org-babel-after-execute-hook,
that should happen whether or not the #+{BEGIN,END}_LaTeX lines are
there (you can get rid of them by using :results raw).

This works for me (after I C-c C-c on the second source block):

--8---cut here---start-8---

* foo

#+begin_src latex :file frac.png :results raw
\(
\frac{1}{2}
\)
#+end_src


* bar

#+BEGIN_SRC elisp
(add-hook 'org-babel-after-execute-hook (function
org-redisplay-inline-images))
#+END_SRC
--8---cut here---end---8---

 2) There is no file test.png in the current working directory.
 

That however may be saying that there is a problem with your setup. Is
there anything in *Messages* that indicates a problem? Assuming that
debug-on-error is not set currently, you might also want to

M-x toggle-debug-on-error RET

and rerun the code block to see if there is some error that is triggered
(sometimes errors are caught using condition-case and are hard to see).

Just to be clear, the frac.png (I renamed it to avoid clobbering an
unrelated
test.png file in my setup) *is* produced in my case.

Nick


The *Messages* buffer did indeed show something:

Failed to create dvi file from
/var/folders/zf/bgjm4tvs3wv_6q7_6z3b2nx0gn/T/orgtex64181Q3t.tex


Checking the log file in that directory, I saw squawking about missing $
signs around the mathematical expression. Adding these, so the block now
reads

#+begin_src latex :file test.png :results raw
$\frac{1}{2}$
#+end_src

it now compiles and displays perfectly.


Thanks!




[O] Strange python output using session

2012-09-10 Thread Richard Stanton
I get an extra blank item plus some strange formatting on my output when I use 
the :session key in a python source block. Here's a simple example showing the 
problem:

---

* Examples

#+BEGIN_SRC python :results output
print hello
print bye
print 2
#+END_SRC

#+RESULTS:
: hello
: bye
: 2

#+BEGIN_SRC python :results output :session
print hello
print bye
print 2
#+END_SRC

#+RESULTS:
: 
: hello
:  bye
:  2




[O] Extra space between list items in HTML export

2012-09-10 Thread Richard Stanton
I often use the h:2 option to turn level 3 headers into itemized list entries. 
When exporting to LaTeX/PDF, the spacing between items is the same this way as 
it is when I use an explicit itemized list. When exporting to HTML, however, 
there's some extra space inserted between items when they were originally 
headers. Here's an example. Export to HTML and you'll see the different spacing:

-

#+OPTIONS: h:2, toc:nil

* Example of itemized list
** Blank level 2 header
- List 1
- List 2
- List 3

* Level 3 headings as itemized list, with extra space
** Blank level 2 header
*** List 1
*** List 2
*** List 3



Re: [O] Extra space between list items in HTML export

2012-09-10 Thread Richard Stanton
 From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com]
 Sent: Monday, September 10, 2012 2:37 PM

  #+OPTIONS: h:2, toc:nil
 
  * Example of itemized list
  ** Blank level 2 header
  - List 1
  - List 2
  - List 3
 
  * Level 3 headings as itemized list, with extra space
  ** Blank level 2 header
  *** List 1
  *** List 2
  *** List 3
 
 
 The old exporter does that: it breaks the second up into three lists, each 
 with
 a single element. The first is a single list with three elements.
 
 The new exporter produces a single list with three elements, although it
 includes the section number for each entry - this might be a bug.
 
 Nick

I also get the section number included as part of the list item text. This does 
look like a bug.

When I use the new exporter to export to LaTeX/PDF, I get no section numbers, 
but I get a numbered, rather than itemized, list. This also seems like a 
(different) bug.

Richard



Re: [O] Extra space between list items in HTML export

2012-09-10 Thread Richard Stanton


On 9/10/12 4:31 PM, Jambunathan K kjambunat...@gmail.com wrote:


 From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com]
 Sent: Monday, September 10, 2012 2:37 PM

  #+OPTIONS: h:2, toc:nil
 
  * Example of itemized list
  ** Blank level 2 header
  - List 1
  - List 2
  - List 3
 
  * Level 3 headings as itemized list, with extra space
  ** Blank level 2 header
  *** List 1
  *** List 2
  *** List 3
 

 The old exporter does that: it breaks the second up into three lists,
each with
 a single element. The first is a single list with three elements.

 The new exporter produces a single list with three elements, although
it
 includes the section number for each entry - this might be a bug.

 Nick

 I also get the section number included as part of the list item
 text. This does look like a bug.

 When I use the new exporter to export to LaTeX/PDF, I get no section
 numbers, but I get a numbered, rather than itemized, list. This also
 seems like a (different) bug.

I have pushed a fix to org-e-html.el.

The depth of numbering is according to the value of num:N spec. Use
num:2 instead of num:t

to get the numbering behaviour you desire.

If something is not according to taste, point me to the markup that is
missing or which needs to be removed (instead of describing it in
English)

 Richard



--

Thanks. I'll try the new version.

Meanwhile, as I understand it (and as implemented in the old exporter),
h:2 should mean that only two levels of section headings should be created
at all. Level 3 should be an itemized list (and therefore, implicitly,
should not have a number). Thus, h:2 should imply n:2, I believe.




Re: [O] Extra space between list items in HTML export

2012-09-10 Thread Richard Stanton
On 9/10/12 4:45 PM, Jambunathan K kjambunat...@gmail.com wrote:

Richard Stanton stan...@haas.berkeley.edu writes:

 On 9/10/12 4:31 PM, Jambunathan K kjambunat...@gmail.com wrote:


 From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com]
 Sent: Monday, September 10, 2012 2:37 PM

  #+OPTIONS: h:2, toc:nil
 
  * Example of itemized list
  ** Blank level 2 header
  - List 1
  - List 2
  - List 3
 
  * Level 3 headings as itemized list, with extra space
  ** Blank level 2 header
  *** List 1
  *** List 2
  *** List 3
 

 The old exporter does that: it breaks the second up into three lists,
each with
 a single element. The first is a single list with three elements.

 The new exporter produces a single list with three elements, although
it
 includes the section number for each entry - this might be a bug.

 Nick

 I also get the section number included as part of the list item
 text. This does look like a bug.

 When I use the new exporter to export to LaTeX/PDF, I get no section
 numbers, but I get a numbered, rather than itemized, list. This also
 seems like a (different) bug.

I have pushed a fix to org-e-html.el.

The depth of numbering is according to the value of num:N spec. Use
num:2 instead of num:t

to get the numbering behaviour you desire.

If something is not according to taste, point me to the markup that is
missing or which needs to be removed (instead of describing it in
English)

 Richard



--

 Thanks. I'll try the new version.

 Meanwhile, as I understand it (and as implemented in the old exporter),
 h:2 should mean that only two levels of section headings should be
created
 at all. Level 3 should be an itemized list (and therefore, implicitly,
 should not have a number). Thus, h:2 should imply n:2, I believe.

New exporter is, hmmm, new.

You can still get the old behaviour.  So, that leaves us with no scope
for complaining.  

I am merely following what Ngz has advised us.


The HTML and LaTeX/PDF behavior are now the same, and I can see why the
new behavior is better than the old, since it allows more options, so I'll
stop complaining. For a while, anyway...

Thanks.





[O] Question on formatting result blocks in LaTeX

2012-09-09 Thread Richard Stanton
Using Org-mode version 7.9.1 (release_7.9.1-163-g27101a @ 
c:/emacs/site-lisp/org-mode/lisp/), here's an example of some Python code with 
an output block:

#+name: read_excel
#+begin_src python :results output :exports both
from pandas import *
import requests, StringIO
xls = requests.get('http://www.econ.yale.edu/~shiller/data/chapt26.xls')
f = io.parsers.ExcelFile(StringIO.StringIO(xls.content))
dat=f.parse('Data',skiprows=[0,1,3,4,5,6,7],index_col=0).dropna(thresh=3).ix[:,'P':'CPI'].convert_objects()
print dat.head(5)
#+end_src

#+RESULTS: read_excel
: NOTE *** Ignoring non-worksheet data named u'PDVPlot' (type 0x02 = Chart)
: NOTE *** Ignoring non-worksheet data named u'ConsumptionPlot' (type 0x02 = 
Chart)
:  P D E R  RLONGCPI
: 1871  4.44  0.26  0.40  6.35   5.32  12.464061
: 1872  4.86  0.30  0.43  7.81   5.36  12.654392
: 1873  5.11  0.33  0.46  8.35   5.58  12.939807
: 1874  4.66  0.33  0.46  6.86   5.47  12.368896
: 1875  4.54  0.30  0.36  4.96   5.07  11.512651

When I export this org file to HTML, the output block has the same format 
(colors, etc.) as the source block. When I export to PDF via LaTeX,  however, 
the result block seems to get formatted as regular text, and looks nothing like 
the source block. Is there any way to get the same formatting for the result 
block as for the source block when exporting to LaTeX/PDF?

Thanks.

Richard Stanton





[O] How to get graphs to display inline (immediately upon creation)?

2012-09-09 Thread Richard Stanton
I'm using Org-mode version 7.9.1 (release_7.9.1-154-g659be3 @ 
c:/emacs/site-lisp/org-mode/lisp/)

I'd like to use org mode to display inline graphs, but am having some trouble. 
Here's a sample org file (with results block), which creates a single plot 
using R:

-

#+TITLE:   Test plot
#+PROPERTY: session *R*

* Sample plot in R

#+begin_src R :exports both :results graphics :file img.png
hist(rnorm(40))
#+end_src

#+RESULTS:
[[file:img.png]]

---

I'd like the graph to appear inline immediately when I press C-c C-c to execute 
the code block. However, all I get is the result block shown. I can use 

#+STARTUP: inlineimages

to show the graph when I first load the org file, and I can press C-c C-x C-v 
to turn on inline displaying if it's off, but even when it's turned on, the 
graph doesn't display inline if I press C-c C-c again. In fact, I then have to 
press C-c C-x C-v *twice* (once to turn inline display off, and once to turn it 
back on again) to get the graph to display.

How can I get inline graphs to display inline the moment they've been created?

Thanks.

Richard Stanton



Re: [O] How to get graphs to display inline (immediately upon creation)?

2012-09-09 Thread Richard Stanton
Yes!

Thanks very much. That seems to work fine.

 -Original Message-
 From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com]
 Sent: Sunday, September 09, 2012 10:13 PM
 To: Richard Stanton
 Cc: emacs-orgmode@gnu.org
 Subject: Re: [O] How to get graphs to display inline (immediately upon
 creation)?
 
 Richard Stanton stan...@haas.berkeley.edu wrote:
 
  I'm using Org-mode version 7.9.1 (release_7.9.1-154-g659be3 @
  c:/emacs/site=
  -lisp/org-mode/lisp/)
 
  I'd like to use org mode to display inline graphs, but am having some
  troub= le. Here's a sample org file (with results block), which
  creates a single p= lot using R:
 
  -
 
  #+TITLE:   Test plot
  #+PROPERTY: session *R*
 
  * Sample plot in R
 
  #+begin_src R :exports both :results graphics :file img.png
  hist(rnorm(40))
  #+end_src
 
  #+RESULTS:
  [[file:img.png]]
 
  ---
 
  I'd like the graph to appear inline immediately when I press C-c C-c
  to exe= cute the code block. However, all I get is the result block
  shown. I can us=
  e=20
 
  #+STARTUP: inlineimages
 
  to show the graph when I first load the org file, and I can press C-c
  C-x C= -v to turn on inline displaying if it's off, but even when it's
  turned on, = the graph doesn't display inline if I press C-c C-c
  again. In fact, I then = have to press C-c C-x C-v *twice* (once to
  turn inline display off, and onc= e to turn it back on again) to get the 
  graph
 to display.
 
  How can I get inline graphs to display inline the moment they've been
  creat= ed?
 
 
 Untested.
 Maybe add org-redisplay-inline-images to org-babel-after-execute-hook?
 
 Nick



Re: [O] How to get graphs to display inline (immediately upon creation)?

2012-09-09 Thread Richard Stanton
One minor issue: if there are no images in the org file, I now get the message

No images to display inline

When executing a code block.

 -Original Message-
 From: Richard Stanton
 Sent: Sunday, September 09, 2012 10:46 PM
 To: 'nicholas.do...@hp.com'
 Cc: emacs-orgmode@gnu.org
 Subject: RE: [O] How to get graphs to display inline (immediately upon
 creation)?
 
 Yes!
 
 Thanks very much. That seems to work fine.
 
  -Original Message-
  From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com]
  Sent: Sunday, September 09, 2012 10:13 PM
  To: Richard Stanton
  Cc: emacs-orgmode@gnu.org
  Subject: Re: [O] How to get graphs to display inline (immediately upon
  creation)?
 
  Richard Stanton stan...@haas.berkeley.edu wrote:
 
   I'm using Org-mode version 7.9.1 (release_7.9.1-154-g659be3 @
   c:/emacs/site=
   -lisp/org-mode/lisp/)
  
   I'd like to use org mode to display inline graphs, but am having
   some troub= le. Here's a sample org file (with results block), which
   creates a single p= lot using R:
  
   -
  
   #+TITLE:   Test plot
   #+PROPERTY: session *R*
  
   * Sample plot in R
  
   #+begin_src R :exports both :results graphics :file img.png
   hist(rnorm(40))
   #+end_src
  
   #+RESULTS:
   [[file:img.png]]
  
   ---
  
   I'd like the graph to appear inline immediately when I press C-c C-c
   to exe= cute the code block. However, all I get is the result block
   shown. I can us=
   e=20
  
   #+STARTUP: inlineimages
  
   to show the graph when I first load the org file, and I can press
   C-c C-x C= -v to turn on inline displaying if it's off, but even
   when it's turned on, = the graph doesn't display inline if I press
   C-c C-c again. In fact, I then = have to press C-c C-x C-v *twice*
   (once to turn inline display off, and onc= e to turn it back on
   again) to get the graph
  to display.
  
   How can I get inline graphs to display inline the moment they've
   been creat= ed?
  
 
  Untested.
  Maybe add org-redisplay-inline-images to org-babel-after-execute-hook?
 
  Nick



[O] Question on latex source block

2012-09-08 Thread Richard Stanton
Using Org-mode version 7.9.1 (release_7.9.1-154-g659be3 @ 
c:/emacs/site-lisp/org-mode/lisp/), I created the following LaTeX code block:

#+begin_src latex :file test.png
\frac{1}{2}
#+end_src

When I press C-c C-c to compile the code block, I get the following error dump:

Debugger entered--Lisp error: (void-function org-create-formula-image)
  org-create-formula-image(\\frac{1}{2} test.png (:foreground default 
:background default :scale 1.0 :html-foreground Black :html-background 
Transparent :html-scale 1.0 :matchers (begin $1 $ $$ \\( \\[)) t)
  org-babel-execute:latex(\\frac{1}{2} ((:comments . ) (:shebang . ) 
(:cache . no) (:padline . ) (:noweb . no) (:tangle . no) (:exports . 
results) (:results . file replace latex) (:session . none) (:hlines . 
no) (:padnewline . yes) (:file . test.png) (:result-type . value) 
(:result-params file replace latex) (:rowname-names) (:colname-names)))
  org-babel-execute-src-block(nil (latex \\frac{1}{2} ((:comments . ) 
(:shebang . ) (:cache . no) (:padline . ) (:noweb . no) (:tangle . 
no) (:exports . results) (:results . file replace latex) (:session . 
none) (:hlines . no) (:padnewline . yes) (:file . test.png) 
(:result-type . value) (:result-params file replace latex) 
(:rowname-names) (:colname-names))  nil 0))
  org-babel-execute-src-block-maybe()
  org-babel-execute-maybe()
  org-babel-execute-safely-maybe()
  run-hook-with-args-until-success(org-babel-execute-safely-maybe)
  org-ctrl-c-ctrl-c(nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)

What am I missing here?

Thanks.

Richard Stanton



Re: [O] Blank equation when exported to HTML using dvipng

2012-05-28 Thread Richard Stanton
 From: Puneeth Chaganti [mailto:puncha...@gmail.com]
 Sent: Sunday, May 27, 2012 10:48 PM
 To: Richard Stanton
 Subject: Re: [O] Blank equation when exported to HTML using dvipng
 
 On Mon, May 28, 2012 at 11:13 AM, Richard Stanton
 stan...@haas.berkeley.edu wrote:
  Here's a very simple ORG file:
 
  
 
  #+OPTIONS: LaTeX:dvipng
 
  * Test file
  \begin{equation}
  x=\sqrt{b}
  \end{equation}
 
  --
 
  When I export this to HTML (Org-mode version 7.8.11 (release_7.8.11-12-
 gc55405 @ c:/emacs/site-lisp/org-mode/lisp/)), the equation comes out
 blank.
 
  The HTML file contains the following code:
 
  img src=ltxpng/test_660c6efb146974e9d77e2de45f258385867ef389.png
  alt=\begin{equation} x=\sqrt{b} \end{equation}/
 
  However, directory ltxpng is empty.
 
  I'm running Emacs 24.0.97 under Windows Vista with MikTeX 2.09 installed
 and PATH set so that I can call pdflatex, dvipng, etc. from the command line
 just fine.
 
  Any thoughts about what might be going wrong?
 
 Do you get any error messages?  Do you have dvipng installed?
 
 --
 Puneeth

The *Messages* buffer shows the following:

Exporting...
Loading reftex...done
Creating LaTeX image 1
Failed to create dvi file from 
c:/Users/stanton/AppData/Local/Temp/orgtex5660EuC.tex
Exporting...
image ltxpng/test_660c6efb146974e9d77e2de45f258385867ef389.png t
Saving file c:/projects/texintro/web/test.html...
Wrote c:/projects/texintro/web/test.html
HTML export done, pushed to kill ring and clipboard

Investigating further, the log file associated with the tex file listed above 
shows the following:

Package ifplatform Warning: 
shell escape is disabled, so I can only detect \ifwindows.

)
\minted@bgbox=\box31
\minted@code=\write4
\@float@every@listing=\toks22
\c@listing=\count106
)

! Package minted Error: You must invoke LaTeX with the -shell-escape flag.

See the minted package documentation for explanation.
Type  H return  for immediate help.
 ...  
  
l.7 \usepackage
   [latin1]{inputenc}
? 
! Emergency stop.
 ...  
  
l.7 \usepackage
   [latin1]{inputenc}
Pass the -shell-escape flag to LaTeX. Refer to the minted.sty documentation for
 more information.

So now I can see what the problem is, but how do I tell org-mode to call latex 
with the -shell-escape flag?



Re: [O] Blank equation when exported to HTML using dvipng

2012-05-28 Thread Richard Stanton
In my init.el, I have

(setq org-latex-to-pdf-process 
  '(pdflatex -shell-escape -interaction nonstopmode -output-directory %o 
%f
pdflatex -shell-escape -interaction nonstopmode -output-directory %o 
%f
pdflatex -shell-escape -interaction nonstopmode -output-directory %o 
%f
pdflatex -shell-escape -interaction nonstopmode -output-directory %o 
%f))

The problem is that when I export to HTML with the dvipng option, it's calling 
latex, not pdflatex, so I don't think this option has an effect.

 -Original Message-
 From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com]
 Sent: Monday, May 28, 2012 7:08 AM
 To: Richard Stanton
 Cc: Puneeth Chaganti; emacs-orgmode@gnu.org
 Subject: Re: [O] Blank equation when exported to HTML using dvipng
 
 Richard Stanton stan...@haas.berkeley.edu wrote:
 
  ...
 
  So now I can see what the problem is, but how do I tell org-mode to
  call latex with the -shell-escape flag?
 
 
 You can customize org-latex-to-pdf-process (or org-e-latex-pdf-
 process[fn:1] if you are using the new exporter). In my case, I have
 
 ,
 | org-latex-to-pdf-process is a variable defined in `org-latex.el'.
 | Its value is (texi2dvi --pdf %f)
 | Original value was
 | (pdflatex -interaction nonstopmode -output-directory %o %f pdflatex
 | -interaction nonstopmode -output-directory %o %f pdflatex
 | -interaction nonstopmode -output-directory %o %f)
 `
 
 but texi2dvi probably does not exist on windows (and you still have to patch
 it even on linux). Just add --shell-escape after every pdflatex (or whatever
 command is invoked on windows).
 
 Nick
 
 Footnotes:
 
 [fn:1] NB: different spelling in the two cases - not only the added e- but
also the missing -to.



[O] Blank equation when exported to HTML using dvipng

2012-05-27 Thread Richard Stanton
Here's a very simple ORG file:



#+OPTIONS: LaTeX:dvipng

* Test file
\begin{equation}
x=\sqrt{b}
\end{equation}   

--

When I export this to HTML (Org-mode version 7.8.11 (release_7.8.11-12-gc55405 
@ c:/emacs/site-lisp/org-mode/lisp/)), the equation comes out blank. 

The HTML file contains the following code:

img src=ltxpng/test_660c6efb146974e9d77e2de45f258385867ef389.png 
alt=\begin{equation}
x=\sqrt{b}
\end{equation}/

However, directory ltxpng is empty.

I'm running Emacs 24.0.97 under Windows Vista with MikTeX 2.09 installed and 
PATH set so that I can call pdflatex, dvipng, etc. from the command line just 
fine.

Any thoughts about what might be going wrong? 



[O] make fails on Windows machine

2012-05-20 Thread Richard Stanton
I just downloaded the latest version (version 7.8.10 - 
release_7.8.10-573-g7b33d9) and typed make, only to obtain the following 
output:

[C:\emacs\site-lisp\org-mode]make
==
= Invoke make help for a synopsis of make targets. =
= Created a default local.mk template.   =
= Setting oldorg as the default target.=
= Please adapt local.mk to your local setup! =
==
make -C doc clean;  make -C lisp clean;
make[1]: Entering directory `/c/emacs/site-lisp/org-mode/doc'
rm -f org *.pdf *.html *_letter.tex org-version.inc \
  *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs \
  *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps
make[1]: Leaving directory `/c/emacs/site-lisp/org-mode/doc'
make[1]: Entering directory `/c/emacs/site-lisp/org-mode/lisp'
rm -f org-version.el org-install.el org-version.elc org-install.elc
rm -f *.elc
make[1]: Leaving directory `/c/emacs/site-lisp/org-mode/lisp'
make -C lisp compile
make[1]: Entering directory `/c/emacs/site-lisp/org-mode/lisp'
rm -f org-version.el org-install.el org-version.elc org-install.elc
org-version: 7.8.10 (release_7.8.10-573-g7b33d9)
Loading c:/emacs/site-lisp/org-mode/lisp/org-compat.el (source)...
Loading c:/emacs/site-lisp/org-mode/UTILITIES/org-fixup.el (source)...
Saving file c:/emacs/site-lisp/org-mode/lisp/org-version.el...
Loading vc-git...
Wrote c:/emacs/site-lisp/org-mode/lisp/org-version.el
org-install: 7.8.10 (release_7.8.10-573-g7b33d9)
Loading c:/emacs/site-lisp/org-mode/lisp/org-compat.el (source)...
Loading c:/emacs/site-lisp/org-mode/UTILITIES/org-fixup.el (source)...
Saving file c:/c/emacs/site-lisp/org-mode/lisp/org-install.el...
c:/c/emacs/site-lisp/org-mode/lisp/: no such directory
Makefile:30: recipe for target `org-install.el' failed
make[1]: *** [org-install.el] Error 127
make[1]: Leaving directory `/c/emacs/site-lisp/org-mode/lisp'
targets.mk:54: recipe for target `compile' failed
make: *** [compile] Error 2

[C:\emacs\site-lisp\org-mode]

I'm running Emacs 24.0.96 under Windows, and from the output above it may well 
also be relevant that I'm using Cygwin's version of make (+ other tools).



Re: [O] Problem exporting to PDF (and viewing)

2012-05-18 Thread Richard Stanton
  2) If not, where is the code that interprets %s? I can try stepping
  through it and see what I can find.
 
 
 It happens in org.el:org-open-file, specifically this piece of the code (I 
 think):
 
 ,
 | (while (string-match %s cmd)
 | (setq cmd (replace-match
 |(save-match-data
 |  (shell-quote-argument
 |   (convert-standard-filename file)))
 |t t cmd)))
 `

I did some tracing through, and have found where things go wrong. 

At the start of the code listed above, 

cmd = c:/progra~1/sumatrapdf/sumatrapdf.exe %s 
file = c:/dropbox/org/personal.pdf

(convert-standard-filename file) returns
C:/dropbox/org/personal.pdf

So far so good...

However, 

(shell-quote-argument (convert-standard-filename file)) returns
c\\:dropbox/org/personal.pdf

That's where the problem occurs. After this block of code is completed, cmd 
takes the value
c:/progra~1/sumatrapdf/sumatrapdf.exe c\\:dropbox/org/personal.pdf

This command causes sumatrapdf to squawk with an error. It's the \\: that 
causes the problem. If, after this block of code executes, I manually switch 
the \\: back to :/, so cmd goes back to 

c:/progra~1/sumatrapdf/sumatrapdf.exe c:/dropbox/org/personal.pdf

and then press c to continue, the PDF file pops up just fine. Could we just 
drop the call to shell-quote-argument? It seems like everything would work fine 
without this call.



Re: [O] Problem exporting to PDF (and viewing)

2012-05-18 Thread Richard Stanton


 -Original Message-
 From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com]
 Sent: Friday, May 18, 2012 2:11 PM
 To: Richard Stanton
 Cc: emacs-orgmode@gnu.org; Jonathan Leech-Pepin
 Subject: Re: [O] Problem exporting to PDF (and viewing)
 
 Richard Stanton stan...@haas.berkeley.edu wrote:
 
2) If not, where is the code that interprets %s? I can try
stepping through it and see what I can find.
   
  
   It happens in org.el:org-open-file, specifically this piece of the code (I
 think):
  
   ,
   | (while (string-match %s cmd)
   | (setq cmd (replace-match
   |(save-match-data
   |  (shell-quote-argument
   |   (convert-standard-filename file)))
   |t t cmd)))
   `
 
  I did some tracing through, and have found where things go wrong.
 
  At the start of the code listed above,
 
  cmd = c:/progra~1/sumatrapdf/sumatrapdf.exe %s
  file = c:/dropbox/org/personal.pdf
 
  (convert-standard-filename file) returns C:/dropbox/org/personal.pdf
 
  So far so good...
 
  However,
 
  (shell-quote-argument (convert-standard-filename file)) returns
  c\\:dropbox/org/personal.pdf
 
 
 Does it really drop the slash in front of dropbox? When I do that on my
 system, the : is quoted, but the slash is left alone:
 
 
 (setq s C:/dropbox/org/personal.pdf)
 C:/dropbox/org/personal.pdf
 (shell-quote-argument s)
 C\\:/dropbox/org/personal.pdf
 system-type
 gnu/linux
 
 If it does indeed drop the slash, can you try just putting it back and leaving
 the backslashes alone?

Oops. I must have deleted it somehow while transcribing. No, the slash is left 
alone:

c\\:/Dropbox/org/personal.pdf




Re: [O] Problem exporting to PDF (and viewing)

2012-05-18 Thread Richard Stanton
 From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com]
 Sent: Friday, May 18, 2012 3:20 PM
 To: Richard Stanton
 Cc: emacs-orgmode@gnu.org; Jonathan Leech-Pepin
 Subject: Re: [O] Problem exporting to PDF (and viewing)
 
 Richard Stanton stan...@haas.berkeley.edu wrote:
 
2) If not, where is the code that interprets %s? I can try
stepping through it and see what I can find.
   
  
   It happens in org.el:org-open-file, specifically this piece of the code (I
 think):
  
   ,
   | (while (string-match %s cmd)
   | (setq cmd (replace-match
   |(save-match-data
   |  (shell-quote-argument
   |   (convert-standard-filename file)))
   |t t cmd)))
   `
 
  I did some tracing through, and have found where things go wrong.
 
  At the start of the code listed above,
 
  cmd = c:/progra~1/sumatrapdf/sumatrapdf.exe %s
  file = c:/dropbox/org/personal.pdf
 
  (convert-standard-filename file) returns C:/dropbox/org/personal.pdf
 
  So far so good...
 
  However,
 
  (shell-quote-argument (convert-standard-filename file)) returns
  c\\:dropbox/org/personal.pdf
 
  That's where the problem occurs. After this block of code is
  completed, cmd takes the value c:/progra~1/sumatrapdf/sumatrapdf.exe
 c\\:dropbox/org/personal.pdf
 
  This command causes sumatrapdf to squawk with an error. It's the \\:
  that causes the problem. If, after this block of code executes, I
  manually switch the \\: back to :/, so cmd goes back to
 
  c:/progra~1/sumatrapdf/sumatrapdf.exe c:/dropbox/org/personal.pdf
 
  and then press c to continue, the PDF file pops up just fine. Could we 
  just
 drop the call to shell-quote-argument? It seems like everything would work
 fine without this call.
 
 
 Can you trace the execution of shell-quote-argument? In particular, what is
 the value of system-type and what result do you get when you evaluate the
 form
 
   (w32-shell-dos-semantics)
 
 ?
 
 It seems that it falls through to the default case and I'm not sure it should.

Tracing through (shell-quote-argument c:/dropbox/org/personal.pdf),

system-type is windows-nt

(w32-shell-dos-semantics) returns nil

This result occurs because I'm using (Cygwin) bash as my shell inside Emacs, 
not the Windows default, cmdproxy.exe. It's therefore true that my shell does 
*not* expect DOS file names (and gets very upset when you pass it a 
backslash...), but escaping the : seems to cause problems because now : is 
taken to be part of the file name, I think, rather than part of c:, the name 
of the (Windows) disk.





Re: [O] Problem exporting to PDF (and viewing)

2012-05-13 Thread Richard Stanton
 Achim Gratz writes 
 Richard Stanton writes:
  While this seems to have something to do with the bash shell I'm
  using, this works fine for everything else, so I'm pretty sure there's
  no fundamental problem in my setup, and it would be nice to find a way
  around this problem.
 
 I am pretty sure there is some fundamental problem, but you never told
 us what exactly your setup is.
 
 FWIW, I sometimes get these doubled up prefix paths since I installed
 cygwin-setup and cygwin-mount from the EmacsWiki in operations that are
 completely unrelated to org (I haven't had time to investigate), but
 then it works for the same path if I try the same thing a bit later.
 Also, as has been mentioned before, you might want to check where the
 string c:\dropbox\org comes from, since Emacs would normally expand it
 as c:/dropbox/org, so it seems likely that you pull it in via a
 Windows environment variable or it is quoted once too many.  Lastly, it
 is not a good idea to give such DOS paths with \ to bash, as bash has
 totally different quoting rules than DOS cmd.

Thanks. I'm using Cygwin bash under Windows Vista, and suspect you may have a 
point about the directory separator, though nowhere in my init.el do I use a 
backslash. Anyway, I'll give it a check and see what I can find.



Re: [O] Problem exporting to PDF (and viewing)

2012-05-12 Thread Richard Stanton
I think the problem is in the org-mode code that interprets %s. (and how this 
interacts with my bash shell). This is supposed to pass the executable the 
fully qualified file name, but somehow it ends up passing the directory twice, 
which (understandably) confuses the executable. 

While this seems to have something to do with the bash shell I'm using, this 
works fine for everything else, so I'm pretty sure there's no fundamental 
problem in my setup, and it would be nice to find a way around this problem.

Two thoughts:

1) Is there another string I could use, instead of %s, that results in the file 
name being passed without the path at all? This would probably cure the problem.

2) If not, where is the code that interprets %s? I can try stepping through it 
and see what I can find.

Thanks a lot.

Richard


 -Original Message-
 From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com]
 Sent: Saturday, May 12, 2012 7:40 AM
 To: Jonathan Leech-Pepin
 Cc: Richard Stanton; emacs-orgmode@gnu.org
 Subject: Re: [O] Problem exporting to PDF (and viewing)
 
 Jonathan Leech-Pepin jonathan.leechpe...@gmail.com wrote:
 
  I suspect you should be able to get it to recognize C:/Program\
  Files/sumatrapdf/sumatrapdf.exe.
 
  Alternately if the exe is found on your PATH (you may need to add it
  by hand), you should be able to manage with:
 
  (executable-find sumatrapdf.exe)
 
  which should be able to track back the path to the appropriate file.
 
  On Sat, May 12, 2012 at 12:10 AM, Richard Stanton
  stan...@haas.berkeley.edu wrote:
   Checking further, this works fine using the default Windows shell in
 Emacs, but fails if I use bash as my shell. Unfortunately, I like to use bash,
 which I achieve with the following lines in my init.el:
  
        (setq shell-file-name bash)
        (setenv SHELL shell-file-name)
        (setq explicit-shell-file-name shell-file-name)
  
   -Original Message-
   From: Richard Stanton
   Sent: Friday, May 11, 2012 4:52 PM
   To: emacs-orgmode@gnu.org
   Subject: Problem exporting to PDF (and viewing)
  
   Using Org-mode version 7.8.09 (release_7.8.09-553-g5750f0) (and
   earlier
   versions) I've encountered a problem on my Windows machine when I
   try to export an Org file to LaTeX, then to Pdf, then viewing (using C-c 
   C-
 e d).
  
   In my init.el I have the lines
  
     (eval-after-load org
       '(progn
          (if (assoc \\.pdf\\' org-file-apps)
              (setcdr (assoc \\.pdf\\' org-file-apps)
   c:/progra~1/sumatrapdf/sumatrapdf.exe  %s)
            (add-to-list 'org-file-apps '(\\.pdf\\' .
   c:/progra~1/sumatrapdf/sumatrapdf.exe %s) t
   )
  
   This results in:
  
   org-file-apps is a variable defined in `org.el'.
   Its value is ((auto-mode . emacs)
    (\\.mm\\' . default)
    (\\.x?html?\\' . default)
    (\\.pdf\\' . c:/progra~1/sumatrapdf/sumatrapdf.exe %s))
  
   When I try to export an org file by typing C-c C-e d, sumatrapdf
   opens up OK, but complains with an error like this:
  
   Error loading c:\dropbox\org\c\:\dropbox\org\personal.pdf
  
   Any idea why I get the repeated path? A similar constructions works
   fine on my Mac, so I'm not quite sure what's going wrong here.
 
 I don't do Windoze, but this looks to me like a typo in some init file, 
 perhaps a
 missing semicolon? I'd grep the usual suspects (on Linux, this would be
 /etc/*, and all the config/init files and directories under $HOME (.profile,
 .bashrc, .emacs, etc etc), but I have no idea what these would be on
 Windoze - you might even have to search the *shudder*
 registry) for c:\dropbox\org.
 
 Nick



[O] Problem exporting to PDF (and viewing)

2012-05-11 Thread Richard Stanton
Using Org-mode version 7.8.09 (release_7.8.09-553-g5750f0) (and earlier 
versions) I've encountered a problem on my Windows machine when I try to export 
an Org file to LaTeX, then to Pdf, then viewing (using C-c C-e d).

In my init.el I have the lines

  (eval-after-load org
'(progn
   (if (assoc \\.pdf\\' org-file-apps)
   (setcdr (assoc \\.pdf\\' org-file-apps) 
c:/progra~1/sumatrapdf/sumatrapdf.exe  %s) 
 (add-to-list 'org-file-apps '(\\.pdf\\' . 
c:/progra~1/sumatrapdf/sumatrapdf.exe %s) t
)

This results in:
 
org-file-apps is a variable defined in `org.el'.
Its value is ((auto-mode . emacs)
 (\\.mm\\' . default)
 (\\.x?html?\\' . default)
 (\\.pdf\\' . c:/progra~1/sumatrapdf/sumatrapdf.exe %s))

When I try to export an org file by typing C-c C-e d, sumatrapdf opens up OK, 
but complains with an error like this:

Error loading c:\dropbox\org\c\:\dropbox\org\personal.pdf

Any idea why I get the repeated path? A similar constructions works fine on my 
Mac, so I'm not quite sure what's going wrong here.




Re: [O] Problem exporting to PDF (and viewing)

2012-05-11 Thread Richard Stanton
Checking further, this works fine using the default Windows shell in Emacs, but 
fails if I use bash as my shell. Unfortunately, I like to use bash, which I 
achieve with the following lines in my init.el: 

  (setq shell-file-name bash)
  (setenv SHELL shell-file-name) 
  (setq explicit-shell-file-name shell-file-name)

 -Original Message-
 From: Richard Stanton
 Sent: Friday, May 11, 2012 4:52 PM
 To: emacs-orgmode@gnu.org
 Subject: Problem exporting to PDF (and viewing)
 
 Using Org-mode version 7.8.09 (release_7.8.09-553-g5750f0) (and earlier
 versions) I've encountered a problem on my Windows machine when I try to
 export an Org file to LaTeX, then to Pdf, then viewing (using C-c C-e d).
 
 In my init.el I have the lines
 
   (eval-after-load org
 '(progn
(if (assoc \\.pdf\\' org-file-apps)
(setcdr (assoc \\.pdf\\' org-file-apps)
 c:/progra~1/sumatrapdf/sumatrapdf.exe  %s)
  (add-to-list 'org-file-apps '(\\.pdf\\' .
 c:/progra~1/sumatrapdf/sumatrapdf.exe %s) t
 )
 
 This results in:
 
 org-file-apps is a variable defined in `org.el'.
 Its value is ((auto-mode . emacs)
  (\\.mm\\' . default)
  (\\.x?html?\\' . default)
  (\\.pdf\\' . c:/progra~1/sumatrapdf/sumatrapdf.exe %s))
 
 When I try to export an org file by typing C-c C-e d, sumatrapdf opens up OK,
 but complains with an error like this:
 
 Error loading c:\dropbox\org\c\:\dropbox\org\personal.pdf
 
 Any idea why I get the repeated path? A similar constructions works fine on
 my Mac, so I'm not quite sure what's going wrong here.




[O] Sporadic problems pasting

2012-05-02 Thread Richard Stanton
I've been using org-mode (version 7.8.09, release_7.8.09-482-gf47915)
quite a lot over the last 24 hours to edit a file that will turn into a
Beamer presentation. During the course of this editing, I've encountered a
few problems. I'm not sure if these are org-mode or Emacs problems (I've
just updated to Emacs 24.0.96 under OS X), but the first is that on
several occasions, when cutting and pasting text in my org-mode buffer,
when I press C-y to paste (or yank), instead of doing what I ask, I get a
message in the minibuffer telling me something like

Quit: pasteboard doesn't contain valid data

At this point, I seem to be completely unable to retrieve the text I had
previously cut, which is somewhat inconvenient. To try and find out more,
I have debug-on-error set to t, but Emacs doesn't enter the debugger when
I press C-y; it just gives me that not very useful error message.

This doesn't happen anywhere close to 100% of the time, and I have no way
to recreate the problem systematically, but it happened probably 4 or 5
times during the last 24 hours.






[O] Emacs occasionally hangs using org-mode

2012-05-02 Thread Richard Stanton
I've been using org-mode (version 7.8.09, release_7.8.09-482-gf47915)
quite a lot over the last 24 hours to edit a file that will turn into a
Beamer presentation. One problem I've encountered during this period is
that Emacs (24.0.96 under OS X Lion) has randomly hung multiple times.
Sometimes this occurs when I have just asked Emacs to process the org file
to a PDF file, but sometimes it occurs when I'm just typing. Sometimes the
hang involves Emacs literally disappearing, and sometimes I just get an
infinite rotating ball. There's nothing obviously predictable about when
this occurs, and it's happened maybe 10 times in the last 24 hours. Not a
fatal problem, and Emacs fires up quite quickly on my Mac, but annoying
nevertheless.


I suspect this may well be an Emacs problem rather than an org-mode
problem, and that I'm only seeing it as org related because that's what
I've been using for the last 24 hours, but either way I'd appreciate any
suggestions for how to track down more information to help solve this
problem.

By the way, I just tried going back to 24.0.95 and it hung too, so it's
not just this version of Emacs.




[O] org + beamer: How to get @Š@ to create \alert?

2012-05-01 Thread Richard Stanton
I've just started using orgmode to create Beamer presentations, and have a
question.

In the worg documentation
(http://orgmode.org/worg/org-tutorials/org-beamer/tutorial.html), it gives
an example of how enclosing text in @ signs is supposed to result in
highlighted red text. When I try it, I get text surrounded by two @
signs...

Following suggestions from this list back in 2010, I tried customizing
org-export-latex-emphasis-alist to

Value: ((* \\textbf{%s} nil)
 (/ \\emph{%s} nil)
 (_ \\underline{%s} nil)
 (+ \\st{%s} nil)
 (= \\protectedtexttt t)
 (~ \\verb t)
 (@ \\alert{%s} nil))


but this doesn't seem to help either.

Can anyone tell me how to get this working?

Thanks.

By the way, org-version reports: Org-mode version 7.8.09
(release_7.8.09-481-g3c3402 @
/Applications/Emacs.app/Contents/Resources/site-lisp/org-mode/lisp/org-inst
all.el)







[O] make fails on current version

2012-04-23 Thread Richard Stanton
I just updated org-mode and typed make. Two problems:

1) The doc file seems to have trouble:

org.texi:6703: Misplaced {.
org.texi:6703: Misplaced }.
makeinfo: Removing output file `org' due to errors; use --force to
preserve.


2) org-install.el doesn't get created.

From org-version.el, this is git version release_7.8.09-375-gb7982a
(org-version just returns N/A).





[O] Error on opening org files

2012-04-13 Thread Richard Stanton
I just updated org-mode to version 7.8.09 (release_7.8.09.199.g5e4cff.dirty), 
and now get the following error when I try to open any .org file:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  org-babel-header-arg-expand()
  run-hook-with-args-until-success(org-babel-header-arg-expand)
  org-cycle((4))
  org-set-startup-visibility()
  org-mode()
  set-auto-mode-0(org-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#buffer work.org c:/Dropbox/org/work.org nil nil 
c:/Dropbox/org/work.org ((16640 12 . 1731) (37630 . 48608)))
  find-file-noselect(c:/Dropbox/org/work.org nil nil nil)
  find-file(c:/Dropbox/org/work.org)
  steve-ido-choose-from-recentf()
  call-interactively(steve-ido-choose-from-recentf nil nil)



Re: [O] Python code block hangs with :session if python-mode is loaded

2012-04-01 Thread Richard Stanton
 The above executes without problem for me regardless of whether python-
 mode has been explicitly loaded.  I have python mode py-version 5.1.0 on
 my machine.  My guess is that python-mode changed the session prompt in
 such a way that Babel can not tell when execution has completed.  I have
 the following in my *Python* session buffer after execution [1], what are
 the contents of your *Python* session buffer after you have C-g'd out of the
 loop?
 
 Best,
 
 Footnotes:
 [1]  *Python*
  print %d + %d = %d % (2, 3, 2+3)
 2 + 3 = 5
 2**5
 
 32
 
 
  'org_babel_python_eoe'
  'org_babel_python_eoe'
  print %d + %d = %d % (2, 3, 2+3)
 2 + 3 = 5
  2**5
 32
 
 
 
  'org_babel_python_eoe'
 'org_babel_python_eoe'
 
 --
 Eric Schulte
 http://cs.unm.edu/~eschulte/

Hi Eric.

I'm using python-mode 6.0.6, and have it set up to use ipython as the default 
python shell. Here's what I see:

--

Enthought Python Distribution -- www.enthought.com

Python 2.7.2 |EPD 7.2-2 (32-bit)| (default, Sep 14 2011, 11:02:05) [MSC v.1500 
32 bit (Intel)]
Type copyright, credits or license for more information.

IPython 0.12 -- An enhanced Interactive Python.
? - Introduction and overview of IPython's features.
%quickref - Quick reference.
help  - Python's own help system.
object?   - Details about 'object', use 'object??' for extra details.

In [1]: 
In [2]: print %d + %d = %d % (2, 3, 2+3)
2**5



2 + 3 = 5

In [3]: Out[3]: 32

In [4]: 
In [4]: 
In [4]: 'org_babel_python_eoe'

In [4]: Out[4]: 'org_babel_python_eoe'

In [5]:






[O] Python code block hangs with :session if python-mode is loaded

2012-03-31 Thread Richard Stanton
I have python-mode (latest version from Launchpad) set up to handle python 
editing in Emacs.

Using orgmode, the following code block runs fine if Ipress C-c C-c, producing 
the (correct) output shown:

#+begin_src python :results output
print %d + %d = %d % (2, 3, 2+3)
2**5
#+end_src

#+RESULTS:
: 2 + 3 = 5

If I do not have (require 'python-mode) in my init.el, the following also works 
fine:

#+begin_src python :results output :session
print %d + %d = %d % (2, 3, 2+3)
2**5
#+end_src

#+RESULTS:
: 2 + 3 = 5
: 32

However, if (require 'python-mode) is in my init.el file, pressing C-c C-c in 
the second code block causes Emacs to hang with the message Executing python 
code block. I can get out  by pressing C-g, but it never returns otherwise.





Re: [O] Problems running C code in org-mode under Windows - SOLVED

2012-03-29 Thread Richard Stanton
 One problem - when using bash as the shell, when trying to execute the
 compiled file, it tries to execute the empty file, not the file that was just
 compiled (which has the same name, but the extension .exe, added by the
 compiler).
 
 A partial solution to this is to append .exe to the name of the binary temp
 file if running under Windows. E.g., start org-babel-C-execute something
 like this:
 
 (defun org-babel-C-execute (body params)
   This function should only be called by `org-babel-execute:C'
 or `org-babel-execute:C++'.
   (let* ((tmp-src-file (org-babel-temp-file
   C-src-
   (cond
((equal org-babel-c-variant 'c) .c)
((equal org-babel-c-variant 'cpp) .cpp
  (tmp-bin-file (org-babel-temp-file
   C-bin-
   (if (equal system-type 'windows-nt) .exe )))
 
 [...]
 
 I say partial solution because the output in the org file is *still* blank, 
 but
 at least the program does get run this way...

Solved (approximately):

Here was the org file I was using:

#+begin_src C :includes stdio.h
int a=2;
int b=3;
printf(%d\n, a+b);
#+end_src

This ran fine, but returned an error code of 2, which caused problems. When I 
added the extra line
 
   return(0);

at the end, it ran fine.

To allow for people who might be using the Cygwin bash shell in Emacs under 
Windows (which is recommended by many),  I do recommend making the change I 
suggested above, adding the following lines to ob-C.el:

  (tmp-bin-file (org-babel-temp-file
   C-bin-
   (if (equal system-type 'windows-nt) .exe )))


This prevents bash trying to run an (empty) file with no extension when the 
compiler has generated a file with a .exe extension. Otherwise, it looks like 
I now have this running fine. 

I also suggest not creating an empty binary file and just letting the compiler 
create it, unless this poses some risks I'm not seeing.

Thanks.



Re: [O] Problems running C code in org-mode under Windows - SOLVED

2012-03-29 Thread Richard Stanton
 To allow for people who might be using the Cygwin bash shell in Emacs
 under Windows (which is recommended by many),  I do recommend making
 the change I suggested above, adding the following lines to ob-C.el:
 
   (tmp-bin-file (org-babel-temp-file
  C-bin-
  (if (equal system-type 'windows-nt) .exe )))
 
 
 This prevents bash trying to run an (empty) file with no extension when the
 compiler has generated a file with a .exe extension. Otherwise, it looks
 like I now have this running fine.
 
 I also suggest not creating an empty binary file and just letting the compiler
 create it, unless this poses some risks I'm not seeing.

One more quick follow-up: It seems that I need to add a return(0); line to my 
main routine to get any C examples to work under Windows, whereas I don't need 
to add such a line on my Mac. I just tried the cocktail.c example from your 
2012 Journal of Statistical Software article, and this works on my Mac, but 
fails on my PC (even with my edits to ob-C.el) unless I add return(0); at the 
end of the main code block. 

It would be nice for Windows users to be able to run others' examples without 
having to edit them first, so what do you think of the idea of having  ob-C.el 
append a return(0); line to the main file before passing it to the compiler? 




Re: [O] Problems running C code in org-mode under Windows

2012-03-28 Thread Richard Stanton
 I think the Access is denied problem is probably the same as that listed
 here:
 
 http://lists.gnu.org/archive/html/help-gnu-emacs/2010-04/msg00247.html
 
 Unfortunately, when I switch to using bash as my shell under Windows, this
 causes problems with python-mode (though this is not really your
 problem...) This change does get the compilation to work on my machine,
 however, and a .exe file is created. So far so good...
 
 However, the output still appears blank in the org buffer. More tracing
 required...

One problem - when using bash as the shell, when trying to execute the compiled 
file, it tries to execute the empty file, not the file that was just compiled 
(which has the same name, but the extension .exe, added by the compiler). 

A partial solution to this is to append .exe to the name of the binary temp 
file if running under Windows. E.g., start org-babel-C-execute something like 
this:

(defun org-babel-C-execute (body params)
  This function should only be called by `org-babel-execute:C'
or `org-babel-execute:C++'.
  (let* ((tmp-src-file (org-babel-temp-file
C-src-
(cond
 ((equal org-babel-c-variant 'c) .c)
 ((equal org-babel-c-variant 'cpp) .cpp
 (tmp-bin-file (org-babel-temp-file 
C-bin-
(if (equal system-type 'windows-nt) .exe )))

[...]

I say partial solution because the output in the org file is *still* blank, 
but at least the program does get run this way...

One question - why create a temp file for the executable before running the 
compilation? Why not just have it created by the compiler?



Re: [O] Problems running C code in org-mode under Windows

2012-03-28 Thread Richard Stanton
  As far as I can see, at this point the command being called is
 
  C:/emacs/emacs-24.0.94/bin/cmdproxy -c gcc -o \c:/users/stanton[...]C-
 bin-10700opx\ \c:/users/Stanton[...]C-src-10700bfr.c\
 
  (where [...] just means I deleted some more path information, but it's all
 valid).
 
  If I execute this exact command at the command line, the compilation
  works fine, and creates an executable file C-bin-10700opx.exe (note
  that gcc on Windows automatically adds the .exe extension if you omit
  it). However, after running the call-process-region command in the .el
  file, no executable file is produced, and error-file has the contents
 
  Access is denied

In case anyone is interested, this explains why the Access Denied errors 
occurred, and why switching to bash solved the problem:

http://cboard.cprogramming.com/tech-board/125098-windows-7-access-denied-gcc.html

Another solution to the Access Denied problem is to put the following line in 
init.el:

(setq org-babel-C-compiler gcc-4)

Then you can keep using the Window shell instead of bash. However, this still 
only solves part of the problem. The output is still blank.




Re: [O] Problems running C code in org-mode under Windows

2012-03-27 Thread Richard Stanton
I've been tracing through, and a problem occurs when the compilation gets run, 
which is at about line 155 in file ob-eval.el, inside function 
org-babel-shell-command-on-region, where call-process region is called.

As far as I can see, at this point the command being called is

C:/emacs/emacs-24.0.94/bin/cmdproxy -c gcc -o 
\c:/users/stanton[...]C-bin-10700opx\ 
\c:/users/Stanton[...]C-src-10700bfr.c\

(where [...] just means I deleted some more path information, but it's all 
valid).

If I execute this exact command at the command line, the compilation works 
fine, and creates an executable file C-bin-10700opx.exe (note that gcc on 
Windows automatically adds the .exe extension if you omit it). However, after 
running the call-process-region command in the .el file, no executable file is 
produced, and error-file has the contents

Access is denied

Not sure why this should be, but the compilation is not happening.





 -Original Message-
 From: Eric Schulte [mailto:eric.schu...@gmx.com]
 Sent: Monday, March 26, 2012 6:45 PM
 To: Richard Stanton
 Cc: emacs-orgmode@gnu.org
 Subject: Re: [O] Problems running C code in org-mode under Windows
 
 Richard Stanton stan...@haas.berkeley.edu writes:
 
  Here's a simple org file that's supposed to run some C code and print the
 result:
 
  --
 
  * Sample C code
 
  #+name: RHS.c
  #+begin_src C :noweb yes :tangle RHS.c
#include stdio.h
main
  #+end_src
 
  #+name: main
  #+begin_src C
int main(int argc, char *argv[]) {
  int lst[argc-1];
  int i;
  for(i=1;iargc;i++)
lst[i-1] = atoi(argv[i]);
  for(i=1;iargc;i++)
printf(%d , lst[i-1] + 1);
  printf(\n);
  }
  #+end_src
 
  #+call: RHS.c[:cmdline 8 7 6]()
 
  -
 
  It works fine on my Mac, producing the result:
 
  #+RESULTS: RHS.c[:cmdline 8 7 6]()
  : 9 8 7
 
  On my PC, however, running Windows Vista, the output is blank and
  there's a *Org-babel-error-output* buffer containing the message
 
  Access is denied.
  'c:/Users/stanton/AppData/Local/Temp/babel-11948MQP/C-bin-11948Nln'
 is
  not recognized as an internal or external command, operable program or
  batch file.
 
  There is a file called C-bin-11948Nln in that directory, but it has
  length 0, suggesting that something is going wrong in the compilation
  process. However, I can also see potential problems with the fact that
  the file name does not end in .exe, so the Windows shell is not easily
  going to recognize it as an executable anyway.
 
  Does anyone have this running OK under Windows? Alternatively, how can
  I track down what's going wrong in more detail?
 
  Thanks.
 
  Richard Stanton
 
 
 I don't have access to a windows machine so I can't debug this myself, but I
 would suggest stepping through the execution of the `org-babel-C-execute'
 function using edebug.  This is done by first placing the cursor inside the 
 `org-
 babel-C-execute' function, evaluating the function with C-u C-M-x, then
 executing a C code block.  This should give you some idea of what is going
 wrong where.
 
 Best,
 
 --
 Eric Schulte
 http://cs.unm.edu/~eschulte/



  1   2   >