Comprehensive TeX Archive Network

Direc­tory tex-archive/macros/generic/xint

Source:  xint.dtx (v1.1a, 2014/11/07)
Author:  Jean-Francois Burnol
Info:    Expandable operations on big integers, decimals, fractions
License: LPPL 1.3c or later

This README is also avail­able as README.pdf and README.html.

Change log is in CHANGES.pdf and CHANGES.html.


With LaTeX

\usepackage{xint}       % expandable arithmetic with big integers
\usepackage{xintfrac}   % decimal numbers, fractions, floats
\usepackage{xintexpr}   % expressions with infix operators

Fur­ther pack­ages: xintbinhex, xintgcd, xintseries and xintcfrac. All de­pen­den­cies are han­dled au­to­mat­i­cally. For ex­am­ple xintexpr au­to­mat­i­cally loads xintfrac which it­self loads xint. Pack­age xintcore is the sub­set of xint pro­vid­ing only the five op­er­a­tions on big in­te­gers: \xintiiAdd, \xintiiMul, ... There is also xinttools which is a sep­a­rate pack­age pro­vid­ing, among oth­ers, ex­pand­able and non-ex­pand­able loops such as \xintFor.

With TeX

One does for ex­am­ple:

\input xintexpr.sty\relax

Again, all de­pen­den­cies are han­dled au­to­mat­i­cally. The pack­ages may be loaded in any cat­code con­text such that let­ters, dig­its, \ and % have their stan­dard cat­codes.

xintcore.sty and xinttools.sty both im­port xintkernel.sty which has the cat­code han­dler and pack­age iden­ti­fier and de­fines a few util­i­ties such as \oodef or \xint_dothis/\xint_orthat.


Method A: us­ing the pack­age man­ager of your TeX dis­tri­bu­tion

xint is in­cluded in TeXLive (hence also MacTeX) and MikTeX.

There can be a few days of de­lay be­tween ap­pari­tion of a new ver­sion on CTAN and avail­abil­ity via the dis­tri­bu­tion pack­age man­ager.

Method B: man­ual in­stal­la­tion us­ing xint.tds.zip and unzip

As­sumes a GNU/Linux-like sys­tem (or Mac OS X).

  1. ob­tain xint.tds.zip from CTAN: http://mir­ror.ctan.org/in­stall/macros/generic/xint.tds.zip

  2. cd to the down­load reper­tory and is­sue:

    unzip xint.tds.zip -d <TEXMF>

    where <TEXMF> is a suit­able TDS-com­pli­ant des­ti­na­tion reper­tory. For ex­am­ple, with TeXLive:

    • Linux, stan­dard ac­cess rights, hence sudo is needed, in­stal­la­tion into the "lo­cal" tree:

      sudo unzip xint.tds.zip -d /usr/local/texlive/texmf-local
      sudo texhash /usr/local/texlive/texmf-local
    • Mac OS X, in­stal­la­tion into user home folder (no sudo needed, and it is rec­om­mended to not have a ls-R file there, hence no tex­hash):

      unzip xint.tds.zip -d  ~/Library/texmf

Method C: man­ual in­stal­la­tion us­ing Makefile and xint.dtx

The Make­file au­tom­a­tizes re­build­ing from xint.dtx all doc­u­men­ta­tion files as well as xint.tds.zip. It is for GNU/Linux-like (inc. Mac OS X) sys­tems, with a teTeX like in­stal­la­tion such as TeXLive. Fur­ther­more the Pan­doc soft­ware is re­quired.

  1. ob­tain xint.dtx and Makefile from http://www.ctan.org/pkg/xint.

  2. put them in an oth­er­wise empty work­ing reper­tory, run make or equiv­a­lently make help for fur­ther in­struc­tions.

Method D: in­stal­la­tion start­ing with only xint.dtx

Run "tex xint.dtx" or "etex xint.dtx" to ex­tract from xint.dtx all pack­ages as well as these files:

the cur­rent README with Mark­down for­mat­ting.
the changes across suc­ces­sive re­leases.

used to gen­er­ate xint.pdf via "latex xint.tex" (thrice) then "dvipdfmx xint.dvi". For suc­cess­ful com­pi­la­tion, pack­ages newtxtt, newtxmath, etoc, mathastext are needed. In­clu­sion of the source code is off by de­fault, but the tog­gle can be set in xint.tex.

It is also pos­si­ble to com­pile xint.tex with pdflatex.

A third op­tion is to gen­er­ate xint.pdf via pdflatex xint.dtx. Source code is then in­cluded by de­fault.

this is for UNIX-like sys­tems. Note: this file is only pro­duced with "etex xint.dtx", not with "tex xint.dtx". Re­name it to Makefile and run make on the com­mand line for fur­ther help.
doHTMLs.sh and doPDFs.sh
these are scripts (for UNIX-like sys­tems) which can be used to con­vert the README.md and CHANGES.md to HTML and PDF for­mats. They re­quire Pan­doc.
a Pan­doc tem­plate used by doPDFs.sh.

Fin­ish­ing the in­stal­la­tion in a TDS hi­er­ar­chy:

  • move the style files to TDS:tex/generic/xint/

  • xint.dtx goes to TDS:source/generic/xint/

  • the doc­u­men­ta­tion (xint.pdf, README.md,...) goes to TDS:doc/generic/xint/

Depend­ing on the des­ti­na­tion, it may then be nec­es­sary to re­fresh a file­name database.


Copy­right (C) 2014 by Jean-Fran­cois Burnol

This Work may be dis­tributed and/or mod­i­fied un­der the con­di­tions of the LaTeX Project Public Li­cense, ei­ther ver­sion 1.3c of this li­cense or (at your op­tion) any later ver­sion. This ver­sion of this li­cense is in


and the lat­est ver­sion of this li­cense is in


and ver­sion 1.3 or later is part of all dis­tri­bu­tions of LaTeX ver­sion 2005/12/01 or later.

This Work has the LPPL main­te­nance sta­tus author-maintained.

The Author of this Work is Jean-Fran­cois Burnol.

This Work con­sists of the source file xint.dtx and of its de­rived files: xin­tk­er­nel.sty, xint­core.sty, xint.sty, xint­frac.sty, xin­t­expr.sty, xint­bin­hex.sty, xint­gcd.sty, xintseries.sty, xintcfrac.sty, xint­tools.sty, xint.ins, xint.tex, README, README.md, README.html, README.pdf, CHANGES.md, CHANGES.html, CHANGES.pdf, pan­doctpl.la­tex, doHTMLs.sh, doPDFs.sh, xint.dvi, xint.pdf, Make­file.mk.


Name Size Date Notes
CHANGES.html 37963 2014-11-07 23:50
CHANGES.pdf 58291 2014-11-07 23:50
Make­file 460 2014-10-21 23:03
README 5465 2014-11-07 23:50
README.html 9578 2014-11-07 23:50
README.pdf 29059 2014-11-07 23:50
sourcex­int.pdf 532268 2014-11-07 23:50
xint.dtx 1092426 2014-11-07 23:44
xint.ins 3030 2014-11-07 23:49
xint.pdf 665732 2014-11-07 23:50

Down­load the con­tents of this pack­age in one zip archive (1.5M).

xint – Ex­pand­able op­er­a­tions on long num­bers

The bun­dle pro­vides nine pack­ages:

  • xint­core, which pro­vides ex­pand­able TeX macros that im­ple­ment the ba­sic arith­metic op­er­a­tions of ad­di­tion, sub­trac­tion, mul­ti­pli­ca­tion and di­vi­sion, as ap­plied to ar­bi­trar­ily long num­bers rep­re­sented as chains of dig­its with an op­tional mi­nus sign;
  • xint, which ex­tends xint­core with more big in­te­ger op­er­a­tions;
  • xint­tools, which pro­vides util­i­ties of in­de­pen­dent in­ter­est such as ex­pand­able and non-ex­pand­able loops;
  • xint­frac, which com­putes frac­tions us­ing xint;
  • xin­t­expr, which ex­tends xint­frac with an ex­pand­able parser of comma sep­a­rated ex­pres­sions in­volv­ing in­te­gers, frac­tions, boolean, and al­ge­braic op­er­a­tors, and de­clared as well as dummy vari­ables;
  • xint­bin­hex pro­vides con­ver­sions to and from bi­nary and hex­adec­i­mal bases;
  • xintseries, which pro­vides ba­sic func­tion­al­ity for com­put­ing par­tial sums us­ing xint;
  • xint­gcd, which pro­vides im­ple­men­ta­tions of the Eu­clidean al­go­rithm, and of its type­set­ting;
  • xintcfrac, which deals with the com­pu­ta­tion of con­tin­ued frac­tions.
All of the pack­ages’ com­pu­ta­tions are done in a way that they can op­er­ate in an ex­pand­ing en­vi­ron­ment.

The pack­ages may be used ei­ther with Plain TeX or LaTeX.

Pack­age De­tailsxint
Ver­sion1.1a 2014-11-07
Li­censeThe LaTeX Project Public Li­cense 1.3
Copy­right2013–2014 Jean-François Burnol
Main­tainerJean-François Burnol
TDS archivexint.tds.zip
Con­tained inTeXlive as xint
MikTeX as xint
Topics per­form cal­cu­la­tions within TeX
per­form and type­set arith­metic prob­lems
Guest Book Sitemap Contact