### LaTeX users online

In total there are**15**users online :: 1 registered, 0 hidden and 14 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: Yahoo [Bot] and 14 guests

### LaTeX blog world

Index II: Stildatei und Layout (Tobi)Index I: Anlegen und Verarbeiten (Tobi)

How to Ask for LaTeX-related Help Effectively (Lian Tze)

Speaker Meeting 2016 (Joseph)

LaTeX and music (Clemens)

Adding references from an external file (Tom)

Exporting from LyX to MS Word and LibreOffice (Stefan)

Booklets erzeugen (Tobi)

AltaCV, yet another LaTeX CV/Résumé class (Lian Tze)

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)

## 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:**1943**Joined:**Sat Apr 16th, 2011**Location:**Germany
3 posts
• Page
1 of 1
## Topic Tagscounters • programming## LaTeX users onlineUsers browsing this forum: Yahoo [Bot] and 14 guests |