# Remove spacing above section in titlesec

I'm writing a document optimized for mobile usage, and as such I want to conserve my space. The spacing that titlesec adds to sections, subsections, etc. is getting somewhat annoying. Is there a (simple) method to remove this? My desire is to just change the look of the title while retaining all LaTeX default spacing, etc.

The sectsty package doesn't add any spacing and works great, but I'd like to make use of some of titlesec's features.

I've looked at the following questions and they don't seem to fix my problem:

Please close this if I've overlooked something in the solutions above.

\documentclass[11pt]{article}
\usepackage{geometry}
\geometry{margin=5mm, paper=a6paper, showframe=true}
\usepackage{titlesec}
\titleformat*\section{\Large}
\titleformat*\subsection{\large}
\usepackage{lipsum}
\begin{document}
\section*{Using titlesec}
\subsection*{Lorem Ipsum}
\lipsum[3]
\end{document}


Note: Remove the three titlesec lines to obtain the LaTeX default result.

-
This is a great question. Sadly enough, titlesec's formatting is not immediately setup for this kind of thing. Instead, and often very typically, you have to specify all of the options in order to change just one thing, without even knowing the defaults of the other. That's the advantage of providing a key-value driven input rather than a full argument-based macro (as titlesec does). What's needed here is something like titleseckv (doesn't exist) that does everything titlesec does, but allows for a key-value interface with LaTeX defaults otherwise. – Werner Oct 26 '12 at 23:16

The package titlesec adds \strut in some places. In your case you have to defeat this behavior in three places:

\documentclass[11pt]{article}
\usepackage{geometry}
\geometry{margin=5mm, paper=a6paper, showframe=true}

\usepackage{titlesec}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\ttl@select}{\strut}{}{}{}
\patchcmd{\ttlh@hang}{\strut}{}{}{}
\patchcmd{\ttlh@hang}{\strut}{}{}{}
\makeatother

\titleformat*\section{\Large}
\titleformat*\subsection{\large}

\usepackage{lipsum}
\begin{document}

\section*{Using titlesec}
\subsection*{Lorem Ipsum}
\lipsum[3]
\end{document}


The macros involved are \ttl@select and \ttlh@hang (in the second one \strut appears twice. If other styles are selected it may be necessary to patch \ttlh@display or \ttlh@runin`.

-