Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pifont.sty.ltxml maps \ding{...} to wrong symbols #988

Closed
siegfriedzoetzsche opened this issue May 4, 2018 · 1 comment
Closed

pifont.sty.ltxml maps \ding{...} to wrong symbols #988

siegfriedzoetzsche opened this issue May 4, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@siegfriedzoetzsche
Copy link

siegfriedzoetzsche commented May 4, 2018

The mapping

    sub dingbat_map {
      my ($code) = @_;
      return pack('U', $code + 0x2700); }

in pifont.sty.ltxml is wrong because from Table 2 in psnfss2e.pdf ([1] http://ftp.gwdg.de/pub/ctan/macros/latex/required/psnfss/psnfss2e.pdf) and pifont.ucf ([2] for me at /texlive/texmf-dist/doc/latex/ucs/config/pifont.ucf) we can see that ding{XYZ} does not necessarily map to U<XYZ + 0x2700>.

I compiled a test file ding.tex that contains all the \ding symbols listed in [2]

    \documentclass{article}
    \usepackage[utf8]{inputenc}
    \usepackage{pifont}
    \begin{document}
    U+2701	\ding{"21}%[✁]
    \par U+2702	\ding{"22}%[✂]
    \par U+2703	\ding{"23}%[✃]
    \par U+2704	\ding{"24}%[✄]
    \par U+260E	\ding{"25}%[☎]
    \par U+2706	\ding{"26}%[✆]
    \par U+2707	\ding{"27}%[✇]
    \par U+2708	\ding{"28}%[✈]
    \par U+2709	\ding{"29}%[✉]
    \par U+261B	\ding{"2A}%[☛]
    \par U+261E	\ding{"2B}%[☞]
    \par U+270C	\ding{"2C}%[✌]
    \par U+270D	\ding{"2D}%[✍]
    \par U+270E	\ding{"2E}%[✎]
    \par U+270F	\ding{"2F}%[✏]
    \par U+2710	\ding{"30}%[✐]
    \par U+2711	\ding{"31}%[✑]
    \par U+2712	\ding{"32}%[✒]
    \par U+2713	\ding{"33}%[✓]
    \par U+2714	\ding{"34}%[✔]
    \par U+2715	\ding{"35}%[✕]
    \par U+2716	\ding{"36}%[✖]
    \par U+2717	\ding{"37}%[✗]
    \par U+2718	\ding{"38}%[✘]
    \par U+2719	\ding{"39}%[✙]
    \par U+271A	\ding{"3A}%[✚]
    \par U+271B	\ding{"3B}%[✛]
    \par U+271C	\ding{"3C}%[✜]
    \par U+271D	\ding{"3D}%[✝]
    \par U+271E	\ding{"3E}%[✞]
    \par U+271F	\ding{"3F}%[✟]
    \par U+2720	\ding{"40}%[✠]
    \par U+2721	\ding{"41}%[✡]
    \par U+2722	\ding{"42}%[✢]
    \par U+2723	\ding{"43}%[✣]
    \par U+2724	\ding{"44}%[✤]
    \par U+2725	\ding{"45}%[✥]
    \par U+2726	\ding{"46}%[✦]
    \par U+2727	\ding{"47}%[✧]
    \par U+2605	\ding{"48}%[★]
    \par U+2729	\ding{"49}%[✩]
    \par U+272A	\ding{"4A}%[✪]
    \par U+272B	\ding{"4B}%[✫]
    \par U+272C	\ding{"4C}%[✬]
    \par U+272D	\ding{"4D}%[✭]
    \par U+272E	\ding{"4E}%[✮]
    \par U+272F	\ding{"4F}%[✯]
    \par U+2730	\ding{"50}%[✰]
    \par U+2731	\ding{"51}%[✱]
    \par U+2732	\ding{"52}%[✲]
    \par U+2733	\ding{"53}%[✳]
    \par U+2734	\ding{"54}%[✴]
    \par U+2735	\ding{"55}%[✵]
    \par U+2736	\ding{"56}%[✶]
    \par U+2737	\ding{"57}%[✷]
    \par U+2738	\ding{"58}%[✸]
    \par U+2739	\ding{"59}%[✹]
    \par U+273A	\ding{"5A}%[✺]
    \par U+273B	\ding{"5B}%[✻]
    \par U+273C	\ding{"5C}%[✼]
    \par U+273D	\ding{"5D}%[✽]
    \par U+273E	\ding{"5E}%[✾]
    \par U+273F	\ding{"5F}%[✿]
    \par U+2740	\ding{"60}%[❀]
    \par U+2741	\ding{"61}%[❁]
    \par U+2742	\ding{"62}%[❂]
    \par U+2743	\ding{"63}%[❃]
    \par U+2744	\ding{"64}%[❄]
    \par U+2745	\ding{"65}%[❅]
    \par U+2746	\ding{"66}%[❆]
    \par U+2747	\ding{"67}%[❇]
    \par U+2748	\ding{"68}%[❈]
    \par U+2749	\ding{"69}%[❉]
    \par U+274A	\ding{"6A}%[❊]
    \par U+274B	\ding{"6B}%[❋]
    \par U+25CF	\ding{"6C}%[●]
    \par U+274D	\ding{"6D}%[❍]
    \par U+25A0	\ding{"6E}%[■]
    \par U+274F	\ding{"6F}%[❏]
    \par U+2750	\ding{"70}%[❐]
    \par U+2751	\ding{"71}%[❑]
    \par U+2752	\ding{"72}%[❒]
    \par U+25B2	\ding{"73}%[▲]
    \par U+25BC	\ding{"74}%[▼]
    \par U+25C6	\ding{"75}%[◆]
    \par U+2756	\ding{"76}%[❖]
    \par U+25D7	\ding{"77}%[◗]
    \par U+2758	\ding{"78}%[❘]
    \par U+2759	\ding{"79}%[❙]
    \par U+275A	\ding{"7A}%[❚]
    \par U+275B	\ding{"7B}%[❛]
    \par U+275C	\ding{"7C}%[❜]
    \par U+275D	\ding{"7D}%[❝]
    \par U+275E	\ding{"7E}%[❞]
    \par U+2761	\ding{"A1}%[❡]
    \par U+2762	\ding{"A2}%[❢]
    \par U+2763	\ding{"A3}%[❣]
    \par U+2764	\ding{"A4}%[❤]
    \par U+2765	\ding{"A5}%[❥]
    \par U+2766	\ding{"A6}%[❦]
    \par U+2767	\ding{"A7}%[❧]
    \par U+2666	\ding{"A9}%[♦]
    \par U+2665	\ding{"AA}%[♥]
    \par U+2460	\ding{"AC}%[①]
    \par U+2461	\ding{"AD}%[②]
    \par U+2462	\ding{"AE}%[③]
    \par U+2463	\ding{"AF}%[④]
    \par U+2464	\ding{"B0}%[⑤]
    \par U+2465	\ding{"B1}%[⑥]
    \par U+2466	\ding{"B2}%[⑦]
    \par U+2467	\ding{"B3}%[⑧]
    \par U+2468	\ding{"B4}%[⑨]
    \par U+2469	\ding{"B5}%[⑩]
    \par U+2776	\ding{"B6}%[❶]
    \par U+2777	\ding{"B7}%[❷]
    \par U+2778	\ding{"B8}%[❸]
    \par U+2779	\ding{"B9}%[❹]
    \par U+277A	\ding{"BA}%[❺]
    \par U+277B	\ding{"BB}%[❻]
    \par U+277C	\ding{"BC}%[❼]
    \par U+277D	\ding{"BD}%[❽]
    \par U+277E	\ding{"BE}%[❾]
    \par U+277F	\ding{"BF}%[❿]
    \par U+2780	\ding{"C0}%[➀]
    \par U+2781	\ding{"C1}%[➁]
    \par U+2782	\ding{"C2}%[➂]
    \par U+2783	\ding{"C3}%[➃]
    \par U+2784	\ding{"C4}%[➄]
    \par U+2785	\ding{"C5}%[➅]
    \par U+2786	\ding{"C6}%[➆]
    \par U+2787	\ding{"C7}%[➇]
    \par U+2788	\ding{"C8}%[➈]
    \par U+2789	\ding{"C9}%[➉]
    \par U+278A	\ding{"CA}%[➊]
    \par U+278B	\ding{"CB}%[➋]
    \par U+278C	\ding{"CC}%[➌]
    \par U+278D	\ding{"CD}%[➍]
    \par U+278E	\ding{"CE}%[➎]
    \par U+278F	\ding{"CF}%[➏]
    \par U+2790	\ding{"D0}%[➐]
    \par U+2791	\ding{"D1}%[➑]
    \par U+2792	\ding{"D2}%[➒]
    \par U+2793	\ding{"D3}%[➓]
    \par U+2794	\ding{"D4}%[➔]
    \par U+2194	\ding{"D6}%[↔]
    \par U+2195	\ding{"D7}%[↕]
    \par U+2798	\ding{"D8}%[➘]
    \par U+2799	\ding{"D9}%[➙]
    \par U+279A	\ding{"DA}%[➚]
    \par U+279B	\ding{"DB}%[➛]
    \par U+279C	\ding{"DC}%[➜]
    \par U+279D	\ding{"DD}%[➝]
    \par U+279E	\ding{"DE}%[➞]
    \par U+279F	\ding{"DF}%[➟]
    \par U+27A0	\ding{"E0}%[➠]
    \par U+27A1	\ding{"E1}%[➡]
    \par U+27A2	\ding{"E2}%[➢]
    \par U+27A3	\ding{"E3}%[➣]
    \par U+27A4	\ding{"E4}%[➤]
    \par U+27A5	\ding{"E5}%[➥]
    \par U+27A6	\ding{"E6}%[➦]
    \par U+27A7	\ding{"E7}%[➧]
    \par U+27A8	\ding{"E8}%[➨]
    \par U+27A9	\ding{"E9}%[➩]
    \par U+27AA	\ding{"EA}%[➪]
    \par U+27AB	\ding{"EB}%[➫]
    \par U+27AC	\ding{"EC}%[➬]
    \par U+27AD	\ding{"ED}%[➭]
    \par U+27AE	\ding{"EE}%[➮]
    \par U+27AF	\ding{"EF}%[➯]
    \par U+27B1	\ding{"F1}%[➱]
    \par U+27B2	\ding{"F2}%[➲]
    \par U+27B3	\ding{"F3}%[➳]
    \par U+27B4	\ding{"F4}%[➴]
    \par U+27B5	\ding{"F5}%[➵]
    \par U+27B6	\ding{"F6}%[➶]
    \par U+27B7	\ding{"F7}%[➷]
    \par U+27B8	\ding{"F8}%[➸]
    \par U+27B9	\ding{"F9}%[➹]
    \par U+27BA	\ding{"FA}%[➺]
    \par U+27BB	\ding{"FB}%[➻]
    \par U+27BC	\ding{"FC}%[➼]
    \par U+27BD	\ding{"FD}%[➽]
    \par U+27BE	\ding{"FE}%[➾]
    \end{document}

I used the ouputs of

latex ding.tex

and

latexml ding.tex -destination ding.xml

for comparison.

Modifying pifont.sty.ltxml by adding

    our %dingbat_code_map = (
        0x21 => 0x2701, # [✁]
        0x22 => 0x2702, # [✂]
        0x23 => 0x2703, # [✃]
        0x24 => 0x2704, # [✄]
        0x25 => 0x260E, # [☎]
        0x26 => 0x2706, # [✆]
        0x27 => 0x2707, # [✇]
        0x28 => 0x2708, # [✈]
        0x29 => 0x2709, # [✉]
        0x2A => 0x261B, # [☛]
        0x2B => 0x261E, # [☞]
        0x2C => 0x270C, # [✌]
        0x2D => 0x270D, # [✍]
        0x2E => 0x270E, # [✎]
        0x2F => 0x270F, # [✏]
        0x30 => 0x2710, # [✐]
        0x31 => 0x2711, # [✑]
        0x32 => 0x2712, # [✒]
        0x33 => 0x2713, # [✓]
        0x34 => 0x2714, # [✔]
        0x35 => 0x2715, # [✕]
        0x36 => 0x2716, # [✖]
        0x37 => 0x2717, # [✗]
        0x38 => 0x2718, # [✘]
        0x39 => 0x2719, # [✙]
        0x3A => 0x271A, # [✚]
        0x3B => 0x271B, # [✛]
        0x3C => 0x271C, # [✜]
        0x3D => 0x271D, # [✝]
        0x3E => 0x271E, # [✞]
        0x3F => 0x271F, # [✟]
        0x40 => 0x2720, # [✠]
        0x41 => 0x2721, # [✡]
        0x42 => 0x2722, # [✢]
        0x43 => 0x2723, # [✣]
        0x44 => 0x2724, # [✤]
        0x45 => 0x2725, # [✥]
        0x46 => 0x2726, # [✦]
        0x47 => 0x2727, # [✧]
        0x48 => 0x2605, # [★]
        0x49 => 0x2729, # [✩]
        0x4A => 0x272A, # [✪]
        0x4B => 0x272B, # [✫]
        0x4C => 0x272C, # [✬]
        0x4D => 0x272D, # [✭]
        0x4E => 0x272E, # [✮]
        0x4F => 0x272F, # [✯]
        0x50 => 0x2730, # [✰]
        0x51 => 0x2731, # [✱]
        0x52 => 0x2732, # [✲]
        0x53 => 0x2733, # [✳]
        0x54 => 0x2734, # [✴]
        0x55 => 0x2735, # [✵]
        0x56 => 0x2736, # [✶]
        0x57 => 0x2737, # [✷]
        0x58 => 0x2738, # [✸]
        0x59 => 0x2739, # [✹]
        0x5A => 0x273A, # [✺]
        0x5B => 0x273B, # [✻]
        0x5C => 0x273C, # [✼]
        0x5D => 0x273D, # [✽]
        0x5E => 0x273E, # [✾]
        0x5F => 0x273F, # [✿]
        0x60 => 0x2740, # [❀]
        0x61 => 0x2741, # [❁]
        0x62 => 0x2742, # [❂]
        0x63 => 0x2743, # [❃]
        0x64 => 0x2744, # [❄]
        0x65 => 0x2745, # [❅]
        0x66 => 0x2746, # [❆]
        0x67 => 0x2747, # [❇]
        0x68 => 0x2748, # [❈]
        0x69 => 0x2749, # [❉]
        0x6A => 0x274A, # [❊]
        0x6B => 0x274B, # [❋]
        0x6C => 0x25CF, # [●]
        0x6D => 0x274D, # [❍]
        0x6E => 0x25A0, # [■]
        0x6F => 0x274F, # [❏]
        0x70 => 0x2750, # [❐]
        0x71 => 0x2751, # [❑]
        0x72 => 0x2752, # [❒]
        0x73 => 0x25B2, # [▲]
        0x74 => 0x25BC, # [▼]
        0x75 => 0x25C6, # [◆]
        0x76 => 0x2756, # [❖]
        0x77 => 0x25D7, # [◗]
        0x78 => 0x2758, # [❘]
        0x79 => 0x2759, # [❙]
        0x7A => 0x275A, # [❚]
        0x7B => 0x275B, # [❛]
        0x7C => 0x275C, # [❜]
        0x7D => 0x275D, # [❝]
        0x7E => 0x275E, # [❞]
        0xA1 => 0x2761, # [❡]
        0xA2 => 0x2762, # [❢]
        0xA3 => 0x2763, # [❣]
        0xA4 => 0x2764, # [❤]
        0xA5 => 0x2765, # [❥]
        0xA6 => 0x2766, # [❦]
        0xA7 => 0x2767, # [❧]
        0xA9 => 0x2666, # [♦]
        0xAA => 0x2665, # [♥]
        0xAC => 0x2460, # [①]
        0xAD => 0x2461, # [②]
        0xAE => 0x2462, # [③]
        0xAF => 0x2463, # [④]
        0xB0 => 0x2464, # [⑤]
        0xB1 => 0x2465, # [⑥]
        0xB2 => 0x2466, # [⑦]
        0xB3 => 0x2467, # [⑧]
        0xB4 => 0x2468, # [⑨]
        0xB5 => 0x2469, # [⑩]
        0xB6 => 0x2776, # [❶]
        0xB7 => 0x2777, # [❷]
        0xB8 => 0x2778, # [❸]
        0xB9 => 0x2779, # [❹]
        0xBA => 0x277A, # [❺]
        0xBB => 0x277B, # [❻]
        0xBC => 0x277C, # [❼]
        0xBD => 0x277D, # [❽]
        0xBE => 0x277E, # [❾]
        0xBF => 0x277F, # [❿]
        0xC0 => 0x2780, # [➀]
        0xC1 => 0x2781, # [➁]
        0xC2 => 0x2782, # [➂]
        0xC3 => 0x2783, # [➃]
        0xC4 => 0x2784, # [➄]
        0xC5 => 0x2785, # [➅]
        0xC6 => 0x2786, # [➆]
        0xC7 => 0x2787, # [➇]
        0xC8 => 0x2788, # [➈]
        0xC9 => 0x2789, # [➉]
        0xCA => 0x278A, # [➊]
        0xCB => 0x278B, # [➋]
        0xCC => 0x278C, # [➌]
        0xCD => 0x278D, # [➍]
        0xCE => 0x278E, # [➎]
        0xCF => 0x278F, # [➏]
        0xD0 => 0x2790, # [➐]
        0xD1 => 0x2791, # [➑]
        0xD2 => 0x2792, # [➒]
        0xD3 => 0x2793, # [➓]
        0xD4 => 0x2794, # [➔]
        0xD6 => 0x2194, # [↔]
        0xD7 => 0x2195, # [↕]
        0xD8 => 0x2798, # [➘]
        0xD9 => 0x2799, # [➙]
        0xDA => 0x279A, # [➚]
        0xDB => 0x279B, # [➛]
        0xDC => 0x279C, # [➜]
        0xDD => 0x279D, # [➝]
        0xDE => 0x279E, # [➞]
        0xDF => 0x279F, # [➟]
        0xE0 => 0x27A0, # [➠]
        0xE1 => 0x27A1, # [➡]
        0xE2 => 0x27A2, # [➢]
        0xE3 => 0x27A3, # [➣]
        0xE4 => 0x27A4, # [➤]
        0xE5 => 0x27A5, # [➥]
        0xE6 => 0x27A6, # [➦]
        0xE7 => 0x27A7, # [➧]
        0xE8 => 0x27A8, # [➨]
        0xE9 => 0x27A9, # [➩]
        0xEA => 0x27AA, # [➪]
        0xEB => 0x27AB, # [➫]
        0xEC => 0x27AC, # [➬]
        0xED => 0x27AD, # [➭]
        0xEE => 0x27AE, # [➮]
        0xEF => 0x27AF, # [➯]
        0xF1 => 0x27B1, # [➱]
        0xF2 => 0x27B2, # [➲]
        0xF3 => 0x27B3, # [➳]
        0xF4 => 0x27B4, # [➴]
        0xF5 => 0x27B5, # [➵]
        0xF6 => 0x27B6, # [➶]
        0xF7 => 0x27B7, # [➷]
        0xF8 => 0x27B8, # [➸]
        0xF9 => 0x27B9, # [➹]
        0xFA => 0x27BA, # [➺]
        0xFB => 0x27BB, # [➻]
        0xFC => 0x27BC, # [➼]
        0xFD => 0x27BD, # [➽]
        0xFE => 0x27BE # [➾]
        );

and changing sub dingbat_map to

    sub dingbat_map {
      my ($code) = @_;
      return pack('U', $dingbat_code_map{$code}); }

my test file produces the correct xml output.

What I am not sure about is what \ding{32} should map to.
It is listed in Table 2 in [1] but not in [2].

I also noticed that latex does not complain about \ding{X} for any character codes X in [0,255] but throws an ! Bad character code for X > 255.
So I am not sure what the desired behaviour of latexml would be for \ding{20} for example which gives no errors in latex but is not listed in [1] or [2].
Those "undefines" character codes seem to produce no ouput in latex.

@dginev dginev added the bug label May 4, 2018
@dginev dginev added this to the LaTeXML-0.8.3 milestone May 4, 2018
@brucemiller
Copy link
Owner

Hmm...old code, before I figured out to simulate fontmaps, but still, it was pretty way off!
I fixed it up, using your suggestions as a guide (but made a fontmap file). Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants