General ⇒ Orphans and widows
Orphans and widows
I am preparing a book that is composed of hundreds of very short stories. I want the title of each story to be centred and in caps (no special font or bold). Some are multi-line titles. And I want the person who recounted the story to be named after the story in flush right. In each chapter there are dozens of stories. There is no need for the story titles to appear in the table of contents.
The way I set it up originally was using the center environment for the titles for each story and the flushright environment for the name of the "author" of the story. This looks perfect, except for the fact that I get lots of orphans and widows.
Does any one have a suggestion on how to set this up? The "author"s name must stay with the story and so must the title.
Thanks in advance.
David
The way I set it up originally was using the center environment for the titles for each story and the flushright environment for the name of the "author" of the story. This looks perfect, except for the fact that I get lots of orphans and widows.
Does any one have a suggestion on how to set this up? The "author"s name must stay with the story and so must the title.
Thanks in advance.
David
NEW: TikZ book now 40% off at Amazon.com for a short time.

Re: Orphans and widows
I solved the first problem by coding all the story titles as subsections and then redefining the subsection:
\makeatletter
\renewcommand\subsection{\@startsection
{subsection}{1}{0mm} % name, level, indent
{-\baselineskip} % beforeskip
{0.5\baselineskip} % afterskip
{\normalfont\normalsize\centering\MakeUppercase}}
\makeatother
I still have a problem with the names of the authors. How do I keep them together with the stories?
Any help would be appreciated.
Thanks
\makeatletter
\renewcommand\subsection{\@startsection
{subsection}{1}{0mm} % name, level, indent
{-\baselineskip} % beforeskip
{0.5\baselineskip} % afterskip
{\normalfont\normalsize\centering\MakeUppercase}}
\makeatother
I still have a problem with the names of the authors. How do I keep them together with the stories?
Any help would be appreciated.
Thanks
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Orphans and widows
Regarding the title of this thread, try the solution from another thread [1] with exactly the same topic.
[1] Forum thread: Widows and Orphans
[1] Forum thread: Widows and Orphans
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Orphans and widows
The titlesec package can be useful. I include an example showing something similar to what you described:
Code: Select all
\documentclass{article}
\usepackage{titlesec}
\newcommand{\theAuthor}{}
\newcommand{\secformat}[1]{%
\parbox[b]{\textwidth}{\filcenter{\Large\scshape #1}}%
\par\vspace*{.5\baselineskip}%
\filleft\itshape\theAuthor}
\titleformat{\subsection}[block]
{}{}{0pt}{\secformat}
\begin{document}
\renewcommand\theAuthor{First author}
\subsection{first story}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\renewcommand\theAuthor{First author and Second author}
\subsection{second story\\ {\small\normalfont (my favorite)}}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Re: Orphans and widows
Thank you to both, especially to gmedina for your example. This is really good.
However, what if I wanted to put the author at the end of the story (with similar formatting to your example)? How might that work so that the author's name stayed with the story and is not left on it's own.
However, what if I wanted to put the author at the end of the story (with similar formatting to your example)? How might that work so that the author's name stayed with the story and is not left on it's own.
Orphans and widows
In that case, I would suggest something like the code below (using the advise that localghost gave you); if necessary, you will have to manually correct any misplacements of the authors.
Edit: initially I gave another solution that was poorly designed.
Code: Select all
\documentclass{book}
\usepackage{titlesec}
\clubpenalty10000
\widowpenalty10000
\newcommand{\secformat}[1]{%
\parbox[b]{\textwidth}{\filcenter{\Large\scshape #1}}}%
\titleformat{\subsection}[block]
{}{}{0pt}{\secformat}
\newsavebox{\storyAuthor}
\newenvironment{theStory}[2]%
{\sbox{\storyAuthor}{\itshape#2}%
\subsection{#1}}%
{\par\hspace*{\fill}\usebox{\storyAuthor}}
\begin{document}
\begin{theStory}{first story}{Author one}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\end{theStory}
\begin{theStory}{second story\\ {\small\normalfont (my favorite)}}{Author one and Author two}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\end{theStory}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Re: Orphans and widows
Honestly, I am overwhelmed. This is really an excellent solution. Thank you so much.
-
- Posts: 16
- Joined: Sat Dec 06, 2008 7:55 pm
Re: Orphans and widows
I'm glad I found this posting. It solved my problems. Here's another "thank-you".