% Robust, scale-aware "allsome" quantifier.
% Implemented in TeX by David A. Wheeler, released under CC0 license.

\usepackage{tikz}
\usepackage{amsmath}

% Heights and widths are in ex units (the height of a lowercase 'x') so the
% symbol matches the surrounding math font; quantifiers such as \forall and
% \exists are about 1.4ex tall. The middle prong of the "E" is shortened
% slightly, a standard typographic trick to make the letter look balanced.
\newcommand{\allsome}{\mathord{\mathchoice
  % 1. Display style (large equations)
  {\tikz[baseline=-0.35, line width=0.06em, line cap=rect, line join=miter, x=1ex, y=1ex]{
    \draw (0,0) -- (-0.5, 1.4); \draw (0,0) -- (0.5, 1.4); \draw (-0.25, 0.7) -- (0.25, 0.7);
    \draw (1.4, 0) -- (1.4, 1.4); \draw (0,0) -- (1.4, 0); \draw (0.5, 1.4) -- (1.4, 1.4);
    \draw (1.4, 0.7) -- (0.95, 0.7);
  }}%
  % 2. Text style (standard inline math)
  {\tikz[baseline=-0.35, line width=0.06em, line cap=rect, line join=miter, x=1ex, y=1ex]{
    \draw (0,0) -- (-0.5, 1.4); \draw (0,0) -- (0.5, 1.4); \draw (-0.25, 0.7) -- (0.25, 0.7);
    \draw (1.4, 0) -- (1.4, 1.4); \draw (0,0) -- (1.4, 0); \draw (0.5, 1.4) -- (1.4, 1.4);
    \draw (1.4, 0.7) -- (0.95, 0.7);
  }}%
  % 3. Script style (subscripts and superscripts)
  {\tikz[baseline=-0.35, line width=0.045em, line cap=rect, line join=miter, x=0.7ex, y=0.7ex]{
    \draw (0,0) -- (-0.5, 1.4); \draw (0,0) -- (0.5, 1.4); \draw (-0.25, 0.7) -- (0.25, 0.7);
    \draw (1.4, 0) -- (1.4, 1.4); \draw (0,0) -- (1.4, 0); \draw (0.5, 1.4) -- (1.4, 1.4);
    \draw (1.4, 0.7) -- (0.95, 0.7);
  }}%
  % 4. Scriptscript style (nested subscripts)
  {\tikz[baseline=-0.35, line width=0.035em, line cap=rect, line join=miter, x=0.5ex, y=0.5ex]{
    \draw (0,0) -- (-0.5, 1.4); \draw (0,0) -- (0.5, 1.4); \draw (-0.25, 0.7) -- (0.25, 0.7);
    \draw (1.4, 0) -- (1.4, 1.4); \draw (0,0) -- (1.4, 0); \draw (0.5, 1.4) -- (1.4, 1.4);
    \draw (1.4, 0.7) -- (0.95, 0.7);
  }}%
}}
