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.

The issue is that the text is not getting centered even after issueing \centering. The following picture depicts it :
enter image description here
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} 
share|improve this question
    
Put \centering in place of \noindent and remove it from the other places. –  egreg May 13 at 15:57

2 Answers 2

up vote 6 down vote accepted

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} 

enter image description here

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}

enter image description here

Change the spacing to suit.

share|improve this answer

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}

Result

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*}
share|improve this answer

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.