emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* new exporter and latex attributes
@ 2012-08-20 21:28 Rick Frankel
  2012-08-20 22:54 ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Rick Frankel @ 2012-08-20 21:28 UTC (permalink / raw)
  To: emacs-orgmode

Has the syntax for latex attributes changed in the new exporter, or is
is the following a bug?

Given this source file:

* Test width attribute
#+ATTR_LATEX: width=3in
#+begin_src dot :file t.png 
  digraph g { a -> b }
#+end_src

#+results:
[[file:t.png]]

The old exporter generats:
#+begin_src latex
  \includegraphics[width=3in]{t.png}
#+end_src

And the new exporter
#+begin_src latex
  \includegraphics[width=.9\linewidth]{t.png}
#+end_src

which ignores the width override.

rick

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

* Re: new exporter and latex attributes
  2012-08-20 21:28 new exporter and latex attributes Rick Frankel
@ 2012-08-20 22:54 ` Nicolas Goaziou
  2012-08-21  0:55   ` Rick Frankel
  2012-08-21 13:04   ` Bastien
  0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2012-08-20 22:54 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Rick Frankel <rick@rickster.com> writes:

> Has the syntax for latex attributes changed in the new exporter, or is
> is the following a bug?

Neither. Though, at some point, I'd like to change syntax for LaTeX
attributes for a plist-based one.

> Given this source file:
>
> * Test width attribute
> #+ATTR_LATEX: width=3in
> #+begin_src dot :file t.png 
>   digraph g { a -> b }
> #+end_src
>
> #+results: [[file:t.png]]
>
> The old exporter generats:
> #+begin_src latex
>   \includegraphics[width=3in]{t.png}
> #+end_src
>
> And the new exporter
> #+begin_src latex
>   \includegraphics[width=.9\linewidth]{t.png}
> #+end_src
>
> which ignores the width override.

"width" is an attribute for the file, but it means nothing for the
source code.

Use something like the following.

* Test width attribute
#+NAME: graph
#+begin_src dot :file t.png 
  digraph g { a -> b }
#+end_src

#+ATTR_LATEX: width=3in
#+RESULTS: graph
[[file:t.png]]


Regards,

-- 
Nicolas Goaziou

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

* Re: new exporter and latex attributes
  2012-08-20 22:54 ` Nicolas Goaziou
@ 2012-08-21  0:55   ` Rick Frankel
       [not found]     ` <rick@rickster.com>
  2012-08-21 13:06     ` Bastien
  2012-08-21 13:04   ` Bastien
  1 sibling, 2 replies; 11+ messages in thread
From: Rick Frankel @ 2012-08-21  0:55 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Aug 21, 2012 at 12:54:25AM +0200, Nicolas Goaziou wrote:
> Hello,
> 
> Rick Frankel <rick@rickster.com> writes:
> 
> > Has the syntax for latex attributes changed in the new exporter, or is
> > is the following a bug?
> 
> Neither. Though, at some point, I'd like to change syntax for LaTeX
> attributes for a plist-based one.
> 
> Use something like the following.
> 
> * Test width attribute
> #+NAME: graph
> #+begin_src dot :file t.png 
>   digraph g { a -> b }
> #+end_src
> 
> #+ATTR_LATEX: width=3in
> #+RESULTS: graph
> [[file:t.png]]
> 
> 
That doesn't make sense. In the current exporter, all attributes
(html, latex, etc) applied to the export are placed directly before
the source block. If you have to run the source block and then place
the attributes just before the results line you disconnect the results
from the source block, and the next time the source block is evaluated
a second results block will be added to the file. Babel doesn't allow
for anything between =#+end_src= and =#+results=.


rick

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

* Re: new exporter and latex attributes
       [not found]     ` <rick@rickster.com>
@ 2012-08-21  5:34       ` Nick Dokos
  2012-08-21 19:08         ` Rick Frankel
  0 siblings, 1 reply; 11+ messages in thread
From: Nick Dokos @ 2012-08-21  5:34 UTC (permalink / raw)
  To: emacs-orgmode

Rick Frankel <rick@rickster.com> wrote:

> On Tue, Aug 21, 2012 at 12:54:25AM +0200, Nicolas Goaziou wrote:
> > Hello,
> > 
> > Rick Frankel <rick@rickster.com> writes:
> > 
> > > Has the syntax for latex attributes changed in the new exporter, or is
> > > is the following a bug?
> > 
> > Neither. Though, at some point, I'd like to change syntax for LaTeX
> > attributes for a plist-based one.
> > 
> > Use something like the following.
> > 
> > * Test width attribute
> > #+NAME: graph
> > #+begin_src dot :file t.png 
> >   digraph g { a -> b }
> > #+end_src
> > 
> > #+ATTR_LATEX: width=3in
> > #+RESULTS: graph
> > [[file:t.png]]
> > 
> > 
> That doesn't make sense. In the current exporter, all attributes
> (html, latex, etc) applied to the export are placed directly before
> the source block. If you have to run the source block and then place
> the attributes just before the results line you disconnect the results
> from the source block, and the next time the source block is evaluated
> a second results block will be added to the file. Babel doesn't allow
> for anything between =#+end_src= and =#+results=.
> 

Named source blocks will refresh the corresponding named results blocks
anywhere in the file: they don't produce a new set each time they are
executed and it doesn't matter whether they are "disconnected". I'm not
sure how far back this behavior goes, but it is how current (well,
slightly out-of-date but not too much) master-branch org behaves.

Nick

Org-mode version 7.8.11 (release_7.8.11-501-gc4050a @ /home/nick/elisp/org-mode/lisp/)

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

* Re: new exporter and latex attributes
  2012-08-20 22:54 ` Nicolas Goaziou
  2012-08-21  0:55   ` Rick Frankel
@ 2012-08-21 13:04   ` Bastien
  2012-08-21 13:07     ` Nicolas Goaziou
  2012-08-21 13:47     ` Nick Dokos
  1 sibling, 2 replies; 11+ messages in thread
From: Bastien @ 2012-08-21 13:04 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, schulte eric

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Use something like the following.

There is still a bug here.

I've encountered it many times.

> * Test width attribute
> #+NAME: graph
> #+begin_src dot :file t.png 
>   digraph g { a -> b }
> #+end_src
>
> #+ATTR_LATEX: width=3in
> #+RESULTS: graph
> [[file:t.png]]

When reevaluating the source block with C-c C-c, the #+ATTR_LATEX 
will be deleted.   Can you or Eric look for a way to fix this?  I 
see no reason why #+ATTR_LATEX should be deleted...

-- 
 Bastien

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

* Re: new exporter and latex attributes
  2012-08-21  0:55   ` Rick Frankel
       [not found]     ` <rick@rickster.com>
@ 2012-08-21 13:06     ` Bastien
  1 sibling, 0 replies; 11+ messages in thread
From: Bastien @ 2012-08-21 13:06 UTC (permalink / raw)
  To: emacs-orgmode

Rick Frankel <rick@rickster.com> writes:

> That doesn't make sense. In the current exporter, all attributes
> (html, latex, etc) applied to the export are placed directly before
> the source block.

This should change.  Attributes are attributes to something (big up
Husserl), so attributes to images should be placed right before the
images, etc.

-- 
 Bastien

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

* Re: new exporter and latex attributes
  2012-08-21 13:04   ` Bastien
@ 2012-08-21 13:07     ` Nicolas Goaziou
  2012-08-21 13:47     ` Nick Dokos
  1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2012-08-21 13:07 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, schulte eric

Hello,

Bastien <bzg@altern.org> writes:

> There is still a bug here.
>
> I've encountered it many times.
>
>> * Test width attribute
>> #+NAME: graph
>> #+begin_src dot :file t.png 
>>   digraph g { a -> b }
>> #+end_src
>>
>> #+ATTR_LATEX: width=3in
>> #+RESULTS: graph
>> [[file:t.png]]
>
> When reevaluating the source block with C-c C-c, the #+ATTR_LATEX 
> will be deleted.

I cannot reproduce it. What is your Babel config?


Regards,

-- 
Nicolas Goaziou

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

* Re: new exporter and latex attributes
  2012-08-21 13:04   ` Bastien
  2012-08-21 13:07     ` Nicolas Goaziou
@ 2012-08-21 13:47     ` Nick Dokos
  2012-08-21 17:41       ` Bastien
  1 sibling, 1 reply; 11+ messages in thread
From: Nick Dokos @ 2012-08-21 13:47 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Nicolas Goaziou, schulte eric

Bastien <bzg@altern.org> wrote:

> Hi Nicolas,
> 
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
> 
> > Use something like the following.
> 
> There is still a bug here.
> 
> I've encountered it many times.
> 
> > * Test width attribute
> > #+NAME: graph
> > #+begin_src dot :file t.png 
> >   digraph g { a -> b }
> > #+end_src
> >
> > #+ATTR_LATEX: width=3in
> > #+RESULTS: graph
> > [[file:t.png]]
> 
> When reevaluating the source block with C-c C-c, the #+ATTR_LATEX 
> will be deleted.   Can you or Eric look for a way to fix this?  I 
> see no reason why #+ATTR_LATEX should be deleted...
> 

FWIW, I cannot reproduce this.

Nick

Org-mode version 7.8.11 (release_7.8.11-501-gc4050a @ /home/nick/elisp/org-mode/lisp/)

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

* Re: new exporter and latex attributes
  2012-08-21 13:47     ` Nick Dokos
@ 2012-08-21 17:41       ` Bastien
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2012-08-21 17:41 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Nicolas Goaziou, emacs-orgmode, schulte eric

Nick Dokos <nicholas.dokos@hp.com> writes:

> FWIW, I cannot reproduce this.

Me neither, dunno what I did.  Sorry for the noise,

-- 
 Bastien

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

* Re: new exporter and latex attributes
  2012-08-21  5:34       ` Nick Dokos
@ 2012-08-21 19:08         ` Rick Frankel
  2012-08-21 20:27           ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Rick Frankel @ 2012-08-21 19:08 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Aug 21, 2012 at 01:34:16AM -0400, Nick Dokos wrote:
> Rick Frankel <rick@rickster.com> wrote:
> 
> > On Tue, Aug 21, 2012 at 12:54:25AM +0200, Nicolas Goaziou wrote:
> > > Hello,
> > > 
> > > Use something like the following.
> > > 
> > > * Test width attribute
> > > #+NAME: graph
> > > #+begin_src dot :file t.png 
> > >   digraph g { a -> b }
> > > #+end_src
> > > 
> > > #+ATTR_LATEX: width=3in
> > > #+RESULTS: graph
> > > [[file:t.png]]
> > > 

> Named source blocks will refresh the corresponding named results blocks
> anywhere in the file: they don't produce a new set each time they are
> executed and it doesn't matter whether they are "disconnected". I'm not
> sure how far back this behavior goes, but it is how current (well,
> slightly out-of-date but not too much) master-branch org behaves.
> 

Yes. IF the source block is named, the results block will be
replaced regardless of where it lives in the file, so adding
attributes above the results block works.

BUT, if the source block is not named then a duplicate results will be
created above the current results block w/ the attribute header when
the source block is re-evaluated.

I guess it's acceptable to require all source blocks to be named if
you want to have header attributes associated with the generated
results, but this is a significant incompatible change from the
behavior of the current exporter...

rick

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

* Re: new exporter and latex attributes
  2012-08-21 19:08         ` Rick Frankel
@ 2012-08-21 20:27           ` Nicolas Goaziou
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2012-08-21 20:27 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Rick Frankel <rick@rickster.com> writes:

> BUT, if the source block is not named then a duplicate results will be
> created above the current results block w/ the attribute header when
> the source block is re-evaluated.

That's correct.

For convenience, Babel might copy src-block attributes to the generated
results upon block evaluation. It would be strange though: do both
src-block and results have to share the same caption, the same label..?
We could limit copy to ATTR keywords, perhaps. I feel it's hackish,
though.

> I guess it's acceptable to require all source blocks to be named if
> you want to have header attributes associated with the generated
> results, but this is a significant incompatible change from the
> behavior of the current exporter...

There are a few incompatible changes, indeed. You can't make an omelette
without breaking eggs.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2012-08-21 20:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 21:28 new exporter and latex attributes Rick Frankel
2012-08-20 22:54 ` Nicolas Goaziou
2012-08-21  0:55   ` Rick Frankel
     [not found]     ` <rick@rickster.com>
2012-08-21  5:34       ` Nick Dokos
2012-08-21 19:08         ` Rick Frankel
2012-08-21 20:27           ` Nicolas Goaziou
2012-08-21 13:06     ` Bastien
2012-08-21 13:04   ` Bastien
2012-08-21 13:07     ` Nicolas Goaziou
2012-08-21 13:47     ` Nick Dokos
2012-08-21 17:41       ` Bastien

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