Add LaTeX templates: novel, kdp-trade, poetry, textbook, childrens

This commit is contained in:
Solaria
2026-03-14 17:10:11 +00:00
parent b809713a52
commit 35d7b1ff08
6 changed files with 582 additions and 3 deletions
+8 -3
View File
@@ -45,9 +45,14 @@ class LaTeXExporter:
"""Export manuscript to LaTeX and compile to PDF."""
TEMPLATES = {
"memoir": "memoir.tex",
"academic": "academic.tex",
"base": "base.tex",
"novel": "novel.tex", # General fiction
"memoir": "memoir.tex", # Memoir/personal narrative
"kdp-trade": "kdp-trade.tex", # KDP 5.5x8.5
"academic": "academic.tex", # Academic/technical
"textbook": "textbook.tex", # Textbook with exercises
"poetry": "poetry.tex", # Poetry collections
"childrens": "childrens.tex", # Picture books
"base": "base.tex", # Basic template
}
def __init__(self, template_dir: Optional[str] = None):
@@ -0,0 +1,76 @@
% Opus Orchestrator - Children's Book Template
% Picture books, illustrated books
\documentclass[14pt]{memoir}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{color}
\usepackage{wrapfig}
% Picture book trim (standard)
\geometry{
paperwidth=8in,
paperheight=10in,
textwidth=6.5in,
textheight=8in,
inner=0.75in,
outer=0.75in,
}
% Hyperref
\hypersetup{colorlinks=false}
% Large readable fonts
\usepackage{gentium}
\usepackage{mathpazo}
% Chapter style
\chapterstyle{article}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\begin{document}
% Title page
\thispagestyle{empty}
\begin{center}
\vspace*{1in}
{\Huge\bfseries\booktitle\par}
\vspace{2in}
{\Large by \bookauthor\par}
\vfill
{\large\bookdate}
\end{center}
% Copyright
\clearpage
\thispagestyle{empty}
\vspace*{\fill}
\begin{center}
Copyright \textcopyright\ \bookdate\ \bookauthor\\
All rights reserved.
\end{center}
\vspace*{\fill}
% Story pages
\mainmatter
$body$
% About the author
\clearpage
\section*{About the Author}
\addcontentsline{toc}{section}{About the Author}
\bigskip
\textit{The author writes from their home.}\\
\end{document}
@@ -0,0 +1,111 @@
% Opus Orchestrator - KDP Trade Paperback Template
% Optimized for Amazon KDP 5.5x8.5
\documentclass[12pt]{memoir}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{microtype}
\usepackage{textcomp}
\usepackage{color}
% KDP Trim Size: 5.5 x 8.5 inches
\geometry{
papersize={5.5in,8.5in},
textwidth=4.5in,
textheight=7in,
inner=0.5in,
outer=0.5in,
top=0.5in,
bottom=0.5in,
bindingoffset=0.25in,
}
% Bleed (for KDP)
\usepackage[cam,center]{crop}
% Microtype
\microtypesetup{protrusion=true}
% Hyperref
\hypersetup{
colorlinks=false,
pdfborder={0 0 0},
pdfcreator={Opus Orchestrator},
pdfproducer={Opus Orchestrator},
}
% Fonts
\usepackage{mathptmx}
\usepackage[T1]{url}
% Chapter style
\chapterstyle{dowding}
% Headers
\pagestyle{plain}
\makeevenfoot{plain}{\thepage}{}{}
\makeoddfoot{plain}{}{}{\thepage}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\def\bookpublisher{$publisher$}
\def\bookisbn{$isbn$}
\begin{document}
% Half title
\thispagestyle{empty}
\vspace*{2in}
{\Huge\scshape\booktitle\par}
% Title page
\clearpage
\thispagestyle{empty}
\vspace*{1in}
\begin{center}
{\Huge\scshape\booktitle\par}
\vspace{1in}
{\Large\scshape\bookauthor\par}
\vfill
{\large\scshape\bookpublisher}\\
{\scshape\bookdate}
\end{center}
% Copyright
\clearpage
\thispagestyle{empty}
\vspace*{\fill}
\begin{center}
Copyright \textcopyright\ \bookdate\ \bookauthor\\
\bigskip
All rights reserved.\\
\bigskip
ISBN: $isbn$}
\end{center}
\vspace*{\fill}
% Dedication
$if(dedication)$
\clearpage
\thispagestyle{empty}
\vspace*{3in}
\begin{center}
\textit{$dedication$}
\end{center}
$endif$
% Contents
\clearpage
\tableofcontents
$body$
\end{document}
+130
View File
@@ -0,0 +1,130 @@
% Opus Orchestrator - Novel Template
% Fiction, general purpose
\documentclass[12pt,ebook]{memoir}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{microtype}
\usepackage{lettrine}
\usepackage{textcomp}
% Geometry - standard novel
\geometry{
paperwidth=5.5in,
paperheight=8.5in,
textwidth=4in,
textheight=7in,
inner=0.75in,
outer=0.5in,
top=0.75in,
bottom=0.75in,
bindingoffset=0.125in,
}
% Microtype
\microtypesetup{protrusion=true,tracking=true}
% Hyperref
\hypersetup{
colorlinks=false,
pdfborder={0 0 0},
}
% Chapter style - elegant
\chapterstyle{dowding}
\setsecnumdepth{none}
% Drop caps
\lettrinefont{LH}
\def\LettrineTextFont{\itshape}
% Fonts
\usepackage{mathptmx} % Times
\usepackage[T1]{url}
% Headers
\nouppercaseheads
\makepagestyle{novel}
\makepsmarks{novel}{
\nouppercase\markboth{\rightmark}{\leftmark}}
\pagestyle{novel}
% Epigraphs
\usepackage{epigraph}
\epigraphwidth=3.5in
\epigraphrule=0pt
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\def\bookpublisher{$publisher$}
\begin{document}
% Half title (verso)
\thispagestyle{empty}
\pdfbookmark{Half Title}{half}
\vspace*{2in}
\begin{raggedright}
\HUGE\scshape\booktitle
\end{raggedright}
% Title page (recto)
\clearpage
\thispagestyle{empty}
\vspace*{1in}
\begin{center}
\HUGE\scshape\booktitle\par
\vspace{1.5in}
\Large\scshape\bookauthor\par
\vfill
\large\scshape\bookpublisher\\
\normalsize\scshape\bookdate
\end{center}
% Copyright
\clearpage
\thispagestyle{empty}
\vspace*{\fill}
\begin{center}
Copyright \textcopyright\ \bookdate\ \bookauthor\\
All rights reserved.\\
ISBN: $isbn$
\end{center}
\vspace*{\fill}
% Dedication
$if(dedication)$
\clearpage
\thispagestyle{empty}
\vspace*{3in}
\begin{center}
\textit{$dedication$}
\end{center}
$endif$
% Epigraph
$if(epigraph)$
\clearpage
\begin{center}
\textit{$epigraph$}
\end{center}
$endif$
% Contents
\clearpage
\pdfbookmark{Contents}{toc}
\tableofcontents*
\mainmatter
$body$
\end{document}
@@ -0,0 +1,87 @@
% Opus Orchestrator - Poetry Template
% Verse collections, poetry books
\documentclass[12pt,openright]{memoir}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{microtype}
\usepackage{lettrine}
% Poetry trim size
\geometry{
paperwidth=6in,
paperheight=9in,
textwidth=4in,
textheight=7in,
inner=1in,
outer=0.75in,
}
% Hyperref
\hypersetup{colorlinks=false}
% Fonts
\usepackage{mathpazo} % Palatino - classic for poetry
% Chapter style
\chapterstyle{ell}
% Drop caps with lettrine
\lettrineIndentZeros=true
\lettrineHeight=2
\lettrineDepth=1
% Stanza spacing
\usepackage{setspace}
\setstretch{1.2}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\begin{document}
% Title page
\thispagestyle{empty}
\begin{center}
\vspace*{2in}
{\Huge\scshape\booktitle\par}
\vspace{1.5in}
{\Large\scshape\bookauthor\par}
\vfill
{\large\scshape\bookdate}
\end{center}
% Copyright
\clearpage
\thispagestyle{empty}
\vspace*{\fill}
\begin{center}
Copyright \textcopyright\ \bookdate\ \bookauthor\\
All rights reserved.
\end{center}
\vspace*{\fill}
% Dedication
$if(dedication)$
\clearpage
\thispagestyle{empty}
\vspace*{3in}
\begin{center}
\textit{$dedication$}
\end{center}
$endif$
% Poetry collection
\mainmatter
$body$
\end{document}
@@ -0,0 +1,170 @@
% Opus Orchestrator - Textbook/Academic Template
% Technical, educational, reference
\documentclass[12pt,oneside]{book}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{makeidx}
\usepackage{natbib}
\usepackage{titlesec}
\usepackage{booktabs}
\usepackage{listings}
\usepackage{fancyvrb}
\usepackage{multicol}
\usepackage{tcolorbox}
% Geometry
\geometry{
paperwidth=7in,
paperheight=10in,
textwidth=5.5in,
textheight=8in,
left=0.75in,
right=0.75in,
top=1in,
bottom=1in,
}
% Hyperref
\hypersetup{
colorlinks=true,
linkcolor=blue,
citecolor=blue,
urlcolor=blue,
}
% Chapter formatting
\titleformat{\chapter}[display]
{\normalfont\LARGE\bfseries}
{\chaptertitlename\ \thechapter}{20pt}{\LARGE\bfseries}
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{12pt}{\Large\bfseries}
\titleformat{\subsection}
{\normalfont\large\bfseries}
{\thesubsection}{12pt}{\large\bfseries}
% Headers
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[RO]{\thepage}
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\rightmark}
% Code listings
\lstset{
basicstyle=\ttfamily\small,
frame=single,
backgroundcolor=\color{lightgray},
language=Python,
}
% Theorems
\newtcbtheorem[number within=chapter]{theorem}{Theorem}%
{colback=blue!5,colframe=blue!75!black,fonttitle=\bfseries}{th}
\newtcbtheorem[number within=chapter]{definition}{Definition}%
{colback=green!5,colframe=green!75!black,fonttitle=\bfseries}{def}
% Index
\makeindex
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\def\bookpublisher{$publisher$}
\def\bookedition{$edition$}
\begin{document}
% Front matter
\frontmatter
% Title page
\begin{titlepage}
\begin{center}
\vspace*{1in}
{\Huge\bfseries\booktitle\par}
\vspace{0.5in}
{\Large\bookauthor\par}
\vfill
{\large\bookedition}\\
\bigskip
{\large\bookpublisher}\\
{\large\bookdate}
\end{titlepage}
% Copyright
\thispagestyle{empty}
\vspace*{\fill}
Copyright \textcopyright\ \bookdate\ \bookauthor\\
All rights reserved.
\vfill
% Dedication
$if(dedication)$
\clearpage
\begin{center}
\textit{$dedication$}
\end{center}
$endif$
% Acknowledgments
$if(acknowledgments)$
\chapter{Acknowledgments}
$acknowledgments$
$endif$
% Preface
$if(preface)$
\chapter{Preface}
$preface$
$endif$
% Abstract
$if(abstract)$
\chapter{Abstract}
$abstract$
$endif$
% Table of contents
\tableofcontents
% List of figures
\listoffigures
% List of tables
\listoftables
% List of listings
\lstlistoflistings
% Main matter
\mainmatter
$body$
% Back matter
\backmatter
% Bibliography
$if(bibliography)$
\bibliographystyle{plainnat}
\bibliography{$bibliography$}
$endif$
% Index
\printindex
\end{document}