# LaTeX internal references for files and URLs

I have a document with nearly 100 open source files that are referenced repeatedly throughout. Also, with each file is a URL, download URL, MD5 hash, etc.

Is there a quick and simple way to create an external file (say .ent) containing all this information and then reference each item within the publishable file (or the .tex)? That way, whenever a file is updated, I need only change the single entry in the static file and all references to that file throughout my document are also updated?

• I have heard of applications of biblatex for other things than bibliography. Maybe this might a solution. – user36296 Jun 27 '16 at 19:10

Even if you probably know biblatex only as a tool to create bibliographies, it is a powerful tool which can be used for a lot of things:

\documentclass{article}
\usepackage{biblatex}

\usepackage{filecontents}

\begin{filecontents*}{database.ent}
@file{test,
usera = {www.URL.com},
userc = "md5123456"
}
\end{filecontents*}

\DeclareCiteCommand{\citeurl}
{}
{\printfield{usera}}
{}
{}

{}
{\printfield{userb}}
{}
{}

\DeclareCiteCommand{\citemd}
{}
{\printfield{userc}}
{}
{}

\begin{document}

\citeurl{test}

\citemd{test}

\end{document}


In case you do not want to remember which field usera etc was supposed to be, you can create your own fields:

\documentclass{article}
\usepackage{biblatex}

\usepackage{filecontents}

\begin{filecontents*}{database.ent}
@file{test,
md = "md5123456"
}
\end{filecontents*}

\begin{filecontents*}{test.dbx}
\DeclareDatamodelFields[type=field,datatype=verbatim]{md}
\DeclareDatamodelEntryfields{md}
\end{filecontents*}

\DeclareCiteCommand{\citemd}
{}
{\printfield{md}}
{}
{}

\begin{document}

\citemd{test}

\end{document}


[The important thing here is, that the \DeclareDatamodel things cannot be in your current tex file, but have to be in an external file, test.dbx in this example]

• samcarter, I think your answer best meets my needs. I am going to try and use your example and see if I can shoehorn it into my settings. I think this will work. I did not even think of trying biblatex as a possible solution. – Kerry Cox Jun 28 '16 at 22:25
• @KerryCox Good luck! Maybe start with the first example, custom fields, like in the second example, can be tricky. – user36296 Jun 28 '16 at 23:17
• @KerryCox So did it work for your project? – user36296 Jul 1 '16 at 17:20
• No, it did not. I tried your first example and got only a test, test, test back. I am still new to LaTeX and have yet to try out the biblatex option. I'm just trying to finish up my book and when done, I'll try substituting and saving the variables. I did find the following link that looks promising as well: tex.stackexchange.com/questions/37094/… – Kerry Cox Jul 19 '16 at 4:18
• @KerryCox Maybe a stupid question, but if you get test, test, test, did you run (pdf)latex -> biber -> (pdf)latex -> (pdf)latex? And does biber give you any errors or warnings? – user36296 Jul 19 '16 at 8:13