TeX - LaTeX Asked by Andrews on October 1, 2021
I need to use symbols varheartsuit
and vardiamondsuit
in package fdsymbol
without changing other fonts, so I can’t using command usepackage{fdsymbol}
.
This answer suggest using DeclareSymbolFont
and DeclareMathSymbol
, but simple replacement doesn’t work here.
So how can I do a similar job?
Thanks for your time and effort.
This is a short working example:
documentclass{article}
DeclareFontFamily{U}{FdSymbolA}{}
DeclareFontShape{U}{FdSymbolA}{m}{n}{<->FdSymbolA-Book}{}
DeclareSymbolFont{extrasymbols}{U}{FdSymbolA}{m}{n}
DeclareMathSymbol{vardiamondsuit}{mathord}{extrasymbols}{182}
DeclareMathSymbol{varheartsuit}{mathord}{extrasymbols}{184}
begin{document}
$vardiamondsuitvarheartsuit$
end{document}
Explanation:
vardiamondsuit
is defined as the 182nd character in FdSymbolA-Book.pfb.
varheartsuit
is defined as the 184th character in FdSymbolA-Book.pfb.
Result:
Correct answer by domperor on October 1, 2021
To add to @domperor's answer, for symbols in text mode, the usefont
command can be used.
MWE
documentclass{article}
DeclareFontFamily{U}{FdSymbolA}{}
DeclareFontShape{U}{FdSymbolA}{m}{n}{<->FdSymbolA-Book}{}
newcommandvardiamondsuit{{usefont{U}{FdSymbolA}{m}{n}char182}}
newcommandvarheartsuit{{usefont{U}{FdSymbolA}{m}{n}char184}}
begin{document}
xvardiamondsuitvarheartsuit x
end{document}
Addendum:
There are various packages, like fonttable
, for displaying the contents of a font.
Or you can just loop
through the <=256 char
s of a legacy font (note: some Unicode fonts have thousands of glyphs):
MWE
documentclass[12pt]{article}
usepackage{xcolor}
%usepackage{fdsymbol}
DeclareFontFamily{U}{FdSymbolA}{}
DeclareFontShape{U}{FdSymbolA}{m}{n}{<->FdSymbolA-Book}{}
%=============== font table labels
newcommandftlabel[1]{{usefont{OT1}{lmr}{m}{n}scriptsize #1}}
%------------------- font table
newcommanddisplayglyphs{%
count255 = 0
loop
iffontcharfontnumbercount255{%*
ftlabel{[numbercount255 =}colorbox{yellow!30}{textcolor{red!70!blue!80}{{largecharnumbercount255}}}ftlabel{] } %need space for line-breaking
}fi
ifnumcount255 < 256
advancecount255 by 1
repeat
}
%=====================================
begin{document}
usefont{U}{FdSymbolA}{m}{n}
displayglyphs
end{document}
Answered by Cicada on October 1, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP