在 newcommand 中使用西里爾字母值

在 newcommand 中使用西里爾字母值

我的目標是能夠寫:

\newcommand{\сlient_name}{Имя}

\client_name並在我的文件中全部使用。現在我收到以下錯誤:

Underfull \hbox (badness 10000) in paragraph at lines 670--670
[][]|\l_fontspec_font –ü—Ä–æ-–≥—Ä–∞–º-–º–∏-—Ä–æ-–≤–∞-

完整的錯誤截圖在這裡 -http://take.ms/opd30

我試過這個SE答案並嘗試使用

\newcommand{\сlient_name}{\foreignlanguage{russian}{Имя}}

但這沒有幫助。

如何在 /newcommand 變數中使用西里爾字母值?

答案1

考慮以下最小文檔:

\documentclass{article}
\usepackage{fontspec}

\newcommand{\сlient_name}{Имя}


\begin{document}

\client_name

\end{document}

運行 XeLaTeX 可以發現

! Missing $ inserted.
<inserted text> 
                $
l.4 \newcommand{\сlient_name}{Имя}

? 

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.4 \newcommand{\сlient_name}{Имя}

? 
! Missing number, treated as zero.
<to be read again> 
                   n
l.4 \newcommand{\сlient_name}{Имя}

? 
! You already have nine parameters.
\reserved@a ...xpandafter \сlient \reserved@b #10
                                                  n{
l.4 \newcommand{\сlient_name}{Имя}

? 
! Missing $ inserted.
<inserted text> 
                $
l.5 

? 
No file mohnstrudel.aux.
! Undefined control sequence.
l.9 \client
           _name
? 
! Missing $ inserted.
<inserted text> 
                $
l.9 \client_
            name
? 
! Missing $ inserted.
<inserted text> 
                $
l.10 

? 

請注意,第一個錯誤正是在\newcommand嘗試時出現的。之後發生的事情是完全無法預測的。

_修復命令名稱中的錯誤:這是不允許的,請參閱指令/巨集名稱不能包含數字和符號

相關內容