I have searched a lot to find an answer to this question, but I could only find how to remove a newline after \section (or \chapter).
How can one remove the newline before \section, as defined by book class?
Basically, looking at the MWE below, I am looking to a way to have:
Text before. Section heading
MWE:
\documentclass[12pt]{book}
\usepackage{titlesec}
\titleformat{\section}[hang]{\normalfont}{\thesection.}{0pt}{}
\titlespacing{\section}
{0pt}% left
{0pt}% before
{0pt}% after
\begin{document}
Text before. \section*{Section heading} Text after
\end{document}
I can't find any option with titlesec and I would not want to enter the esoteric intricacies of TeX class redefinitions.
I would be grateful for any hint or pointer on how to deal with this kind of problem.

[short for toc]option nor does it write to the TOC (or the page head) it could (I may update later if you want that) but in that case it would be a (bit) easier if instead of redefining\sectionyou redefined the lower level\@startsectionbut in that case\subsection,\paragraphetc would also be redefined to be inline, would that be OK? – David Carlisle Oct 27 '14 at 16:02\@startsection), as it seems it would be easier later on to add space where necessary than to remove. Thank you so much. – gsl Oct 27 '14 at 16:05