Text FormattingFont Size of the Document Title

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
dasatti
Posts: 12
Joined: Sun Sep 09, 2012 5:14 pm

Font Size of the Document Title

Post by dasatti »

Hi,

I want to set the font size of the main title to 14pt. I am using the »article« class.

Code: Select all

\documentclass[a4paper,10pt,twocolumn]{article}
How can I do this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Font Size of the Document Title

Post by localghost »

You can patch a helper macro for the \maketitle command by the etoolbox package.

Code: Select all

\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage[T1]{fontenc}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\@maketitle}{\LARGE}{\Large}{}{}
\makeatother

\title{Document Title at \texttt{14pt}}
\author{dasatti}

\begin{document}
  \maketitle
\end{document}
With a document font size of 10pt this sets the size for the title to exactly 14.4pt.


Thorsten
dasatti
Posts: 12
Joined: Sun Sep 09, 2012 5:14 pm

Re: Font Size of the Document Title

Post by dasatti »

Yes, I had the idea about the 14.4pt title size. I wanted to know if there is some way to make it exactly 14pt in size but I guess 14.4pt will also work for me.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Font Size of the Document Title

Post by localghost »

Selection of an arbitrary font size is possible. The patch has to be modified a bit.

Code: Select all

\makeatletter
\patchcmd{\@maketitle}{\LARGE}{\fontsize{14}{17}\selectfont}{}{}
\makeatother
But I think the difference is almost not noticeable.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Font Size of the Document Title

Post by cgnieder »

In deed there is no visible difference (except for the leading); compare \fourteenpt with \Large:

Code: Select all

\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[left=0pt,right=0pt]{geometry}

\makeatletter
\newcommand*\fourteenpt{\fontsize{14}{15.5}\selectfont}
\newcommand*\totht[1]{\dimexpr\ht#1+\dp#1\relax}
\newcommand*\leading{{\setbox0\hbox{\strut}\the\totht0}}
\newcommand*\fntsize{{\setbox0\hbox{Mg}\the\totht0}}% total size of the letters Mg
\newcommand*\showsize[1]{{#1 {\ttfamily\string#1} (\f@size pt) \fntsize/\leading}\par}
\makeatother

\begin{document}
\showsize\tiny
\showsize\scriptsize
\showsize\footnotesize
\showsize\small
\showsize\normalsize
\showsize\large
\showsize\fourteenpt
\showsize\Large
\showsize\LARGE
\showsize\huge
\showsize\Huge
\end{document}
fntsize.png
fntsize.png (55.8 KiB) Viewed 77976 times
Regards
site moderator & package author
Post Reply