From: Tim Cross <email@example.com>
Subject: Re: Publish to HTML and LaTeX/PDF with cross-file links?
Date: Thu, 16 Jun 2022 09:55:14 +1000 [thread overview]
Message-ID: <firstname.lastname@example.org> (raw)
Jens Lechtenboerger <email@example.com> writes:
> Hi all,
> I publish OER (https://oer.gitlab.io/) from Org sources and wonder
> about links to local files as documented at . 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
> “foo.html#custom-id”, which is what I want.
> However, for LaTeX/PDF export, the hyperlink points to the source
> file “foo.org”, which in my case is a broken link. I would like
> that to be “foo.pdf” (or even something pointing at the proper
> 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-functions.
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)))
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.
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).
next prev parent reply other threads:[~2022-06-16 0:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-15 6:36 Publish to HTML and LaTeX/PDF with cross-file links? Jens Lechtenboerger
2022-06-15 23:55 ` Tim Cross [this message]
2022-06-16 9:17 ` Jens Lechtenboerger
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
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).