\documentclass[a4paper]{article} % ----------------------- % Macros for time reports % Use the fixed point arithmetic % package by Michael Mehlich. \usepackage{fp} % Initialize counter. \FPset{\hours}{0} \newcommand{\addhour}[1]{ % Increase counter by given value. \FPadd{\hours}{\hours}{#1} } \newcommand{\duration}[1]{ % Increase counter. \addhour{#1} % Show value it is increased by. #1 hours } \newcommand{\totalduration}{ % Round output to one digit after the dot. \FPround{\hours}{\hours}{1} % Show total value. \FPprint{\hours} hours } % ------------------- % An example document % Suppress indention of paragraphs. \setlength{\parindent}{0em} \begin{document} \duration{3} \\ \duration{4.5} \\ \duration{7} \\ \\ \textbf{\totalduration} \end{document}