### LaTeX users online

In total there are**13**users online :: 2 registered, 0 hidden and 11 guests (based on users active over the past 5 minutes)

Most users ever online was

**1327**on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: Google [Bot], Yahoo [Bot] and 11 guests

### LaTeX blog world

TeXdoc.net updated (Stefan)TUG 2016 reports (Norbert)

TUG 2016 in Toronto - Arriving and first excursion (Stefan)

Define new macros for logical markup (Tobi)

Finding typefaces (fonts) (Tobi)

Order of float placement parameters (Tobi)

Changes and News (Clemens)

What's new in chemmacros v5.6? (Clemens)

Lass Dich nicht von einem Hobby stressen! (Markus)

Das "Currentfile" Paket (Uwe)

TeX Live 2016 released (Stefan)

How to Deal with Wide Tables (Lian Tze Lim)

Get TeX Live 2016 now (Tobi)

LyX 2.2 released (Stefan)

Point vs. Big Point (Tobi)

Programming network switches and routers using TeX (Stefan)

## Counters as Variables## LaTeX Forum: Generalcounters • programming •Add tags
3 posts
• Page
1 of 1
Hi,
Let's say I have two counters set up in a file that do their counting correctly. Printing out a total value of a counter is simple, but how could I print out a ratio of two totals (something like `\total{counta}/\total{countb}` ) to a specific number of decimal points? Also, how could I print the value of a counter divided by some pre-specified number?I've looked around to find this, but didn't have any luck. Thanks! Last edited by nikolapoljak on Sat Apr 20th, 2013, edited 2 times in total.
- nikolapoljak
**Posts:**9**Joined:**Sun Feb 26th, 2012
Solved - more or less, by using packages totcount and fp and by using
`\csname` . Couldn't find a simpler workaround.After filling in counters `countA` and `countB` , defined whit `\newtotcount` I can do this.- Code: Select all • Open in online LaTeX editor
`\FPdiv\intresult{\csname thecountA\endcsname}{\csname thecountB\endcsname}` \FPround\final{\intresult}{2}
I get the final solution rounded off to two decimals. Writing it out in text is simple, something like this. - Code: Select all • Open in online LaTeX editor
`The result I got is \final.`
Of course, if say `countB` gets filled after the calculation written here, run LaTeX twice so that the `\totcount` does it's thing.- nikolapoljak
**Posts:**9**Joined:**Sun Feb 26th, 2012
The fp package would also have been one of my suggestions. Other possibilities for calculating real numbers are
- the calculator package
- the pgf package
- the
`l3fp` module of the l3kernel
Regards -
cgnieder - Site Moderator
**Posts:**1918**Joined:**Sat Apr 16th, 2011**Location:**Germany
3 posts
• Page
1 of 1
## Topic Tagscounters • programming## LaTeX users onlineUsers browsing this forum: Google [Bot], Yahoo [Bot] and 11 guests |