Währungssymbol: Französischer Franc II

Währungssymbol: Französischer Franc II

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 \normalsizeim Mathematikmodus in der Eingabezeile 26 ungültig.

Antwort1

Der Befehl \fontspecsollte 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}

Bildbeschreibung hier eingeben

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}

Bildbeschreibung hier eingeben

Antwort2

Das Problem scheint aufzutreten, weil v2.6 vonsiunitxschaltet die Standardeinstellung für die Modusoption von textauf 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}

Ausgabe

verwandte Informationen