A simple solution is to set a \hypertarget
in the bibliography item. The syntax is quite simple: Create the target with
\hypertarget{MyTargetKey}{}
and create a link to the target with
\hyperlink{MyTargetKey}{link text}
Everything put together:
\documentclass{article}
\usepackage[colorlinks,allcolors=red]{hyperref}
\begin{document}
This \hyperlink{MyTargetKey}{link} takes you to the same
place as \cite{MyKey} does.
\begin{thebibliography}{9}
\bibitem{MyKey} \hypertarget{MyTargetKey}{} Anne Author, Thoughts, 3001.
\end{thebibliography}
\end{document}
If you work e.g. with BibLaTeX, this gets even more hackish, but still works. You can set the target in the author field.
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{MyKey,
AUTHOR = {Author, \hypertarget{MyKeyH}{Anne}},
TITLE = {Thoughts},
YEAR = {3001},
}
\end{filecontents*}
\documentclass{article}
\usepackage[colorlinks,allcolors=red]{hyperref}
\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
This \hyperlink{MyKeyH}{link} takes you to the same place as \cite{MyKey} does.
\printbibliography
\end{document}
This is not a particularly nice solution, but I am not aware of a direct, elegant way.
Using multibib
results after the first compile run of file mwe.tex
with pdflatex
(or in your case compiling with TeXStudio) in two new files mwe.aux
and apndx.aux
. Both .aux
files needs to be run with bibtex
. TeXStudio does the run with bibtex
for file mwe.aux
, for apndx.aux
you need to do it by your own. Just run the command bibtex apndx
in a windows terminal.
After that you can compile two times with TeXStudio to get the resulting PDF.
To get command \citeapndx
be run in a caption of a figure (your question in the comments) you need to use command \protect
like (same for a \section
):
\caption{In figure caption \protect\citeapndx{Johnson2000}}
% ^^^^^^^^
So with the following file mwe.tex
(package filecontents
is only used to have both bib files and the tex code in one compiling MWE):
% needs: bibtex apndx
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{Creighton2006,
author = {Creighton, Oliver and Ott, Martin and Bruegge, Bernd},
booktitle = {Requirements Engineering, 14th IEEE International Conference},
isbn = {0769525555},
pages = {109--118},
publisher = {IEEE},
title = {{Software cinema-video-based requirements engineering}},
url = {http://ieeexplore.ieee.org/xpls/abs{\_}all.jsp?arnumber=1704054},
year = {2006},
}
\end{filecontents}
\begin{filecontents}{apndx.bib}
@article{Johnson2000,
author = {Johnson, W Lewis and Rickel, Jeff W and Lester, James C},
journal = {International Journal of Artificial Intelligence in Education},
number = {11},
pages = {47--78},
title = {{Animated pedagogical agents: face-to-face interaction in
interactive learning environments}},
volume = {Internatio},
year = {2000},
}
\end{filecontents}
\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage{multibib}
\usepackage{graphicx}
\newcites{apndx}{References in Appendix}
\begin{document}
First paper to cite: \cite{Creighton2006}
\bibliographystyle{ecca}
\bibliography{\jobname}
\appendix
Cite a paper in the appendix \citeapndx{Johnson2000}
%\section{In the appendix \protect\citeapndx{Johnson2000}} % <===========
\begin{figure}
\centering
\includegraphics[width=5cm]{example-image-a}
\caption{In figure caption \protect\citeapndx{Johnson2000}} % <=======
\label{fig:example-image-a}
\end{figure}
\bibliographystyleapndx{ecca}
\bibliographyapndx{apndx}
\end{document}
and the compiling chain (independent from TeXStudio):
- open a terminal window in Windows with pressing windows start key and
R
, then type cmd
, press enter
- move to the directory where you have your tex code and the bib file(s) with
cd <directory path>
- run command
pdflatex mwe
(resulting in two needed .aux
files)
- run command
bibtex mwe
(compiles mwe.aux
)
- run command
bibtex apndx
(compiles apndx.aux
)
- run command
pdflatex mwe
(resulting in files *.bbl
and *.blg
)
- run command
pdflatex mwe
(resulting in pdf
file with bibliography)
If you are using an editor (TeXStudio, TeXnicCenter, ...) the editor can run pdflatex mwe
and bibtex mwe
for you, but not bibtex apndx
. So run this command after the first compile run with TeXStudio in a windows terminal ...
After running the compile chain you get the following resulting pdf:
Best Answer
This is discussed in the hyperref manual. Basically hyperref needs an anchor to produce the correct link. Add
\phantomsection
before\addcontentsline
to provide one.