[Tex/LaTex] Multiplication to macro argument

calculationsfontsizefp

Since the baselineskip parameter for fontsize should better be 1.2 times of the font size, I'd like to define a macro which accepts only one argument and deduces the baselineskip from the font size. It should be something like this.

\newcommand{\myfontsize}[1]{\fontsize{#1}{1.2*#1}\selectfont}

Of course, the code cannot compile because of 1.2*#1. I've searched for hours, but I couldn't find any solution. Since code like 1.2\baselineskip is possible, I expect this to be a simple question.

Addendum: I'm not quite familiar with low level LaTeX commands. Maybe fp and calc will help, but I don't know how.

Update 2013/11/13:

\documentclass{minimal}

\newlength\x
\newcommand{\zihao}[1]{\setlength\x{#1}\fontsize{\x}{1.2\x}\selectfont}
\newcommand{\chuhao}{\zihao{42.2pt}}
\newcommand{\xiaochu}{\zihao{36.1pt}}
\newcommand{\yihao}{\zihao{26.1pt}}
\newcommand{\xiaoyi}{\zihao{24.1pt}}
\newcommand{\erhao}{\zihao{22.1pt}}
\newcommand{\xiaoer}{\zihao{18.1pt}}
\newcommand{\sanhao}{\zihao{16.1pt}}
\newcommand{\xiaosan}{\zihao{15.1pt}}
\newcommand{\sihao}{\zihao{14.1pt}}
\newcommand{\xiaosi}{\zihao{12.1pt}}
\newcommand{\wuhao}{\zihao{10.5pt}}
\newcommand{\xiaowu}{\zihao{9.0pt}}

\begin{document}
\noindent \chuhao ABCDEFG\\
\xiaochu ABCDEFG\\
\yihao ABCDEFG\\
\xiaoyi ABCDEFG\\
\erhao ABCDEFG\\
\xiaoer ABCDEFG\\
\sanhao ABCDEFG\\
\xiaosan ABCDEFG\\
\sihao ABCDEFG\\
\xiaosi ABCDEFG\\
\wuhao ABCDEFG\\
\xiaowu ABCDEFG\
\end{document}

enter image description here

update 2013/11/13
Change \ to \par
enter image description here

Best Answer

You need to create a length (here, \myfntht), so that the multiply can be easily done.

I EDITED the answer to allow an optional parameter as the multiplier between the two arguments of the \fontsize macro. Note that, while I used multipliers of \baselineskip to set the new font size in my MWE, it is probably best to use another measure, as \baselineskip is itself changed during the making of a new font size, and thus, with its use, some of the spacings could get compounded (as in compounded interest).

\documentclass{article} 
\usepackage{lipsum}
\newlength\myfntht
\newcommand{\myfontsize}[2][1.2]{\setlength\myfntht{#2}%
  \fontsize{\myfntht}{#1\myfntht}\selectfont}
\begin{document}
\lipsum[4]
\myfontsize{\baselineskip} \lipsum[4]
\myfontsize{2\baselineskip} \lipsum[4]
\end{document}

enter image description here