🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #107

Re: How to test if \tenrm is using CM or AM fonts?

#107
From: leichter
Date: Fri, 30 Oct 1992 00:34
31 lines
1570 bytes
In article <1992Oct28.054929.9327@midway.uchicago.edu>,
trivedi@rabi.uchicago.edu (Anil Trivedi) writes:
| A brief question for TeXperts: 
| 
| How can you test (within a job) if \tenrm is cmr10, as it usually
| is now a days, or amr10, as in the older versions?
| 
| I tried: 
| 		\def\tenrmname{\fontname\tenrm}
| 		\def\cmrten{cmr10}
| 		\message{\tenrmname}
| 		\message{\cmrten}
| 		\ifx\tenrmname\cmrten\message{y}\else\message{n}\fi
| but I get: 
| 		cmr10 cmr10 n

You've got two problems.  First, \tenrmname doesn't contain "cmr10", it
contains \fontname\tenrm, so you aren't comparing what you think you are
comparing.  You can fix that by doing:

| 		\edef\tenrmname{\fontname\tenrm}
		 ^

But then it STILL won't work, because the catcodes of the characters \fontname
gives you for "cmr" are "other", not "letter".  There's probably a simpler
way to do this, but the following hack works:

	\edef\x{\meaning\cmrten} \edef\y{\meaning\tenrmname}
	\ifx\x\y\message{y}\else\message{n}\fi

							-- Jerry
Technical Details
Message-ID: <1992Oct29.193426.1@zodiac.rutgers.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!ames!sun-barr!rutgers!igor.rutgers.edu!zodiac.rutgers.edu!leichter
References: <1992Oct28.054929.9327@midway.uchicago.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!ames!sun-barr!rutgers!igor.rutgers.edu!zodiac.rutgers.edu!leichter
From: leichter@zodiac.rutgers.edu
Newsgroups: comp.text.tex
Subject: Re: How to test if \tenrm is using CM or AM fonts?
Message-ID: <1992Oct29.193426.1@zodiac.rutgers.edu>
Date: 30 Oct 92 00:34:26 GMT
References: <1992Oct28.054929.9327@midway.uchicago.edu>
Sender: news@igor.rutgers.edu
Organization: Rutgers University Department of Computer Science
Lines: 31
Nntp-Posting-Host: pisces.rutgers.edu