From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: using vref in latex export, and normal links in html export Date: Fri, 11 Mar 2016 14:11:23 +0100 Message-ID: References: <8737rxwa2i.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeMqm-0006js-HE for emacs-orgmode@gnu.org; Fri, 11 Mar 2016 08:11:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeMqj-0003oh-3L for emacs-orgmode@gnu.org; Fri, 11 Mar 2016 08:11:28 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:38665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeMqi-0003oV-Tl for emacs-orgmode@gnu.org; Fri, 11 Mar 2016 08:11:25 -0500 In-Reply-To: <8737rxwa2i.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Fri, 11 Mar 2016 11:03:33 +0000") 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: emacs-orgmode --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Eric, On 2016-03-11 12:03, Eric S Fraga writes: > On Friday, 11 Mar 2016 at 11:20, Alan Schmitt wrote: >> Hello, >> >> 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 thought I could do this trick with a macro: >> >> #+macro: vref @@latex:\myvref{$1}{@@[[$1]]@@latex:}@@ > > I may be missing something but could you not simply use > > [[vref:fig:log-expt-7]] > > (along with description text if you wished) and define an org link as > below? > > #+begin_src elisp > (org-add-link-type "vref" nil > (lambda (path desc format) > (cond > ((eq format 'latex) > (format "\\vref{%s}" path))))) > #+end_src > > (untested) Thank you for the suggestion, but I end up with the same thing as with the macro: the reference generated is to "fig:log-expt-7", but this does not work as the label assigned by org to the figure is "fig:orgparagraph1". Here is a small example of a similar problem. Exporting this to latex This is a \ref{fig:foo} and this is a link [[fig:foo]] #+label: fig:foo #+begin_figure Test #+end_figure results in #+begin_src latex This is a \ref{fig:foo} and this is a link \ref{orgspecialblock1} \begin{figure} Test \label{orgspecialblock1} \end{figure} #+end_src Alan =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 Monthly Athmospheric CO=E2=82=82 (2016-02, Mauna Loa Obs.): 404.02 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBCgAGBQJW4sP7AAoJEAQNCjtO0uXHN28IAL5q7ru3P+rYKAEY2KdrslNo ZSK2gcQGTis4gGpLeQiG4UeqcIl21kCqugPqy8/PjJ6tJzoURL+XSVEDiusOmSAF X5BHNCIdASUaATGIU/D7ywCQYf6z3y0/y4eJ8B5tbmoZ1R2DPtkr8q6KgN0T6AFb xMf2HaSZVRLH//JthdIzQncT8BpKOS4QohFR/KX9OdsUlHnYSBK4slbBwKB/jCn/ etaLK0YCPMadHl6+sBfYFDr8lOcNxRhdUUP9Qri/xto379CN+u6+7IV25U/+iXPP mMSG+SeUImDBAV43/YmZ+UBAxs65db24Rgq32CC0ZUOJ0f+fso5BEohPV1d4cbw= =fZTo -----END PGP SIGNATURE----- --=-=-=--