1

I am struggling trying to put together some technical documents (using the article class). Is there a way to allow page breaks directly after a section title? If possible, I would like to let some of the subsection levels to break directly after the subsection header.

At several points in the document, I have to create lists using the section numbering and need the text next to the number. Until now, I have had an empty title and the text forced indented with adjustwidth following, but I need to be able to have the text on the same line as the number. I also would like to not have to force page breaks to prevent run off of the page when I am in one of these numbered lists. When I have tried using something like:

  \paragraph{beginning of the text} continuation of text

or defining these levels with runin, I cannot get the entire thing indented: only the first line (which I also have to have).

Here is my section title formatting and example: (I apologize if it is messy or poorly written)

\documentclass[12pt]{article}
\usepackage{titlesec} 

\setcounter{secnumdepth}{5}%sets depth of numbering system
\setcounter{tocdepth}{1}

\titleformat{\subsection}[hang]{\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titlespacing*{\subsection} {1em}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}


\titleformat{\subsubsection}[hang]{\normalfont\normalsize}{\thesubsubsection}{1em}{}
\titlespacing*{\subsubsection} {2em}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\titleformat{\paragraph}[hang]{\normalfont\normalsize}{\theparagraph}{1em}{}
\titlespacing*{\paragraph} {3em}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}



\titleformat{\subparagraph}[hang]{\normalfont\normalsize}{\thesubparagraph.}{1em}{}
\titlespacing*{\subparagraph} {4em}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\begin{document}

\section{title}
\subsection{title 2}
\subsubsection{title 3}
\paragraph{list item 1}
\paragraph{list item 2}
\paragraph{list item 3} 

\end{document}

EDIT: To clarify from some comments: I need the list structure to be indented and have the numbering with it (ex. 1.1.1.1 not just 1 as I would get with enumeration)

I also need the whole thing (sometimes a sentence or list item, sometimes paragraphs(hear meaning blocks of text, not the section title) as they have to be numbered) to be indented to the same point, preferably similar to a hang but not necessarily.

I can currently make it work with some specifically placed breaks, but as the document is edited, these are constantly having to be moved. I would like to let the document break around the headings without necessarily needing text underneath the heading.

I hope this helps to what I am hoping to achieve. Thanks!

  • (i) welcome to tex.se! (ii) please provide complete bit small document where you show, what you like to obtain (iii) your request is very unusual. such behavior is (in normal circumstances) not desired (allowed) :-( – Zarko Mar 21 '18 at 17:49
  • 1
    I don't fully understand what you're after, but the use of \paragraph for list items seems wrong. You should take a look at the enumitem package for that. For the rest, can you clarify exactly what you want by providing an example of how the text should look? Normally page breaks after section headers are poor style, and I'm not sure if titlesec supports such an option off hand. – TH. Mar 21 '18 at 17:49
  • You could insert \pagebreak after the section. – EuklidAlexandria Mar 21 '18 at 17:50
  • your comments about lists seem strange, you can have 1.1.1 numbering for nested lists if you wish, it seems that your are looking for lists which would also handle indenting the text. – David Carlisle Mar 21 '18 at 18:42
1

It isn't totally clear what layout you need but it sounds like you want to use a list not section heads. If the layout here isn't quite as you need, the enumitem package makes it easy to customise the layout.

enter image description here

\documentclass{article}

\renewcommand\theenumii{\theenumi.\arabic{enumii}}
\renewcommand\theenumiii{\theenumii.\arabic{enumiii}}
\renewcommand\theenumiv{\theenumiii.\arabic{enumiv}}

\renewcommand\labelenumii{\theenumii.}
\begin{document}


\begin{enumerate}
\item\mbox{}
\begin{enumerate}
\item\mbox{}
\begin{enumerate}
\item zzzz
\item zzz
\end{enumerate}
\item\mbox{}
\begin{enumerate}
\item zzzz
\item zzz
\end{enumerate}
\end{enumerate}
\item zzzz
\item zzzz
\item\mbox{}
\begin{enumerate}
\item zzzz
\item\mbox{}
\begin{enumerate}
\item zzzz
\item zzz
\end{enumerate}
\end{enumerate}
\end{enumerate}

\end{document}
  • David, this is very close to what I am looking for, but sometimes the various items DO have headers, so I cannot just get rid of the section headings. I have found that using block format for those needed without headings, I can start the section in the header and finish the paragraph without a line break. This allows for latex to adjust page breaks too. do you know of a way though to indent the following lines of a [block] section styling? I have been using [hang] but it will not let the header run into the text. I hope how I am describing it makes sense... – Stephen O Mar 23 '18 at 15:21
  • @StephenO someone may supply and answer using sections headings (which you are free to accept if it does what you want:-) but I'm not sure I understand your description enough to suggest anything other than the above. I can't really add a titlesec [hang] addition to this answer as the whole point of the answer is to use list markup. Note theer are many ways to style a list that has "headings" eg the description environment or a custom list defined using enumitem – David Carlisle Mar 23 '18 at 16:10

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.