Skip to content

[Feature request]: Support numbers with multiple uncertainty descriptions #50

Description

@RungeCC

Motivation

In physics (particularly high-energy and nuclear physics), it is common to encounter values with more than one uncertainty component. This is usually due to multiple sources of error, such as "Statistical" vs. "Systematic" uncertainties. Sometimes, specific parts of the systematic error are even distinguished separately (e.g., luminosity error, calibration error).

It would be highly beneficial if zero could support multiple, labeled uncertainty components to accurately represent data.

Proposed API

#import /* zero path */: num
#let num1 = num.with(
  uncertainty-mode: "separate",
  uncertainty-labels: ("stat", "sys", ), // array or a function with type int => content | str | none, `none` means no label
  uncertainty-label-function: (u, l) => $#u_#l$ // or we could combine this with `uncertainty-labels`, it becomes a function that receive (index, uncertainty) and return content.
)
#let num2 = num.with(
  uncertainty-mode: "compact",
// by default no label
)
$
num1("1.48(23)(42)", )
// equivalent to: 1.48 plus.minus 0.23_"stat" plys.minus 0.42_"sys"
num1("1.48+.20-.31+.14-.22", )
// equivalent to: 1.48^(+0.20_"stat"+0.14_"sys")_(-0.31_"stat"-0.22_"sys")
num2("1.48+-0.32+-0.42", )
// equivalent to: 1.48(32)(42)
$

Table Alignment should also work for each part of uncertainties.

Affect on Current Behavior

Shall be none, since originally those would cause syntax errors in zero.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions