6

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?

8

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}

turnstile example

5

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

\documentclass[a4paper]{article}
\usepackage{amsmath}

\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{\kern1pt\hrule\kern1pt}%
           \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{\kern1pt\hrule\kern\fontdimen22\tsfont2\hrule\kern1pt}%
           \relax\if\relax\detokenize{#2}\relax\hphantom{-}\kern-2pt\else#3\fi\cr}}
}}
\newcommand\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}

\begin{gather*}
\textstyle \vdash \qquad \turnstile{}{}
\\
X\turnstile{}{}\Gamma\turnstile{a}{bbbb}P\Turnstile{a}{bbbb}Y\models Q
\\
A_{\Gamma\turnstile[3]{x,y}{L}P}
\\
A\turnstile[0]{x,y}{L}B
\end{gather*}
\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.

enter image description here

  • For me A \turnstile{}{L} B looks the same as A \vdash B. In other words, when the superscript argument is empty, the subscript doesn't get generated. You can fix it with A \turnstile{\quad}{L} B but that doesn't seem like it should be necessary. – Randy Randerson Jan 30 '18 at 5:18
  • @RandyRanderson The minimum width is set using \hphantom, you can modify that to suit your needs. – egreg Jan 30 '18 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.