2

I get the following error message when using the semantic package:

   ! Bad mathchar (32768).
<to be read again> 
                   \relax 
l.13 \begin{document}

The problem goes away if I load the semantic package with just the inference option. However, I do need math ligatures (the \mathlig command).

Also, the problem disappears if I do not load the mathtools package. Here is a minimal working example:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{semantic}

% \usepackage{mathtools}     % Uncommenting this causes the problem.

\mathlig{->}{\rightarrow}
\mathlig{|->}{\mapsto}

\begin{document}

Here is a formula: $a -> b |-> c$.

\end{document}
dow
  • 648
  • 4
  • 9
  • 2
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Moriambar Jun 20 '17 at 20:19
  • Sorry about that, I have edited the question accordingly. – dow Jun 20 '17 at 20:52
  • 2
    Just switch the loading order: first mathtools, then semantic. – egreg Jun 20 '17 at 20:55
  • Thanks guys, that makes the MWE work, but breaks other random things, like for example $a^*$. The solution is of course to write $a^{*}$ instead.

    Just felt like leaving this here.

    – dow Jun 20 '17 at 21:09

2 Answers2

3

The semantic package documentation doesn’t explicitly tell that amsmath should be loaded before it.

Since mathtools loads amsmath, the same applies.

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{mathtools} % must go before semantic
\usepackage{semantic}

\mathlig{->}{\rightarrow}
\mathlig{|->}{\mapsto}

\begin{document}

Here is a formula: $a -> b |-> c$.

\end{document}

enter image description here

I'm not really sure of the advantage of -> over \rightarrow and |-> over \mapsto.

egreg
  • 1,121,712
  • I write programming language semantics, and being able to read inference rules in-source is of great value. Consider for example\mathlig{-->*}{\longrigharrow^{*}}, standing for the transitive reflexive closure of some pre-defined --> relation. – dow Jun 20 '17 at 21:12
1

Try this fix:

Add the code :

\usepackage{mathpazo}
\usepackage[mathpazo]{flexisym}

PS: Found the fix here

koleygr
  • 20,105
  • Thanks for your response; however, it did not fix my problem. I am now getting

    ! Undefined control sequence. \binrel@@ #1->\@symErr ?{\OrdSymbol {#1}} l.43 \paralonen

    Please see my edited question for a minimal working example.

    – dow Jun 20 '17 at 20:53