General ⇒ Orphans and widows
Orphans and widows
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Re: Orphans and widows
\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
[1] Forum thread: Widows and Orphans
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Orphans and widows
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}
Re: Orphans and widows
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
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}
Re: Orphans and widows
-
- Posts: 16
- Joined: Sat Dec 06, 2008 7:55 pm