Gero27″ post=67267Buonasera a tutti amici del forum,
devo ricorrere nuovamente a voi in questo periodo di panettoni e festeggiamenti per un problema per me insormontabile.
Sto scrivendo un breve report utilizzando XeLaTeX su MacTeX, e ho bisogno di usare il simbolo dell’insieme dei numeri reali, ma… non c’è verso di farlo apparire!!
Ho provato caricando tutti i pacchetti possibili e immaginabili: amssymb, amsfonts, unicode-math… ma proprio non ne vuol sapere di darmi il risultato desiderato, e per di più ottengo strani errori che non riesco proprio a decifrare.Riporto come esempio minimo l’ultimo di tanti tentativi fatti:
`\documentclass[twoside,11pt]{report}
\usepackage[english]{babel}
\usepackage{xltxtra}
\usepackage{setspace}
\onehalfspacing
\usepackage[labelsep=period,tableposition=top]{caption}[2004/07/16]
\captionsetup[figure]{font={small},justification=centerlast}
\usepackage{amsmath,mathrsfs,unicode-math}
\usepackage[top=2.5cm,left=2cm,right=2cm,bottom=2cm]{geometry}\begin{document}
Extremum seeking [bla bla bla …]
\begin{equation}\label{f}
(63) f(\theta)=f^*+\frac{f''}{2}{(\theta-\theta^*)}^2 \qquad , \qquad f''>0
\end{equation}
so that any function $f\in C^2$ can be approximated locally by eq. \eqref{f} [bla bla bla …]
\begin{gather*}
\mathscr{L}[\theta^*(t)]=\lambda_\theta\Gamma_\theta(s)\\
\mathscr{L}[f^*(t)]=\lambda_f\Gamma_f(s)
\end{gather*}
[bla bla bla …]
where $x\in\mathbb{R}^n$ [bla bla bla …]
\end{document}`La cosa meravigliosa è che così facendo compare addirittura un errore inspiegabile in una riga di codice che non ha mai dato problemi (quella indicata con “(63)”)!! Lo riporto:
`! Undefined control sequence.
\um_glyph_if_exist:nTF #1->\iffontchar \l_um_font
#1\scan_stop: \prg_return_…
l.63 ^^If(\theta)=f^*+\frac{f''}{2}
{(\theta-\theta^*)}^2^^I\qquad^^I,^^I\qqu…?`
Qualcuno sa spiegarmi che succede:?:?:?
Grazie in anticipo e buon anno a tutti 🙂
Ruggero
L’errore principale che ottieni è
`! unicode-math error: “no-font-selected”`
Non ha senso caricare unicode-math e non dichiarare il font matematico (attualmente non esiste un default, ci penseranno quando Latin Modern Math sarà completo). I casi sono due: o dichiari
`\setmathfont{Latin Modern Math}`
oppure non carichi unicode-math. Nel primo caso mathrsfs non ha senso; puoi sostituirlo con
`\setmathfont[range={\mathcal,\mathbfcal}]{XITS Math}
\let\mathscr\mathcal`
Vediamo il preambolo per benino.
Caso 1
`\documentclass[twoside,11pt]{report}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range={\mathcal,\mathbfcal}]{XITS Math}
\let\mathscr\mathcal
\usepackage[top=2.5cm,left=2cm,right=2cm,bottom=2cm]{geometry}
\usepackage[labelsep=period,tableposition=top]{caption}[2004/07/16]
\captionsetup[figure]{font={small},justification=centerlast}
\usepackage{setspace}
\onehalfspacing`
Caso 2:
`\documentclass[twoside,11pt]{report}
%\usepackage[english]{babel}
\usepackage{amsmath,amssymb,mathrsfs}
\usepackage{fontspec}
\usepackage[top=2.5cm,left=2cm,right=2cm,bottom=2cm]{geometry}
\usepackage[labelsep=period,tableposition=top]{caption}[2004/07/16]
\captionsetup[figure]{font={small},justification=centerlast}
\usepackage{setspace}
\onehalfspacing`
Non caricare xltxtra, è praticamente inutile.
Quanto a babel: usarlo per l’inglese è del tutto irrilevante. Con XeLaTeX è meglio in genere usare polyglossia, ma babel non fa danni per lingue come inglese e italiano (per il francese sì).
Quella virgola appesa al nulla nella formula che comincia con (63) è orrida. O vicina alla prima sottoformula o via (mettendo f>0 fra parentesi).
Ciao
Enrico