Am Samstag, den 30.04.2016, 09:36 +0200 schrieb racoon:
> Hi,
> 
> In word you can create bookmarks based on a passage in the text. Is 
> there such a feature in LyX?
> 
> So basically it would work like this:
> 
> 1. You mark a passage (e.g. a word).
> 2. You make it a bookmark.
> 2. You go somewhere else and insert a cross reference top the
> bookmark. 
> This will lead to the content of the bookmark being inserted and a 
> hyperlink to that passage being created.
> 
> I think it is a nice idea to create hyperlinks (like in Wikipedia)
> to 
> certain terms that are explained elsewhere. Also if one changes
> one's 
> mind about the term one can just change it at the bookmark and it is 
> changed everywhere in the text.
> 
> (I guess it is similar to creating a definition in LaTeX
> 
> \def\foo{Whatever}
> 
> So one can use now \foo to insert "Whatever" in the text and can
> change 
> what is actually inserted in the definition. What is missing is the 
> hyperlink part to the bookmark. So it is not exactly the same.)


Preamble:

\usepackage{etoolbox}
\usepackage{hyperref}
\newcommand\setbookmark[2]{%
\csdef{bkmk@#1}{#2}%
\label{bkmk:#1}%
#2
}

\newcommand\usebookmark[1]{%
\hyperref[bkmk:#1]{\csuse{bkmk@#1}}%
}


Usage:

\setbookmark{test}{A test!}
marks the bookmark "test" and prints the text "a test!"


\usebookmark{test}
prints the text "a test!" as a hyperlink to the former occurrence.

HTH
Jürgen


> 
> Best,
> Daniel
> 

Reply via email to