Page LayoutParagraph numbering

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
andygdl
Posts: 1
Joined: Tue Apr 19, 2011 12:25 pm

Paragraph numbering

Post by andygdl »

Hi,
I've been searching for a while how to do this, but have so far not found a satisfactory solution. For the record, I'm using MiKTeX 2.9 and TeXnicCenter.

I'm writing a report, with the required formatting as follows:

-3 tiers of numbering -chapter,section,paragraph. Each paragraph is numbered (e.g 3.1.2).

-I've been writing the 'bulk' text within \subsection{***} to achieve this, but Latex seems to not deal with pagebreaks if I use this approach.

-I've also been using the titlesec package to set the formatting.

-The following code is the best I can get to my desired formatting. I'm afraid the titlsec settings are cannibalised from an example with little understanding (the gap between end of number and beginning of word is set, where a fixed gap between beginning of number and beginning of word is desired). Technically the thing will be in Verdana, but I've left that out in the interests of package compatibility

Code: Select all

\documentclass[a4paper]{report}
\usepackage{titlesec}


\setlength{\parindent}{0pt}
\setlength{\parskip}{2ex} 


\topmargin 0cm
\oddsidemargin 0.7cm
\textwidth 15.5cm

%TITLESEC: HEADING FORMATS
\titleformat{\chapter}
	{\bfseries} % formatting
	{\llap{
		{\thechapter}
		\hskip 1cm
	}}
	{0em}% horizontal sep
	{}% before		

\titleformat{\section}
	{\bfseries} % formatting
	{\llap{
		{\thesection}
		\hskip 0.7cm
	}}
	{0em}% horizontal sep
	{}% before		
	
	
\titleformat{\subsection}
	{} % formatting
	{\llap{
		{\thesubsection}
		\hskip 0.5cm
	}}
	{0em}% horizontal sep
	{}% before		
	
\begin{document}

\chapter{ch1}
\section{sec1}
\subsection{the bulk text here}
\end{document}
-I would be happy to stick with this inelegant method, but as I've said, Latex doesn't seem to expect bulk text to be written inside \subchapter, and so no page breaks appear, and the document ends up running off the bottom of the page.


-Ideally it would be great be able to write my document like the code below, and achieve the numbering in the document preamble:

Code: Select all

\chapter{ch}
\section{sec1}

here is my text

and some more text

etc

\section{sec2}
-I've seen something slightly similar that achieved this using a \newenvironment that defines \everypar, although I've seen that playing with \everypar is not advised. In any case, my novice latex ability does not stretch to being able to adapt this method to my desired formatting.

My apologies for the long post. Is there a good way to achieve this formatting? Thanks very much for any help!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Paragraph numbering

Post by kaiserkarl13 »

Your example doesn't indicate what you're actually trying to do---we need more text to see what you mean.

Chapters in a report are typically "big" headings, starting on a fresh page and the like. If that's not what you want, which is what it looks like from your example, use the article class (using section, subsection, and subsubsection for structure).

Is this similar to what you want?

Code: Select all

\documentclass{article}
\begin{document}
\section{Chapter Heading}
\subsection{Section Heading}
\subsubsection{Paragraph Heading}
body text here.  blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
\end{document}
Or perhaps the same as above with the following lines added to the preamble?

Code: Select all

\makeatletter
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {3.25ex\@plus1ex \@minus.2ex}%
                                     {-1em}%
                                     {\normalfont\normalsize\bfseries}}
\makeatother
All the above does is define subsections to look exactly like paragraphs---see article.cls---which basically deletes the linebreak.
Post Reply