Skip to content

Instantly share code, notes, and snippets.

@ricardoalcocer
Last active May 25, 2022 09:22
Show Gist options
  • Save ricardoalcocer/eeea650891069bfc9622 to your computer and use it in GitHub Desktop.
Save ricardoalcocer/eeea650891069bfc9622 to your computer and use it in GitHub Desktop.
LaTeX master template for writing a book
\chapter{Chapter Title}
\begin{shaded}
\textbf{This chapter covers:}
\begin{itemize}
\item Topic 1
\item Topic 2
\end{itemize}
\end{shaded}
Chapter intro goes here
\begin{shaded}
\textbf{You could have shaded callouts}\\*
This area could be used to add more stuff
\end{shaded}
\section{Section Name}
Section content goes here. In sections you can have images that you refer to the as figure ref{fig:1_1}. When you do this, LaTeX will look for a file named 1_1.png in the images folder specified in the master.tex file. Make sure you include the caption and the label as part of the image declaration.
\begin{figure}[h]
\centering
\includegraphics[scale=0.2]{1_1}
\caption{How Titanium works}
\label{fig:1_1}
\end{figure}
\clearpage
\begin{shaded}
The clear page command above I use sometimes because of an image is placed in the bottom of a page, the float gets broken and the rest of the text and images in the chapter get messed up.
\end{shaded}
\subsection{This is a subsection}
Subsecton text goes here
\subsection{This is a subsection}
You could have tables and reference them as table \ref{tbl:my-label}.
\begin{table}[hbtp]
\footnotesize
\centering
\begin{tabulary}{1.0\textwidth}{L|L}\hline
\textbf{Column 1} & \textbf{Column 2)} \\ \hline\hline
Conent & Content \\ \hline
Conent & Content \\ \hline
Conent & Content \\ \hline
Conent & Content \\ \hline
\end{tabulary}
\caption{Native Platform Tools}
\label{tbl:my-label}
\end{table}
You can also add code, and reference it as listing \ref{lst:1_1}
\begin{lstlisting}[caption={The caption},label={lst:1_1}]
var x=y;
var obj={
javascript : "ftw"
}
\end{lstlisting}
\section{Summary}
End your chapter and bye bye
% Template from:
% http://tex.stackexchange.com/questions/70824/painless-memoir-class-book-template
\documentclass[10pt,twoside,openright]{memoir}
\usepackage[paperwidth=7.5in, paperheight=9.25in,bindingoffset=.75in]{geometry}
\setstocksize{9.25in}{7.5in}
\usepackage[protrusion=true,expansion=true]{microtype}
% START MY CUSTOMIZATIONS
\usepackage{framed}
\usepackage{color}
\definecolor{shadecolor}{gray}{0.90} % Color for callouts
\usepackage{graphicx} % If you want to include postscript graphics
\graphicspath{ {images/} } % Images folder
\usepackage[utf8]{inputenc} % UTF-8 characters
\usepackage{hyperref} % For URLs
\usepackage{tabulary} % Nicer tables
\usepackage{listings} % Code listings
\usepackage{listingsutf8} % For source code listings
\lstset{basicstyle=\footnotesize\ttfamily, % Code listings
breaklines=true,
keywordstyle=\color{blue}\ttfamily,
stringstyle=\color{red}\ttfamily,
commentstyle=\color{green}\ttfamily} % Quotes in code listings
\lstset{framextopmargin=50pt}
% END MY CUSTOMIZATIONS
\usepackage{makeidx} % If you want to generate an index, automatically
\makeindex % Working with indexes
%%% BEGIN DOCUMENT
\begin{document}
%%% TITLE PAGE
\pagestyle{empty}
\begin{vplace}[0.7]
\begin{center}
\huge{\textbf{The Title}}
\end{center}
\begin{center}
\large{\textit{The Subtitle}}
\vspace{0.3in}
\end{center}
\begin{center}
\textbf{The Author}
\end{center}
\end{vplace}
%%% COPYRIGHTS PAGE
\clearpage
\include{chapters/copyrights}
\clearpage
\frontmatter
\include{chapters/foreword}
\include{chapters/preface}
\include{chapters/acknowledgements}
\include{chapters/aboutbook}
\tableofcontents
\mainmatter
\part{The First Part}
\include{chapters/ch01}
\part{The Other Part}
\include{chapters/ch01}
%%% BEGIN APPENDICES
\begin{appendices}
\include{chapters/appendixa}
\include{chapters/appendixb}
\include{chapters/appendixc}
\end{appendices}
\backmatter
\listoffigures
\clearpage
\listoftables
\clearpage
\printindex
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment