Symbol creation in TikZ
Wouldn't be better to use a standard symbol?
\documentclass{article}
\usepackage{mathabx}
\begin{document}
\[
A\sqSubset B
\]
\end{document}
One can avoid mathabx
changing all symbols, which might be undesired.
\documentclass{article}
\DeclareFontFamily{U}{mathb}{}
\DeclareFontShape{U}{mathb}{m}{n}{
<-5.5> mathb5
<5.5-6.5> mathb6
<6.5-7.5> mathb7
<7.5-8.5> mathb8
<8.5-9.5> mathb9
<9.5-11> mathb10
<11-> mathb12
}{}
\DeclareSymbolFont{mathb}{U}{mathb}{m}{n}
\DeclareFontSubstitution{U}{mathb}{m}{n}
\DeclareMathSymbol{\sqSubset}{3}{mathb}{"94}
\DeclareMathSymbol{\sqSupset}{3}{mathb}{"95}
\begin{document}
$A \sqSubset B \sqSupset C$
\end{document}
The symbol quality can be improved.
Spacings:
\mathrel
takes care of the horizontal math mode spacing in different math contexts.- Side bearings for the symbol can be reduced from 3pt to values similar to
sqsubset
.
Line drawings:
Polylines should not be split and the line segments drawn as single lines. Then line join settings does not apply. If the lines are drawn as connected lines, then the line joining can be made smoother. The example below uses setting
round
.Also the line caps can be made round as in
\sqsubset
.
Full example:
\documentclass{article}
\usepackage{tikz}
% Old version
\newcommand{\OldSqsubset}{
\kern3pt
\begin{tikzpicture}
\draw (0ex,0ex) -- (0ex,1.3ex);
\draw (0ex,0) -- (1.3ex,0ex);
\draw (0ex,1.3ex) -- (1.3ex,1.3ex);
\draw (0.325ex,0.325ex) -- (1.3ex,0.325ex);
\draw (0.325ex,0.325ex) -- (0.325ex,0.975ex);
\draw (0.325ex,0.975ex) -- (1.3ex,0.975ex);
\end{tikzpicture}
\kern3pt }
% New version
\newcommand{\Sqsubset}{%
\mathrel{%
\tikz[line cap=round, line join=round]
\draw
(1.3ex, 0ex) -- (0ex, 0ex) -- (0ex, 1.3ex) -- (1.3ex, 1.3ex)
(1.3ex, 0.325ex) -- (0.325ex, 0.325ex) -- (0.325ex, 0.975ex)
-- (1.3ex, 0.975ex)
(-.13ex, 0ex) (1.3ex + .13ex, 0ex) % side bearings
;%
}%
}
\begin{document}
\noindent
$A \OldSqsubset B$
$A \Sqsubset B$
\end{document}
This is made to obey math styles, and I called it a \mathrel
(an assumption of mine). It will always be as tall as the height of a capital letter.
EDITED to change the second argument of \scalerel*
from X
to \subset
, so that this new symbol would forever acquire the height of \subset
, in response to Barbara's comment.
\documentclass{article}
\usepackage{tikz,scalerel}
\newcommand{\SqsubsetRAW}{%
\begin{tikzpicture}
\draw (0ex,0ex) -- (0ex,1.3ex);
\draw (0ex,0) -- (1.3ex,0ex);
\draw (0ex,1.3ex) -- (1.3ex,1.3ex);
\draw (0.325ex,0.325ex) -- (1.3ex,0.325ex);
\draw (0.325ex,0.325ex) -- (0.325ex,0.975ex);
\draw (0.325ex,0.975ex) -- (1.3ex,0.975ex);
\end{tikzpicture}}
\newsavebox\SqsubsetBOX
\savebox\SqsubsetBOX{\SqsubsetRAW}
\newcommand\Sqsubset{\mathrel{\scalerel*{\kern1\LMpt\usebox{\SqsubsetBOX}}{\subset}}}
\begin{document}
$Z \subset A\Sqsubset B_{A\Sqsubset B_{A\Sqsubset B}}$
\LARGE
$A\Sqsubset B_{A\Sqsubset B_{A\Sqsubset B}}$
\end{document}