GNU bug report logs - #41089
11.91; preview-latex gets confused by tikz calc syntax

Previous Next

Package: auctex;

Reported by: Dylan Thurston <dpt <at> bostoncoop.net>

Date: Mon, 4 May 2020 22:54:01 UTC

Severity: normal

Found in version 11.91

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41089 in the body.
You can then email your comments to 41089 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-auctex <at> gnu.org:
bug#41089; Package auctex. (Mon, 04 May 2020 22:54:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dylan Thurston <dpt <at> bostoncoop.net>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Mon, 04 May 2020 22:54:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dylan Thurston <dpt <at> bostoncoop.net>
To: bug-auctex <at> gnu.org
Subject: 11.91; preview-latex gets confused by tikz calc syntax
Date: Mon, 4 May 2020 18:53:02 -0400
preview-latex appears to get confused by tikz calc syntax, which
includes a dollar sign. Here is a minimal file:
------------------------------------------------------------
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
  \[
  \begin{tikzpicture}[x=1.5cm]
    \node (S1) at (0,1) {$S_1$};
    \node (D1) at (1,1) {$D_1 \setminus V_1$};
    \node (V1) at (2,1) {$V_1$};
    \node at ($(S1.east)!0.5!(D1.west)$) {$\sqcup$};
    \node at ($(D1.east)!0.5!(V1.west)$) {$\sqcup$};
  \end{tikzpicture}
  \]
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
------------------------------------------------------------
The log output file is below.


Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11)
 of 2019-09-22, modified by Debian
Package: 11.91

Run buffer contents:

Running `Preview-LaTeX' on `/tmp/_region_' with ``pdflatex  -file-line-error   "\nonstopmode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview}\AtBeginDocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,floats,graphics,textmath,sections]{preview}[2004/11/05]\fi}" "\input" "\detokenize{" _region_.tex "}"''
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-04-06>
No auxiliary output files.

(./_region_.tex  !name(t.tex) (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (/usr/share/texlive/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty (/usr/share/texlive/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty (/usr/share/texlive/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex)) (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def (/usr/share/texlive/texmf-dist/tex/latex/ms/everyshi.sty)) (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex (/usr/share/texlive/texmf-dist/tex/generic/pgf/pgf.revision.tex))) (/usr/share/texlive/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty) (/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def))) (/usr/share/texlive/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex (/usr/share/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)) (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg) (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def))) (/usr/share/texlive/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex) (/usr/s...

[...]

	....15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Missing \endcsname inserted.
<to be read again> 
                   \pr@$ 
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Extra \endcsname.
<argument> \endcsname 
                      
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Missing number, treated as zero.
<to be read again> 
                   \pgf <at> sh <at> nt@ 
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Illegal unit of measure (pt inserted).
<to be read again> 
                   \pgf <at> sh <at> nt@ 
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Missing number, treated as zero.
<to be read again> 
                   \global 
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Illegal unit of measure (pt inserted).
<to be read again> 
                   \global 
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Missing number, treated as zero.
<to be read again> 
                   (
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Illegal unit of measure (pt inserted).
<to be read again> 
                   (
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Missing number, treated as zero.
<to be read again> 
                   \global 
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Illegal unit of measure (pt inserted).
<to be read again> 
                   \global 
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
./_region_.tex:15: Missing number, treated as zero.
<to be read again> 
                   D
l.15     \node at ($(D1.east)
                             !0.5!(V1.west)$) {$\sqcup$};
(That makes 100 errors; please try again.)
./_region_.tex:15:  ==> Fatal error occurred, no output PDF file produced!
Transcript written on _region_.log.

TeX Output exited as expected with code 1 at Mon May  4 18:46:32
Running `Preview-PDF2DSC' with ``pdf2dsc _region_.pdf _region_.prv/tmpC8AQHt/preview.dsc''

Preview-PDF2DSC killed at Mon May  4 18:46:32

current state:
==============
(setq
 AUCTeX-version "11.91"
 LaTeX-command-style '((""
			"%(PDF)%(latex) %(file-line-error) %(extraopts) %S%(PDFout)")
		       )
 image-types '(svg imagemagick png gif tiff jpeg xpm xbm pbm postscript)
 preview-image-type 'png
 preview-image-creators '((dvipng
			   (open preview-gs-open preview-dvipng-process-setup)
			   (place preview-gs-place) (close preview-dvipng-close))
			  (png (open preview-gs-open) (place preview-gs-place)
			   (close preview-gs-close))
			  (jpeg (open preview-gs-open) (place preview-gs-place)
			   (close preview-gs-close))
			  (pnm (open preview-gs-open) (place preview-gs-place)
			   (close preview-gs-close))
			  (tiff (open preview-gs-open) (place preview-gs-place)
			   (close preview-gs-close))
			  )
 preview-dvipng-image-type 'png
 preview-dvipng-command "dvipng -picky -noghostscript %d -o %m/prev%%03d.png"
 preview-pdf2dsc-command "pdf2dsc %s.pdf %m/preview.dsc"
 preview-gs-command "/usr/bin/rungs"
 preview-gs-options '("-q" "-dDELAYSAFER" "-dNOPAUSE" "-DNOPLATFONTS" "-dPrinted"
		      "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4")
 preview-gs-image-type-alist '((png png "-sDEVICE=png16m")
			       (dvipng png "-sDEVICE=png16m")
			       (jpeg jpeg "-sDEVICE=jpeg")
			       (pnm pbm "-sDEVICE=pnmraw")
			       (tiff tiff "-sDEVICE=tiff12nc"))
 preview-fast-conversion t
 preview-prefer-TeX-bb nil
 preview-dvips-command "dvips -Pwww -i -E %d -o %m/preview.000"
 preview-fast-dvips-command "dvips -Pwww %d -o %m/preview.ps"
 preview-scale-function 1.0
 preview-LaTeX-command '("%`%l \"\\nonstopmode\\nofiles\\PassOptionsToPackage{"
			 ("," . preview-required-option-list)
			 "}{preview}\\AtBeginDocument{\\ifx\\ifPreview\\undefined" preview-default-preamble "\\fi}\"%' \"\\detokenize{\" %t \"}\"")
 preview-required-option-list '("active" "tightpage" "auctex"
				(preview-preserve-counters "counters"))
 preview-preserve-counters nil
 preview-default-option-list '("displaymath" "floats" "graphics" "textmath"
			       "sections")
 preview-default-preamble '("\\RequirePackage["
			    ("," . preview-default-option-list)
			    "]{preview}[2004/11/05]")
 preview-LaTeX-command-replacements nil
 preview-dump-replacements '(preview-LaTeX-command-replacements
			     ("\\`\\([^ ]+\\)\\(?: +\\(?:\\(--?kanji[= ][^ ]+\\)\\|-\\(?:[^ \\\"]\\|\\\\.\\|\"[^\"]*\"\\)*\\)\\)*\\(.*\\)\\'" "\\1 -ini \\2 -interaction=nonstopmode \"&\\1\" " preview-format-name ".ini \\3")
			     )
 preview-undump-replacements '(("\\`\\([^ ]+\\)\\(?: +\\(?:\\(--?kanji[= ][^ ]+\\)\\|-\\(?:[^ \\\"]\\|\\\\.\\|\"[^\"]*\"\\)*\\)\\)*.* \"\\\\input\" \"\\\\detokenize{\" \\(.*\\) \"}\"\\'" "\\1 \\2 -interaction=nonstopmode -file-line-error " preview-format-name " \"/AUCTEXINPUT{\" \\3 \"}\"")
			       )
 preview-auto-cache-preamble 'ask
 preview-TeX-style-dir nil
 )

Output from running `/usr/bin/rungs -h':
GPL Ghostscript 9.52 (2020-03-19)
Copyright (C) 2020 Artifex Software, Inc.  All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
 -dNOPAUSE           no pause after page   | -q       `quiet', fewer messages
 -g<width>x<height>  page size in pixels   | -r<res>  pixels/inch resolution
 -sDEVICE=<devname>  select device         | -dBATCH  exit after last file
 -sOutputFile=<file> select output file: - for stdout, |command for pipe,
                                         embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: x11alpha
Available devices:
   alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 ap3250 appledmp
   atx23 atx24 atx38 bbox bit bitcmyk bitrgb bitrgbtags bj10e bj10v bj10vh
   bj200 bjc600 bjc800 bjc880j bjccmyk bjccolor bjcgray bjcmono bmp16 bmp16m
   bmp256 bmp32b bmpgray bmpmono bmpsep1 bmpsep8 ccr cdeskjet cdj1600 cdj500
   cdj550 cdj670 cdj850 cdj880 cdj890 cdj970 cdjcolor cdjmono cdnj500 cfax
   chp2200 cif cljet5 cljet5c cljet5pr coslw2p coslwxl cups declj250 deskjet
   devicen dfaxhigh dfaxlow display dj505j djet500 djet500c dl2100 dnj650c
   epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100 epl6200
   eplcolor eplmono eps2write eps9high eps9mid epson epsonc escp escpage
   faxg3 faxg32d faxg4 fmlbp fmpr fpng fs600 gdi hl1240 hl1250 hl7x0
   hpdj1120c hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510
   hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c
   hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdjplus hpdjportable ibmpro
   ijs imagen inferno ink_cov inkcov itk24i itk38 iwhi iwlo iwlq jetp3852
   jj100 jpeg jpegcmyk jpeggray la50 la70 la75 la75plus laserjet lbp310
   lbp320 lbp8 lex2050 lex3200 lex5700 lex7000 lips2p lips3 lips4 lips4v
   lj250 lj3100sw lj4dith lj4dithp lj5gray lj5mono ljet2p ljet3 ljet3d ljet4
   ljet4d ljet4pjl ljetplus ln03 lp1800 lp1900 lp2000 lp2200 lp2400 lp2500
   lp2563 lp3000c lp7500 lp7700 lp7900 lp8000 lp8000c lp8100 lp8200c lp8300c
   lp8300f lp8400f lp8500c lp8600 lp8600f lp8700 lp8800c lp8900 lp9000b
   lp9000c lp9100 lp9200b lp9200c lp9300 lp9400 lp9500c lp9600 lp9600s
   lp9800c lps4500 lps6500 lq850 lxm3200 lxm5700m m8510 md1xMono md2k
   md50Eco md50Mono md5k mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono miff24
   mj500c mj6000c mj700v2c mj8000c ml600 necp6 npdl nullpage oce9050 oki182
   oki4w okiibm oprp opvp paintjet pam pamcmyk32 pamcmyk4 pbm pbmraw pcl3
   pclm pcx16 pcx24b pcx256 pcxcmyk pcxgray pcxmono pdfimage24 pdfimage32
   pdfimage8 pdfwrite pdfwrite pdfwrite pgm pgmraw pgnm pgnmraw photoex
   picty180 pj pjetxl pjxl pjxl300 pkm pkmraw pksm pksmraw plan plan9bm
   planc plang plank planm plib plibc plibg plibk plibm png16 png16m png256
   png48 pngalpha pnggray pngmono pngmonod pnm pnmraw ppm ppmraw pr1000
   pr1000_4 pr150 pr201 ps2write psdcmyk psdcmyk16 psdcmykog psdrgb psdrgb16
   pwgraster pxlcolor pxlmono r4081 rinkj rpdl samsunggdi sj48 spotcmyk
   st800 stcolor t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc tiff32nc
   tiff48nc tiff64nc tiffcrle tiffg3 tiffg32d tiffg4 tiffgray tifflzw
   tiffpack tiffscaled tiffscaled24 tiffscaled32 tiffscaled4 tiffscaled8
   tiffsep tiffsep1 txtwrite uniprint x11 x11alpha x11cmyk x11cmyk2 x11cmyk4
   x11cmyk8 x11gray2 x11gray4 x11mono xcf xes xpswrite
Search path:
   /usr/share/ghostscript/9.52/Resource/Init :
   /usr/share/ghostscript/9.52/lib :
   /usr/share/ghostscript/9.52/Resource/Font :
   /usr/share/ghostscript/fonts : /var/lib/ghostscript/fonts :
   /usr/share/cups/fonts : /usr/share/ghostscript/fonts :
   /usr/local/lib/ghostscript/fonts : /usr/share/fonts
Ghostscript is also using fontconfig to search for font files
For more information, see /usr/share/doc/ghostscript/Use.htm.
On debian system you may need to install ghostscript-doc package.
Please report bugs to bugs.ghostscript.com.





Information forwarded to bug-auctex <at> gnu.org:
bug#41089; Package auctex. (Tue, 05 May 2020 18:42:01 GMT) Full text and rfc822 format available.

Message #8 received at 41089 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Dylan Thurston <dpt <at> bostoncoop.net>
Cc: 41089 <at> debbugs.gnu.org
Subject: Re: bug#41089: 11.91; preview-latex gets confused by tikz calc syntax
Date: Tue, 05 May 2020 20:39:09 +0200
[Message part 1 (text/plain, inline)]
Hi Dylan,

Dylan Thurston <dpt <at> bostoncoop.net> writes:

> preview-latex appears to get confused by tikz calc syntax, which
> includes a dollar sign. Here is a minimal file:
> ------------------------------------------------------------
> \documentclass{article}
> \usepackage{tikz}
> \usetikzlibrary{calc}
>
> \begin{document}
>   \[
>   \begin{tikzpicture}[x=1.5cm]
>     \node (S1) at (0,1) {$S_1$};
>     \node (D1) at (1,1) {$D_1 \setminus V_1$};
>     \node (V1) at (2,1) {$V_1$};
>     \node at ($(S1.east)!0.5!(D1.west)$) {$\sqcup$};
>     \node at ($(D1.east)!0.5!(V1.west)$) {$\sqcup$};
>   \end{tikzpicture}
>   \]
> \end{document}
>
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% End:
> ------------------------------------------------------------

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.

Then your document would look like this:

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

\usepackage{tikz}
\usetikzlibrary{calc}

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

\begin{document}

Text
\[
  \begin{tikzpicture}[x=1.5cm]
    \node (S1) at (0,1) {$S_1$};
    \node (D1) at (1,1) {$D_1 \setminus V_1$};
    \node (V1) at (2,1) {$V_1$};
    \node at ($(S1.east)!0.5!(D1.west)$) {$\sqcup$};
    \node at ($(D1.east)!0.5!(V1.west)$) {$\sqcup$};
  \end{tikzpicture}
\]

Text
\begin{tikzpicture}[x=1.5cm]
  \node (S1) at (0,1) {$S_1$};
  \node (D1) at (1,1) {$D_1 \setminus V_1$};
  \node (V1) at (2,1) {$V_1$};
  \node at ($(S1.east)!0.5!(D1.west)$) {$\sqcup$};
  \node at ($(D1.east)!0.5!(V1.west)$) {$\sqcup$};
\end{tikzpicture}
Text

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

where preview-latex in Emacs looks like this:
[x1.png (image/png, inline)]
[Message part 3 (text/plain, inline)]
Reg. the `textmath' option, this is the description from the manual:

    `textmath' will make all text math subject to previews.  Since math
      mode is used throughly inside of LaTeX even for other purposes,
      this works by redefining \(, \) and $ and the `math' environment
      (apparently some people use that).  Only occurences of these text
      math delimiters in later loaded packages and in the main document
      will thus be affected.

Best, Arash

Information forwarded to bug-auctex <at> gnu.org:
bug#41089; Package auctex. (Wed, 06 May 2020 00:46:01 GMT) Full text and rfc822 format available.

Message #11 received at 41089 <at> debbugs.gnu.org (full text, mbox):

From: Dylan Thurston <dpt <at> bostoncoop.net>
To: Arash Esbati <arash <at> gnu.org>
Cc: 41089 <at> debbugs.gnu.org
Subject: Re: bug#41089: 11.91; preview-latex gets confused by tikz calc syntax
Date: Tue, 5 May 2020 20:45:01 -0400
Hi Arash,

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?

--Dylan




Information forwarded to bug-auctex <at> gnu.org:
bug#41089; Package auctex. (Wed, 06 May 2020 05:53:02 GMT) Full text and rfc822 format available.

Message #14 received at 41089 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Dylan Thurston <dpt <at> bostoncoop.net>
Cc: 41089 <at> debbugs.gnu.org
Subject: Re: bug#41089: 11.91; preview-latex gets confused by tikz calc syntax
Date: Wed, 06 May 2020 07:51:41 +0200
Hi Dylan,

Dylan Thurston <dpt <at> bostoncoop.net> 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




Information forwarded to bug-auctex <at> gnu.org:
bug#41089; Package auctex. (Wed, 06 May 2020 12:59:02 GMT) Full text and rfc822 format available.

Message #17 received at 41089 <at> debbugs.gnu.org (full text, mbox):

From: Dylan Thurston <dpt <at> bostoncoop.net>
To: Arash Esbati <arash <at> gnu.org>
Cc: 41089 <at> debbugs.gnu.org
Subject: Re: bug#41089: 11.91; preview-latex gets confused by tikz calc syntax
Date: Wed, 6 May 2020 08:58:54 -0400
On Wed, May 06, 2020 at 07:51:41AM +0200, Arash Esbati wrote:
> 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.

Ah, thanks for the hint. And indeed googling it reveals an answer, as
explained here:
https://tex.stackexchange.com/questions/149626/tikz-library-calc-and-auctex-preview-in-emacs-fails

--Dylan




Information forwarded to bug-auctex <at> gnu.org:
bug#41089; Package auctex. (Mon, 11 May 2020 19:55:01 GMT) Full text and rfc822 format available.

Message #20 received at 41089 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Dylan Thurston <dpt <at> bostoncoop.net>
Cc: 41089 <at> debbugs.gnu.org
Subject: Re: bug#41089: 11.91; preview-latex gets confused by tikz calc syntax
Date: Mon, 11 May 2020 21:53:50 +0200
Dylan Thurston <dpt <at> bostoncoop.net> writes:

> On Wed, May 06, 2020 at 07:51:41AM +0200, Arash Esbati wrote:
>> 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.
>
> Ah, thanks for the hint. And indeed googling it reveals an answer, as
> explained here:
> https://tex.stackexchange.com/questions/149626/tikz-library-calc-and-auctex-preview-in-emacs-fails

Thanks for the link.  I think we should add something to the manual of
preview.sty about the problem and the solution.  WDYT, would it make
sense?

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#41089; Package auctex. (Mon, 11 May 2020 21:23:02 GMT) Full text and rfc822 format available.

Message #23 received at 41089 <at> debbugs.gnu.org (full text, mbox):

From: Dylan Thurston <dpt <at> bostoncoop.net>
To: Arash Esbati <arash <at> gnu.org>
Cc: 41089 <at> debbugs.gnu.org
Subject: Re: bug#41089: 11.91; preview-latex gets confused by tikz calc syntax
Date: Mon, 11 May 2020 17:22:40 -0400
On Mon, May 11, 2020 at 09:53:50PM +0200, Arash Esbati wrote:
> Dylan Thurston <dpt <at> bostoncoop.net> writes:
> 
> > On Wed, May 06, 2020 at 07:51:41AM +0200, Arash Esbati wrote:
> >> 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.
> >
> > Ah, thanks for the hint. And indeed googling it reveals an answer, as
> > explained here:
> > https://tex.stackexchange.com/questions/149626/tikz-library-calc-and-auctex-preview-in-emacs-fails
> 
> Thanks for the link.  I think we should add something to the manual of
> preview.sty about the problem and the solution.  WDYT, would it make
> sense?

That would be great! If you wanted to get really fancy, you could even
do it automatically, if given some appropriate option when the
environment is loaded. (Or maybe even always? Does it make sense to
reset the meaning of '$' in other circumstances?)

--Dylan





Information forwarded to bug-auctex <at> gnu.org:
bug#41089; Package auctex. (Fri, 08 Mar 2024 09:43:02 GMT) Full text and rfc822 format available.

Message #26 received at 41089 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Dylan Thurston <dpt <at> bostoncoop.net>
Cc: 41089 <at> debbugs.gnu.org
Subject: Re: bug#41089: 11.91; preview-latex gets confused by tikz calc syntax
Date: Fri, 08 Mar 2024 10:41:20 +0100
Dylan Thurston <dpt <at> bostoncoop.net> writes:

> On Mon, May 11, 2020 at 09:53:50PM +0200, Arash Esbati wrote:
>> 
>> Thanks for the link.  I think we should add something to the manual of
>> preview.sty about the problem and the solution.  WDYT, would it make
>> sense?
>
> That would be great!

I finally managed to add an entry to preview-faq.texi (commit
ff03bccb38).

--8<---------------cut here---------------start------------->8---
diff --git a/doc/preview-faq.texi b/doc/preview-faq.texi
index 95d70f05..38044af6 100644
--- a/doc/preview-faq.texi
+++ b/doc/preview-faq.texi
@@ -78,8 +78,8 @@ Emacs.
 It is known to work under the X Window System for Linux and for several
 flavors of Unix: we have reports for HP and Solaris.

-There are several development versions of Emacs around for native MacOS
-Carbon, and @previewlatex{} is working with them, too.
+There are several versions of Emacs around for macOS, and @previewlatex{}
+is working with them, too.

 With Windows, both native Emacs and Cygwin Emacs should work.  However, it
 is known that @url{https://miktex.org/,MiK <at> TeX{}} sometimes doesn't work
@@ -210,6 +210,35 @@ facilities of @file{preview.sty} to tell it how to resolve this, whether
 you want no previews, previews of whole slides or previews of inner
 material.

+@subsection Does @previewlatex{} work with the TikZ package?
+
+@previewlatex{} doesn't have support for the @code{tikzpicture}
+environment built-in.  It can be included manually by adding the lines:
+@example
+\usepackage[displaymath,sections,graphics,floats,textmath]@{preview@}
+\PreviewEnvironment[@{[]@}]@{tikzpicture@}
+@end example
+
+@noindent
+to the document preamble.
+
+Things get more complicated when the code inside the @code{tikzpicture}
+environment contains @code{$ $} for inserting inline math and
+@previewlatex{} is instructed to insert previews for it into the buffer.
+In this case, you can disable previews for inline math by changing the
+lines above to:
+@example
+\usepackage[displaymath,sections,graphics,floats
+  % textmath   %% Don't preview inline math
+]@{preview@}
+\PreviewEnvironment[@{[]@}]@{tikzpicture@}
+@end example
+
+Another solution is to source out the TikZ pictures into an external file
+which uses the @code{standalone} class, process them and insert them back
+into the main file as figures with the @code{\includegraphics} macro.  In
+this case, previewing of inline math will work as usual.
+
 @node Troubleshooting, Other formats, Customization, Frequently Asked Questions
 @section Troubleshooting
--8<---------------cut here---------------end--------------->8---

> If you wanted to get really fancy, you could even do it automatically,
> if given some appropriate option when the environment is loaded. (Or
> maybe even always? Does it make sense to reset the meaning of '$' in
> other circumstances?)

I refrained from doing something like that since I can't tell about
possible side effects.

I'm therefore closing this report.

Best, Arash




bug closed, send any further explanations to 41089 <at> debbugs.gnu.org and Dylan Thurston <dpt <at> bostoncoop.net> Request was from Arash Esbati <arash <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 08 Mar 2024 09:44:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 05 Apr 2024 11:24:35 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 36 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.