[Tex/LaTex] Remove spacing above section in titlesec

sectioningspacingtitlesec

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.

MWE result

\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.

Best Answer

UPDATED ANSWER

Do \usepackage[nostruts]{titlesec}, which will remove the struts like my answer below did.

The feature was added with version 2.11, released 2019-07-16.

ORIGINAL ANSWER

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.

Related Question