Is there a calculator with LaTeX-syntax?

前端 未结 17 2031
北海茫月
北海茫月 2020-12-12 17:00

When I write math in LaTeX I often need to perform simple arithmetic on numbers in my LaTeX source, like 515.1544 + 454 = ???.

I usually copy-paste the

17条回答
  •  旧巷少年郎
    2020-12-12 17:48

    The calc package allows you to do some calculations in source, but only within commands like \setcounter and \addtolength. As far as I can tell, this is not what you want.

    If you already use sage, then the sagetex package is pretty awesome (if not, it's overkill). It allows you get nicely formatted output from input like this:

    The square of
    $\begin{pmatrix}
    1 & 2 \\
    3 & 4
    \end{pmatrix}$
    is \sage{matrix([[1, 2], [3,4]])^2}.
    
    The prime factorization of the current page number is \sage{factor(\thepage)}
    

提交回复
热议问题