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 :

**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),


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

And it will yield as follows

enter image description here

  • 1
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.