Full textcomp
\documentclass{article}
\usepackage{textcomp}
\begin{document}
\textordmasculine
\end{document}
Package textcomp
takes care of font families that do not support the full range of encoding TS1 by a concept of "subencoding".
Full encoding TS1 without textcomp
\documentclass{article}
\usepackage[TS1,OT1]{fontenc}% or T1 instead of OT1
\begin{document}
\textordmasculine
\end{document}
That assumes that the used font supports all symbols of TS1. However, \textordmasculine
is usually not missing. But other symbols like \textbullet
are redefined to use TS1 encoding.
Partial encoding TS1 with \textordmasculine
\documentclass{article}
\DeclareFontEncoding{TS1}{}{}
\DeclareFontSubstitution{TS1}{cmr}{m}{n}
\DeclareTextSymbol{\textordmasculine}{TS1}{186}
\DeclareTextSymbolDefault{\textordmasculine}{TS1}
\begin{document}
\textordmasculine
\end{document}
Then the symbol is still defined using LaTeX's NFSS2. That means font size commands, changing font attributes (\textbf
, …) work. But \textbullet
is not redefined.
Font loading via plain TeX command
If you need the symbol in one size and shape only, then you could also load the font directly. Then first create a MWE for the symbol with using textcomp
:
\documentclass{article}
\usepackage[loading]{tracefnt}
\usepackage{textcomp}
\pagestyle{empty}
\begin{document}
\textordmasculine
\end{document}
Make sure, that the font sizes and families are correct:
- Correct size option for the document class (
10pt
, 11pt
, 12pt
).
- The MWE contains all other font packages (
lmodern
, mathptx
, …).
Then run the MWE through LaTeX and look for the following information of tracefnt
:
LaTeX Font Info: External font `tcrm1000 at10.0pt' loaded as
(Font) TS1/cmr/m/n/10 on input line 6.
tcrm1000 at10.0pt
can be different depending on the font and size settings. It is the data we need for \newfont
:
\documentclass{article}
\newfont{\fonttextcomp}{tcrm1000 at10.0pt}
% \providecommand for the case `textcomp` is loaded.
\providecommand*{\textordmasculine}{%
\begingroup\fonttextcomp\symbol{186}\endgroup
}
\begin{document}
\textordmasculine
\end{document}
Limitation: The symbol will not resize or is affected by \textbf
etc. Each variant requires a new font and macro.
Summary
Because the latest method is cumbersome and has serious limitations, I would recommend the third method (or one of the first three methods).
Result
it's my understanding that the glyph names are determined by the font. (note use of the term "glyph"; characters and glyphs are related, but are not interchangeable. but that's another story.)
it's also my understanding that the names supplied by the font depend on the supplier of the font -- they may be "meaningful" in some way (e.g., an ascii letter, a unicode, a descriptive name, ...) or they may just be a supplier's internal code, as used to be the situation in the days of metal type (as shown in old monotype technical symbols listings).
things may change, but ... don't hold your breath.
adding to what ulrike has said, unicode also uses names as well as numbers. an important (but possibly irrelevant point) here is that, once both a name and a number are assigned, they are never changed, even should the name prove to be wrong, or just ill-advised.
a second point is that some glyphs are not necessarily named by a single unique unicode. a unicode is supposed to define meaning, not shape. "variant" glyphs (with the same meaning but different shape) may be represented by multiple unicodes, in two principal ways:
by using a combining diacritic, as \nvarleq
is a compound of \leq
(U+2264) and U+20D2, "combining long vertical overlay"; almost no relations negated by a vertical cancellation are represented by single unicodes, and unless the basic principles of unicode assignment change, this will remain the norm.
by adding a defined "variation selector" (U+FE00) to designate recognized (i.e., officially by unicode) variants that are unable to be modified by addition of a combining diacritic, such as \lvertneqq
(less than but not equal to with vertical negation of only the equals sign, U+2268,U+FE00).
unicode technical report #25, unicode support for mathematics, deals with these methods in sections 2.17 and 2.18 (pages 26 ff.).
Best Answer
With
pdflatex
you can't, unless you create a new set of fonts from the TrueType version. Fonts forpdflatex
have only 256 slots and no possibility of defining a variant. One could, in principle, just create new.pfb
files and use the metrics for the “normal g”, but it would be very tough work.It's easy with XeLaTeX or LuaLaTeX, as the alternate “g” is in stylistic set 2: