Dealing with a bizarre error due to single-quote characters

Kirill Elagin kirelagin at gmail.com
Fri Sep 17 01:58:41 CEST 2021


Hello,

I am facing a completely crazy issue that has to do with \input’ing
documents that contain single-quote characters. I have a document
template that includes a pdf_tex image (from Inkscape) in page
headers, which worked perfectly well, until at some point build
started failing with:

```
(./input.latex
! Missing $ inserted.
<inserted text>
                $
l.3 %% Accompanies image file
```

It turned out that this was due to single-quote characters occurring
in comments and string literals in the pdf_tex file. I managed to work
the issue around for now by replacing those single-quotes with
something else. What’s crazy about this is that (a) those
single-quotes are completely valid and (b) the error appears and
disappears seemingly randomly depending on the content of the main
file at completely unrelated locations.

Here is a minimal reproducer: https://github.com/serokell/latex-quote-repro.

The example might look like I lost my mind, but, I promise, I did not.
It consists of two files:

1. `input.latex` is the one that is being \input’ed, and it is just an
arbitrary file containing a single-quote;
2. `main.latex` has a pretty random structure and is full of letters
“x”, since I obtained it by minimising a real document.

I realise that, unfortunately, this “minimal” example is not so
minimal, as it depends on KOMA-Script, but that’s as far as I could
get.

The error is very sensitive to the content of the main file – removing
any (non-essential) line will make the error go away; also I tried to
minimise the actual gibberish content, so, in most cases, removing one
letter “x” will also result in the error going away.

I don’t understand if this is an issue with KOMA-Script or with LaTeX.
The entire thing, honestly, doesn’t make any sense to me and the only
reasonable explanation that I have is memory corruption. However,
given the complexity of the setup, I guess, it might be something in
KOMA as well, but I can’t prove this, since, due to the extreme
sensitivity of the error, I can’t get rid of KOMA in the reproducer.

In any case, I will be grateful for any advice and pointers in the
right direction. I guess, the first thing I need to do is figure out
where to report this for further investigation.

Cheers,
Kirill



More information about the texhax mailing list.