# TikZ and AUCTeX: Different results

Consider the following MWE:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[thick,fill=yellow!50] (0,0) circle (3);
\draw[thick,fill=orange!50] (0,0) circle (2.4);
\foreach \letter [count=\i] in {A,...,Z} {
\draw[very thin] (0,0) -- ({90-\i*360/26}:3);
\path (0,0) --node[pos=.9,sloped,allow upside down,rotate=-90] {\letter} ({360/52+90-\i*360/26}:3);
}
\foreach \letter [count=\i] in {G,H,...,Z,A,B,...,F} {
\path (0,0) --node[pos=.7,sloped,allow upside down,rotate=-90] {\small\letter} ({360/52+90-\i*360/26}:3);
}
\end{tikzpicture}

\end{document}


It draws a disk for the Caesar cipher. When run through pdflatex the result is correct. However, when I use the preview function in Emacs and AUCTeX, I get this:

I am using AUCTeX 12.2.0. Compilation runs through with only one error message:

./region.tex:11: 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

However, I do not think that this is linked to my problem in any way, because the problem persists even if I work around the error by setting \catcode\$=3. • Stupid question for a long time user, but: How can I escape a single backtick inside code... ? Mar 27 '20 at 10:53 • For the backticks, see How do I mark inline code? (in short: ab\c results in abc). Mar 27 '20 at 11:16 • @frougon Thanks. I tried that, it didn't work. However, your link shows two solutions. I used double backticks. Mar 27 '20 at 12:13 • It worked in my comment, but I believe the rules in comments are different from those in questions & answers, so this could explain what you experienced. Mar 27 '20 at 12:31 ## 1 Answer The compilation error is expected since the preview package redefines $. From the manual:

textmath will make all text math subject to previews. Since math mode is used thoroughly inside of LaTX even for other purposes, this works by redefining $$, $$ and $ and the math environment (apparently some people use that). Only occurrences of these text math delimiters in later loaded packages and in the main document will thus be affected. But that is not the source of your problem. It seems that your issue is coming from the unhappy interaction of the current Ghostscript versions and preview. Please tweak the variable preview-pdf-color-adjust-method to the symbol compatible or nil and try it again. It looks like this for me (with rungs from TeXlive '19 which runs Ghostscript 9.50): This is the corresponding LaTeX code: \documentclass{article} \usepackage{tikz} \usepackage[displaymath,floats,graphics,footnotes, % textmath %% Don't touch$ %%
]{preview}
\PreviewEnvironment{tikzpicture}

\begin{document}

\begin{tikzpicture}
\draw[thick,fill=yellow!50] (0,0) circle (3);
\draw[thick,fill=orange!50] (0,0) circle (2.4);
\foreach \letter [count=\i] in {A,...,Z} {
\draw[very thin] (0,0) -- ({90-\i*360/26}:3);
\path (0,0) --node[pos=.9,sloped,allow upside down,rotate=-90]
{\letter} ({360/52+90-\i*360/26}:3);
}
\foreach \letter [count=\i] in {G,H,...,Z,A,B,...,F} {
\path (0,0) --node[pos=.7,sloped,allow upside down,rotate=-90]
{\small\letter} ({360/52+90-\i*360/26}:3);
}
\end{tikzpicture}

\begin{verbatim}

Note the black blob around M-N. So I think the story will go on.
• You are amazing! Thank you very much. I would never have thought that this option could be the source of the problem, causing just those two letters to disappear. Furthermore, my system say gs --version` is 9.50. Mar 30 '20 at 20:23