emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: LaTeX export and LaTeX environment
@ 2010-05-19  6:34 Ulf Stegemann
  2010-05-19  6:57 ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Ulf Stegemann @ 2010-05-19  6:34 UTC (permalink / raw)
  To: emacs-orgmode

With

Org-mode version 6.36trans (release_6.36.80.gbdfd)
GNU Emacs 24.0.50.3 (i686-pc-linux-gnu, GTK+ Version 2.18.6)

the LaTeX exporter seems to cease to work when encountering a LaTeX
environment. Suppose this minimal org file:

--8<--------------------------snip-------------------------->8---

#+TITLE: Wrapping in Env

/foo/

#+BEGIN_LaTeX
\begin{center}
#+END_LaTeX

/bar/

#+BEGIN_LaTeX
\end{center}
#+END_LaTeX

/baz/

--8<--------------------------snap-------------------------->8---

When exported to LaTeX the relevant part looks like this:

--8<--------------------------snip-------------------------->8---

\emph{foo}

\begin{center}

/bar/

\end{center}

\emph{baz}

--8<--------------------------snap-------------------------->8---

As far as I can see, this happens only if an environment is defined in
the BEGIN/END_LaTeX blocks. Everything between such blocks is exported
literally. I'm pretty sure this once had worked but I'm not sure when
org stopped to export correctly.

Ulf

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

* Re: Bug: LaTeX export and LaTeX environment
  2010-05-19  6:34 Bug: LaTeX export and LaTeX environment Ulf Stegemann
@ 2010-05-19  6:57 ` Carsten Dominik
  2010-05-19  7:27   ` Ulf Stegemann
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2010-05-19  6:57 UTC (permalink / raw)
  To: Ulf Stegemann; +Cc: emacs-orgmode


On May 19, 2010, at 8:34 AM, Ulf Stegemann wrote:

> With
>
> Org-mode version 6.36trans (release_6.36.80.gbdfd)
> GNU Emacs 24.0.50.3 (i686-pc-linux-gnu, GTK+ Version 2.18.6)
>
> the LaTeX exporter seems to cease to work when encountering a LaTeX
> environment. Suppose this minimal org file:
>
> --8<--------------------------snip-------------------------->8---
>
> #+TITLE: Wrapping in Env
>
> /foo/
>
> #+BEGIN_LaTeX
> \begin{center}
> #+END_LaTeX
>
> /bar/
>
> #+BEGIN_LaTeX
> \end{center}
> #+END_LaTeX
>
> /baz/
>
> --8<--------------------------snap-------------------------->8---
>
> When exported to LaTeX the relevant part looks like this:
>
> --8<--------------------------snip-------------------------->8---
>
> \emph{foo}
>
> \begin{center}
>
> /bar/
>
> \end{center}
>
> \emph{baz}
>
> --8<--------------------------snap-------------------------->8---
>
> As far as I can see, this happens only if an environment is defined in
> the BEGIN/END_LaTeX blocks. Everything between such blocks is exported
> literally. I'm pretty sure this once had worked but I'm not sure when
> org stopped to export correctly.
>
> Ulf

Hi Ulf,

it has always been like this,

check out this entire thread for work-arounds and other solutions

http://thread.gmane.org/gmane.emacs.orgmode/12977

HTH

- Carsten

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

* Re: Bug: LaTeX export and LaTeX environment
  2010-05-19  6:57 ` Carsten Dominik
@ 2010-05-19  7:27   ` Ulf Stegemann
  2010-05-19 19:20     ` Mark Elston
  0 siblings, 1 reply; 10+ messages in thread
From: Ulf Stegemann @ 2010-05-19  7:27 UTC (permalink / raw)
  To: emacs-orgmode

Hi Carsten,

Carsten Dominik <carsten.dominik@gmail.com> wrote:

> On May 19, 2010, at 8:34 AM, Ulf Stegemann wrote:
>
>> With
>>
>> Org-mode version 6.36trans (release_6.36.80.gbdfd)
>> GNU Emacs 24.0.50.3 (i686-pc-linux-gnu, GTK+ Version 2.18.6)
>>
>> the LaTeX exporter seems to cease to work when encountering a LaTeX
>> environment.
>
> it has always been like this,
>
> check out this entire thread for work-arounds and other solutions
>
> http://thread.gmane.org/gmane.emacs.orgmode/12977

I must have been blind, thanks for the pointer! It works like a charm
with org-special-blocks.

Ulf

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

* Re: Re: Bug: LaTeX export and LaTeX environment
  2010-05-19  7:27   ` Ulf Stegemann
@ 2010-05-19 19:20     ` Mark Elston
  2010-06-01 13:42       ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Elston @ 2010-05-19 19:20 UTC (permalink / raw)
  To: emacs-orgmode

Ulf, Carsten,


On 5/19/2010 12:27 AM, Ulf Stegemann wrote:
> Hi Carsten,
>
> Carsten Dominik<carsten.dominik@gmail.com>  wrote:
>
>> On May 19, 2010, at 8:34 AM, Ulf Stegemann wrote:
>>
>>>  ...
>>> the LaTeX exporter seems to cease to work when encountering a LaTeX
>>> environment.
>>
>> it has always been like this,
>>
>> check out this entire thread for work-arounds and other solutions
>>
>> http://thread.gmane.org/gmane.emacs.orgmode/12977
>
> I must have been blind, thanks for the pointer! It works like a charm
> with org-special-blocks.
>
> Ulf

I have not looked into the contrib directory lately (for quite a while,
actually) so was not aware of the org-special-blocks stuff.  This is
pretty cool and *almost* what I was about to ask for as well.

The only problem I have with it is I need (for specific environments) to
pass a parameter to the \begin{xxx} call on latex export.  I think what
is there is a more than adequate basis for what I am looking to do and I
will add my stuff to it and try it out.

My question is:  Is there a preferred way of doing this?  I can do a
local enhancement that hard-codes what I am trying to do but would
prefer to do this is a more open-ended (even elegant) way.  At the
end of the day it simply has to work.  But I would prefer doing it
"right." :)

Mark

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

* Re: Re: Bug: LaTeX export and LaTeX environment
  2010-05-19 19:20     ` Mark Elston
@ 2010-06-01 13:42       ` Carsten Dominik
  2010-06-01 13:57         ` Chris Gray
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2010-06-01 13:42 UTC (permalink / raw)
  To: Mark Elston; +Cc: emacs-orgmode


On May 19, 2010, at 9:20 PM, Mark Elston wrote:

> Ulf, Carsten,
>
>
> On 5/19/2010 12:27 AM, Ulf Stegemann wrote:
>> Hi Carsten,
>>
>> Carsten Dominik<carsten.dominik@gmail.com>  wrote:
>>
>>> On May 19, 2010, at 8:34 AM, Ulf Stegemann wrote:
>>>
>>>> ...
>>>> the LaTeX exporter seems to cease to work when encountering a LaTeX
>>>> environment.
>>>
>>> it has always been like this,
>>>
>>> check out this entire thread for work-arounds and other solutions
>>>
>>> http://thread.gmane.org/gmane.emacs.orgmode/12977
>>
>> I must have been blind, thanks for the pointer! It works like a charm
>> with org-special-blocks.
>>
>> Ulf
>
> I have not looked into the contrib directory lately (for quite a  
> while,
> actually) so was not aware of the org-special-blocks stuff.  This is
> pretty cool and *almost* what I was about to ask for as well.
>
> The only problem I have with it is I need (for specific  
> environments) to
> pass a parameter to the \begin{xxx} call on latex export.  I think  
> what
> is there is a more than adequate basis for what I am looking to do  
> and I
> will add my stuff to it and try it out.
>
> My question is:  Is there a preferred way of doing this?  I can do a
> local enhancement that hard-codes what I am trying to do but would
> prefer to do this is a more open-ended (even elegant) way.  At the
> end of the day it simply has to work.  But I would prefer doing it
> "right." :)

Hi Mark,

several environments already to accept parameters, and in all cases it  
is
done by just listing the arguments after the begin statement,  
separated by spaces.

So what you could implement is that if a user writes

#+begin_xxx {aa}[bb]{cc}

that org-special-blocks will then create

\begin{xxx}{aa}[bb]{cc}

I think we must ask for the space, to make sure that all old code will  
work.
A patch to org-special-blocks for this goal would be very useful, I  
think.

- Carsten



>
> Mark
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: Bug: LaTeX export and LaTeX environment
  2010-06-01 13:42       ` Carsten Dominik
@ 2010-06-01 13:57         ` Chris Gray
  2010-06-01 14:46           ` Carsten Dominik
  2010-06-01 15:02           ` Chris Gray
  0 siblings, 2 replies; 10+ messages in thread
From: Chris Gray @ 2010-06-01 13:57 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik wrote:

> Hi Mark,

> several environments already to accept parameters, and in all cases it
> is
> done by just listing the arguments after the begin statement,
> separated by spaces.

> So what you could implement is that if a user writes

> #+begin_xxx {aa}[bb]{cc}

> that org-special-blocks will then create

> \begin{xxx}{aa}[bb]{cc}

> I think we must ask for the space, to make sure that all old code will
> work.
> A patch to org-special-blocks for this goal would be very useful, I
> think.

Hi Carsten,

I actually needed this yesterday, so I'll make a patch and try to send
it in the next couple of days.

Should anything be done for the HTML exporter if there are arguments?

Cheers,
Chris

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

* Re: Re: Bug: LaTeX export and LaTeX environment
  2010-06-01 13:57         ` Chris Gray
@ 2010-06-01 14:46           ` Carsten Dominik
  2010-06-01 15:02           ` Chris Gray
  1 sibling, 0 replies; 10+ messages in thread
From: Carsten Dominik @ 2010-06-01 14:46 UTC (permalink / raw)
  To: Chris Gray; +Cc: emacs-orgmode


On Jun 1, 2010, at 3:57 PM, Chris Gray wrote:

> Carsten Dominik wrote:
>
>> Hi Mark,
>
>> several environments already to accept parameters, and in all cases  
>> it
>> is
>> done by just listing the arguments after the begin statement,
>> separated by spaces.
>
>> So what you could implement is that if a user writes
>
>> #+begin_xxx {aa}[bb]{cc}
>
>> that org-special-blocks will then create
>
>> \begin{xxx}{aa}[bb]{cc}
>
>> I think we must ask for the space, to make sure that all old code  
>> will
>> work.
>> A patch to org-special-blocks for this goal would be very useful, I
>> think.
>
> Hi Carsten,
>
> I actually needed this yesterday, so I'll make a patch and try to send
> it in the next couple of days.
>
> Should anything be done for the HTML exporter if there are arguments?

Hi Chris

I can't think of anything useful - unless we do something like

#+begin_xxx -largs "{aa}[bb]{cc}" -hargs "aa=\"xxx\" bb=\"uuu\""

and then use the largs for LaTeX and the hargs as additional attributes
in the HTML div.

But right now I don't see many applications for this in HTML, so
I am not sure it is worth the trouble.  Maybe just ignore these  
additional
arguments, or put them as a string into some special attribute like

<div class="xxx" latex_block_args="{aa}[bb]{cc}">

so that some javascript hacker can do something with these
arguments.

I am not sure what the right cause of action is, and I would
be happy already with a patch that attaches the rest of the line
in LaTeX and throws it away in HTML.

I am starting to think we should have this package in the
core - can I get you to sign the papers with the FSF for
your contributions to Org-mode?  Instructions are here:

http://orgmode.org/worg/org-contribute.php

Cheers

- Carsten

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

* Re: Bug: LaTeX export and LaTeX environment
  2010-06-01 13:57         ` Chris Gray
  2010-06-01 14:46           ` Carsten Dominik
@ 2010-06-01 15:02           ` Chris Gray
  2010-06-01 21:20             ` Mark Elston
  1 sibling, 1 reply; 10+ messages in thread
From: Chris Gray @ 2010-06-01 15:02 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

Chris Gray wrote:
> I actually needed this yesterday, so I'll make a patch and try to send
> it in the next couple of days.

Here is the patch for the LaTeX exporter.  I'm not much of an HTML
person, so I don't know if arguments would be useful there.

Cheers,
Chris


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-special-blocks-arguments.diff --]
[-- Type: text/x-diff, Size: 1389 bytes --]

commit 7a34d757ffbdeb97e7818411c5fe33e6339312e1
Author: Chris Gray <chrismgray@gmail.com>
Date:   Tue Jun 1 16:52:52 2010 +0200

    Add arguments to environments in the LaTeX expansion of org-special-blocks
    
    * contrib/lisp/org-special-blocks.el
      (org-special-blocks-convert-latex-special-cookies): Implement the
      change by slightly altering the regexp.

	Modified contrib/lisp/org-special-blocks.el
diff --git a/contrib/lisp/org-special-blocks.el b/contrib/lisp/org-special-blocks.el
index af50b30..a6064b1 100644
--- a/contrib/lisp/org-special-blocks.el
+++ b/contrib/lisp/org-special-blocks.el
@@ -64,13 +64,14 @@ seen.  This is run after a few special cases are taken care of."
 (defun org-special-blocks-convert-latex-special-cookies ()
   "Converts the special cookies into LaTeX blocks."
   (goto-char (point-min))
-  (while (re-search-forward "^ORG-\\(.*\\)-\\(START\\|END\\)$" nil t)
+  (while (re-search-forward "^ORG-\\([^ \t\n]*\\)[ \t]*\\(.*\\)-\\(START\\|END\\)$" nil t)
     (replace-match
-     (if (equal (match-string 2) "START")
-	 (concat "\\begin{" (match-string 1) "}")
+     (if (equal (match-string 3) "START")
+	 (concat "\\begin{" (match-string 1) "}" (match-string 2))
        (concat "\\end{" (match-string 1) "}"))
      t t)))
 
+
 (add-hook 'org-export-latex-after-blockquotes-hook
 	  'org-special-blocks-convert-latex-special-cookies)
 


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: Bug: LaTeX export and LaTeX environment
  2010-06-01 15:02           ` Chris Gray
@ 2010-06-01 21:20             ` Mark Elston
  2010-06-02  8:28               ` Chris Gray
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Elston @ 2010-06-01 21:20 UTC (permalink / raw)
  To: emacs-orgmode

Wow!  I had hoped to start looking at this over the long weekend
but had other things grabbing my attention.  Now Chris has already
submitted a patch for it!

Chris, I take it that the following:

   #+begin_refquote {Albert Einstein}
   Make things as simple as possible, but no simpler.
   #+end_refquote

would then translate into:

   \begin{refquote}{Albert Einstein}
   Make things as simple as possible, but no simpler.
   \end{refquote}

This is exactly what I was looking for.

Mark


On 6/1/2010 8:02 AM, Chris Gray wrote:
> Chris Gray wrote:
>> I actually needed this yesterday, so I'll make a patch and try to send
>> it in the next couple of days.
>
> Here is the patch for the LaTeX exporter.  I'm not much of an HTML
> person, so I don't know if arguments would be useful there.
>
> Cheers,
> Chris
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Bug: LaTeX export and LaTeX environment
  2010-06-01 21:20             ` Mark Elston
@ 2010-06-02  8:28               ` Chris Gray
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Gray @ 2010-06-02  8:28 UTC (permalink / raw)
  To: emacs-orgmode

Mark Elston wrote:

> Wow!  I had hoped to start looking at this over the long weekend
> but had other things grabbing my attention.  Now Chris has already
> submitted a patch for it!

> Chris, I take it that the following:

>   #+begin_refquote {Albert Einstein}
>   Make things as simple as possible, but no simpler.
>   #+end_refquote

> would then translate into:

>   \begin{refquote}{Albert Einstein}
>   Make things as simple as possible, but no simpler.
>   \end{refquote}

That's the idea.  If it doesn't work, let me know. :)

Cheers,
Chris

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

end of thread, other threads:[~2010-06-02  8:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-19  6:34 Bug: LaTeX export and LaTeX environment Ulf Stegemann
2010-05-19  6:57 ` Carsten Dominik
2010-05-19  7:27   ` Ulf Stegemann
2010-05-19 19:20     ` Mark Elston
2010-06-01 13:42       ` Carsten Dominik
2010-06-01 13:57         ` Chris Gray
2010-06-01 14:46           ` Carsten Dominik
2010-06-01 15:02           ` Chris Gray
2010-06-01 21:20             ` Mark Elston
2010-06-02  8:28               ` Chris Gray

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).