Subject: bug#41089: 11.91; preview-latex gets confused by tikz calc syntax

From: Arash Esbati <[email-masked]>
Date: Wed, 06 May 2020 07:51:41 +0200

Hi Dylan,

Dylan Thurston <[email-masked]> writes:

> On Tue, May 05, 2020 at 08:39:09PM +0200, Arash Esbati wrote:
>> Your example works for me if I give preview-latex 2 hints:
>> 
>> 1)  Don't touch $ in order to keep tikz happy
>> 2)  Tell preview-latex that it should render tikzpicture environment.
>
> Thanks for the suggestion, but I definitely *do* want preview-latex to
> render text math, as that's the main use of the mode for me.
>
> Can't preview-latex detect and ignore nested environments to register?

I think the main issue is that tikz throws an error when $ is redefined:

    Package tikz Error: Sorry, some package has redefined the meaning of
    the math-mode dollar sign. This is incompatible with tikz and its
    calc library and might cause unrecoverable errors.

Consider this example with renders fine with preview:

--8<---------------cut here---------------start------------->8---
\documentclass{article}

\usepackage[displaymath,floats,graphics,footnotes,
textmath  %% Don't touch $ %%
]{preview}

\begin{document}

Text $D_1 \setminus V_1$
\[
  D_1 \setminus V_1 \quad \mbox{Text with $D_1 \setminus V_1$}
\]

\end{document}
--8<---------------cut here---------------end--------------->8---

preview can handle $ constructs in environments.

I'm not familiar with tikz, maybe it has an option to be more forgiving
when $ is redefined?

Best, Arash