Math Saturation Symbol
First create a standalone
version of your icon, here in saturation.tex
:
\documentclass[border=0mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\makeatletter
\pgfdeclareshape{record}{
\inheritsavedanchors[from={rectangle}]
\inheritbackgroundpath[from={rectangle}]
\inheritanchorborder[from={rectangle}]
\foreach \x in {center,north east,north west,north,south,south east,south west}{
\inheritanchor[from={rectangle}]{\x}
}
\foregroundpath{
\pgfpointdiff{\northeast}{\southwest}
\pgf@xa=\pgf@x \pgf@ya=\pgf@y
\northeast
\pgfpathmoveto{\pgfpoint{0}{0.33\pgf@ya}}
\pgfpathlineto{\pgfpoint{0}{-0.33\pgf@ya}}
\pgfpathmoveto{\pgfpoint{0.33\pgf@xa}{0}}
\pgfpathlineto{\pgfpoint{-0.33\pgf@xa}{0}}
\pgfpathmoveto{\pgfpointadd{\southwest}{\pgfpoint{-0.33\pgf@xa}{-0.6\pgf@ya}}}
\pgfpathlineto{\pgfpointadd{\southwest}{\pgfpoint{-0.5\pgf@xa}{-0.6\pgf@ya}}}
\pgfpathlineto{\pgfpointadd{\northeast}{\pgfpoint{-0.5\pgf@xa}{-0.6\pgf@ya}}}
\pgfpathlineto{\pgfpointadd{\northeast}{\pgfpoint{-0.33\pgf@xa}{-0.6\pgf@ya}}}
}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\node[record,minimum size=1cm,fill=blue!30,draw] (a) {};
\end{tikzpicture}
\end{document}
Then, use this code to include it as the height of the local value of 1ex
, with a little horizontal gap on each side. This code will adjust to the current font size (so no problem if you go Huge
) as well as to the current math style (\scriptstyle
and \scriptscriptstyle
):
\documentclass{article}
\usepackage{scalerel,graphicx}
\newcommand\sat{\ThisStyle{%
\kern.5\LMpt\includegraphics[height=1\LMex]{saturation}\kern.5\LMpt}}
\begin{document}
\centering
Here is \sat.
In math, $A_{\sat}$
\[
A_{\sat_{\sat}}
\]
\end{document}
Obviously, you can change the size by adjusting 1\LMex
to something different. You can adjust the gap by adjusting the .5\LMpt
to something different, and you can change the color and line thickness in the original tikz
code.
For example, by changing the color at saturation.tex
to gray!5
and adding a thick
specification to the draw, one gets this:
That carries over directly into the main document, where I have changed the height specification to 1.3\LMex
, to arrive at:
SUPPLEMENT
To help the OP with a follow up request to eliminate the border and axes, replace saturation.tex
with this:
\documentclass[border=0mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (-.5,-.4);
\coordinate (B) at (-.3,-.4);
\coordinate (C) at (+.3,+.4);
\coordinate (D) at (+.5,+.4);
\draw [black, thick] (A)--(B)--(C)--(D);
\end{tikzpicture}
\end{document}
Then, with the document code definition that
\newcommand\sat{\ThisStyle{%
\kern.5\LMpt\includegraphics[height=1.3\LMex]{saturation}\kern.5\LMpt}}
we arrive at
\documentclass{article}
\usepackage{scalerel,graphicx}
\newcommand\sat{\ThisStyle{%
\kern.5\LMpt\includegraphics[height=1.3\LMex]{saturation}\kern.5\LMpt}}
\begin{document}
\centering
Here is \sat.
In math, $A_{\sat}$
\[
A_{\sat_{\sat}}
\]
\Huge
\[
A_{\sat_{\sat}}
\]
\end{document}
I'm not sure if this is what you want, but you can design your own symbol without tikz
. Use \mathchoice
to allow for use as a subscript or subsubscript.
Here is the code:
\documentclass{article}
\usepackage{calc} % needed to subtract from \hght
\newlength{\wdth}
\newlength{\hght}
\newlength{\dpth}
\newcommand{\sat}{\mathchoice%
{\settowidth{\wdth}{/}\settoheight{\hght}{/}\settodepth{\dpth}{/}%
\rule[-\dpth]{.25em}{.09ex}\hspace{-.13\wdth}/%
\hspace{-.15\wdth}\rule[\hght-.09ex]{.25em}{.09ex}}
{\settowidth{\wdth}{/}\settoheight{\hght}{/}\settodepth{\dpth}{/}%
\rule[-\dpth]{.25em}{.09ex}\hspace{-.15\wdth}/%
\hspace{-.15\wdth}\rule[\hght-.09ex]{.25em}{.09ex}}
{\settowidth{\wdth}{$\scriptstyle /$}\settoheight{\hght}{$\scriptstyle /$}\settodepth{\dpth}{$\scriptstyle /$}%
\rule[-\dpth]{.2em}{.08ex}\hspace{-.17\wdth}\scriptstyle /%
\hspace{-.17\wdth}\rule[\hght-.08ex]{.2em}{.08ex}}
{\settowidth{\wdth}{$\scriptstyle /$}\settoheight{\hght}{$\scriptscriptstyle /$}\settodepth{\dpth}{$\scriptscriptstyle /$}%
\rule[-\dpth]{.15em}{.07ex}\hspace{-.19\wdth}\scriptscriptstyle /%
\hspace{-.19\wdth}\rule[\hght-.07ex]{.15em}{.07ex}}
}
\begin{document}
$A\sat B_{A\sat B_{A\sat B}}$
\end{document}
If you want longer or shorter tails you can adjust the lengths in the \rule
parameters. The .25em
(or .2em
for subscript, .18em
for subsubscript) controls the length.
With picture
mode:
\documentclass{article}
\usepackage{amsmath}
\usepackage{pict2e}
\makeatletter
\DeclareRobustCommand{\saturation}{%
\mathrel{%
\mkern1mu\nonscript\mkern-1mu
\mathpalette\satur@tion\relax
\mkern1mu\nonscript\mkern-1mu
}%
}
\newcommand{\satur@tion}[2]{%
\vcenter{\hbox{%
\sbox\z@{$\m@th#1|$}%
\setlength{\unitlength}{\dimexpr\ht\z@+\dp\z@}%
\saturation@linethickness{#1}%
\begin{picture}(0.6,1)
\roundcap
\polyline(0,0)(0.2,0)(0.4,1)(0.6,1)
\end{picture}%
}}%
}
\newcommand{\saturation@linethickness}[1]{%
\linethickness{%
1.25\fontdimen8
\ifx#1\displaystyle\textfont\else
\ifx#1\textstyle\textfont\else
\ifx#1\scriptstyle\scriptfont\else
\scriptscriptfont\fi\fi\fi 3
}%
}
\makeatother
\begin{document}
$A\saturation B_{A\saturation B_{A\saturation B}}$
\end{document}
The command \saturation@linethickess
is an old trick of mine, see https://tex.stackexchange.com/a/412159/4427
I chose to make the symbol the same vertical size as |
; the width is 60% of the height and the three parts have equal width. Feel free to change the proportions. You can get it wider with
\newcommand{\satur@tion}[2]{%
\vcenter{\hbox{%
\sbox\z@{$\m@th#1|$}%
\setlength{\unitlength}{\dimexpr\ht\z@+\dp\z@}%
\saturation@linethickness{#1}%
\begin{picture}(0.8,1)
\roundcap
\polyline(0,0)(0.2,0)(0.6,1)(0.8,1)
\end{picture}%
}}%
}