[Tex/LaTex] How to get a stairway symbol in math mode

math-modesymbols

I am looking for a 'stair' or 'stairway' symbol that I can use in math mode to denote a stair-like curve, for example to be used as an integration path. I have included some pictures as examples below:

enter image description here

enter image description here

enter image description here

and for "full" stairs:

enter image description here

enter image description here

enter image description here

Feel free to add more appropriate tags.

Best Answer

You could build something on your own, like:

\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}

Observe that the stairs have a round appeal. This way they blend better with <. You can choose sharp corners if you change

\tikzset{stairwayStyle/.style={stairwayStyleRound}}

to

\tikzset{stairwayStyle/.style={stairwayStyleSharp}}

if you want to. The thickness of the strokes varies with the font size and the symbols do change their color appropriately.

Tikz is very versatile once you have a basic understanding. It might be relatively slow compared to other low level software, though. My code might have some room for improvement.

enter image description here