From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: using vref in latex export, and normal links in html export Date: Sat, 12 Mar 2016 16:27:22 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aer4M-0006Xc-KP for emacs-orgmode@gnu.org; Sat, 12 Mar 2016 16:27:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aer4H-0000Fj-SQ for emacs-orgmode@gnu.org; Sat, 12 Mar 2016 16:27:30 -0500 Received: from mail-qg0-x235.google.com ([2607:f8b0:400d:c04::235]:33406) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aer4H-0000Ff-Ng for emacs-orgmode@gnu.org; Sat, 12 Mar 2016 16:27:25 -0500 Received: by mail-qg0-x235.google.com with SMTP id t4so125806485qge.0 for ; Sat, 12 Mar 2016 13:27:25 -0800 (PST) In-reply-to: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Stefan Nobis Cc: emacs-orgmode@gnu.org you could also try redefining the export of a ref link like this. #+BEGIN_SRC emacs-lisp (setf (elt (assoc "ref" org-link-protocols) 2) (lambda (keyword desc format) (cond ((eq format 'latex) "\\vref{keyword}") ((eq format 'html) (format "%s" keyword (or desc "")))))) #+END_SRC I am not sure if that is the kind of html export you want, but you could adapt it to something else. Stefan Nobis writes: > Alan Schmitt writes: > >> I'm converting a latex document into org-mode to easily export it both >> to latex and html. I've just encountered something that I don't know how >> to do: export a \vref reference. I would like to have something that >> exports to \vref in latex, and to a normal link in html. > > I solve this with the help of an export filter: > > --8<---------------cut here---------------start------------->8--- > (defun sn/ox-latex-filter-varioref (text backend info) > (when (org-export-derived-backend-p backend 'latex) > (replace-regexp-in-string "\\\\ref{" "\\\\vref{" text))) > > (eval-after-load "ox-latex" > '(progn > (add-to-list 'org-export-filter-link-functions 'sn/ox-latex-filter-varioref))) > --8<---------------cut here---------------end--------------->8--- -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu