emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LaTeX export and org-add-link-type
@ 2014-07-21 13:28 Serge Cohen
  2014-07-21 14:19 ` Leonard Avery Randall
  0 siblings, 1 reply; 3+ messages in thread
From: Serge Cohen @ 2014-07-21 13:28 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1610 bytes --]

Hello list,

When using hte org to LaTeX exporter, I would like to use the link-type capabilities described here :
http://orgmode.org/worg/org-contrib/babel/examples/article-class.html#sec-3

To follow the instruction, I have added the lines to my ~/.emacs.el

(org-add-link-type
 "ltx" nil
 (lambda (path desc format)
   (cond
    ((eq format 'html)
     (format "<span style=\"color:grey;\" class=\"%s\">%s</span>" path desc))
    ((eq format 'latex)
     (format "\\%s{%s}" path desc)))))

I have even added the following call just after that (but I have the feeling this is un-necessary, since should already be done within org-add-link-type function).

(org-make-link-regexps)

Then adding a [[ltx:foo][albert]] to an org file, and exporting to a HTML buffer, I get what I am expecting :
<span style="color:grey;" class="foo">bar</span>

But when I export to a LaTeX buffer, irrelevant to what I use as link/path I get :
\texttt{bar}

To me this means that the org-link-type mechanism is bypassed when exporting to LaTeX (indeed from org-latex.el , I have the feeling that the function org-export-latex-link is taking care of the link parsing, without carrign for the content of org-link-types nor org-link-types-re).

Is this normal, if so is there another way to obtain the same results as what is proposed in the documentation ?

To complete the post : I am using Aquamacs (MacOSX gui-version), based on GNU emacs 23.4.1
The included version of org.el is Version: 6.33x

Hoping someone will be able to point me to the right direction. Thanks in advance,

Serge.



[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 841 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LaTeX export and org-add-link-type
  2014-07-21 13:28 LaTeX export and org-add-link-type Serge Cohen
@ 2014-07-21 14:19 ` Leonard Avery Randall
  2014-07-29 14:38   ` Fabrice Niessen
  0 siblings, 1 reply; 3+ messages in thread
From: Leonard Avery Randall @ 2014-07-21 14:19 UTC (permalink / raw)
  To: Serge Cohen; +Cc: emacs-orgmode

Hi Serge,

Serge Cohen writes:


> Is this normal, if so is there another way to obtain the same results
> as what is proposed in the documentation ?

The behaviour you are explaining is not normal.  The setup you described
should work.

> To complete the post : I am using Aquamacs (MacOSX gui-version), based
> on GNU emacs 23.4.1 The included version of org.el is Version: 6.33x

Herein lies your problem.  6.33 is a very old version of org. I tested
the old Aquamacs 2.5 with org 6.33 and it does not work.  You should
update your org version and probably your emacs as well.  I tested your
code on the newer Aquamacs 3.0 release and it works.  If you like the
Aquamacs key commands then 3.0 is a reasonable bet. It comes with org
7.9.3. Other good distros for OSX can be acquired through macports,
homebrew, or emacsforosx.  All of these are fairly integrated into the
osx environment (the homebrew distro comes with a few config options so
you may want to look to see which one is best for you).

Regarding org mode version, I would recommend the most recent version
which is available through melpa.  If you have a lot of stuff in your
org configuration file, updating to org version 8.x requires a bit of
work, but the new backend should be stable, so you want have to fiddle
too much with your init file in the future.

Once you upgrade to emacs 24, adding new packages is fairly easy through
package.el. Just add this snippet to your init file.

(when (>= emacs-major-version 24)
  (require 'package)
  (package-initialize)
  (add-to-list 'package-archives 
  '("melpa" . "http://melpa.milkbox.net/packages/") t))

Then to upgrade to the latest version of org-mode just press `M-x package
install RET org-plus-contrib RET'. 

Hope this helps.

All best,
Leonard

-- 
Leonard A. Randall
PhD Candidate
Departments of Philosophy
University of St Andrews

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LaTeX export and org-add-link-type
  2014-07-21 14:19 ` Leonard Avery Randall
@ 2014-07-29 14:38   ` Fabrice Niessen
  0 siblings, 0 replies; 3+ messages in thread
From: Fabrice Niessen @ 2014-07-29 14:38 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Leonard Avery Randall wrote:
> Serge Cohen writes:
>> Is this normal, if so is there another way to obtain the same results
>> as what is proposed in the documentation ?
>
> The behaviour you are explaining is not normal.  The setup you described
> should work.
>
>> To complete the post : I am using Aquamacs (MacOSX gui-version), based
>> on GNU emacs 23.4.1 The included version of org.el is Version: 6.33x
>
> Herein lies your problem.  6.33 is a very old version of org. I tested
> the old Aquamacs 2.5 with org 6.33 and it does not work.  You should
> update your org version and probably your emacs as well.  I tested your
> code on the newer Aquamacs 3.0 release and it works.  If you like the
> Aquamacs key commands then 3.0 is a reasonable bet. It comes with org
> 7.9.3. Other good distros for OSX can be acquired through macports,
> homebrew, or emacsforosx.  All of these are fairly integrated into the
> osx environment (the homebrew distro comes with a few config options so
> you may want to look to see which one is best for you).
>
> Regarding org mode version, I would recommend the most recent version
> which is available through melpa.  If you have a lot of stuff in your
> org configuration file, updating to org version 8.x requires a bit of
> work, but the new backend should be stable, so you want have to fiddle
> too much with your init file in the future.
>
> Once you upgrade to emacs 24, adding new packages is fairly easy through
> package.el. Just add this snippet to your init file.
>
> (when (>= emacs-major-version 24)
>   (require 'package)
>   (package-initialize)
>   (add-to-list 'package-archives 
>   '("melpa" . "http://melpa.milkbox.net/packages/") t))
>
> Then to upgrade to the latest version of org-mode just press `M-x package
> install RET org-plus-contrib RET'. 

Note that using custom link types is -- in my opinion -- outperformed by
the Org macros. For example, because custom link types limit you to
2 arguments, no more.

With macros, you can have as many as you want (or at least 9?), and you
can also easily convert the macro code per back-end; for example:

  #+MACRO: cite @@latex:\cite{$1}@@@@odt:\cite{$1}@@

Note that I'm planning to write a set of default (useful) Org macros,
and publish them.

My project is currently on GitHub: https://github.com/fniessen/org-macros.

See documentation on
http://htmlpreview.github.io/?https://github.com/fniessen/org-macros/blob/master/README.html.

Best regards,
Fabrice

-- 
Fabrice Niessen
Leuven, Belgium
http://www.pirilampo.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-29 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-21 13:28 LaTeX export and org-add-link-type Serge Cohen
2014-07-21 14:19 ` Leonard Avery Randall
2014-07-29 14:38   ` Fabrice Niessen

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).