I wanted to reduce the inter-word space for some passages in a written text with the rest of the text remaining unchanged. So I tried to use \addfontfeature
locally which I execute with the command \tight{bla}
The issue now is that everything after the \addfontfeature
is also affected by it. Even when I add a second \addfontfeature
(executed by \nottight{bla}
) to reverse the effect, I get the same result.
What am I doing wrong?
MWE:
% !TEX TS-program = LuaLaTeX
\documentclass{scrartcl}
\usepackage{fontspec}
\setmainfont{Arial Unicode MS}
\newfontfamily\arabicfont[Script=Arabic,Numbers=Arabic]{Arial Unicode MS}
\newcommand{\arabtext}[1] % Arabic inside LTR
{\bgroup\luatextextdir TRT\arabicfont{#1}\hfill\egroup}
\newcommand{\tight}[1]
{\bgroup\addfontfeature{WordSpace=-2.0}#1\egroup}
\newcommand{\nottight}[1]
{\bgroup\addfontfeature{WordSpace=1.0}#1\egroup}
\begin{document}
% normal text:
Lorem ipsum dolor sit amet, vel ei ipsum animal. Sea intellegat interpretaris no. Vis id summo periculis, ut duo falli recteque. Id sea gubergren splendide repudiandae. Quo tota quaeque conclusionemque.
% tight text:
\tight{Lorem ipsum dolor sit amet, vel ei ipsum animal. Sea intellegat interpretaris no. Vis id summo periculis, ut duo falli recteque. Id sea gubergren splendide repudiandae. Quo tota quaeque conclusionemque.}
% should be normal text:
\nottight%
Lorem ipsum dolor sit amet, vel ei ipsum animal. Sea intellegat interpretaris no. Vis id summo periculis, ut duo falli recteque. Id sea gubergren splendide repudiandae. Quo tota quaeque conclusionemque.}
% normal Arabic text:
\arabtext{وفي تشكيل الأمور ما, عُقر حادثة أصقاع عدم تم, دون واحدة فهرست بـ. أن بوابة ا الوزراء كلا. و إختار بمحاولة فقد, ذات أمّا مواقعها ان. إنطلاق المؤلّفة اليابان، تم.}
% tight Arabic text:
\arabtext{\tight{وفي تشكيل الأمور ما, عُقر حادثة أصقاع عدم تم, دون واحدة فهرست بـ. أن بوابة ا الوزراء كلا. و إختار بمحاولة فقد, ذات أمّا مواقعها ان. إنطلاق المؤلّفة اليابان، تم.}}
% should be normal Arabic text:
\arabtext{\nottight%
وفي تشكيل الأمور ما, عُقر حادثة أصقاع عدم تم, دون واحدة فهرست بـ. أن بوابة ا الوزراء كلا. و إختار بمحاولة فقد, ذات أمّا مواقعها ان. إنطلاق المؤلّفة اليابان، تم.}
\end{document}
\newenvironment{tighter}[1]{\addfontfeature{WordSpace=-2.0}#1}{\addfontfeature{WordSpace=1.0}}
with the same result. However, I would prefer an option where I can have different inter-word spaces within one line or paragraph, e.g. "bla bla bla \tight{foo bar foo bar} bla bla bla" with "bla bla" having normal space and "foo bar" tighter space.WordSpace
is pretty underdescribed, though I guess it is an additive feature (or, here, multplicative..?). To reverse your change, try using the setting-0.5
. Caveat: apparently really wishing one could read Arabic isn't enough to actually read Arabic.-2.0
randomly to make the effect visible, I need to ask you now how you calculated-0.5
? Or generally: what would be the value for the reverse command given any random value for the initial command?