# Formatting labels of chapters and sections

I'm just starting with this amazing world of LaTeX. I'm wondering how to set the format of a document (with some stuff centered and sections with no relative numbering)

I'm trying with the titlesec package, But I'm not being lucky.

This is what I need to reach:

Chapter 1 <- this should be centered
About whatever... <- this also should be centered
blablabla... <-this should be on the left side

Section 1. blablabla <- section in the left side, text begins in the same line

Section 2. bla bla bla
bla

Chapter 2

Section 3. bla bla bla  <-IMPORTANT, section have a non relative numbering
.
.
.


Does anybody knows how to do this?

UPDATE:

Well, I found a partially solution that I would like to share. This is the code for making the section counter non relative:

\usepackage{chngcntr}
\counterwithout{section}{chapter}


Also I found a way for solving the Chapter centering:

\usepackage[Glenn]{fncychap}


This makes a fancy chapter title what makes me happy because is centered and looks nice.

-
Welcome to TeX.SE! Have a look at the titlesec package, it should help get you started :) – cmhughes Dec 27 '12 at 17:53
Thanks, as I said before, I was trying with that package. I got how to do almost all the stuff but not the part where i want the text next to the Section title... I will post the partially solution for those who may be interested – uDalillu Dec 28 '12 at 10:07
Please tell us which documentclass you are using, or even better provide a minimal working example (MWE). – Andrew Swann Dec 29 '12 at 16:29
Sorry, I didn't know it is important to mention that. I'm using the report class. Thanks for the advice about the MWE, but the only way that comes to my mind about providing an example for "How it should look" is the way I did. For instance, Im rendering with Xelatex and using xunicode, polyglossia and parskip packages. – uDalillu Dec 29 '12 at 23:02

Here's one possible solution using the titlesec package to format the chapter and section headings; the chngcntr package was used so the sections are numbered consecutively:

\documentclass{report}
\usepackage{chngcntr}
\usepackage{titlesec}
\usepackage{lipsum}% just to generate text for the example

\counterwithout{section}{chapter}

\newcommand{\periodafter}[1]{#1.}

\titleformat{\chapter}[display]
{\normalfont\Large\bfseries\filcenter}
{\chaptertitlename~\thechapter}
{10pt}
{}
\titleformat{\section}[runin]
{\normalfont\large\bfseries}{\thesection}{1em}{\periodafter}
\titlespacing*{\section}
{0pt}{3.5ex plus 1ex minus .2ex}{0.5em}

\begin{document}

\chapter{Test Chapter with a Long Title Spanning Several Lines}
\section{Test Section}
\lipsum[4]

\end{document}


Since precise specifications were not mentioned (vertical lengths, desired font size, font series, etc.) I used some settings that can be easily adjusted according to your needs; in particular, I wasn't sure about the position of the section number and the section title, but this can also be easily changed.

In an update to the original question, Eudald mentions that he decided to use the Glenn style from the fncychap package; I would humbly suggest not to use this package, since its styles don't behave well particularly for long titles, as can be seen here:

\documentclass{report}
\usepackage[Glenn]{fncychap}

\begin{document}

\chapter{Test Chapter with a Long Title Spanning Several Lines}

\end{document}


which produces a title that seems (IMHO) "unbalanced":

If a framed title is desired, it would be better to use again the titlesec package; a little example:

\documentclass{report}
\usepackage{chngcntr}
\usepackage{titlesec}
\usepackage{lipsum}

\counterwithout{section}{chapter}

\newcommand{\periodafter}[1]{#1.}

\titleformat{\chapter}[frame]
{\normalfont}
{\filright\small\enspace\MakeUppercase{\chaptertitlename}~\thechapter\enspace}
{20pt}
{\Large\filcenter}
\titleformat{\section}[runin]
{\normalfont\large\bfseries}{\thesection}{1em}{\periodafter}
\titlespacing*{\section}
{0pt}{3.5ex plus 1ex minus .2ex}{0.5em}

\begin{document}

\chapter{Test Chapter with a Long Title Spanning Several Lines}
\section{Test Section}
\lipsum[4]

\end{document}


-