emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] using vref in latex export, and normal links in html export


From: Alan Schmitt
Subject: Re: [O] using vref in latex export, and normal links in html export
Date: Fri, 11 Mar 2016 14:11:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin)

Hello Eric,

On 2016-03-11 12:03, Eric S Fraga <address@hidden> 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

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂ (2016-02, Mauna Loa Obs.): 404.02

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]