# Tikz: the use of \tilde is not working in the tikz environment

From my post on placing a node at the intersection of two circles, I came across a problem.

When I compile the document, \tilde F renders ~F and not a tilde over the F. I can't duplicate this issue on a smaller scale though.

Here is my preamble:

\documentclass[11pt, dvipsnames]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{eucal}
\usepackage{pxfonts}
\usepackage{setspace}
\usepackage{enumerate}
\usepackage{amscd}
\usepackage{dsfont}
\usepackage{wasysym}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{mathtools}
\usepackage{kurier}
\usepackage{pgfplots}
\usepackage{listings}
\usepackage{etoolbox}
\usepackage{tikz-3dplot}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage{array}
\usepackage{tkz-fct}
\usepackage{graphicx}
\usepackage{datetime}
\usepackage{fancyhdr}
\usepackage{xcolor}
\usepackage[protrusion = true, expansion]{microtype}
\usepackage{marvosym}
\usepackage{starfont}
\usepackage{fixltx2e}
\usepackage{hyperref}
\usepackage[margin = 0.75in]{geometry}
\usepackage[caption = false]{subfig}
\usepackage[all]{hypcap}

%  arctanh
\DeclareMathOperator\arctanh{arctanh}

%  phantom sections for itemize linking use hyperref and name
\AtBeginEnvironment{itemize}{\apptocmd{\item}{\phantomsection}{}{
\errmessage{couldn't patch item}}}

%\listfiles

\hypersetup{
citecolor = Violet,
urlcolor = Blue
}

\hypersetup{
citebordercolor = Violet,
filebordercolor = Red,
}

\lstset
{
breaklines = true,
tabsize = 3,
showstringspaces = false
}

\lstdefinestyle{Common}
{
extendedchars = \true,
language = {Python},
frame = single,
% ===========================================================
framesep = 3pt,%expand outward.
framerule = 0.4pt,%expand outward.
xleftmargin = 3.7pt,%make the frame fits in the text area.
xrightmargin = 3.5pt,%make the frame fits in the text area.
% ===========================================================
rulecolor = \color{Red}
}

\lstdefinestyle{A}
{
style = Common,
backgroundcolor = \color{Yellow!10},
basicstyle = \scriptsize\color{Black}\ttfamily,
keywordstyle = \color{Orange},
identifierstyle = \color{Cyan},
stringstyle = \color{Red},
}

\lstdefinestyle{B}
{
style = Common,
backgroundcolor = \color{Black},
basicstyle = \scriptsize\color{White}\ttfamily,
keywordstyle = \color{Orange},
identifierstyle = \color{Cyan},
stringstyle = \color{Red},
}

\usepackage{mdframed}

\pgfplotsset{compat = 1.8}

decorations.pathreplacing, patterns, decorations.pathmorphing, positioning,
through, intersections, backgrounds}

\makeatletter
\tikzset{circle through extra radius/.code = {
% unorthodox addon for the through library
% needs to be used after 'circle through'!
% this can be avoided by slightly changing the source
\pgfmathsetlengthmacro\pgf@tempa{
\pgfkeysvalueof{/pgf/minimum width} + 2 * (#1)}%
\pgfset{/pgf/minimum width/.expanded = \pgf@tempa}%
}%
}}
\tikzset{
special style/.code = {%
\if#1\tikz@nonactiveexlmark
\pgfkeysalso{@special style}%
\else
\pgfkeysalso{style/.expanded=#1}%
\fi
},
@special style/.style = {draw = none, fill = none}
}
\makeatother

% line numbering for tabbing
\newcommand{\tagthisaux}{%
\refstepcounter{equation}%
(\theequation)%
}
\newcommand{\tagthisline}{\\tagthisaux}
%

\newcommand\idea[1]{\begin{center}#1\end{center}}

%

\newenvironment{definition}[1][Definition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}


Here is the offending example but this example works fine for Qrrbrbilbel (maybe misspelled) and not me.

\begin{tikzpicture}[scale = .7,
every label/.append style = {font = \small},
dot/.style = {fill, outer sep = +0pt, inner sep = +0pt,
shape = circle, draw = none, label = {#1}},
dot/.default =,
small dot/.style = {minimum size = 2.5pt, dot = {#1}},
small dot/.default =,
big dot/.style = {minimum size = 5pt, dot = {#1}},
big dot/.default =
]
\begin{scope}[rotate around ={-23.9625:(.75, -1)}]
\begin{scope}
\clip(-1, -4) rectangle (.5, 4);
\draw [samples = 50, domain = -0.99:0.99, xshift = 1cm, red, thick]
plot ({0.8 * (-1 - (\x)^2) / (1 - (\x)^2)},
{1.83 * (-2) * (\x) / (1 - (\x)^2)});
\end{scope}
\node[scale = .75, small dot = {below: $$P_1$$}] (P1) at (3, 0) {};
\node[scale = .75, small dot = {above, left = 3.5pt: $$P_2$$}] (P2) at
(-1, 0) {};
\node[scale = .75, small dot = {below: $$F$$}] (F)
at (.75, -1) {};
\path[blue] (F) edge (P1) edge (P2) (P1) edge (P2);
\path ($(P1)!.7!(P2)$) coordinate (Fm) node[small dot =
{below = 10pt, right = 3pt: $$F_m^*$$}] {};
\foreach \cPoint in {1, 2}
{.0cm, .4cm, .8cm}
\node[draw, name path global/.expanded = \cPoint:\cRadius] at
(P\cPoint.center) (\cPoint:\cRadius) [circle through = (Fm),
\foreach \cRadius in {1, 2} {
\tikzset{name intersections = {of/.expanded = {1:\cRadius} and
\foreach \cSolution in {1, 2}
\node[black, scale = .5, big dot =
{right: $\ifnum\cSolution = 1\expandafter\tilde\fi F^*_\cRadius$}]
}
\end{scope}
\end{tikzpicture}

• If you do like this \ifnum\cSolution = 1\expandafter\tilde F^*_\cRadius\fi it works. – cacamailg Jun 12 '13 at 0:30
• @cacamailg yes but the bottom two intersection nodes disappear then. – dustin Jun 12 '13 at 0:32
• @dustin: Is that the minimal preamble required to reproduce the problem for you? If you remove any of the packages or any of the definitions, it starts working? – Jake Jun 12 '13 at 1:04
• @dustin Well, then do \ifnum\cSolution=1\tilde F\else F\fi^*_\cRadius, but still, it is weird that the “my” solution works for the default font settings but not for your document. The definition of \tilde in “my” solution is \mathaccent "707E\relax, your code gives \protect \mathaccentV {tilde}07E. – Qrrbrbirlbel Jun 12 '13 at 1:04
• @Qrrbrbirlbel that worked. Can you post it as a solution. – dustin Jun 12 '13 at 1:09

The amsmath package re-defines \tilde from

\tilde:
macro:->\mathaccent "707E\relax


to

\tilde:
macro:->\protect \mathaccentV {tilde}07E


The \mathaccentV macro expects a fifth argument, the F, which should be grabbed anyway (that’s the reason for \expandafter so to not use \fi as an argument), but something goes wrong.

As a work-around, use

$\ifnum\cSolution = 1\tilde F\else F\fi^*_\cRadius$

• It would be safer to use $\ifnum\cSolution = 1 \tilde F\else F\fi^*_\cRadius$ as otherwise \tilde`is expanded (while looking for the end of the number) whether the test is true or false. – David Carlisle Jun 12 '13 at 8:47