muito obrigado pela sua solução!!
Eu havia encontrado outra
(http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2011-05/msg00092.html)
mas que não ficou bonita como a sua (tive que comentar o
DivisaoContinuadaMarcada). Eu modifiquei o box de divisão e coloquei o
smile no resto (usei o relsize para aumentar o número no \stackrel):
\documentclass{minimal}
\usepackage{relsize}
\makeatletter
\newbox\nb@box
\newcount\nb@a
\newcount\nb@b
\newcount\iter@
\newcommand\conversion[2][2]{%
\def\dividende@{#2}\def\base@{#1}\iter@\@ne\conversion@{#2}{#1}}
\newcommand\conversion@[2]{%
\setbox\nb@box\hbox{\kern0.5em#1\kern0.5em}%
\nb@a#1 \nb@b#1 \divide\nb@b#2
\vtop{%
\multiply\nb@b#2 \advance\nb@a-\nb@b
\hbox to\wd\nb@box{\hfil#1\hfil}%
\vskip3pt\hrule height\z@ width\wd\nb@box\vskip3.4pt
\hbox to\wd\nb@box{\hfil$\stackrel{\mathlarger{\number\nb@a}}{\smile}$\kern0.5em}%
\expandafter\xdef\csname reste@\number\iter@\endcsname
{\number\nb@a}%
}%
\setbox\nb@box\hbox{8}\vrule height\ht\nb@box depth0.5ex
\setbox\nb@box\hbox{%
\kern0.5em
\ifnum#2>\nb@b\relax
#2%
\else
\number\nb@b
\fi
\kern0.5em}%
\vtop{%
\hbox to\wd\nb@box{\kern0.5em#2\hfil}%
\vskip3pt\hrule height0.4pt width\wd\nb@box\vskip3pt
\hbox{%
\csname @\ifnum\nb@b>0 first\else second\fi oftwo\endcsname
{\advance\iter@\@ne\gdef\maxiter{\number\iter@}%
\expandafter\conversion@\expandafter{\number\nb@b}{#2}}%
{\kern0.5em\number\nb@b\xdef\maxiter{\number\iter@}}}%
}%
}
\newcommand\displayresult{%
$(\dividende@)_{10}=(\displayresult@\maxiter)_{\base@}$}
\newcommand\displayresult@[1]{%
\csname reste@#1\endcsname
\ifnum#1>\@ne
\expandafter\displayresult@\expandafter
{\number\numexpr#1-1\expandafter}%
\fi
}
\makeatother
\begin{document}
\parindent0pt
Successive divisions by 2: \conversion{197}
And the result: \displayresult
\bigskip
Successive divisions by 3: \conversion[3]{197}
And the result: \displayresult
\end{document}
2011/8/16 Miguel Frasson <mvsfr...@gmail.com>:
--
Thadeu Penna
Prof.Associado
Instituto de Ciências Exatas - Volta Redonda
Universidade Federal Fluminense
INCT - Sistemas Complexos
Linux User #50500 (counter.li.org)
Maravilhoso.
Brilhante.
Parabéns a todos.
--
Data Estelar 2455790,400289
http://sites.google.com/site/ficmatinf
Desejo-lhe Paz, Vida Longa e Prosperidade.
São Bem Vindas Mensagens no Formato texto UTF-8 com Acentos.