filecontentsdef: How to save a file data in a macro without creating a physical file in the working directory?

by Diaa   Last Updated October 09, 2019 20:23 PM - source

Following the description of filecontentsdefmacro environment in the manual of filecontentsdef, I understood that it can be used to save some data in a macro without the need to create a physical file in the working directory.

However, the following MWE doesn't work as I expected. So, my question is how can I store a *.bib file data in a macro without creating a physical file in the working directory?

% arara: lualatex: { options: [ '-synctex=1', '-shell-escape','-interaction=nonstopmode' ]}
% arara: biber
% arara: lualatex: { options: [ '-synctex=1', '-shell-escape','-interaction=nonstopmode' ]}
% arara: lualatex: { options: [ '-synctex=1', '-shell-escape','-interaction=nonstopmode' ]}

\documentclass[nonatbib]{elsarticle}

\makeatletter
\let\[email protected]\relax
\makeatother

\usepackage[backend=biber,hyperref=true]{biblatex}

\usepackage{filecontentsdef,hyperref}
\begin{filecontentsdefmacro}{\somemacro}
@Article{key,
    author =    {author},
    title =     {title},
    journal = {journal}
}
\end{filecontentsdefmacro}

\addbibresource{\somemacro}

\begin{document}
    Lorem ipsum~\cite{key}.
    \printbibliography
\end{document}


Related Questions



filecontents replaces tabs with spaces

Updated March 08, 2017 20:23 PM

Why can't fillcontents work in a macro

Updated February 23, 2016 01:10 AM


Overwriting file warning

Updated November 24, 2017 19:23 PM