2

I'm having trouble using both the biblatex package (to manage the bibliography) and the navigator package (to embed a file into the PDF). Here is a minimum example:

\documentclass[11pt,letterpaper,titlepage]{article}

\usepackage{biblatex}
\usepackage{navigator}

\addbibresource{latextest.bib}

% Just need some file here
\embeddedfile{Test}[Test.txt]{latextest.bib}

\begin{document}

Test

Test \cite{ctan}

Test

\printbibliography

\finishpdffile

\end{document}

Here are the contents of latextest.bib:

@online{ctan,
    title = "The Comprehensive TeX Archive Network",
    url = "https://ctan.org/"
}

The log file shows several errors:

! Undefined control sequence.
<argument> \bibname 

l.11 \begin{document}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.


! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.11 \begin{document}

You're in trouble here.  Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

! Too many }'s.
<argument> ...cs \bibname {\abx@str @bibliography}

l.11 \begin{document}

You've closed more groups than you opened.
Such booboos are generally harmless, so keep going.

! Too many }'s.
<argument> \letcs \refname {\abx@str @references}

l.11 \begin{document}

You've closed more groups than you opened.
Such booboos are generally harmless, so keep going.

! Undefined control sequence.
<argument> \biblistname 

l.11 \begin{document}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Too many }'s.
<argument> ... \biblistname {\abx@str @shorthands}

l.11 \begin{document}

You've closed more groups than you opened.
Such booboos are generally harmless, so keep going.

If the bibliography-related commands (\usepackage{biblatex}, \addbibresource, \cite, and \printbibliography) are commented out then compilation is successful. Similarly, if the commands related to embedding the file (\usepackage{navigator}, \embeddedfile, and \finishpdffile) are commented out, then compilation is also successful.

This happens with both MiKTeX 2.9.7216-x64 (re-installed yesterday and all packages up-to-date) and TeX Live 2017.20180305-1 running on Ubuntu. I'm compiling with XeTeX and Biber.

I'd appreciate any fixes or suggestions on how to troubleshoot the issue.

1 Answer 1

5

There is indeed a fundamental incompatibility between navigator and biblatex (or to be more precise a fundamental incompatibility between the TeX programming toolboxes the two use, namely texapi and etoolbox).

If you exchange the loading order of the two packages in the minimal example to

\usepackage{navigator}
\usepackage{biblatex}

you'll get the following error

("C:\Program Files\MiKTeX 2.9\tex/latex/etoolbox\etoolbox.sty"

! LaTeX Error: Command \letcs already defined.
               Or name \end... illegal, see p.192 of the manual.

This suggests that navigator or a package that is loaded by navigator defines the command \letcs that is also defined by etoolbox (which is needed by biblatex).

A bit of digging shows that texapi, which is loaded by navigator, has

\long\pdef\letcs#1{\expandafter\let  \csname#1\endcsname}

whereas etoolbox has

\newrobustcmd{\letcs}[2]{%
  \ifcsdef{#2}
    {\expandafter\let\expandafter#1\csname#2\endcsname}
    {\undef#1}}

Unfortunately, these two definitions have the exact opposite 'syntax'. texapi's version is used as

\letcs{foo}\bar

while etoolbox uses its version as

\letcs\foo{bar}

Since the command is ubiquitous in both navigator and biblatex this name clash makes the packages pretty much incompatible. If you want to make the two packages work together you have to save and restore the correct version of \letcs as needed by the commands used.

In the MWE below things are set up so that the working definition of \letcs throughout the document is the one from etoolbox. This means that for every navigator command we need to locally reset \letcs to its texapi definition.

\documentclass[11pt,letterpaper,titlepage]{article}

\usepackage{navigator}
\let\navletcs\letcs
\let\letcs\relax
\usepackage{biblatex}

\begin{filecontents}{latextest.bib}
@online{ctan,
    title = "The Comprehensive TeX Archive Network",
    url = "https://ctan.org/"
}
\end{filecontents}
\addbibresource{latextest.bib}

\begingroup
\let\letcs\navletcs
\embeddedfile{Test}[Test.txt]{latextest.bib}
\endgroup

\begin{document}
Test

Test \cite{ctan}

Test

\printbibliography

\begingroup
\let\letcs\navletcs
\finishpdffile
\endgroup
\end{document}
1
  • Ingenious solution, thank you for the thorough explanation!
    – nkarstens
    Commented Oct 10, 2019 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .