8

I'd like to use the symbol given by textordmasculine from the textcomp package.

But I don't want to load textcomp since it is too much and I only want that symbol (in fact I need the masculine order symbol with the underline and I didn't find this symbol except using textcomp).

From CTAN I found

\DeclareTextSymbol{\textordmasculine}{TS1}{'272}
\DeclareTextSymbolDefault{\textordmasculine}{TS1}

but have no idea how to use these lines to load that symbol.

If I use both I get

Encoding scheme `TS1' unknown. ...ontFamily{TS1}{cmr}{\hyphenchar\font\m@ne}
Encoding scheme `TS1' unknown. \DeclareFontFamily{TS1}{phv}{}
  • 3
    You may be interested in Importing a Single Symbol From a Different Font – Werner Jul 12 '13 at 23:29
  • I known that there is such post but i couldn't find it. Thanks. – Sigur Jul 12 '13 at 23:32
  • @Sigur There's no need to add the \DeclareSymbolFont; just the \DeclareFontFamily{U}{myts}{} and suitable \DeclareFontShape commands. Then you can define \textordmasculine to be {\fontencoding{U}\fontfamily{myts}\selectfont\symbol{'272}} Anyway, I don't see why not loading textcomp – egreg Jul 12 '13 at 23:40
  • @egreg, thanks. I don't know if textcomp will affect something else and since I want only one symbol I'm trying to avoid it, also I don't know if it comes with base install. Well, sorry but I'm not able to follow your suggestion. I tried on preamble \DeclareFontFamily{U}{myts}{} and \def\textordmasculine{\fontencoding{U}\fontfamily{myts}\selectfont\symbol{'272}} but it does not work. – Sigur Jul 12 '13 at 23:50
  • 3
    @Sigur textcomp is part of the latex core release, it is like article class, a mandated part of any latex installation. – David Carlisle Jul 13 '13 at 0:36
12

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

Result

  • Method three is basically what I do in siunitx to load a few required symbols without having to require textcomp. – Joseph Wright Jul 13 '13 at 9:20
  • Thanks. Nice explanation. How did you know that the symbol number would be 186? – Sigur Jul 13 '13 at 19:24
  • 1
    @Sigur: I have looked it up in ts1enc.def. – Heiko Oberdiek Jul 13 '13 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.