我需要画一个箭头,但头部不同。头部应该看起来像$\dashv$
。我确实需要改变线条。我试过$--\dashv$
,但效果不好。有什么想法吗?
它看起来应该像一个水平的 T。
答案1
你想要这样的东西吗?
\documentclass{article}
\usepackage{turnstile}
\begin{document}
% \setlength{\leasturnstilewidth}{15em}% this should work if I've understood the documentation correctly, but seems to have no effect
$\nsststile{\hspace*{15em}}{}$
\end{document}
只是改变15em
为您需要的尺寸即可。
更改垂直规则的高度
事实证明,改变旋转闸门的高度绝非易事。尽管文档表明最终用户可以操纵各种长度,但事实并非如此。查看后发现,问题出在turnstile.sty
这里:
\newcommand{\turnstile}[6][s]
{\ifthenelse{\equal{#1}{d}}
{\sbox{\first}{$\displaystyle{#4}$}
\sbox{\second}{$\displaystyle{#5}$}}{}
\ifthenelse{\equal{#1}{t}}
{\sbox{\first}{$\textstyle{#4}$}
\sbox{\second}{$\textstyle{#5}$}}{}
\ifthenelse{\equal{#1}{s}}
{\sbox{\first}{$\scriptstyle{#4}$}
\sbox{\second}{$\scriptstyle{#5}$}}{}
\ifthenelse{\equal{#1}{ss}}
{\sbox{\first}{$\scriptscriptstyle{#4}$}
\sbox{\second}{$\scriptscriptstyle{#5}$}}{}
\setlength{\dashthickness}{0.111ex}
\setlength{\ddashthickness}{0.35ex}
\setlength{\leasturnstilewidth}{0.8em}
\setlength{\extrawidth}{0.2em}
\ifthenelse{%
\equal{#3}{n}}{\setlength{\tinyverdistance}{0ex}}{}
\ifthenelse{%
\equal{#3}{s}}{\setlength{\tinyverdistance}{0.5\dashthickness}}{}
\ifthenelse{%
\equal{#3}{d}}{\setlength{\tinyverdistance}{0.5\ddashthickness}
\addtolength{\tinyverdistance}{\dashthickness}}{}
\ifthenelse{%
\equal{#3}{t}}{\setlength{\tinyverdistance}{1.5\dashthickness}
\addtolength{\tinyverdistance}{\ddashthickness}}{}
\setlength{\verdistance}{0.4ex}
\settoheight{\lengthvar}{\usebox{\first}}
\setlength{\raisedown}{-\lengthvar}
\addtolength{\raisedown}{-\tinyverdistance}
\addtolength{\raisedown}{-\verdistance}
\settodepth{\raiseup}{\usebox{\second}}
\addtolength{\raiseup}{\tinyverdistance}
\addtolength{\raiseup}{\verdistance}
\setlength{\lift}{0.8ex}
\settowidth{\firstwidth}{\usebox{\first}}
\settowidth{\secondwidth}{\usebox{\second}}
\ifthenelse{\lengthtest{\firstwidth = 0ex}
\and
\lengthtest{\secondwidth = 0ex}}
{\setlength{\turnstilewidth}{\leasturnstilewidth}}
{\setlength{\turnstilewidth}{2\extrawidth}
\ifthenelse{\lengthtest{\firstwidth < \secondwidth}}
{\addtolength{\turnstilewidth}{\secondwidth}}
{\addtolength{\turnstilewidth}{\firstwidth}}}
\setlength{\turnstileheight}{3ex}
\sbox{\turnstilebox}
{\raisebox{\lift}{\ensuremath{
\makever{#2}{\dashthickness}{\turnstileheight}{\ddashthickness}
\makehor{#3}{\dashthickness}{\turnstilewidth}{\ddashthickness}
\hspace{-\turnstilewidth}
\raisebox{\raisedown}
{\makebox[\turnstilewidth]{\usebox{\first}}}
\hspace{-\turnstilewidth}
\raisebox{\raiseup}
{\makebox[\turnstilewidth]{\usebox{\second}}}
\makever{#6}{\dashthickness}{\turnstileheight}{\ddashthickness}}}}
\mathrel{\usebox{\turnstilebox}}}
基本上,这会对此处定义的各种长度进行硬编码。您可以随意重新定义它们,但只要您使用\turnstile
(或例如,\nsststile
根据以下定义)\turnstile
),长度就会重置为其默认值。
我尝试的第一件事是使用 的功能etoolbox
来修补\turnstile
。然而,尽管etoolbox
报告命令可修补,但我的尝试失败了。
最后,绝望的办法:
\documentclass{article}
\usepackage{turnstile}
\newlength{\myturnstileheight}
\setlength{\myturnstileheight}{1ex}
\newcommand*\myarrow[2][\myturnstileheight]
{\setlength{\dashthickness}{0.111ex}
\setlength{\ddashthickness}{0.35ex}
\setlength{\tinyverdistance}{0ex}
\setlength{\verdistance}{0.4ex}
\settoheight{\lengthvar}{}
\setlength{\raisedown}{-\lengthvar}
\addtolength{\raisedown}{-\tinyverdistance}
\addtolength{\raisedown}{-\verdistance}
\settodepth{\raiseup}{}
\addtolength{\raiseup}{\tinyverdistance}
\addtolength{\raiseup}{\verdistance}
\setlength{\lift}{0.8ex}
\setlength{\turnstilewidth}{#2}
\setlength{\turnstileheight}{#1}
\sbox{\turnstilebox}
{\raisebox{\lift}{\ensuremath{
\makever{n}{\dashthickness}{\turnstileheight}{\ddashthickness}
\makehor{s}{\dashthickness}{\turnstilewidth}{\ddashthickness}
\hspace{-\turnstilewidth}
\raisebox{\raisedown}
{\makebox[\turnstilewidth]{}}
\hspace{-\turnstilewidth}
\raisebox{\raiseup}
{\makebox[\turnstilewidth]{}}
\makever{s}{\dashthickness}{\turnstileheight}{\ddashthickness}}}}
\mathrel{\usebox{\turnstilebox}}}
\begin{document}
$\myarrow{3em}$
$\myarrow[2ex]{1em}$
$\myarrow[10ex]{10em}$
\end{document}
这定义了一个新命令,\myarrow
它基于 的定义,\turnstile
但经过简化和调整,使高度可调。它还定义了一个新的长度\myturnstileheight
,您可以将其设置为合适的默认值。在这里,它被设置为1ex
。 的语法\myarrow
被大大简化,以使其更方便您的使用:
\myarrow[<height>]{<width>}
最后输出:
答案2
和tikz
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\newcommand\myarrow[1][3em]{%
\tikz\draw[thick,-Bar] (0,0) -- (#1,0);
}
\begin{document}
$\myarrow[15em]$ $\myarrow[2em]$
\end{document}
答案3
也许,如果我理解得好的话,你想要的东西存在于mdsymbol
字体中:
看这个线了解如何在不使用 mdsymbol 字体排版所有数学符号的情况下使其可用。