My question concerns `inacessible'. I have already searched and found little information to assist me. My code is much too lengthy and complex for a MWE, so I will have to hunt this down myself. Thus, I seek guidance as to where to look.

The error concerns entrance to math mode. As soon as the $ is encountered, compile halts, and states that the $ is inaccessible. Also happens if I use \( instead. Does not matter what follows the $. Even $ $ throws the error, as soon as the first $ is encountered in document body.

I am using lualatex 2017 with fontspec, but the error is not produced by test documents that do not use my code. Thus, the error is certainly in my own code. Also, no error is produced if I avoid math mode, when using my own code. So, that limits the possibilities. I do not have any macros that specifically address math mode.

I have checked, just prior to the $, and the catcode of $ is 3, as expected. I have also asked \show$ and it tells me that it is the math mode shift, as expected.

According to the TeX error message, and also from previous questions here, inacessible may be thrown when the code contains erroneous syntax such as \def{somecommand}{something} instead of the correct \def\somecommand{something}. I have reviewed my code, and there is no such mistake. The log file does not illuminate me.

So, what other things may cause an inaccessible message? Given some possibilities, I will have to hunt this down myself. I hope I have phrased this question so that it is of general interest.

FURTHER EDIT: Earlier, I had a portion of the log file here, but it is too localized to be of general interest. The relevant portion concerned errors in how the math-mode fonts were defined. The errors were always lurking, but not thrown until math mode was entered. What caused the error was my own manipulation of font-related code, in a way that was harmless to ordinary text mode.

I accepted David's answer, because his response (continued in chat) helped me narrow the problem to a particular portion of my code. Barbara's answer was also helpful. When I cut that code section out, math mode works. Now, all I have to do is figure out why. The reason will not be exactly the one mentioned (incorrect usage of \def) but rather something involving my own redefinition of a command. There are many ways to fumble a redefinition, which are well-discussed in many other questions on this forum. Among the possibilities are using \let when it should be \LetLtxMacro, or redefining a command originally in ExplSyntax so that it no longer uses that syntax.

The instructional point: Incorrect usage of \def (or \edef and such) is not the only way to fumble a macro definition.

FINAL(?) EDIT: Problem solved! In my code, I had done this: \let\textfont\rmfamily\relax. That was old code, and I have forgotten why I did it (serves no real purpose). So I got rid of it, and now all is good. It turns out that \textfontN (where N is a number) is used by the fontloader. So, my code disrupted the fontloader for whatever followed, and that happened to trap the part where the math font was loaded. The error only appeared when entering math mode, because that was the only place where the misdefined font would be called. If the error had been directly thrown by the fontloader during Preamble, I would have found it.

closed as unclear what you're asking by user139954, user36296, Mico, egreg, diabonas Oct 19 '17 at 22:27

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • @DavidCarlisle I have added the final portion of log file, using \tracingall. – user139954 Oct 17 '17 at 19:50
  • Just killed it. It seemed to hang. Will re-try. – user139954 Oct 17 '17 at 20:00
  • @DavidCarlisle Terminated log file with x. Revised final portion of log file now posted above, showing the inacessible. – user139954 Oct 17 '17 at 20:11
  • Let us continue this discussion in chat. – David Carlisle Oct 17 '17 at 20:13
  • math@fonts ->protect protect edef TU you are doomed from here on, this is an accident waiting to happen, I wonder how you got there. – David Carlisle Oct 17 '17 at 20:21

If an inaccessible control sequence is inserted every math then in classic tex you almost certainly have something like

\everymath{\def z{}}

blah $x$


which produces

! Missing control sequence inserted.
<inserted text> 
<to be read again> 
<everymath> \def z
<to be read again> 
l.6 blah $x

You could do the same in luatex but in luatex there are additional possibilities of inserting the error generating code via Lua callbacks rather than by the \everymath register.

Since posting this answer the log was added to the question and it confirms that this is essentially what has happened.

LaTeX loads math fonts (the first time math is used at each font size) in \everymath and for various reasons it processes font loading code in a mode where backslashes are not used when displaying command names.

For some reason (not clear from the log fragment shown) parts of \math@fonts seem to have been incorrectly double-expanded and so the next time it is executed, instead of


it does

\def TU{TU}

as \encoding has expanded already

so \def sees T and .....

  • None of my own code uses everymath. In the log file with \tracingall there is only this line: \everymath->\check@mathfonts \the \everymath . – user139954 Oct 17 '17 at 19:53
  • \show\everymath produces toks11. – user139954 Oct 17 '17 at 19:56
  • @RobtAll yes I know:-) – David Carlisle Oct 17 '17 at 19:58
  • 1
    @RobtAll added a start of some analysis of your log – David Carlisle Oct 17 '17 at 20:29
  • Add my upvote +1. – Sebastiano Oct 17 '17 at 20:52

david's comment and answer gave me an idea.

try this with any flavor of latex:


i get

! Missing control sequence inserted.
<inserted text> 
l.2 \newcommand{z}{xxx}

this implies the possibility that you may be trying to define a command without an initial backslash. there are other possibilities, of course, but this should be a relatively easy one to find.

  • not the OP: it's Frank that turned off the backslashes then tried to define a command... – David Carlisle Oct 17 '17 at 20:13
  • @DavidCarlisle -- should i delete this answer then? – barbara beeton Oct 17 '17 at 20:15
  • 1
    no a random future person looking for this error message more likely to be helped by this answer than any answer to the actual problem in this question, which would involve tracing how some unshown lua fot setup in the OPs document has thrown some latex font loading code written in a previous millenium for a different tex engine off course:-) – David Carlisle Oct 17 '17 at 20:18
  • Just now, I did look through my code for \newcommand{missingslash} but found nothing. – user139954 Oct 17 '17 at 20:22
  • @DavidCarlisle Regarding your comment above: In most cases that would be true, but before posting I already found other threads on this topic, including the situation mentioned by yourself and Barbara. The indicated solution did not work. Although the problem is "related" to that, the obscurity of the TeX error message (as usual) provided no guidance. – user139954 Oct 19 '17 at 20:52