Skip to content

Commit

Permalink
Add latex option to call result "withoutUnit"
Browse files Browse the repository at this point in the history
i.e. value and errors, but not the unit
In contrast, "value" only outputs the value itself without any errors.
  • Loading branch information
Splines committed Mar 16, 2024
1 parent 56b94e0 commit d518728
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/application/latex_stringifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def result_to_latex_cmd(self, result: Result) -> str:
# Unit
if result.unit != "":
builder.add_branch("unit", rf"\unit{{{result.unit}}}")
builder.add_branch("withoutUnit", self.result_to_latex_str_without_unit(result))

# Error message
keywords = builder.keywords
Expand Down Expand Up @@ -106,3 +107,9 @@ def result_to_latex_str_without_error(self, result: Result) -> str:
Returns the result without error as LaTeX string making use of the siunitx package.
"""
return self.create_str(result.value, [], result.unit)

def result_to_latex_str_without_unit(self, result: Result) -> str:
"""
Returns the result without unit as LaTeX string making use of the siunitx package.
"""
return self.create_str(result.value, result.uncertainties, "")

0 comments on commit d518728

Please sign in to comment.