1

I am currently writing a rule book using sections/subsections/subsubsection/paragraphs to break the rules down into parts. I am using the titlesec package to format the sections; however, the problem I'm running into is that the "hang" shape for \titleformat doesn't automatically cause a page break if it goes past the bottom margin of the page (as opposed to the "runin" shape). Is there a way to prevent this by making some sort of "hang/runin" hybrid?

Here is my titlesec code:

\titleformat{\section}[hang]{\bfseries\Large}{\thesection}{0.4em}{}
\titlespacing*{\section}{0pt}{2\baselineskip}{1.25\baselineskip}
\titleformat{\subsection}[hang]{\bfseries\large}{\thesubsection}{0.4em}{\mdseries\normalsize}
\titlespacing*{\subsection}{2em}{1\baselineskip}{1\baselineskip}
\titleformat{\subsubsection}[hang]{\bfseries\large}{\thesubsubsection}{0.4em}{\mdseries\normalsize}
\titlespacing*{\subsubsection}{4em}{1\baselineskip}{1\baselineskip}
\titleformat{\paragraph}[hang]{\bfseries\large}{\theparagraph}{0.4em}{\mdseries\normalsize}
\titlespacing*{\paragraph}{6em}{1\baselineskip}{1\baselineskip}

Here is the content:

\chapter{Rules}
\section{Distribution of Power}

    \subsection{The following list describes the hierarchy of power in the League:}
        \begin{enumerate}
            \item League Commissioner
            \item Deputy League Commissioner and Divisionals Commissioners
            \item Director of Operations and Deputy Divisional League Commissioners
            \item Deputy Director of Operations
            \item Forum Administrators
            \item Game Officials
            \item General Managers
            \item Assistant General Managers
        \end{enumerate}

    \subsection{Each rank listed above has veto power over all ranks listed below it on all domains.}

\section{Divisions, Promotion, and Relegation}

    \subsection{Divisions}

        \subsubsection{No division can have more than 16 teams}

            \paragraph{League officials have the right to promote/relegate teams if necessary to maintain the 16 team maximum.}

        \subsubsection{No division can have fewer than 4 teams.}

            \paragraph{If there is more than one division and one division has fewer than 4 teams, the teams from the next highest division must be promoted by the start of the following season to maintain the 4 team minimum.}

            \paragraph{If there is more than one division and the lowest division has fewer than 4 teams, the teams from that division must be promoted by the start of the following season to maintain the 4 team minimum.}

            \paragraph{League officials have the right to divide teams as they see fit to maintain the 4 team minimum.}

        \subsubsection{A new division must be made if all existing divisions have at least 12 teams and the new division has at least 4.}

        \subsubsection{Divisions with 8 or more teams shall be split into 2 conferences}

            \paragraph{Those conferences shall be referred to as the Eastern and Western conferences in this text; although, a Divisional Commissioner may provide a different name for each conference.}

        \subsubsection{Each division must have its own Commissioner, Deputy Commissioner, Director of Operations, Deputy Director of Operations, match hosts, match officials, and match streamers.}

            \paragraph{It is not necessary for smaller divisions (fewer than 8 teams) to have all these staff positions open. Divisional staff positions shall be opened by the League Commissioner (or Deputy Commissioner) when he or she feels it is appropriate.}

    \subsection{Promotion and Relegation}

        \subsubsection{At the end of each season, some teams will be promoted or relegated based on the number of teams in their division and their rank among that division.}

            \paragraph{If a division has 4-8 teams, 1 team gets relegated and 1 team gets promoted.}

            \paragraph{If a division has 9-12 teams, 2 teams get relegated and 2 teams get promoted.}

            \paragraph{If a division has 13-16 teams, 3 teams get relegated and 3 teams get promoted.}

            \paragraph{No team may be promoted from the highest ranked division, as there is no division for those teams to be promoted to.}

            \paragraph{No team may be relegated from the lowest ranked division, as there is no division for those teams to be relegated to.}

        \subsubsection{Promotion and Relegation in a Division With 4 to 8 Teams}

            \paragraph{The Divisional Champions get promoted. The last place team gets relegated.}

            \paragraph{If there are only 4 teams in the division, the semi-final losers play in a 5 game series. The losing team from those matches is relegated.}

        \subsubsection{Promotion and Relegation in a Division With 9 to 12 Teams}

            \paragraph{Both the team finished first overall and the divisional playoff winner gain automatic promotion.}

            \paragraph{If the team that placed first overall also wins the Divisional Championship, the semi-final losers play in a 3 game series. The winner of this series plays a 3 game series with the runner up. The winner of this series is promoted.}

            \paragraph{The last placed team is automatically relegated.}

            \paragraph{The second and third to last place teams play in a 3 game relegation series. The loser of this series is relegated.}

        \subsubsection{Promotion and Relegation in a Division With 13 to 16 Teams}

            \paragraph{Both the team finished first overall and the divisional playoff winner gain automatic promotion.}

\section{Goals, Assists, and Match Reports}
\section{Player Conduct Policy}
\section{Matches}
\section{Playoffs}
\section{Draft and Roster Limit}
\section{Affiliation}
\section{Waivers, Free Agency, and Trading}

Here is the undesired result (notice how everything below II.B.1.d is cut off):

  • this looks like an interesting question, but I wonder if you'd be open to seeing an alternative approach using nested enumerate environments - the enumitem package would be useful in customizing the labels – cmhughes Jun 26 '14 at 5:01
  • @cmhughes That could work. Is there a way of automatically setting custom labels without having to express them for each enumerate? – Jason Jun 26 '14 at 5:05
  • @cmhughes Also, is there a way of ensuring the enumerate environments are included in the table of contents? Specifically, I would like to be able to view 2 levels deep into the enumerate environments (e.g. section II, and all of II's direct children). – Jason Jun 26 '14 at 5:13
  • The problem is mainly due to the fact there is no text netween sectioning commands. If you add \mbox{}` after each of them, it disappears. After all a section title is supposed to have some text after it. – Bernard Jun 26 '14 at 8:59
  • @Bernard Great find! I figured out a way to automate that so I wouldn't have to type \mbox{} in every time. I will post the code later as an answer. – Jason Jun 26 '14 at 11:54
2

Here is a solution: it consists in replacing the \subsection and \paragraph sectioning command with theorem environmentsthat have an empty name and just a label . Using the ntheorem package, I defined a Rule and a subRule theorem environments. It's easy to have different indentation for different theorems and to have the ad hoc counters. Finally, it is possible to add theorem labels to the table of contents; I don't see why you would want to add the contents of \Rule and \subRule, since they would be duplicates. Maybe I'm wrong?

Anyway, here is a code that does what I think you want:

\documentclass[a4paper,11pt,twoside]{book}%english,
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[nomarginpar]{geometry}
\usepackage{etoolbox} 
\usepackage[nobottomtitles]{titlesec}

\setcounter{tocdepth}{4}
\titleformat{\section}[hang]{\bfseries\Large}{\thesection}{0.4em}{}
\titlespacing*{\section}{0pt}{2\baselineskip}{1.25\baselineskip}
\renewcommand*\thesection{\Roman{section}}

\titleformat{\subsection}[hang]{\bfseries\large}{\thesubsection}{0.4em}{\mdseries\normalsize}
\titlespacing*{\subsection}{2em}{1\baselineskip}{1\baselineskip}
\renewcommand*\thesubsection{\thesection.\Alph{subsection}}
%
%\titleformat{\subsubsection}[block]{\bfseries\large}{\thesubsubsection}{0.4em}{\mdseries\normalsize}
%\titlespacing*{\subsubsection}{4em}{1\baselineskip}{1\baselineskip}
%\renewcommand*\thesubsubsection{\thesubsection.\arabic{subsubsection}}
%
%\titleformat{\paragraph}[block]{\bfseries\large}{\theparagraph}{0.4em}{\mdseries\normalsize}
%\titlespacing*{\paragraph}{6em}{1\baselineskip}{1\baselineskip}
%\renewcommand*\theparagraph{\thesubsubsection.\alph{paragraph}}

\usepackage{ntheorem}
\theoremstyle{change}
\theoremheaderfont{\bfseries\large}
\theorembodyfont{\mdseries\normalsize}
\theorempreskip{1\baselineskip}
\theorempostskip{1\baselineskip}

{%
\theoremnumbering{arabic}
\theoremindent = 4em%4
\theoremseparator{\hspace{-0.25em}}
\newtheorem{Rule}{}[subsection]
    }%
\AtEndEnvironment{Rule}{\addcontentsline{toc}{subsubsection}{\theRule}}
\newcommand\RULE[1]{\begin{Rule}#1\end{Rule}}

\theoremindent = 6em
\theoremseparator{\hspace{-0.25em}}
\theoremnumbering{alph}
\newtheorem{subRule}{}[Rule]
\AtEndEnvironment{subRule}{\addcontentsline{toc}{paragraph}{\thesubRule}}
\newcommand\SubRule[1]{\begin{subRule}#1\end{subRule}}

\begin{document}
\sffamily


\tableofcontents

\chapter{Rules}
\section{Distribution of Power}

    \subsection{The following list describes the hierarchy of power in the League:}
        \begin{enumerate}
            \item League Commissioner
            \item Deputy League Commissioner and Divisionals Commissioners
            \item Director of Operations and Deputy Divisional League Commissioners
            \item Deputy Director of Operations
            \item Forum Administrators
            \item Game Officials
            \item General Managers
            \item Assistant General Managers
        \end{enumerate}

    \subsection{Each rank listed above has veto power over all ranks listed below it on all domains.}

\section{Divisions, Promotion, and Relegation}

    \subsection{Divisions}

    \RULE{No division can have more than 16 teams}

        \SubRule{League officials have the right to promote/relegate teams if necessary to maintain the 16 team maximum.}

    \RULE{No division can have fewer than 4 teams.}

        \SubRule{If there is more than one division and one division has fewer than 4 teams, the teams from the next highest division must be promoted by the start of the following season to maintain the 4 team minimum.}

        \SubRule{If there is more than one division and the lowest division has fewer than 4 teams, the teams from that division must be promoted by the start of the following season to maintain the 4 team minimum.}

        \SubRule{League officials have the right to divide teams as they see fit to maintain the 4 team minimum.}

    \RULE{A new division must be made if all existing divisions have at least 12 teams and the new division has at least 4.}

    \RULE{Divisions with 8 or more teams shall be split into 2 conferences}

        \SubRule{Those conferences shall be referred to as the Eastern and Western conferences in this text; although, a Divisional Commissioner may provide a different name for each conference.}

    \RULE{Each division must have its own Commissioner, Deputy Commissioner, Director of Operations, Deputy Director of Operations, match hosts, match officials, and match streamers.}

        \SubRule{It is not necessary for smaller divisions (fewer than 8 teams) to have all these staff positions open. Divisional staff positions shall be opened by the League Commissioner (or Deputy Commissioner) when he or she feels it is appropriate.}

    \subsection{Promotion and Relegation}

    \RULE{At the end of each season, some teams will be promoted or relegated based on the number of teams in their division and their rank among that division.}

        \SubRule{If a division has 4-8 teams, 1 team gets relegated and 1 team gets promoted.}

        \SubRule{If a division has 9-12 teams, 2 teams get relegated and 2 teams get promoted.}

        \SubRule{If a division has 13-16 teams, 3 teams get relegated and 3 teams get promoted.}

        \SubRule{No team may be promoted from the highest ranked division, as there is no division for those teams to be promoted to.}

        \SubRule{No team may be relegated from the lowest ranked division, as there is no division for those teams to be relegated to.}

    \RULE{Promotion and Relegation in a Division With 4 to 8 Teams}

        \SubRule{The Divisional Champions get promoted. The last place team gets relegated.}

        \SubRule{If there are only 4 teams in the division, the semi-final losers play in a 5 game series. The losing team from those matches is relegated.}

    \RULE{Promotion and Relegation in a Division With 9 to 12 Teams}

        \SubRule{Both the team finished first overall and the divisional playoff winner gain automatic promotion.}

        \SubRule{If the team that placed first overall also wins the Divisional Championship, the semi-final losers play in a 3 game series. The winner of this series plays a 3 game series with the runner up. The winner of this series is promoted.}

        \SubRule{The last placed team is automatically relegated.}

        \SubRule{The second and third to last place teams play in a 3 game relegation series. The loser of this series is relegated.}

    \RULE{Promotion and Relegation in a Division With 13 to 16 Teams}

            \SubRule{Both the team finished first overall and the divisional playoff winner gain automatic promotion.}

\section{Goals, Assists, and Match Reports}
\section{Player Conduct Policy}
\section{Matches}
\section{Playoffs}
\section{Draft and Roster Limit}
\section{Affiliation}
\section{Waivers, Free Agency, and Trading}

\end{document} 

And part of the resulting .pdf:

enter image description here

enter image description here

enter image description here

  • This solution works great. Do you have any idea why \setmainfont{Open Sans} no longer works for me using this method? It provides no errors and the fontspec package is loaded, but it simply doesn't change the font. – Jason Jun 26 '14 at 14:25
  • 1
    Did you remove the \usepackage{lmodern}, line 4 of my preamble? I don't have OpenSans on my system, and I had to replace it. – Bernard Jun 26 '14 at 14:33
  • I have tried that, but it seems the only way to get OpenSans to work is to simply create a new font family and wrap the entire document with \opensans{}. – Jason Jun 26 '14 at 14:39
  • 1
    Another detail I forgot: I suppose you compile with XeLaTeX (or LuaLaTeX).Remove the loading of fontenc and (at least for XeLaTeX) of inputenc. The problem comes perhaps from them. If it doesn't work try any system font for which there's no latex package, just to see. – Bernard Jun 26 '14 at 15:35

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.