Book Template Using Files

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

LaTeX TEMPLATE

Book structure placed in separate files

Please take the example LaTeX code below and create a two level structure to make it
easier to read. Namely, put each 'part' in a file and put each 'chapter' in the part
file. main.tex then uses 'input' or 'includes' or some other way, to incorporate the
parts into the book and the chapters into the parts.

Original example code to be restructured


\documentclass{book} \usepackage{titlesec} \usepackage{geometry} \usepackage{lipsum}
\usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage{amsmath}
\usepackage{natbib} \usepackage{hyperref} \usepackage{tabularx} \usepackage{cellspace}
% Package to add cell padding \setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt} \geometry{a4paper, margin=1in}

% Adjust spacing before and after chapter titles \titlespacing*{\chapter}{0pt}{-20pt}


{20pt}

\begin{document}

% Title page \begin{titlepage} \centering \vspace*{2cm} {\Huge \textbf{The Book


Title}}\ \vspace{1.5cm} {\Large Author Name}\ \vfill {\large \today} \end{titlepage}

% Table of Contents \tableofcontents \newpage

\part{Introduction to ITS} \chapter{Intelligent Tutoring Systems (ITS)}


\section{Overview} \lipsum[1-2]

\section{History} \lipsum[3-4]

\chapter{Components of ITS} \section{Student Model} \subsection{Knowledge


Representation} \lipsum[5-6]

\subsection{Adaptive Learning} \lipsum[7-8]

\section{Instructional Model} \lipsum[9-10]

\section{Interface Model} \lipsum[11-12]

\part{Advanced Topics in ITS} \chapter{Machine Learning in ITS} \section{Supervised


Learning} \lipsum[13-14]

\section{Unsupervised Learning} \lipsum[15-16]

\chapter{Natural Language Processing} \section{Text Analysis} \lipsum[17-18]

\section{Dialogue Systems} \lipsum[19-20]

% Include table from separate file \input{table.tex}

% Appendices \appendix \chapter{Appendix Title} \section{Appendix Section} \lipsum[21-


22]

% Bibliography \begin{thebibliography}{9} \bibitem{latexcompanion} Author.


\textit{Book Title}. Publisher, Year.
\bibitem{einstein} Albert Einstein. \textit{Zur Elektrodynamik bewegter K{"o}rper}.
(German) [\textit{On the electrodynamics of moving bodies}]. Annalen der Physik, 1905.

\end{thebibliography}

\end{document}

Restructured Code
To structure the LaTeX book into a two-level structure with parts and chapters, we'll
create separate files for each part and each chapter. The main file ( main.tex ) will
include these part files, and each part file will include the corresponding chapter
files. Here's how you can do it:

Directory Structure
1. main.tex
2. part1.tex (Introduction to ITS)
3. part2.tex (Advanced Topics in ITS)
4. chapter1.tex (Intelligent Tutoring Systems (ITS))
5. chapter2.tex (Components of ITS)
6. chapter3.tex (Machine Learning in ITS)
7. chapter4.tex (Natural Language Processing)
8. table.tex

main.tex

\documentclass{book}
\usepackage{titlesec}
\usepackage{geometry}
\usepackage{lipsum}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{natbib}
\usepackage{hyperref}
\usepackage{tabularx}
\usepackage{cellspace} % Package to add cell padding
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\geometry{a4paper, margin=1in}

% Adjust spacing before and after chapter titles


\titlespacing*{\chapter}{0pt}{-20pt}{20pt}

\begin{document}

% Title page
\begin{titlepage}
\centering
\vspace*{2cm}
{\Huge \textbf{The Book Title}}\\
\vspace{1.5cm}
{\Large Author Name}\\
\vfill
{\large \today}
\end{titlepage}

% Table of Contents
\tableofcontents
\newpage

\input{part1.tex}
\input{part2.tex}

% Include table from separate file


\input{table.tex}

% Appendices
\appendix
\chapter{Appendix Title}
\section{Appendix Section}
\lipsum[21-22]

% Bibliography
\begin{thebibliography}{9}
\bibitem{latexcompanion}
Author.
\textit{Book Title}.
Publisher, Year.

\bibitem{einstein}
Albert Einstein.
\textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German)
[\textit{On the electrodynamics of moving bodies}]. Annalen der Physik, 1905.

\end{thebibliography}

\end{document}

part1.tex (Introduction to ITS)

\part{Introduction to ITS}
\input{chapter1.tex}
\input{chapter2.tex}

part2.tex (Advanced Topics in ITS)

\part{Advanced Topics in ITS}


\input{chapter3.tex}
\input{chapter4.tex}

chapter1.tex (Intelligent Tutoring Systems (ITS))


\chapter{Intelligent Tutoring Systems (ITS)}
\section{Overview}
\lipsum[1-2]

\section{History}
\lipsum[3-4]

chapter2.tex (Components of ITS)

\chapter{Components of ITS}
\section{Student Model}
\subsection{Knowledge Representation}
\lipsum[5-6]

\subsection{Adaptive Learning}
\lipsum[7-8]

\section{Instructional Model}
\lipsum[9-10]

\section{Interface Model}
\lipsum[11-12]

chapter3.tex (Machine Learning in ITS)

\chapter{Machine Learning in ITS}


\section{Supervised Learning}
\lipsum[13-14]

\section{Unsupervised Learning}
\lipsum[15-16]

chapter4.tex (Natural Language Processing)

\chapter{Natural Language Processing}


\section{Text Analysis}
\lipsum[17-18]

\section{Dialogue Systems}
\lipsum[19-20]

table.tex (Table content)

% Table content here


\begin{table}[h!]
\centering
\begin{tabular}{| m{7cm} | m{5cm} |}
\hline
\textbf{Topic} & \textbf{Citation} \\
\hline
Implementation of step analyzer and step generator & Shute \& Psotka, 1996 \\
\hline
Evaluation of tutoring system during and after development & Shute \& Psotka, 1996 \\
\hline
Involvement of instructors in design and evaluation & Dick \& Carey, 1990 \\
\hline
Designing student activities and user interfaces & Clark \& Mayer, 2002 \\
\hline
\end{tabular}
\caption{Important Topics for Tutoring System Developers}
\label{table:1}
\end{table}

With this structure, each part and chapter is organized into separate files, making
the main document easier to read and manage. You can compile main.tex in a LaTeX
editor to generate the complete document.

You might also like