24

I understand from THIS question that the current font size can be determined.

But how can I convert this to a length value?

\documentclass[10pt,a4paper]{article}
\newlength{\mytextsize}

   %This part fails.... 
   \makeatletter
      \setlength{\mytextsize}{\f@size pt}
   \makeatother

\begin{document}
    %do something.        
\end{document}

In other words, I want to use the 10pt declared in the \documentclass{...} elsewhere.

  • Is this question specific to the default document classes? – Werner Jun 14 '13 at 22:55
21

What you have is the right answer:

\documentclass[10pt,a4paper]{article}
\newlength{\mytextsize}

   %This part fails....  (no it doesn't:-)
   \makeatletter
\show\f@size
      \setlength{\mytextsize}{\f@size pt}
   \makeatother

\showthe\mytextsize
\begin{document}
    %do something.        
\end{document}

which produces a log of:

> \f@size=macro:
->10.
l.6 \show\f@size

? 
> 10.0pt.
l.10 \showthe\mytextsize

Showing your length has been set to 10pt.

However note that this saves the default text size not the name of the class option. For 10pt they happen to be the same but for 11pt option the default font size is 10.95pt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.