Marco87″ post=91120Ciao a tutti,
vi ringrazio davvero molto per il vostro contributo alla risposta. Mi sembra che la cosa migliore sia usare un comando nativo di LaTeX. Però, se compilo questo codice:
`\documentclass{memoir}\begin{document}
\settowidth{\misura}{Testo}
\end{document}`
ottengo questo errore:! Undefined control sequence.
\misura l.5 \settowidth{\misura}{Testo}
The control sequence at the end of the top line
of your error message was never \def’ed. If you have
misspelled it (e.g., `\hobx’), type `I’ and the correct
spelling (e.g., `I\hbox’). Otherwise just continue,
and I’ll forget about whatever was undefined.! Missing number, treated as zero.
\setbox
l.5 \settowidth{\misura}{Testo}A number should have been here; I inserted `0′.
(If you can’t figure out why I needed to see a number,
look up `weird error’ in the index to The TeXbook.)! Illegal unit of measure (pt inserted).
\setbox
l.5 \settowidth{\misura}{Testo}Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I’ll assume that you meant to say pt, for printer’s points.
To recover gracefully from this error, it’s best to
delete the erroneous units; e.g., type `2′ to delete
two letters. (See Chapter 27 of The TeXbook.)Perché succede questo? Succede anche a voi?
Grazie mille e buona giornata,
Marco.
Diciamo che servono 3 passaggi: definizione, calcolo e stampa. Nel tuo codice c’è solo il calcolo. Prova con:
`
\documentclass{memoir}
\usepackage{calc}
\newlength{\misura}% definizione
\begin{document}
\settowidth{\misura}{Testo}% calcolo
\the\misura% stampa
\end{document}
`
Ciao
Claudio