Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
1  
Is this what you are looking for Chapter number and chapter title in one line. I am sure your SO question will migrate here as its TeX related. –  texenthusiast Feb 28 '13 at 6:43
    
You may end up redefining \maketitle –  Sean Allred Feb 28 '13 at 9:02
3  
Hello! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. This seems necessary since as you can see, in the comments above, one of the users thinks you speak about \maketitle and the second one thinks you speak about \chapter. –  tohecz Feb 28 '13 at 9:06

1 Answer 1

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.

share|improve this answer
    
Sorry I am really noob to Latex. How to use \title@font? –  Snowfish Apr 1 '13 at 21:24
    
@Snowfish observe the use of makeatletter and makeatother -- these commands turn the at symbol @ into a letter and an 'other' respectively. Normally, @ is a special character and not available for control sequences, but \makeatletter allows this, and \makeatother disallows it. (@ is often used for internal package commands.) See tex.stackexchange.com/questions/8351/…. –  Sean Allred Apr 5 '13 at 8:12
    
If you're talking about actually using it, check out \renewcommand. –  Sean Allred Apr 5 '13 at 8:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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