ユーザー ガイドの基本的な例の 1 つに結婚日を追加しようとすると、写真に重なる水平線が表示されます。
これが私のコードです:
\documentclass{article}
\usepackage{genealogytree}
\usepackage{tcolorbox}
\begin{document}
\begin{genealogypicture}[
processing=database,
database format=medium marriage below,
node size=2.4cm,
level size=3.5cm,
level distance=6mm,
%...
list separators hang,
name font=\bfseries,
surn code={\textcolor{red!50!black}{#1}},
place text={\newline}{},
date format=d/mon/yyyy,
%...
tcbset={male/.style={colframe=blue,colback=blue!5},
female/.style={colframe=red,colback=red!5}},
box={fit basedim=7pt,boxsep=2pt,segmentation style=solid,
halign=left,before upper=\parskip1pt,
\gtrDBsex,drop fuzzy shadow,
if image defined={add to width=25mm,right=25mm,
underlay={\begin{tcbclipinterior}\path[fill overzoom DBimage]
([xshift=-24mm]interior.south east) rectangle (interior.north east);
\end{tcbclipinterior}},
}{},
},
]
sandclock
{
child{
g[id=GauxCarl1777]{
male,
name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
birth={1777-04-30}{Braunschweig (Niedersachsen)},
marriage={1800-01-01}{}, %<== my modification to the guide's example
death={1855-02-23}{G\"ottingen (Niedersachsen)},
profession={Mathematiker, Astronom, Geod\"at und Physiker},
image={Carl_Friedrich_Gauss.jpg},
}
p[id=GauxCarl1777]{
female,
name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
birth={1777-04-30}{Braunschweig (Niedersachsen)},
marriage={1800-01-01}{}, %<== my modification to the guide's example
death={1855-02-23}{G\"ottingen (Niedersachsen)},
profession={Mathematiker, Astronom, Geod\"at und Physiker},
image={Carl_Friedrich_Gauss.jpg},
}
}
}
\end{genealogypicture}
\end{document}
これを防ぐ方法を誰か知っていますか?
答え1
これにはさまざまな解決策が考えられます。最も簡単なのは、 などの線を引かないデータベース形式に変更することですmedium
。この場合、結婚は出生と死亡の間に印刷されます。
MWE:
\documentclass{article}
\usepackage{genealogytree}
\usepackage{tcolorbox}
\begin{document}
\begin{genealogypicture}[
processing=database,
database format=medium,
box={fit basedim=7pt,boxsep=2pt,segmentation style=solid,
halign=left,before upper=\parskip1pt,
\gtrDBsex,drop fuzzy shadow,
if image defined={add to width=25mm,right=25mm,
underlay={\begin{tcbclipinterior}\path[fill overzoom image=\gtrDBimage]
([xshift=-24mm]interior.south east) rectangle (interior.north east);
\end{tcbclipinterior}},
}{},
},
]
sandclock{
child{
g[id=GauxCarl1777]{
male,name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
birth={1777-04-30}{Braunschweig (Niedersachsen)},
marriage={1800-01-01}{},
death={1855-02-23}{G\"ottingen (Niedersachsen)},
profession={Mathematiker, Astronom, Geod\"at und Physiker},
image={Carl_Friedrich_Gauss.jpg},
}
}
child{
g[id=GauxCarl1777]{
female,name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
birth={1777-04-30}{Braunschweig (Niedersachsen)},
marriage={1800-01-01}{},
death={1855-02-23}{G\"ottingen (Niedersachsen)},
profession={Mathematiker, Astronom, Geod\"at und Physiker},
}
}
}
\end{genealogypicture}
\end{document}
結果:
2 つ目の可能性は、 の定義を変更してmedium marriage below
行を削除することです。 定義はファイル にリストされておりgtrcore.node.code.tex
、 をロードした後で変更したコードを独自のドキュメントに追加することで再定義できますgenealogytree
。
MWE:
\documentclass{article}
\usepackage{genealogytree}
\usepackage{tcolorbox}
\makeatletter
\gtrDeclareDatabaseFormat{medium marriage below}{}{%
\gtrPrintName%
\begin{gtreventlist}%
\gtr@list@event@birth%
\gtr@list@event@floruit%
\gtr@list@event@death%
\end{gtreventlist}%
\gtr@print@infolist%
\gtr@ifmarriagedefined{%
\begin{gtreventlist}\gtr@list@event@marriage\end{gtreventlist}}{}%
% was: \gtr@ifmarriagedefined{\tcbline\begin{gtreventlist}\gtr@list@event@marriage\end{gtreventlist}}{}%
}
\makeatother
\begin{document}
\begin{genealogypicture}[
processing=database,
database format=medium marriage below,
box={fit basedim=7pt,boxsep=2pt,segmentation style=solid,
halign=left,before upper=\parskip1pt,
\gtrDBsex,drop fuzzy shadow,
if image defined={add to width=25mm,right=25mm,
underlay={\begin{tcbclipinterior}\path[fill overzoom image=\gtrDBimage]
([xshift=-24mm]interior.south east) rectangle (interior.north east);
\end{tcbclipinterior}},
}{},
},
]
sandclock{
child{
g[id=GauxCarl1777]{
male,name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
birth={1777-04-30}{Braunschweig (Niedersachsen)},
marriage={1800-01-01}{},
death={1855-02-23}{G\"ottingen (Niedersachsen)},
profession={Mathematiker, Astronom, Geod\"at und Physiker},
image={Carl_Friedrich_Gauss.jpg},
}
}
child{
g[id=GauxCarl1777]{
female,name={Johann \pref{Carl Friedrich} \surn{Gau\ss{}}},
birth={1777-04-30}{Braunschweig (Niedersachsen)},
marriage={1800-01-01}{},
death={1855-02-23}{G\"ottingen (Niedersachsen)},
profession={Mathematiker, Astronom, Geod\"at und Physiker},
}
}
}
\end{genealogypicture}
\end{document}
結果:
このソリューションを少し拡張するには、画像があるかどうかをテストし、画像のないノードの行のみを印刷し、画像がない場合は、たとえば垂直方向のスペースを少し印刷します。
MWE、再定義の関連部分のみを表示:
\gtr@ifmarriagedefined{%
\ifdefvoid{\gtrDBimage}{\tcbline}{\vspace{2mm}}%
\begin{gtreventlist}\gtr@list@event@marriage\end{gtreventlist}}{}%
結果:
または、\tcbline
両方のケースで を追加すると、画像がある場合に線が 24 mm 短くなります。
\gtr@ifmarriagedefined{%
\ifdefvoid{\gtrDBimage}{\tcbline}{%
\tcbline@ {\kvtcb@leftupper +\@totalleftmargin +24mm}}%
\begin{gtreventlist}\gtr@list@event@marriage\end{gtreventlist}}{}%
結果: