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
\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:
\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:
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
Unexpected results may occur from adding the ending vertical line(s).
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.