0

I am relatively new to LaTeX, so please bear with me.

I have just started using macros and finding them quite useful. However, I find myself having to use the tilde (~) a lot of times to get a space between the macro defined string and the next word.

Example:

\newcommand{\ftp}{File Transfer Protocol}

but when I write this:

The \ftp is awesome because blah blah blah.

I get this (note there isn't a space between 'Protocol' and 'is'):

The File Transfer Protocolis awesome blah blah blah.

so I have to use the tilde:

the \ftp~is awesome because blah blah blah.

so that I can get that space:

The File Transfer Protocol is awesome blah blah blah.

My question is then: is there anyway I can avoid having to type the tilde every time?

Qrrbrbirlbel
  • 119,821
nunos
  • 1,019
  • 4
    Have a look at the xspace package. – Peter Grill Mar 13 '13 at 18:58
  • That looks like what I am looking for yes. However, it doesn't show up on the MikTeX package manager... Am I supposed to install it manually or sth? Thanks. – nunos Mar 13 '13 at 19:26
  • 2
    @nunos It should be installed as it belongs to the required tools package. Also, do not use ~ here as it forces a space that is not breakable. Better would be \. – Qrrbrbirlbel Mar 13 '13 at 19:33
  • Hm.. Can you please take a look here then? http://pastebin.com/q4KVFdMX. I am still not getting a space after the macro. Thanks. – nunos Mar 13 '13 at 19:41
  • 1
    @nunos Have you seen the linked duplicated question? You need to actually use \xspace: \newcommand{\foobar}{Foobar\xspace} – Qrrbrbirlbel Mar 13 '13 at 20:20
  • Another option, which I quite like, is to write the {\ftp} is awesome.... The advantage of this over ~ or \ is that it's independent of whether your macro is followed by a space or a punctuation mark. E.g. I like {\ftp} and more {\ftp}. – John Wickerson Mar 13 '13 at 20:59
  • @Qrrbrbirlbel you're so right. I skimmed through the duplicate question and thought it would work just by using the package. It works now with the \xspace. Thanks. – nunos Mar 13 '13 at 22:05

0 Answers0