3

This might sound a bit odd: I am using JabRef for maintaining a database which does not content bibliographical data in the first place:

@Person{caesar,
  date          = {100-44BC},
  comment       = {tyran},
  description   = {rebel},
  locationbirth = {Rome},
  locationdeath = {Rome},
  name          = {Iulius Caesar, Caius},
  shortname     = {Caesar},
  works         = {Bello Gallico},
}

@Work{bello:gallico,
  author = {Caesar},
  title  = {Bello Gallico},
  date   = {58-51BC},
}

This works pretty nicely since all the fields in JabRef can be customized and I can group various entries and search the database quickly.

Now the difficult part:

How can I use and integrate the data in a TeX-document?

Note: I am aware of datatool which would be quite the tool to use and its gui (datatooltk) but I cannot run it on my system (... always Java-issues) but I would like to use JabRef and the dataset with its bibtex-format.

Is it possible to have relationships among entries? Like works={\getdata{bello:gallico}{title}}, (see below in MWE)?

First attempt using biblatex


At a first glance it looks like a common and modified \cite-command should do the job. I failed. And it might conflict with the citation style one uses. But maybe someone has a nice solution with biblatex?

Second attempt using keyval/xkeyval


On the other hand it is also "just" a key-value list divided into several entries. So xkeyval might be the right tool doing it. But I fail integrating the dataset document and passing the values to a \setkeys.../\define@key command.

Here is a MWE:

\documentclass{scrartcl}
\usepackage{xkeyval}
\usepackage{filecontents}


\newcommand\getdata[2]{%
  % load file `datasets.tex` and search for needed values.
  % \setkeys{#1}{#2}
    % \define@key{#1}{#2}{##1}
}


\begin{filecontents}{datasets.tex}
    @Person{caesar,
  date          = {100-44BC},
  comment       = {tyran},
  description   = {rebel},
  locationbirth = {Rome},
  locationdeath = {Rome},
  name          = {Iulius Caesar, Caius},
  shortname     = {Caesar},
  works         = {\getdata{bello:gallico}{title}},
} 

@Person{cicero,
  date          = {106-43BC},
  comment       = {great author},
  description   = {Statesman, rhetor, author},
  locationbirth = {Arpinum},
  locationdeath = {Formiae},
  name          = {Tullius Cicero, Marcus},
  shortname     = {Cicero},
  works         = {\getdata{de:re:publica}{title}, \getdata{de:amicitia}{title}},
}

@Work{de:re:publica,
  author = {\getdata{cicero}{name}},
  title  = {De re publica},
  date   = {54-51BC},
}

@Work{de:amicitia,
  author = {\getdata{cicero}{name}},
  title  = {Laelius de amicitia},
  date   = {44BC},
}

@Work{bello:gallico,
  author = {\getdata{caesar}{name}},
  title  = {Bello Gallico},
  date   = {58-51BC},
}
\end{filecontents}



\begin{document} 
\getdata{caesar}{name} was bon in 
\getdata{caesar}{locationbirth}.
He lived \getdata{caesar}{date} and died in
\getdata{casear}{locationdeath}.

Our friend \getdata{cicero}{name} lived longer (\getdata{cicero}{date}) and he can be described as: 
\getdata{cicero}{description}.


% if this works it would be awesome!
\getdata{cicero}{name} published many important works: \getdata{cicero}{works}.
\getdata{caesar}{name} however only one big shot: 
\getdata{bello:gallico}{title} written in 
\getdata{bello:gallico}{date}.
\end{document}
  • 3
    It should work fine with biblatex. I have an address database in this format which I use with biblatex. tug.org/TUGboat/tb35-3/tb111fischer.pdf. – Ulrike Fischer Jun 8 '18 at 22:01
  • And you already have published it in the DTK - which would have been my next step. I am too late obviously. Thank you for the link and hint. – LukasCB Jun 8 '18 at 22:03
  • 1
    @UlrikeFischer In the paper you provide via the link there are only hard-coded \cite-examples. I am rather interested in a \cite command to which I can pass the relevant field I want to cite. Otherwise I would need to define as many \cite-commands as many fields I have in a dataset. – LukasCB Jun 8 '18 at 23:01
  • 1
    There is a generic \citefield command. Check the docu. – Ulrike Fischer Jun 9 '18 at 6:03
  • For relationships in general you could use the crossref field (JabRef also supports it), it allows to link to another entry by key. Typically used for child-parent relationships like a chapter linking to a book entry. – Christoph S Jun 9 '18 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.