emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG?] Strange effect of noweb name collision on LaTeX export
@ 2012-06-08  0:50 Ethan Ligon
  2012-06-08 15:13 ` Eric Schulte
  0 siblings, 1 reply; 3+ messages in thread
From: Ethan Ligon @ 2012-06-08  0:50 UTC (permalink / raw)
  To: Emacs-orgmode@gnu.org

#+TITLE:       Example of name collision bug
#+AUTHOR:
#+EMAIL:
#+DATE:      2012-06-07 Thu
#+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t

* Figure and trivial code reference
  Here we have a figure.
  This example works as expected; we get a latex figure on export.

[[./foo.png]]

* Figure and trivial code reference (with collision)
  Here we have a figure and a trivial code block with a noweb reference.
  The difference is that the basename of the figure matches the noweb
  reference.  Instead of a figure on latex export, we get a hyperref!

[[./bar.png]]

#+BEGIN_SRC sh :exports none
#<<bar>>
#+END_SRC


-- 
Ethan Ligon, Associate Professor
Agricultural & Resource Economics
University of California, Berkeley

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

* Re: [BUG?] Strange effect of noweb name collision on LaTeX export
  2012-06-08  0:50 [BUG?] Strange effect of noweb name collision on LaTeX export Ethan Ligon
@ 2012-06-08 15:13 ` Eric Schulte
  2012-06-08 15:54   ` Ethan Ligon
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Schulte @ 2012-06-08 15:13 UTC (permalink / raw)
  To: Ethan Ligon; +Cc: Emacs-orgmode@gnu.org

Ethan Ligon <ligon@are.berkeley.edu> writes:

> #+TITLE:       Example of name collision bug
> #+AUTHOR:
> #+EMAIL:
> #+DATE:      2012-06-07 Thu
> #+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
>
> * Figure and trivial code reference
>   Here we have a figure.
>   This example works as expected; we get a latex figure on export.
>
> [[./foo.png]]
>
> * Figure and trivial code reference (with collision)
>   Here we have a figure and a trivial code block with a noweb reference.
>   The difference is that the basename of the figure matches the noweb
>   reference.  Instead of a figure on latex export, we get a hyperref!
>
> [[./bar.png]]
>
> #+BEGIN_SRC sh :exports none
> #<<bar>>
> #+END_SRC

Ah, so as it turns out the syntax for the noweb reference happens to be
the same as the syntax used to specify a latex label.  In this case the
LaTeX exporter first mistakes the <<bar>> as a label anchor, and then
apparently converts the bar.png link to a real link.

The latex exporter probably shouldn't try to make anchors out of the
text within code blocks.  However, in the mean time you can customize
the noweb syntax using the `org-babel-noweb-wrap-start' and
`org-babel-noweb-wrap-end' variables so that they aren't mistaken for
label anchors.

Best,

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

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

* Re: [BUG?] Strange effect of noweb name collision on LaTeX export
  2012-06-08 15:13 ` Eric Schulte
@ 2012-06-08 15:54   ` Ethan Ligon
  0 siblings, 0 replies; 3+ messages in thread
From: Ethan Ligon @ 2012-06-08 15:54 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Emacs-orgmode@gnu.org

On Fri, Jun 8, 2012 at 8:13 AM, Eric Schulte <eric.schulte@gmx.com> wrote:
> Ethan Ligon <ligon@are.berkeley.edu> writes:
>
>> #+TITLE:       Example of name collision bug
>> #+AUTHOR:
>> #+EMAIL:
>> #+DATE:      2012-06-07 Thu
>> #+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
>>
>> * Figure and trivial code reference
>>   Here we have a figure.
>>   This example works as expected; we get a latex figure on export.
>>
>> [[./foo.png]]
>>
>> * Figure and trivial code reference (with collision)
>>   Here we have a figure and a trivial code block with a noweb reference.
>>   The difference is that the basename of the figure matches the noweb
>>   reference.  Instead of a figure on latex export, we get a hyperref!
>>
>> [[./bar.png]]
>>
>> #+BEGIN_SRC sh :exports none
>> #<<bar>>
>> #+END_SRC
>
> Ah, so as it turns out the syntax for the noweb reference happens to be
> the same as the syntax used to specify a latex label.  In this case the
> LaTeX exporter first mistakes the <<bar>> as a label anchor, and then
> apparently converts the bar.png link to a real link.
>
> The latex exporter probably shouldn't try to make anchors out of the
> text within code blocks.  However, in the mean time you can customize
> the noweb syntax using the `org-babel-noweb-wrap-start' and
> `org-babel-noweb-wrap-end' variables so that they aren't mistaken for
> label anchors.

This diagnosis seems exactly right (and thanks for the work-around).
The problem is even worse than I indicated earlier, though---things
like

./foo-bar.png
or
./foo_bar.png

are incorrectly turned into a link if there's any source block along
the lines of
#+begin_src sh
<<foo>>
#+end_src

or

#+begin_src sh
<<bar>>
#+end_src

Note also that this is not just an ambiguity about whether
./foo-bar.png should be treated as a link or a figure, because if it's
a link it's a /broken/ link (in the example above the resulting LaTeX
is \hyperref[.-foo-bar.png]{./foo-bar.png})

-Ethan

-- 
Ethan Ligon, Associate Professor
Agricultural & Resource Economics
University of California, Berkeley

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

end of thread, other threads:[~2012-06-08 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-08  0:50 [BUG?] Strange effect of noweb name collision on LaTeX export Ethan Ligon
2012-06-08 15:13 ` Eric Schulte
2012-06-08 15:54   ` Ethan Ligon

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