0

The code below works if I do not include \input{ChapterHeading.tex}, but I would like to include this if possible?

\documentclass{article}

\begin{document}
\input{title.tex}
\tableofcontents
\clearpage
\input{ChapterHeading.tex}
\chapter{(Chapter One)} \input{Introduction.tex}
\chapter{Chapter Two} \input{rv-NSS.tex}
\end{document}

and this is the ChapterHeading.tex file

\documentclass{book}
\usepackage{graphics}

\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Large\raggedleft}
{\MakeUppercase{\chaptertitlename}%
\rlap{ \resizebox{!}{1.5cm}{\thechapter} \rule{5cm}{1.5cm}}}
{10pt}{\Huge}
\titlespacing*{\chapter}{0pt}{30pt}{20pt}


 \setcounter{chapter}{0}
 \begin{document}
 \pagenumbering{gobble}
 \chapter{Introduction}
 \end{document}
Bazman
  • 857
  • 1
    The error is because you're using another preamble in the ChapterHeading.tex file. Instead of that you could build your title page manually using the titlepage environment. – Aradnix Sep 19 '14 at 17:38

1 Answers1

1

If you put the preamble of ChapterHeading.tex in HeadingPreamble.tex, you may achieve:

\documentclass{article}

\input{HeadingPreamble.tex}

\begin{document}
\input{title.tex}
\tableofcontents
\clearpage
\input{ChapterHeading.tex}
\chapter{(Chapter One)} \input{Introduction.tex}
\chapter{Chapter Two} \input{rv-NSS.tex}
\end{document}

HeadingPreamble.tex file

\usepackage{graphics}

\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Large\raggedleft}
{\MakeUppercase{\chaptertitlename}%
\rlap{ \resizebox{!}{1.5cm}{\thechapter} \rule{5cm}{1.5cm}}}
{10pt}{\Huge}
\titlespacing*{\chapter}{0pt}{30pt}{20pt}

\setcounter{chapter}{0}

ChapterHeading.tex file

\pagenumbering{gobble}

It is sensible to just remove ChapterHeading.tex, so the main document would be:

\documentclass{article}

\input{HeadingPreamble.tex}

\begin{document}
\input{title.tex}
\tableofcontents
\clearpage
\pagenumbering{gobble}
\chapter{(Chapter One)} \input{Introduction.tex}
\chapter{Chapter Two} \input{rv-NSS.tex}
\end{document}
umarcor
  • 1,454