{
  "name": "LaTeX counter commands and their expl3 integer counterparts",
  "description": "Side-by-side list of the LaTeX counter commands documented by Overleaf and the expl3 integer functions documented in The LaTeX3 Interfaces, compiled for one task each: create, set, add, increment, evaluate and loop. Cells marked as not covered mean the cited page does not describe a direct equivalent.",
  "page": "https://casrai.org/guides/latex-programming",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-17T09:30:37Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Task",
      "unit": "",
      "description": ""
    },
    {
      "name": "LaTeX counter command",
      "unit": "",
      "description": ""
    },
    {
      "name": "expl3 integer function",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Task": "Create a variable",
      "LaTeX counter command": "\\newcounter{c} (starts at 0; error if the name exists)",
      "expl3 integer function": "\\int_new:N"
    },
    {
      "Task": "Set a value",
      "LaTeX counter command": "\\setcounter{c}{n} (n may be negative)",
      "expl3 integer function": "\\int_set:Nn \\l_tmp_int { 4 }"
    },
    {
      "Task": "Add an amount",
      "LaTeX counter command": "\\addtocounter{c}{n}",
      "expl3 integer function": "\\int_add:Nn"
    },
    {
      "Task": "Add one",
      "LaTeX counter command": "\\stepcounter{c}",
      "expl3 integer function": "\\int_incr:N"
    },
    {
      "Task": "Subtract one",
      "LaTeX counter command": "Not covered by the cited counters page",
      "expl3 integer function": "\\int_decr:N"
    },
    {
      "Task": "Print or use the value",
      "LaTeX counter command": "\\arabic{c} prints; \\value{c} returns the number without printing",
      "expl3 integer function": "\\int_eval:n evaluates an integer expression left to right"
    },
    {
      "Task": "Repeat code over a range",
      "LaTeX counter command": "Not covered by the cited counters page",
      "expl3 integer function": "\\int_step_inline:nnnn {initial}{step}{final}{code}, with #1 the current value"
    }
  ],
  "sources": [
    {
      "title": "Overleaf: Counters",
      "url": "https://www.overleaf.com/learn/latex/Counters",
      "accessed": "2026-11-17"
    },
    {
      "title": "The LaTeX3 Interfaces (interface3.pdf)",
      "url": "https://ctan.math.washington.edu/tex-archive/macros/latex/required/l3kernel/interface3.pdf",
      "accessed": "2026-11-17"
    }
  ]
}