UTF8 不能(完全)在表中工作

UTF8 不能(完全)在表中工作

UTF8 不能像在普通文本中那樣在表格/表格中工作有什麼原因嗎?我嘗試在表格中寫一個小寫的西格瑪。在普通文字中,我只需輸入 σ 即可正確顯示。但在寫 σ 的表格中,它只是不顯示任何放置空格的內容。相反,我必須使用 \sigma。我正在使用 LuaLaTeX 進行編譯,因此 UTF8 支援應該不是問題。另外,例如 a ± 無需任何技巧即可工作。那麼為什麼所有 UTF8 符號在表格中的工作方式與在文本中的工作方式不同呢?

編輯:最小工作樣本

\documentclass{article}
\usepackage{fontspec}
\setmainfont{arial}[
    Extension = .ttf,
    UprightFont = *,
    BoldFont = *bd,
    ItalicFont = *i,
    BoldItalicFont = *bi]

\begin{document}
\renewcommand{\familydefault}{\sfdefault}
σ
\begin{table}
    \begin{tabular}{c|c}
        σ & \sigma \\
    \end{tabular}
\end{table}

\end{document}

答案1

如果要切換\familydefault,應該在之前執行\begin{document}\normalfont在之後明確使用才能實際使用它,否則當前載入的字體仍然是先前的預設字體。

還將\setmainfont字體設定為預設襯線字體(因為這是預設設定下的主要字體)。

如果您想用作Arial無襯線字體並使用此無襯線字體作為預設字體,您可以加載

\documentclass{article}
\usepackage{fontspec}
\setsansfont{arial}[
    Extension = .ttf,
    UprightFont = *,
    BoldFont = *bd,
    ItalicFont = *i,
    BoldItalicFont = *bi]

\renewcommand{\familydefault}{\sfdefault}
\begin{document}
σ
\begin{table}
    \begin{tabular}{c|c}
        σ & \sigma \\
    \end{tabular}
\end{table}

\end{document}

答案2

這與環境重置為文件預設拉丁現代無襯線無關tabulartable該文件沒有希臘語

\documentclass{article}
\usepackage{fontspec}
\setmainfont{arial}[
    Extension = .ttf,
    UprightFont = *,
    BoldFont = *bd,
    ItalicFont = *i,
    BoldItalicFont = *bi]
\showoutput
\begin{document}
\renewcommand{\familydefault}{\sfdefault}
\begin{table}
\end{table}

\end{document}

相關內容