# How can I create a rectangle symbol?

I need to represent symmetries of a a rectangle as a set, and in my text book they do so by using the following notation

S(SYMBOL-THAT-LOOKS-LIKE-A-RECTANGLE)

I searched everywhere, tried http://detexify.kirelabs.org/classify.html and no luck. So, I came to terms with there not being any rectangle, and the closest I have been able to get is

$s\sqsubset\sqsupset$


Is there any way I can reduce the spacing between them so they make a better rectangle?

• \square from amssymb. or $s\sqsubset\!\sqsupset$ – user11232 Nov 25 '14 at 0:20
• \square is like, a square though right? :D (the second one will do btw, that was just what i was after :D) – JustDanyul Nov 25 '14 at 0:22
• You want a rectangle!, what should be the width? – user11232 Nov 25 '14 at 0:22
• $s\sqsubset\!\sqsupset$ did the trick! thanks a lot :D – JustDanyul Nov 25 '14 at 0:24

This is U+25AD (▭) and available as \hrectangle in unicode-math (if using xelatex or lualatex) or stix if using pdflatex (and will be available in other font packages that cover the Unicode math blocks)

\documentclass{article}

\usepackage{stix}

\begin{document}

$a \hrectangle b$

\end{document}

• For a filled rectangle \hrectangleblack of stix may be used. – Herpes Free Engineer Sep 9 '16 at 14:39

A good occasion for \ooalign, one of the best tricks in my toolbox:

\documentclass{article}
\usepackage{amssymb}

\newcommand{\rectangle}{{%
\ooalign{$\sqsubset\mkern3mu$\cr$\mkern3mu\sqsupset$\cr}%
}}

\begin{document}
$S(\rectangle)$
\end{document}


Experiment changing 3mu for different ratios between width and height.

• What does ooalign stands for? (I'm mostly interested in the oo since align is self explanatory :D) – Manuel Nov 25 '14 at 9:59
• @Manuel See tex.stackexchange.com/a/22375/4427 – egreg Nov 25 '14 at 10:00
• I meant the name. Just curiosity. halign in some way is “horizontal alignment”, valign for “vertical”, but oo? “over and over”? – Manuel Nov 25 '14 at 10:17
• @Manuel You should ask Donald Knuth. – egreg Nov 25 '14 at 10:25
\documentclass[12pt]{report}
\usepackage{amsmath,amssymb}
\newcommand{\rectangle}{\fboxsep0pt\fbox{\rule{1em}{0pt}\rule{0pt}{1ex}}}
\begin{document}
$s\rectangle$

\end{document}


One simple method would be to use tikzpackage. You can draw each line of the rectangle. It may be tedious at first to use tikz, but it is so much more convenient when you need to modify your image. \usepackage{tikz} \begin{document}

\maketitle

S
\begin{tikzpicture}[font=\small\sffamily\bfseries, node distance = 0.5cm]
\tikzset{
mynode/.style={rectangle,rounded corners,draw=black, top color=white, bottom     color=yellow!50,very thick, inner sep=1em, minimum size=3em, text centered},
myarrow/.style={->, >=latex', shorten >=1pt, thick},
mylabel/.style={text width=7em, text centered}
}
\tikzstyle{block} = [rectangle, draw,
text width=11em, text centered]

\tikzstyle{decision} = [diamond, draw, text width=4em, text badly centered, inner     sep=0pt]

\node[block] (rectangle) [text width=13em] {text_inside_rectangle};
\end{tikzpicture}


Here, I draw a node. you can specify the dimensions of the rectangle accordingly. And if you want more such rectangles you just have to repeat the '\node[block] (rectangle) [text width=13em] {text_inside_rectangle}; ' statement. Hope this helps.

• As it is, this is more of a comment rather than an answer. If you actually include the code to draw the rectangle then this would make a good answer. – Peter Grill Dec 11 '14 at 7:37

Try this:

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
A$\sqsubset \! \sqsupset$B
\end{document}