3

For reasons unknown to me the following minimised latex code produces a

(/opt/local/share/texmf-texlive/tex/latex/mdwtools/syntax.sty) (./text.aux)) ! Incomplete \iffalse; all text was ignored after line 12.

error by pdflatex. Its derived from my document where the trouble started when I tried to add the syntax package:

\documentclass[a4paper,fontsize=12pt,parskip=half,toc=listofnumbered,toc=bib]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}


\usepackage{syntax}

\begin{document}

\begin{quotation}
As a rule of thumb, if you can tell which computer you are using, you are not using a distributed system.
\end{quotation} from \cite{DOS_Tanenbaum}

\end{document}

Is seems it somehow interferes with bibtex, since when I remove the \cite it generates a pdf.

7
  • syntax redefines the underscore, as you are using one in the cite key it breaks. Feb 28, 2019 at 9:50
  • WTF, good to know. You are right, post it as an answer and get your mark. Feb 28, 2019 at 9:52
  • Ohh nice now I get other errors like ! Missing \endcsname inserted. in the whole document , seems now it interferes with glossary Feb 28, 2019 at 9:56
  • 3
    Well then don't use the package. It is from 1996, and it is quite improbable that someone will fix the incompabilities. Feb 28, 2019 at 10:00
  • 4
    See also tex.stackexchange.com/a/251962/2388 Feb 28, 2019 at 10:02

1 Answer 1

2

The simplest solution is to do \usepackage[nounderscore]{syntax}. However, you can fix the usage in labels or citations.

\documentclass{article}

\usepackage{syntax}

\makeatletter
\def\@uscore.{%
  \ifmmode
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
  \sb
  {\@usc@re}%
}
\def\@usc@re{%
  \ifincsname
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
  {\string_}%
  {\textunderscore\@ifnextchar_{}{\usc@builtindischyphen}}%
}
\if@uscore
  \AtBeginDocument{%
    \catcode`\_\active%
    \begingroup%
    \lccode`\~`\_%
    \lowercase{\endgroup\protected\def~{\@uscore.}}%
  }
\fi


\begin{document}

This is an underscore ``_''; also \cite{DOS_Tanenbaum} and $a_1$

\end{document}

enter image description here

1
  • Thank you for your effort, but then the packages creates different issues with the glossaries package. However as the comment from Ulrike Fischer, this fixed this specific issues, so if you want, I check you as accepted. Feb 28, 2019 at 11:54

You must log in to answer this question.

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