* changing \href to \myhref in LaTex export
@ 2010-01-19 15:31 "Martin G. Skjæveland"
2010-01-20 8:40 ` Sébastien Vauban
0 siblings, 1 reply; 8+ messages in thread
From: "Martin G. Skjæveland" @ 2010-01-19 15:31 UTC (permalink / raw
To: emacs-orgmode
Hi,
is it possible to change how hyperlinks are exported to LaTex without
going into to org-latex.el, but setting by a variable or similar in my
.emacs file?
I would like to export hyperlinks in Latex as \myhref (or something
else) instead of \href, so that I can redefine \myhref using \href, like
this
\usepackage{ifthen}
\newcommand{\myhref}[2]{
\ifthenelse{\equal{#1}{#2}}
{\href{#1}{#2}}
{\href{#1}{#2}\footnote{\url{#1}}}
}
and thus include the URLs of the links as footnotes.
(I thought I could set this with a parameter of the hyperref package in
LaTex, but I have not found a way.)
Thanks!
Martin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: changing \href to \myhref in LaTex export
2010-01-19 15:31 changing \href to \myhref in LaTex export "Martin G. Skjæveland"
@ 2010-01-20 8:40 ` Sébastien Vauban
2010-01-20 9:19 ` "Martin G. Skjæveland"
0 siblings, 1 reply; 8+ messages in thread
From: Sébastien Vauban @ 2010-01-20 8:40 UTC (permalink / raw
To: emacs-orgmode-mXXj517/zsQ
Hi Martin,
"Martin G. Skjæveland" wrote:
>
> is it possible to change how hyperlinks are exported to LaTex without going
> into to org-latex.el, but setting by a variable or similar in my .emacs
> file?
>
> I would like to export hyperlinks in Latex as \myhref (or something else)
> instead of \href, so that I can redefine \myhref using \href, like this
>
> \usepackage{ifthen}
> \newcommand{\myhref}[2]{
> \ifthenelse{\equal{#1}{#2}}
> {\href{#1}{#2}}
> {\href{#1}{#2}\footnote{\url{#1}}}
> }
>
> and thus include the URLs of the links as footnotes.
Not answering clearly your question, but an alternative (that works) is to
redefine \href either in your private class (if you use one) or in your TeX
file.
In the latter case, put the `renewcommand' in your Org source, so that it gets
exported every time.
Example (with a `newcommand' here):
--8<---------------cut here---------------start------------->8---
#+LaTeX_HEADER: \newcommand{\figtext}[2]{\begin{tikzpicture} \draw (-#1/2,-#1/2) rectangle (#1/2,#1/2); \node[text width=#1] at (0,0) {\color{blue}\scriptsize{#2}}; \end{tikzpicture}}
--8<---------------cut here---------------end--------------->8---
I think, for this case, this offers more flexibility and allows you to get
what you want.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: changing \href to \myhref in LaTex export
2010-01-20 8:40 ` Sébastien Vauban
@ 2010-01-20 9:19 ` "Martin G. Skjæveland"
2010-01-20 9:28 ` Carsten Dominik
2010-01-20 11:10 ` Sébastien Vauban
0 siblings, 2 replies; 8+ messages in thread
From: "Martin G. Skjæveland" @ 2010-01-20 9:19 UTC (permalink / raw
To: Sébastien Vauban; +Cc: emacs-orgmode
Sébastien Vauban wrote:
> Hi Martin,
>
> "Martin G. Skjæveland" wrote:
>> is it possible to change how hyperlinks are exported to LaTex without going
>> into to org-latex.el, but setting by a variable or similar in my .emacs
>> file?
>>
>> I would like to export hyperlinks in Latex as \myhref (or something else)
>> instead of \href, so that I can redefine \myhref using \href, like this
>>
>> \usepackage{ifthen}
>> \newcommand{\myhref}[2]{
>> \ifthenelse{\equal{#1}{#2}}
>> {\href{#1}{#2}}
>> {\href{#1}{#2}\footnote{\url{#1}}}
>> }
>>
>> and thus include the URLs of the links as footnotes.
>
> Not answering clearly your question, but an alternative (that works) is to
> redefine \href either in your private class (if you use one) or in your TeX
> file.
>
> In the latter case, put the `renewcommand' in your Org source, so that it gets
> exported every time.
>
> Example (with a `newcommand' here):
>
> --8<---------------cut here---------------start------------->8---
> #+LaTeX_HEADER: \newcommand{\figtext}[2]{\begin{tikzpicture} \draw (-#1/2,-#1/2) rectangle (#1/2,#1/2); \node[text width=#1] at (0,0) {\color{blue}\scriptsize{#2}}; \end{tikzpicture}}
> --8<---------------cut here---------------end--------------->8---
>
> I think, for this case, this offers more flexibility and allows you to get
> what you want.
Hi Seb,
yes, this looks like the flexibility I'm after, but my problem with your
solution is that by using \renewcommand I would be defining a recursive
command, which does not work. (I should have mentioned that in my first
email, sorry.) This is the reason for renaming the \href command in the
export, so I can define my own href command using the standard href.
The reason I want to do this in the first place is to make URLs
available when the latex pdf is printed.
Martin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: changing \href to \myhref in LaTex export
2010-01-20 9:19 ` "Martin G. Skjæveland"
@ 2010-01-20 9:28 ` Carsten Dominik
2010-01-20 10:00 ` "Martin G. Skjæveland"
2010-01-20 11:10 ` Sébastien Vauban
1 sibling, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2010-01-20 9:28 UTC (permalink / raw
To: "Martin G. Skjæveland"; +Cc: Sébastien Vauban, emacs-orgmode
Hi Martin,
OK, please pull and then use the variable `org-export-latex-hyperref-
format'.
- Carsten
On Jan 20, 2010, at 10:19 AM, Martin G. Skjæveland wrote:
> Sébastien Vauban wrote:
>> Hi Martin,
>> "Martin G. Skjæveland" wrote:
>>> is it possible to change how hyperlinks are exported to LaTex
>>> without going
>>> into to org-latex.el, but setting by a variable or similar in
>>> my .emacs
>>> file?
>>>
>>> I would like to export hyperlinks in Latex as \myhref (or
>>> something else)
>>> instead of \href, so that I can redefine \myhref using \href, like
>>> this
>>>
>>> \usepackage{ifthen}
>>> \newcommand{\myhref}[2]{
>>> \ifthenelse{\equal{#1}{#2}}
>>> {\href{#1}{#2}}
>>> {\href{#1}{#2}\footnote{\url{#1}}}
>>> }
>>>
>>> and thus include the URLs of the links as footnotes.
>> Not answering clearly your question, but an alternative (that
>> works) is to
>> redefine \href either in your private class (if you use one) or in
>> your TeX
>> file.
>> In the latter case, put the `renewcommand' in your Org source, so
>> that it gets
>> exported every time.
>> Example (with a `newcommand' here):
>> --8<---------------cut here---------------start------------->8---
>> #+LaTeX_HEADER: \newcommand{\figtext}[2]{\begin{tikzpicture} \draw
>> (-#1/2,-#1/2) rectangle (#1/2,#1/2); \node[text width=#1] at (0,0)
>> {\color{blue}\scriptsize{#2}}; \end{tikzpicture}}
>> --8<---------------cut here---------------end--------------->8---
>> I think, for this case, this offers more flexibility and allows you
>> to get
>> what you want.
>
> Hi Seb,
>
> yes, this looks like the flexibility I'm after, but my problem with
> your solution is that by using \renewcommand I would be defining a
> recursive command, which does not work. (I should have mentioned
> that in my first email, sorry.) This is the reason for renaming the
> \href command in the export, so I can define my own href command
> using the standard href.
>
> The reason I want to do this in the first place is to make URLs
> available when the latex pdf is printed.
>
> Martin
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: changing \href to \myhref in LaTex export
2010-01-20 9:28 ` Carsten Dominik
@ 2010-01-20 10:00 ` "Martin G. Skjæveland"
0 siblings, 0 replies; 8+ messages in thread
From: "Martin G. Skjæveland" @ 2010-01-20 10:00 UTC (permalink / raw
To: Carsten Dominik; +Cc: Sébastien Vauban, emacs-orgmode
Carsten Dominik wrote:
> Hi Martin,
>
> OK, please pull and then use the variable
> `org-export-latex-hyperref-format'.
Hi Carsten,
setting
(setq org-export-latex-hyperref-format "\\myhref{%s}{%s}")
works like a charm. Thanks!
Martin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: changing \href to \myhref in LaTex export
2010-01-20 9:19 ` "Martin G. Skjæveland"
2010-01-20 9:28 ` Carsten Dominik
@ 2010-01-20 11:10 ` Sébastien Vauban
2010-01-20 12:08 ` Carsten Dominik
2010-01-20 13:00 ` "Martin G. Skjæveland"
1 sibling, 2 replies; 8+ messages in thread
From: Sébastien Vauban @ 2010-01-20 11:10 UTC (permalink / raw
To: emacs-orgmode-mXXj517/zsQ
Hi Martin,
"Martin G. Skjæveland" wrote:
> Sébastien Vauban wrote:
>> "Martin G. Skjæveland" wrote:
>>
>>> is it possible to change how hyperlinks are exported to LaTex without
>>> going into to org-latex.el, but setting by a variable or similar in my
>>> .emacs file?
>>>
>>> I would like to export hyperlinks in Latex as \myhref (or something else)
>>> instead of \href, so that I can redefine \myhref using \href, like this
>>>
>>> \usepackage{ifthen}
>>> \newcommand{\myhref}[2]{
>>> \ifthenelse{\equal{#1}{#2}}
>>> {\href{#1}{#2}}
>>> {\href{#1}{#2}\footnote{\url{#1}}}
>>> }
>>>
>>> and thus include the URLs of the links as footnotes.
>>
>> Not answering clearly your question, but an alternative (that works) is to
>> redefine \href either in your private class (if you use one) or in your TeX
>> file.
>>
>> In the latter case, put the `renewcommand' in your Org source, so that it
>> gets exported every time.
>>
>> Example (with a `newcommand' here):
>>
>> --8<---------------cut here---------------start------------->8---
>> #+LaTeX_HEADER: \newcommand{\figtext}[2]{\begin{tikzpicture} \draw (-#1/2,-#1/2) rectangle (#1/2,#1/2); \node[text width=#1] at (0,0) {\color{blue}\scriptsize{#2}}; \end{tikzpicture}}
>> --8<---------------cut here---------------end--------------->8---
>>
>> I think, for this case, this offers more flexibility and allows you to get
>> what you want.
>
> yes, this looks like the flexibility I'm after, but my problem with your
> solution is that by using \renewcommand I would be defining a recursive
> command, which does not work. (I should have mentioned that in my first
> email, sorry.) This is the reason for renaming the \href command in the
> export, so I can define my own href command using the standard href.
Nope! You can do that by simply renaming the old version first.
In your case:
--8<---------------cut here---------------start------------->8---
\let\orig@href=\href
\renewcommand\href[2]{%
\ifthenelse{\equal{#1}{#2}}
{\orig@href{#1}{#2}}
{\orig@href{#1}{#2}\footnote{\url{#1}}}
}% href
\href{http://www.mygooglest.com/}{Test}
\href{http://www.mygooglest.com/}{http://www.mygooglest.com/}
--8<---------------cut here---------------end--------------->8---
> The reason I want to do this in the first place is to make URLs available
> when the latex pdf is printed.
That makes sense. I'll reuse your idea!
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: changing \href to \myhref in LaTex export
2010-01-20 11:10 ` Sébastien Vauban
@ 2010-01-20 12:08 ` Carsten Dominik
2010-01-20 13:00 ` "Martin G. Skjæveland"
1 sibling, 0 replies; 8+ messages in thread
From: Carsten Dominik @ 2010-01-20 12:08 UTC (permalink / raw
To: Sébastien Vauban; +Cc: emacs-orgmode
Cool, I did not know this.
Thanks!
- Carsten
On Jan 20, 2010, at 12:10 PM, Sébastien Vauban wrote:
> Hi Martin,
>
> "Martin G. Skjæveland" wrote:
>> Sébastien Vauban wrote:
>>> "Martin G. Skjæveland" wrote:
>>>
>>>> is it possible to change how hyperlinks are exported to LaTex
>>>> without
>>>> going into to org-latex.el, but setting by a variable or similar
>>>> in my
>>>> .emacs file?
>>>>
>>>> I would like to export hyperlinks in Latex as \myhref (or
>>>> something else)
>>>> instead of \href, so that I can redefine \myhref using \href,
>>>> like this
>>>>
>>>> \usepackage{ifthen}
>>>> \newcommand{\myhref}[2]{
>>>> \ifthenelse{\equal{#1}{#2}}
>>>> {\href{#1}{#2}}
>>>> {\href{#1}{#2}\footnote{\url{#1}}}
>>>> }
>>>>
>>>> and thus include the URLs of the links as footnotes.
>>>
>>> Not answering clearly your question, but an alternative (that
>>> works) is to
>>> redefine \href either in your private class (if you use one) or in
>>> your TeX
>>> file.
>>>
>>> In the latter case, put the `renewcommand' in your Org source, so
>>> that it
>>> gets exported every time.
>>>
>>> Example (with a `newcommand' here):
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> #+LaTeX_HEADER: \newcommand{\figtext}[2]{\begin{tikzpicture} \draw
>>> (-#1/2,-#1/2) rectangle (#1/2,#1/2); \node[text width=#1] at (0,0)
>>> {\color{blue}\scriptsize{#2}}; \end{tikzpicture}}
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> I think, for this case, this offers more flexibility and allows
>>> you to get
>>> what you want.
>>
>> yes, this looks like the flexibility I'm after, but my problem with
>> your
>> solution is that by using \renewcommand I would be defining a
>> recursive
>> command, which does not work. (I should have mentioned that in my
>> first
>> email, sorry.) This is the reason for renaming the \href command in
>> the
>> export, so I can define my own href command using the standard href.
>
> Nope! You can do that by simply renaming the old version first.
>
> In your case:
>
> --8<---------------cut here---------------start------------->8---
> \let\orig@href=\href
> \renewcommand\href[2]{%
> \ifthenelse{\equal{#1}{#2}}
> {\orig@href{#1}{#2}}
> {\orig@href{#1}{#2}\footnote{\url{#1}}}
> }% href
>
> \href{http://www.mygooglest.com/}{Test}
> \href{http://www.mygooglest.com/}{http://www.mygooglest.com/}
> --8<---------------cut here---------------end--------------->8---
>
>
>> The reason I want to do this in the first place is to make URLs
>> available
>> when the latex pdf is printed.
>
> That makes sense. I'll reuse your idea!
>
> Best regards,
> Seb
>
> --
> Sébastien Vauban
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: changing \href to \myhref in LaTex export
2010-01-20 11:10 ` Sébastien Vauban
2010-01-20 12:08 ` Carsten Dominik
@ 2010-01-20 13:00 ` "Martin G. Skjæveland"
1 sibling, 0 replies; 8+ messages in thread
From: "Martin G. Skjæveland" @ 2010-01-20 13:00 UTC (permalink / raw
To: Sébastien Vauban; +Cc: emacs-orgmode
Sébastien Vauban wrote:
> Hi Martin,
>
> "Martin G. Skjæveland" wrote:
>> Sébastien Vauban wrote:
>>> "Martin G. Skjæveland" wrote:
>>>
>>>> is it possible to change how hyperlinks are exported to LaTex without
>>>> going into to org-latex.el, but setting by a variable or similar in my
>>>> .emacs file?
>>>>
>>>> I would like to export hyperlinks in Latex as \myhref (or something else)
>>>> instead of \href, so that I can redefine \myhref using \href, like this
>>>>
>>>> \usepackage{ifthen}
>>>> \newcommand{\myhref}[2]{
>>>> \ifthenelse{\equal{#1}{#2}}
>>>> {\href{#1}{#2}}
>>>> {\href{#1}{#2}\footnote{\url{#1}}}
>>>> }
>>>>
>>>> and thus include the URLs of the links as footnotes.
>>> Not answering clearly your question, but an alternative (that works) is to
>>> redefine \href either in your private class (if you use one) or in your TeX
>>> file.
>>>
>>> In the latter case, put the `renewcommand' in your Org source, so that it
>>> gets exported every time.
>>>
>>> Example (with a `newcommand' here):
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> #+LaTeX_HEADER: \newcommand{\figtext}[2]{\begin{tikzpicture} \draw (-#1/2,-#1/2) rectangle (#1/2,#1/2); \node[text width=#1] at (0,0) {\color{blue}\scriptsize{#2}}; \end{tikzpicture}}
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> I think, for this case, this offers more flexibility and allows you to get
>>> what you want.
>> yes, this looks like the flexibility I'm after, but my problem with your
>> solution is that by using \renewcommand I would be defining a recursive
>> command, which does not work. (I should have mentioned that in my first
>> email, sorry.) This is the reason for renaming the \href command in the
>> export, so I can define my own href command using the standard href.
>
> Nope! You can do that by simply renaming the old version first.
>
> In your case:
>
> --8<---------------cut here---------------start------------->8---
> \let\orig@href=\href
> \renewcommand\href[2]{%
> \ifthenelse{\equal{#1}{#2}}
> {\orig@href{#1}{#2}}
> {\orig@href{#1}{#2}\footnote{\url{#1}}}
> }% href
>
> \href{http://www.mygooglest.com/}{Test}
> \href{http://www.mygooglest.com/}{http://www.mygooglest.com/}
> --8<---------------cut here---------------end--------------->8---
Thanks, what works perfect!
Initially, it did not work, but moving the above code directly below
\usepackage{hyperref}
solved my problems.
Martin
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-01-20 12:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-19 15:31 changing \href to \myhref in LaTex export "Martin G. Skjæveland"
2010-01-20 8:40 ` Sébastien Vauban
2010-01-20 9:19 ` "Martin G. Skjæveland"
2010-01-20 9:28 ` Carsten Dominik
2010-01-20 10:00 ` "Martin G. Skjæveland"
2010-01-20 11:10 ` Sébastien Vauban
2010-01-20 12:08 ` Carsten Dominik
2010-01-20 13:00 ` "Martin G. Skjæveland"
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.