I put omegas in my text as needed using a command:
\newcommand{\ohm}{$\Omega$ }
Then I needed other symbols so I included package gensymb
. But when I do, \ohm is already defined. So I tried using the one defined in the library. It does not add a space afterward, not sure why. My \kohm
and \Mohm
work fine. I'm not sure whether I should be overriding the \ohm
command. What is the best approach to solve this problem?
MWE:
\documentclass[12pt]{book}
\usepackage{gensymb}
\newcommand{\fahren}{\degree F}
%\newcommand{\cels}{\degree C}
%\newcommand{\ohm}{$\Omega$ }
\newcommand{\kohm}{k$\Omega$ }
\newcommand{\Mohm}{M$\Omega$ }
\begin{document}
test \ohm
test \kohm
test \Mohm
I measure temperature in \fahren
\end{document}
I do not want to have to add braces or a backslash after the command: \ohm{}
or \ohm\
The \kohm
command works as I want it to, inserting a space afterward because it is an equation. I suppose I can define a \ohm
command that is exactly the same as \kohm
but then I would have to replace every one of the \ohm
commands in multiple documents.
Best Answer
It's really your choice. If you want to use
\ohm
the way you defined it, the load thegensymb
package and redefine\ohm
:The redefinition is delayed until
\AtBeginDocument
, asgensymb
looks for the presence oftextcomp
in order to define an appropriate\ohm
.Forcing a space after the command wouldn't always work, as you'll see when you use something like
Check out this \ohm.
For general attempts at adding spaces of commands, see Space after LaTeX commands.