From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: How to fix path to figures in included files Date: Thu, 20 Oct 2016 18:49:26 +0200 Message-ID: <878ttjynhl.fsf@nicolasgoaziou.fr> References: <871szlzfz0.fsf@thinkpad.rath.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxGX4-0001PL-52 for emacs-orgmode@gnu.org; Thu, 20 Oct 2016 12:49:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxGX3-0003Um-Bj for emacs-orgmode@gnu.org; Thu, 20 Oct 2016 12:49:30 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:52870) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxGX3-0003U6-5q for emacs-orgmode@gnu.org; Thu, 20 Oct 2016 12:49:29 -0400 Received: from saiph (unknown [IPv6:2a03:a0a0:0:4301::b3c]) (Authenticated sender: mail@nicolasgoaziou.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 4CD5DA80CD for ; Thu, 20 Oct 2016 18:49:26 +0200 (CEST) In-Reply-To: <871szlzfz0.fsf@thinkpad.rath.org> (Nikolaus Rath's message of "Wed, 12 Oct 2016 09:31:31 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hello, Nikolaus Rath 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