答案1
你可以自己构建一些东西,例如:
\documentclass{memoir}
\usepackage{multicol,tikz,xcolor, amsmath}
\usetikzlibrary{calc}
\tikzset{stairwayStyleLineWidth/.style={line width=0.04em}}
\tikzset{stairwayStyleRound/.style={line join=round,line cap=round,stairwayStyleLineWidth}}
\tikzset{stairwayStyleSharp/.style={stairwayStyleLineWidth}}
\tikzset{stairwayStyle/.style={stairwayStyleRound}}
\newcommand{\stairwayup}{\mathbin{
\tikz[baseline=(stairwayanchor.base)]{
\node (stairwayanchor) {\quad};
\draw[stairwayStyle]
($(stairwayanchor.south west) + (0.0em,0.4em)$)
-- ++(0.20em,0) -- ++(0,0.20em)
-- ++(0.20em,0) -- ++(0,0.20em)
-- ++(0.20em,0) -- ++(0,0.20em)
-- ++(0.20em,0) %-- ++(0,0.25em)
;
}}
}
\newcommand{\stairwaydown}{\mathbin{
\tikz[baseline=(stairwayanchor.base)]{
\node (stairwayanchor) {\quad};
\draw[stairwayStyle]
($(stairwayanchor.south east) + (0.0em,0.4em)$)
-- ++(-0.20em,0) -- ++(0,0.20em)
-- ++(-0.20em,0) -- ++(0,0.20em)
-- ++(-0.20em,0) -- ++(0,0.20em)
-- ++(-0.20em,0) %-- ++(0,-0.25em)
;
}}
}
\newcommand{\stairwayupfilled}{\mathbin{
\tikz[baseline=(stairwayanchor.base)]{
\node (stairwayanchor) {\quad};
\draw[stairwayStyle,fill=.]
($(stairwayanchor.south west) + (0.0em,0.4em)$)
-- ++(0,0.20em)
-- ++(0.20em,0) -- ++(0,0.20em)
-- ++(0.20em,0) -- ++(0,0.20em)
-- ++(0.20em,0) %-- ++(0,0.25em)
-- ++(0,-0.60em)
-- cycle
;
}}
}
\newcommand{\stairwayuphollow}{\mathbin{
\tikz[baseline=(stairwayanchor.base)]{
\node (stairwayanchor) {\quad};
\draw[stairwayStyle]
($(stairwayanchor.south west) + (0.0em,0.4em)$)
-- ++(0,0.20em)
-- ++(0.20em,0) -- ++(0,0.20em)
-- ++(0.20em,0) -- ++(0,0.20em)
-- ++(0.20em,0) %-- ++(0,0.25em)
-- ++(0,-0.60em)
-- cycle
;
}}
}
\newcommand{\stairwaydownfilled}{\mathbin{
\tikz[baseline=(stairwayanchor.base)]{
\node (stairwayanchor) {\quad};
\draw[stairwayStyle,fill=.]
($(stairwayanchor.south east) + (0.0em,0.4em)$)
-- ++(0,0.20em)
-- ++(-0.20em,0) -- ++(0,0.20em)
-- ++(-0.20em,0) -- ++(0,0.20em)
-- ++(-0.20em,0) %-- ++(0,-0.25em)
-- ++(0,-0.60em)
-- cycle
;
}}
}
\newcommand{\stairwaydownhollow}{\mathbin{
\tikz[baseline=(stairwayanchor.base)]{
\node (stairwayanchor) {\quad};
\draw[stairwayStyle]
($(stairwayanchor.south east) + (-0.0em,0.4em)$)
-- ++(0,0.20em)
-- ++(-0.20em,0) -- ++(0,0.20em)
-- ++(-0.20em,0) -- ++(0,0.20em)
-- ++(-0.20em,0) %-- ++(0,-0.25em)
-- ++(0,-0.60em)
-- cycle
;
}}
}
\begin{document}
\begin{multicols}{2}
The symbols used in Text $\stairwayupfilled \stairwayup \stairwayuphollow$ and $\stairwaydownfilled \stairwaydown \stairwaydownhollow$ and formulas:
\begin{align*}
&5\stairwayup6 \stairwaydown 7 \\
&\int_{\stairwayup} \omega, \int_{\stairwaydown} \omega\\
&\stairwayupfilled \stairwayup \stairwayuphollow \\
&\stairwaydownfilled \stairwaydown \stairwaydownhollow
\end{align*}
Different sizes and widths:
{\tiny $\stairwayup <$}
{\huge $\stairwayup <$}
\begin{align*}
{\tiny\stairwayup}
{\huge\stairwayup}
\end{align*}
Color:
\begin{align*}
\colorbox{blue}{\color{-blue} $\stairwayupfilled \stairwayup \stairwayuphollow$}
\end{align*}
Normalsize:
\begin{align*}
6 &\stairwayup 5 \stairwaydown 7\\
6 &> 5<7\\
\int_{\stairwayup} & \int_{\stairwaydown}
\end{align*}
\tiny Tiny:
\begin{align*}
6 &\stairwayup 5 \stairwaydown 7\\
6 &> 5<7\\
\int_{\stairwayup} & \int_{\stairwaydown}
\end{align*}
\huge Huge:
\begin{align*}
6 &\stairwayup 5 \stairwaydown 7\\
6 &> 5<7\\
\int_{\stairwayup} & \int_{\stairwaydown}
\end{align*}
\end{multicols}
\end{document}
观察楼梯的圆形外观。这样它们可以更好地融入<
。如果您更改,可以选择尖角
\tikzset{stairwayStyle/.style={stairwayStyleRound}}
到
\tikzset{stairwayStyle/.style={stairwayStyleSharp}}
如果你想的话。笔画的粗细会随着字体大小而变化,符号的颜色也会相应改变。
钛钾一旦你有了基本的了解,z 就非常灵活。不过,与其他低级软件相比,它可能相对较慢。我的代码可能还有一些改进空间。
答案2
又一个这样的问题:我开始觉得我应该认真考虑把我的halloweenmath
包裹将其整合到一个通常旨在用任意图片制作数学符号的包中。这样,您可以免费获得一些额外的功能,例如当bold
数学版本生效时外观更大胆,以及下标/上标的自动缩放。然而,我看不出为什么所讨论的符号应该表现为二元运算符。
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
\usepackage{halloweenmath} % also loads "amsmath''
\makeatletter
\newcommand*\@HwM@ironwire@stairway[2]{%
% #1 := font selector (e.g., "\textfont")
% #2 := line thickness, in unit of default-rule-thickness "\fontdimen"
\begin{@HwM@small@picture}#1{4.6}{-2.3}%
\roundcap
\linethickness{#2\@HwM@thickness@units@for #1}%
\polyline(\-2,-2)(\-2,-1)(\-1,-1)(\-1,0)%
(0,0)(0,1)(\+1,1)(\+1,2)(\+2,2)\relax
\end{@HwM@small@picture}%
}
\newcommand*\@HwM@Ironwire@Stairway[2]{%
% #1 := style selector (e.g., "\textstyle")
% #2 := font selector (e.g., "\textfont")
\@HwM@choose@thicknesses{\@HwM@ironwire@stairway #2}%
{{1.25}}%
{{2.5}}%
}
\newcommand*\@HwM@hollow@stairway[2]{%
% #1 := font selector (e.g., "\textfont")
% #2 := line thickness, in unit of default-rule-thickness "\fontdimen"
\begin{@HwM@small@picture}#1{4.6}{-2.3}%
\roundcap
\linethickness{#2\@HwM@thickness@units@for #1}%
\polygon(\-2,-2)(\-2,-1)(\-1,-1)(\-1,0)%
(0,0)(0,1)(\+1,1)(\+1,2)(\+2,2)%
(\+2,-2)\relax
\end{@HwM@small@picture}%
}
\newcommand*\@HwM@Hollow@Stairway[2]{%
% #1 := style selector (e.g., "\textstyle")
% #2 := font selector (e.g., "\textfont")
\@HwM@choose@thicknesses{\@HwM@hollow@stairway #2}%
{{1.25}}%
{{2.5}}%
}
\newcommand*\mathsimplerightstair{\@HwM@set@right@dir \@HwM@mathsimplestair}
\newcommand*\mathsimpleleftstair {\@HwM@set@left@dir \@HwM@mathsimplestair}
\newcommand*\@HwM@mathsimplestair{%
\@HwM@general@ordinary@symbol \@HwM@Ironwire@Stairway
}
\newcommand*\mathhollowrightstair{\@HwM@set@right@dir \@HwM@mathhollowstair}
\newcommand*\mathhollowleftstair {\@HwM@set@left@dir \@HwM@mathhollowstair}
\newcommand*\@HwM@mathhollowstair{%
\@HwM@general@ordinary@symbol \@HwM@Hollow@Stairway
}
\makeatother
\begin{document}
In text, surrounded by square brackets so to check the sidebearings:
\( [ \mathsimplerightstair \mathsimpleleftstair] \),
or \( [\mathhollowrightstair \mathhollowleftstair] \).
Now in display:
\[
\mathsimplerightstair + \int_{\mathsimplerightstair} f(z)\,dz
- \mathhollowleftstair - \int_{\mathhollowleftstair} g(z)\,dz
\]
Note that the symbols get smaller in the subscript, even if the main font size
doesn't change. This behavior extends to double scripts, \emph{e.g.},
\( [\mathhollowrightstair_{\mathhollowrightstair^{\mathhollowrightstair}}] \),
as one would expect.\footnote{Of course, changes in the main font size are
honored too:
\( [\mathhollowrightstair_{\mathhollowrightstair^{\mathhollowrightstair}}] \).}
Furthemore, compare the looks of the four symbols in the \texttt{normal} and in
the \texttt{bold} math versions:
\( [\mathsimplerightstair \mathsimpleleftstair
\mathhollowrightstair \mathhollowleftstair] \)
{\bfseries \boldmath versus
\( [\mathsimplerightstair \mathsimpleleftstair
\mathhollowrightstair \mathhollowleftstair] \).}
As already mentioned in a footnote, the symbols also scale with the main font
size (compare them with the brackets).
\bigskip
{\Large This is \verb|\Large|:
\( [ \mathsimplerightstair \mathsimpleleftstair] +
\mathhollowrightstair_{\mathhollowrightstair}\).}
\bigskip
{\Huge This is \verb|\Huge|:
\( [ \mathsimplerightstair \mathsimpleleftstair] +
\mathhollowrightstair_{\mathhollowrightstair}\).}
\bigskip
{\footnotesize This is \verb|\footnotesize|:
\( [ \mathsimplerightstair \mathsimpleleftstair] +
\mathhollowrightstair_{\mathhollowrightstair}\).}
\end{document}
请参阅注释halloweenmath.dtx
以了解宏的工作原理。当然,可能仍需要对侧边距和线条粗细进行一些微调。
这是输出:
添加:
我突然想到,在上面的代码中,您可能需要将所有出现的 替换为\roundcap
,\roundcap \roundjoin
以便在楼梯各段之间获得圆形连接以及圆形盖帽;事实上,\roundcap
在 的情况下甚至毫无用处\@HwM@hollow@stairway
,因为它根本没有盖帽!