# How to make my own LaTeX template?

Ok I know that my question is quite local, however, I have struggled with it for a long time and I could not find the answer, so I decided to post it here.

I have to rewrite a book (which was written using Word) by LaTeX, without changing the structure and the content.

This book is divided into 2 parts; part 1 has 2 chapters and part 2 has 3 chapters. Chapters are numbered by alphabet letter like Chapter A, Chapter B,... and theorems in each chapter are numbered depending in its chapter like Theorem A1, Theorem B7,...

I have searched on the Internet for book templates, but I found nothing that fully appropriate with this style of book. Every time I tried I got troubles with numbering theorem, with index and content.... :|

Could you please help me to write the appropriate LaTeX code? Please do not tell me that I should change the way the book behaves, since the author want to keep it, and I am just an editor only.

update : Here is the picture that I made :

For the theorem, I number it by hand, as the following code :

   \indent \textbf{Định lý A1.}
(Thales thuận dạng hình học)\emph{Nếu ba đường thẳng đôi một song song $a, b, c$ cùng bị hai đường thẳng $\Delta, \Delta'$ tương ứng cắt tại $A, B, C; A’, B’, C’$ thì $\dfrac{AB}{BC}=\dfrac{A'B'}{B'C'}$. }

• I think you should show a picture. – karathan Apr 3 '13 at 7:30
• One thing to pay attention the next time: do not write $a, b, c$, write the longer $a$, $b$, $c$ instead. Here you enumerate the three variables a, b and c and thus the comma needs to be outside the math environment to get the spacing correct. – Peater de Xel Apr 3 '13 at 9:52

Here is a very basic way, using the book-class and the amsmath-commands:

\documentclass{book}

\usepackage{mathtools} % loads the ams-packages and provides some fixes
\usepackage{lipsum} % for dummy text only

\renewcommand{\thechapter}{\Alph{chapter}} % change chapter numbering to A, B, C, ...
\newtheorem{mytheorem}{Theorem} % define new theorem style

\begin{document}
\tableofcontents

\chapter{Lorem Ipsum}
\lipsum[1]

\begin{mytheorem} %first theorem - this will be "A.1"
\begin{align}
a^2+b^2=c^2
\end{align}
\end{mytheorem}

\lipsum[2-5]

\chapter{Lorem Ipsum}
\lipsum[6-8]

\begin{mytheorem} %second theorem - this will be B.1
\begin{align}
1+1=3
\end{align}
\end{mytheorem}

\lipsum[9]

\end{document}


## Edit

Based on your screenshot, try the following – you have to remove the old definition of mytheorem from the previous example, then add:

\usepackage{chngcntr} %allows you to reset counters within others

\newcounter{mytheoremcounter} %create a counter for your theorems
\setcounter{mytheoremcounter}{0}%set them to zero. At the begin of every theorem
%, this gets increased by one, so the first theorem will be '1'
\counterwithin{mytheoremcounter}{chapter} % reset the counter in every chapter

\newenvironment{mytheorem}{%
\indent\textbf{Theorem \thechapter\arabic{mytheoremcounter}.}
}{}


Then write the following:

\begin{mytheorem}
(Lorem Ipsum Dolor Sit Amet) \emph{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibu- lum ut, placerat ac, adipiscing vitae, felis. $\Delta$, $\Delta'$
Curabitur dictum gravida mauris. $A, B, C; A’, B’, C’$ mollis ac, nulla
$\dfrac{AB}{BC}=\dfrac{A'B'}{B'C'}$. }
\end{mytheorem}


This produces:

## Edit 2

The same result with an improved interface:

\newenvironment{mytheorem}[1]{
\indent\textbf{Theorem \thechapter\arabic{mytheoremcounter}.} (#1) \em
}{}


Use it like this:

\begin{mytheorem}{The title}
The theorem
\end{mytheorem}


With the \em you do not need to write the \emph{...} every time.

• Thank you ralfix for your answer, but I do not mean the theorem is labeled by (A1), but I mean it is Theorem A1 : $a^2+b^2=c^2$. So how can I numbering the theorem ? – Knumber10 Apr 3 '13 at 9:14
• If you replace the line \newtheorem{mytheorem}{Theorem} by \newtheorem{mytheorem}{Theorem}[chapter], the theorem heading will be of the form "Theorem A.1". – jub0bs Apr 3 '13 at 9:43
• It surely is more "fitting" to use the amsthm package in such a case – but defining the environment himself it is possible to exactly match the given style without needing to define a new theorem style (if @NguyễnDuyKhánh wants the dot after the number, not as separator e.g.) – Peater de Xel Apr 3 '13 at 9:56
• @ralfix: You can format the chapter heading as @NguyễnDuyKhánh requested by adding \usepackage{titlesec} and \titleformat{\chapter}[hang]{\bf\huge}{\Alph{chapter}.}{1pc}{} in the preamble. – Dominikus K. Apr 3 '13 at 10:52
• @ralfix you can add the following lines to your preamble to produce the desired sectional unit headers: \usepackage{titlesec} \titleformat{\chapter}[block] {\normalfont\LARGE\bfseries\filcenter}{\thechapter.}{0.4em}{} \titleformat{\section} {\normalfont\Large\bfseries\filcenter}{\thesection.}{0.4em}{} \titlespacing*{\chapter} {0pt}{40pt}{20pt} – Gonzalo Medina Apr 4 '13 at 2:06