Re: SImboli logici

#84846
samiel
Partecipante
    Up
    0
    Down
    ::


    C’è qualcosa che continua a sfuggirmi. Il problema non è \tag, bensì \label.
    Prendiamo questo esempio:
    `\documentclass[a4paper,12pt]{article}
    \usepackage[T1]{fontenc}
    \usepackage{fontspec}
    \usepackage{amsmath}
    \usepackage[math-style=upright]{unicode-math}
    \setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
    \setmathfont{Asana Math}
    \usepackage{polyglossia}
    \setmainlanguage{italian}
    \usepackage{microtype}

    %\newcommand\ap[1]{\textormath{\textsuperscript{#1}}{^{\mathrm{#1}}}}
    %\newcommand\ped[1]{\textormath{\textsubscript{#1}}{_{\mathrm{#1}}}}

    \providecommand*\ap[1]{\textormath{\textsuperscript{#1}}{^{\mathrm{#1}}}}
    \providecommand*\ped[1]{\textormath{\textsubscript{#1}}{_{\mathrm{#1}}}}

    %\newcommand{\superscript}[1]{\ensuremath{^{\textrm{#1}}}}
    %\newcommand{\subscript}[1]{\ensuremath{_{\textrm{#1}}}}

    %\makeatletter
    %\newcommand\textsubscript[1]{\@textsubscript{\selectfont#1}}
    %\def\@textsubscript#1{{\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
    %\newcommand\textbothscript[2]{%
    % \@textbothscript{\selectfont#1}{\selectfont#2}}
    %\def\@textbothscript#1#2{%
    % {\m@th\ensuremath{%
    % ^{\mbox{\fontsize\sf@size\z@#1}}%
    % _{\mbox{\fontsize\sf@size\z@#2}}}}}
    %\def\@super{^}\def\@sub{_}
    %
    %\catcode`^\active\catcode`_\active
    %\def\@super@sub#1_#2{\textbothscript{#1}{#2}}
    %\def\@sub@super#1^#2{\textbothscript{#2}{#1}}
    %\def\@@super#1{\@ifnextchar_{\@super@sub{#1}}{\textsuperscript{#1}}}
    %\def\@@sub#1{\@ifnextchar^{\@sub@super{#1}}{\textsubscript{#1}}}
    %\def^{\let\@next\relax\ifmmode\@super\else\let\@next\@@super\fi\@next}
    %\def_{\let\@next\relax\ifmmode\@sub\else\let\@next\@@sub\fi\@next}
    %\makeatother

    \begin{document}

    \begin{equation*}
    p \leftrightarrow q
    \end{equation*}
    bla bla
    \begin{equation}
    p \leftrightarrow q
    \label{equ:coimplicazione}
    \end{equation}
    bla bla
    \begin{equation}
    p \leftrightarrow q \tag{D\ped2}
    %\label{equ:D\ped2}
    \end{equation}

    x\ap2

    x\ped2

    $x\ap2$

    $x\ped2$

    \end{document}`
    Se commento la riga \label, tutto funziona correttamente. Il comando \ped
    individua se la modalità è o non è matematica, e usa dietro il sipario _ oppure \textsubscript.
    Infatti il risultato è corretto. Ma se decommento \label, allora ottengo:
    `! Missing \endcsname inserted.

    \bgroup
    l.8 …qu:D_{\mathup {2}}}{{{D_{\mathup {2}}}}{1}}

    ? `
    E qualsiasi stringa io inserisca in \label per il pedice, mi dà errore

    m

    Go to top