# Remove spacing from equals so that it acts like a variable

I am trying to write a natural isomorphism (the adjunction) between two hom-functors. The spacing for the first argument - is removed, as desired, but the second argument = has the spacing of a binary operator, even though it only has a parenthesis on its right-hand side. I.e., the following:

i:\mathcal{D}(F-,=)\Rightarrow \mathcal{C}(-,G=)


Looks like this:

How can I remove the spacing after the G before the = so it's like the spacing after the F before the -?

• \smash{<argument>} maybe? Something like $\smash{=}$ Mar 4, 2017 at 17:52
• @azetina That works but is not its main purpose: \smash kills the vertical height of a symbol, but also results in a \mathord so the horizontal spacing is that of a symbol. Mar 4, 2017 at 18:00
• @AndrewSwann good observation. Mar 4, 2017 at 18:01

To make something act as ordinary character in math mode it is sufficient to put it in curly brackets {...}. This then becomes a \mathord and gets the appropriate spacing.

\documentclass{article}

\begin{document}

\begin{displaymath}
i\colon\mathcal{D}(F-,=)\Rightarrow \mathcal{C}(-,G{=})
\end{displaymath}

\newcommand{\eq}{{=}}
\begin{displaymath}
i\colon\mathcal{D}(F-,\eq)\Rightarrow \mathcal{C}(-,G\eq)
\end{displaymath}

\end{document}


You might want to define a short-hand, e.g. \eq for this as I have with the \newcommand{\eq}{{=}} above.

For this semantic case, @egreg suggest a better macro like:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\blank}[1][1]{%
\ifcase#1\relax\or{-}\or{=}\or{\equiv}\fi
}

\begin{document}

$i\colon\mathcal{D}(F\blank,\blank[2])\Rightarrow \mathcal{C}(\blank,G\blank[2])$

\end{document}


@VF1 points to Four line equality to get a four line symbol. However, that quickly gets unreadable, so I suggest using something like <n> above the dash. Here are two macros \nblank and \xblank that will do that. The second \xblank is a version that extends to fit the label above.

\documentclass{article}

\usepackage{amsmath}

\newcommand{\blank}[1][1]{%
\ifcase#1\relax\or{-}\or{=}\or{\equiv}\or\nblank{#1}\fi
}

\newcommand{\shortstrut}{\vrule width 0pt height 0.8ex}
\newcommand{\nblank}[1]{\overset{\langle #1\rangle}{\shortstrut\smash[t]{-}}}

\makeatletter
\newcommand{\xblank}[1]{\setbox\z@%
\hbox{\m@th$\cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill \displaystyle$}%
\def\@tempa{\mkern1mu{\langle #1\rangle}\mkern1mu}%
\setbox\tw@\hbox{\m@th$\scriptstyle\@tempa$}%
{\mathop{\shortstrut\hbox to \wd\tw@{\unhbox\z@}}\limits^{\@tempa}}}
\makeatother

\begin{document}

\begin{displaymath}
i\colon\mathcal{D}(F\blank,\blank[2])\Rightarrow
\mathcal{C}(\blank,G\blank[2])
\end{displaymath}

\begin{displaymath}
r(\blank,\nblank{2},\dots,\nblank{n}) = (\nblank{n},\dots,\nblank{2},\blank)
\end{displaymath}

\begin{displaymath}
s(\blank,\dots,\xblank{1001637}) = \xblank{37}
\end{displaymath}

\end{document}

• Is it necessary to use the display math environment? Mar 4, 2017 at 17:56
• No, this works in any math environment and inline between dollars $...$. Mar 4, 2017 at 17:57
• This is definitely the most direct solution. I was hoping that perhaps the use of - for the first argument, = for the second, and \equiv for the third was just a hack (which results in the necessity of this workaround). Would you happen to know if there's something built-in for making an arbitrary number of horizontal bars as argument placeholders, perhaps from some category theory package?
– VF1
Mar 4, 2017 at 17:58
• Its just a weird way of showing the mwe. Why would he need to define a new command for it? Mar 4, 2017 at 17:58
• @azetina To distinguish the cases where = is not being used for the equality. I regularly use \newcommand{\Hodge}{{*}} for the Hodge star operator, which does not have the usual spacing of the * symbol. Mar 4, 2017 at 18:03