![使用 hyperref 和 biblatex 的家谱树](https://linux22.com/image/441048/%E4%BD%BF%E7%94%A8%20hyperref%20%E5%92%8C%20biblatex%20%E7%9A%84%E5%AE%B6%E8%B0%B1%E6%A0%91.png)
是否可以创建一个家谱树,其中包含从节点编号到 biblatex 文件的超链接,该文件在末尾打印为参考列表,其中包含有关节点中引用的人员的相关数据,或者包含与minipage
鼠标悬停时显示的节点相关的详细信息的超链接?
我能够按照手册生成带有节点编号的树,但不确定如何在每个节点中创建超链接,任何指向正确方向的指针都会有所帮助。
具有生成节点号的树的 MWE:
\documentclass{article}
\usepackage[margin=2cm,landscape,a0paper]{geometry}
\usepackage[all]{genealogytree}
\begin{document}
\gtrSymbolsSetCreateSelected{blue}{Male}
\gtrSymbolsSetCreateSelected{red}{Female}
\gtrSymbolsSetCreateSelected{black}{Neuter}
\begin{tikzpicture}
\genealogytree[template=symbol nodes,level size=8mm,level distance=6.5mm,
box={title={\gtrnodenumber},height=5mm,attach boxed title to bottom center,
fonttitle=\fontsize{3mm}{3mm}\sffamily,
boxed title style={size=tight,height=3mm,valign=center,left=0.2mm,right=0.2mm}},
tcbset={mytext/.style={notitle,interior style={top color=gtr_Yellow_Frame!50!gtr_Yellow_Back,
bottom color=gtr_Yellow_Frame!50!gtr_Yellow_Back,middle color=gtr_Yellow_Back}}},
add parent=a to fam_a,add parent=b to fam_b,add parent=c to fam_c]
{
child{
gm pf cf
child{gm pf cf cm}
child{gm pf cm c- cm}
}
}
\end{tikzpicture}
\end{document}
当将该\cite
命令放置在框中时,它将起作用,如下所示 MWE:
\documentclass{article}
\usepackage{blindtext}
\usepackage[margin=2cm,landscape,a0paper]{geometry}
\usepackage[all]{genealogytree}
\usepackage[backend=biber]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{1,
author={John Doe},
title={\gtrsymBorn 1990},
}
@book{2,
author={Jane Doe},
title={\gtrsymBorn 1990},
}
@book{3,
author={Jane Doe3},
title={\gtrsymBorn 1990},
}
@book{4,
author={Jane Doe4},
title={\gtrsymBorn 1990},
}
@book{5,
author={Jane Doe5},
title={\gtrsymBorn 1990},
}
@book{6,
author={Jane Doe6},
title={\gtrsymBorn 1990},
}
@book{7,
author={Jane Doe7},
title={\gtrsymBorn 1990},
}
@book{8,
author={Jane Doe8},
title={\gtrsymBorn 1990},
}
@book{9,
author={Jane Doe9},
title={\gtrsymBorn 1990},
}
@book{10,
author={Jane Doe10},
title={\gtrsymBorn 1990},
}
@book{11,
author={Jane Doe11},
title={\gtrsymBorn 1990},
}
@book{12,
author={Jane Doe12},
title={\gtrsymBorn 1990},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\gtrSymbolsSetCreateSelected{blue}{Male}
\gtrSymbolsSetCreateSelected{red}{Female}
\gtrSymbolsSetCreateSelected{black}{Neuter}
\begin{tikzpicture}
\genealogytree[template=symbol nodes,level size=8mm,level distance=6.5mm,
content interpreter content={\gtrifnodeid{\gtrnodeid}{n_{\gtrnodenumber}}},
% note cite command
box={title={\cite{\gtrnodenumber}},
height=5mm,attach boxed title to bottom center,
fonttitle=\fontsize{3mm}{3mm}\sffamily,
boxed title style={size=tight,height=3mm,valign=center,left=0.2mm,right=0.2mm}},
tcbset={mytext/.style={notitle,interior style={top color=gtr_Yellow_Frame!50!gtr_Yellow_Back,
bottom color=gtr_Yellow_Frame!50!gtr_Yellow_Back,middle color=gtr_Yellow_Back}}},
add parent=a to fam_a,add parent=b to fam_b,add parent=c to fam_c]
{
child{
gm pf cf
child{gm pf cf cm}
child{gm pf cm c- cm}
}
}
\end{tikzpicture}
\clearpage
\blindtext[4]
\printbibliography
\end{document}
但如果我把\cite
命令放在行中
content interpreter content={\gtrifnodeid{\gtrnodeid}{n_{\gtrnodenumber}}},
因此
content interpreter content={\gtrifnodeid{\gtrnodeid}{n\cite{{\gtrnodenumber}}}},
无法生成参考列表。
是否有其他语法可用于获取框内的引用链接?
答案1
你的解决方案对我来说很好,你只需要在 周围使用一对括号\gtrnodenumber
。因此,而不是
content interpreter content={\gtrifnodeid{\gtrnodeid}{n\cite{{\gtrnodenumber}}}}
你应该写
content interpreter content={\gtrifnodeid{\gtrnodeid}{n\cite{\gtrnodenumber}}}
完整的 MWE(我使用@misc
而不是@book
,尽管创建自定义数据模型可能是个好主意):
\documentclass{article}
\usepackage[all]{genealogytree}
\usepackage[backend=biber]{biblatex}
\usepackage{hyperref}
\begin{filecontents}{\jobname.bib}
@misc{1,
author={John Doe},
title={\gtrsymBorn 1990},
}
@misc{2,
author={Jane Doe},
title={\gtrsymBorn 1990},
}
@misc{3,
author={Jane Doe3},
title={\gtrsymBorn 1990},
}
@misc{4,
author={Jane Doe4},
title={\gtrsymBorn 1990},
}
@misc{5,
author={Jane Doe5},
title={\gtrsymBorn 1990},
}
@misc{6,
author={Jane Doe6},
title={\gtrsymBorn 1990},
}
@misc{7,
author={Jane Doe7},
title={\gtrsymBorn 1990},
}
@misc{8,
author={Jane Doe8},
title={\gtrsymBorn 1990},
}
@misc{9,
author={Jane Doe9},
title={\gtrsymBorn 1990},
}
@misc{10,
author={Jane Doe10},
title={\gtrsymBorn 1990},
}
@misc{11,
author={Jane Doe11},
title={\gtrsymBorn 1990},
}
@misc{12,
author={Jane Doe12},
title={\gtrsymBorn 1990},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\gtrSymbolsSetCreateSelected{blue}{Male}
\gtrSymbolsSetCreateSelected{red}{Female}
\gtrSymbolsSetCreateSelected{black}{Neuter}
\begin{tikzpicture}
\genealogytree[
template=symbol nodes,
level size=8mm,
level distance=6.5mm,
content interpreter content={
\gtrifnodeid{\gtrnodeid}{n\cite{\gtrnodenumber}}
}, % note cite command
box={
title={\gtrnodenumber},
height=5mm,
attach boxed title to bottom center,
fonttitle=\fontsize{3mm}{3mm}\sffamily,
boxed title style={
size=tight,
height=3mm,
valign=center,
left=0.2mm,
right=0.2mm
}
},
tcbset={
mytext/.style={
notitle,
interior style={
top color=gtr_Yellow_Frame!50!gtr_Yellow_Back,
bottom color=gtr_Yellow_Frame!50!gtr_Yellow_Back,
middle color=gtr_Yellow_Back}
}
},
add parent=a to fam_a,
add parent=b to fam_b,
add parent=c to fam_c
]{
child{gm pf cf
child{gm pf cf cm}
child{gm pf cm c- cm}
}
}
\end{tikzpicture}
\clearpage
\printbibliography
\end{document}
输出树:
输出参考列表: