Re: [O] Preview LaTeX fragment not working (for me)

2013-09-11 Thread Rasmus
Hi Evan,

Evan Misshula  writes:

> I am trying to Preview LaTeX fragment (11.7.4).  I have the preview
> working in Preview LaTeX but when I (C-c C-x C-l) org-mode shows empty
> boxes.

AUCTeX Preview LaTeX didn't work with Org last time I tried, but I'm
not sure whether you're referring to this or Org's preview
capabilities (which lack a bit behind AUCTeX's).

> #+LATEX_HEADER: \usepackage{tikz}
> #+LATEX_HEADER: \usepackage{attrib}
> #+LATEX_HEADER: \usepackage{amsmath}
> #+LATEX_HEADER:
> \usepackage{/home/evan/Documents/chicago/learning/Causality/bug.sty}
> #+LATEX_HEADER: \let\iint\undefined
> #+LATEX_HEADER: \let\iiint\undefined
> #+LATEX_HEADER: \usepackage{dsfont}
> #+LATEX_HEADER: \usepackage[retainorgcmds]{IEEEtrantools}

Do try to cut it to a minimum example and use less exotic packages.  I
don't want to install new packages for the sake of trying your
example.

In any case, it's probably a conflict of packages (some functions may
be defined twice).  On my system the files used to generate images are
stored in the root of /tmp (on a GNU/Linux system).

Also, check out the variable org-format-latex-header.

Also, on previewing in general: Do you use org entities?  They make
stuff like this pretty readable.  If you need more readability you can
even create math matrices with Org-tables.

Hope it helps,
Rasmus

--
C is for Cookie




Re: [O] Link with spaces does not export properly in html

2013-09-11 Thread Nicolas Goaziou
Hello,

Simon  writes:

> My problem is that if an external link in my org document has %20 for spaces
> in and the document is then  exported for html, the %20 is changed to %2520.
> This means the link does note work in the exported document.
>
> Does anyone know how this issue can be resolved?

This was fixed in 8.1 release. You need to update Org.


Regards,

-- 
Nicolas Goaziou



Re: [O] `org-element-map' ignores type 'org-data'?

2013-09-11 Thread Nicolas Goaziou
Hello,

Thorsten Jolitz  writes:

> The returned mapped tree starts with the first (section (...)) element,
> org-data is simply ignored and missing. 
>
> How can I make `org-element-map' act on the 'org-data' element too?

You can't. This behaviour is hard-coded.


Regards,

-- 
Nicolas Goaziou



[O] [bug?][patch] Org LaTeX Fragments

2013-09-11 Thread Rasmus
Hi,

I don't know if this is a bug or a feature, but consider the following
test file:

#+BEGIN_SRC Org
#+TITLE: Fails when exporting
#+TITLE: Fails when exporting

* Instructions :noexport:

  1. Start =emacs -q=
  2. <> Run \src_emacs-lisp{(org-preview-latex-fragment)}
 - WORKS
  3. <> Run \src_emacs-lisp{(org-latex-export-to-pdf)} =./test.pdf=
 - FAILS

  [[p2]] works when [[p3]] fails because `org-format-latex-header`
  loads =amsmath=, but Org LaTeX export doesn't.  Why I don't know.

  *Proposal: Replace amstext with amsmath.*

* test
\begin{align}
x \mathcal{ABC}
\end{align}
#+END_SRC


The first patch adds amsmath as a dependency which fixes the above
bug.  According to my TeXLive it seems amstext is distributed with
amsmath, so I don't think that's an issue.  Increased load time?
Well, maybe.  I didn't test.

Will amstext be missed?  No, it's loaded by amsmath, currently line 120

 \RequirePackage{amstext}[1995/01/25]

The second patch removes the dependency on eucal.  Eucal provides an
alternative font for the mathcal macro.  Unless someone believes it's
better than the standard font, e.g. for small fonts, there is little
point in requiring it IMO.

We could also replace color with xcolor, which is the better
alternative, but I don't think it matters in this case and hence I
haven't provided a patch for that. 

–Rasmus

>From 8753024dca47d906e73f7963293b2174ae0f37fe Mon Sep 17 00:00:00 2001
From: rasmus 
Date: Wed, 11 Sep 2013 11:53:47 +0200
Subject: [PATCH 1/2] Add amsmath as a global LaTeX dependency

* org.el (org-format-latex-header): Remove amsmath.
(org-latex-default-packages-alist): Remove amstext and add amsmath.

This increases consistency between LaTeX exports and LaTeX preview
snippets.
---
 lisp/org.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 59a22a2..e8f25e9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3780,7 +3780,6 @@ images at the same place."
 
 (defcustom org-format-latex-header "\\documentclass{article}
 \\usepackage[usenames]{color}
-\\usepackage{amsmath}
 \\usepackage[mathscr]{eucal}
 \[PACKAGES]
 \[DEFAULT-PACKAGES]
@@ -3832,11 +3831,11 @@ header, or they will be appended."
 ("" "float" nil)
 ("" "wrapfig"   nil)
 ("normalem" "ulem"  t)
+("" "amsmath"   t)
 ("" "textcomp"  t)
 ("" "marvosym"  t)
 ("" "wasysym"   t)
 ("" "amssymb"   t)
-("" "amstext"   nil)
 ("" "hyperref"  nil)
 "\\tolerance=1000")
   "Alist of default packages to be inserted in the header.
@@ -3848,7 +3847,7 @@ The packages in this list are needed by one part or another of
 Org mode to function properly:
 
 - inputenc, fontenc:  for basic font and character selection
-- amstext: for subscript and superscript
+- amsmath: for subscript and superscript and math environments
 - textcomp, marvosymb, wasysym, amssymb: for various symbols used
   for interpreting the entities in `org-entities'.  You can skip
   some of these packages if you don't use any of their symbols.
-- 
1.8.4

>From 6c2139cc4275a426cedfbe548290b3c3f1b836a6 Mon Sep 17 00:00:00 2001
From: rasmus 
Date: Wed, 11 Sep 2013 11:58:08 +0200
Subject: [PATCH 2/2] Remove depedency on eucal for LaTeX fragments generation.

* org.el (org-format-latex-header): Remove eucal.

With amsmath loaded eucal (basically) only provides an alternative
typeface to \mathcal{.}
---
 lisp/org.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index e8f25e9..997e740 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3780,7 +3780,6 @@ images at the same place."
 
 (defcustom org-format-latex-header "\\documentclass{article}
 \\usepackage[usenames]{color}
-\\usepackage[mathscr]{eucal}
 \[PACKAGES]
 \[DEFAULT-PACKAGES]
 \\pagestyle{empty} % do not remove
-- 
1.8.4


--
There are known knowns; there are things we know that we know.


[O] [BUG] Re: How to trigger the clockcheck in an agenda view.

2013-09-11 Thread Sebastien Vauban
Hi Nicolas,

Nicolas Girard wrote:
> 2013/8/5 Sebastien Vauban :
>>
>> Except the above, I definitely don't understand why it wouldn't work for you.
>> Can you reproduce the problem with a minimal Emacs config file (adding the
>> require of `org' and `org-agenda' before)?
>
> I think I understand why Rainer has a problem.
>
> According to the docstring from `org-agenda-custom-commands', there
> are two acceptable syntaxes for defining a command:
> - the "simple" one : (key desc type match settings files)
> - and the "complex" or "composite" one : (key desc (cmd1 cmd2 ...)
> general-settings-for-whole-set files).
>
> Now, the following code defines two commands, who are functionally
> identical, but syntactically different. The first one uses the "simple"
> syntax, and the second one, the "complex" syntax.
>
> If you evaluate the code and trigger the agenda, you'll see that the
> first command *doesn't* work as expected, while the second works.

I confirm that I can reproduce the bug you've spotted.

Great finding you've done there... This is the kind of obvious thing very
difficult to spot...

And, in fact, the extract I sent early of August wasn't working for me. Well,
the same version from a multi-block agenda view. This completely corroborates
your sayings...

> (I just borrowed your scissors to delimit my code, hope you don't mind ;-) )

These are not mine: just the default ones when pressing `C-c M-m' when
composing a message in Emacs!

>   (setq org-agenda-custom-commands nil)
>   (setq org-agenda-custom-commands
> (append
>  org-agenda-custom-commands '(
>  ("G" "Good: Clock Review"
>   ((agenda ""
>((org-agenda-show-log 'clockcheck)
> (org-agenda-clockreport-mode t)
>  ("B"  "Bad: Clock Review"
>   agenda ""
>   ((org-agenda-show-log 'clockcheck)
>(org-agenda-clockreport-mode t))

Indeed, while G is good, B is not firing up the "clock check" as expected.

Best regards,
  Seb

--
Sebastien Vauban




[O] [BUG?] Duplicate agenda entries when enabling archives-mode

2013-09-11 Thread Sebastien Vauban
Hello,

If you use the following block of code, you'll see that all your entries are
duplicated.

For a clock review, this is much worse, as Org will warn about clocking
overlaps everywhere... (because multiple entries, then, happened at the same
time).

--8<---cut here---start->8---
(setq org-agenda-custom-commands nil)

(add-to-list 'org-agenda-custom-commands
 '("C" "Clock Review"
   ((agenda ""
(
 (org-agenda-archives-mode t) ;; <<<
 (org-agenda-clockreport-mode t)
 (org-agenda-overriding-header "Clocking Review")
 (org-agenda-show-log 'clockcheck)
 (org-agenda-span 'day))) t)))
--8<---cut here---end--->8---

Putting the `archives-mode' line in comments does solve the problem.

Best regards,
  Seb

-- 
Sebastien Vauban




[O] [export] Should sidewaystable option automatically add rotating package?

2013-09-11 Thread Eric S Fraga
Hi,

A minor feature request.  Feel free to ignore!

Using the sidewaystable :float option for table exports to LaTeX
requires one to manually add a 

  #+LaTeX_header: \usepackage{rotating}

line to the org file.  Could this package be added automatically by the
exporter if the sidewaystable option is present?

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5




Re: [O] Outline cycling does not preserve point's position

2013-09-11 Thread Nicolas Goaziou
Hello,

Jambunathan K  writes:

> Some suggestions:
>
> 1. Give a better name.  Say "pre-order" traversal of element in the
>parse tree. [1]

I don't know what "pre-order" means. What about
`org-flat-forward-element' or simply (but misleading) `org-forward-paragraph'?

> 3. When you say "Shouldn't be here", it means that point is NOT at the
>canonical C-down position.  But you do seem to "adjust" it to the
>canonical position down below.
>
>May be you want to remove it or say something more positive like - In
>the middle of nowhere.  Trying to get to the assembly point.

I don't understand. Are you talking about the error message? There is no
"canonical" C-down position, so I'm a bit confused.

>> New version:
>
> Couple of issues.
>
> 1. Visit the attached file.  Make sure everything is visible.
> 2. M-<
> 3. C-down gives a stacktrace.  See below.

Fixed.

> 1. Move to bol of the empty line that is in <<>> section.  
> That
>is not an empty line but has spaces.
>
> 2. C-down
>
> 3. Cursor does NOT do a stop over at "References" headline but skips
>past to References to Fuzzy Target

That was a bug in `org-element-at-point', which is now fixed. Thank you.
You'll need to update Org.


New version, with comments and docstring:

(defun org-forward-linear-element ()
  "Move forward to next element, ignoring depth.
The function implements some special moves for convenience:
  - On an affiliated keyword, jump to the beginning of the
relative element.
  - On an item or a footnote definition, move to the second
element inside, if any.
  - On a table, jump after it.
  - On a verse block, stop after each blank line."
  (interactive)
  (when (eobp) (user-error "Cannot move further down"))
  (let* ((origin (point))
 (element (org-element-at-point))
 (type (org-element-type element))
 (post-affiliated (org-element-property :post-affiliated element))
 (contents-begin (org-element-property :contents-begin element))
 (contents-end (org-element-property :contents-end element))
 (end (let ((end (org-element-property :end element)) (parent element))
(while (and (setq parent (org-element-property :parent parent))
(= (org-element-property :contents-end parent) end))
  (setq end (org-element-property :end parent)))
end)))
(skip-chars-forward " \r\t\n")
(or (eobp) (goto-char (max (line-beginning-position) origin)))
(cond ((or (eobp) (not end) (= (point) end)))
  ;; On affiliated keywords, move to element's beginning.
  ((and post-affiliated (< (point) post-affiliated))
   (goto-char post-affiliated))
  ;; At a table row, move to the end of the table.
  ((eq type 'table-row)
   (goto-char (org-element-property
   :end (org-element-property :parent element
  ((eq type 'table) (goto-char end))
  ((not contents-begin) (goto-char end))
  ;; If current element contents are invisible, skip the
  ;; element.
  ((outline-invisible-p (line-end-position))
   (if (not (eq type 'plain-list)) (goto-char end)
 ;; At a plain list, make sure we move to the next item
 ;; instead of skipping the whole list.
 (forward-char)
 (org-forward-linear-element)))
  ((< (point) contents-begin)
   (if (not (memq type '(footnote-definition item)))
   (goto-char contents-begin)
 ;; At footnote definitions and items, move to second
 ;; element, if any, or to next element otherwise.
 (end-of-line)
 (org-forward-linear-element)))
  ((>= (point) contents-end) (goto-char end))
  ((eq type 'paragraph) (goto-char end))
  ((eq type 'plain-list)
   (end-of-line)
   (org-forward-linear-element))
  ;; Verse blocks cannot contain paragraphs.  Though, we
  ;; emulate them with blank lines separators to ease
  ;; editing.
  ((eq type 'verse-block)
   (or (re-search-forward "^[ \t]*$" contents-end t)
   (goto-char end)))
  (t (error "This shouldn't happen")


Regards,

-- 
Nicolas Goaziou



[O] [BUG] Re: Troubles with custom agenda commands

2013-09-11 Thread Sebastien Vauban



Hi Bastien,

"Sebastien Vauban" wrote:
> Bastien wrote:
>> "Sebastien Vauban" writes:
>>
>>> When getting to the agenda dispatcher (`C-c a'), I see:
>>>
>>>S   Summary Review: set of 3 commands
>>>
>>>   while I only have... 2 commands (`agenda' and `todo'). Why?
>>
>> This is a bug, fixed.  Thanks for spotting this!
>
> Tested. Confirmed OK.

The above problem is back with the following configuration (tested with
"emacs -Q"):

--8<---cut here---start->8---
(add-to-list 'org-agenda-custom-commands
 '("C" "Clock Review"
   ((agenda ""
((org-agenda-clockreport-mode t)
 (org-agenda-overriding-header "Clocking Review")
 (org-agenda-show-log 'clockcheck)
 (org-agenda-span 'day))) t)))
--8<---cut here---end--->8---

Org writes:

--8<---cut here---start->8---
C   Clock Review  : set of 2 commands
n   Agenda and all TODO's: set of 2 commands
--8<---cut here---end--->8---

while there is only 1 command to be run (the agenda view)!?

Note, surprisingly, 2 extra spaces before the ":", while they're not in the
customized header string...

Best regards,
  Seb

-- 
Sebastien Vauban





[O] [bug] org-caldav-sync broken if entries have tables?

2013-09-11 Thread Eric S Fraga
Hello,

I have just upgraded both org and org-caldav and now I can no longer
sync to my Google calendar.  I get the following error:

Debugger entered--Lisp error: (args-out-of-range [left left right left] 4)
  org-export-table-cell-alignment((table-cell (:begin 49232 :end 49241 
  org-ascii-table-cell((table-cell (:begin 49232 :end 49241
  org-export-data((table-cell (:begin 49232 :end 49241 
  ...
  org-export-data((org-data nil (section (:begin 1 :end 103 
  org-export-as(icalendar nil nil t (:ascii-charset utf-8 
:icalendar-agenda-view nil))
  ...
  org-icalendar--combine-files(nil "~/s/notes/diary.org" 
"~/s/notes/googlecalendar.org")
  apply(org-icalendar--combine-files nil ("~/s/notes/diary.org" 
"~/s/notes/googlecalendar.org"))
  (if (featurep (quote ox-icalendar)) (apply (quote 
org-icalendar--combine-files) nil orgfiles) (apply (quote org-export-icalendar) 
t orgfiles))
  (let ((icalendar-file (if (featurep (quote ox-icalendar)) (quote 
org-icalendar-combined-agenda-file) (quote 
org-combined-agenda-icalendar-file))) (orgfiles (append org-caldav-files (list 
org-caldav-inbox))) (org-icalendar-store-UID t) 
(org-icalendar-include-bbdb-anniversaries nil) (icalendar-uid-format 
"orgsexp-%h") (org-icalendar-date-time-format (cond ((and 
org-icalendar-timezone (string= org-icalendar-timezone "UTC")) 
":%Y%m%dT%H%M%SZ") (org-icalendar-timezone ";TZID=%Z:%Y%m%dT%H%M%S") (t 
":%Y%m%dT%H%M%S" (set icalendar-file (make-temp-file "org-caldav-")) 
(org-caldav-debug-print 1 (format "Generating ICS file %s." (symbol-value 
icalendar-file))) (if (featurep (quote ox-icalendar)) (apply (quote 
org-icalendar--combine-files) nil orgfiles) (apply (quote org-export-icalendar) 
t orgfiles)) (find-file-noselect (symbol-value icalendar-file)))
  org-caldav-generate-ics()
  (setq org-caldav-ics-buffer (org-caldav-generate-ics))
  (if (and org-caldav-event-list (y-or-n-p "Last sync seems to have been 
aborted. Should I try to resume? ")) nil (setq org-caldav-ics-buffer 
(org-caldav-generate-ics)) (setq org-caldav-event-list nil) (setq 
org-caldav-sync-result nil) (org-caldav-load-sync-state) (progn (let 
((--dolist-tail-- org-caldav-event-list) cur) (while --dolist-tail-- (setq cur 
(car --dolist-tail--)) (org-caldav-event-set-status cur nil) (setq 
--dolist-tail-- (cdr --dolist-tail--) (org-caldav-update-eventdb-from-org 
org-caldav-ics-buffer) (org-caldav-update-eventdb-from-cal))
  org-caldav-sync()
  call-interactively(org-caldav-sync nil nil)
  command-execute(org-caldav-sync)

  
There is nothing particularly strange about the table found at location
49232 in my diary.

Deleting the table and one other, possibly leaving no tables in my
diary, allows syncing to work again.

thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5




Re: [O] [BUG] Re: Troubles with custom agenda commands

2013-09-11 Thread Sebastien Vauban
Hi Bastien,

"Sebastien Vauban" wrote:
> "Sebastien Vauban" wrote:
>> Bastien wrote:
>>> "Sebastien Vauban" writes:
>>>
 When getting to the agenda dispatcher (`C-c a'), I see:

S   Summary Review: set of 3 commands

   while I only have... 2 commands (`agenda' and `todo'). Why?
>>>
>>> This is a bug, fixed.  Thanks for spotting this!
>>
>> Tested. Confirmed OK.
>
> The above problem is back with the following configuration (tested with
> "emacs -Q"):
>
> (add-to-list 'org-agenda-custom-commands
>  '("C" "Clock Review"
>((agenda ""
> ((org-agenda-clockreport-mode t)
>  (org-agenda-overriding-header "Clocking Review")
>  (org-agenda-show-log 'clockcheck)
>  (org-agenda-span 'day))) t)))
>
> Org writes:
>
> C   Clock Review  : set of 2 commands
> n   Agenda and all TODO's: set of 2 commands
>
> while there is only 1 command to be run (the agenda view)!?

Please IGNORE IT!  This "bug" is due to a faulty placement of the parenthesis.

It should have been:

> (add-to-list 'org-agenda-custom-commands
>  '("C" "Clock Review"
>((agenda ""
> ((org-agenda-clockreport-mode t)
>  (org-agenda-overriding-header "Clocking Review")
>  (org-agenda-show-log 'clockcheck)
>  (org-agenda-span 'day) t)
   ^^
Sorry for this false alarm.

> Note, surprisingly, 2 extra spaces before the ":", while they're not in the
> customized header string...

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] [export] Should sidewaystable option automatically add rotating package?

2013-09-11 Thread Rasmus
Hi Eric,

Eric S Fraga  writes:
> A minor feature request.  Feel free to ignore!
>
> Using the sidewaystable :float option for table exports to LaTeX
> requires one to manually add a 
>
>   #+LaTeX_header: \usepackage{rotating}
>
> line to the org file.  Could this package be added automatically by the
> exporter if the sidewaystable option is present?

My 2¢:

I think the policy is that the ox-latex ain't going to track packages.
Aaron made some patches for this some time ago, but they weren't
included.

So the question is should it be a default package?

I think not.  E.g. tabu isn't loaded.  Amsmath isn't loaded if you
generate a matrix.  Also, a kitten dies every time the length of
org-latex-default-packages-alist increases!

–Rasmus

-- 
When in doubt, do it!




Re: [O] [export] Should sidewaystable option automatically add rotating package?

2013-09-11 Thread Eric S Fraga
Rasmus  writes:

> Hi Eric,
>
> Eric S Fraga  writes:
>> A minor feature request.  Feel free to ignore!
>>
>> Using the sidewaystable :float option for table exports to LaTeX
>> requires one to manually add a 
>>
>>   #+LaTeX_header: \usepackage{rotating}
>>
>> line to the org file.  Could this package be added automatically by the
>> exporter if the sidewaystable option is present?
>
> My 2¢:
>
> I think the policy is that the ox-latex ain't going to track packages.
> Aaron made some patches for this some time ago, but they weren't
> included.
>
> So the question is should it be a default package?
>
> I think not.  E.g. tabu isn't loaded.  Amsmath isn't loaded if you
> generate a matrix.  

Okay.  I can live with this!  

I guess it would help if the documentation indicated when additional
packages may be required.  I had to do an internet search to find out I
needed the rotating package for the sidewaystable option described in
the org info pages.

> Also, a kitten dies every time the length of
> org-latex-default-packages-alist increases!

;-)

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5




Re: [O] [export] Should sidewaystable option automatically add rotating package?

2013-09-11 Thread Carsten Dominik

On 11.9.2013, at 14:08, Eric S Fraga  wrote:

> Rasmus  writes:
> 
>> Hi Eric,
>> 
>> Eric S Fraga  writes:
>>> A minor feature request.  Feel free to ignore!
>>> 
>>> Using the sidewaystable :float option for table exports to LaTeX
>>> requires one to manually add a 
>>> 
>>>  #+LaTeX_header: \usepackage{rotating}
>>> 
>>> line to the org file.  Could this package be added automatically by the
>>> exporter if the sidewaystable option is present?
>> 
>> My 2¢:
>> 
>> I think the policy is that the ox-latex ain't going to track packages.
>> Aaron made some patches for this some time ago, but they weren't
>> included.
>> 
>> So the question is should it be a default package?
>> 
>> I think not.  E.g. tabu isn't loaded.  Amsmath isn't loaded if you
>> generate a matrix.  
> 
> Okay.  I can live with this!  
> 
> I guess it would help if the documentation indicated when additional
> packages may be required.  I had to do an internet search to find out I
> needed the rotating package for the sidewaystable option described in
> the org info pages.

Well, this is documented on the LaTeX pages.  Why would you duplicate this
in Org's documentation?  And What part of the LaTeX documentation exactly?

> 
>> Also, a kitten dies every time the length of
>> org-latex-default-packages-alist increases!

That is a terrible thought. :)

> 
> ;-)
> 
> Thanks,
> eric
> 
> -- 
> : Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5
> 
> 



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [O] Outline cycling does not preserve point's position

2013-09-11 Thread Suvayu Ali
On Tue, Sep 10, 2013 at 11:08:23PM +0200, Carsten Dominik wrote:
> 
> And I agree with you, beginning of line is a good target column.

On reading Nicolas's explanation, I agree too.  This is better.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] [export] Should sidewaystable option automatically add rotating package?

2013-09-11 Thread Rasmus
Carsten Dominik  writes:

>> Okay.  I can live with this!  
>> 
>> I guess it would help if the documentation indicated when additional
>> packages may be required.  I had to do an internet search to find out I
>> needed the rotating package for the sidewaystable option described in
>> the org info pages.

It's fine with me if it's something like 

Float environment for the table. Possible values are sidewaystable
(requires

[[http://www.ctan.org/tex-archive/macros/latex/contrib/rotating][rotating]])...

> Well, this is documented on the LaTeX pages.

Worg doesn't ship with Emacs. . .

> Why would you duplicate this in Org's documentation?  And What part
> of the LaTeX documentation exactly?

Currently 12.7.4 LaTeX specific attributes under - placement :: ...,
it seems.


>>> Also, a kitten dies every time the length of
>>> org-latex-default-packages-alist increases!
>
> That is a terrible thought. :)

So don't add another symbol package! :)

–Rasmus

-- 
m-mm-mmm- bacon!



Re: [O] [export] Should sidewaystable option automatically add rotating package?

2013-09-11 Thread Rainer M Krug
Carsten Dominik  writes:

> On 11.9.2013, at 14:08, Eric S Fraga  wrote:
>
>> Rasmus  writes:
>> 
>>> Hi Eric,
>>> 
>>> Eric S Fraga  writes:
 A minor feature request.  Feel free to ignore!
 
 Using the sidewaystable :float option for table exports to LaTeX
 requires one to manually add a 
 
  #+LaTeX_header: \usepackage{rotating}
 
 line to the org file.  Could this package be added automatically by the
 exporter if the sidewaystable option is present?
>>> 
>>> My 2¢:
>>> 
>>> I think the policy is that the ox-latex ain't going to track packages.
>>> Aaron made some patches for this some time ago, but they weren't
>>> included.
>>> 
>>> So the question is should it be a default package?
>>> 
>>> I think not.  E.g. tabu isn't loaded.  Amsmath isn't loaded if you
>>> generate a matrix.  
>> 
>> Okay.  I can live with this!  
>> 
>> I guess it would help if the documentation indicated when additional
>> packages may be required.  I had to do an internet search to find out I
>> needed the rotating package for the sidewaystable option described in
>> the org info pages.
>
> Well, this is documented on the LaTeX pages.  Why would you duplicate this
> in Org's documentation?  And What part of the LaTeX documentation exactly?

It certainly is, but the beauty of org is that it hides some of the
nitty-gritty to write LaTeX files (and odt - even more so).

One part would be 12.7.4 - LaTeX specific attributes.

It states:

,
| :placement 
| Float environment for the table. Possible values are
| sidewaystable, multicolumn, t and nil. When unspecified, a table with a
| caption will have a table environment. Moreover, :placement attribute
| can specify the positioning of the float.
`

An addition like:

,
| For some options, additional LaTeX packages need to be loaded. Please
| see LaTeX documentation for details.
`

Would suffice, and be general enough.

Cheers,

Rainer

>
>> 
>>> Also, a kitten dies every time the length of
>>> org-latex-default-packages-alist increases!
>
> That is a terrible thought. :)
>
>> 
>> ;-)
>> 
>> Thanks,
>> eric
>> 
>> -- 
>> : Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5
>> 
>> 
>
<#secure method=pgpmime mode=sign>

-- 
Rainer M. Krug

email: RMKruggmailcom




[O] [BUG] org-time-clock%

2013-09-11 Thread Pierre-Henry Frohring
Hi !

org-time-clock% gives me unexpected result.  
One could reproduce the bug using the code below or attached file.

configuration :
emacs-version : GNU Emacs 24.3.1 (x86_64-apple-darwin, NS 
apple-appkit-1038.36) of 2013-03-13 on bob.porkrind.org
org-version : Org-mode version 8.1.1

* results
** expected result
   #+BEGIN: clocktable :maxlevel 1 :scope file :formula %
   #+CAPTION: Clock summary at [2013-09-11 Mer 14:31]
   | Headline | Time  | % |
   |--+---+---|
   | *Total time* | *4d 0:00* | 100.0 |
   |--+---+---|
   | task_1   | 2d 0:00   |  50.0 |
   | task_2   | 1d 0:00   |  25.0 |
   | task_3   | 1d 0:00   |  25.0 |
   #+TBLFM: $3='(org-clock-time% @2$2 $2..$2);%.1f
   #+END:

** result obtained
   #+BEGIN: clocktable :maxlevel 1 :scope file :formula %
   #+CAPTION: Clock summary at [2013-09-11 Mer 14:39]
   | Headline | Time  |   % |
   |--+---+-|
   | *Total time* | *4d 0:00* | 0.0 |
   |--+---+-|
   | task_1   | 2d 0:00   | 0.0 |
   | task_2   | 1d 0:00   | 0.0 |
   | task_3   | 1d 0:00   | 0.0 |
   #+TBLFM: $3='(org-clock-time% @2$2 $2..$2);%.1f
   #+END:




=




#+BEGIN: clocktable :maxlevel 1 :scope file :formula %
#+CAPTION: Clock summary at [2013-09-11 Mer 14:31]
| Headline | Time  | % |
|--+---+---|
| *Total time* | *4d 0:00* | 100.0 |
|--+---+---|
| task_1   | 2d 0:00   |  50.0 |
| task_2   | 1d 0:00   |  25.0 |
| task_3   | 1d 0:00   |  25.0 |
#+TBLFM: $3='(org-clock-time% @2$2 $2..$2);%.1f
#+END:


* task_1
  CLOCK: [2013-09-09 Lun 14:16]--[2013-09-11 Mer 14:16] => 48:00

* task_2
  CLOCK: [2013-09-10 Mar 14:16]--[2013-09-11 Mer 14:16] => 24:00

* task_3
  CLOCK: [2013-09-10 Mar 14:16]--[2013-09-11 Mer 14:16] => 24:00

* org-clock-time%
** org-mode-8.1.1/lisp/org-clock.el

 #+BEGIN_SRC elisp

   (defun org-clock-time% (total &rest strings)
 "Compute a time fraction in percent.
   TOTAL s a time string like 10:21 specifying the total times.
   STRINGS is a list of strings that should be checked for a time.
   The first string that does have a time will be used.
   This function is made for clock tables."
 (let ((re "\\([0-9]+\\):\\([0-9]+\\)")
   tot s)
   (save-match-data
 (catch 'exit
   (if (not (string-match re total))
   (throw 'exit 0.)
 (setq tot (+ (string-to-number (match-string 2 total))
  (* 60 (string-to-number (match-string 1 total)
 (if (= tot 0.) (throw 'exit 0.)))
   (while (setq s (pop strings))
 (if (string-match "\\([0-9]+\\):\\([0-9]+\\)" s)
 (throw 'exit
(/ (* 100.0 (+ (string-to-number (match-string 2 s))
   (* 60 (string-to-number
  (match-string 1 s)
   tot
   0

 #+END_SRC

 #+RESULTS:
 : org-clock-time%

** fixed/org-clock-time%
#+BEGIN_SRC elisp

  (defun org-clock-time% (total &rest strings)
"Compute a time fraction in percent.
  TOTAL is a time string like '1d 10:21' specifying the total times.
  STRINGS is a list of strings that should be checked for a time.
  The first string that does have a time will be used.
  This function is made for clock tables."

(let (str-to-min
  (tot 0)
  s)

  ;; "([0-9]+d)? [0-9]+:[0-9]+" -> minutes
  (setq str-to-min
(lambda (clock)
  (let ((re 
"\\(\\([0-9]+\\)d[[:space:]]\\)?\\([0-9]+\\):\\([0-9]+\\)"))
(save-match-data
  (catch 'exit
(if (not (string-match re clock))
;; ill formatted => 0
(throw 'exit 0.)

  (+ (string-to-number (match-string 4 clock))
 (* 60 (string-to-number (match-string 3 clock)))
 (* 60 24 (if (match-string 2 clock)
  (string-to-number (match-string 2 clock))
0)

  ;; compute time fraction in percent
  (catch 'exit
(setq tot (funcall str-to-min total))
(if (= tot 0.) (throw 'exit 0.))
(while (setq s (pop strings))
  (throw 'exit
 (/ (* 100.0 (funcall str-to-min s))
tot)))
0)))

#+END_SRC

#+RESULTS:
: org-clock-time%



test-org-clocktable.org
Description: Binary data


[O] [BUG] Colored tags generate an error when C-x C-w'ing the agenda

2013-09-11 Thread Sebastien Vauban
Hello,

If you have colors for tags:

--8<---cut here---start->8---
  ;; faces for specific tags
  (setq org-tag-faces
'(("home" .
   (:slant italic
:foreground "#5C88D3" :background "#BBDDFF"))
  ("work" .
   (:slant italic
:foreground "#5F7C43" :background "#C1D996"
--8<---cut here---end--->8---

you can't export the agenda views anymore; they all generate the following
error:

#+begin_src text
  Debugger entered--Lisp error: (wrong-type-argument listp "#5C88D3")
ps-face-attributes("#5C88D3")
ps-face-attribute-list((:slant italic :foreground "#5C88D3" :background 
"#BBDDFF"))
ps-plot-with-face(459 463 (:slant italic :foreground "#5C88D3" :background 
"#BBDDFF"))
ps-generate-postscript-with-faces1(1 6850)
ps-generate-postscript-with-faces(1 6850)
ps-generate(# 1 6850 ps-generate-postscript-with-faces)
ps-spool-with-faces(1 6850 nil)
ps-print-with-faces(1 6850 "~/agenda.ps")
ps-print-buffer-with-faces("~/agenda.ps")
...
command-execute(org-agenda-write)
#+end_src

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] [bug] org-caldav-sync broken if entries have tables?

2013-09-11 Thread Nicolas Goaziou
Hello,

Eric S Fraga  writes:

> I have just upgraded both org and org-caldav and now I can no longer
> sync to my Google calendar.  I get the following error:

[...]

> There is nothing particularly strange about the table found at location
> 49232 in my diary.

Are you able to export a buffer (with any export back-end) containing
only that table?


Regards,

-- 
Nicolas Goaziou



[O] How to insert fraction and other math inside tables?

2013-09-11 Thread Hans Bale
How do I insert eg. \frac{1}{2} inside a table?

Following does not seem to work

|text   |some more text|
|---+--|
|\frac{1}{2}| \frac{1}{3}  |


Exporting to html, the .html it is displayed as:  
   
|text   |some more text|
|---+--|
|\frac{1}{2}| \frac{1}{3}  |


Enclosing with \( ... \) does not work properly, after exporting the .html shows

|text   |some more text|
|---+--|
|   |  |






Re: [O] error message at line break

2013-09-11 Thread henry atting
henry atting  writes:

> Nicolas Goaziou  writes:
>
>> Hello,
>>
>> henry atting  writes:
>>
>>> When writing at every automatic break at the end of a line I get this
>>> error message:
>>>
>>> org-comment-line-break-function: Wrong type argument: char-or-string-p,
>>> nil
>>>
>>> It doesn't hurt much though it's a bit annoying. 
>>>
>>> Org-mode version 8.1.1 (release_8.1.1-7-gaecdf5-git)
>>
>> I cannot reproduce the problem. Could you check your installation?
>>
> Ah, I see, it has something to do with org-tree-slide. I start
> tree-slide as default with a hook and disable it when I work on an org
> file.
> As this problem is very special I will not explain it further (but if
> someone is interested I will do so)
>

I'm sorry my mistake. 
This has nothing to do with tree-slide. It happens with each org file
without header when you do not indent the first two lines at least
one space.

Regards,
henry





Re: [O] [bug?][patch] Org LaTeX Fragments

2013-09-11 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> I don't know if this is a bug or a feature, but consider the following
> test file:
>
> #+BEGIN_SRC Org
> #+TITLE: Fails when exporting
> #+TITLE: Fails when exporting
>
> * Instructions   
> :noexport:
>
>   1. Start =emacs -q=
>   2. <> Run \src_emacs-lisp{(org-preview-latex-fragment)}
>  - WORKS
>   3. <> Run \src_emacs-lisp{(org-latex-export-to-pdf)} =./test.pdf=
>  - FAILS
>
>   [[p2]] works when [[p3]] fails because `org-format-latex-header`
>   loads =amsmath=, but Org LaTeX export doesn't.  Why I don't know.
>
>   *Proposal: Replace amstext with amsmath.*
>
> * test
> \begin{align}
> x \mathcal{ABC}
> \end{align}
> #+END_SRC

I think `org-format-latex-header' shouldn't load amsmath at all.

> The first patch adds amsmath as a dependency which fixes the above
> bug.  According to my TeXLive it seems amstext is distributed with
> amsmath, so I don't think that's an issue.  Increased load time?
> Well, maybe.  I didn't test.

It's not about load time, but about compatibility with other packages.
I think some of them don't coexist well with amsmath. "amssymb" and
"amstext" are less demanding in that area.


Regards,

-- 
Nicolas Goaziou



[O] [wish, detail] Resume ordered lists

2013-09-11 Thread Sebastien Vauban
Hello,

Currently, ordered list items may be (re-)started with a different value
(e.g., 20), by writing the item with `[@20]'.

A nice-to-have feature would be the ability to resume a list at the previous
value + 1, such as:

  ╭
  │ 1. This
  │ 2. That
  │ 
  │ Some intermediate paragraph.
  │ 
  │ 3. [@resume] Those
  ╰

That would allow for more efficiency when adding or deleting items from the
previous list.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] error message at line break

2013-09-11 Thread Nicolas Goaziou
Hello,

henry atting  writes:

> It happens with each org file without header when you do not indent
> the first two lines at least one space.

Could you provide an ECM?


Regards,

-- 
Nicolas Goaziou



Re: [O] error message at line break

2013-09-11 Thread henry atting
Nicolas Goaziou  writes:

> Hello,
>
> henry atting  writes:
>
>> It happens with each org file without header when you do not indent
>> the first two lines at least one space.
>
> Could you provide an ECM?
>
Okay, say I have an org file with two lines in it (fill-column is set to
70). Here you go:

--8<---cut here---start->8---
Jemand mußte Josef K. verleumdet haben, denn ohne daß er etwas Boeses
getan haette, wurde er eines Morgens verhaftet. Die Koechin der Frau
--8<---cut here---end--->8---

Then you go on with the text, which is:

Grubach, seiner Zimmervermieterin, die ihm jeden Tag gegen acht Uhr frueh
das Fruehstueck brachte,...

At each automatic line skip I get the mentioned error message. But if
you indent these two lines one space everything works fine.

>
> Regards,

Regards,
henry




Re: [O] Outline cycling does not preserve point's position

2013-09-11 Thread Nicolas Goaziou
Jambunathan K  writes:

> `org-forward-paragraph' is much better.  As long as the docstring or
> comments mention that Org's notion of paragraph is much more nuanced or
> richer than a text-mode's notion of paragraph.  

OK. Suggestions welcome.

Meanwhile, here is an updated version for the function:

(defun org-forward-linear-element ()
  "Move forward to next element, ignoring depth.
The function implements some special moves for convenience:
  - On an affiliated keyword, jump to the beginning of the
relative element.
  - On an item or a footnote definition, move to the second
element inside, if any.
  - On a table, jump after it.
  - On a verse block, stop after each blank line."
  (interactive)
  (when (eobp) (user-error "Cannot move further down"))
  (let* ((element (org-element-at-point))
 (type (org-element-type element))
 (post-affiliated (org-element-property :post-affiliated element))
 (contents-begin (org-element-property :contents-begin element))
 (contents-end (org-element-property :contents-end element))
 (end (let ((end (org-element-property :end element)) (parent element))
(while (and (setq parent (org-element-property :parent parent))
(= (org-element-property :contents-end parent) end))
  (setq end (org-element-property :end parent)))
end)))
(cond ((not element)
   (skip-chars-forward " \r\t\n")
   (or (eobp) (beginning-of-line)))
  ;; On affiliated keywords, move to element's beginning.
  ((and post-affiliated (< (point) post-affiliated))
   (goto-char post-affiliated))
  ;; At a table row, move to the end of the table.
  ((eq type 'table-row)
   (goto-char (org-element-property
   :end (org-element-property :parent element
  ((eq type 'table) (goto-char end))
  ((not contents-begin) (goto-char end))
  ;; If current element contents are invisible, skip the
  ;; element altogether.
  ((outline-invisible-p (line-end-position))
   (if (not (eq type 'plain-list)) (goto-char end)
 ;; At a plain list, make sure we move to the next item
 ;; instead of skipping the whole list.
 (forward-char)
 (org-forward-linear-element)))
  ((>= (point) contents-end) (goto-char end))
  ((>= (point) contents-begin)
   ;; Handle special cases.  In all other situations, point
   ;; is where it should be.
   (case type
 (paragraph (goto-char end))
 ;; At a plain list, try to move to second element in
 ;; first item, if possible.
 (plain-list (end-of-line)
 (org-forward-linear-element))
 ;; Consider blank lines as separators in verse blocks to
 ;; ease editing.
 (verse-block
  (beginning-of-line)
  (if (not (re-search-forward "^[ \t]*$" contents-end t))
  (goto-char end)
(skip-chars-forward " \r\t\n")
(if (= (point) contents-end) (goto-char contents)
  (beginning-of-line))
  ;; When contents start on the middle of a line (e.g. in
  ;; items and footnote definitions), try to reach first
  ;; element starting after current line.
  ((> (line-end-position) contents-begin)
   (end-of-line)
   (org-forward-linear-element))
  (t (goto-char contents-begin)


Regards,

-- 
Nicolas Goaziou



Re: [O] Outline cycling does not preserve point's position

2013-09-11 Thread Nicolas Goaziou
Jambunathan K  writes:

> Nicolas Goaziou  writes:
>
>> I don't understand. Are you talking about the error message? There is no
>> "canonical" C-down position, so I'm a bit confused.
>
> Put your cursor on the blank line between.  Do a C-down.  You will see
> the cursor moving and also an error reported.  So, the "empty line" is a
> position where a C-down operation would land you in.  It is a position
> from nowhere.

I don't think it happens in latest version.

> I see some issues when the point is position some where deep inside
> invisible parts of the tree.
>
> For example, visit
>
> "~/src/worg/org-tutorials/org-reference-guide-es.org"
>
> Get in to a state where ALL headlines are visible but none of body text
> is visible.
>
> Position your cursor randomly, like so.
>
>M-: (goto-char (mod (random) (point-max)))
>
> Then C-down.
>
> Within let's say 10 attempts, you will see that a headline is skipped
> and the cursor lands on subsequent headline.

Fixed. This deserves a new version:

(defun org-forward-linear-element ()
  "Move forward to next element, ignoring depth.
The function implements some special moves for convenience:
  - On an affiliated keyword, jump to the beginning of the
relative element.
  - On an item or a footnote definition, move to the second
element inside, if any.
  - On a table, jump after it.
  - On a verse block, stop after each blank line."
  (interactive)
  (when (eobp) (user-error "Cannot move further down"))
  (let* ((element (org-element-at-point))
 (type (org-element-type element))
 (post-affiliated (org-element-property :post-affiliated element))
 (contents-begin (org-element-property :contents-begin element))
 (contents-end (org-element-property :contents-end element))
 (end (let ((end (org-element-property :end element)) (parent element))
(while (and (setq parent (org-element-property :parent parent))
(= (org-element-property :contents-end parent) end))
  (setq end (org-element-property :end parent)))
end)))
(cond ((not element)
   (skip-chars-forward " \r\t\n")
   (or (eobp) (beginning-of-line)))
  ;; On affiliated keywords, move to element's beginning.
  ((and post-affiliated (< (point) post-affiliated))
   (goto-char post-affiliated))
  ;; At a table row, move to the end of the table.
  ((eq type 'table-row)
   (goto-char (org-element-property
   :end (org-element-property :parent element
  ((eq type 'table) (goto-char end))
  ((not contents-begin) (goto-char end))
  ;; If current element contents are invisible, skip the
  ;; element altogether.
  ((outline-invisible-p (line-end-position))
   (case type
 (headline
  (org-with-limited-levels (outline-next-visible-heading 1)))
 ;; At a plain list, make sure we move to the next item
 ;; instead of skipping the whole list.
 (plain-list (forward-char)
 (org-forward-linear-element))
 (otherwise (goto-char end
  ((>= (point) contents-end) (goto-char end))
  ((>= (point) contents-begin)
   ;; Handle special cases.  In all other situations, point
   ;; is where it should be.
   (case type
 (paragraph (goto-char end))
 ;; At a plain list, try to move to second element in
 ;; first item, if possible.
 (plain-list (end-of-line)
 (org-forward-linear-element))
 ;; Consider blank lines as separators in verse blocks to
 ;; ease editing.
 (verse-block
  (beginning-of-line)
  (if (not (re-search-forward "^[ \t]*$" contents-end t))
  (goto-char end)
(skip-chars-forward " \r\t\n")
(if (= (point) contents-end) (goto-char contents)
  (beginning-of-line))
  ;; When contents start on the middle of a line (e.g. in
  ;; items and footnote definitions), try to reach first
  ;; element starting after current line.
  ((> (line-end-position) contents-begin)
   (end-of-line)
   (org-forward-linear-element))
  (t (goto-char contents-begin)


Regards,

-- 
Nicolas Goaziou



Re: [O] Inline plot with matplotlib

2013-09-11 Thread Johan Ekh
Thank you! This works!
/Johan


On Tue, Sep 10, 2013 at 1:08 AM, Rasmus  wrote:

> Johan Ekh  writes:
>
> > Hi all,
> > I would like to create a plot with matplotlib and have it exported to a
> > beamer presentation without storing the plot in a file. Is that possible?
>
> I guess you'd want to plot is as a pgf file, whether real of
> 'virtual'.  You could send the result to STDOUT but it may take a bit
> more effort.  Also, a simple test with sys.stdout says the pgf backend
> doesn't support stdout. . .
>
> If *printing* to a pgf file everything works out of the box in recent
> versions of Org.
>
> > Can someone point me to an example or a good starting point?
>
>   http://matplotlib.org/users/pgf.html
>
> Here's an example of a simple plot.
>
> #+TITLE: =matplotlib= and =pgf=
> #+LATEX_HEADER: \usepackage{pgf}
> #+NAME:spectrum
> #+BEGIN_SRC python :var OUT="test.pgf" :exports results :results value file
>   import matplotlib as mpl
>   pgf_with_pdflatex = {
>   "pgf.texsystem": "pdflatex",
>   "text.usetex": True,
>   'pgf.rcfonts': False,
>   'font.size': 9,
>   'fond.family': 'serif',
>   "pgf.preamble": [
>   r"\usepackage[utf8]{inputenc}",
>   r"\usepackage[T1]{fontenc}"]}
>   mpl.rcParams.update(pgf_with_pdflatex)
>   import matplotlib.pyplot as plt
>   from numpy import pi, cos, linspace
>   s1, t1, t2 = 1, .8, .2
>   s = lambda w: s1 / (2 * pi) * (1 + t1 ** 1 + t2 ** 2 + (1 + t2) * 2 * t1
> * cos(w) + 2 * t2 * cos(4 * w))
>   x = linspace(0, pi, 1000)
>   plt.figure(figsize=(4,1.5))
>   plt.plot(x, s(x))
>   plt.xlim( 0, pi)
>   plt.xlabel("$\\omega$")
>   plt.ylabel("Spectrum")
>   plt.tight_layout(0)
>   plt.savefig(OUT, format = 'pgf')
>   return(OUT)
> #+END_SRC
>
> #+RESULTS: spectrum
> [[file:test.pgf]]
>
>
>
>
> --
> . . . The proofs are technical in nature and provides no real
> understanding.
>
>
>
>
>
>


Re: [O] [bug?][patch] Org LaTeX Fragments

2013-09-11 Thread Rasmus
Nicolas Goaziou  writes:

> I think `org-format-latex-header' shouldn't load amsmath at all.

That's another possibility.

>> The first patch adds amsmath as a dependency which fixes the above
>> bug.  According to my TeXLive it seems amstext is distributed with
>> amsmath, so I don't think that's an issue.  Increased load time?
>> Well, maybe.  I didn't test.
>
> It's not about load time, but about compatibility with other packages.
> I think some of them don't coexist well with amsmath. "amssymb" and
> "amstext" are less demanding in that area.

Except for the odd, typically, symbol package that should be loaded
after amsmath I'm not aware of any such cases.  I thought that nath
might have been an issue, but even that supports amsmath.

http://www.ctan.org/tex-archive/macros/latex/contrib/nath

–Rasmus


-- 
The Kids call him Billy the Saint




[O] setting options to python interpreter for a code block

2013-09-11 Thread John Kitchin
Hi,
I am looking at a new strategy to capture stderr and exceptions in python
code blocks. Right now exceptions are not captured in the output, and
neither is stderr.

I made a little sandbox module that captures stdout, stderr, and exceptions
and then prints them all to stdout with some minor formatting. Here is an
example.

Say test.py has this content

#+BEGIN_SRC python
print 'hello'

print 4 + 6

import sys

print >>sys.stderr, 'message to stderr'


raise Exception('baboom')
#+END_SRC

When I use the sandbox, I get all the output on stdout like this.

#+BEGIN_SRC sh
python -m sandbox < test.py
# or cat test.py | python -m sandbox
#+END_SRC

#+RESULTS:
#+begin_example

--
hello
10


--
stderr:
message to stderr


--
Traceback (most recent call last):
  File "/home/jkitchin/Dropbox/pycse/pycse/sandbox/sandbox.py", line 16, in

exec(content, ns_globals, ns_locals)
  File "", line 10, in 
Exception: baboom


#+end_example


So, I was wondering how to get this to happen in org-mode on a regular
python block. I think it could work if I could define a custom interpreter
for a particular block, e.g. python-sandbox that takes the codeblock on
stdin.

Is there some other way that I could do this? Thanks!

John

---
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu


Re: [O] error message at line break

2013-09-11 Thread henry atting
Nicolas Goaziou  writes:

> Hello,
>
> henry atting  writes:
>
>> Okay, say I have an org file with two lines in it (fill-column is set to
>> 70). Here you go:
>>
>>
>> Jemand mußte Josef K. verleumdet haben, denn ohne daß er etwas Boeses
>> getan haette, wurde er eines Morgens verhaftet. Die Koechin der Frau
>>
>>
>> Then you go on with the text, which is:
>>
>> Grubach, seiner Zimmervermieterin, die ihm jeden Tag gegen acht Uhr frueh
>> das Fruehstueck brachte,...
>>
>> At each automatic line skip I get the mentioned error message. But if
>> you indent these two lines one space everything works fine.
>
> Strange, I still cannot reproduce it.
>
Strange, in deed. I can reproduce it even this way:

1. Start emacs with `emacs -Q'
2. Add my org directory to the load path 
3. Load org-mode
4. Then type the above quoted beginning of Kafka's Prozess

> Regards,

Greetings
henry



Re: [O] [export] Should sidewaystable option automatically add rotating package?

2013-09-11 Thread Eric S Fraga
Rasmus  writes:

> Carsten Dominik  writes:
>
>>> Okay.  I can live with this!  
>>> 
>>> I guess it would help if the documentation indicated when additional
>>> packages may be required.  I had to do an internet search to find out I
>>> needed the rotating package for the sidewaystable option described in
>>> the org info pages.
>
> It's fine with me if it's something like 
>
> Float environment for the table. Possible values are sidewaystable
> (requires
> 
> [[http://www.ctan.org/tex-archive/macros/latex/contrib/rotating][rotating]])...

I think this would be ideal.

thanks,
eric
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5




Re: [O] error message at line break

2013-09-11 Thread Nicolas Goaziou
Hello,

henry atting  writes:

> Okay, say I have an org file with two lines in it (fill-column is set to
> 70). Here you go:
>
>
> Jemand mußte Josef K. verleumdet haben, denn ohne daß er etwas Boeses
> getan haette, wurde er eines Morgens verhaftet. Die Koechin der Frau
>
>
> Then you go on with the text, which is:
>
> Grubach, seiner Zimmervermieterin, die ihm jeden Tag gegen acht Uhr frueh
> das Fruehstueck brachte,...
>
> At each automatic line skip I get the mentioned error message. But if
> you indent these two lines one space everything works fine.

Strange, I still cannot reproduce it.


Regards,

-- 
Nicolas Goaziou



Re: [O] Outline cycling does not preserve point's position

2013-09-11 Thread Nicolas Goaziou


Jambunathan K  writes:

> Hmmm... Object traversal.  
>
> Now there should be a way to move between objects: Move to the next
> object of the same type the cursor is on.

This is interesting but not really possible at the moment. Currently
Elements implement "successors" functions, which are basically
a `re-search-forward' on some hard coded regexp and a predicate to check
if we're really where we think we are. So moving to the next object is
easy, but moving to the previous one would be awkward.

In order to allow this, we should first change the innards of Elements
and split "successors" in two parts:

  1. an association list between object types and regexp
  2. a predicate

Then we would be able to move either way.

If there's some real interest in it, I can have a look, but not right
now.


Regards,

-- 
Nicolas Goaziou




Re: [O] [bug] org-caldav-sync broken if entries have tables?

2013-09-11 Thread Eric S Fraga
Nicolas Goaziou  writes:

> Hello,
>
> Eric S Fraga  writes:
>
>> I have just upgraded both org and org-caldav and now I can no longer
>> sync to my Google calendar.  I get the following error:
>
> [...]
>
>> There is nothing particularly strange about the table found at location
>> 49232 in my diary.
>
> Are you able to export a buffer (with any export back-end) containing
> only that table?

No, and I have figured out why. 



The table was ill-formed.  It was originally part of an email I had cut
and pasted into a diary item and I had never asked org to "format" it
which, if I had, would have added an extra column throughout.  It's
interesting that the exporter used to work.  It *is*, however, a long
time since I updated my org as I was away all of August (without a
computer!) and have been doing the headless chicken impression ever
since trying to catch up ...



If it helps, here is a minimal example:

--8<---cut here---start->8---
* table test for export
|Milestone / Deliverable  |WP  
|Responsibl|Due:|
| ||e | 
   |
|M7.1  |UCL to have developed and exercised test bed  |7   |UCL   
|30th|
--8<---cut here---end--->8---

Note the extra | before the first UCL in the last line of the table,
something which I hadn't spotted.

Thanks for making me look at this closer and sorry for the noise.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5




Re: [O] setting options to python interpreter for a code block

2013-09-11 Thread John Kitchin
cool! this worked wonderfully:


(setq org-babel-python-command "python -m sandbox")
#+BEGIN_SRC python
print 'hello'

print 4 + 6

import sys

print >>sys.stderr, 'message to stderr'


raise Exception('baboom')
#+END_SRC

#+RESULTS:
#+begin_example

--
hello
10


--
stderr:
message to stderr


--
Traceback (most recent call last):
  File "/home/jkitchin/Dropbox/pycse/pycse/sandbox/sandbox.py", line 19, in

exec(content, ns_globals, ns_locals)
  File "", line 10, in 
Exception: baboom


#+end_example

If anyone is interested, here is the sandbox module:
#!/usr/bin/env python
from cStringIO import StringIO
import os, sys

old_stdout = sys.stdout
old_stderr = sys.stderr
redirected_output = sys.stdout = StringIO()
redirected_error = sys.stderr = StringIO()

ns_globals = {}
ns_locals = {}


if __name__ == '__main__':
content = sys.stdin.read()
out, err, exc = None, None, None

try:
exec(content, ns_globals, ns_locals)
except:
import traceback
exc = traceback.format_exc()

out = redirected_output.getvalue()
err = redirected_error.getvalue()

sys.stdout = old_stdout
sys.stderr = old_stderr

s = '''
--
{0}
'''.format(out)

if err:
s += '''
--
stderr:
{0}
'''.format(err)

if exc:
s += '''
--
{0}
'''.format(exc)

print s


John

---
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Wed, Sep 11, 2013 at 2:17 PM, Eric Schulte wrote:

> You could try setting org-babel-python-command to "python -m sandbox".
>
> If that doesn't work we could add a cmdline header argument to python
> code blocks pretty easily.
>
> Cheers,
>
> John Kitchin  writes:
>
> > Hi,
> > I am looking at a new strategy to capture stderr and exceptions in python
> > code blocks. Right now exceptions are not captured in the output, and
> > neither is stderr.
> >
> > I made a little sandbox module that captures stdout, stderr, and
> exceptions
> > and then prints them all to stdout with some minor formatting. Here is an
> > example.
> >
> > Say test.py has this content
> >
> > #+BEGIN_SRC python
> > print 'hello'
> >
> > print 4 + 6
> >
> > import sys
> >
> > print >>sys.stderr, 'message to stderr'
> >
> >
> > raise Exception('baboom')
> > #+END_SRC
> >
> > When I use the sandbox, I get all the output on stdout like this.
> >
> > #+BEGIN_SRC sh
> > python -m sandbox < test.py
> > # or cat test.py | python -m sandbox
> > #+END_SRC
> >
> > #+RESULTS:
> > #+begin_example
> >
> > --
> > hello
> > 10
> >
> >
> > --
> > stderr:
> > message to stderr
> >
> >
> > --
> > Traceback (most recent call last):
> >   File "/home/jkitchin/Dropbox/pycse/pycse/sandbox/sandbox.py", line 16,
> in
> > 
> > exec(content, ns_globals, ns_locals)
> >   File "", line 10, in 
> > Exception: baboom
> >
> >
> > #+end_example
> >
> >
> > So, I was wondering how to get this to happen in org-mode on a regular
> > python block. I think it could work if I could define a custom
> interpreter
> > for a particular block, e.g. python-sandbox that takes the codeblock on
> > stdin.
> >
> > Is there some other way that I could do this? Thanks!
> >
> > John
> >
> > ---
> > John Kitchin
> > Associate Professor
> > Doherty Hall A207F
> > Department of Chemical Engineering
> > Carnegie Mellon University
> > Pittsburgh, PA 15213
> > 412-268-7803
> > http://kitchingroup.cheme.cmu.edu
>
> --
> Eric Schulte
> https://cs.unm.edu/~eschulte
> PGP: 0x614CA05D
>


Re: [O] setting options to python interpreter for a code block

2013-09-11 Thread Eric Schulte
You could try setting org-babel-python-command to "python -m sandbox".

If that doesn't work we could add a cmdline header argument to python
code blocks pretty easily.

Cheers,

John Kitchin  writes:

> Hi,
> I am looking at a new strategy to capture stderr and exceptions in python
> code blocks. Right now exceptions are not captured in the output, and
> neither is stderr.
>
> I made a little sandbox module that captures stdout, stderr, and exceptions
> and then prints them all to stdout with some minor formatting. Here is an
> example.
>
> Say test.py has this content
>
> #+BEGIN_SRC python
> print 'hello'
>
> print 4 + 6
>
> import sys
>
> print >>sys.stderr, 'message to stderr'
>
>
> raise Exception('baboom')
> #+END_SRC
>
> When I use the sandbox, I get all the output on stdout like this.
>
> #+BEGIN_SRC sh
> python -m sandbox < test.py
> # or cat test.py | python -m sandbox
> #+END_SRC
>
> #+RESULTS:
> #+begin_example
>
> --
> hello
> 10
>
>
> --
> stderr:
> message to stderr
>
>
> --
> Traceback (most recent call last):
>   File "/home/jkitchin/Dropbox/pycse/pycse/sandbox/sandbox.py", line 16, in
> 
> exec(content, ns_globals, ns_locals)
>   File "", line 10, in 
> Exception: baboom
>
>
> #+end_example
>
>
> So, I was wondering how to get this to happen in org-mode on a regular
> python block. I think it could work if I could define a custom interpreter
> for a particular block, e.g. python-sandbox that takes the codeblock on
> stdin.
>
> Is there some other way that I could do this? Thanks!
>
> John
>
> ---
> John Kitchin
> Associate Professor
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> http://kitchingroup.cheme.cmu.edu

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



[O] BUG: clicking on timestamp destroys buffer ordering and point

2013-09-11 Thread Samuel Wales
I like the feature where you can RET or click on a timestamp.
Recently in git master, it changes the buffer list so that the buffer
you are in is off in some random location.  You cannot get back to it
with next-buffer.

I bind this to a function key and operate in full screen (I never
split windows).  It is my primary means of buffer navigation.  Almost
all of Emacs will get you to the buffer you were just in if you do
next-buffer, and back again with previous-buffer.  Thus, it is sort of
like a back command in a browser.  This is true for almost any
buffer-creating command like org-agenda.  (I don't use the click on
timestamp feature that much, but it would be nice if it worked this
way also, and the fact that it does not might indicate that other
areas of Org might not, now or in the future, so this is a bug report
intended to prevent future bugs more than a critical current need.)

Also, I noticed that point in the original buffer gets placed at bob.
IMO it should stay where it was.

Thanks.

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] Outline cycling does not preserve point's position

2013-09-11 Thread Nicolas Goaziou
Jambunathan K  writes:

> I am happy with whatever is the latest version.  You may want to commit
> it.

I copy here[fn:1] the current version, for the record, along with its backward
counterpart. Some points are still to be discussed:

  1. What to do on node properties?
  2. What to do on source blocks?


[fn:1] Here is the code:

(defun org-forward-linear-element ()
  "Move forward to beginning of next element, ignoring depth.
The function implements some special moves for convenience:
  - On an affiliated keyword, jump to the beginning of the
relative element.
  - On an item or a footnote definition, move to the second
element inside, if any.
  - On a table, jump after it.
  - On a verse block, stop after each blank line."
  (interactive)
  (when (eobp) (user-error "Cannot move further down"))
  (let* ((element (org-element-at-point))
 (type (org-element-type element))
 (post-affiliated (org-element-property :post-affiliated element))
 (contents-begin (org-element-property :contents-begin element))
 (contents-end (org-element-property :contents-end element))
 (end (let ((end (org-element-property :end element)) (parent element))
(while (and (setq parent (org-element-property :parent parent))
(= (org-element-property :contents-end parent) end))
  (setq end (org-element-property :end parent)))
end)))
(cond ((not element)
   (skip-chars-forward " \r\t\n")
   (or (eobp) (beginning-of-line)))
  ;; On affiliated keywords, move to element's beginning.
  ((and post-affiliated (< (point) post-affiliated))
   (goto-char post-affiliated))
  ;; At a table row, move to the end of the table.
  ((eq type 'table-row)
   (goto-char (org-element-property
   :end (org-element-property :parent element
  ((eq type 'table) (goto-char end))
  ((not contents-begin) (goto-char end))
  ;; If current element contents are invisible, skip the
  ;; element altogether.
  ((outline-invisible-p (line-end-position))
   (case type
 (headline
  (org-with-limited-levels (outline-next-visible-heading 1)))
 ;; At a plain list, make sure we move to the next item
 ;; instead of skipping the whole list.
 (plain-list (forward-char)
 (org-forward-linear-element))
 (otherwise (goto-char end
  ((>= (point) contents-end) (goto-char end))
  ((>= (point) contents-begin)
   ;; Handle special cases.  In all other situations, point is
   ;; where it should be.
   (case type
 (paragraph (goto-char end))
 ;; At a plain list, try to move to second element in
 ;; first item, if possible.
 (plain-list (end-of-line)
 (org-forward-linear-element))
 ;; Consider blank lines as separators in verse blocks to
 ;; ease editing.
 (verse-block
  (beginning-of-line)
  (if (not (re-search-forward "^[ \t]*$" contents-end t))
  (goto-char end)
(skip-chars-forward " \r\t\n")
(if (= (point) contents-end) (goto-char contents)
  (beginning-of-line))
  ;; When contents start on the middle of a line (e.g. in
  ;; items and footnote definitions), try to reach first
  ;; element starting after current line.
  ((> (line-end-position) contents-begin)
   (end-of-line)
   (org-forward-linear-element))
  (t (goto-char contents-begin)

(defun org-backward-linear-element ()
  "Move backward to start of previous element, ignoring depth."
  (interactive)
  (when (bobp) (user-error "Cannot move further up"))
  (let* ((element (org-element-at-point))
 (type (org-element-type element))
 (contents-begin (org-element-property :contents-begin element))
 (contents-end (org-element-property :contents-end element))
 (post-affiliated (org-element-property :post-affiliated element))
 (begin (org-element-property :begin element)))
(cond ((not element) (goto-char (point-min)))
  ((= (point) begin)
   (backward-char)
   (org-backward-linear-element))
  ((and post-affiliated (<= (point) post-affiliated)) (goto-char begin))
  ((eq type 'table-row)
   (goto-char (org-element-property
   :contents-begin (org-element-property :parent element
  ((eq type 'table) (goto-char begin))
  ((not contents-begin)
   (goto-char (or post-affiliated begin)))
  ((eq type 'paragraph)
   (goto-char contents-begin)
   ;; When at first paragraph in an item or a footnote
   ;; definition, move directly to 

Re: [O] Outline cycling does not preserve point's position

2013-09-11 Thread Suvayu Ali
Hi Nicolas,

On Wed, Sep 11, 2013 at 10:01:31PM +0200, Nicolas Goaziou wrote:
> Jambunathan K  writes:
> 
> > I am happy with whatever is the latest version.  You may want to commit
> > it.
> 
> I copy here[fn:1] the current version, for the record, along with its backward
> counterpart. Some points are still to be discussed:

Looks good.  I'll use it full-time for the next few days and report back.

>   1. What to do on node properties?

You mean property drawers after headlines?  I would think skipping them
would seem pertinent?  After all properties are usually hidden away.

>   2. What to do on source blocks?

One thing I feel the need for is to be able to navigate longer source
blocks as if they were simple text: either for perusal, or for minor
editing.  So my personal preference is empty lines end a "paragraph".

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.



[O] LaTeX export: images subplots

2013-09-11 Thread Martin Leduc
Hi all,
  I am using org-mode to write a report with several figures. I would like to 
group some images into a same figure, let say a 2x2 panel. I know that I can 
directly embed latex code in my org file, for example by using the subfloats 
(from the latex subfig package). 

However, I would prefer to use an org-based solution of inserting the image 
links in order to keep the convenient way of previewing images right into the 
buffer with C-c C-x C-v.

The only solution I found is by using tables such as:

#+CAPTION: Insert caption here.
#+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
| [[pathtoimage]] | [[pathtoimage]] |
| [[pathtoimage]] | [[pathtoimage]] |

where the size of the images is controled by p{} and C-cxv is working. However, 
in the exported TeX file, it is a table, not a figure. Is there a cleaner way 
to make image panels that would preserve the figure environment in the exported 
TeX file ?

Thanks a lot,
Martin


  

Re: [O] LaTeX export: images subplots

2013-09-11 Thread John Hendy
On Wed, Sep 11, 2013 at 8:56 PM, Martin Leduc  wrote:
> Hi all,
>   I am using org-mode to write a report with several figures. I would like
> to group some images into a same figure, let say a 2x2 panel. I know that I
> can directly embed latex code in my org file, for example by using the
> subfloats (from the latex subfig package).
>
> However, I would prefer to use an org-based solution of inserting the image
> links in order to keep the convenient way of previewing images right into
> the buffer with C-c C-x C-v.
>
> The only solution I found is by using tables such as:
>
> #+CAPTION: Insert caption here.
> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> | [[pathtoimage]] | [[pathtoimage]] |
> | [[pathtoimage]] | [[pathtoimage]] |
>
> where the size of the images is controled by p{} and C-cxv is working.
> However, in the exported TeX file, it is a table, not a figure. Is there a
> cleaner way to make image panels that would preserve the figure environment
> in the exported TeX file ?

Just wanted to cite my similar (same?) question from a bit back:
- http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01800.html

The only suggest I got was to use the subfig package, which may
actually be something like what you're looking for.

I guess p{width} /could/ work for what I was going for, but I will
often stagger images and my own "captions" via the org table:

#+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
| [[pathtoimage]] | [[pathtoimage]] |
| /blah blah/  |  /blah blah/  |
|   |   |
| [[pathtoimage]] | [[pathtoimage]] |
| /blah blah/  |  /blah blah/  |
|   |   |

I don't like using p{} because everything is left aligned and I like
to center the images and the "caption" text below each one.
Unfortunately, there's no centered equivalent to p{}. Thus, I end up
using \includegraphics[widt]{} manually.

Anyway, sorry if that's off-topic. Just wanted to voice that I have a
use for this general sort of thing as well. Heck, I think even
applying the beamer columns principle to LaTeX article classes would
work and be quite neat.


Thanks,
John

>
> Thanks a lot,
> Martin
>
>



Re: [O] LaTeX export: images subplots

2013-09-11 Thread Martin Leduc
Hi John, 
   this solution using tables was indeed inspired from your post, I am so 
sorry, I should have refered to it...

I suppose that the feature has not been implemented yet. I am now thinking of 
generating a panel with imagemagick before including it in the org buffer, for 
example with

#+begin_src sh
convert +append image1.png image2.png panel.png
#+end_src

and hence 

#+CAPTION:
[[panel.png]]

to have the two images side by side both in the buffer (with C-cxv) and the 
latex pdf (within a figure environment).

Is there a cleaner org solution that I would have missed ?
Thanks again,
Martin

> Date: Wed, 11 Sep 2013 21:47:08 -0500
> Subject: Re: [O] LaTeX export: images subplots
> From: jw.he...@gmail.com
> To: mart...@hotmail.com
> CC: emacs-orgmode@gnu.org
> 
> On Wed, Sep 11, 2013 at 8:56 PM, Martin Leduc  wrote:
> > Hi all,
> >   I am using org-mode to write a report with several figures. I would like
> > to group some images into a same figure, let say a 2x2 panel. I know that I
> > can directly embed latex code in my org file, for example by using the
> > subfloats (from the latex subfig package).
> >
> > However, I would prefer to use an org-based solution of inserting the image
> > links in order to keep the convenient way of previewing images right into
> > the buffer with C-c C-x C-v.
> >
> > The only solution I found is by using tables such as:
> >
> > #+CAPTION: Insert caption here.
> > #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> > | [[pathtoimage]] | [[pathtoimage]] |
> > | [[pathtoimage]] | [[pathtoimage]] |
> >
> > where the size of the images is controled by p{} and C-cxv is working.
> > However, in the exported TeX file, it is a table, not a figure. Is there a
> > cleaner way to make image panels that would preserve the figure environment
> > in the exported TeX file ?
> 
> Just wanted to cite my similar (same?) question from a bit back:
> - http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01800.html
> 
> The only suggest I got was to use the subfig package, which may
> actually be something like what you're looking for.
> 
> I guess p{width} /could/ work for what I was going for, but I will
> often stagger images and my own "captions" via the org table:
> 
> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> | [[pathtoimage]] | [[pathtoimage]] |
> | /blah blah/  |  /blah blah/  |
> |   |   |
> | [[pathtoimage]] | [[pathtoimage]] |
> | /blah blah/  |  /blah blah/  |
> |   |   |
> 
> I don't like using p{} because everything is left aligned and I like
> to center the images and the "caption" text below each one.
> Unfortunately, there's no centered equivalent to p{}. Thus, I end up
> using \includegraphics[widt]{} manually.
> 
> Anyway, sorry if that's off-topic. Just wanted to voice that I have a
> use for this general sort of thing as well. Heck, I think even
> applying the beamer columns principle to LaTeX article classes would
> work and be quite neat.
> 
> 
> Thanks,
> John
> 
> >
> > Thanks a lot,
> > Martin
> >
> >
  

Re: [O] LaTeX export: images subplots

2013-09-11 Thread John Hendy
On Wed, Sep 11, 2013 at 10:13 PM, Martin Leduc  wrote:
> Hi John,
>this solution using tables was indeed inspired from your post, I am so
> sorry, I should have refered to it...
>

Ha! No problem at all -- small mailing list world :)

> I suppose that the feature has not been implemented yet. I am now thinking
> of generating a panel with imagemagick before including it in the org
> buffer, for example with
>
> #+begin_src sh
> convert +append image1.png image2.png panel.png
> #+end_src
>
> and hence
>
> #+CAPTION:
> [[panel.png]]

What in the wide world of sports!? That's amazing and I can't believe
I've never run into that. Sooo flipping handy. I've been looking for
an easy way to do this with dissimilar ggplot2 plots where facetting
is hard or doesn't make sense as well:
- Like this: 
http://stackoverflow.com/questions/18046051/setting-individual-axis-limits-with-facet-wrap-and-scales-free-in-ggplot2

That's pretty awesome and I just tried it; works beautifully.

Then again, I think handling images in Org tables would be just
fantastic. Not need for an external program or the compile time.
Perhaps a bit tricky as one would have to infer from some #+attr_latex
property that one wanted to apply some size parameter to every
[option] box of the converted \includegraphics line...

In any case, thanks for this and I'll keep that in mind. Hopefully
others chime in.


John

>
> to have the two images side by side both in the buffer (with C-cxv) and the
> latex pdf (within a figure environment).
>
> Is there a cleaner org solution that I would have missed ?
> Thanks again,
> Martin
>
>> Date: Wed, 11 Sep 2013 21:47:08 -0500
>> Subject: Re: [O] LaTeX export: images subplots
>> From: jw.he...@gmail.com
>> To: mart...@hotmail.com
>> CC: emacs-orgmode@gnu.org
>>
>> On Wed, Sep 11, 2013 at 8:56 PM, Martin Leduc  wrote:
>> > Hi all,
>> > I am using org-mode to write a report with several figures. I would like
>> > to group some images into a same figure, let say a 2x2 panel. I know
>> > that I
>> > can directly embed latex code in my org file, for example by using the
>> > subfloats (from the latex subfig package).
>> >
>> > However, I would prefer to use an org-based solution of inserting the
>> > image
>> > links in order to keep the convenient way of previewing images right
>> > into
>> > the buffer with C-c C-x C-v.
>> >
>> > The only solution I found is by using tables such as:
>> >
>> > #+CAPTION: Insert caption here.
>> > #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
>> > | [[pathtoimage]] | [[pathtoimage]] |
>> > | [[pathtoimage]] | [[pathtoimage]] |
>> >
>> > where the size of the images is controled by p{} and C-cxv is working.
>> > However, in the exported TeX file, it is a table, not a figure. Is there
>> > a
>> > cleaner way to make image panels that would preserve the figure
>> > environment
>> > in the exported TeX file ?
>>
>> Just wanted to cite my similar (same?) question from a bit back:
>> - http://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg01800.html
>>
>> The only suggest I got was to use the subfig package, which may
>> actually be something like what you're looking for.
>>
>> I guess p{width} /could/ work for what I was going for, but I will
>> often stagger images and my own "captions" via the org table:
>>
>> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
>> | [[pathtoimage]] | [[pathtoimage]] |
>> | /blah blah/ | /blah blah/ |
>> | | |
>> | [[pathtoimage]] | [[pathtoimage]] |
>> | /blah blah/ | /blah blah/ |
>> | | |
>>
>> I don't like using p{} because everything is left aligned and I like
>> to center the images and the "caption" text below each one.
>> Unfortunately, there's no centered equivalent to p{}. Thus, I end up
>> using \includegraphics[widt]{} manually.
>>
>> Anyway, sorry if that's off-topic. Just wanted to voice that I have a
>> use for this general sort of thing as well. Heck, I think even
>> applying the beamer columns principle to LaTeX article classes would
>> work and be quite neat.
>>
>>
>> Thanks,
>> John
>>
>> >
>> > Thanks a lot,
>> > Martin
>> >
>> >



Re: [O] LaTeX export: images subplots

2013-09-11 Thread Charles Berry
Martin Leduc  hotmail.com> writes:

> 
>

> Hi all,

> I am using org-mode to write a report with several figures. I would
> like to group some images into a same figure, let say a 2x2 panel. I
> know that I can directly embed latex code in my org file, for
> example by using the subfloats (from the latex subfig package).
> However, I would prefer to use an org-based solution of inserting
> the image links in order to keep the convenient way of previewing
> images right into the buffer with C-c C-x C-v.

> The only solution I found is by using tables such as:
> 
> #+CAPTION: Insert caption here.
> #+ATTR_LATEX: :align p{0.5\textwidth}p{0.5\textwidth}
> | [[pathtoimage]] | [[pathtoimage]] |
> | [[pathtoimage]] | [[pathtoimage]] |
> 

> where the size of the images is controled by p{} and C-cxv is
> working.  However, in the exported TeX file, it is a table, not a
> figure. Is there a cleaner way to make image panels that would
> preserve the figure environment in the exported TeX file ?


I think you are close.

Use 

#+BEGIN_SRC org :exports none
#+name: imtable

#+END_SRC


This gives you the images in a form you can view and a way to access the
links so you can export them in a different form.

For example,

#+BEGIN_SRC emacs-lisp :var a=imtable :exports results :results raw
  (mapconcat (lambda(y) 
   (mapconcat 
(lambda(x) (org-export-string-as x 'latex t)) y "")) a "")
#+END_SRC

exports as 

\includegraphics[width=.9\linewidth]{img3070YH.png}
\includegraphics[width=.9\linewidth]img307BjN.png}
\includegraphics[width=.9\linewidth]img307OtT.png}
\includegraphics[width=.9\linewidth]img307b3Z.png}

when the elements in the table are the image paths img*.png as shown.


HTH,

Chuck