7

I am trying to create a new math symbol. Could someone please help me with it?

My current code:

enter image description here

\documentclass[12pt]{report}
\RequirePackage{tikz}

\newcommand{\eq}{\begin{tikzpicture}%
    [scale=.175, line width=0.5pt]
    \draw (-1,1) -- (0,0);
    \draw (0,1) -- (-0.5,0.5);
    \draw (0,-1) -- (-1,0);
    \draw (-0.5,-0.5) -- (-1,-1);
    \end{tikzpicture}}

\begin{document}
\[ u - \eq - u \]
\end{document}

However, the symbol I am actually going for is this:

enter image description here

I was using it for something like this:

enter image description here

4
  • A tip: If you indent lines by 4 spaces or enclose words in backticks `, they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). Commented Feb 8 at 20:17
  • 1
    I've taken the liberty of making your code minimally compiable. Feel free to revert. Commented Feb 8 at 20:28
  • Please tell us more about the intended use of this symbol. E.g., is is supposed to denote a binary operator (such as + and -) or a relational operator (such as = and \ne)? Commented Feb 8 at 20:30
  • @mico similar to equivalence. I wanted it to have some relation to "adjunction". Commented Feb 9 at 12:51

2 Answers 2

7

To generate the symbol shown in your second screenshot, you need to change the four \draw commands that are part of the tikzpicture environment. And, since you mention that it is supposed to represent a "twisted equal" symbol, I would assign it status mathrel.

enter image description here

Your tikz code assumes, at least implicitly, that the symbol will only ever be used in \displaystyle or \textstyle math mode, but not in \scriptstyle mode, let alone \scriptscriptstyle mode. Please advise if that's not your intention.

\documentclass[12pt]{report}
\RequirePackage{tikz}
\usepackage{amsmath} % for 'gather*' environment
\newcommand{\eq}{\mathrel{\begin{tikzpicture}%
    [scale=.175, line width=0.5pt]
    \draw (-1,-1) -- (0,0);
    \draw (-1,0) -- (-0.5,-0.5);
    \draw (0,-1) -- (1,0);
    \draw (0.5,-0.5) -- (1,-1);
    \end{tikzpicture}}}
\begin{document}
\begin{gather*}
u = v \\
u \eq v
\end{gather*}
\end{document}

Addendum: If the two parts of the symbol should be snugged up a bit, I'd use the following code:

\newcommand{\eq}{\mathrel{\begin{tikzpicture}%
    [scale=.175, line width=0.5pt]
    \draw (-1,-1) -- (0,0);
    \draw (-1,0) -- (-0.5,-0.5);
    \draw (-0.3,-1) -- (0.7,0);
    \draw (0.2,-0.5) -- (0.7,-1);
    \end{tikzpicture}}}

enter image description here

7

Here a possible realization without tikz

\documentclass{article}
\usepackage{amssymb,graphicx,drcutils}

\makeatletter
\newcommand*{\eq}{\mathrel{\mathpalette\eq@\relax}}% replace \mathrel if necessary
\newcommand*{\eq@}[2]{%
   \rotatebox[origin=c]{180}{\m@th$#1\righthreetimes$}\mkern-6mu\rightthreetimes
}
\makeatother

\begin{document}
$a \eq b$
$\scriptstyle a \eq b$
$\scriptscriptstyle a \eq b$
\end{document}

enter image description here

And for fun... picture mode!

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

\makeatletter
\newcommand*{\eq}{\mathrel{\mkern1mu\mathpalette\eq@\relax\mkern1mu}}
\newcommand*{\eq@}[2]{%
   \setbox\z@=\hbox{\m@th$#1=\mkern-2mu$}%
   \unitlength\wd\z@
   \begin{picture}(1,.5)
   \linethickness{\fontdimen8\ifx#1\scriptscriptstyle\scriptscriptfont\else\ifx#1\scriptstyle\scriptfont\else\textfont\fi\fi3}
   %\roundcap % uncomment for round line ends
   \Line(0,0)(.5,.5)
   \Line(.5,0)(1,.5)
   \Line(0,.5)(.25,.25)
   \Line(.75,.25)(1,0)
   \end{picture}
}
\makeatother

\begin{document}
$a \eq b$
$\scriptstyle a \eq b$
$\scriptscriptstyle a \eq b$

$a = b$
$\scriptstyle a = b$
$\scriptscriptstyle a = b$
\end{document}

enter image description here

6
  • 1
    @Mico Using a given font means you'll have to take what the font provides :-) One could start scaling the symbol horizontally, but I'm not sure it's quite worth the trouble. Maybe I'll post a pict2e answer, if David or egreg don't precede me :-) Commented Feb 8 at 21:05
  • 1
    @Mico Picture mode added :-D Commented Feb 8 at 21:28
  • 2
    Very good code with pict2e, but I'd suggest to add some sidebearings: change into \newcommand*{\eq}{\mathrel{\mspace{1mu}\mathpalette\eq@\relax}\mspace{1mu}} and \sbox\z@{\m@th$#1=\mspace{-2mu}$}% instead of the \setbox line. Commented Feb 9 at 10:46
  • 1
    @campa what advantage does this have over tikz version? Commented Feb 9 at 12:50
  • 2
    @Entropy I come from a time when computers were slow and loading large packages took a lot of time. Tikz is of course great and I use it regularly, but loading it just for four straight lines is an overkill. Otherwise none. Commented Feb 9 at 13:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.