emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [bug] org block not correctly exported to LaTeX
@ 2011-07-21 12:02 Thomas Holst
  2011-07-24 23:12 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Holst @ 2011-07-21 12:02 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

when the follwing org-file is exported to LaTeX, #+BEGIN_ORG
and #+END_ORG is inserted in the tex-file.

--8<------------------------schnipp------------------------->8---
* Testing output perl to org

  #+srcname: TestingPerlToOrg
  #+begin_src perl :exports results :results output org
    print "Hello World\n";
  #+end_src

  #+results: TestingPerlToOrg
  #+BEGIN_ORG
  Hello World
  #+END_ORG
--8<------------------------schnapp------------------------->8---

Relevant part of the tex-file:
--8<------------------------schnipp------------------------->8---
#+begin_src latex
  \#+begin\_{}org 
    Hello World
  \#+end\_{}org
#+end_src
--8<------------------------schnapp------------------------->8---

If the #+BEGIN_ORG ... #+END_ORG starts at column 0 it is not inserted
into the tex-file. Other blocks (e.g. #+BEGIN_EXAMPLE ... #+END_EXAMPLE)
are not inserted if they are indented.

Tested with:
emacs 23.2.1 on WinXP
Org-mode version 7.6 (release_7.6.75.g67e9) (local patch to makefile)

Thanks again for org-mode. More and more of my collegues are starting to
use it!
-- 
Mit freundlichen Grüßen / Best regards 

Thomas Holst 
DGS-EC/ESE4

Tel.   +49 (711) 811-40681
PC-Fax +49 (711) 811-5182208

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [bug] org block not correctly exported to LaTeX
  2011-07-21 12:02 [bug] org block not correctly exported to LaTeX Thomas Holst
@ 2011-07-24 23:12 ` Bastien
  2011-07-25  8:02   ` Thomas Holst
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2011-07-24 23:12 UTC (permalink / raw)
  To: Thomas Holst; +Cc: emacs-orgmode

Hi Thomas,

Thomas Holst <thomas.holst@de.bosch.com> writes:

> when the follwing org-file is exported to LaTeX, #+BEGIN_ORG
> and #+END_ORG is inserted in the tex-file.

You surely want

#+begin_src org
#+end_src org

"#+begin_org" doesn't exist.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [bug] org block not correctly exported to LaTeX
  2011-07-24 23:12 ` Bastien
@ 2011-07-25  8:02   ` Thomas Holst
  2011-07-25 17:08     ` Eric Schulte
  2011-07-25 17:48     ` Bernt Hansen
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Holst @ 2011-07-25  8:02 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Holst Thomas (DGS-EC/ESE4), Bastien

Hi Bastien,

thanks for your answer. 

>> when the follwing org-file is exported to LaTeX, #+BEGIN_ORG
>> and #+END_ORG is inserted in the tex-file.
>
> You surely want
> #+begin_src org
> #+end_src org
> "#+begin_org" doesn't exist.

#+BEGIN_ORG 
#+END_ORG

gets inserted by org-babel. Here is the relevant part of ob.el lines
1620 ff.

#+srcname: ob.el
#+begin_src emacs-lisp
  ;; ....
  ((member "org" result-params)
   (wrap "#+BEGIN_ORG" "#+END_ORG"))
  ;; ...
#+end_src emacs-lisp

Here is an example which shows the issue.

#+begin_src org
* Testing org-babel perl
  
  #+srcname: TestingPerl
  #+begin_src perl :exports results :results output org
    print("#+CAPTION: A caption\n");
    print("#+LABEL: tbl:dvi\n");
    print("#+ATTR_LaTeX: placement[H]\n");
    print("| *bold/T* |\n");
    print("|--------|\n");
    print("| normal |\n");
  #+end_src

  #+results: TestingPerl
  #+BEGIN_ORG
  #+CAPTION: A caption
  #+LABEL: tbl:dvi
  #+ATTR_LaTeX: placement[H]
  | *bold/T* |
  |--------|
  | normal |
  #+END_ORG
#+end_src org

I tested replacing 

 #+BEGIN_ORG 
 #+END_ORG 

with 

 #+BEGIN_SRC org
 #+END_SRC org

But that doesn't work. The org-babel output is inserted verbatim when
exported to LaTeX. That is not what is expected. 

I could use a

:results output raw

header, but with a long output (including blank lines) org-babel has
problems finding the end of the output when recalculating the source
block. The org-babel output gets appended not rewritten.

My workaround is not indenting the source block. Then everything works
as expected. But indented soure blocks look nicer.

Thanks again for looking into this.
-- 
Mit freundlichen Grüßen / Best regards 

Thomas Holst 
DGS-EC/ESE4

Tel.   +49 (711) 811-40681
PC-Fax +49 (711) 811-5182208

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [bug] org block not correctly exported to LaTeX
  2011-07-25  8:02   ` Thomas Holst
@ 2011-07-25 17:08     ` Eric Schulte
  2011-07-26  6:50       ` Thomas Holst
  2011-07-25 17:48     ` Bernt Hansen
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2011-07-25 17:08 UTC (permalink / raw)
  To: Thomas Holst; +Cc: Bastien, emacs-orgmode

Thomas Holst <thomas.holst@de.bosch.com> writes:

> Hi Bastien,
>
> thanks for your answer. 
>
>>> when the follwing org-file is exported to LaTeX, #+BEGIN_ORG
>>> and #+END_ORG is inserted in the tex-file.
>>
>> You surely want
>> #+begin_src org
>> #+end_src org
>> "#+begin_org" doesn't exist.
>
> #+BEGIN_ORG 
> #+END_ORG
>
> gets inserted by org-babel.

Yes, Babel uses the #+begin/end_org as markers, so that it can identify
the beginning and end of raw Org-mode results when those results need to
be deleted or replaced with new results.

Since these are just used as markers and are functionally equivalent to
comment lines (e.g., no special treatment of the portion between the
begin_org and end_org lines) we didn't really coordinate this with the
results of Org-mode.

It seems however that since comments must start on the first character
of a line, these don't work when indented.

Would it be difficult to recognize these two lines as comments when they
are indented?  Note we also have #+begin/end_result lines which may
likely have similar issues.

Best -- Eric

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [bug] org block not correctly exported to LaTeX
  2011-07-25  8:02   ` Thomas Holst
  2011-07-25 17:08     ` Eric Schulte
@ 2011-07-25 17:48     ` Bernt Hansen
  2011-07-26  7:00       ` Thomas Holst
  1 sibling, 1 reply; 7+ messages in thread
From: Bernt Hansen @ 2011-07-25 17:48 UTC (permalink / raw)
  To: Thomas Holst; +Cc: Bastien, emacs-orgmode

Thomas Holst <thomas.holst@de.bosch.com> writes:

> Hi Bastien,
>
> thanks for your answer. 
>
>>> when the follwing org-file is exported to LaTeX, #+BEGIN_ORG
>>> and #+END_ORG is inserted in the tex-file.
>>
>> You surely want
>> #+begin_src org
>> #+end_src org
>> "#+begin_org" doesn't exist.
>
> #+BEGIN_ORG 
> #+END_ORG
>
> gets inserted by org-babel. Here is the relevant part of ob.el lines
> 1620 ff.
>
> #+srcname: ob.el
> #+begin_src emacs-lisp
>   ;; ....
>   ((member "org" result-params)
>    (wrap "#+BEGIN_ORG" "#+END_ORG"))
>   ;; ...
> #+end_src emacs-lisp
>
> Here is an example which shows the issue.
>
> #+begin_src org
> * Testing org-babel perl
>   
>   #+srcname: TestingPerl
>   #+begin_src perl :exports results :results output org
>     print("#+CAPTION: A caption\n");
>     print("#+LABEL: tbl:dvi\n");
>     print("#+ATTR_LaTeX: placement[H]\n");
>     print("| *bold/T* |\n");
>     print("|--------|\n");
>     print("| normal |\n");
>   #+end_src
>   #+results: TestingPerl
>   #+BEGIN_ORG
>   #+CAPTION: A caption
>   #+LABEL: tbl:dvi
>   #+ATTR_LaTeX: placement[H]
>   | *bold/T* |
>   |--------|
>   | normal |
>   #+END_ORG
> #+end_src org

Hi Thomas,

You have nested #+begin_src / #+end_src in this example.  I'm not sure
that is supported.

Fontification of this example seems to indicate that the
second #+begin_src perl is invalid and the first #+end_src terminates
the #+begin_src org

-Bernt

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [bug] org block not correctly exported to LaTeX
  2011-07-25 17:08     ` Eric Schulte
@ 2011-07-26  6:50       ` Thomas Holst
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Holst @ 2011-07-26  6:50 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Holst Thomas (DGS-EC/ESE4), Bastien

Hi Eric,

thanks for looking into this.

· Eric Schulte <schulte.eric@gmail.com> wrote:
> Thomas Holst <thomas.holst@de.bosch.com> writes:
>> Hi Bastien,
>>
>> thanks for your answer. 
>>
>>>> when the follwing org-file is exported to LaTeX, #+BEGIN_ORG
>>>> and #+END_ORG is inserted in the tex-file.
>>>
>>> You surely want
>>> #+begin_src org
>>> #+end_src org
>>> "#+begin_org" doesn't exist.
>>
>> #+BEGIN_ORG 
>> #+END_ORG
>>
>> gets inserted by org-babel.
>
> Yes, Babel uses the #+begin/end_org as markers, so that it can identify
> the beginning and end of raw Org-mode results when those results need to
> be deleted or replaced with new results.
>
> Since these are just used as markers and are functionally equivalent to
> comment lines (e.g., no special treatment of the portion between the
> begin_org and end_org lines) we didn't really coordinate this with the
> results of Org-mode.
>
> It seems however that since comments must start on the first character
> of a line, these don't work when indented.
>
> Would it be difficult to recognize these two lines as comments when they
> are indented?  Note we also have #+begin/end_result lines which may
> likely have similar issues.

This exactly is the issue. If I remove the indentation from the result
block export works fine. As you mentioned #+begin/#+end_org markers are
treated as comments and do not appear in the LaTeX output.

I tried to find a solution to this but my lisp is not (yet) good enough.

-- 
Mit freundlichen Grüßen / Best regards 

Thomas Holst 
DGS-EC/ESE4

Tel.   +49 (711) 811-40681
PC-Fax +49 (711) 811-5182208

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [bug] org block not correctly exported to LaTeX
  2011-07-25 17:48     ` Bernt Hansen
@ 2011-07-26  7:00       ` Thomas Holst
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Holst @ 2011-07-26  7:00 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Holst Thomas (DGS-EC/ESE4), Bernt Hansen

Hi Bernt,

· Bernt Hansen <bernt@norang.ca> wrote:
> Thomas Holst <thomas.holst@de.bosch.com> writes:
>
>> Hi Bastien,
>>
>> thanks for your answer. 
>>
>>>> when the follwing org-file is exported to LaTeX, #+BEGIN_ORG
>>>> and #+END_ORG is inserted in the tex-file.
>>>
>>> You surely want
>>> #+begin_src org
>>> #+end_src org
>>> "#+begin_org" doesn't exist.
>>
>> #+BEGIN_ORG 
>> #+END_ORG
>>
>> Here is an example which shows the issue.
>>
>> #+begin_src org
>> * Testing org-babel perl
>>   
>>   #+srcname: TestingPerl
>>   #+begin_src perl :exports results :results output org
>>     print("#+CAPTION: A caption\n");
>>     print("#+LABEL: tbl:dvi\n");
>>     print("#+ATTR_LaTeX: placement[H]\n");
>>     print("| *bold/T* |\n");
>>     print("|--------|\n");
>>     print("| normal |\n");
>>   #+end_src
>>   #+results: TestingPerl
>>   #+BEGIN_ORG
>>   #+CAPTION: A caption
>>   #+LABEL: tbl:dvi
>>   #+ATTR_LaTeX: placement[H]
>>   | *bold/T* |
>>   |--------|
>>   | normal |
>>   #+END_ORG
>> #+end_src org
>
> You have nested #+begin_src / #+end_src in this example.  I'm not sure
> that is supported.

I used #+begin_src / #+end_src org only to show the org file in my
email. The part between #+begin / #+end_src org is the content of my
test org file.

As Eric said the problem is #+begin_org / #+end_org which is inserted by
babel. If #+begin_org / #+end_org does not start at column 0 it appears in
the exported LaTeX file.

-- 
Mit freundlichen Grüßen / Best regards 

Thomas Holst 
DGS-EC/ESE4

Tel.   +49 (711) 811-40681
PC-Fax +49 (711) 811-5182208

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-26  7:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-21 12:02 [bug] org block not correctly exported to LaTeX Thomas Holst
2011-07-24 23:12 ` Bastien
2011-07-25  8:02   ` Thomas Holst
2011-07-25 17:08     ` Eric Schulte
2011-07-26  6:50       ` Thomas Holst
2011-07-25 17:48     ` Bernt Hansen
2011-07-26  7:00       ` Thomas Holst

Code repositories for project(s) associated with this 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).