[OS X TeX] sectioning format

Herb Schulz herbs at wideopenwest.com
Sun Aug 1 15:39:52 CEST 2004


On 7/29/04 6:09 PM, "Alain Schremmer" <Schremmer.Alain at verizon.net> wrote:

> I would like to achieve the following look:
> 
> 01. Section 1 Name
> 1. Text in a numbered paragraph Š
>   Text in a new, unnumbered paragraph Š
> 
> 2. Text in a numbered paragraph Š
>   Text in a new, unnumbered paragraph Š
> 

Howdy,

After ``botching'' my answer to you a day or two ago I decided to play with
things myself and came up with this:

\documentclass{article}
\usepackage{titlesec}

\renewcommand{\thesubsection}{\arabic{subsection}}
\newcommand{\secfmt}{\makebox[0pt][r]{\thesection. }}
\newcommand{\subsecfmt}{\makebox[0pt][r]{\thesubsection. }}
\titleformat{\section}{\normalfont\Large\bfseries}{\secfmt}{0pt}{}
\titleformat{\subsection}[runin]{\normalfont\bfseries}{\subsecfmt}{0pt}{}
\titlespacing*{\subsection}{0pt}{\parskip}{0pt}


\begin{document}
\section{The First Section}

\subsection{}
This is the First SubSection in the First Section. I'll add a bunch of stuff
just so that there is a long paragraph and it wraps so I can see that the
formatting is working properly.

This is the Second Paragraph of the First SubSection in the First Section.
I'll add a bunch of stuff just so that there is a long paragraph and it
wraps so I can see that the formatting is working properly.

\subsection{}
This is the Second SubSection in the First Section. I'll add a bunch of
stuff just so that there is a long paragraph and it wraps so I can see that
the formatting is working properly.

\section{The Second Section}

\subsection{}
This is the First SubSection in the Second Section. I'll add a bunch of
stuff just so that there is a long paragraph and it wraps so I can see that
the formatting is working properly.

This is the Second Paragraph of the First SubSection in the Second Section.
I'll add a bunch of stuff just so that there is a long paragraph and it
wraps so I can see that the formatting is working properly.

\subsection{}
This is the Second SubSection in the Second Section. I'll add a bunch of
stuff just so that there is a long paragraph and it wraps so I can see that
the formatting is working properly.

This is the Second Paragraph of the Second SubSection in the Second Section.
I'll add a bunch of stuff just so that there is a long paragraph and it
wraps so I can see that the formatting is working properly.

\end{document}

I think it does approximately what you want. Note that it puts the
(sub)section numbers in the left margin. If that is a problem you can
increase the left margin using the geometry package. This is done to keep
nice alignment of numbered and unnumbered paragraphs.

If yhou don't want indented paragraphs add the lines:

\setlength{\parindent}{0pt}
\setlength{\parskip}{\smallskipamount}

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list