is possible make a command like this?
\fontsize{2\normalsize}{2\normalsize}\selectfont
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityYour request isn't directly possible. The command \normalsize
isn't a dimension, but a command that performs several actions.
Of course the command \normalsize
depends on the font size. But it also depends on the class. The standard classes define the command related to the selected font size in the files size1X.clo
. The X
stands for
0 => 10pt
1 => 11pt
2 => 12pt
In the file size10.clo
\normalsize
is defined as
\renewcommand\normalsize{%
\@setfontsize\normalsize\@xpt\@xiipt
\abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
\abovedisplayshortskip \z@ \@plus3\p@
\belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
\belowdisplayskip \abovedisplayskip
\let\@listi\@listI}
where \@setfontsize\normalsize\@xpt\@xiipt
means:
\def\@xpt{10}
\def\@xipt{10.95}
\def\@xiipt{12}
\def\@setfontsize#1#2#3{\@nomath#1%
\ifx\protect\@typeset@protect
\let\@currsize#1%
\fi
\fontsize{#2}{#3}\selectfont}
To detect the current font size see How to display the font size in use in the final output
There you can find that the command \f@size
represent the current font size. To save the standard font size use:
\edef\savefontsize{\f@size}
I can imagine the following example:
\documentclass{article}
\makeatletter
\begingroup
\normalsize
\xdef\doublesize{\noexpand\fontsize{\noexpand\numexpr2*\f@size\noexpand\relax pt}{\noexpand\dimexpr\f@baselineskip+\f@baselineskip\noexpand\relax}\noexpand\selectfont}
\endgroup
\begin{document}
Text Text
\doublesize Text Text
\end{document}
\f@size
would expand to 10.95, which isn't legal in \numexpr
; probably \xdef\doublesize{\noexpand\fontsize{\the\dimexpr2\dimexpr\f@size pt}{\the\dimexpr2\dimexpr\f@baselineskip}\noexpand\selectfont}
is better.
– egreg
Aug 14 '12 at 20:42
Take a look at the relsize
package, it does exactly what you request. A MWE:
\documentclass{article}
\usepackage{blindtext,relsize}
\begin{document}
\thispagestyle{empty}
\textscale{2}{\blindtext\par}
{\relscale{2}\blindtext}\par}
\end{document}
\relscale
takes just one argument, the scale factor. If you want to limit the effect put the \relscale
within a group, e.g. {\relscale{2}\blindtext}
.
– Torbjørn T.
Aug 14 '12 at 18:20
it is set relative to the current fontsize:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tgpagella}
\makeatletter
\def\setFS#1{\@tempdima=\f@size pt\fontsize{#1\@tempdima}{\dimexpr #1\@tempdima+2pt}\selectfont}
\makeatother
\begin{document}
foo \setFS{1.5}bar \setFS{2}baz \normalsize
foobar
\end{document}