[O] Comment lines interfere with figure options

2015-10-30 Thread Mark Edgington
If I have some org-mode content that looks like this...

#+NAME: fig-myimage
#+CAPTION: Caption of Figure
#+ATTR_LaTeX: :width 5cm
#+RESULTS: myimage
[[file:images/myimage.png]]

then I get a centered figure with the appropriate width and caption
when exporting to LaTeX.  If, however, I add a comment (or two)
in-between one of the option-lines...

#+NAME: fig-myimage
#+CAPTION: Caption of Figure
# (this was the original width)
# +ATTR_LaTeX: width 10cm
#+ATTR_LaTeX: :width 5cm
#+RESULTS: myimage
[[file:images/myimage.png]]

then all of the settings above the comments are lost.  Would it be
difficult to modify org-mode so that comment-lines are ignored when
looking for a block of settings lines that precede an image?  This
seems like sensible behavior to me, and there are cases when it would
be convenient to annotate the options you've used, or to temporarily
replace one option-line with another by commenting one out.



Re: [O] Comment lines interfere with figure options

2015-10-30 Thread Nicolas Goaziou
Hello,

Mark Edgington  writes:

> If I have some org-mode content that looks like this...
>
> #+NAME: fig-myimage
> #+CAPTION: Caption of Figure
> #+ATTR_LaTeX: :width 5cm
> #+RESULTS: myimage
> [[file:images/myimage.png]]
>
> then I get a centered figure with the appropriate width and caption
> when exporting to LaTeX.  If, however, I add a comment (or two)
> in-between one of the option-lines...
>
> #+NAME: fig-myimage
> #+CAPTION: Caption of Figure
> # (this was the original width)
> # +ATTR_LaTeX: width 10cm
> #+ATTR_LaTeX: :width 5cm
> #+RESULTS: myimage
> [[file:images/myimage.png]]
>
> then all of the settings above the comments are lost.  Would it be
> difficult to modify org-mode so that comment-lines are ignored when
> looking for a block of settings lines that precede an image?

It means introducing a special cases for comments (i.e.,
comments-in-attributes). I'm not a big fan of special cases.

However you can comment the attribute above the block, e.g.,

  # (this was the original width)
  # +ATTR_LaTeX: width 10cm
  #+NAME: fig-myimage
  #+CAPTION: Caption of Figure
  #+ATTR_LaTeX: :width 5cm
  #+RESULTS: myimage
  [[file:images/myimage.png]]

It is very easy to do with M-S-up/down, considering you probably don't
have a screenful of attributes for the same block.


Regards,

-- 
Nicolas Goaziou