2

While trying to use yax in my thesis, I discovered that it was incompatible with biblatex in the same way as described in this question. I tried to apply the workaround described in the answer to that question, and it worked with article document class, but not with the Master/PhD thesis template I'm using.

This is the minimal example (it compiles if I change the document class to article):

\documentclass[english]{MastersDoctoralThesis}
%\documentclass{article}

\usepackage{yax}

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

\begin{document}
    It is sometimes really hard to get TeX to work.
\end{document}

The first error:

! Undefined control sequence.
<argument> \letcs \blx@backrefsetstyle 
                                       {blx@opt@backrefsetstyle@setonly}
l.13363 ...conds=false,julian=false,labeltime=24h}

1 Answer 1

4

It's not actually biblatex that is incompatible with yax, it's etoolbox. (biblatex loads and uses etoolbox for many things. And it's not actually yax, it's texapi, which is loaded by yax.)

MastersDoctoralThesis also loads etoolbox, so when you say

\documentclass[english]{MastersDoctoralThesis}

\usepackage{yax}

\let\navletcs\letcs
\let\letcs\relax

etoolbox has already been loaded by MastersDoctoralThesis and yax has already overwritten its \letcs.

The following

\usepackage{biblatex}

will not load etoolbox again, because LaTeX loads packages only once. So etoolbox will not overwrite the definitions from yax.

The error can be avoided by making sure yax is really loaded before etoolbox. We also save the definitions of \letcs to be able to switch between them later.

\RequirePackage{yax}
\let\texapiletcs\letcs
\let\letcs\relax
\RequirePackage{etoolbox}
\let\etoolboxletcs\letcs
\documentclass[english]{MastersDoctoralThesis}

\usepackage{biblatex}

\begin{document}
    It is sometimes really hard to get TeX to work.
\end{document}

Note that uses of commands defined by yax may break in the document unless you switch to texapi's definition of \letcs and that commands defined by biblatex/etoolbox may break if you don't switch back quickly enough.

Avoiding groups (which may have undesirable side effects) this can be done roughly as follows

\let\letcs\texapiletcs % switch to texapi definition
... do stuff with yax ...
\let\letcs\etoolboxletcs % go back to etoolbox definition

If at all possible I recommend you look for an alternative to yax. I'm also not too fond of MastersDoctoralThesis (it appears to me that it usually causes more trouble for people than necessary), so if you still have a chance to switch to a more standard document class, that's something you may seriously want to consider.

4
  • Thanks you! The solution doesn't fully work in my case though. I want to define a bunch of yax values (\setparameter) and then use them throughout the text with \usevalue. If I wrap a definition and a usage in the same \begingroup \let\letcs\navletcs \endgroup it works, but with separate groups it doesn't (the value doesn't show up). Is there a workaround for this? On a related note, what would you suggest as alternatives to yax and to the thesis template? Commented Apr 11, 2020 at 10:04
  • 1
    @SergeiTikhomirov Check out the update, please. I don't know what you need yax for, so I can't suggest a good alternative (I hadn't heard of yax until today). An alternative for the thesis template is not to use a template at all and to start from one of the standard classes (probably report or book for a thesis) one of the KOMA-Script classes (scrreprt, scrbook) or memoir.
    – moewe
    Commented Apr 11, 2020 at 10:28
  • @sergei en.m.wikibooks.org/wiki/LaTeX/Scientific_Reports
    – Johannes_B
    Commented Apr 12, 2020 at 3:30
  • wouldn't it be better to \RequirePackage{texapi} instead of \RequirePackage{yax}, in case yax ever stops using it?
    – jan-glx
    Commented Aug 4 at 13:35

You must log in to answer this question.

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