I have the following page which I am trying to get the first line to be centered without affecting the other text. However, using \centerline{} seems to ignore the page margin and does not wrap text to fit the original margin.

\centerline{\textbf{\large{Appendix \hypertarget{Appendix}{F}: Construction of the Managerial Performance Indicator (MSI)}}}

\vspace{0.5 cm}

This text is just for the example

enter image description here

  • Since \centerline is not supported in LaTeX, … – egreg May 24 '16 at 22:06

The macro \centerline comes from Plain TeX and its behavior is exactly what you see: it centers without wrapping text and without respecting the margin.

The macro is not supported in LaTeX; it exists just for historical reasons. If one knows how to properly use it, well; otherwise, it's better to leave it alone.

Perhaps you are looking for

Appendix \hypertarget{Appendix}{F}: Construction of the 
Managerial Performance Indicator (MSI)

Technical note.

Here is the definition of \centerline:

% latex.ltx, line 5030:

and here is the definition of \@@line:

% latex.ltx, line 5027:

Oh, well, what's \hb@xt@?

% latex.ltx, line 784:
\def\hb@xt@{\hbox to}

So \centerline{text} is the same as typing

\hbox to \hsize{\hss text\hss}

which has some peculiar properties:

  1. It doesn't start horizontal mode
  2. The text inside is not wrapped
  3. If the text inside is wider than \hsize (the current width for typesetting paragraphs), it will stick out in the margins by the same amount at left and right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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