Text Formattingcentering a chapter title

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Re: centering a chapter title

Post by thedoctor818 »

Now when I try the code, I get the error that I am missing \begin{document}???
-Michael D

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: centering a chapter title

Post by Stefan Kottwitz »

What is the current code you are using that's raising the error?

Stefan
LaTeX.org admin
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

centering a chapter title

Post by thedoctor818 »

Now, I can get this code #1 below to work:

Code: Select all

\documentclass[12pt,letterpaper,twoside,openany]{book}
\usepackage[pagestyles]{titlesec}
\usepackage[left=0.50in,right=0.45in,top=0.50in,bottom=0.50in]{geometry}


\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries\centering}{}{20pt}{\Huge}
\titlespacing*{\chapter}
  {0pt}{50pt}{40pt}

\newpagestyle{mystyle}{\sethead{}{}{}\setfoot{}{\thepage}{}}
\pagestyle{mystyle}

\begin{document}
%\maketitle
\tableofcontents

\chapter{WEEKDAY EVENING PRAYERS.}

In the Name of the Father, and of the Son, and of the Holy Spirit. Amen.

more text...

etc

\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries\centering}{\centering\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}
  {0pt}{50pt}{40pt}
 
\titleformat{\section}[display]
  {\normalfont\Large\bfseries\centering}{}{20pt}{\Large}
\titlespacing*{\chapter}
  {0pt}{50pt}{40pt} 

\appendix
\chapter{ON THE SIGN OF THE PRECIOUS AND LIFE-GIVING CROSS.}

\section{text}
\subsection*{text}

more text...

etc

\end{document}

However, when I try to add back my packages as in Code #2, below; I get the error: File ended while scanning use of \@argdef???

Here is that code:

Code: Select all

\documentclass[12pt,letterpaper,twoside,openany]{book}
\usepackage[pagestyles]{titlesec}
\usepackage[left=0.50in,right=0.45in,top=0.50in,bottom=0.50in]{geometry}
\usepackage{liturg}
\usepackage{framed}

\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries\centering}{}{20pt}{\Huge}
\titlespacing*{\chapter}
  {0pt}{50pt}{40pt}

\newpagestyle{mystyle}{\sethead{}{}{}\setfoot{}{\thepage}{}}
\pagestyle{mystyle}

\begin{document}
%\maketitle
\tableofcontents

\chapter{WEEKDAY EVENING PRAYERS.}

In the Name of the Father, and of the Son, and of the Holy Spirit. Amen.

more text...

etc

\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries\centering}{\centering\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}
  {0pt}{50pt}{40pt}
 
\titleformat{\section}[display]
  {\normalfont\Large\bfseries\centering}{}{20pt}{\Large}
\titlespacing*{\chapter}
  {0pt}{50pt}{40pt} 

\appendix
\chapter{ON THE SIGN OF THE PRECIOUS AND LIFE-GIVING CROSS.}

\section{text}
\subsection*{text}

more text...

etc

\end{document}
Any help would be appreaciated.

-MD
-Michael D
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: centering a chapter title

Post by Stefan Kottwitz »

The second code works for me without problems. Could you post your .log file for that code as attachment here?

Stefan
LaTeX.org admin
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Re: centering a chapter title

Post by thedoctor818 »

Thanks for all the help!!!
-Michael D
Post Reply