# Tag Info

## New answers tagged calculations

3

Would you consider using LuaTeX? Then you could evaluate even more complicated expressions: % gobble ".0" for integers and rounding function \begingroup \catcode`\%=12 \directlua{ function math.round_int ( x ) return x>=0 and math.floor(x+0.5) or math.ceil(x-0.5) end function math.round ( x , n ) return math.round_int ( x*10^n ...

8


2

You can sum the array using \int_step_function:nN \documentclass{article} \usepackage{xparse} \usepackage{siunitx} \ExplSyntaxOn \fparray_new:Nn \g_albystalks_main_fparray {6} \fparray_gset:Nnn \g_albystalks_main_fparray {1}{0.907} \fparray_gset:Nnn \g_albystalks_main_fparray {2}{0.875} \fparray_gset:Nnn \g_albystalks_main_fparray {3}{0.845} \fparray_gset:...

1

You can use a loop to sum the items. I also changed the way the array is constructed, just to provide an alternative idea. \documentclass{article} \usepackage{xparse} \usepackage{siunitx} \ExplSyntaxOn \clist_set:Nn \l_tmpa_clist {0.907, 0.875, 0.845, 0.817, 0.701, 0.613} \exp_args:NNx \fparray_new:Nn \g_nome {\clist_count:N \l_tmpa_clist} \int_set:Nn \...

2

There is a rather old package called truncate, so one can use \truncate{122pt}{This text has been~truncated} and the text will be truncated before 122pt, between words and never at a ~. See the truncate package manual for more options

0

A more simplified approach that I am now using might be a bit easier to read, but of course not as flexible as before, but it makes use of the fact that for PGF you don't need to convert the macros to counters before, hence this works to produce a progress bar that is variable in height and is inverted. It also takes into account muzimuzhi's comment ...

6

TeX has a \maxdimen (16383.99999pt), which represents the largest dimension you can use in an dimension expression. See discussions among \maxdimen on this site, including my answer. When \x == 45, \progressbar@tmpdim == 364.19536pt and \progressbar@tmpcounta == 45, their multiplication 364.19536pt * 45 = 16,388.7912pt, is slightly larger than \maxdimen, ...

Top 50 recent answers are included