# Inline math within \newcommand using Pandoc

I'm trying to define a new command as a shortcut for typing arrows in textmode. This requires to use inline math within the command's definition, since I'd like this to work with more kinds of arrows than just \textrightarrow.

Problem is, this affects weirdly the formatting of the text put after the command. Here is a MWE :

\newcommand{\ra}{$\rightarrow$}
**hello** \ra *world*
**hello** $\rightarrow$ *world*
*hello* \ra **world**
*hello* $\rightarrow$ **world**


As you can see, italic and bold emphasis are both ignored, and the space after the arrow is removed. Additionally, it seems like the closing ** on the 3rd line is still recognised, causing some kind of shift in the markup on the 4th line.

As a workaround, you need to place {} (or even a \ as a control space) right after your customized command (within the text),

\newcommand{\ra}{$\rightarrow$}

**hello** \ra{} *world*
**hello** $\rightarrow$ *world*
*hello* \ra{} **world**
*hello* $\rightarrow$ **world**


And it will yield as follows

• Thanks for the workaround! I think I might still post an issue on GitHub though, since in LaTeX it works fine without braces. – Champitoad Nov 14 '17 at 21:37