# Pigpen-like symbol for =

I would like to use symbols which look like the pigpen cypher symbols

One symbol I need consists of the two horizontal edges of the square, and the other has the vertical edges in it. I cannot just use = (and its rotation) because the lines are too close to each other. I've looked in the Comprehensive LaTeX Symbol List but could not find any symbol like that. Where could I get hold of such a symbol?

• Are you using this package or are you just looking for something similar? It would be easy to construct such thing but if you have those symbols in use, we have to stick to this line thickness and scaling and so on. – LaRiFaRi Mar 9 '16 at 10:07
• I couldn't find it either, maybe draw it with tikz ? check this out tex.stackexchange.com/questions/150412/… – Elad Den Mar 9 '16 at 10:09
• I'm using the package pigpen because I also use some other symbols of those listed above @LaRiFaRi And they have just the size and line thickness I'd like to have. – Stefan Hamcke Mar 9 '16 at 10:10

Here, I introduce \pigpenXXXX where XXXX is some combination of 0 and 1 that signify strokes on the left, top, right, bottom (i.e., clockwise starting on left). Stroke length and width are defined by \rlln and \rlwd, respectively. The symbols are defined to sit on the baseline.

Naturally, one could define letters like \def\ppA{\pigpen0011}, etc.

EDITED to make suitable for use in math mode, though it will also function in text mode.

\documentclass{article}
\usepackage{stackengine}
\newlength\rlln
\newlength\rlwd
\newlength\brlwd
\newlength\trlwd
\newlength\lrlwd
\newlength\rrlwd

\rlwd=.5pt
\rlln=5pt
\def\bstr{\rule{\rlln}{\brlwd}\rule{0pt}{\rlwd}}
\def\tstr{\rule{\rlln}{\trlwd}\rule{0pt}{\rlwd}}
\def\lstr{\ooalign{\rule{\lrlwd}{\rlln}\cr\rule{\rlwd}{0pt}}}
\def\rstr{\ooalign{\rule{\rrlwd}{\rlln}\cr\rule{\rlwd}{0pt}}}
\def\gap{\rule{\dimexpr\rlln-2\rlwd}{0pt}}
\def\pigpen#1#2#3#4{\kern1pt% FOUR ARGUMENTS ARE LEFT, TOP, RIGHT, BOTTOM STROKES
\brlwd=#4\rlwd\relax%
\trlwd=#2\rlwd\relax%
\lrlwd=#1\rlwd\relax%
\rrlwd=#3\rlwd\relax%
\stackengine{\dimexpr\rlln-\rlwd}{%
\stackengine{0pt}{\bstr}{\lstr\gap\rstr}{O}{c}{F}{F}{L}%
}{\tstr}{O}{c}{F}{F}{L}\kern1pt%
}
\begin{document}
$x\pigpen0011 \pigpen1011 \pigpen1001 \pigpen0111 \pigpen1111 \pigpen1101 \pigpen0110 \pigpen1110 \pigpen1100 \pigpen1010 \pigpen0101 y$
\end{document}


UPDATE:

The OP requested a version with rounded endcaps. To do so, I use my custom style file roundrule.sty, found exclusively at the end of this answer:

Is there such a thing as a \mathrule? (rounded endcaps)

I then modify my above answer to use round rules instead of rules. I probably need to update roundrule.sty, because I found that if one of the rule dimensions is 0pt, it still outputs a thin line. To circumvent that problem for this answer, I perform a check on the roundrule dimensions.

\documentclass{article}
\usepackage{stackengine,roundrule}
\newlength\rlln
\newlength\rlwd
\newlength\brlwd
\newlength\trlwd
\newlength\lrlwd
\newlength\rrlwd
\newcommand\rrule[2]{\ifdim#1>0pt\relax\ifdim#2>0pt\relax\roundrule{#1}{#2}\else\fi\else\fi}

\rlwd=.5pt
\rlln=5pt
\def\bstr{\rrule{\rlln}{\brlwd}\rule{0pt}{\rlwd}}
\def\tstr{\rrule{\rlln}{\trlwd}\rule{0pt}{\rlwd}}
\def\lstr{\ooalign{\rrule{\lrlwd}{\rlln}\cr\rule{\rlwd}{0pt}}}
\def\rstr{\ooalign{\rrule{\rrlwd}{\rlln}\cr\rule{\rlwd}{0pt}}}
\def\gap{\rule{\dimexpr\rlln-2\rlwd}{0pt}}
\def\pigpen#1#2#3#4{\kern1pt% FOUR ARGUMENTS ARE LEFT, TOP, RIGHT, BOTTOM STROKES
\brlwd=#4\rlwd\relax%
\trlwd=#2\rlwd\relax%
\lrlwd=#1\rlwd\relax%
\rrlwd=#3\rlwd\relax%
\stackengine{\dimexpr\rlln-\rlwd}{%
\stackengine{0pt}{\bstr}{\lstr\gap\rstr}{O}{c}{F}{F}{L}%
}{\tstr}{O}{c}{F}{F}{L}\kern1pt%
}
\begin{document}
$x\pigpen0011 \pigpen1011 \pigpen1001 \pigpen0111 \pigpen1111 \pigpen1101 \pigpen0110 \pigpen1110 \pigpen1100 \pigpen1010 \pigpen0101 y$
\end{document}


• Thank you for your answer! It works perfect for me! One question, though. Is there a way to have round ends at the edges? – Stefan Hamcke Mar 10 '16 at 13:42
• @StefanHamcke Please see my update. – Steven B. Segletes Mar 10 '16 at 15:34
• Thanks for your effort! I have one problem, though. When I use your sample in conjunction with the package ntheorem, I get an error. I've put the line \usepackage[amsmath,thmmarks,hyperref]{ntheorem} into the header, and then the error appears. Apparently a problem with \relax. – Stefan Hamcke Mar 13 '16 at 8:48
• Sorry, I had forgotten to include the package amsmath. So now upon adding \usepackage{amsmath, amssymb, mathrsfs} \usepackage{hyperref} \usepackage[amsmath,thmmarks,hyperref]{ntheorem} to the header, there is a problem with the $...$ environment and \pigpen. It gives an error when I write $\pigpen1100$. – Stefan Hamcke Mar 14 '16 at 10:00
• @StefanHamcke I had to add two \relaxes to the definition of \rrule. I think it should work now. Give it a spin. – Steven B. Segletes Mar 14 '16 at 10:25

You can use pict2e. I took the parameters from pigpen.mf.

\documentclass{article}
\usepackage{pigpen,pict2e}

\DeclareRobustCommand{\pigpenver}{%
\begingroup\pigpenfont
\setlength{\unitlength}{1em}%
\begin{picture}(1,1)
\linethickness{0.09\unitlength}
\roundcap
\polyline(0.16667,0.16667)(0.16667,0.83333)
\polyline(0.83333,0.16667)(0.83333,0.83333)
\end{picture}%
\endgroup
}
\DeclareRobustCommand{\pigpenhor}{%
\begingroup\pigpenfont
\setlength{\unitlength}{1em}%
\begin{picture}(1,1)
\roundcap
\linethickness{0.09\unitlength}
\polyline(0.16667,0.16667)(0.83333,0.16667)
\polyline(0.16667,0.83333)(0.83333,0.83333)
\end{picture}%
\endgroup
}

\begin{document}

X{\pigpenfont E}X\pigpenhor\pigpenver X

{\pigpenfont E}

\pigpenhor{\pigpenfont BC}

\pigpenver{\pigpenfont BC}

\end{document}


A possibly better interface:

\documentclass{article}
\usepackage{pigpen,pict2e,xparse}

\NewDocumentCommand{\pigpenver}{}{%
\begingroup\pigpenfont
\setlength{\unitlength}{1em}%
\begin{picture}(1,1)
\linethickness{0.09\unitlength}
\roundcap
\polyline(0.16667,0.16667)(0.16667,0.83333)
\polyline(0.83333,0.16667)(0.83333,0.83333)
\end{picture}%
\endgroup
}
\NewDocumentCommand{\pigpenhor}{}{%
\begingroup\pigpenfont
\setlength{\unitlength}{1em}%
\begin{picture}(1,1)
\roundcap
\linethickness{0.09\unitlength}
\polyline(0.16667,0.16667)(0.83333,0.16667)
\polyline(0.16667,0.83333)(0.83333,0.83333)
\end{picture}%
\endgroup
}

\ExplSyntaxOn
\NewDocumentCommand{\pp}{m}
{
\group_begin:
\pigpenfont
\tl_map_inline:nn { #1 }
{
\str_case:nnF { ##1 }
{
{h}{\pigpenhor}
{v}{\pigpenver}
}
{##1}
}
\group_end:
}
\ExplSyntaxOff

\begin{document}

\pp{ABCDEFGHIJKLMNOPQRSTUVWXYZhv}

\pp{hLUCASv}

\verb|\pp{h}| $\to$ \pp{h}

\verb|\pp{v}| $\to$ \pp{v}

\end{document}


Just to show the result is as expected (maybe up to some pixels), here's what I get from

\pp{E}\llap{\color{red}\pp{h}}

\pp{h}\llap{\color{red}\pp{E}}


If you need the symbol are at the baseline (the font designer decided to have them raised), change the definition of \pp in the last code to

\NewDocumentCommand{\pp}{m}
{
\group_begin:
\pigpenfont
\raisebox{-0.16667em}
{
\tl_map_inline:nn { #1 }
{
\str_case:nnF { ##1 }
{
{h}{\pigpenhor}
{v}{\pigpenver}
}
{##1}
}
}
\group_end:
}


so the input

ABC\pp{hLUCASv}DEF


would produce

You can also define a different syntax for the symbols; I use the order “right-bottom-left-top”, so rb means “right-bottom” filled and “left-top” empty. This way, you don't need to remember the letter corresponding to a given combination.

\documentclass{article}
\usepackage{pigpen,pict2e,xparse}

\NewDocumentCommand{\pigpenver}{}{%
\begingroup\pigpenfont
\setlength{\unitlength}{1em}%
\begin{picture}(1,1)
\linethickness{0.09\unitlength}
\roundcap
\polyline(0.16667,0.16667)(0.16667,0.83333)
\polyline(0.83333,0.16667)(0.83333,0.83333)
\end{picture}%
\endgroup
}
\NewDocumentCommand{\pigpenhor}{}{%
\begingroup\pigpenfont
\setlength{\unitlength}{1em}%
\begin{picture}(1,1)
\roundcap
\linethickness{0.09\unitlength}
\polyline(0.16667,0.16667)(0.83333,0.16667)
\polyline(0.16667,0.83333)(0.83333,0.83333)
\end{picture}%
\endgroup
}

\ExplSyntaxOn
\NewDocumentCommand{\pp}{m}
{% 'l b r t' is the order
\group_begin:
\pigpenfont
\raisebox{-0.16667em}
{
\clist_map_inline:nn { #1 }
{
\str_case:nn { ##1 }
{
{bt}{\pigpenhor}
{lr}{\pigpenver}
{br}{A}
{lbr}{B}
{lb}{C}
{brt}{D}
{lbrt}{E}
{lbt}{F}
{rt}{G}
{lrt}{H}
{lt}{I}
}
}
}
\group_end:
}
\ExplSyntaxOff

\begin{document}

ABC\pp{lr,br,lrt,lt,bt}DEF

\end{document}


• In the definition of pigpenver the lines \linethickness{0.09\unitlength} and \roundcap are exchanged, compared to the definition of pigpenhor, and it seems like this causes the symbol to shift to the right, at least when I compile it on my system. – Stefan Hamcke Mar 10 '16 at 13:20
• Thank you for your answer! I'm testing the in-line appearance right now, and the symbols are to elevated, so I adjust the numbers. That also means I have to refrain from using the symbols in the pigpen package and that I'll define them manually, which is easy using the pict2e package like you do here. – Stefan Hamcke Mar 10 '16 at 13:28
• @StefanHamcke I can add an automatic way for shifting all symbols to the baseline. – egreg Mar 10 '16 at 13:34
• One question: When I define a symbol pigpenlt with the edges at the left and the top, and I add the line {lt}{\pigpenlt} to the block, the symbol does not appear when I write \pp{lt}. It works with a single letter mapped to \pigpenlt, though. Can we change the code so I can use two letters? – Stefan Hamcke Mar 10 '16 at 13:37
• @StefanHamcke Not really: I map letter by letter, so just one is seen at a time. One could devise a notation such as \pp{h/lt/v/lt} or similar. – egreg Mar 10 '16 at 13:43

If you do not care for the sharp edges, just draw a white rectangle above:

% arara: pdflatex

\documentclass{article}
\usepackage{tikz}
\usepackage{pigpen}
\newcommand{\testa}{%
\begin{tikzpicture}%
\node [inner sep=0pt, outer sep=0pt] (A) {\pigpenfont E};
\draw [draw=none,fill=white] ([xshift=2.04pt]A.south west) rectangle ([xshift=-2.04pt]A.north east);
\end{tikzpicture}%
}
\newcommand{\testb}{%
\begin{tikzpicture}%
\node [inner sep=0pt, outer sep=0pt] (B) {\pigpenfont E};
\draw [draw=none,fill=white] ([yshift=2.04pt]B.south west) rectangle ([yshift=-2.04pt]B.north east);
\end{tikzpicture}%
}

\begin{document}
{\pigpenfont ABCDEFGHI}\testa\testb
\end{document}


• Thank you! It seems like the edges become thiner when the fontsize is increased, so I'll adjust the value of xshift (2.4 seems good for 13pt). – Stefan Hamcke Mar 9 '16 at 10:47
• It would be much nicer to clip symbols B and H (or D and F resp.) in half and set them together. Together with \mathpalette... I do not have the time right now. Maybe someone else takes this approach. – LaRiFaRi Mar 9 '16 at 10:49

I assume the symbol you look for doesn't exist. From this topic \bot like symbol with two horizontal lines, I build your expected symbol:

\documentclass{article}
\usepackage{amsmath,trimclip}

\makeatletter
\DeclareRobustCommand{\Equ}{%
\mathord{\vphantom{\textendash}\mathpalette\mich@Equ\relax}%
}
\newcommand{\mich@Equ}[2]{%
\ooalign{%
$\m@th#1\textendash$\cr
{\raisebox{1.\height}{$\m@th#1\textendash$}}\cr
}%
}
\makeatother

\begin{document}

$\Equ$

$\scriptstyle \Equ$

$\scriptscriptstyle \Equ$

\end{document}


Edit:

This update permits to have the same lines for all the symbols you need. It uses MnSymbol package where some of these symbols are already implemented

\documentclass{article}
\usepackage{amsmath,trimclip}
\usepackage{MnSymbol}

\makeatletter
\DeclareRobustCommand{\Equ}{%
\mathord{\vphantom{\textendash}\mathpalette\mich@Equ\relax}%
}
\newcommand{\mich@Equ}[2]{%
\ooalign{%
{\raisebox{.5\height}{$\m@th#1\minus$}}\cr
{\raisebox{-.5\height}{$\m@th#1\minus$}}\cr
}%
}
\DeclareRobustCommand{\Ver}{%
\mathord{\vphantom{\medvert}\mathpalette\mich@Ver\relax}%
}
\newcommand{\mich@Ver}[2]{%
\ooalign{%
$\m@th#1\,\:\medvert\!\medvert$
}%
}
\makeatother

\begin{document}

$$\begin{array}{cl} \lefthalfcap & \verb|\lefthalfcap| \\ \lefthalfcup & \verb|\lefthalfcup| \\ \righthalfcap & \verb|\righthalfcap| \\ \righthalfcup & \verb|\righthalfcup| \\ \sqcup & \verb|\sqcup| \\ \sqcap & \verb|\sqcap| \\ \Equ & \verb|\Equ| \\ \Ver & \verb|\Ver| \\ \end{array}$$

\end{document}

• Thank you. I forgot to mention that I actually use some of the pigpen symbols and wanted these symbols in addition to the others, so they should have the same size and line thickness. But maybe I could also build all these symbols like you do here. It would be very kind if you could also show me how to build for example the {\pigpenfont C} symbol. – Stefan Hamcke Mar 9 '16 at 10:28