[Tex/LaTex] How to fit the title into a single line

chaptersline-breakingsectioning

I think I am just too new to the LaTeX environment.

Do I just change the font size to fit the title into a single line? Then how do one change the font size of the title? Is there any other smart/automatic way of doing it?

Title means the title for the whole document, not chapter titles. Originally, I wanted to resize the fonts so that it can fit into one line, but then later I thought there was no issue for a 2-line title, so I kind of ignored the issue and kept on working. However, it would be still nice to know how to adjust the font size on the title.

Here is an example:

\documentclass[11pt]{article}

\title{\textbf{This Is A Very Long Title That Cannot Be Fitted Into One Line}}
\author{Author}
\date{}
\begin{document}

\maketitle

\end{document}

I am sorry I didn't update the question earlier. Thanks to everyone for the comments!

Best Answer

I wouldn't consider what you're asking good practice, but you can redefine the \@maketitle macro (which is internally used by the article class to typeset the title), to put the title into a box and scale it to the appropriate width using the \resizebox macro from the graphics/graphicx package. Here's an example that might fit your needs:

\documentclass{article}

\usepackage{graphics}

\makeatletter
  \def\title@font{\Large\bfseries}
  \let\ltx@maketitle\@maketitle
  \def\@maketitle{\bgroup%
    \let\ltx@title\@title%
    \def\@title{\resizebox{\textwidth}{!}{%
      \mbox{\title@font\ltx@title}%
    }}%
    \ltx@maketitle%
  \egroup}
\makeatother

\title{A Title That's Either Very Long or Awfully Short}
\author{Me}

\begin{document}
\maketitle
\end{document}

Here, the title font properties are stored in \title@font, so you can change them at your own discretion. As an example, I set the title in a bold font. In particular, I would advise you to adjust the font size in the definition of \title@font, e.g. \Large, \Huge, \normalsize, ... , to match the proper optical font size as closely as possible, i.e. that the title has to be scaled by as small an amount as possible.

Related Question