Text Formattingsection subsections

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
coast
Posts: 6
Joined: Sat Jul 09, 2011 9:49 pm

section subsections

Post by coast »

I would like to create a document with numbering like this:

1.0 INTRODUCTION

1.1 sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text

1.2 sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text


2.0 SITE AND SURROUNDINGS

2.1 sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text

Etc…

I can’t do this with \section{} and \subsection{} since it all comes out as bold.
Any Ideas?
Last edited by coast on Tue Jul 26, 2011 5:08 pm, edited 1 time in total.

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

achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

section subsections

Post by achim »

OS: Kubuntu
Distribution: TexLive
Editor: Kile
coast
Posts: 6
Joined: Sat Jul 09, 2011 9:49 pm

section subsections

Post by coast »

Thanks achim. I didn't get exactly how the startsection markup works.
I've looked for an example useage but have found none.

So far this is my solution:

Code: Select all

\begin{enumerate}
\item{\textbf{Introduction}}
    \item[1.1]{Sample text sample text sample text}
    \item[1.2]{Sample text sample text sample text}
\item{\textbf{Conclusion}}
\end{enumerate}
%indentation above is only for clarity and does not affect output
The problem is the item 1.1 and 1.2 are not indented properly. I've tried \begin{align} and \end{align}, but it produces errors.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

section subsections

Post by frabjous »

I wouldn't use an enumerate environment -- that's not going to work well unless each section is less than a paragraph. Try the titlesec package. Here's something to get you started, but you'll want to read the documentation.

Code: Select all

\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}% command to be formatted
            {\bfseries}% format applied to both num and title
            {\thesection.\arabic{subsection}}% the number format
            {0.5em}% space between num. and title
            {\MakeUppercase}% formatting for title only

\titleformat{\subsection}% command to be formatted
            [runin]% shape -- see documentation
            {}% format applied to both num and title
            {\thesubsection}% the number format
            {0.5em}% space between num. and title
            {}% formatting for title only
\begin{document}
\section{Introduction}

\subsection{} sample text sample text sample text sample text sample text 
sample text sample text sample text sample text sample text sample text 
sample text sample text sample text

\subsection{} sample text sample text sample text sample text sample text 
sample text sample text sample text sample text sample text sample text 
sample text sample text sample text


\section{Site and Surroundings}

\subsection{} sample text sample text sample text sample text sample text 
sample text sample text sample text sample text sample text sample text 
sample text sample text sample text 
\end{document}

The output looks like this:
titles.png
titles.png (12.42 KiB) Viewed 3348 times
coast
Posts: 6
Joined: Sat Jul 09, 2011 9:49 pm

Re: section subsections

Post by coast »

Thanks frabjous. Thats exacly what I was looking for.
Post Reply