From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aLiAGMB0qmKaLwAAbAwnHQ (envelope-from ) for ; Thu, 16 Jun 2022 02:09:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id MMeGGMB0qmIyKwEA9RJhRA (envelope-from ) for ; Thu, 16 Jun 2022 02:09:36 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E1991361E2 for ; Thu, 16 Jun 2022 02:09:35 +0200 (CEST) Received: from localhost ([::1]:33356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1d4o-0002mT-HT for larch@yhetil.org; Wed, 15 Jun 2022 20:09:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1d3W-0002mK-4E for emacs-orgmode@gnu.org; Wed, 15 Jun 2022 20:08:14 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:45138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1d3U-0006IE-7d for emacs-orgmode@gnu.org; Wed, 15 Jun 2022 20:08:13 -0400 Received: by mail-pj1-x102a.google.com with SMTP id t3-20020a17090a510300b001ea87ef9a3dso30386pjh.4 for ; Wed, 15 Jun 2022 17:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=QxF6f0f1XzzTjxJLVjRv1t9e0OACyUNoLGH1w1hesIA=; b=R+p9pv5P6hTL6n5dl1vuIBVQ5dWuVIHHCV7Wh99jFOF7VKs5s9QzmMhHUGhLXWK7pm V29qPcvAwy3hUrYe4BHkrX+nkq79RVHDUEO85zIlGcpEuAQ75YuaSCHVpMkNOk6jqTqL bvxx5JSVO7hQQHMICkbQiQkyEdeXqYP+mS6iiE9DCNYHUjV8af9fcZiWh0ZrLUBB8PAp JbIdoTTCb8C4xoFO+cy66/6L6aCocCC2F0zoayAiM/v5w7T1r/aqgFYQbwRLyFMg+cA4 ZNcpEtD+HDd28CuSLn9BHCiSinfAYT2x2PLXkIfFoUieGMxkValA0pRfAsNq/ZG2bOQA FGww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version:content-transfer-encoding; bh=QxF6f0f1XzzTjxJLVjRv1t9e0OACyUNoLGH1w1hesIA=; b=G51Q2y8D85SamE51tInqnMiYUOb+4l9zHxXLGUpfDSDjRfbL9Gg/UXFVOyGQRyY9D/ ivC01kJR+KZK91Sr4cheLew6L2UxdK/Irn5FMp6g5PLCNBWFvEKHHgtYPHGryoYjKfcC I9sneGO59iUV7c+j9BGkJpxAGvxnAuvGuYy4bVMKDEmUt4yJoIxTNXBaT2+mkyJtycff KJ96AUyOCKWquMwSmSITjbbo4AeMP+54ARp5n64epscdMYxzYLWgb++t7eOw5nhi3hY6 /x5uCcPzYUBzJR1UnoQN/fiQm3J2pkyn7O7GOnmfQ1R4nNqmq1hZwG6njJaHPb1JqJR3 uiGw== X-Gm-Message-State: AJIora8+8NQIqf97FI5nhQtwsEF2iamIDSXM+Jkl5LgD6aFVyAcCLBFn dgffWPcqBbYxgYFm1mHc10lNWPjv7Yw= X-Google-Smtp-Source: AGRyM1s4O9gBA/XD+KK6n/4Wj+lPOj0AyoceRYCC6wflj0TqWC+EbZ47wetzvvsQ5jkh88IuWn8gkw== X-Received: by 2002:a17:902:f54b:b0:163:e2fd:10a5 with SMTP id h11-20020a170902f54b00b00163e2fd10a5mr2286454plf.28.1655338085979; Wed, 15 Jun 2022 17:08:05 -0700 (PDT) Received: from dingbat (2001-44b8-31f2-bb00-6dd7-9340-893b-974d.static.ipv6.internode.on.net. [2001:44b8:31f2:bb00:6dd7:9340:893b:974d]) by smtp.gmail.com with ESMTPSA id s14-20020a63770e000000b003fad46ceb85sm191001pgc.7.2022.06.15.17.08.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 17:08:05 -0700 (PDT) References: <871qvqv3ep.fsf@wi.uni-muenster.de> User-agent: mu4e 1.7.27; emacs 28.1.50 From: Tim Cross To: emacs-orgmode@gnu.org Subject: Re: Publish to HTML and LaTeX/PDF with cross-file links? Date: Thu, 16 Jun 2022 09:55:14 +1000 In-reply-to: <871qvqv3ep.fsf@wi.uni-muenster.de> Message-ID: <87h74llbbd.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=theophilusx@gmail.com; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1655338175; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=QxF6f0f1XzzTjxJLVjRv1t9e0OACyUNoLGH1w1hesIA=; b=ibveMFIroHufAiQlUpokpE+ms9j2Hgn7JO25mMES9IZ+Otu/ciGdqUak79iLaazGGjyHcs l7SrUIZIXcAOI3ImJ0PI1nRzf/uJEkajRCCSXVv3i5WZWDy5dH9cG+ZicBOh2IH6UWlpSd rMdQLNFnpjjfypPs3h8FlaoBWG1965a/GFV2SgnHLLHWAr5sTS9uU4kJPNxKChzB/blBOZ 1e8EfoLRQmAL+umYQqaIMvo2bRRXc/mB2z8HLAkhJ6BMGWFWK40kS/atoMrItZ0g9uvLt9 t4sjTDOXbpB3kZ8fNsv1XXFxr8eG274ZADlMXbZkue9chdPvnlH/JIycjUe2Nw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1655338175; a=rsa-sha256; cv=none; b=jNQyuBg3Fi3qQu+T2JaRaBJ3xydKuP8vSF9I/iRNah/Kdo3gqISGmVe4dHESfPrD0t5i05 Z3pinphjrDbDjkXO80jD6SlAka0cLS5mWBnygdFHwHHuL4wPc1gmj+/vYhFPQj4OXgjgsK pRp3AZVVryDtmKyoh9Wrx5GbDiG6GoGvrSggY6LeUppIqLFOxSGb9/zMLFF5q+95DBfCx8 AtwkvQ8fG3NErwEvElGM4o02aaUxwoDwXXVe0XiVqkC82YALPWERCXoe+VvfatUa0AQyEo lT/EcLW/5sDkcEuArasL4gvHIHaK1ezraJGPUxlVEAZtTZb2BSwf6qB/h3KghA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=R+p9pv5P; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.99 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=R+p9pv5P; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: E1991361E2 X-Spam-Score: -2.99 X-Migadu-Scanner: scn1.migadu.com X-TUID: /wjpCUmBNLLr Jens Lechtenboerger writes: > Hi all, > > I publish OER (https://oer.gitlab.io/) from Org sources and wonder > about links to local files as documented at [1]. That page only > talks about HTML export. How can I achieve similar behavior for > LaTeX/PDF export? > > More precisely: For HTML export, a link like > [[file:foo.org::#custom-id][elsewhere]] turns into a hyperlink to > =E2=80=9Cfoo.html#custom-id=E2=80=9D, which is what I want. > > However, for LaTeX/PDF export, the hyperlink points to the source > file =E2=80=9Cfoo.org=E2=80=9D, which in my case is a broken link. I wou= ld like > that to be =E2=80=9Cfoo.pdf=E2=80=9D (or even something pointing at the p= roper > section in the PDF file). > > Is this (easily) possible? > I think what you need is an export filter function for links in latex exports. Have a look at the docstring for variable org-export-filter-link-f= unctions.=20 As a very basic example, the following should work (defun my-latex-link-filter (text backend info) "Replace link to org files with pdf version." (when (org-export-derived-backend-p backend 'latex) (replace-regexp-in-string "\\.org" ".pdf" text))) (add-to-list 'org-export-filter-link-functions 'my-latex-link-filter) =20=20=20=20=20=20=20=20=20=20=20=20=20 Note that the above example is likely too 'basic'. For example, you need to be wary of the file path if the exported PDF is going to be moved to a different location. This is one of the limitations of file links.=20 If you have a sufficiently complex publishing requirement, you might find the org-publish module useful as it can provide a convenient way to put all your publishing configuration into a single easier to manage variable. (see org manual section on publishing).=20