emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to fix path to figures in included files
@ 2016-10-12 16:31 Nikolaus Rath
  2016-10-20 16:49 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolaus Rath @ 2016-10-12 16:31 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

When using INCLUDE in an org-file to include a file in a sub-directory
(e.g. "#+INCLUDE: preamble/preamble.org"), and the included file in turn
refers to a file ("[[./figure1.png]]"), then the LaTeX export for the
top-level org file refers to the file with its path relative to the
included .org file rather than the top-level org file for which LaTeX is
generated.

Is there a way to fix this?

In other words, if I have a file "main.org" that contains just

,----
| #+INCLUDE: preamble/preamble.org"
`----

and preamble/preamble.org contains

,----
| * Preamble
| 
| Look at this amazing image:
| [[./file1.png]]
`----

Then the LaTeX that is generated for "main.org" is

,----
| \part{Preamble}
| \label{sec:orgheadline3}
| 
| Look at this amazing image:
| 
| \includegraphics[width=.9\linewidth]{./figure1.png}
`----

but I want it to be:

,----
| \part{Preamble}
| \label{sec:orgheadline3}
| 
| Look at this amazing image:
| 
| \includegraphics[width=.9\linewidth]{preamble/figure1.png}
`----

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«

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

* Re: How to fix path to figures in included files
  2016-10-12 16:31 How to fix path to figures in included files Nikolaus Rath
@ 2016-10-20 16:49 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2016-10-20 16:49 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Nikolaus Rath <Nikolaus@rath.org> writes:

> When using INCLUDE in an org-file to include a file in a sub-directory
> (e.g. "#+INCLUDE: preamble/preamble.org"), and the included file in turn
> refers to a file ("[[./figure1.png]]"), then the LaTeX export for the
> top-level org file refers to the file with its path relative to the
> included .org file rather than the top-level org file for which LaTeX is
> generated.
>
> Is there a way to fix this?

I'm pretty sure that question was raised before on this ML, but, after
a cursory look, I cannot find any reference to it.

There is no way to fix this for the time being. I can think of two
solutions.

1. We could add a hook just before inserting included file in the master
   document, so you get a chance to rewrite links yourself.

2. We could do that rewriting every file link with a relative path
   ourselves.

Second option only makes sense if the behavior you suggest is always the
one needed. We may need some more feedback about this.

Also, it could fail for some link types, when the path is not obviously
a file, e.g. [[foo:a/b]]. IOW, if implemented, we would have to limit
ourselves to "file:" links.

OTOH, the first solution is easy to implement.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2016-10-20 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 16:31 How to fix path to figures in included files Nikolaus Rath
2016-10-20 16:49 ` Nicolas Goaziou

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