- Questo topic ha 11 risposte, 3 partecipanti ed è stato aggiornato l'ultima volta 1 anno, 7 mesi fa da .
-
Topic
-
Consideriamo il seguente EMC
`\documentclass[
tipotesi=custom,%
]{toptesi}\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}\begin{document}
\(\pi\approx 3,14\)
\(\pi\approx 3, 14\)
\end{document}`
che ho compilato con il seguente comando
`latexmk –halt-on-error –file-line-error -lualatex ./foo.tex`
Funziona tutto! Tuttavia, cercando di copiarne il contenuto ho ottenuto
`π ≈ 3;14
π ≈ 3; 14`
come si può vedere la virgola intelligente c’è, ma è un punto e virgola. Infatti, il code point Unicode del glifo in questione è [font=”monospace”]U+003B : SEMICOLON[/font]. A pag. 26 del TR25 è riportatoThe period (U+002E FULL STOP) and U+002C COMMA are widely used as numerical punctuation, however, their meaning depends on local conventions.
e lo stesso è confermato qui da [font=”monospace”]unicode-math[/font].
Controllando, con FontForge, effettivamente la virgola ha proprio quel code point nel font XITS Math.
Quindi ho eseguito il seguente comando
`pdffonts ./foo.pdf`
scoprendo che il font usato non è OTF, ma Type 1 per la precisione è il Computer Modern Math Italic in corpo 10
`name type encoding emb sub uni object ID
———————————— —————– —————- — — — ———
IOPIZX+XITSMath-Regular CID Type 0C Identity-H yes yes yes 4 0
APBXHK+CMMI10 Type 1 Builtin yes yes no 5 0
IZLSCG+XITS-Regular CID Type 0C Identity-H yes yes yes 6 0
`
Così ho provato a cercare il “colpevole” e ho trovato, nel file toptesi.dtx, il seguente frammento, che dal commento è proprio il responsabile della gestione della virgola intelligente
`% The cryptic code that redefines the comma in math mode
% establishes that this character is a normal math character,
% instead of a math punctuation mark. Actually the code
% that defines the mathematical active comma is a new
% addition that lets the comma perform correctly in its
% double function (decimal separator and punctuation mark).
% The only point where this code fails is when a list of
% numbers is typeset: when a numeric list must be typeset,
% such as, for example, $\forall i=0,\,1,\,2,\,3, n$, in the
% source code a space \emph{must} be inserted after every
% punctuating comma while no space follows a decimal comma:
% for example \verb*+$\forall i=0, 1, 2, 3,n$+. The space
% before the |n| is not necessary (but it wouldn't hurt)
% because |n| is not recognised as a digit, therefore the
% “intelligent” comma inserts the necessary space by itself.
%
% \begin{macrocode}
\DeclareMathSymbol{\virgola}{\mathpunct}{letters}{“3B}
\DeclareMathSymbol{\virgoladecimale}{\mathord}{letters}{“3B}
\AtBeginDocument{\mathcode`\,=\string”8000}
{\catcode `,=\active \gdef,{\futurelet\let@token\m@thcomma}}
\def\m@thcomma{\let\@tempB\virgola
\@tfor\@tempA:=0123456789\do{%
\expandafter\ifx\@tempA\let@token\let\@tempB\virgoladecimale
\@break@tfor\fi}\@tempB}
%
\catcode`\^^Z=10
\topmargin 0pt
% \end{macrocode}`
C’è la possibilità di ottenere il glifo corretto, senza copiare e modificare TOPtesi?
- Devi essere connesso per rispondere a questo topic.