![pgfmath:如何创建像‘1000 sep’这样的‘10^n sep’?](https://linux22.com/image/479110/pgfmath%EF%BC%9A%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E5%83%8F%E2%80%981000%20sep%E2%80%99%E8%BF%99%E6%A0%B7%E7%9A%84%E2%80%9810%5En%20sep%E2%80%99%EF%BC%9F.png)
我们知道,有一个命令1000 sep={...}
。
是否有可能创建类似的命令10^11 sep={\\}
?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\pgfmathprintnumber[fixed, 1000 sep={\,}]{1233123312331233123312}
\pgfmathprintnumber[fixed, 1000 sep={\,}]{123312331233123312331233123312331233123312331233123312331233123312331233123312331233123312331233123312331233123312331233}
\end{document}
答案1
不要在家尝试这个——你已经被警告了
\def\mysepfinish#1{#1\ifnum\count0>\count1
\let\next\mysepfinish
\advance\count0by-1\relax
\count2=\count0
\divide\count2by\count1
\multiply\count2by\count1\relax
\ifnum\count2=\count0\relax\mydelim\fi
\else\let\next\relax\fi\next}
\def\mysepcount#1{\ifx\end#1\let\next\relax
\else\advance\count0by1\let\next\mysepcount\fi
\next}
\def\mysep#1#2#3{{\def\mydelim{#2}\count0=0\relax
\count1=#1\relax
\mysepcount#3\end
\mysepfinish#3\relax}}
\mysep{11}{\\}{1234567890123456789012345678901234567890}