# Type powers of ten using a custom command

I use the font times and I am writing powers of ten often. So I am using 10\textsuperscript{2}. I was wondering if it is possible to make a command like \ten{2} which does the same thing? It would make it faster for me to type and is also very clear to read in my editor.

\documentclass{article}
\usepackage{times}
\begin{document}
10\textsuperscript{2}
%\ten{2}
\end{document}

• Off-topic: times is deprecated and ought not be used. – cfr Jul 9 '18 at 0:44

\documentclass{article}
\newcommand{\ten}[1]{10\textsuperscript{#1}}
\usepackage{blindtext,times}
\begin{document}
\ten{2}\blindtext\par\ten{324}
\end{document}

• Please could you edit your code to make it compilable? – cfr Jul 9 '18 at 0:45

Perhaps a more versatile solution:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\num{e2}

\num{1e5}
\end{document}


gives

• Would not be very clear for the editor reading it, though. Also, doesn't this give you a bad box warning? – cfr Jul 9 '18 at 0:45
• @cfr Do you mean the code or the output not being clear for the editor? I don't quite understand: if you mean editor (of a journal, say) or the TeX editor, or..? And no, it doesn't. It does for you? – Troy Jul 9 '18 at 0:49
• I thought part of the point was to make the source more readable for the editor. That's what the question said was part of the motivation for \ten{#1}. And I didn't check yet. Shouldn't it give a bad box warning, though? – cfr Jul 9 '18 at 0:51
• @cfr oh ok, so the editor as mentioned in the question, i.e., the TeX editor. Whether it's more readable seems to be in the eye of the beholder IMO. I don't find this any harder to read than \ten{2}, say. But it's more versatile, and has the benefit of being a more well-known command. In either case, it's better than \textsuperscript which is the main problem posed by OP. With regards to bad box, I don't know.. It doesn't for me. You mean the bad box to come from using \\? – Troy Jul 9 '18 at 0:55
• I agree it is more versatile. And, yes, shouldn't that give a bad box warning? Now I can't produce a bad box warning using \\  at all. (I.e. no matter how hard I try.] – cfr Jul 9 '18 at 1:02

If you use knitr, just write a \Sexpr{}:

<<echo=F>>=
options(scipen=-3)
@
\documentclass{article}
\begin{document}
\Sexpr{10^2} \Sexpr{10^5} \Sexpr{10000} \Sexpr{100} \Sexpr{0.0000123}
\end{document}