14

In this query, @MartinSharrer provides a nice macro to create a custom fontsize. Unfortunately, I don't understand how to use it.

The code below uses his macro

\documentclass{beamer}
\newlength{\mylength}
\makeatletter
\newcommand{\mycfs}[1]{%
  \normalsize
  \@defaultunits\mylength=#1pt\relax\@nnil
  \edef\@tempa{{\strip@pt\mylength}}%
  \ifx\protect\@typeset@protect
     \edef\@currsize{\noexpand\mycfs\@tempa}% store calculated size
  \fi
  \mylength=1.2\mylength
  \edef\@tempa{\@tempa{\strip@pt\mylength}}%
  \@tempa
  \expandafter\fontsize\@tempa
  \selectfont
}
\makeatother
\begin{document}
{\mycfs{8} This is a test} \\
{\mycfs{7} This is a test} \\
{\mycfs{6} This is a test} \\
{\mycfs{5} This is a test} \\
\end{document}

But produces this output .

The font selection part is great but I can't figure out how to remove the numbers at the beginning of each line. Could somebody advise please?

1
  • 1
    Why can't you just use \fontsize ? (as in flav's answer) Nov 21, 2017 at 8:59

2 Answers 2

7

I can't figure out how to remove the numbers at the beginning of each line.

Simply remove the line that contains just \@tempa.

25

using fontsize and selectfont (https://en.wikibooks.org/wiki/LaTeX/Fonts):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel}

\begin{document}

Coucou

\fontsize{14pt}{14pt}\selectfont
Coucou

\fontsize{28pt}{28pt}\selectfont
Coucou

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .