# How to set up BibLaTeX for use with 'freeform' citations

I am writing a genealogical document which requires 'freeform' citations to meet industry standards. In an attempt to get the citations I want in the document, I have used a rather 'hacky' method thus far but want to see if there is a better way for me to do this before I get too far into building my .bib file.

My current solution is to write my freeform citations within the shorthand field and then my bibliographic entry within the note field. Using style=verbose results in nice looking footnotes and bibliographic entries, but I am running into issues with repeated citations. I'm not sure if I'm even using the shorthand and note fields correctly (or BibLaTeX for that matter!).

Alternatively I have looked into using the title and shorttitle fields and then applying a \DeclareFieldFormat to remove the italics, but it is proving troublesome and finicky to correctly show the citations I want in footnotes and the bibliography.

Essentially what I want is to have a .bib file where each entry is a @misc data type that has (1) a full reference note, (2) a short reference note used for subsequent citations and (3) a bibliographic note which will print only in the bibliography. The citations should appear in footnotes in my .tex file, with subsequent citations using the abbreviated reference note. Alternatively I would be happy with simply a full reference note and a bibliographic note, with the ability to reference earlier footnotes by number instead of using the short reference note.

I have looked into writing my own CSL, editing style files, etc, but I am not yet at that level with programming knowledge. I think I could sufficiently follow step-by-step instructions if this was a viable option, but so far it seems that I will have to use a more 'hacky' solution. Also I am relatively new to LaTeX in general, so please excuse any ignorance or misnomers!

EDIT:

Example of a 'freeform' citation in the three modes:

(1) Full (First) Reference Note: Church of England (Derby, Derbyshire, England), Parish Registers, vol. 4, p. 3, marriage of John Smith and Jane Bloggs (20 January 1815); digital images, Ancestry.com (http://ancestry.com.au : accessed 1 July 2018), citing Derbyshire Record Office, Matlock.

(2) Short (Subsequent) Reference Note: Church of England (Derby, Derbs.), Parish Registers, vol. 4, p. 3, Smith-Bloggs (20 January 1815).

(3) Bibliography Entry: Church of England (Derby, Derbyshire, England). Parish Registers. Digital images. Ancestry.com. http://ancestry.com.au : 2018.

• I think we could do with an example of what a 'freeform' citation might look like: can you give a couple of 'input' and 'output' examples? – Joseph Wright Jul 1 '18 at 9:54
• @JosephWright An example of a full reference note might be: Church of England (Derby, Derbyshire, England), Parish Registers, vol. 4, p. 3, marriage of John Smith and Jane Bloggs (20 January 1815); digital images, Ancestry.com (ancestry.com.au : accessed 1 July 2018), citing Derbyshire Record Office, Matlock. This would all be entered into the shorthand field in my .bib file. – S. Bell Jul 1 '18 at 10:01
• biblatex is not really great with 'freeform' citations. The whole idea is that you give all semantically meaningful bits of information separately, so that they can be reassembled according to a particular style. Depending on your exact requirements hacks are available, but that can easily get out of hand or ugly. Can you add your example to your question along with all the three forms you would expect to be made from it. – moewe Jul 1 '18 at 10:10
• @moewe I gathered that that was the case! Ideally I would be able to enter the information separately, but it just doesn't seem possible. So I'm looking for the best solution in the absence of a good one - and I'm not tied to biblatex but it seemed as good an option as any from my limited experience. I have added the three modes of an example 'freeform' citation. – S. Bell Jul 1 '18 at 10:20
• In theory you could write your own type for these kind of things. See tex.stackexchange.com/q/175776/35864. If your document does not use any other citations where biblatex might be useful, it could be easier to try something else... – moewe Jul 1 '18 at 10:30

biblatex doesn't really do 'freeform' citations. The whole point of biblatex (and BibTeX) is that you feed it with all semantically meaningful bits of information separately so that those bits can be reassembled according to a scheme defined by a chosen bibliography and citation style.

If you can find a common structure for a subclass of your citations you may be able to come up with a scheme to classify them and decompose the various data into handy bite-sized chunks that biblatex can deal with. You could then write your own entry type as described in How can I create entirely new data types with BibLaTeX/Biber?.

Here is an atrocious hack that takes the strategy you have been using slightly further and gives you the output you want.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=verbose, backend=biber]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{marriage,
shorthand = {Church of England (Derby, Derbs.), Parish Registers, vol.\ 4, p.\ 3, Smith-Bloggs (20 January 1815).},
note      = {\ifcitation
{Church of England (Derby, Derbyshire, England), Parish Registers, vol.\ 4, p.\ 3, marriage of John Smith and Jane Bloggs (20 January 1815); digital images, Ancestry.com (\url{http://ancestry.com.au}: accessed 1 July 2018), citing Derbyshire Record Office, Matlock.}
{Church of England (Derby, Derbyshire, England). Parish Registers. Digital images. Ancestry.com. \url{http://ancestry.com.au}: 2018.}},
}
\end{filecontents}

\renewbibmacro*{shorthandintro}{}

\begin{document}
Lorem\footcite{marriage} ipsum\footcite{marriage}
\printbibliography
\end{document}


But if we are doing that we might as well stop and abuse fields and declare our own 'freeform' citations. This is a first shot at a @freeform entry type for the verbose styles.

It supports the field bibliography for the display in the bibliography, firstcite for the first longer citation and cite for subsequent citations. The field sortkey can be used to give the sorting position in the bibliography.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage{filecontents}
\begin{filecontents}{freeform.dbx}
\DeclareDatamodelEntrytypes{freeform}
\DeclareDatamodelFields[type=field,datatype=literal]{
bibliography,
cite,
firstcite,
}
\DeclareDatamodelEntryfields[freeform]{
bibliography,
cite,
firstcite,
sortkey,
}
\end{filecontents}

\usepackage[style=verbose, backend=biber, datamodel=freeform, mincrossrefs=1]{biblatex}

\DeclareBibliographyDriver{freeform}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printfield{bibliography}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}

\renewbibmacro*{cite:full}{%
\ifentrytype{freeform}
{\iffieldundef{firstcite}
{\usebibmacro{cite:short}}
{\printfield{firstcite}}}
{\usebibmacro{cite:full:citepages}%
\printtext[bibhypertarget]{%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}%
\usebibmacro{shorthandintro}}}

\renewbibmacro*{cite:short}{%
\ifentrytype{freeform}
{\printfield{cite}}
{\printnames{labelname}%
\setunit*{\printdelim{nametitledelim}}%
\printfield[citetitle]{labeltitle}}}}

\DeclareSourcemap{
\maps[datatype=bibtex,overwrite=false]{
\map{
\pertype{freeform}
\step[fieldsource=bibliography]
\step[fieldset=sortkey, origfieldval]
}
}
}

\begin{filecontents}{\jobname.bib}
@freeform{marriage,
cite         = {Church of England (Derby, Derbs.), Parish Registers, vol.\ 4, p.\ 3, Smith-Bloggs (20 January 1815).},
firstcite    = {Church of England (Derby, Derbyshire, England), Parish Registers, vol.\ 4, p.\ 3, marriage of John Smith and Jane Bloggs (20 January 1815); digital images, Ancestry.com (\url{http://ancestry.com.au}: accessed 1 July 2018), citing Derbyshire Record Office, Matlock.},
bibliography = {Church of England (Derby, Derbyshire, England). Parish Registers. Digital images. Ancestry.com. \url{http://ancestry.com.au}: 2018.},
sortkey      = {Church of England, Derby, Derbyshire, England},
}
\end{filecontents}

\begin{document}
Lorem\footcite{marriage} ipsum\footcite{marriage}
\printbibliography
\end{document}


If you have two entries with the same bibliography you will of course get that output twice in the references, which may look odd. If you don't want that you can make sure that the same bibliography is only shown once by using a more complex structure in the .bib file.

@freeform{marriage:smithbloggs,
cite         = {Church of England (Derby, Derbs.), Parish Registers, vol.\ 4, p.\ 3, Smith-Bloggs (20 January 1815).},
firstcite    = {Church of England (Derby, Derbyshire, England), Parish Registers, vol.\ 4, p.\ 3, marriage of John Smith and Jane Bloggs (20 January 1815); digital images, Ancestry.com (\url{http://ancestry.com.au}: accessed 1 July 2018), citing Derbyshire Record Office, Matlock.},
options      = {skipbib},
crossref     = {coe:derb},
}
@freeform{marriage:smothbliggs,
cite         = {Church of England (Derby, Derbs.), Parish Registers, vol.\ 5, p.\ 1, Smoth-Bliggs (30 April 1815).},
firstcite    = {Church of England (Derby, Derbyshire, England), Parish Registers, vol.\ 5, p.\ 1, marriage of Jane Smoth and John Bliggs (30 April 1815); digital images, Ancestry.com (\url{http://ancestry.com.au}: accessed 1 July 2018), citing Derbyshire Record Office, Matlock.},
options      = {skipbib},
crossref     = {coe:derb},
}
@freeform{coe:derb,
sortkey      = {Church of England, Derby, Derbyshire, England},
bibliography = {Church of England (Derby, Derbyshire, England). Parish Registers. Digital images. Ancestry.com. \url{http://ancestry.com.au}: 2018.},
}


If two entries share the same bibliography, you can outsource the bibliography and sortkey fields into a new entry and reference it from the citation entries with crossref = {...}, make sure that the citation entries don't end up in the bibliography with options = {skipbib},.

But here biblatex does not really do a lot except for sorting and tracking of first vs. subsequent citations. That could be achieved differently.

• I appreciate you giving me this answer, even though, as you say, biblatex is not designed for use with 'freeform' citations. If I did run into a situation with duplicate items in the bibliography, is there a way around that? Or could I simply leave the 'bibliography' field in the .bib file blank for any entries that I know will be the same? And I'm assuming I can still use the feature of biblatex here where I can use keywords to split the reference up into separate sections? – S. Bell Jul 1 '18 at 23:35
• @S.Bell Have a look at the updated answer for a suggestion on dealing with several citations with the same bibliography. It requires some manual work, but I guess that is almost unavoidable. You can use most of the features biblatex provides, filtering by keywords should be absolutely fine. – moewe Jul 2 '18 at 6:11
• I think I followed your instructions correctly, but I'm having an issue with the 'empty' crossref bibliography item not showing up in my bibliography. Any ideas or should I open a new question? – S. Bell Jul 4 '18 at 10:04
• @S.Bell Yes, please open a new question with a complete MWE/MWEB of what you are doing. (Make sure that we can compile the MWE, so test it in an empty folder before you submit your question.) Please also describe what output you get (you can include a screenshot) and the output you want to get. – moewe Jul 4 '18 at 10:07
• @MrYouMath sortkey should determine the sort order in the bibliography, so you could write sortkey = {Elk 1972} for a work by Elk from 1972 if you want to sort by name and year. Since no other fields are used, this field should include all necessary sorting information. It is used exactly as provided. Note further that this sorting is primitive string sorting, so you may have to resort to certain tricks if you want more advanced stuff. What exactly do you want, what did you try and how did it not work for you? It's probably better to ask a new question about that if it's more complicated. – moewe Nov 17 '18 at 15:07