
Dies ist eine Folgefrage zuWährungssymbol: Französischer Franc.
Betrachten Sie das folgende Beispiel:
\documentclass{article}
\usepackage{fontspec}
\usepackage{siunitx}
\DeclareRobustCommand*{\myfranc}{%
\begingroup
\fontspec{FreeSerif.otf}%
^^^^20a3%
\endgroup
}
\DeclareSIUnit{\franc}{\myfranc}
\setmainfont[
BoldFont = lmroman10-bold.otf,
ItalicFont = lmroman10-italic.otf,
BoldItalicFont = lmroman10-bolditalic.otf,
SlantedFont = lmromanslant10-regular.otf,
BoldSlantedFont = lmromanslant10-bold.otf,
SmallCapsFont = lmromancaps10-regular.otf
]{lmroman10-regular.otf}
\begin{document}
\SI{1000}{\franc}
\end{document}
Dies (das ist Heiko Oberdieks letzter Vorschlag in seinemAntwort) hat vorher funktioniert, aber jetzt nicht mehr; jetzt wird nur noch die Menge gedruckt, nicht aber die Einheit (französisches Franc-Symbol). Wie kann ich das beheben?
Und wie entferne ich die folgende Schriftartwarnung?
Befehl
\normalsize
im Mathematikmodus in der Eingabezeile 26 ungültig.
Antwort1
Der Befehl \fontspec
sollte niemals in einem Dokument verwendet werden; definieren Sie eine Schriftfamilie und verwenden Sie diese.
\documentclass{article}
\usepackage{fontspec}
\usepackage{siunitx}
\DeclareRobustCommand*{\myfranc}{%
\mbox{\freeserif^^^^20a3}%
}
\DeclareSIUnit{\franc}{\myfranc}
\setmainfont[
BoldFont = lmroman10-bold.otf,
ItalicFont = lmroman10-italic.otf,
BoldItalicFont = lmroman10-bolditalic.otf,
SlantedFont = lmromanslant10-regular.otf,
BoldSlantedFont = lmromanslant10-bold.otf,
SmallCapsFont = lmromancaps10-regular.otf
]{lmroman10-regular.otf}
\newfontfamily{\freeserif}{FreeSerif.otf}
\begin{document}
\SI{1000}{\franc}
\end{document}
Sie können ₣
bei Bedarf auch direkt eingeben:
\documentclass{article}
\usepackage{fontspec}
\usepackage{siunitx}
\usepackage{newunicodechar}
\setmainfont[
BoldFont = lmroman10-bold.otf,
ItalicFont = lmroman10-italic.otf,
BoldItalicFont = lmroman10-bolditalic.otf,
SlantedFont = lmromanslant10-regular.otf,
BoldSlantedFont = lmromanslant10-bold.otf,
SmallCapsFont = lmromancaps10-regular.otf
]{lmroman10-regular.otf}
\newfontfamily{\freeserif}{FreeSerif.otf}
\newunicodechar{₣}{\text{\freeserif ₣}}
\newcommand{\FF}{₣}
\DeclareSIUnit{\franc}{\FF}
\begin{document}
\SI{1000}{\franc} is 1000\,₣ or \SI{1000}{₣}
\end{document}
Antwort2
Das Problem scheint aufzutreten, weil v2.6 vonsiunitx
schaltet die Standardeinstellung für die Modusoption von text
auf um math
.
\documentclass{article}
\usepackage{fontspec}
\usepackage{siunitx}
\DeclareRobustCommand*{\myfranc}{% thanks to egreg and Manuel
\begingroup
\freeserif^^^^20a3%
\endgroup
}
\DeclareSIUnit[mode = text]{\franc}{\myfranc}
\newfontfamily{\freeserif}{FreeSerif.otf}
\begin{document}
\SI{1000}{\franc}
\end{document}