Text Formattinglong bold large centered text exceeds right margin!!

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
amegahed3
Posts: 15
Joined: Wed Feb 25, 2009 11:20 am

long bold large centered text exceeds right margin!!

Post by amegahed3 »

Hi all,

I am a Latex beginner, and I face the following problem: whenever I try to type a long title that is centered, bold, large and underlined, it goes out of the page's right margin, instead of dividing it into two lines!!

Here is the code I use:

Code: Select all

\documentclass[12pt]{article}%{amsart}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[top= 1in, bottom= 1in, left= 1in, right= 1in]{geometry}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\begin{document}

\begin{centering}
\underline{\large{\textbf{Progress in the Special Problems Course ``8900 ALE'' Taken by Aly Megahed in Fall 2008 }}}\\
\end{centering}

\end{document}
Attached is an output pdf file that shows the problem!

Could you please help me?

Thanks.

Aly
Attachments
test.pdf
(10.93 KiB) Downloaded 631 times

Recommended reading 2024:

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

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

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: long bold large centered text exceeds right margin!!

Post by josephwright »

Your problem is \underline, which TeX cannot line-break (more or less). There are ways around this, but underlining is normally regarded as bad news in typeset material. Do you really need this?

By the way, I would favour doing

\begin{center}
\large\bfseries
Your text goes here.
\end{center}

as the center environment is a group, and will "trap" \bfseries and \large.
Joseph Wright
amegahed3
Posts: 15
Joined: Wed Feb 25, 2009 11:20 am

Re: long bold large centered text exceeds right margin!!

Post by amegahed3 »

Thanks a lot, Joseph for your reply.

I do understand all what you said. But what are the ways to go around this (as I really need the underline) ?

Thanks.

Aly
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

long bold large centered text exceeds right margin!!

Post by josephwright »

The soul package will do the job:

Code: Select all

\documentclass{article}
\usepackage{soul}

\begin{document}

\begin{center}
  \large\bfseries
  \ul{Progress in the Special Problems Course 
    ``8900 ALE'' Taken by Aly Megahed in Fall 2008 }
\end{center}

\end{document}
Joseph Wright
amegahed3
Posts: 15
Joined: Wed Feb 25, 2009 11:20 am

Re: long bold large centered text exceeds right margin!!

Post by amegahed3 »

Thanks a lot, Joseph. It worked perfectly. I really really appreciate your help.

Aly
Post Reply