diff options
Diffstat (limited to 'Master/texmf-dist/scripts/lua-physical/physical-quantity.lua')
-rw-r--r-- | Master/texmf-dist/scripts/lua-physical/physical-quantity.lua | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Master/texmf-dist/scripts/lua-physical/physical-quantity.lua b/Master/texmf-dist/scripts/lua-physical/physical-quantity.lua index d89fdd2836b..875a2ee38d3 100644 --- a/Master/texmf-dist/scripts/lua-physical/physical-quantity.lua +++ b/Master/texmf-dist/scripts/lua-physical/physical-quantity.lua @@ -1,7 +1,7 @@ --[[ This file contains the quantity class -Copyright (c) 2020 Thomas Jenni +Copyright (c) 2021 Thomas Jenni Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -424,10 +424,18 @@ function Quantity:tosiunitx(param,mode) end if mode == Quantity.SIUNITX_SI then - return "\\SI"..param.."{"..tostring(self.value).."}".."{"..self.unit:tosiunitx().."}" + if type(self.value) == "number" then + return "\\SI"..param.."{"..tostring(self.value).."}".."{"..self.unit:tosiunitx().."}" + else + return "\\SI"..param.."{"..self.value:tosiunitx().."}".."{"..self.unit:tosiunitx().."}" + end elseif mode == Quantity.SIUNITX_num then - return "\\num"..param.."{"..tostring(self.value).."}" + if type(self.value) == "number" then + return "\\num"..param.."{"..tostring(self.value).."}" + else + return "\\num"..param.."{"..self.value:tosiunitx().."}" + end elseif mode == Quantity.SIUNITX_si then return "\\si"..param.."{"..self.unit:tosiunitx().."}" |