I want to store a ratio value in a command, e.g. \newcommand{\ratio}{0.7}
, and then use it in recalculating a length, e.g. \setlength{\somelength}{\ratio*\width}
.
Using lengths to store the ratio doesn't seem to work as it requires a unit (but ratios are unitless). I've also tried using calc
but I can't seem to get it to work.
How should I go about this?
EDIT: Minimal example:
\documentclass{standalone}
\newcommand{\widthRatio}{0.7}
\newlength{\newWidth}
\setlength{\newWidth}{\widthRatio*\textwidth} % Doesn't compile
\begin{document}
\end{document}
\width
is a register like\textwidth
then your code would work if you omit*
– David Carlisle Mar 13 '13 at 14:39