[Tex/LaTex] How to write ‘decimal to Binary convertion ‘ in Latex



How can I make like this…plz help!

Best Answer




\cs_new:Npn \displayasdecimal#1 {(#1) \sb {10}}
\cs_new:Npn \displayasoctal #1 {(\int_to_oct:n{#1}) \sb 8}
\cs_new:Npn \displayasbinary #1 {(\int_to_bin:n{#1}) \sb 2}




This gets you

enter image description here

If you actually want to do the calculation automatically and dislay it as in the top of your picture then that would be possible too using expl3.