Re: [XeTeX] problem with ~ in Mapping=velthuis-sanskrit

2020-11-12 Thread Zdenek Wagner
Just to add, 12% is definitely wrong because it does not end the
number, the number ends at a non-number. If you type
\catcode`\~=12%
3 sons

you will get an error that 123 is not allowed here. You should end it
either with a space or with a \relax.

Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz

čt 12. 11. 2020 v 11:36 odesílatel David Carlisle
 napsal:
>
>
> >\catcode`\~=12%
>
> changing catcodes in an environment looks wrong (the % after the 12 is 
> definitely wrong)  if you change catcodes then the definition cannot work in 
> the argument of any command (for the same reasons that \verb does not work in 
> command arguments) . Leave ~ active but make it expand to the inactive one eg
>
> \edef~{\string~}%
>
>



Re: [XeTeX] problem with ~ in Mapping=velthuis-sanskrit

2020-11-12 Thread Zdenek Wagner
Bonjour,

thisi is mentioned somewhere in the documentation. The problem is that
the mapping is applied just before the text is output. However,
category of ~ is set to 13, which means that the character is active.
Thus first the active character is expanded to the nonbreakable space
and only then the mapping is applied. It is therefore necessary to
deactivate the character by setting \catcode`\~=12.

Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz

čt 12. 11. 2020 v 11:29 odesílatel François Patte
 napsal:
>
> Bonjour,
>
> Using the velthuis tranliteration scheme to type devanagari texts, I
> recently came accross some problem with ~n to produce ञ glyph.
>
> In tabular like environment, the ~ returns to its non -break space
> status and ~n is rendered as न
>
> Here is a MWE:
> <
> \documentclass[a4paper,twoside,11pt]{report}
>
> \usepackage{fontspec}
>
> \setmainfont{FreeSerif}[%
> Script=Default,%
> Mapping=tex-text,%
> Fractions=On,%
> Numbers=OldStyle,%
> ]
>
> \newfontfamily{\sanskritdev}{%
>FreeSerif}
>
> \newenvironment{deva}{%
>\catcode`\~=12%
>\sanskritdev%
>\addfontfeature{%
>  Mapping=velthuis-sanskrit,%
>  Scale=MatchLowercase,
>}%
> }%
> {\catcode`\~=13}
>
> \usepackage{stackengine}
>
> \begin{document}
>
> \newcommand{\vaq}[2]{%
>\begin{tabular}{@{\,}c@{\,}}
>  #1\\
>  {\deva #2}
>\end{tabular}%
> }
>
> \newcommand{\vak}[2]{%
>\stackon{#1}{\deva #2}%
> }
>
> {\deva ~na}
>
> \vaq{2}{~na}
>
>   \vak{3}{~na}
>
> \end{document}
> <---
>
> --
> François Patte
> UFR de mathématiques et informatique
> Laboratoire CNRS MAP5, UMR 8145
> Université Paris Descartes
> 45, rue des Saints Pères
> F-75270 Paris Cedex 06
> Tél. +33 (0)6 7892 5822
> http://www.math-info.univ-paris5.fr/~patte
> FSF
> https://www.fsf.org/blogs/community/presenting-shoetool-happy-holidays-from-the-fsf



Re: [XeTeX] problem with ~ in Mapping=velthuis-sanskrit

2020-11-12 Thread David Carlisle
>\catcode`\~=12%

changing catcodes in an environment looks wrong (the % after the 12 is
definitely wrong)  if you change catcodes then the definition cannot work
in the argument of any command (for the same reasons that \verb does not
work in command arguments) . Leave ~ active but make it expand to the
inactive one eg

\edef~{\string~}%


[XeTeX] problem with ~ in Mapping=velthuis-sanskrit

2020-11-12 Thread François Patte

Bonjour,

Using the velthuis tranliteration scheme to type devanagari texts, I 
recently came accross some problem with ~n to produce ञ glyph.


In tabular like environment, the ~ returns to its non -break space 
status and ~n is rendered as न


Here is a MWE:
<
\documentclass[a4paper,twoside,11pt]{report}

\usepackage{fontspec}

\setmainfont{FreeSerif}[%
Script=Default,%
Mapping=tex-text,%
Fractions=On,%
Numbers=OldStyle,%
]

\newfontfamily{\sanskritdev}{%
  FreeSerif}

\newenvironment{deva}{%
  \catcode`\~=12%
  \sanskritdev%
  \addfontfeature{%
Mapping=velthuis-sanskrit,%
Scale=MatchLowercase,
  }%
}%
{\catcode`\~=13}

\usepackage{stackengine}

\begin{document}

\newcommand{\vaq}[2]{%
  \begin{tabular}{@{\,}c@{\,}}
#1\\
{\deva #2}
  \end{tabular}%
}

\newcommand{\vak}[2]{%
  \stackon{#1}{\deva #2}%
}

{\deva ~na}

\vaq{2}{~na}

 \vak{3}{~na}

\end{document}
<---

--
François Patte
UFR de mathématiques et informatique
Laboratoire CNRS MAP5, UMR 8145
Université Paris Descartes
45, rue des Saints Pères
F-75270 Paris Cedex 06
Tél. +33 (0)6 7892 5822
http://www.math-info.univ-paris5.fr/~patte
FSF
https://www.fsf.org/blogs/community/presenting-shoetool-happy-holidays-from-the-fsf


OpenPGP_0x744E82D9D855D895.asc
Description: application/pgp-keys


OpenPGP_signature
Description: OpenPGP digital signature