使用 siunitx 的字母太多

使用 siunitx 的字母太多

當我嘗試使用 siunitx 套件的某些功能時,我遇到了這個惱人的錯誤。假設我想製作一個簡單的表格:

 \begin{table}[h!]
  \centering
  \caption{Caption for the table.}
  \label{tab:table1}
  \begin{tabular}{l|c||r}
    1 & 2 & 3 \si{\volt}\\
    \hline
    a & b & c\\
  \end{tabular}
\end{table}

如果我使用命令\si{\volt}就不會有錯誤。但如果我改用\SI{3}{\volt}它,我會得到一個錯誤。您知道發生了什麼以及如何解決嗎?

答案1

問題已經解決了。如果你想寫:

\RequirePackage{ifplatform}
\ifwindows
  \setmainfont[Ligatures=TeX,ItalicFont=RobotoCondensed-LightItalic,BoldFont=RobotoCondensed-Regular,BoldItalicFont=RobotoCondensed-Italic]{RobotoCondensed-Light}
  \setmonofont[Scale=MatchLowercase]{RobotoMono-Light} 
  \setmathfont(Greek,Digits,Latin){RobotoCondensed-Light}
  \setmathrm[ItalicFont=RobotoCondensed-LightItalic,BoldFont=RobotoCondensed-Regular,BoldItalicFont=RobotoCondensed-Italic]{RobotoCondensed-Light}
\else
  \setmainfont[BoldFont=Roboto Condensed, BoldItalicFont=Roboto Condensed Italic,ItalicFont=Roboto Condensed Light Italic,Ligatures=TeX]{Roboto Condensed Light}
  \setmonofont[Scale=.9]{Roboto Mono Light} 
  \setmathfont(Greek,Digits,Latin){Roboto Condensed Light}
  \setmathrm[ItalicFont=Roboto Condensed Light Italic,BoldFont=Roboto Condensed,BoldItalicFont=Roboto Condensed Italic]{Roboto Condensed Light}
\fi

不起作用。但是,如果你寫:

\RequirePackage{ifplatform}
\ifwindows
    \setmainfont[Ligatures=TeX,ItalicFont=RobotoCondensed-LightItalic,BoldFont=RobotoCondensed-Regular,BoldItalicFont=RobotoCondensed-Italic]{RobotoCondensed-Light}
    \setsansfont[Ligatures=TeX,ItalicFont=RobotoCondensed-LightItalic,BoldFont=RobotoCondensed-Regular,BoldItalicFont=RobotoCondensed-Italic]{RobotoCondensed-Light}
    \setmonofont[Scale=MatchLowercase]{RobotoMono-Light} 
    \setmathfont(Greek,Digits,Latin){RobotoCondensed-Light}
    \setmathrm[ItalicFont=RobotoCondensed-LightItalic,BoldFont=RobotoCondensed-Regular,BoldItalicFont=RobotoCondensed-Italic]{RobotoCondensed-Light}
    \setmathsf[ItalicFont=RobotoCondensed-LightItalic,BoldFont=RobotoCondensed-Regular,BoldItalicFont=RobotoCondensed-Italic]{RobotoCondensed-Light}
\else
    \setmainfont[BoldFont=Roboto Condensed, BoldItalicFont=Roboto Condensed Italic,ItalicFont=Roboto Condensed Light Italic,Ligatures=TeX]{Roboto Condensed Light}
    \setsansfont[BoldFont=Roboto Condensed, BoldItalicFont=Roboto Condensed Italic,ItalicFont=Roboto Condensed Light Italic,Ligatures=TeX]{Roboto Condensed Light}
    \setmonofont[Scale=.9]{Roboto Mono Light} 
    \setmathfont(Greek,Digits,Latin){Roboto Condensed Light}
    \setmathrm[ItalicFont=Roboto Condensed Light Italic,BoldFont=Roboto Condensed,BoldItalicFont=Roboto Condensed Italic]{Roboto Condensed Light}
    \setmathsf[ItalicFont=Roboto Condensed Light Italic,BoldFont=Roboto Condensed,BoldItalicFont=Roboto Condensed Italic]{Roboto Condensed Light}
\fi

我猜第二個程式碼區塊中的最後一個命令很重要。但是我找不到它的作用\setmathsf

相關內容