Math & Science ⇒ Defining math operators that accept input.
-
- Posts: 2
- Joined: Thu Jan 05, 2012 8:27 pm
Defining math operators that accept input.
I am writing a paper that requires arbitrary R-module homomorphism groups Hom_R(*,X) and Hom_R(X,*)to be typed frequently. I would like to declare math operators that take input so that I can type "\rHom{B}" and have the output "Hom_R(B,X)" and type "\lHom{A}" and have the output "Hom_R(X,A)". So far the best I can come up with still requires me to type out the _R(B,X) part.
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Defining math operators that accept input.
I'm having to guess somewhat as to what you want the input commands to be, but how about this:dtmurphree wrote:I am writing a paper that requires arbitrary R-module homomorphism groups Hom_R(*,X) and Hom_R(X,*)to be typed frequently. I would like to declare math operators that take input so that I can type "\rHom{B}" and have the output "Hom_R(B,X)" and type "\lHom{A}" and have the output "Hom_R(X,A)". So far the best I can come up with still requires me to type out the _R(B,X) part.
Code: Select all
\newcommand*{\rHom}[2]{\mathrm{Hom_R}(#1,#2)}
\newcommand*{\lHom}[2]{\mathrm{Hom_R}(#2,#1)}
Code: Select all
\rHom{B}{X} \lHom{A}{X}
-
- Posts: 2
- Joined: Thu Jan 05, 2012 8:27 pm
Defining math operators that accept input.
kaiserkarl13 wrote:I'm having to guess somewhat as to what you want the input commands to be, but how about this:dtmurphree wrote:I am writing a paper that requires arbitrary R-module homomorphism groups Hom_R(*,X) and Hom_R(X,*)to be typed frequently. I would like to declare math operators that take input so that I can type "\rHom{B}" and have the output "Hom_R(B,X)" and type "\lHom{A}" and have the output "Hom_R(X,A)". So far the best I can come up with still requires me to type out the _R(B,X) part.Then you would typeCode: Select all
\newcommand*{\rHom}[2]{\mathrm{Hom_R}(#1,#2)} \newcommand*{\lHom}[2]{\mathrm{Hom_R}(#2,#1)}
to get "Hom_R(B,X) Hom_R(X,A)"Code: Select all
\rHom{B}{X} \lHom{A}{X}
Thank you so much! This was almost exactly what I was looking for, and close enough for me to get what to do next. I kept trying to do it as a
Code: Select all
\DeclareMathOperator
Code: Select all
\newcommand*{\rHom}[1]{\mathrm{Hom_R}(#1,X)}
\newcommand*{\lHom}[1]{\mathrm{Hom_R}(X,#1)}