[Tex/LaTex] Symbol for skeptical consequence that matches the turnstile package

math-operatorsrelation-symbolssymbolsturnstile

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

B is a skeptical consequence of A

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:

B is a logical and skeptical consequence of A

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.

Best Answer

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.