vincentb1 / fmtcount

Source for LaTeX fmtcount package
11 stars 5 forks source link

No accented capital letters with xelatex #15

Closed Alfonsib closed 9 years ago

Alfonsib commented 9 years ago

It's all in the title: \ORDINALstring{cnt} produces DEUXIèME if the value of cnt is 2.

Minimal example:

\documentclass[11pt,twoside]{report} \usepackage[french]{fmtcount}

\usepackage{fontspec}

\usepackage{titlesec}

\titleformat{\chapter}% [display]% {\filcenter}% {\MakeUppercase{\chaptername}~\ORDINALstring{chapter}}% {12pt}% {\MakeUppercase}

\begin{document}

\chapter{Toto}

\chapter{Tata}

È

\end{document}

frpatte2 commented 9 years ago

Ulrike Fischer has given a fix to be put in the document: \robustify` (which fixes for grave accents).

Can this be implemented in the fmtcount.sty?

vincentb1 commented 9 years ago

Hello, I must admit that I am not familiar enough with xelatex to know what to do. fmtcount already has some xelatex specific code — this is done to detect what language is loaded.

First of all could you please confirm the proposal by Ulrike — I am afraid that we have a github markdown problem in your post — is that

\robustify\`

or

\robustify`

I cannot understand the latter.

Now, concerning \robustify:

\robustify\`

with the outest scope — so not only the result of \ORDINALxxx would be affected, but any code that would use accents.

\`e

by

\protect\`e

?

frpatte2 commented 9 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Le 09/11/2014 23:20, Vincent Belaïche a écrit :

Hello, I must admit that I am not familiar enough with xelatex to know what to do. fmtcount already has some xelatex specific code — this is done to detect what language is loaded.

First of all could you please confirm the proposal by Ulrike — I am afraid that we have a github markdown problem in your post — is that

\robustify`

It is this one

Here is the Ulrike suggestion:

`e is expanded to a \char command before \uppercase can see it and \uppercase/MakeUppercase don't affect \char.

Imho the relevant `e in fc-french.def should be protected, but you can also make the commands yourself robust:

\documentclass[11pt,twoside]{report} \usepackage{ifluatex} \ifluatex \usepackage{fontspec} \else \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \fi

\usepackage[french]{babel} \usepackage[french]{fmtcount} \usepackage{etoolbox}

\begin{document} \uppercase{éè \'e `e \char "00E8}

\ORDINALstringnum{2}

\robustify` \robustify\'

\ORDINALstringnum{2} \end{document}

Maybe contacting Ulrike directly could help on this issue.


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)1 8394 5849 http://www.math-info.univ-paris5.fr/~patte -----BEGIN PGP SIGNATURE----- Version: GnuPG v1

iEYEARECAAYFAlRghnQACgkQdE6C2dhV2JVXlQCfd2ZYTtKoYA7yG3fjVt7i0FhK AMkAoNeoaTvCwAutnNOzIjiDGdD/SMla =PmoM -----END PGP SIGNATURE-----

vincentb1 commented 9 years ago

Hello,

I think that the following quote from Ulrike's message is clear enough:

Imho the relevant `e in fc-french.def should be protected

that is exactly the kind of solution that came to my mind as the best one.

vincentb1 commented 9 years ago

Well, that seems more difficult than I thought. I did the change in fc-french.def locally on my machine so that any occurrence of

\`e

is replaced by

\protect\`e

Then I added a test, so file sample-polyglossia.tex is modified as:

\documentclass{article}
\usepackage{xunicode,polyglossia}

\setmainlanguage{french}
\usepackage{fmtcount}

\newcounter{cnt}

\begin{document}
\numberstringnum{10}
\setcounter{cnt}{2}
\ORDINALstring{cnt}

\end{document}

What I get is that the compilation fails as follows:

Administrateur@AIGLEROYAL /local/projects/fmtcount/trunk/test
$ make clean
rm -fr pdftests
rm -f pdftests.log
rm -fr tests
for w in short shortgo shortbab; do rm -f $w.log; done
Administrateur@AIGLEROYAL /local/projects/fmtcount/trunk/test
$ make pdftests/sample-polyglossia.pdf
mkdir -p tests
echo "" > tests/.dir
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fmtcount.sty > tests/fmtcount.sty
mkdir -p pdftests
echo "" > pdftests/.dir
cp -u tests/fmtcount.sty -T pdftests/fmtcount.sty
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fcnumparser.sty > tests/fcnumparser.sty
cp -u tests/fcnumparser.sty -T pdftests/fcnumparser.sty
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fcprefix.sty > tests/fcprefix.sty
cp -u tests/fcprefix.sty -T pdftests/fcprefix.sty
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-british.def > tests/fc-british.def
cp -u tests/fc-british.def -T pdftests/fc-british.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-english.def > tests/fc-english.def
cp -u tests/fc-english.def -T pdftests/fc-english.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-french.def > tests/fc-french.def
cp -u tests/fc-french.def -T pdftests/fc-french.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-german.def > tests/fc-german.def
cp -u tests/fc-german.def -T pdftests/fc-german.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-portuges.def > tests/fc-portuges.def
cp -u tests/fc-portuges.def -T pdftests/fc-portuges.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-spanish.def > tests/fc-spanish.def
cp -u tests/fc-spanish.def -T pdftests/fc-spanish.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-UKenglish.def > tests/fc-UKenglish.def
cp -u tests/fc-UKenglish.def -T pdftests/fc-UKenglish.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-USenglish.def > tests/fc-USenglish.def
cp -u tests/fc-USenglish.def -T pdftests/fc-USenglish.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-ngermanb.def > tests/fc-ngermanb.def
cp -u tests/fc-ngermanb.def -T pdftests/fc-ngermanb.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-ngerman.def > tests/fc-ngerman.def
cp -u tests/fc-ngerman.def -T pdftests/fc-ngerman.def
awk 'BEGIN                      { printenb = 0; }; /^%    \\end{macrocode}/   { printenb = 0; }; printenb == 1              { print }; /^%    \\begin{macrocode}/ { printenb = 1; }' ../fc-germanb.def > tests/fc-germanb.def
cp -u tests/fc-germanb.def -T pdftests/fc-germanb.def
rm -f pdftests.log
==================================================================================================
== Begin target pdftests
==================================================================================================
cd pdftests; if latexmk -r ../xelatex_latexmkrc ../../sample-polyglossia.tex; \
    then echo "Test sample-polyglossia: ok" >> ../pdftests.log; \
    else echo "Test sample-polyglossia: failed" >> ../pdftests.log; \
    fi
Use of uninitialized value in concatenation (.) or string at C:\Programmes\MiKTeX 2.9\scripts\latexmk\perl\latexmk.pl line 925.
Latexmk: This is Latexmk, John Collins, 10 Nov 2013, version: 4.39.
**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****
Rule 'pdflatex': Rules & subrules not known to be previously run:
   pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
      'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'xelatex  -recorder  "../../sample-polyglossia.tex"'
------------
Latexmk: applying rule 'pdflatex'...
This is XeTeX, Version 3.1415926-2.5-0.9999.3 (MiKTeX 2.9 64-bit)
entering extended mode
(c:\Nos_Programmes\msys\local\projects\fmtcount\trunk\sample-polyglossia.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic, 
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2013-05-26, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
 lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
german-x-2013-05-26, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
ishmax, welsh, loaded.
("C:\Programmes\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Programmes\MiKTeX 2.9\tex\latex\base\size10.clo"))
("C:\Programmes\MiKTeX 2.9\tex\xelatex\xunicode\xunicode.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\tipa\t3enc.def")
("C:\Programmes\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\graphics\keyval.sty")
("C:\Programmes\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\graphics\trig.sty")
("C:\Programmes\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg")
("C:\Programmes\MiKTeX 2.9\tex\xelatex\xetex-def\xetex.def"))))
("C:\Programmes\MiKTeX 2.9\tex\latex\polyglossia\polyglossia.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\etoolbox\etoolbox.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\misc\etex.sty"))
("C:\Programmes\MiKTeX 2.9\tex\latex\makecmds\makecmds.sty")
("C:\Programmes\MiKTeX 2.9\tex\latex\xkeyval\xkeyval.sty"
("C:\Programmes\MiKTeX 2.9\tex\generic\xkeyval\xkeyval.tex"))
("C:\Programmes\MiKTeX 2.9\tex\latex\fontspec\fontspec.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\l3kernel\expl3.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\l3kernel\expl3-code.tex")
("C:\Programmes\MiKTeX 2.9\tex\latex\l3kernel\l3xdvipdfmx.def"))
("C:\Programmes\MiKTeX 2.9\tex\latex\l3packages\xparse\xparse.sty")
("C:\Programmes\MiKTeX 2.9\tex\latex\fontspec\fontspec-patches.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\base\fixltx2e.sty")
*************************************************
* LaTeX warning: "xparse/redefine-command"
* 
* Redefining document command \oldstylenums with arg. spec. 'm' on line 128.
*************************************************
) ("C:\Programmes\MiKTeX 2.9\tex\latex\fontspec\fontspec-xetex.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\base\fontenc.sty"
("C:\Programmes\MiKTeX 2.9\tex\latex\euenc\eu1enc.def")
("C:\Programmes\MiKTeX 2.9\tex\latex\euenc\eu1lmr.fd"))
("C:\Programmes\MiKTeX 2.9\tex\latex\fontspec\fontspec.cfg")))
("C:\Programmes\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty")
("C:\Programmes\MiKTeX 2.9\tex\generic\ifxetex\ifxetex.sty"))
("C:\Programmes\MiKTeX 2.9\tex\latex\polyglossia\gloss-french.ldf")
(c:\Nos_Programmes\msys\local\projects\fmtcount\trunk\test\pdftests\fmtcount.st
y ("C:\Programmes\MiKTeX 2.9\tex\latex\base\ifthen.sty")
(c:\Nos_Programmes\msys\local\projects\fmtcount\trunk\test\pdftests\fcprefix.st
y
(c:\Nos_Programmes\msys\local\projects\fmtcount\trunk\test\pdftests\fcnumparser
.sty)) ("C:\Programmes\MiKTeX 2.9\tex\latex\amsmath\amsgen.sty")
(c:\Nos_Programmes\msys\local\projects\fmtcount\trunk\test\pdftests\fc-french.d
ef))
(c:\Nos_Programmes\msys\local\projects\fmtcount\trunk\test\pdftests\sample-poly
glossia.aux) ("C:\Programmes\MiKTeX 2.9\tex\latex\tipa\t3cmr.fd")
! Undefined control sequence.
\UseTextAccent ...up \@firstofone \let \@curr@enc 
                                                  \cf@encoding \@use@text@en...
l.14 \ORDINALstring{cnt}

? 
vincentb1 commented 9 years ago

Just to add that this must be some \edef to change into \protected@edefsomewhere in the code, eh… I just need a little more time to make the change.

vincentb1 commented 9 years ago

Ok, I have made the correction and pushed them to the repo.

You can get it this way:

git clone https://github.com/nlct/fmtcount.git
cd fmtcount/dist
make install TEXMF_INSTALL_DIR=/path/of/the/texmf/where/you/will/install/it

You need to replace in the above /path/of/the/texmf/where/you/will/install/it by the correct path. You also need:

vincentb1 commented 9 years ago

Please @Alfonsib could you check that the problem is solved by my correction. See installation instruction in previous comment.

Alfonsib commented 9 years ago

I installed the files in my local texmf directory and tested. Everything worked just fine. Thanks a lot (Grand merci…)

Bernard

frpatte2 commented 9 years ago

Ok fine, works for me.... waiting for the update on ctan

vincentb1 commented 9 years ago

The update on CTAN will come after another issue raised by Denis Bitouzé is solved — this issue is not on this issue base — it is twofold:

The second point is not yet solved, I need some discussion with Nicola about this because I do anything.