General ⇒ Document layout (book of poems)
Document layout (book of poems)
I am currently working on a book of poems and I recently discovered the key features that LaTeX provides for this kind of documents. Until now, I only have used it for scientific articles.
I have a bit of a problem, due to my lack of knowledge and experience.
I want my book to contain several sections, but not in the common sense of the word. For example, I want to divide my poems into "Love poems" and "Heroic poems", with the following askings:
- The TOC to contain a title "Love poems", like a chapter name, and then all the poems underneath it, like usual sections
- I want a new page on which to write "Love poems" only (just like blank pages that sepparate chapters), and afterwards the poems. Then after I wrote all the love poems, when entering the second part, I want again an allmost blank page, on which I only want "Heroic poems", and then the poems on the following pages.
Until now managed to supress the chapter numbers, but I don't know how to obtain this layout. I thought about using "Love poems" as a chapter and then the poems as sections of it, but then how can I get only the chapter's name written on a new page?
Thank you for your attention and help,
Adrian
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Document layout (book of poems)
Code: Select all
\documentclass{book}
\usepackage{lipsum}% used for dummy text
\setcounter{secnumdepth}{-1}% removes numbering of sectioning units
\usepackage{titlesec}
\begin{document}
\tableofcontents
%%% Chapter formatting
\titleformat{\chapter}
{\Huge\bfseries}% global formatting (title and number)
{\thechapter.\,}% number formatting; if empty, it removes the number (but not from TOC)
{0pt}% spacing between the number and the title
{}% code/content between the number and the title
[\clearpage]% code/content after the title; if you want sections to start on the next right page, use \cleardoublepage instead of \clearpage
\titlespacing{\chapter}
{0pt}% left margin
{5cm}% vertical spacing before the title
{0cm}% vertical spacing after the title
%%%
\chapter{Love poems}
\section{First poem}
\lipsum[1-4]% dummy text
\chapter{Heroic poems}
\section{First poem}
\lipsum[1-4]% dummy text
\end{document}
Re: Document layout (book of poems)
Document layout (book of poems)
How can I get the chapter's name written on a blank page, only by itself and then the following pages to contain the (sub)sections?
I intend to make "Love poems" & "Heroic poems" to be chapters and then the poems belonging to them, the sections.
Document layout (book of poems)
Code: Select all
\documentclass{book}
\setcounter{secnumdepth}{-1}
\begin{document}
\tableofcontents
\chapter{Love poems}
\clearpage
\section{First poem}
Some text.
\chapter{Heroic poems}
\clearpage
\section{First poem}
Some text.
\end{document}
Document layout (book of poems)
Still you'll need to change \thesection so it doesn't add chapter numbers to section numbers if you were going to treat the poems as sections. You'd also need to reset the chapter numbers with each part division.
Here's an example.
Code: Select all
\documentclass{book}
\usepackage{lipsum}% for adding filler text
\renewcommand{\thesection}{\arabic{section}}
\begin{document}
\tableofcontents
\part*{Funny Poems}
\addcontentsline{toc}{chapter}{Funny Poems}
\section{Hungry Mungry}
\lipsum[1]
\section{The Old Man From Nantucket}
\lipsum[2]
\part*{Serious Poems}
\setcounter{section}{0}
\addcontentsline{toc}{chapter}{Serious Poems}
\section{Ode to LaTeX}
\lipsum[3]
\end{document}
If you want to do something more advanced, then definitely look at the documentation of the titlesec package. There isn't going to be another easy way.
Document layout (book of poems)
Thank you very much, that did the trick that I wanted, simple and effective. I only have to lower the title of the chapter, i.e. in the middle of thee page, but I think I can do this by myself.meho_r wrote:Well, I don't know an easier way to manipulate sectioning units than by using titlesec package. However, if you don't want an automatic solution, and since there are only two chapters, you can simply clear the page after the chapter titles manually, e.g.:
Thanks again to all of you!
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Document layout (book of poems)
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10