text text text text text text text text text text text text text text text text text text text text text text text text text text text text
1.1.
First Section
text text text text text text text text text text text text text text text text text text text text text text text text text text text text
----------------------------------------------------------------
The problem is that sometimes I get figures between the section number and the Section Title, such as:
---------------
1.1.
<figure>
First Section
text text text text text text text text text text text text text text text text text text text text text text text text text text text text
----------------
or even section number and section title in separate pages?
----------------
text text text text text text text text text text text text text text text text text text text text text text text text text text text text
1.1.
======== page break =========
First Section
----------------
In order to make your question better understandable, provide a minimal working example.
As you already mentioned, your solution doesn't work quite well, but there are better ways. But to think about those, at least the knowledge of the documentclass is needed.
You might also want to take a look at the titlesec-package.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
\documentclass{book}%
\usepackage{graphicx}
\usepackage{titlesec}
\newcommand{\autolabel}[1]{\label{sec:#1}#1}
\titleformat{name=\chapter}
[display]
{\LARGE\bfseries}
{\thechapter}
{0pt}
{\autolabel}
\titleformat{name=\section}% Rafael Goes 25/04/2013
[display]
{\penalty -5000\Large\bfseries}
{\thesection}
{0pt}
{\autolabel}
\begin{document}
\chapter{First Chapter}
This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate.
This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate.
This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate.
\section{First section}
This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate.
This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate.
This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.5\textwidth]{smiley-face.jpg}
\caption{This is a figure}
\label{fig:smiley-face}
\end{figure}
\section{Second section}
This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate. This is a generic text just to illustrate.
\end{document}
Last edited by cgnieder on Mon Jul 22, 2013 10:48 am, edited 1 time in total.