9

I've come up with a way of displaying the symbol my lecturer uses for a poset embedding in LaTeX, having not been able to find it as a standard symbol. The method I employed was using a TikZ picture as a new function with the following code

\newcommand{\Sqsubset}{
\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 }

I was basically just wondering if there is a way of using this symbol without having to have the compiler draw it from the code every time... perhaps saving it as a glyph?

  • Welcome to TeX.SE. For future reference, while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. This is especially important for tikz as there are numerous libraries – Peter Grill Oct 26 '16 at 17:09
  • 3
    If I understood your question correctly, you can include the mathabx package so that you can use \sqSubset in math mode --> a comprehensive LATEX Symbol List – mattdanzi Oct 26 '16 at 17:18
  • 1
    Can you give some reference for the symbol? I can't find it in the Unicode repertoire; with some showcases it might be included. – egreg Oct 26 '16 at 21:30
  • @egreg -- not in unicode. wasn't on the stix list. if a published reference can be found, it would certainly be accepted, and i'd be happy to submit it. – barbara beeton Oct 26 '16 at 21:48
7

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}

Result

  • 1
    alignment is incorrect. should be vertically centered around the math axis. (same alignment, and same class, as regular \subset.) – barbara beeton Oct 26 '16 at 21:46
11

Wouldn't be better to use a standard symbol?

\documentclass{article}
\usepackage{mathabx}

\begin{document}

\[
A\sqSubset B
\]

\end{document}

enter image description here

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}

enter image description here

5

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}

enter image description here

  • 1
    alignment is incorrect. should be vertically centered around the math axis. – barbara beeton Oct 26 '16 at 21:40
4

You can use a \savebox. However, this may be an issue if the symbol is used in subscripts or superscripts, etc.

Code:

\documentclass{article}
\usepackage{tikz}

\newcommand{\SqsubsetMacro}{%
    \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%
}

\newsavebox{\SqsubsetBox}
\savebox{\SqsubsetBox}{\SqsubsetMacro}
\newcommand{\Sqsubset}{\usebox{\SqsubsetBox}}

\begin{document}

\Sqsubset  

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.