0

I have the following definition in my latex document:

\newcommand{\emp}{\texttt{EMP}}

This eats the space after it. For example, if I type

Assume that relation \emp is fragmented

The latex output is

 Assume that EMPis fragmented (notice the lack of space after EMP).

If I change the definition to put space after EMP like this:

\newcommand{\emp}{\texttt{EMP} }

The above example works, but then I have weird spaces before punctuations that follow \emp (e.g., in \emp, I have an extra space before ,).

Is there a proper way of defining these so I won't have this problem?

ozsu
  • 2,385
  • Use \emp{} is or \emp\ is. – Phelype Oleinik May 28 '19 at 15:41
  • Thanks; I need the second version since I am not looking at emphasis. The version generally works but when I have a punctuation afterwards I need to be careful. For example, I need \emp,\ since \emp, eats up the , -- is this expected? – ozsu May 28 '19 at 16:14
  • I didn't understand your comment about emphasis. The \␣ ( represents a space) forces TeX to insert a space after the command. If you don't want the space, like in \emp, you don't need the \␣, just write \emp,. If you do \emp\, you are doing a thin-space command \,. The \emp{} version can be used anywhere: \emp{}␣is nice. \emp{}, is nice, however the \␣ version is used only where you need the space: \emp\␣is nice. \emp, is nice – Phelype Oleinik May 28 '19 at 16:20
  • Got it, thanks. I misread your \emp{} as \emph{} so that was the comments about emphasis. Sorry for that. Many thanks for the help. – ozsu May 28 '19 at 17:01
  • No problem. Glad it helped :-) – Phelype Oleinik May 28 '19 at 17:50

0 Answers0