Symbol for skeptical consequence that matches the turnstile package

The turnstile package provides

\turnstile[<size>]{<lvert>}{<horz>}{<below>}{<above>}{<rvert>}

where <horz> calls the macro

\makehor{<line type>}{<thickness>}{<length>}{<sep>}

to draw the horizontal line(s) of the turnstile. In the following code, I've redefined \makehor (and consequently also \turnstile) to take a first argument w (for wavy) which typesets the symbol $\sim$ as the "horizontal line". The adjustbox package provides some clipping and resizing.

enter image description here

\documentclass{article}
\usepackage{turnstile}% http://ctan.org/pkg/turnstile
\usepackage{adjustbox}% http://ctan.org/pkg/adjustbox

\renewcommand{\makehor}[4]
  {\ifthenelse{\equal{#1}{n}}{\hspace{#3}}{}
   \ifthenelse{\equal{#1}{s}}{\rule[-0.5#2]{#3}{#2}}{}
   \ifthenelse{\equal{#1}{d}}{\setlength{\lengthvar}{#2}
     \addtolength{\lengthvar}{0.5#4}
     \rule[-\lengthvar]{#3}{#2}
     \hspace{-#3}
     \rule[0.5#4]{#3}{#2}}{}
   \ifthenelse{\equal{#1}{t}}{\setlength{\lengthvar}{1.5#2}
     \addtolength{\lengthvar}{#4}
     \rule[-\lengthvar]{#3}{#2}
     \hspace{-#3}
     \rule[-0.5#2]{#3}{#2}
     \hspace{-#3}
     \setlength{\lengthvar}{0.5#2}
     \addtolength{\lengthvar}{#4}
     \rule[\lengthvar]{#3}{#2}}{}
   \ifthenelse{\equal{#1}{w}}{% New wavy $\sim$ definition
     \setbox0=\hbox{$\sim$}%
     \raisebox{-.6ex}{\hspace*{-.05ex}\adjustbox{width=#3,height=\height}{\clipbox{0.75 0 0 0}{\usebox0}}}}{}
  }

\begin{document}

\[
  \renewcommand{\arraystretch}{2}%
  \begin{array}{ll}
    \textrm{Regular}\ \verb!s! & \textrm{Wavy}\ \verb!w! \\ \hline
    A\turnstile{s}{s}{}{}{n}B & A\turnstile{s}{w}{}{}{n}B \\
    A\turnstile{s}{s}{L}{}{n}B & A\turnstile{s}{w}{L}{}{n}B \\
    A\turnstile{s}{s}{}{D}{n}B & A\turnstile{s}{w}{}{D}{n}B \\
    A\turnstile{s}{s}{L}{D}{n}B & A\turnstile{s}{w}{L}{D}{n}B
  \end{array}
\]
\end{document}

The main advantage of tapping into the existing command (or extending it) rather than writing one's own is that it is easier to use. Additionally, since \turnstile takes the upper/lower letters as arguments, it's easier to grab hold of them than (say) defining a new command that requires some interpretation of limit use, like \wavyturn_{L}^{D} (say). As such, the other features of \turnstile is adopted (like the \rule for the vertical line and the other spacing.

The above code currently only works for a single wavy line. However, if needed, it could be extended to work for more than one (like the original \turnstile..{d}... and \turnstile..{t}.. commands). For now, it works based on the MWE, but not work as expected with other variations (longer phrases and/or right vertical line). That may require more work, since I haven't tested it.


Edit: Admittedly my tikz-prowess requires a heavy boost of steroids. The following addition to the turnstile horizontal rule is provided by the symbol z. It draws a thin wavy line using a sine curve. I'm pretty sure the horizontal (\hspace) and vertical (\raisebox) adjustments can be done inside \tikz, so suggestions are welcome and encouraged. The same goes for the adjustbox modifications, and whether that can be incorporated in \tikz as well:

enter image description here

\documentclass{article}
\usepackage{turnstile}% http://ctan.org/pkg/turnstile
\usepackage{tikz}% http://ctan.org/pkg/pgf
\usepackage{adjustbox}% http://ctan.org/pkg/adjustbox

\renewcommand{\makehor}[4]
  {\ifthenelse{\equal{#1}{n}}{\hspace{#3}}{}
   \ifthenelse{\equal{#1}{s}}{\rule[-0.5#2]{#3}{#2}}{}
   \ifthenelse{\equal{#1}{d}}{\setlength{\lengthvar}{#2}
     \addtolength{\lengthvar}{0.5#4}
     \rule[-\lengthvar]{#3}{#2}
     \hspace{-#3}
     \rule[0.5#4]{#3}{#2}}{}
   \ifthenelse{\equal{#1}{t}}{\setlength{\lengthvar}{1.5#2}
     \addtolength{\lengthvar}{#4}
     \rule[-\lengthvar]{#3}{#2}
     \hspace{-#3}
     \rule[-0.5#2]{#3}{#2}
     \hspace{-#3}
     \setlength{\lengthvar}{0.5#2}
     \addtolength{\lengthvar}{#4}
     \rule[\lengthvar]{#3}{#2}}{}
   \ifthenelse{\equal{#1}{w}}{% New wavy $\sim$ definition
     \setbox0=\hbox{$\sim$}%
     \raisebox{-.6ex}{\hspace*{-.05ex}\adjustbox{width=#3,height=\height}{\clipbox{0.75 0 0 0}{\usebox0}}}}{}
   \ifthenelse{\equal{#1}{z}}{% New tikz wavy definition
     \raisebox{-.4ex}{\hspace*{-.08ex}\tikz \draw [thin,x=0.5ex,y=.25ex] (0,0) sin (1,1) cos (2,0) sin (3,-1) cos (4,0);\hspace*{.2ex}}}{}   
  }

\begin{document}

\[
  \renewcommand{\arraystretch}{2}%
  \begin{array}{lll}
    \textrm{Regular}\ \verb!s! & \textrm{Wavy}\ \verb!w! & \textrm{TikZ}\ \verb!z! \\ \hline
    A\turnstile{s}{s}{}{}{n}B & A\turnstile{s}{w}{}{}{n}B & A\turnstile{s}{z}{}{}{n}B \\
    A\turnstile{s}{s}{L}{}{n}B & A\turnstile{s}{w}{L}{}{n}B & A\turnstile{s}{z}{L}{}{n}B \\
    A\turnstile{s}{s}{}{D}{n}B & A\turnstile{s}{w}{}{D}{n}B & A\turnstile{s}{z}{}{D}{n}B \\
    A\turnstile{s}{s}{L}{D}{n}B & A\turnstile{s}{w}{L}{D}{n}B & A\turnstile{s}{z}{L}{D}{n}B
  \end{array}
\]
\end{document}

It needs improvement for a number of reasons:

  1. There is a very minute difference in the typesetting of a "denominator-only" and "numerator+denominator" \turnstile. For example, look at the close-up between

    enter image description here

  2. Unexpected results may occur from adding the ending vertical line(s).

  3. The spacing of the right operand (B in this case) is too far off. This can be accommodated by means of an intermediate macro, but it is best suited inside the \turnstile macro.

I think all of the above items would be addressed by someone with a better handle on tikz-related commands. But then again, perhaps this is not a problem.


If you desire to have a symbol adjust based on the size of the surrounding text, the solution from Symbol for skeptical consequence can be enhanced to accept two additional parameters for the upper and lower characters.

Update: As requested in the comments, I also added an optional first parameter (defaults \sim) which defines the horizontal character to be used. Here is the output with three different horizontal symbols:

enter image description here

\documentclass[border=2pt]{standalone}
\usepackage{amsmath}%  only needed for \dfrac
\usepackage{graphicx}% needed for \scalebox
\usepackage{pgf}%      needed for the math calculations

% http://math.arizona.edu/~aprl/publications/mathclap/
\def\mathrlap{\mathpalette\mathrlapinternal}%
\def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}}%

\makeatletter
\newdimen\@mydimen%
\newdimen\@myHeightOfBar%
\settoheight{\@myHeightOfBar}{$|$}%
\newcommand{\SetScaleFactor}[1]{%
    \settoheight{\@mydimen}{#1}%
    \pgfmathsetmacro{\scaleFactor}{\@mydimen/\@myHeightOfBar}%
}%

\newcommand*{\Scale}[2][3]{\scalebox{#1}{\ensuremath{#2}}}%

\newcommand*{\nct}[5][\sim]{%
    \SetScaleFactor{\vphantom{\ensuremath{#2#3}}}% Compute scale to be applied
    #2%
\mathrel{\Scale[\scaleFactor]{|\mathrlap{\kern-0.48ex{\substack{{\scriptscriptstyle #5}\\[-0.5ex]#1\\[-0.6ex]{\scriptscriptstyle #4}}}}\hphantom{\kern-0.90ex\sim}}}%
    #3%
}%

\begin{document}
$\nct{a}{b}{l}{u}     \qquad \nct{\frac{A}{C}}{B}{l}{u}    \qquad \nct{\dfrac{A}{C}}{B}{l}{u}$\par
$\nct[-]{a}{b}{l}{u}  \qquad \nct[-]{\frac{A}{C}}{B}{l}{u} \qquad \nct[-]{\dfrac{A}{C}}{B}{l}{u}$\par
$\nct[=]{a}{b}{l}{u}  \qquad \nct[=]{\frac{A}{C}}{B}{l}{u} \qquad \nct[=]{\dfrac{A}{C}}{B}{l}{u}$
\end{document}