[texhax] Exact lengths
Ian.Collier at comlab.ox.ac.uk
Ian.Collier at comlab.ox.ac.uk
Wed Mar 9 18:15:01 CET 2005
stefan at raggmunk.nu writes:
>Is there a way to round a calculated length (for example 118.79715pt) to
>an equal number of picas (that is, 10 picas or 120pt)?
\newdimen \mydimenA % temporary registers
\newdimen \mydimenB
\newcount \mycountA
\mydimenA=118.79715pt % the input
\mydimenB=1pc % the unit length
\newlinechar=10 \message {Old value = \the\mydimenA ^^J}
\advance\mydimenA by 0.5\mydimenB %(if you want it rounded to nearest integer)
\divide\mydimenA by \mydimenB
\mycountA=\mydimenA % this is the number of picas you want
\mydimenA=\mycountA\mydimenB % this is the rounded dimension you want
\message {New value = \the\mydimenA ^^J}
--
---- Ian Collier : imc at comlab.ox.ac.uk : WWW page below
------ http://users.comlab.ox.ac.uk/ian.collier/imc.shtml
More information about the texhax
mailing list