Help us understand the problem. What is going on with this article?

LaTeXでn進数から10進数への変換式

More than 3 years have passed since last update.

n進数から10進数への変換式をlatexで作成．

test.tex
\documentclass{article}

\usepackage{xstring}
\usepackage{xifthen}
\usepackage{pgf}

\usepackage{amsmath} % align

\begin{document}

\newcounter{ep}
\newcounter{index}

\newcommand{\toD}[2][2]{
\StrLen{#2}[\mystrlen]
\setcounter{ep}{\mystrlen}
\setcounter{index}{0}%
\whiledo{\value{index} < \mystrlen}{%
\stepcounter{index}%
\StrChar{#2}{\theindex} \times #1^\theep
\ifnum\theep>0{{}+{}}\fi
}
}
\newcommand{\toDD}[2][2]{
\StrLen{#2}[\mystrlen]
\setcounter{ep}{\mystrlen}
\setcounter{index}{0}%
\whiledo{\value{index} < \mystrlen}{%
\stepcounter{index}%
\StrChar{#2}{\theindex} \times
\pgfmathint{#1^\theep}\pgfmathresult
\ifnum\theep>0{{}+{}}\fi
}
}

\begin{align}
(0334)_8 &= \toD[8]{0334} \\
&= \toDD[8]{0334} \\
%
(1011011)_2 &= \toD{1011011} \\
&= \toDD{1011011}
\end{align}

\end{document}


こうなります．

Why not register and get more from Qiita?
1. We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
2. you can read useful information later efficiently
By "stocking" the articles you like, you can search right away