使用 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

相关内容