0

This question already has an answer here:

My goal is to be able to write:

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

and use \client_name all over in my document. Right now I'm getting following errors like this:

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

Full errors screenshot here - http://take.ms/opd30

I tried this SE answer and tried using

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

but it didn't help.

How can I accomplish using cyrillic values in /newcommand variables?

marked as duplicate by Alan Munn, egreg macros Apr 26 '17 at 17:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Welcome to TeX.SX! You can't use an underscore in a macro name to begin with. – egreg Apr 26 '17 at 17:06
  • I tried to delete all current macros, leaving only one and using camel case. Now I'm getting this error: ./technical_specification.tex:236: Package microtype Error: Font expansion does not work with xetex. – mohnstrudel Apr 26 '17 at 17:17
  • It's impossible to tell without seeing a minimal document producing the error. But the error message is telling you something, isn't it? – egreg Apr 26 '17 at 17:19
  • I tried to google the new error, it leads me to this - tex.stackexchange.com/questions/118713/… Further research leads me to regions which I utterly don't understand. While I generally like the idea of using some sort of semi code to produce documents, this whole bibtex/lualutex/xelatex area drives me insane. I just want to use some simple variables instead of typing text over and over again. But, alas, I will stick to it. Sorry for bothering. – mohnstrudel Apr 26 '17 at 17:26
  • You can define \clientname. – egreg Apr 26 '17 at 17:40
0

Consider the following minimal document:

\documentclass{article}
\usepackage{fontspec}

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


\begin{document}

\client_name

\end{document}

Running XeLaTeX over it reveals

! 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 

? 

Note the first error is exactly when \newcommand is being attempted. What happens later is completely unpredictable.

Fix the error, which is having _ in the command name: this is not allowed, see Command/macro name cannot include numbers and symbols

  • It is important to switch, whatever it is (looks like a compiler to me) to LuaLaTeX from XeLaTeX. Using the latter one I'm receiving following error: Package microtype Error: Font expansion does not work with xetex. (I'm not using an underscore for my variable name). After switching compiler to the first one I can process the document and generate my pdf! – mohnstrudel Apr 26 '17 at 17:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.