# Text is not centered

The issue is that the text is not getting centered even after issueing \centering. The following picture depicts it :

The code:

\documentclass[12pt]{book}
\usepackage{wedn}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\begin{document}
\begin{titlepage}
{\newgeometry{margin=1in, centering}
\noindent \rule{\textwidth}{2pt}
{\LARGE\centering\bfseries MATERIAL SCIENCE \par}
\noindent \rule{\textwidth}{2pt}
{\wedn\large\centering {Department of Physics\par Pondicherry Engineering College}}
}
\end{titlepage}
\restoregeometry
\end{document}

-
Put \centering in place of \noindent and remove it from the other places. –  egreg May 13 '14 at 15:57

Less is more. You want all elements of your title page to be centered, so issue \centering at the top level.

\documentclass[12pt]{book}
\usepackage[T1]{fontenc}
\usepackage{geometry}

\usepackage{wedn} %<-------- ARE YOU REALLY SURE?

\begin{document}
\begin{titlepage}
\newgeometry{margin=1in, centering}
\centering

\rule{\textwidth}{2pt}

\LARGE\textbf{MATERIAL SCIENCE}

\rule{\textwidth}{2pt}

\large\wedn Department of Physics\\ Pondicherry Engineering College

\end{titlepage}

\restoregeometry

\end{document}


If you want the big text to be vertically centered between the rules, a lower level command is better:

\begin{titlepage}
\newgeometry{margin=1in, centering}
\centering

\hrule height 2pt \vspace{3pt}

\LARGE\textbf{MATERIAL SCIENCE}

\vspace{3pt}\hrule height 2pt

\medskip

\wedn\large Department of Physics\\ Pondicherry Engineering College

\end{titlepage}


Change the spacing to suit.

-

TeX uses the setting that is active at the end of the paragraph.

 {\wedn\large\centering Department of Physics\par Pondicherry Engineering College}% removed non-functional braces


The first "Department of Physics" is centered, because \centering is active, \par is inside the group. But "Pondicherry Engineering College" is using the setting before the group, i.e. not \centering.

Solution: Add \par explicitly:

{\wedn\large\centering Department of Physics\par Pondicherry Engineering College\par}


As alternative \centering can be put at the start of the titlepage environment as in egreg's answer, if all elements of the environment should be horizontally centered.

## Vertical centering of text between lines

In chat the question about vertical centering of the head line arised. Modifying egreg's example:

\documentclass[12pt]{book}
\usepackage[T1]{fontenc}
\usepackage{geometry}

\usepackage{wedn}

\begin{document}
\begin{titlepage}
\newgeometry{margin=1in, centering}
\centering

\LARGE
\hrule height 2pt\relax
\kern1ex
\centerline{\textbf{MATERIAL SCIENCE}}
\kern1ex
\hrule height 2pt\relax

\vspace{1ex}

\large\wedn
Department of Physics\\[.5ex]
Pondicherry Engineering College

\end{titlepage}

\restoregeometry

\end{document}


It is using plain TeX syntax here (\hrule, \centerline) rather than LaTeX, because it is a more direct approach. LaTeX always wants to start a new paragraph, which is not needed here.

A "pure LaTeX" solution is

\renewcommand*{\arrayrulewidth}{2pt}
\renewcommand*{\arraystretch}{0}
\begin{tabular*}{\textwidth}{@{}p{\textwidth}@{}}
\hline
\rule{0pt}{1ex}\tabularnewline
\centering\bfseries MATERIAL SCIENCE\tabularnewline
\rule{0pt}{1ex}\tabularnewline
\hline
\end{tabular*}

-