0

I am writing something in Persian language, and I want to manage the space between some words.
I defined:

\newcommand{\nf}{\char\value{226}\char\value{128}\char\value{140}}

But after building the document, I see "! Missing number, treated as zero" error at each line I've used \nf ...
Here is a short example file:

    \documentclass[11pt,oneside,a4paper]{report}
\usepackage{xepersian}
\settextfont{Yas}
\newcommand{\nf}{\char\value{226}\char\value{128}\char\value{140}}

\begin{document}
اگر $n$ نقطهٔ رنگی در صفحه از $k$ رنگ مختلف داشته باشیم، می\nf
خواهیم یک شکل هندسی (دایره، مثلث و ...) را طوری در صفحه قرار دهیم که از هر رنگ دست\nf
کم یکی پوشانده شود.
\end{document}

I am using TeXMaker 4.4.1 on Ubuntu 1604; What's wrong?!

f44
  • 3

1 Answers1

2

The macro \value refers to the value of a counter. I doubt that there are counters with names 226, 128, and 140. I assume you meant the numbers:

\char226 \char128 \char140

In LaTeX provides the macro \symbol (that takes care of the proper ending of the number):

\newcommand*{\nf}{\symbol{226}\symbol{128}\symbol{140}}

But the numbers raise the suspicion that this is meant as a Unicode character encoded as UTF-8. This is a different story.

With 8-bit TeX engines this can be written as:

\newcommand*{\nf}{^^e2^^80^^8c}

But with Unicode-aware TeX engines (XeTeX, LuaTeX), the character can be specified directly. Or with the ^-notation (The ^^ notation in various engines):

\newcommand*{\nf}{^^^^200c}

The symbol is: U+200C ZERO WIDTH NON-JOINER

Heiko Oberdiek
  • 271,626
  • It was not work in this way too! I have question marks at each \nf, in output pdf :( – f44 May 25 '17 at 10:19