Add 8 more LaTeX templates: kdp sizes, hardcover, screenplay, journal

This commit is contained in:
Solaria
2026-03-14 17:15:15 +00:00
parent 35d7b1ff08
commit 7fdc8d8948
8 changed files with 706 additions and 8 deletions
+24 -8
View File
@@ -45,14 +45,30 @@ class LaTeXExporter:
"""Export manuscript to LaTeX and compile to PDF."""
TEMPLATES = {
"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
# KDP Templates (print-ready)
"kdp-pocket": "kdp-pocket.tex", # 5x8 mass market
"kdp-trade": "kdp-trade.tex", # 5.5x8.5 standard
"kdp-6x9": "kdp-6x9.tex", # 6x9 popular
"kdp-square": "kdp-square.tex", # 8x8 art/photo
"kdp-large": "kdp-large.tex", # 8.5x11 workbook
# Book Types
"novel": "novel.tex", # General fiction
"memoir": "memoir.tex", # Memoir/personal
"hardcover": "hardcover.tex", # Premium hardcover
"poetry": "poetry.tex", # Poetry collections
"childrens": "childrens.tex", # Picture books
# Technical/Educational
"academic": "academic.tex", # Academic papers
"textbook": "textbook.tex", # With exercises
"journal": "journal.tex", # Workbooks/planners
# Specialty
"screenplay": "screenplay.tex", # Film/TV scripts
# Base
"base": "base.tex", # Minimal template
}
def __init__(self, template_dir: Optional[str] = None):
@@ -0,0 +1,121 @@
% Opus Orchestrator - Hardcover Template
% Premium hardcover binding
\documentclass[12pt]{book}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{microtype}
\usepackage{textcomp}
\usepackage{color}
% Hardcover trim (slightly larger for binding)
\geometry{
paperwidth=6.14in,
paperheight=9.21in,
textwidth=4.5in,
textheight=7.5in,
inner=0.75in,
outer=0.5in,
top=0.75in,
bottom=0.75in,
}
% Microtype
\microtypesetup{protrusion=true}
% Hyperref
\hypersetup{
colorlinks=false,
}
% Fonts
\usepackage{mathptmx}
\usepackage[T1]{url}
% Fancy chapter headings
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\LARGE\bfseries}
{\chaptertitlename\ \thechapter}{20pt}{\LARGE\bfseries}
% Headers
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[RO]{\thepage}
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\rightmark}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\def\bookpublisher{$publisher$}
\begin{document}
% Half title
\thispagestyle{empty}
\vspace*{2in}
\begin{center}
{\Huge\scshape\booktitle}
\end{center}
% 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\\
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
\tableofcontents
\mainmatter
$body$
\end{document}
@@ -0,0 +1,96 @@
% Opus Orchestrator - Journal/Workbook Template
% Interactive journals, workbooks, planners
\documentclass[10pt]{memoir}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{tasks}
\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{multicol}
\usepackage{enumitem}
% Journal trim
\geometry{
paperwidth=7in,
paperheight=9in,
textwidth=5.5in,
textheight=7.5in,
inner=0.75in,
outer=0.75in,
}
% Hyperref
\hypersetup{colorlinks=false}
% Fonts
\usepackage{mathptmx}
% Chapter style
\chapterstyle{plain}
% Task lists
\settasks{label=(\arabic*), label-width=1.5em}
% Boxed sections
\usepackage{tcolorbox}
\newtcolorbox{sectionbox}[1][]{
colback=blue!5,
colframe=blue!75!black,
#1
}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\begin{document}
% Title page
\thispagestyle{empty}
\begin{center}
\vspace*{1.5in}
{\Huge\bfseries\booktitle\par}
\vspace{1in}
{\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}
% Contents
\clearpage
\tableofcontents
\mainmatter
$body$
% Notes section
\clearpage
\section*{Notes}
\vspace{1in}
\begin{multicols}{2}
\noindent\rule{\linewidth}{0.5pt}
\vfill\columnbreak
\noindent\rule{\linewidth}{0.5pt}
\vfill\columnbreak
\noindent\rule{\linewidth}{0.5pt}
\end{multicols}
\end{document}
@@ -0,0 +1,100 @@
% Opus Orchestrator - KDP 6x9 Template
% Amazon KDP 6" x 9" standard
\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: 6 x 9 inches
\geometry{
papersize={6in,9in},
textwidth=4.5in,
textheight=7.5in,
inner=0.75in,
outer=0.5in,
top=0.75in,
bottom=0.75in,
bindingoffset=0.25in,
}
% Bleed for KDP
\usepackage[cam,center]{crop}
% Microtype
\microtypesetup{protrusion=true}
% Hyperref
\hypersetup{
colorlinks=false,
pdfborder={0 0 0},
}
% Fonts
\usepackage{mathptmx}
% Chapter style
\chapterstyle{dowding}
% Headers
\pagestyle{simple}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\def\bookpublisher{$publisher$}
\def\bookisbn{$isbn$}
\begin{document}
% Title page
\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}
@@ -0,0 +1,86 @@
% Opus Orchestrator - KDP Large Format 8.5x11
% Workbooks, coloring books, textbooks
\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}
\usepackage{booktabs}
\usepackage{multicol}
% KDP Large: 8.5 x 11 inches
\geometry{
papersize={8.5in,11in},
textwidth=7in,
textheight=9in,
inner=0.75in,
outer=0.75in,
top=1in,
bottom=1in,
}
% Bleed
\usepackage[cam,center]{crop}
% Microtype
\microtypesetup{protrusion=true}
% Hyperref
\hypersetup{
colorlinks=false,
}
% Fonts
\usepackage{mathptmx}
% Chapter style
\chapterstyle{hangnum}
% Headers
\pagestyle{simple}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\def\bookpublisher{$publisher$}
\begin{document}
% Title page
\thispagestyle{empty}
\begin{center}
\vspace*{1in}
{\Huge\bfseries\booktitle\par}
\vspace{1in}
{\Large by \bookauthor\par}
\vfill
{\large\bookpublisher}\\
{\bookdate}
\end{center}
% Copyright
\clearpage
\thispagestyle{empty}
\vspace*{\fill}
\begin{center}
Copyright \textcopyright\ \bookdate\ \bookauthor\\
All rights reserved.
\end{center}
\vspace*{\fill}
% Contents
\clearpage
\tableofcontents
$body$
\end{document}
@@ -0,0 +1,93 @@
% Opus Orchestrator - KDP Pocket Book 5x8
% Mass market paperback, pocket size
\documentclass[11pt]{memoir}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{microtype}
\usepackage{textcomp}
% KDP Pocket: 5 x 8 inches
\geometry{
papersize={5in,8in},
textwidth=4in,
textheight=6.5in,
inner=0.5in,
outer=0.5in,
top=0.5in,
bottom=0.5in,
bindingoffset=0.125in,
}
% Microtype
\microtypesetup{protrusion=true}
% Hyperref
\hypersetup{
colorlinks=false,
pdfborder={0 0 0},
}
% Fonts - compact
\usepackage{mathptmx}
% Chapter style - compact
\chapterstyle{dowding}
\setsecnumdepth{none}
% Headers
\pagestyle{plain}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\def\bookpublisher{$publisher$}
\begin{document}
% Title page
\thispagestyle{empty}
\vspace*{0.5in}
\begin{center}
{\Large\scshape\booktitle\par}
\vspace{1in}
{\large\scshape\bookauthor\par}
\vfill
{\scshape\bookpublisher}\\
\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*{2in}
\begin{center}
\textit{$dedication$}
\end{center}
$endif$
% Contents
\clearpage
\tableofcontents
$body$
\end{document}
@@ -0,0 +1,82 @@
% Opus Orchestrator - KDP Square 8x8
% Art books, photography, cookbooks
\documentclass[12pt]{memoir}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{microtype}
\usepackage{color}
\usepackage{wrapfig}
% KDP Square: 8 x 8 inches
\geometry{
papersize={8in,8in},
textwidth=6.5in,
textheight=6.5in,
inner=0.75in,
outer=0.75in,
top=0.75in,
bottom=0.75in,
}
% Bleed
\usepackage[cam,center]{crop}
% Microtype
\microtypesetup{protrusion=true}
% Hyperref
\hypersetup{colorlinks=false}
% Fonts
\usepackage{mathptmx}
\usepackage{Georgia}
% Chapter style
\chapterstyle{plain}
% Headers
\pagestyle{simple}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\def\bookpublisher{$publisher$}
\begin{document}
% Title page
\thispagestyle{empty}
\begin{center}
\vspace*{1.5in}
{\Huge\bfseries\booktitle\par}
\vspace{1in}
{\Large by \bookauthor\par}
\vfill
{\large\bookpublisher}\\
{\bookdate}
\end{center}
% Copyright
\clearpage
\thispagestyle{empty}
\vspace*{\fill}
\begin{center}
Copyright \textcopyright\ \bookdate\ \bookauthor\\
All rights reserved.
\end{center}
\vspace*{\fill}
% Contents
\clearpage
\tableofcontents
$body$
\end{document}
@@ -0,0 +1,104 @@
% Opus Orchestrator - Screenplay Template
% Film/TV scripts, stage plays
\documentclass[12pt]{article}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{setspace}
\usepackage{url}
% Screenplay format
\geometry{
paperwidth=8.5in,
paperheight=11in,
textwidth=6in,
textheight=9in,
left=1.5in,
right=1in,
top=1in,
bottom=1in,
}
% Hyperref
\hypersetup{colorlinks=false}
% Single spaced for screenplay
\singlespacing
% Custom commands for screenplay
\usepackage{ifthen}
\newcounter{scene}
\widowpenalty=10000
\clubpenalty=10000
% Scene heading
\newcommand{\sceneheading}[1]{%
\vspace{1ex}%
\textbf{#1}%
\vspace{1ex}%
}
% Action
\newcommand{\action}[1]{%
#1%
\vspace{1ex}%
}
% Character name
\newcommand{\character}[1]{%
\vspace{1ex}%
\textbf{\MakeUppercase{#1}}%
\vspace{1ex}%
}
% Parenthetical
\newcommand{\parenthetical}[1]{%
\textit{#1}%
}
% Dialogue
\newcommand{\dialogue}[1]{%
#1%
\vspace{1ex}%
}
% Transition
\newcommand{\transition}[1]{%
\raggedleft%
\textbf{#1}%
\normalfont%
\vspace{2ex}%
}
% Metadata
\def\booktitle{$book_title$}
\def\bookauthor{$author$}
\def\bookdate{$date$}
\begin{document}
% Title page
\thispagestyle{empty}
\begin{center}
\vspace*{3in}
{\LARGE\bfseries\booktitle}
\bigskip
\bigskip
written by
\bigskip
\bookauthor
\vfill
\bookdate
\end{center}
% Scenes
\mainmatter
$body$
\end{document}