[Tex/LaTex] Different spacing between title, subtitle and text, and subsection text alignment

sectioningspacingtitlesec

  1. Is there any way to make first line of subsection title be aligned with \parident and second line — aligned to the left?

enter image description here

  1. I need to make different spacing between title, subtitle and subsubtitle:
    a. Spacing between section title and subsection title — 8mm;
    b. Spacing between any title and text — 15mm;
    c. Spacing between text and subsection title — 1,5 linespacing.

Tried to do this way, but it doesn't give right results:

\documentclass{article}

\usepackage{titlesec}
\usepackage[T1,T2A]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}



\titleformat{\section}{\normalfont\fontsize{16}{15}\bfseries\filcenter}{\thesection}{1em}{} 
\titleformat{\subsection}{\normalfont\fontsize{14}{15}\bfseries}{\thesubsection}{1em}{} 
\titleformat{\subsubsection}{\normalfont\fontsize{14}{15}}{\thesubsubsection}{1em}{} 

\titlespacing{\section}{}{10mm}{10mm}
\titlespacing{\subsection}{\parindent}{25mm}{15mm} 
\titlespacing{\subsubsection}{\parindent}{25mm}{15mm} 

\begin{document}

\section{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

\subsection{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

\subsubsection{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube.

\end{document} 

UPD. After system upgrade (including texlive upgrade) there is no text in titles if I use \titleformat.

Best Answer

The problem of spacing between section and subsection can't have an automatic solution, insofar as you can't know in advance whether the section title is followed by some text, or a subsection title. So I think you'll have to do it by hand.

The following code is a solution to what I've understood of your requirements:

\documentclass{article}
\usepackage[T1]{fontenc}%,T2A
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}%,russian
\usepackage{fourier, erewhon}

\usepackage[aftersep]{titlesec}
\titleformat{\section}{\normalfont\fontsize{16}{15}\bfseries\filcenter}{\thesection}{1em}{}
\titleformat{\subsection}[block]{\normalfont\fontsize{14}{15}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}[block]{\normalfont\fontsize{14}{15}}{\thesubsubsection}{1em}{}

\titlespacing{\section}{0pt}{10mm}{10mm}
\titlespacing{\subsection}{0pt}{25mm}{15mm}
\titlespacing{\subsubsection}{0pt}{25mm}{0.5\baselineskip}

\begin{document}

\section{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}\vspace{-4ex}

\subsection{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

\subsubsection{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube.

\end{document} 

enter image description here

Related Question