Lisp functions to make hyperlinks for hyperref

Lisp functions to make hyperlinks for hyperref

Post by John Robert Kitchi » Sat, 14 Jul 2001 09:13:57


I recently made two lisp functions to assist me in creating relative
hyperlinks to files using xemacs. I put these in my .emacs file.  I
bound each function to a different key.  Then when I want to insert a
relative link to another file, I call get-path, which launches dired so
i can browse to the file I want the link to go to, then with the cursor
on the file I want the link to point to, I call insert-hyperlink, which
prints \href{relative-path}{ } at the position in the original buffer I
started. The relative path has forward / in it. It works pretty well, I
thought someone else might do something like this too.

(defun get-path()
(setq cb (current-buffer))
(setq bname (default-directory))
(dired (default-directory))

(defun insert-hyperlink()
(setq hname (dired-get-filename))
(switch-to-buffer cb)
(setq newname (file-relative-name hname bname))
(setq newname (replace-in-string newname "\\\\" "/"))
(insert "\\href{" newname "}{ }")



1. ASCII-to-TeX lisp function(s)?

Surely someone has written something like this already?

The function would turn you file containing

        This *really* is a "wonderful" $1 apple!


        This {\it really} is a ``wonderful'' \$1 apple!


Now doubt there are ambiguities (e.g. "whats"is") which a more
complete, advanced function would then ask you about, query-replace
style, but even a basic routines would be helpful.




2. hilit19: faster unhighlighting

3. Strange hyperlinks -- hyperref/natbib

4. PP&S and Cybervision64 problem on A3000

5. Wrong hyperlinks in pdf-document using hyperref

6. The Web server should send only the requested page. How?

7. document trees and hyperlinks (hyperref) and portability

8. Data base in WARP IBM Works ?

9. href (hyperlink in hyperref) in \thanks - possible ?

10. option of a hyperlink in hyperref

11. Disable url hyperlink in hyperref for latex

12. Making linebreaks function

13. Hyperref: making links to implicit anchors, how?