5

Background I am not very experienced with LaTeX, but I am looking to use it to create the PDF so we can self-publish a short story anthology (previously our group has used MS Word, but that is really painful; now we hope to use pandoc to convert from .docx to .html; and from .html to markdown; and from markdown to LaTeX). Over the past few weeks, I've scoured tex.stackexchange.com, reddit.com/r/latex, CTAN and various blog posts for advice on templates to use. It looks like a lot of people recommend the memoir document class, but memoir seemed very complicated. I wound up starting from book and I've added in various solutions to try to accommodate the fact that we are doing a multi-author short story anthology (so it is good to put the story title and story author in the TOC, in the page headings and in the title page for each story).

What I need help with The template I have appears to work okay for our needs, but I feel like Frankenstein building his Monster--I don't really know all the parts of how LaTeX works. I've just been copy/pasting (with some adaptations) to create the following template. So I am hoping that some of you who are more knowledgeable could give a quick look at this template and see if there are some redundancies, things that could be done more cleanly, or things that could be done correctly (vs. how I'm doing them now).

The template:

  % ==========================================================================================
  %   SIMPLE NOVEL TEMPLATE for LaTeX
  %   Also good for short story anthologies
  %   6" x 9" with bleed
  %   Built by NewMexicoKid 2017-08-05
  %   based on the answer by https://tex.stackexchange.com/users/30640/user12711
  %   Ref: https://tex.stackexchange.com/questions/66902/latex-template-for-typesetting-a-novel
  % ==========================================================================================
  \documentclass[12pt,twoside,openright]{book}
  \usepackage[paperwidth=6.125in,paperheight=9.25in,top=69.0pt,bottom=66.0pt,headsep=21pt,headheight=66.0pt,outer=36pt,inner=53pt]{geometry}
  \usepackage{textcomp}
  \usepackage{verse}       % for poetry, but you need to end each line with \\
  \usepackage{alltt}       % for PRE-formatted poetry
  %-------------------------------------------------------------------------------
  \usepackage[no-math]{fontspec}    % Lets one use system fonts (but with no math)
  \setmainfont{EBGaramond} % EBGaramond font; this is the free Garamond clone
  \usepackage{anyfontsize}
  %-------------------------------------------------------------------------------
  \usepackage{titlesec}
  % remove chapter name and number: http://blog.chapagain.com.np/latex-remove-chapter-name-and-number/
  \titleformat{\chapter}[display]
     {\normalfont\bfseries}{}{0pt}{\Huge}

  \usepackage{fancyhdr} % fancy headers
  \usepackage{microtype} % use this to improve typography
  \usepackage{hyphenat}\hyphenation{my-word, hyphen-ate, never, hyphen} 

  \usepackage[english]{babel} % - for lorem ipsum
  \usepackage{blindtext} % -- just for lorem ipsum

  \usepackage{setspace}\onehalfspacing\frenchspacing\flushbottom\sloppy
     % https://tex.stackexchange.com/questions/65355/flushbottom-vs-raggedbottom
     \setstretch{1.15}
     \setlength{\dimen0}{\textheight}
     \addtolength{\dimen0}{-\topskip}
     \divide\dimen0\baselineskip
     \setlength{\textheight}{\number\dimen0 \baselineskip}
     \addtolength{\textheight}{\topskip}

  \usepackage[normalem]{ulem} % Needed for \sout (strikeout)
  \usepackage{suffix}         % Needed for different chapter headings
  \usepackage[english]{babel}

  % --------------------------------------------------------------------------
  % hyperlinks for the e-book and PDF 
  \usepackage{hyperref}
  \usepackage{color}
  \definecolor{Blue}{RGB}{4, 6, 145}
  \hypersetup{colorlinks,linktocpage,linktoc=all,linkcolor=Blue,urlcolor=Blue}
  % --------------------------------------------------------------------------

  \usepackage{etoc}% only so far to enable multiple uses of "\tableofcontents"
  % maybe the document class already allows it.

  \usepackage{emptypage} % No headers on empty pages

  \DeclareRobustCommand*\AUTHOR [1]{}
  \newcommand\SHOWAUTHORS {%
  \DeclareRobustCommand*\AUTHOR [1]{{\normalfont\small\itshape ##1}}}

  % =========================================================================================
  % https://tex.stackexchange.com/questions/156862/displaying-author-for-each-chapter-in-book
  % The following code not only displays chaptername and author in the TOC but also at the 
  % start of each chapter.
  \makeatletter
  \newcommand\smallcaps[1]{\textsc{#1}}
  \newcommand\newchapter[2] {\gdef\@chaptertitle{#1}\gdef\@chapterauthor{#2}\chapter[#1 / \AUTHOR{#2}]{#1}\printchapterauthor{#2}}
  \def\@chapterauthor{}
  \def\@chaptertitle{}
  \fancypagestyle{mystyle}{%
      \fancyhf{}%
      \fancyhead[LE]{\thepage\quad\smallcaps{\@chaptertitle}}% 
      \fancyhead[RO]{\smallcaps{\@chapterauthor}\quad\thepage}%}
      \renewcommand{\chaptermark}[1]{\markboth{##1}{}}%
  }
  \makeatother

  \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
  \setcounter{secnumdepth}{0}
  \renewcommand{\chaptername}{}
  \renewcommand{\thechapter}{}
  \setcounter{chapter}{-1}

  \makeatletter
  \newcommand{\printchapterauthor}[1]{%
    {\parindent0pt\vspace*{-25pt}%
    \linespread{1.1}\large\scshape#1%
    \par\nobreak\vspace*{35pt}}
    \@afterheading%
  }
  \makeatother
  % =========================================================================================

  % ---------------------------------------------
  % Fancy headers with story name and author
  % Refers back to mystyle defined above
  % ---------------------------------------------
  \pagestyle{mystyle} %fancy
  \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
  % ---------------------------------------------

  % ========================================================================
  % Needed for scene breaks with a "flowerleft" flourish
  \usepackage{adforn}

  % \Scene macro is used for scene breaks * * * * *
  \makeatletter
  \newcommand{\Scene}{%
     \par\nobreak\@afterheading
     \vspace{\topsep}
     \addvspace{\topsep\relax}
     \noindent\hfil%
     \adfflourishleftdouble\quad\adfflowerleft\quad\adfflourishrightdouble
     \hfil\par%
     \vspace{\topsep}
     \@afterindentfalse\@afterheading%
  }
  \makeatother
  % ========================================================================
  % ---------------------------------------------------------------------------
  % use begin{itpars} ... end{itpars} around blocks of text to be italicized
  % https://tex.stackexchange.com/questions/258394/make-block-of-text-italicized
  \newenvironment{itpars}
      {\par\itshape}
      {\par}
  % ---------------------------------------------------------------------------
  % ===============================================================  
  % Provide the author, title and date for the title page
  \author{Author Name} \title{Anthology or Novel Title} \date{2017-08-05}
  % ===============================================================  

  \begin{document}

  \frontmatter       % the front of the book has (lowercase) roman numerals
  \SHOWAUTHORS
  % \tableofcontents
  % -------------------------------------
  % Front matter pages
  \thispagestyle{empty}

  % \begin{figure}[htbp]
  % \centering
  %     \includegraphics[width=3.2in]{title_image.png}
  % \end{figure}

  \begin{center}
      \fontsize{50}{60}\selectfont ANTHOLOGY TITLE
  \end{center}

  \vspace{1.0in}

  \begin{center}
  \Huge{Author Name}
  \end{center}

  % \vspace{1.1in}
  \vfill

  \begin{center}
      \emph{\large{06 August 2017}}
  \end{center}

  \clearpage

  \vspace*{4.5cm}

  \begin{center}
      \Huge{\textsc{Interior Book Title}}
  \end{center}

  \vspace{2em}

  {\parindent0pt % no indentation for this section
  Written by Author Name

  \vspace{2em}

  Copyright \textcopyright 2017 by Author Name

  All rights reserved. Printed in the United States of America. No part of
  this book may be used or reproduced in any manner whatsoever without
  written permission except in the case of brief quotations embodied in
  critical articles and reviews. 

  \vspace{2em}

  ISBN XXX TO BE FILLED IN

  % \vspace{2em}
  \vfill
  Cover Design by A Book Cover Designer
  } %end no indent

  \clearpage

  \emph{This page constitutes a continuation of the copyright page.}

  \begin{center}

  \emph{Story One} copyright \textcopyright 2017 by Author Name

  \emph{Story Two} copyright \textcopyright 2017 by Other Author

  \end{center}

  \clearpage

  \tableofcontents

  \clearpage

  \section{Acknowledgements}\label{acknowledgements}

  The Editors of this anthology would like to thank folks.

  \section{Introduction}\label{introduction}

  \Blindtext
  \Blindtext

  % -------------------------------------

  % \chapter*{Foreword}            % \chapter* (* excludes from Contents)
  \section{Foreward}\label{Foreward}
  %   \input{Foreword.tex}\clearpage
  \Blindtext

  \mainmatter        % the main part of the book will have standard pages
  %
  % ======================================================================
  %
  % Import the chapters; specify chapter title and author with \newchapter
  %
  \part{Book One}
  \newchapter{Story One}{Author One}
  % \input{Story_One}
  \Blindtext\clearpage
  \Blindtext\clearpage
  \Blindtext\clearpage
  \clearpage
  \newchapter{Story Two}{Author Two}
  % \input{Story_Two}
  \Blindtext\clearpage
  \Blindtext\clearpage
  \Blindtext\clearpage
  \clearpage
  \part{Book Two}
  \newchapter{Story Three}{Author One}
  % \input{Story_One}
  \Blindtext\clearpage
  \Blindtext\clearpage
  \Blindtext\clearpage
  \clearpage
  \newchapter{Story Four}{Author Three}
  % \input{Story_Two}
  \Blindtext\clearpage
  \Blindtext\clearpage
  \Blindtext\clearpage
  \clearpage
  % ======================================================================
  \end{document}

Here's the PDF that is generated by the template.

  • Memoir would, frankly, be a better choice. It provides a very coherent approach. Using a standard class, you need a lot of packages to match its functionality. That means a lot of potential for conflicts, confusions etc. It is also harder to typeset typographic monstrosities with Memoir. – cfr Aug 12 '17 at 3:02
  • My concern with memoir was in diving into all of the options; at the time it seemed simpler to just google and grab snippets from here and there and tack them together. Especially since I hadn't seen others use memoir for short story anthologies. But perhaps I should take the time to learn memoir and give it a try... – NewMexicoKid Aug 12 '17 at 4:24
  • Think about it in the real physical world: Either buying a product from the store having a manual with it (memoir is free already) or going to the junk yard (google is pretty much that sometimes) searching for some scrap parts and putting together a product with the same functionality using duct tape. – Johannes_B Aug 12 '17 at 7:23
  • Sometimes you only have time for duct tape... I did google for LaTeX memoir short story anthology but didn't find anything to help short-cut the process. That being said, I do intend to study memoir to see how I might use it. I do begin to see, thanks to cfr, that the duct tape I'm using is holding together something that probably is fairly mismatched. – NewMexicoKid Aug 12 '17 at 10:54
  • I would advise using \raggedbottom, because the different spacing between paragraphs is bad. I think that for your needs ConTeXt will be a better choice than LaTeX: the former supports grid typesetting, which is a must-have when you typeset printed books. – Michael Fraiman Aug 18 '17 at 18:16
8
\sloppy 

You don't want this.

 \setstretch{1.15}

This is not wrong, but it contradicts \onehalfspacing. So remove whichever you don't want.

 \setlength{\dimen0}{\textheight}
 \addtolength{\dimen0}{-\topskip}
 \divide\dimen0\baselineskip
 \setlength{\textheight}{\number\dimen0 \baselineskip}
 \addtolength{\textheight}{\topskip}

This is bad in so many ways. You are treating TeX dimensions as LaTeX lengths. This may not cause errors, but is very icky. However, the real problem here is that you are sneaking behind geometry's back and spray-painting graffiti all over this book it's been writing.

If you ask geometry to manage the page layout dimensions, you must only change those dimensions using geometry's commands. Otherwise, it cannot possibly know what the dimensions should be. geometry is recommended with standard classes. But if you don't want to use it, don't load it. Don't ask it to dinner and then spit in its soup.

You are loading packages multiple times. Don't. For example, babel is loaded more than once.

Specify the variant of English if that matters - you will get different typesetting with british than with american, for example. If different authors use different varieties of English, you have a multilingual document and need to switch languages appropriately.

With very few exceptions, hyperref must be loaded last. You are loading it too early.

Consider using xcolor rather than color.

If you use titlesec, use it to format all your section headings. If you don't want to do that, don't load it.

\newcommand\smallcaps[1]{\textsc{#1}}

Why on Earth or Jupiter would you do this? There is no reason to do this and plenty of reason not to. The \textXX macros are not defined as regular \newcommands by LaTeX for a reason. Moreover, this actually makes more typing and makes it harder for people to help you or understand your code.

\def\@chapterauthor{}
\def\@chaptertitle{}

Don't do this. Use

\newcommand\@chapterauthor{}
\newcommand\@chaptertitle{}

Then use \renewcommand to change them. \def will give you no warning if you overwrite an existing macro, however crucial. It does no checks. Unless you want to do that checking yourself, use \newcommand which will check for you. (You want an error if you try to overwrite an existing command without meaning to!)

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

How many times do you want to renew this?

\renewcommand{\thechapter}{}
\setcounter{chapter}{-1}

Are you sure? There might be some reason for this, but it seems odd.

\usepackage{adforn}

Can't complain about this, I suppose.

\newcommand{\Scene}{%
     \par\nobreak\@afterheading
     \vspace{\topsep}
     \addvspace{\topsep\relax}
     \noindent\hfil%
     \adfflourishleftdouble\quad\adfflowerleft\quad\adfflourishrightdouble
     \hfil\par%
     \vspace{\topsep}
     \@afterindentfalse\@afterheading%
  }

A new line is a space. A macro name eats the space. A closing curly bracket doesn't. You are very likely introducing spaces when you don't want them by commenting lines you don't need to and not commenting ones you do need to.

\Huge{Author Name}
\emph{\large{06 August 2017}}
\Huge{\textsc{Interior Book Title}}

\Huge etc. are switches. They don't take arguments.

\Huge Author Name
\emph{\large 06 August 2017}
\Huge \textsc{Interior Book Title}

are equivalent and more perspicuous.

  • cfr, thanks for your advice. I have just a couple of clarifying questions: 1. Re: your comment about titlesec: am I using it at all in the template? Does titlesec compete with fancyhdr? 2. What does \onehalfspacing do? – NewMexicoKid Aug 12 '17 at 4:17
  • @NewMexicoKid 1. No I don't think you're using it. You can always remove it and see if it still all works. It doesn't compete with fancyhdr although it is designed to work best with titleps, which would compete with fancyhdr. 2. Sets the stretch to 1.213, 1.241 or 1.25, depending on the default font size of the document. Since you immediately set it to 1.15, it effectively does nothing. – cfr Aug 12 '17 at 12:20
  • looks like \titlesec defines \titleformat. It's not clear to me, though, what: \titleformat{\chapter}[display] {\normalfont\bfseries}{}{0pt}{\Huge} is doing. Is this the format of the title on each story? – NewMexicoKid Aug 12 '17 at 13:17
  • Yes. Probably that is relevant. It is just rather confusing with all the \newchapter stuff around it. – cfr Aug 12 '17 at 16:05
  • I ran into a possible problem after making the changes. I had 67 of the Underfull \vbox (badness 4391) has occurred while \output is active [] vs. 7 of them with the \usepackage{setspace}\onehalfspacing\frenchspacing\flushbottom\sloppy % https://tex.stackexchange.com/questions/65355/flushbottom-vs-raggedbottom \setstretch{1.15} \setlength{\dimen0}{\textheight} \addtolength{\dimen0}{-\topskip} \divide\dimen0\baselineskip \setlength{\textheight}{\number\dimen0 \baselineskip} \addtolength{\textheight}{\topskip} code in there. Is there a good way to accomplish this? – NewMexicoKid Aug 12 '17 at 22:27
1

Do have a look at the "novel" document class. It is compatible with TeXLive 2016 and later. Not part of the default TeX distro, you have to request it be added.

The package uses LuaLaTeX only, UTF-8 encoding only. You don't need to know Lua. Uses Open Type fonts with features as requested. Inherently multilingual.

The novel class was specifically written for fiction, either a novel or a collection of short stories. Comes with elaborate documentation, including a discussion of some things you should know if you are doing P.O.D.

And, it has built-in PDF/X capability, verified using Adobe Acrobat Pro.

If you try the package, look in the documentation "extras" folder for an example of a brief (fake) novel.

Just remember that this package was written specifically for printed fiction (not e-books). It has what you need, and eliminates math-dissertation stuff that you don't need.

Also shows you how to prepare a color cover separated to CMYK, if that's what you need.

  • Thanks for the suggestion; I would really prefer to find a class that can be used for both print books and e-books, if such a thing exists. – NewMexicoKid Aug 19 '17 at 18:06
  • @NewMexicoKid E-books are the tricky part. TeX does not normally place inter-word spaces as space characters in the PDF. It merely positions the characters. But an E-book needs real spaces. There is a way to do that in pdfLaTeX, but not (currently) LuaLaTeX. On the other hand, pdfLaTeX does not have real utf-8 characters, which can be a handicap in some cases. If the E-book is for commercial sale, rather than an acadecic journal, you will probably have to start with HTML or even MSWord (not PDF), thus incompatible with TeX. – user139954 Aug 20 '17 at 0:19
  • Thanks, RobtAll. So would it be better for me to use pandoc to convert the LaTeX back to markdown and then from there to html to build the epub? – NewMexicoKid Aug 21 '17 at 2:47
  • @NewMexicoKid I can't answer your question about pandoc, since I don't do things that way. All I know is that epub, mobi, and even Kindle are basically glorified HTML. The more your document looks like HTML, the better. You get no advantage from TeX typesetting or layout, except insofar as you can generate HTML from TeX. And, if your digital publication is actually PDF, then in the case of a non-math publication, you'd find it better to export PDF/A from a program such as LibreOffice. – user139954 Aug 21 '17 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.