* session with python-mode.el complains of void py-toggle-shells @ 2013-01-23 2:47 Myles English 2013-01-23 4:11 ` Nick Dokos 0 siblings, 1 reply; 22+ messages in thread From: Myles English @ 2013-01-23 2:47 UTC (permalink / raw) To: Emacs-orgmode Hi, I think it should be possible to execute a python block in a session using python-mode.el but get this message: "Symbol's function definition is void: py-toggle-shells" Using the latest git head and opening this file with: $ emacs -Q thisfile.org then executing these src blocks in order, shows the problem: #+BEGIN_SRC emacs-lisp (require 'org) (org-babel-do-load-languages 'org-babel-load-languages '((python . t))) #+END_SRC #+RESULTS: | (python . t) | * A heading This works okay: #+begin_src python :results output :session a import sys #+end_src #+RESULTS: Try with python3: #+begin_src elisp (setq org-babel-python-command "python3" py-python-command "python3" ) #+end_src #+RESULTS: : python3 works also: #+begin_src python :results output :session a import sys #+end_src #+RESULTS: Try using python-mode.el: #+begin_src elisp (setq org-babel-python-mode 'python-mode) (load-file "/usr/share/emacs/site-lisp/python-mode.el") #+end_src #+RESULTS: : t #+begin_src python :results output :session a import sys #+end_src Gives this *Message*: org-babel-python-initiate-session-by-key: Symbol's function definition is void: py-toggle-shells Do I need to configure something else? Thanks, Myles ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: session with python-mode.el complains of void py-toggle-shells 2013-01-23 2:47 session with python-mode.el complains of void py-toggle-shells Myles English @ 2013-01-23 4:11 ` Nick Dokos 2013-01-23 12:46 ` [PATCH] " Myles English 2013-01-23 13:00 ` Bastien 0 siblings, 2 replies; 22+ messages in thread From: Nick Dokos @ 2013-01-23 4:11 UTC (permalink / raw) To: Myles English; +Cc: Emacs-orgmode Myles English <mylesenglish@gmail.com> wrote: > Hi, > > I think it should be possible to execute a python block in a session > using python-mode.el but get this message: > > "Symbol's function definition is void: py-toggle-shells" > > Using the latest git head and opening this file with: > > $ emacs -Q thisfile.org > > then executing these src blocks in order, shows the problem: > > #+BEGIN_SRC emacs-lisp > (require 'org) > (org-babel-do-load-languages > 'org-babel-load-languages > '((python . t))) > #+END_SRC > > #+RESULTS: > | (python . t) | > > * A heading > > This works okay: > > #+begin_src python :results output :session a > import sys > #+end_src > > #+RESULTS: > > Try with python3: > > #+begin_src elisp > (setq org-babel-python-command "python3" > py-python-command "python3" > ) > #+end_src > > #+RESULTS: > : python3 > > works also: > > #+begin_src python :results output :session a > import sys > #+end_src > > #+RESULTS: > > Try using python-mode.el: > > #+begin_src elisp > (setq org-babel-python-mode 'python-mode) > (load-file "/usr/share/emacs/site-lisp/python-mode.el") > #+end_src > > #+RESULTS: > : t > > #+begin_src python :results output :session a > import sys > #+end_src > > Gives this *Message*: > > org-babel-python-initiate-session-by-key: Symbol's function definition > is void: py-toggle-shells > > Do I need to configure something else? > I get in trouble much sooner than you do: when evaluating the first code block. The error in my case was that run-python was called with the wrong number of args (from the same function: it's a couple of lines before py-toggle-shells is called). I'm running GNU Emacs 24.3.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.4) of 2012-12-29 and run-python does indeed need a required arg in this version: ,---- | run-python is an interactive autoloaded compiled Lisp function in | `python.el'. | | (run-python CMD &optional DEDICATED SHOW) | | Run an inferior Python process. | Input and output via buffer named after | `python-shell-buffer-name'. If there is a process already | running in that buffer, just switch to it. `---- So I changed the call to (run-python py-python-command) and then all the code blocks could execute with no problem. Has run-python changed signature recently? This may or may not be the problem you are running into however. Nick ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH] session with python-mode.el complains of void py-toggle-shells 2013-01-23 4:11 ` Nick Dokos @ 2013-01-23 12:46 ` Myles English 2013-01-23 13:04 ` Bastien 2013-01-23 13:00 ` Bastien 1 sibling, 1 reply; 22+ messages in thread From: Myles English @ 2013-01-23 12:46 UTC (permalink / raw) To: nicholas.dokos; +Cc: Emacs-orgmode Hi Nick, Nick Dokos writes: > Myles English <mylesenglish@gmail.com> wrote: >> I think it should be possible to execute a python block in a session >> using python-mode.el but get this message: >> >> "Symbol's function definition is void: py-toggle-shells" I have made a bit of progress with the patch below. The breakage may have been due to changes in python-mode.el . The patch works for versions 6.0.10 and 6.1.0. > I get in trouble much sooner than you do: when evaluating the first code > block. The error in my case was that run-python was called with the > wrong number of args (from the same function: it's a couple of lines > before py-toggle-shells is called). I'm running > > GNU Emacs 24.3.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.4) of 2012-12-29 > > and run-python does indeed need a required arg in this version: > > ,---- > | run-python is an interactive autoloaded compiled Lisp function in > | `python.el'. > | > | (run-python CMD &optional DEDICATED SHOW) > | > | Run an inferior Python process. > | Input and output via buffer named after > | `python-shell-buffer-name'. If there is a process already > | running in that buffer, just switch to it. > `---- > > So I changed the call to > > > (run-python py-python-command) > > and then all the code blocks could execute with no problem. Has > run-python changed signature recently? Doing git blame ob-python.el shows that not much has changed in that file over the last couple of years. > This may or may not be the problem you are running into however. I have made some progress and the patch below passes this test: #+BEGIN_SRC emacs-lisp (add-to-list 'load-path "~/.emacs.d/plugins/org-mode/lisp") (require 'org) (org-babel-do-load-languages 'org-babel-load-languages '((python . t))) (setq org-babel-python-mode 'python-mode) #+END_SRC #+begin_src python :results output :session a import sys #+end_src #+begin_src python :results output :session a print(sys.path) #+end_src Patch: --- lisp/ob-python.el +++ lisp/ob-python.el @@ -32,7 +32,7 @@ (declare-function org-remove-indentation "org" ) (declare-function py-shell "ext:python-mode" (&optional argprompt)) -(declare-function py-toggle-shells "ext:python-mode" (arg)) +(declare-function py-toggle-shell "ext:python-mode" (arg)) (declare-function run-python "ext:python" (&optional cmd noshow new)) (defvar org-babel-tangle-lang-exts) @@ -162,16 +162,17 @@ then create. Return the initialized session." ;; Make sure that py-which-bufname is initialized, as otherwise ;; it will be overwritten the first time a Python buffer is ;; created. - (py-toggle-shells py-default-interpreter) + (py-toggle-shell py-default-interpreter) ;; `py-shell' creates a buffer whose name is the value of ;; `py-which-bufname' with '*'s at the beginning and end (let* ((bufname (if (and python-buffer (buffer-live-p python-buffer)) (replace-regexp-in-string ;; zap surrounding * "^\\*\\([^*]+\\)\\*$" "\\1" python-buffer) (concat "Python-" (symbol-name session)))) - (py-which-bufname bufname)) - (py-shell) - (setq python-buffer (concat "*" bufname "*")))) + (py-buffer-name bufname)) + (setq python-buffer (concat "*" bufname "*")) + (py-shell nil nil nil nil nil python-buffer) + )) (t (error "No function available for running an inferior Python"))) (setq org-babel-python-buffers Myles ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH] session with python-mode.el complains of void py-toggle-shells 2013-01-23 12:46 ` [PATCH] " Myles English @ 2013-01-23 13:04 ` Bastien 2013-01-23 18:02 ` Andreas Röhler 0 siblings, 1 reply; 22+ messages in thread From: Bastien @ 2013-01-23 13:04 UTC (permalink / raw) To: Myles English; +Cc: andreas, nicholas.dokos, Emacs-orgmode Hi Myles, thanks for digging into this. I'm copying Andreas as the maintainer of python-mode.el. Myles English <mylesenglish@gmail.com> writes: > --- lisp/ob-python.el > +++ lisp/ob-python.el > @@ -32,7 +32,7 @@ > > (declare-function org-remove-indentation "org" ) > (declare-function py-shell "ext:python-mode" (&optional argprompt)) > -(declare-function py-toggle-shells "ext:python-mode" (arg)) > +(declare-function py-toggle-shell "ext:python-mode" (arg)) If this function's name changed, there should be an alias in python-mode.el. > (declare-function run-python "ext:python" (&optional cmd noshow new)) > > (defvar org-babel-tangle-lang-exts) > @@ -162,16 +162,17 @@ then create. Return the initialized session." > ;; Make sure that py-which-bufname is initialized, as otherwise > ;; it will be overwritten the first time a Python buffer is > ;; created. > - (py-toggle-shells py-default-interpreter) > + (py-toggle-shell py-default-interpreter) > ;; `py-shell' creates a buffer whose name is the value of > ;; `py-which-bufname' with '*'s at the beginning and end > (let* ((bufname (if (and python-buffer (buffer-live-p python-buffer)) > (replace-regexp-in-string ;; zap surrounding * > "^\\*\\([^*]+\\)\\*$" "\\1" python-buffer) > (concat "Python-" (symbol-name session)))) > - (py-which-bufname bufname)) > - (py-shell) > - (setq python-buffer (concat "*" bufname "*")))) > + (py-buffer-name bufname)) > + (setq python-buffer (concat "*" bufname "*")) > + (py-shell nil nil nil nil nil python-buffer) > + )) The docstring of py-shell doesn't say much about why python-buffer would be needed as an argument here. Is it so? If yes, we need to make this compatible with previous versions of python-mode.el. (The argument PY-BUFFER-NAME is not documented in latest python-mode.el) Andreas, can you help sorting this out? Thanks, -- Bastien ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH] session with python-mode.el complains of void py-toggle-shells 2013-01-23 13:04 ` Bastien @ 2013-01-23 18:02 ` Andreas Röhler 2013-01-24 14:10 ` Bastien 0 siblings, 1 reply; 22+ messages in thread From: Andreas Röhler @ 2013-01-23 18:02 UTC (permalink / raw) To: Bastien; +Cc: Myles English, Emacs-orgmode, nicholas.dokos Am 23.01.2013 14:04, schrieb Bastien: > Hi Myles, > > thanks for digging into this. > > I'm copying Andreas as the maintainer of python-mode.el. > > Myles English <mylesenglish@gmail.com> writes: > >> --- lisp/ob-python.el >> +++ lisp/ob-python.el >> @@ -32,7 +32,7 @@ >> >> (declare-function org-remove-indentation "org" ) >> (declare-function py-shell "ext:python-mode" (&optional argprompt)) >> -(declare-function py-toggle-shells "ext:python-mode" (arg)) >> +(declare-function py-toggle-shell "ext:python-mode" (arg)) > Hi Bastien, > If this function's name changed, there should be an alias in > python-mode.el. > right >> (declare-function run-python "ext:python" (&optional cmd noshow new)) >> >> (defvar org-babel-tangle-lang-exts) >> @@ -162,16 +162,17 @@ then create. Return the initialized session." >> ;; Make sure that py-which-bufname is initialized, as otherwise >> ;; it will be overwritten the first time a Python buffer is >> ;; created. >> - (py-toggle-shells py-default-interpreter) >> + (py-toggle-shell py-default-interpreter) >> ;; `py-shell' creates a buffer whose name is the value of >> ;; `py-which-bufname' with '*'s at the beginning and end >> (let* ((bufname (if (and python-buffer (buffer-live-p python-buffer)) >> (replace-regexp-in-string ;; zap surrounding * >> "^\\*\\([^*]+\\)\\*$" "\\1" python-buffer) >> (concat "Python-" (symbol-name session)))) >> - (py-which-bufname bufname)) >> - (py-shell) >> - (setq python-buffer (concat "*" bufname "*")))) >> + (py-buffer-name bufname)) >> + (setq python-buffer (concat "*" bufname "*")) >> + (py-shell nil nil nil nil nil python-buffer) >> + )) > > The docstring of py-shell doesn't say much about why python-buffer > would be needed as an argument here. Is it so? > > If yes, we need to make this compatible with previous versions of > python-mode.el. > > (The argument PY-BUFFER-NAME is not documented in latest > python-mode.el) > > Andreas, can you help sorting this out? > > Thanks, > Okay, I'll dig into. For the moment: assume this code should not be needed, python-mode.el should act that all. But let me have a closer look, Cheers, Andreas ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH] session with python-mode.el complains of void py-toggle-shells 2013-01-23 18:02 ` Andreas Röhler @ 2013-01-24 14:10 ` Bastien 2013-02-21 20:08 ` Andreas Röhler 2013-02-22 8:25 ` Andreas Röhler 0 siblings, 2 replies; 22+ messages in thread From: Bastien @ 2013-01-24 14:10 UTC (permalink / raw) To: Andreas Röhler; +Cc: Myles English, Emacs-orgmode, nicholas.dokos Hi Andreas, Andreas Röhler <andreas.roehler@online.de> writes: > Okay, I'll dig into. > > For the moment: assume this code should not be needed, > python-mode.el should act that all. But let me have a closer look, Great, thanks a lot! -- Bastien ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH] session with python-mode.el complains of void py-toggle-shells 2013-01-24 14:10 ` Bastien @ 2013-02-21 20:08 ` Andreas Röhler 2013-02-22 8:25 ` Andreas Röhler 1 sibling, 0 replies; 22+ messages in thread From: Andreas Röhler @ 2013-02-21 20:08 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 384 bytes --] Am 24.01.2013 15:10, schrieb Bastien: > Hi Andreas, > > Andreas Röhler <andreas.roehler@online.de> writes: > >> Okay, I'll dig into. >> >> For the moment: assume this code should not be needed, >> python-mode.el should act that all. But let me have a closer look, > > Great, thanks a lot! > So let's start with this... BTW, being deeply impressed by org-mode and babel in special. [-- Attachment #2: ob-python.el.diff --] [-- Type: text/x-patch, Size: 994 bytes --] commit e7a5839b5a10d0a27e26b8f1d16296f4c20a1350 Author: Andreas Roehler <andreas.roehler@online.de> Date: Thu Feb 21 20:46:49 2013 +0100 Depend default python-mode from existing feature The former (if (featurep 'xemacs) 'python-mode 'python) makes a wrong assumption, as python-mode.el provides 'python-mode which does not depend from use of XEmacs A next step should enable users to choose environment via defcustom diff --git a/lisp/ob-python.el b/lisp/ob-python.el index 02d762c..1b3b892 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -43,7 +43,7 @@ (defvar org-babel-python-command "python" "Name of the command for executing Python code.") -(defvar org-babel-python-mode (if (featurep 'xemacs) 'python-mode 'python) +(defvar org-babel-python-mode (if (featurep 'python-mode) 'python-mode 'python) "Preferred python mode for use in running python interactively. This will typically be either 'python or 'python-mode.") ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH] session with python-mode.el complains of void py-toggle-shells 2013-01-24 14:10 ` Bastien 2013-02-21 20:08 ` Andreas Röhler @ 2013-02-22 8:25 ` Andreas Röhler 2013-02-23 9:29 ` Bastien 1 sibling, 1 reply; 22+ messages in thread From: Andreas Röhler @ 2013-02-22 8:25 UTC (permalink / raw) To: emacs-orgmode; +Cc: Bastien [-- Attachment #1: Type: text/plain, Size: 353 bytes --] Am 24.01.2013 15:10, schrieb Bastien: > Hi Andreas, > > Andreas Röhler <andreas.roehler@online.de> writes: > >> Okay, I'll dig into. >> >> For the moment: assume this code should not be needed, >> python-mode.el should act that all. But let me have a closer look, > > Great, thanks a lot! > ob-python.el patch again better provision for XEmacs users [-- Attachment #2: ob-python.el.diff --] [-- Type: text/x-patch, Size: 1039 bytes --] commit 0fd2ac7ede3d7c8602a0a71fe1dc1678773baee4 Author: Andreas Roehler <andreas.roehler@online.de> Date: Fri Feb 22 09:08:28 2013 +0100 Depend default python-mode from existing feature The former (if (featurep 'xemacs) 'python-mode 'python) makes a wrong assumption, as python-mode.el provides 'python-mode which does not depend from use of XEmacs python-mode.el should provide a defcustom still to choose environment TINYCHANGE diff --git a/lisp/ob-python.el b/lisp/ob-python.el index 02d762c..c9118e9 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -43,7 +43,7 @@ (defvar org-babel-python-command "python" "Name of the command for executing Python code.") -(defvar org-babel-python-mode (if (featurep 'xemacs) 'python-mode 'python) +(defvar org-babel-python-mode (if (or (featurep 'python-mode)(featurep 'xemacs)) 'python-mode 'python) "Preferred python mode for use in running python interactively. This will typically be either 'python or 'python-mode.") ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH] session with python-mode.el complains of void py-toggle-shells 2013-02-22 8:25 ` Andreas Röhler @ 2013-02-23 9:29 ` Bastien 0 siblings, 0 replies; 22+ messages in thread From: Bastien @ 2013-02-23 9:29 UTC (permalink / raw) To: Andreas Röhler; +Cc: emacs-orgmode Hi Andreas, Andreas Röhler <andreas.roehler@easy-emacs.de> writes: > ob-python.el patch again I applied a more complete patch, turning `org-babel-python-command' and `org-babel-python-mode' into defcustoms. `org-babel-python-mode' will not default to 'python-mode until 'python-mode is featured, so users will typically want to set this variable, exposing it as a defcustom is useful IMO. Thanks for the patch! -- Bastien ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: session with python-mode.el complains of void py-toggle-shells 2013-01-23 4:11 ` Nick Dokos 2013-01-23 12:46 ` [PATCH] " Myles English @ 2013-01-23 13:00 ` Bastien 1 sibling, 0 replies; 22+ messages in thread From: Bastien @ 2013-01-23 13:00 UTC (permalink / raw) To: nicholas.dokos; +Cc: Myles English, Emacs-orgmode Nick Dokos <nicholas.dokos@hp.com> writes: > (run-python py-python-command) > > and then all the code blocks could execute with no problem. Has > run-python changed signature recently? Yes, from Emacs 24.1 to Emacs 24.2. I fixed this, thanks. -- Bastien ^ permalink raw reply [flat|nested] 22+ messages in thread
* [odt] equation labels @ 2011-10-28 1:23 Myles English 2011-10-30 22:11 ` Jambunathan K 0 siblings, 1 reply; 22+ messages in thread From: Myles English @ 2011-10-28 1:23 UTC (permalink / raw) To: emacs-orgmode Hello {Jambunathan}, I have found that Equations become labelled as Figures in the version I am using: emacs 23.3.1 org-mode from git commit 71f1c1be (Oct 26) (?I'm not sure if it is the most recent version of contrib/org-odt as the README.org says "This release is is as good as org-20110613" etc) The test equations in latex-mathml.org in this message: http://lists.gnu.org/archive/html/emacs-orgmode/2011-09/msg00198.html are labelled as "Equation" in the odt files but when I export it fresh I get "Figure". Thank you for the recent MathML stuff by the way. Myles ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels 2011-10-28 1:23 [odt] equation labels Myles English @ 2011-10-30 22:11 ` Jambunathan K 2011-10-31 11:54 ` Myles English 0 siblings, 1 reply; 22+ messages in thread From: Jambunathan K @ 2011-10-30 22:11 UTC (permalink / raw) To: emacs-orgmode Myles English <mylesenglish@gmail.com> writes: > Hello {Jambunathan}, > > I have found that Equations become labelled as Figures in the version I > am using: > > emacs 23.3.1 > org-mode from git commit 71f1c1be (Oct 26) > The test equations in latex-mathml.org in this message: > > http://lists.gnu.org/archive/html/emacs-orgmode/2011-09/msg00198.html > > are labelled as "Equation" in the odt files but when I export it fresh I get > "Figure". This was a regression. I pushed a fix few moments ago. Could you please pull again? > (?I'm not sure if it is the most recent version of contrib/org-odt as > the README.org says "This release is is as good as org-20110613" etc) I have not updated README.org for a while and please ignore whatever it claims. You are using the right version of odt. So no worries. > Thank you for the recent MathML stuff by the way. > > Myles > > -- ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels 2011-10-30 22:11 ` Jambunathan K @ 2011-10-31 11:54 ` Myles English 2011-11-01 11:17 ` Myles English 2011-11-01 19:39 ` Jambunathan K 0 siblings, 2 replies; 22+ messages in thread From: Myles English @ 2011-10-31 11:54 UTC (permalink / raw) To: emacs-orgmode >> On Mon, 31 Oct 2011 03:41:18 +0530, Jambunathan K said: > Myles English <mylesenglish@gmail.com> writes: >> I have found that Equations become labelled as Figures in the >> version I am using: >> >> emacs 23.3.1 org-mode from git commit 71f1c1be (Oct 26) The test >> equations in latex-mathml.org in this message: >> >> http://lists.gnu.org/archive/html/emacs-orgmode/2011-09/msg00198.html >> >> are labelled as "Equation" in the odt files but when I export it >> fresh I get "Figure". > This was a regression. I pushed a fix few moments ago. Could you > please pull again? Thanks for the push, there are three things I notice now: 1) my document won't open and causes libreoffice to crash! I get: "terminate called after throwing an instance of what(): vector::_M_default_append" on the command line 2) the first equation in latex-mathml.org is not numbered, I would expect this if it was using a begin{equation*} environment but not a begin{equation}. 3) the second equation looks a bit like this: x=root(b) (1) Radicals but I would have expected something like: x=root(b) Equation 1.: Radicals Is there a new variable that I need to set to get (e.g.) "Equation 1."? Just to be explicit, the test file latex-mathml.org I am referring to contains: #+TITLE: latex-mathml.org #+AUTHOR: Jambunathan K #+EMAIL: address@hidden #+DATE: 2011-09-09 Fri #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport #+LINK_UP: #+LINK_HOME: #+XSLT: * LaTeX Fragments ** LaTeX Fragment1 # See org-format-latex-options There is a equation down below. \begin{equation} e = \frac{1}{2}mv^2 \end{equation} ** LaTeX Fragment2 #+CAPTION: Radicals #+LABEL: Equation:1 \begin{equation} x=\sqrt{b} \end{equation} If $a^2=b$ and \( b=2 \), then the solution must be either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \]. Myles ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels 2011-10-31 11:54 ` Myles English @ 2011-11-01 11:17 ` Myles English 2011-11-01 19:39 ` Jambunathan K 1 sibling, 0 replies; 22+ messages in thread From: Myles English @ 2011-11-01 11:17 UTC (permalink / raw) To: emacs-orgmode >> On Mon, 31 Oct 2011 11:54:35 +0000, Myles English said: >> On Mon, 31 Oct 2011 03:41:18 +0530, Jambunathan K said: >> Myles English <mylesenglish@gmail.com> writes: >>> I have found that Equations become labelled as Figures in the >>> version I am using: >>> >>> emacs 23.3.1 org-mode from git commit 71f1c1be (Oct 26) The test >>> equations in latex-mathml.org in this message: >>> >>> http://lists.gnu.org/archive/html/emacs-orgmode/2011-09/msg00198.html >>> >>> are labelled as "Equation" in the odt files but when I export it >>> fresh I get "Figure". >> This was a regression. I pushed a fix few moments ago. Could you >> please pull again? > Thanks for the push, there are three things I notice now: > 1) my document won't open and causes libreoffice to crash! I get: > "terminate called after throwing an instance of what(): > vector::_M_default_append" on the command line > 2) the first equation in latex-mathml.org is not numbered, I would > expect this if it was using a begin{equation*} environment but not a > begin{equation}. > 3) the second equation looks a bit like this: > x=root(b) (1) Radicals > but I would have expected something like: > x=root(b) Equation 1.: Radicals Alright, points 2 and 3 are cleared up by me understanding that the asterisk in \begin{equation*} has no visible effect, and that instead of having "Equation 1.:" in the caption below the formula, there is a "(1)" on the RHS. Point 1 is entirely my own problem. Myles ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels 2011-10-31 11:54 ` Myles English 2011-11-01 11:17 ` Myles English @ 2011-11-01 19:39 ` Jambunathan K 2011-11-01 19:49 ` Jambunathan K 2011-11-02 13:18 ` Myles English 1 sibling, 2 replies; 22+ messages in thread From: Jambunathan K @ 2011-11-01 19:39 UTC (permalink / raw) To: emacs-orgmode Myles (I have read the followup post to this set of questions) Myles English <mylesenglish@gmail.com> writes: >>> On Mon, 31 Oct 2011 03:41:18 +0530, Jambunathan K said: > > > Myles English <mylesenglish@gmail.com> writes: > >> I have found that Equations become labelled as Figures in the > >> version I am using: > >> > >> emacs 23.3.1 org-mode from git commit 71f1c1be (Oct 26) The test > >> equations in latex-mathml.org in this message: > >> > >> http://lists.gnu.org/archive/html/emacs-orgmode/2011-09/msg00198.html > >> > >> are labelled as "Equation" in the odt files but when I export it > >> fresh I get "Figure". > > > This was a regression. I pushed a fix few moments ago. Could you > > please pull again? > > Thanks for the push, there are three things I notice now: > > 1) my document won't open and causes libreoffice to crash! I get: > "terminate called after throwing an instance of > what(): vector::_M_default_append" on the command line 1. You are using custom styles for your latex fragment 2. latex-to-mathml converter - as it stands today - assumes the latex fragment is completed in and of itself and doesn't honor the style settings. Putting 1 and 2 together, I am assuming that the XML created by the ODT emitter contains garbage which is causing LibreOffice to be confused. In my observation, ill-formed XML triggers "file is corrupt and should I repair the file?" from LibreOffice. A crash seems strange to me. 1. http://article.gmane.org/gmane.emacs.orgmode/48714 - Above link has my note on -ncf option to mathtoweb 2. http://orgmode.org/worg/org-faq.html - Above link has a note on how to debug corrupt odt files. (Hint: search for corrupt) > 2) the first equation in latex-mathml.org is not numbered, I would > expect this if it was using a begin{equation*} environment but not a > begin{equation}. Currently the odt exporter doesn't peek in to the latex fragment and infer what manner of equation it is. This is something that I could take up ... ,---- | (defvar org-latex-regexps | '(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t) | ;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil) | ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p | ("$1" "\\([^$]\\|^\\)\\(\\$[^ \r\n,;.$]\\$\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil) | ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil) | ("\\(" "\\\\([^\000]*?\\\\)" 0 nil) | ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 nil) | ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil)) | "Regular expressions for matching embedded LaTeX.") `---- > 3) the second equation looks a bit like this: > > x=root(b) (1) > Radicals > > but I would have expected something like: > > x=root(b) > Equation 1.: Radicals > > Is there a new variable that I need to set to get (e.g.) "Equation > 1."? Being a non-latex user, I am not familiar with what the usual practice is. If the latter option is how captioned equations are normally typeset I can take it up. Can you confirm that the expectations above are *not* your own but that of *any* user? > Just to be explicit, the test file latex-mathml.org I am referring to > contains: > > #+TITLE: latex-mathml.org > #+AUTHOR: Jambunathan K > #+EMAIL: address@hidden > #+DATE: 2011-09-09 Fri > #+DESCRIPTION: > #+KEYWORDS: > #+LANGUAGE: en > #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t > #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc > > #+EXPORT_SELECT_TAGS: export > #+EXPORT_EXCLUDE_TAGS: noexport > #+LINK_UP: > #+LINK_HOME: > #+XSLT: > > * LaTeX Fragments > > ** LaTeX Fragment1 > # See org-format-latex-options > > There is a equation down below. > > \begin{equation} > e = \frac{1}{2}mv^2 > \end{equation} > > ** LaTeX Fragment2 > > #+CAPTION: Radicals > #+LABEL: Equation:1 > \begin{equation} > x=\sqrt{b} > \end{equation} > > If $a^2=b$ and \( b=2 \), then the solution must be either $$ > a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \]. > > > Myles > > -- ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels 2011-11-01 19:39 ` Jambunathan K @ 2011-11-01 19:49 ` Jambunathan K 2011-11-02 13:18 ` Myles English 1 sibling, 0 replies; 22+ messages in thread From: Jambunathan K @ 2011-11-01 19:49 UTC (permalink / raw) To: emacs-orgmode >> 2) the first equation in latex-mathml.org is not numbered, I would >> expect this if it was using a begin{equation*} environment but not a >> begin{equation}. > > Currently the odt exporter doesn't peek in to the latex fragment and > infer what manner of equation it is. This is something that I could take > up ... As thing stand today, to produce a numbered equation just attach #+LABEL: to it. This is how odt exporter determines when a formula is numbered or not. -- ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels 2011-11-01 19:39 ` Jambunathan K 2011-11-01 19:49 ` Jambunathan K @ 2011-11-02 13:18 ` Myles English [not found] ` <mylesenglish@gmail.com> 1 sibling, 1 reply; 22+ messages in thread From: Myles English @ 2011-11-02 13:18 UTC (permalink / raw) To: emacs-orgmode Jambunathan, >> On Wed, 02 Nov 2011 01:09:41 +0530, Jambunathan K said: > Myles > (I have read the followup post to this set of questions) > Myles English <mylesenglish@gmail.com> writes: >>>> On Mon, 31 Oct 2011 03:41:18 +0530, Jambunathan K said: >> >> > Myles English <mylesenglish@gmail.com> writes: >> I have found >> that Equations become labelled as Figures in the >> version I am >> using: >> >> >> >> emacs 23.3.1 org-mode from git commit 71f1c1be (Oct 26) The test >> >> equations in latex-mathml.org in this message: >> >> >> >> >> http://lists.gnu.org/archive/html/emacs-orgmode/2011-09/msg00198.html >> >> >> >> are labelled as "Equation" in the odt files but when I export it >> >> fresh I get "Figure". >> >> > This was a regression. I pushed a fix few moments ago. Could you >> > please pull again? >> >> Thanks for the push, there are three things I notice now: >> >> 1) my document won't open and causes libreoffice to crash! I get: >> "terminate called after throwing an instance of what(): >> vector::_M_default_append" on the command line > 1. You are using custom styles for your latex fragment > 2. latex-to-mathml converter - as it stands today - assumes the > latex fragment is completed in and of itself and doesn't honor the > style settings. > Putting 1 and 2 together, I am assuming that the XML created by the > ODT emitter contains garbage which is causing LibreOffice to be > confused. In my observation, ill-formed XML triggers "file is > corrupt and should I repair the file?" from LibreOffice. A crash > seems strange to me. There is (git from a couple of days ago) a problem with referring to equations containing an underscore in the label, I am fairly sure it was allowed before, e.g.: --8<---------------cut here---------------start------------->8--- #+LABEL: Equation:new_eq \begin{equation} x=\sqrt{b} \end{equation} Referring to an equation with an underscore: \ref{Equation:new_eq} --8<---------------cut here---------------end--------------->8--- I get a libreoffice popup: "Read Error. Format error discovered in the file in sub-document content.xmlat 2236,92(row,col)." I think it was many of these errors that caused the crash. > 1. http://article.gmane.org/gmane.emacs.orgmode/48714 - Above link > has my note on -ncf option to mathtoweb > 2. http://orgmode.org/worg/org-faq.html - Above link has a note on > how to debug corrupt odt files. (Hint: search for corrupt) >> 2) the first equation in latex-mathml.org is not numbered, I would >> expect this if it was using a begin{equation*} environment but not >> a begin{equation}. > Currently the odt exporter doesn't peek in to the latex fragment and > infer what manner of equation it is. This is something that I could > take up ... > ,---- | (defvar org-latex-regexps | '(("begin" "^[ > \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t) > | ;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ > \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ > .,?;:'\")]\\|$\\)" 2 nil) | ;; \000 in the following regex is needed > for org-inside-LaTeX-fragment-p | ("$1" "\\([^$]\\|^\\)\\(\\$[^ > \r\n,;.$]\\$\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil) | ("$" > "\\([^$]\\|^\\)\\(\\(\\$\\([^ > \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ > \r\n,.$]\\)\\$\\)\\)\\([- .,?;:'\")\000]\\|$\\)" 2 nil) | ("\\(" > "\\\\([^\000]*?\\\\)" 0 nil) | ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 > nil) | ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil)) | "Regular expressions > for matching embedded LaTeX.") `---- Crikey! That's quite a regexp. I think the only consideration is whether you want it to be consistent with pdf export. Taking consistency to an extreme could lead to a new #+begin_equation block (<-- I haven't thought this through at all). Having said that I am happy with the way it works at the moment. >> 3) the second equation looks a bit like this: >> >> x=root(b) (1) Radicals >> >> but I would have expected something like: >> >> x=root(b) Equation 1.: Radicals >> >> Is there a new variable that I need to set to get (e.g.) "Equation >> 1."? > Being a non-latex user, I am not familiar with what the usual > practice is. If the latter option is how captioned equations are > normally typeset I can take it up. Can you confirm that the > expectations above are *not* your own but that of *any* user? Actually I have changed my mind, it does look better like that, it is just that is was different behaviour to what happened before. Myles ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <mylesenglish@gmail.com>]
* Re: [odt] equation labels [not found] ` <mylesenglish@gmail.com> @ 2011-11-02 13:38 ` Nick Dokos 2011-11-02 14:49 ` Myles English 2011-11-02 14:52 ` Nick Dokos 1 sibling, 1 reply; 22+ messages in thread From: Nick Dokos @ 2011-11-02 13:38 UTC (permalink / raw) To: emacs-orgmode; +Cc: nicholas.dokos Myles English <mylesenglish@gmail.com> wrote: > > There is (git from a couple of days ago) a problem with referring to > equations containing an underscore in the label, I am fairly sure it was > allowed before, e.g.: > > #+LABEL: Equation:new_eq > \begin{equation} > x=\sqrt{b} > \end{equation} > > Referring to an equation with an underscore: \ref{Equation:new_eq} > > I get a libreoffice popup: > > "Read Error. Format error discovered in the file in sub-document > content.xmlat 2236,92(row,col)." > I can reproduce that and it may be a consequence of a change that I introduced at the top level export engine about six months ago. Let me take a look. Nick ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels 2011-11-02 13:38 ` Nick Dokos @ 2011-11-02 14:49 ` Myles English 0 siblings, 0 replies; 22+ messages in thread From: Myles English @ 2011-11-02 14:49 UTC (permalink / raw) To: emacs-orgmode Nick, >> On Wed, 02 Nov 2011 09:38:20 -0400, Nick Dokos said: > Myles English <mylesenglish@gmail.com> wrote: >> >> There is (git from a couple of days ago) a problem with referring >> to equations containing an underscore in the label, I am fairly >> sure it was allowed before, e.g.: >> >> #+LABEL: Equation:new_eq \begin{equation} x=\sqrt{b} \end{equation} >> >> Referring to an equation with an underscore: \ref{Equation:new_eq} >> >> I get a libreoffice popup: >> >> "Read Error. Format error discovered in the file in sub-document >> content.xmlat 2236,92(row,col)." >> > I can reproduce that and it may be a consequence of a change that I > introduced at the top level export engine about six months ago. Let > me take a look. > Nick I may be mistaken but I think it became broken more recently, circa 7th Oct. Myles ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels [not found] ` <mylesenglish@gmail.com> 2011-11-02 13:38 ` Nick Dokos @ 2011-11-02 14:52 ` Nick Dokos 2011-11-02 18:21 ` Jambunathan K 1 sibling, 1 reply; 22+ messages in thread From: Nick Dokos @ 2011-11-02 14:52 UTC (permalink / raw) To: emacs-orgmode; +Cc: nicholas.dokos Myles English <mylesenglish@gmail.com> wrote: > > Nick, > > >> On Wed, 02 Nov 2011 09:38:20 -0400, Nick Dokos said: > > > Myles English <mylesenglish@gmail.com> wrote: > >> > >> There is (git from a couple of days ago) a problem with referring > >> to equations containing an underscore in the label, I am fairly > >> sure it was allowed before, e.g.: > >> > >> #+LABEL: Equation:new_eq \begin{equation} x=\sqrt{b} \end{equation} > >> > >> Referring to an equation with an underscore: \ref{Equation:new_eq} > >> > >> I get a libreoffice popup: > >> > >> "Read Error. Format error discovered in the file in sub-document > >> content.xmlat 2236,92(row,col)." > >> > > > I can reproduce that and it may be a consequence of a change that I > > introduced at the top level export engine about six months ago. Let > > me take a look. > > > Nick > > I may be mistaken but I think it became broken more recently, circa 7th > Oct. > OK - phew (although I may not be out of the woods yet). It seems that the underscore in the link is interpreted as a subscript: ,---- | ... | Referring to an equation with an underscore: <text:sequence-ref text:ref-name="Equation:new<text:span text:style-name="OrgSubscript">eq</text:span>"/> `---- Thanks, Nick ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels 2011-11-02 14:52 ` Nick Dokos @ 2011-11-02 18:21 ` Jambunathan K 2011-11-02 21:33 ` Myles English 0 siblings, 1 reply; 22+ messages in thread From: Jambunathan K @ 2011-11-02 18:21 UTC (permalink / raw) To: Myles English; +Cc: nicholas.dokos, emacs-orgmode >> >> There is (git from a couple of days ago) a problem with referring >> >> to equations containing an underscore in the label, I am fairly >> >> sure it was allowed before, e.g.: >> >> >> >> #+LABEL: Equation:new_eq \begin{equation} x=\sqrt{b} \end{equation} >> >> >> >> Referring to an equation with an underscore: \ref{Equation:new_eq} >> >> >> >> I get a libreoffice popup: >> >> >> >> "Read Error. Format error discovered in the file in sub-document >> >> content.xmlat 2236,92(row,col)." >> >> > OK - phew (although I may not be out of the woods yet). It seems that the > underscore in the link is interpreted as a subscript: > > ,---- > | ... > | Referring to an equation with an underscore: <text:sequence-ref > | text:ref-name="Equation:new<text:span > | text:style-name="OrgSubscript">eq</text:span>"/> > `---- Nick, Thanks for debugging this and isolating the root cause. Myles, I have pushed a fix few minutes ago. Hope things are OK now. -- ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [odt] equation labels 2011-11-02 18:21 ` Jambunathan K @ 2011-11-02 21:33 ` Myles English 0 siblings, 0 replies; 22+ messages in thread From: Myles English @ 2011-11-02 21:33 UTC (permalink / raw) To: emacs-orgmode >> On Wed, 02 Nov 2011 23:51:31 +0530, Jambunathan K said: >> >> There is (git from a couple of days ago) a problem with referring >> >> to equations containing an underscore in the label, I am fairly >> >> sure it was allowed before, e.g.: >> >> >> >> #+LABEL: Equation:new_eq \begin{equation} x=\sqrt{b} \end{equation} >> >> >> >> Referring to an equation with an underscore: \ref{Equation:new_eq} >> >> >> >> I get a libreoffice popup: >> >> >> >> "Read Error. Format error discovered in the file in sub-document >> >> content.xmlat 2236,92(row,col)." >> >> >> OK - phew (although I may not be out of the woods yet). It seems >> that the underscore in the link is interpreted as a subscript: >> >> ,---- | ... | Referring to an equation with an underscore: >> <text:sequence-ref | text:ref-name="Equation:new<text:span | >> text:style-name="OrgSubscript">eq</text:span>"/> `---- > Nick, Thanks for debugging this and isolating the root cause. > Myles, I have pushed a fix few minutes ago. Hope things are OK now. References work fine now, Thanks. Myles ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2013-02-23 10:48 UTC | newest] Thread overview: 22+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-01-23 2:47 session with python-mode.el complains of void py-toggle-shells Myles English 2013-01-23 4:11 ` Nick Dokos 2013-01-23 12:46 ` [PATCH] " Myles English 2013-01-23 13:04 ` Bastien 2013-01-23 18:02 ` Andreas Röhler 2013-01-24 14:10 ` Bastien 2013-02-21 20:08 ` Andreas Röhler 2013-02-22 8:25 ` Andreas Röhler 2013-02-23 9:29 ` Bastien 2013-01-23 13:00 ` Bastien -- strict thread matches above, loose matches on Subject: below -- 2011-10-28 1:23 [odt] equation labels Myles English 2011-10-30 22:11 ` Jambunathan K 2011-10-31 11:54 ` Myles English 2011-11-01 11:17 ` Myles English 2011-11-01 19:39 ` Jambunathan K 2011-11-01 19:49 ` Jambunathan K 2011-11-02 13:18 ` Myles English [not found] ` <mylesenglish@gmail.com> 2011-11-02 13:38 ` Nick Dokos 2011-11-02 14:49 ` Myles English 2011-11-02 14:52 ` Nick Dokos 2011-11-02 18:21 ` Jambunathan K 2011-11-02 21:33 ` Myles English
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).