home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!usc!news.service.uci.edu!unogate!mvb.saic.com!info-tex
- From: hamlin@aps.org (Chris Hamlin 2369)
- Newsgroups: comp.text.tex
- Subject: hyphen in math
- Message-ID: <9212152047.AA28011@lancelot>
- Date: Tue, 15 Dec 92 15:47:05 -0500
- Organization: Info-Tex<==>Comp.Text.Tex Gateway
- X-Gateway-Source-Info: Mailing List
- Lines: 53
-
- >>
- >>
- >> >From: <gilligan@central.bldrdoc.gov>
- >> >Subject: Re: hyphen in math mode
- >> >
- >> > I wanted to print a normal hyphen in a complex math formula. I even tried
- >> >
- >> > \edef\hm{-}
- >> >
- >> > outside math but in all my attemts I got math minus instead. Can someone
- >> > help me with this problem?
- >> >
- >> >Try \hbox{-}, as in $x - y\hbox{-}z$.
- >>
- >> This will not allow the hyphen to change sizes in sub/superscripts. I'd use
- >> {\rm-} as in $A_{y{\rm-}x}$. I do not use the NFSS, so I don't know if it
- >> will handle this properly.
-
- I don't think that {\rm-} will give a hyphen. It doesn't in my quick test.
- \mathcode`\-="2200 is used in plain and latex, and sets the - char to come
- out from family 2, the cmsy family (you can't get it from the rm font in math).
- To get the - to scale you need some tricks. Here is some code defining a \text
- macro for use with the OFSS. It allows you to use \it also. A short test follows
- the macro:
-
- \def\text#1{\relax
- \mathchoice {\hbox{\everymath{\displaystyle}\rm #1}}%
- {\hbox{\everymath{\textstyle}\rm #1}}%
- {\hbox{\everymath{\scriptstyle}%
- \def\prm{\fam\z@ \the\scriptfont\z@ \relax}%
- \def\pit{\fam\itfam \the\scriptfont\itfam \relax}%
- \rm #1}%
- }%
- {\hbox{\everymath{\scriptscriptstyle}%
- \def\prm{\fam\z@ \the\scriptscriptfont\z@ \relax}%
- \def\pit{\fam\itfam \the\scriptscriptfont\itfam \relax}%
- \rm #1}%
- }%
- }
-
- $$ foo-bar ^{foo-bar} \text{foo-bar} ^{\text{foo-bar}} $$
-
- \bye
-
- >> >
- >> >---Jon
- >>
- >> Dan Luecking
- >>
-
- My question: is there an easier/better way to do this?
-
- C.Hamlin, mis@aps.org
-