0

I had created an abbreviation (abv) shortcut using the newcommand. However the command did not render as expected. Specifically, there is a gap between the abv and punctuation marks (See line 1 of the attached Figure). To address this, I manually add spacing between the last two curly bracket. While this did solved the aforementioned problem, but it removed spacing between the abv and text, especially in the middle of sentence (See line 2 of the attached Figure).

May I know how to solve this issue.

Thanks in advanceenter image description here

Updated: Solved using

 \usepackage{xspace}
 \newcommand{\STTbSpace}{STT\textsubscript{b}\xspace}

&&&&&&&&&&&&&&&&&&&&&&&

 \documentclass[a4paper,12pt]{report} 

 \newcommand{\STTbSpace}{STT\textsubscript{b} } % Spacing between the last two curly bracket
  \newcommand{\STTbNoSpace}{STT\textsubscript{b}} % No spacing between the last two curly bracket
 \newcommand{\Fm}{F\textsubscript{1}-m }

 \begin{document}

     When the \STTbSpace in the mid of sentence versus at the end \STTbSpace.

     When the \STTbNoSpace in the mid of sentence versus at the end \STTbNoSpace.

     Similarly \Fm.
 \end{document} 
rpb
  • 171
  • 1
    Write in the input \STTbNoSpace{} in the mid ... to terminate the command. – Ulrike Fischer Jul 11 '19 at 08:31
  • Hi Ulrike, thanks for the quick response. While your proposed idea is an interesting work around, but it require some effort especially if the abv to be used for multiple times – rpb Jul 11 '19 at 08:36
  • 2
    it is not a work-around. It is the recommended syntax. TeX swallows spaces after command names and this is the way to stop this. – Ulrike Fischer Jul 11 '19 at 08:37
  • Thanks for the clarification. – rpb Jul 11 '19 at 08:41
  • Also if these are math variables thye ought to be marked with math mode, and you don't need the {}. – daleif Jul 11 '19 at 08:44
  • 2
    One should mention that the original author of xspace does advocate against its usage. It does create more hard to debug border cases than it's worth. You'll have to prove read every sentence in which you used an xspace dependent macro, see https://tex.stackexchange.com/questions/86565/drawbacks-of-xspace. Just use the correct syntax of putting {} or \ (that is a backslash followed by a space) after the macro. – Skillmon Jul 11 '19 at 08:51

0 Answers0