# How to cross-reference an ERT in LyX?

I am using Classicthesis LyX version 4.2 template, but I think this question is more general to LyX.

This question is related to my own answer to my previous question How to creat hanging indent reference list in Classicthesis LyX version

I want to hyper-reference, for example, "Surname, 2005" in the main text (say, in a child document called Chapter 2) has be clickable and directs to an ERT which is located in another child document-Bibliography.lyx, such as

    \begin{hangparas}{1.27cm}{1}
Surname, A. 2005. This is a bibliography. This is
a bibliography. This is a bibliography. This is a bibliography. This
is a bibliography. This is a bibliography.
\end{hangparas}


Essentially, I want to know how to create and where to put a label for this citation in Bibliography.lyx; then how to cross-reference it in another child document.

28th Oct, 2016: there is still no answer to this question, so any additional comments are welcome.

• With that reference, just cite it writing "Surname, 2005". Do you know some BibTeX or biblatex ? – Fran Oct 23 '16 at 12:05
• I want hyper-reference, that it, "Surname, 2005" in the main text (say, in a child document called Chapter 2) has be clickable and directs to this ERT which is located in another child document-Bibliography.lyx. Apologies for not stating my question clearly. – Wendy Oct 23 '16 at 12:42
• Then you sould use thebibliography environment or a BibTeX bibliography. Both options can be done in LyX via menus without ERT boxes. Please see here to a brief introduction of the basics in LaTeX, so you can understand these LyX options. Moreover, be sure to check "Use Hyperref support" in PDF properties for hyper-references. – Fran Oct 23 '16 at 17:40
• BTW, the use of biblatex is a bit tricky in LyX. For now just learn how to use BibTeX in LyX. – Fran Oct 23 '16 at 17:48
• Thx a lot. I am aware of the standard way, but it takes time to download hundreds of existing citations in BibTex format, and using biblatex in Classicthesis LyX may be even more stricky. Since I already have them in Microsoft Word format, I am interested in the shortcut or workaround. I will go throught the introduction you provided for future citations. – Wendy Oct 25 '16 at 2:16

I figured this out by myself again.

In the reference list, just utilize\hypertargetand type in the ERT as follows:

\begin{hangparas}{1.27cm}{1}
\hypertarget{Surname}{Surname, A. 2005.} This is a bibliography. This is
a bibliography. This is a bibliography. This is a bibliography. This
is a bibliography. This is a bibliography.
\end{hangparas}


That is, create a label name called Surname or anything, and use curly brackets to surround the "Surname, A. 2005." part.

In the main text, type \hyperlink{Surname}{Surname, 2005} shows that...

Note: need to use Ctrl+L to creat ERT whenever you want to insert the latex codes.

Outcome:

Once click the blue words, it leads to the specific location of the citation in the reference list.

Comment: Hopefully this solution together with the one in my previous question can help those who want to transform reference lists in Word version to LyX version. Although it took me a while to figure this out as a learner, it should only take minutes for you to do this.