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試行されたときに発生することに注意してください。その後に何が起こるかは完全に予測できません。

_コマンド名にエラーがある問題を修正しました。これは許可されていません。コマンド/マクロ名には数字や記号を含めることはできません

関連情報