# Symbol for skeptical consequence that matches the turnstile package

This might be seen as a follow up to Symbol for skeptical consequence. From it I got answers so that I could write that B is a skeptical consequence of A such as

which Peter Grill's code produces. Now say that I use the turnstile package to typeset turnstiles which symbolizes logical consequence, that I prefer the turnstiles of the turnstile package to \vdash and \vDash, and that I in the same text want to speak both of logical and skeptical consequence. Then I face two problems:

1. The turnstiles of the turnstiles package don't match any of the symbols for skeptical consequence in the answers of Symbol for skeptical consequence because the turnstiles of the turnstile package are larger.

2. The turnstiles of the turnstile package is superior in how symbols are placed below the turnstile.

This can be illustrated by the following which symbolizes that B is a skeptical consequence of A in language L and that B is a logical consequence of A in language L:

What I would like is, ideally, an extension of the turnstile package to handle skeptical consequence so that I could produce turnstiles with a wavy horizontal that matches the (normal) turnstiles, both in terms of appearance and ability to have correctly placed symbols below and above, of the turnstile package. Also, in contrast to what the images shows, I'd like the wavy line to be such that it has the same thickness and edges as the vertical line.

-

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.

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

\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}
\rule[-\lengthvar]{#3}{#2}
\hspace{-#3}
\rule[0.5#4]{#3}{#2}}{}
\ifthenelse{\equal{#1}{t}}{\setlength{\lengthvar}{1.5#2}
\rule[-\lengthvar]{#3}{#2}
\hspace{-#3}
\rule[-0.5#2]{#3}{#2}
\hspace{-#3}
\setlength{\lengthvar}{0.5#2}
\rule[\lengthvar]{#3}{#2}}{}
\ifthenelse{\equal{#1}{w}}{% New wavy $\sim$ definition
\setbox0=\hbox{$\sim$}%
}

\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:

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

\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}
\rule[-\lengthvar]{#3}{#2}
\hspace{-#3}
\rule[0.5#4]{#3}{#2}}{}
\ifthenelse{\equal{#1}{t}}{\setlength{\lengthvar}{1.5#2}
\rule[-\lengthvar]{#3}{#2}
\hspace{-#3}
\rule[-0.5#2]{#3}{#2}
\hspace{-#3}
\setlength{\lengthvar}{0.5#2}
\rule[\lengthvar]{#3}{#2}}{}
\ifthenelse{\equal{#1}{w}}{% New wavy $\sim$ definition
\setbox0=\hbox{$\sim$}%
\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

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.

-
Wow! Nice answer! Would it be possible to make the wavy line such that it has the same thickness and edges as the vertical line? –  N.N. Oct 21 '11 at 16:18
Thanks for you improvement. I'll award you the bounty for the effort. I agree that the TikZ variant needs improvements, especially the horizontal spacing for the right operand and the vertical spacing for the lower subscript needs to be fixed (the symbols end up too close to the wavy line). What would the best way to get some TikZ wizard attention to it? Maybe to start a new question and ask for improvements to your TikZ solution? –  N.N. Nov 2 '11 at 9:16
@N.N.: I agree that a new question would probably do it justice and it should additionally be labelled as tikz-specific. Perhaps a question with general intent, like "How to make a math symbol using tikz?" but with specific application to "sceptical consequence". Or you could also just make up some symbols to draw some attention as to what you exactly want, being specific about possible additions - like in this question, turnstile allows for adding lines via different commands. That's perhaps a bit too much, I know. –  Werner Nov 2 '11 at 14:29

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:

\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}

-
Can this solution be adapted to also draw normal turnstiles so that there's a matching pair (straight and wavy horizontal line)? –  N.N. Oct 21 '11 at 21:30
Have updated solution to accept an optional first parameter so you can also have a horizontal line. –  Peter Grill Oct 21 '11 at 22:09