# Using custom symbols

As comprehensive as the existing set of symbols is, it doesn't have every possible symbol that could exist, and it really takes the fun out of inventing a new symbol if you can't typeset it nicely.

One option I know of is "combining" existing symbols in some fashion, such as negative spaces. So I could write something like m \gg\!\!= k, but that technique has obvious limitations.

What's the best approach here? ("Stop making up new symbols for no good reason" is a valid answer.)

Edit: For a bit of context my actual interest is in nicer display for typeset source code, particularly making common operators written as multiple ASCII characters look more like a single symbol. This often results in symbols not otherwise used--but recognizable to other programmers--and for which the negative spacing technique suffices. As mentioned in a comment on vanden's answer, I was curious about the more general case.

• Maybe it exists at detexify.kirelabs.org/classify.html ! Jul 27, 2010 at 0:49
• Sounds like you should program in APL :P Jul 27, 2010 at 2:59
• @Sharpie: Actually that's the symbol for binding in monads, used in Haskell. Jul 27, 2010 at 6:21
• Well, it's >>= since Haskell still uses ASCII characters. APL, on the other hand, requires whole set of non-ASCII characters to write valid programs. Jul 27, 2010 at 7:45

Whilst I wouldn't go so far as to define completely new symbols, I do occasionally find myself wanting slightly different ones than the standard set. Where I've encountered this is with arrows when lecturing: I find that I want the ⇔ to look a little more important, for example. For those cases, I redraw it using TikZ:

\newcommand{\textIff}{\tikz \draw (-3ex,.25ex) -- (-.25ex,.25ex) (-3ex,-.25ex) -- (-.25ex,-.25ex) (-.5ex,.5ex) -- (0,0) -- (-.5ex,-.5ex) (-2.75ex,.5ex) -- (-3.25ex,0) -- (-2.75ex,-.5ex);\xspace}
\newcommand{\mathIff}{\mathrel{\textIff}}
\newcommand{\Iff}{\ifmmode\mathIff\else\textIff\fi\xspace}


I guess that using TikZ rather than MetaFont for this is that I already know how to use TikZ for my other diagrams.

I am trying hard to resist introducing a dontdothat tag :-)

While there genuinely are circumstances where a new symbol is needed, most areas seem to already have an embarrassment of riches. Inventing some new symbol ought be thought over long and hard, as doing so introduces a new barrier to communication.

I think we ought to be able to introduce new symbols in TeX and friends (we can), but that it ought be hard enough to discourage frivolous novelty.

If one really wants a new symbol and setting extant symbols on top of one another just won't do, that's what METAFONT is for.

• Besides, when you have such a nice collection of ancient fonts math.harvard.edu/computing/latex/tetex/help/Catalogue/entries/… I am somewhat doubtful new symbols are strictly necessary. =) Jul 27, 2010 at 1:54
• A fair answer! Though I should probably add a disclaimer that I'm not actually intending to start inventing symbols--I was trying to figure out the best way to represent the compound symbol I used as an example and was curious about the general case... Jul 27, 2010 at 2:21
• Sure. But you are going to have to redefine some parts to make certain symbols to automagically use your condenced'' symbols.
– Dima
Jul 27, 2010 at 3:19

I use the lst environment defined by Gerold Meisinger here: http://lambdor.net/?p=273

He uses the listings environment to substitute the haskell representation of tags into the code. Notice how >>= is defined as >\!\!>\!\!=

\lstloadlanguages{Haskell}
{\lstset{}%
\csname lst@SetFirstLabel\endcsname}
{\csname lst@SaveFirstLabel\endcsname}
\lstset{
basicstyle=\small\ttfamily,
escapeinside={/+}{+/},
flexiblecolumns=false,
basewidth={0.5em,0.45em},
literate={+}{{$+$}}1 {/}{{$/$}}1 {*}{{$*$}}1
{=}{{$=$}}1 %{/=}{{$\neg$}}1
{>}{{$>$}}1 {<}{{$<$}}1 {\\}{{$\lambda$}}1
{++}{{$+\!\!\!+$}}1 {::}{{$:\!\!\!:$}}1
{\\\\}{{\char\\\char\\}}1
{->}{{$\rightarrow$}}2 {>=}{{$\geq$}}2 {<-}{{$\leftarrow$}}2
{<=}{{$\leq$}}2 {=>}{{$\Rightarrow$}}2
{\ .\ }{{$\circ$}}2 {(.)}{{($\circ$)}}2
{<<}{{$\ll$}}2 {>>}{{$\gg$}}2 {>>=}{{$>\!\!>\!\!=$}}2
{<<<}{{$\lll$}}2 {>>>}{{$\ggg$}}2 {-<}{{$\leftY$}}1 {^<<}{{$\hat{}\!\!\ll$}}2 {^>>}{{$\hat{}\!\!\gg$}}2
{|}{{$\mid$}}1
{undefined}{{$\bot$}}1
{not\ }{{$\neg$}}1
{elem}{{$\in$}}1
{forall}{{$\forall$}}1
}