貨幣符號:法國法郎II

貨幣符號:法國法郎II

這是一個後續問題貨幣符號: 法國法郎

考慮以下範例:

\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}

這是 Heiko Oberdiek 在他的文章中最後的建議回答) 以前有效,但現在不再有效;現在只列印數量,而不列印單位(法郎符號)。我該如何解決?

另外,如何刪除以下字體警告?

命令\normalsize在輸入行 26 的數學模式下無效。

答案1

該命令\fontspec絕不能在文件中使用;定義一個字體系列並使用它。

\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}

在此輸入影像描述

如果您願意,也可以直接輸入:

\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}

在此輸入影像描述

答案2

看來這個問題是因為 v2.6 出現的siunitx將模式選項的標準設定從text切換為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}

輸出

相關內容