14

I'd tried Detexify but no success. Since we have \square for quadrilateral and \triangle for triangles, I'd like to use a symbol for parallelogram. A kind of slanted square.

Of course, I can do this using tikz but I guess that it is too much. I'd need to load a huge package only to draw a single symbol.

Any ideas?

  • 1
    there's a parallelogram at U+25B1 in unicode, so this would be in the stix or xits fonts. (those aren't in either detexify or the comprehensive symbols list yet.) – barbara beeton Oct 8 '13 at 12:19
  • @barbarabeeton, thanks for your comment but I have no idea how to use this glyph. Is it possible to define a newcommand? – Sigur Oct 8 '13 at 12:22
  • 2
    i'm certain it's possible to define a \newcommand{\parallelogram}, but i haven't ever actually used the stix or xits fonts with (la)tex (even though i helped develop the stix fonts), so this is better answered by someone with real experience. hence a comment rather than an answer. – barbara beeton Oct 8 '13 at 12:27
  • @barbarabeeton, thanks. I found here stixfonts.org/allGlyphs.html the list of symbols available. As you said, ▰ or ▱ is what I want. – Sigur Oct 8 '13 at 12:33
13

using xelatex (or lualatex):

enter image description here

\documentclass{article}

\usepackage{unicode-math}
\setmathfont{xits-math.otf}

\begin{document}

\[ a ^^^^25b1  b \]


\Large
\[ a ^^^^25b1  b \]

\end{document}
  • David, as far as I know it is possible to use only some glyphs from that font, isn't? So the math font would be still the cmr. Thanks. – Sigur Oct 8 '13 at 16:30
  • The stix font have recently been repackaged as a set of fonts for classic (pdf) tex. Using xelatex it's simpler (although not strictly required) to go with the flow and use a matching font for everything. – David Carlisle Oct 8 '13 at 16:35
  • \usepackage{stix} and use \parallelogram is the simplest way to use STIX math fonts, especially for classic pdfTeX. – Leo Liu May 19 '14 at 4:00
10

You don’t need TikZ, you can use PGF (just a little lighter), or if you don’t need rounded line caps/joins (or if you know how to activate them for \rules), a few rules suffice.

Code

\documentclass[varwidth]{standalone}
\usepackage{graphicx,amsmath,amssymb,pgf}
\newcommand*{\parallelogramm}{%
  \rlap{\rotatebox{-30}{\rule[.05ex]{.4pt}{.77em}}}%
  \kern.04em%
  \rlap{\kern.36em\raisebox{0.649519052835em}{\rule{.6em}{.4pt}}}%
  \rule{.6em}{.4pt}\kern-.04em%
  \rotatebox{-30}{\rule[.05ex]{.4pt}{.77em}}}
\newcommand*{\Parallelogramm}[1][]{%
  \pgfpicture\pgfsetroundjoin
    \pgftransformxslant{.6}%
    \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{.60em}{.65em}}%
    \pgfusepath{stroke,#1}%
  \endpgfpicture}
\begin{document}
$\square \triangle$%
\parallelogramm
\Parallelogramm
\Parallelogramm[fill]
\end{document}

Output

enter image description here

  • Does pgf come with basic installation? – Sigur Oct 8 '13 at 13:03
  • @Sigur I don’t know. PGF is the basic layer of TikZ (or to be precise: TikZ is the front-end layer of PGF). Both together (And more) are bundled under pgf in TeXLive and MikTeX. – Qrrbrbirlbel Oct 8 '13 at 13:06
9

With PSTricks just for fun as usual!

\documentclass{article}

\usepackage[pdf]{pstricks}


\newcommand\parallelogram[1][2]{%
    \psset{unit=#1pt}
    \begin{pspicture}(4,3)
        \pspolygon(0,0)(3,0)(4,3)(1,3)
    \end{pspicture}}

\begin{document}
This is a parallelogram \parallelogram. Is it cool? Yes! How about the bigger one \parallelogram[10]? Is it cooler? Yes!
\end{document}

enter image description here

  • 1
    I'd love to kiss your armpit. – Quinn Culver Feb 17 '16 at 0:35
4

This answer uses stackengine and scalerel to construct the glyph. It scales to different math sizes, though the line stroke thickness will be diminished in the process.

\documentclass{article}
\usepackage{amssymb}
\usepackage{stackengine}
\usepackage{scalerel}
\usepackage{graphicx}
\newlength\lthk
\setlength\lthk{.1ex}
\def\bline{\rule{2ex}{\lthk}}
\def\slash{\rotatebox{60}{\bline}}
\def\parallelogram{\stackMath\scalerel*{%
  \def\stackalignment{l}{\stackunder[-.5\lthk]{%
  \def\stackalignment{r}\stackon[-.5\lthk]{\slash\rule{.866ex}{0ex}\slash}{\bline}}%
  {\bline}}}{\square}%
}
\begin{document}
$\square \triangle \parallelogram \scriptscriptstyle \square \triangle \parallelogram$
\end{document}

enter image description here

3

It is not perfect, but the stmaryrd package offers \fatslash and \fatbslash (as binary operators).

  • Thanks, but it is not too fat... lol – Sigur Oct 8 '13 at 12:21
2

The stix package gives you not only \parallelogram and \parallelogramblack, but also \fltns.

\documentclass{article}

\usepackage{stix}

\begin{document}

$\parallelogram \parallelogramblack \fltns$

\end{document}

Output (sorry for upload from Paint)

0

If you're feeling hacky, or are working on an online platform based on KaTeX, this is a mediocre, but perhaps passable ASCII-inspired solution:

 \underline{/\overline{ \vphantom{/} \hphantom{a}}\,}\!\overline{/}}

enter image description here

Hopefully you don't need to use this, though :)

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.