I'd like to have easy access to commonly used relation symbols in text mode, just as they are easily accessible in math mode. An important example is ⊕, or \oplus
. I'd like to configure the control symbol \+
to use it:
\documentclass{article}
\usepackage{amsmath}
\NewDocumentCommand{\+}{}{\ensuremath{\oplus}}
\begin{document}
\section{Upright}
a \+ b\\
$ \text{a} \oplus \text{b} $
\section{Italics}
\textit{a} \+ \textit{b}\\
$a \oplus b$
\end{document}
While this works, I still need to optimise the spacing so that it matches, or is similar to, the spacing in math mode:
I've tried the following:
- changing the value of
\mathsurround
in the definition, i.e.\NewDocumentCommand{\+}{}{\mathsurround=0pt\ensuremath{\oplus}}
(I believe this is already the default) - using
\mathrel
around\oplus
in the definition.
None of these approaches have worked. One additional idea I had was to access the \oplus
symbol directly, but the Unicode symbol would not link to the math relation symbol in the font I use. Is there another way?
\NewDocumentCommand{\+}{}{\ensuremath{\mbox{}\oplus\mbox{}}}
and use\+
without surrounding spaces in text mode.