# Turnstile package

I am fairly new to TeX, so I may be missing something simple, but I can't seem to adjust the height of the turnstile objects produced by the turnstile package. In particular, if the symbol appears as a subscript it does not adjust to match the surrounding text. Does anyone know of a solution?

-
Please add to your question a minimal working example illustrating your problem. –  Gonzalo Medina May 24 '11 at 1:06

The problem with the vertical scaling is documented in the Conclusions section of the file turnstile_article.pdf:

For a future version of this package, we want to look at changing the height of the turnstile sign. This will take into account the heights of the expressions above and below, similar to the way we currently allow for the widths of the expressions.

In particular, since no provision is made for vertical scaling, the symbol will not scale appropriately when used in a subscripted expression (See first part of the example below).

The first idea that comes to my mind is to use \scalebox (from the graphicx) package to scale the turnstile symbol. The following example shows both the actual behaviour with no vertical scaling, and the definition and use of a new command attempting to alleviate this problem; of course, feel free to make the modifications that best suit your needs:

\documentclass{article}
\usepackage{amsmath}
\usepackage{turnstile}
\usepackage{graphicx}

\newcommand*\Subsststile[2]{%
\,\scalebox{0.8}[0.5]{$\sststile[ss]{\textstyle#1}{\textstyle#2}$}\,
}

\begin{document}

The standard command with no vertical scaling:
$A_{\Gamma\sststile[ss]{}{}P} \qquad A_{\Gamma\sststile[ss]{aaaa}{b}P}$

The newly defined command, with vertical scaling:
$A_{\Gamma\Subsststile{}{}P} \qquad A_{\Gamma\Subsststile{aaaa}{b}P}$

\end{document}


-

Here's a different version that scales (but via an optional argument):

\documentclass[a4paper]{article}

\newcommand\turnstile[3][2]{
\mathrel{\calcturnstile{#1}
\setbox0=\hbox{$\tsvstyle\vdash$}
\setbox2=\hbox{$\vcenter{\copy0}$}
\hbox{\vrule\vphantom{$\tsvstyle\vdash$}}
\raise\dimexpr\ht0-\ht2\relax\hbox{\vcenter{\offinterlineskip \ialign{\hfil\kern1pt\tsstyle##\vphantom{by}\kern1pt\hfil\cr \relax\if\relax\detokenize{#2}\relax\hphantom{\vdash}\kern-2pt\else#2\fi\cr \noalign{\kern0.4pt\hrule\kern0.4pt} \relax\if\relax\detokenize{#2}\relax\hphantom{\vdash}\kern-2pt\else#3\fi\cr}}}
}}
\newcommand\Turnstile[3][2]{
\mathrel{\calcturnstile{#1}
\vcenter{\hbox{\vrule\vphantom{$\tsvstyle\models$}}}
\vcenter{\offinterlineskip
\ialign{\hfil\kern1pt$\tsstyle##\vphantom{by}$\hfil\cr
\relax\if\relax\detokenize{#2}\relax\hphantom{=}\kern-2pt\else#2\fi\cr
\noalign{\kern0.4pt\hrule\kern\fontdimen22\tsfont2\hrule\kern0.4pt}
\relax\if\relax\detokenize{#2}\relax\hphantom{-}\kern-2pt\else#3\fi\cr}}
}}
\def\calcturnstile#1{
\ifcase#1\let\tsstyle\textstyle\let\tsvstyle\textstyle\let\tsfont\textfont\or
\let\tsstyle\textstyle\let\tsvstyle\textstyle\let\tsfont\textfont\or
\let\tsstyle\scriptstyle\let\tsvstyle\textstyle\let\tsfont\scriptfont\or
\let\tsstyle\scriptscriptstyle\let\tsvstyle\scriptstyle\let\tsfont\scriptscriptfont\fi}

\begin{document}
\noindent$\vdash$\\
$\turnstile{}{}$
$X\turnstile{}{}\Gamma\turnstile{a}{bbbb}P\Turnstile{a}{bbbb}\models Q$
$A_{\Gamma\vdash\turnstile[3]{x,y}{L}P}$
$A\turnstile[0]{x,y}{L}B$
\end{document}


The optional argument chooses the style for the objects: 0 is for display, 1 for text, 2 for script and 3 for scriptscript. The default is 2. An empty pair of arguments builds symbols very akin to \vdash and \models respectively.

-