3

I want to adjust title margins for two lines length titles. For example, is like below. How can I adjust. Thank you for your understanding I don't know how can I explain my problem.

\titleformat{\chapter}{\normalfont\normalsize\bfseries}{\thechapter.}{1em}{}
\titleformat{\section}{\normalfont\normalsize\bfseries}{\thesection.}{1em}{}
\titleformat{\subsection}{\normalfont\normalsize\bfseries}{\thesubsection.}{1em}{}
\titleformat{\subsubsection}{\normalfont\normalsize\bfseries}{\thesubsubsection.}{1em}{}
\titlelabel{\thetitle.\quad}

What I Want

Diagram
  • 31
  • 2

3 Answers3

0

I don't know how to achieve the desired output with the machinery of the titlesec package. Here's a solution that employs the sectsty package.

enter image description here

\documentclass{article} % or some other suitable document class
\usepackage{newtxtext} % optional (Times Roman clone text font)

\usepackage{sectsty} \allsectionsfont{\normalfont\normalsize\bfseries\nohang\noindent} % See https://tex.stackexchange.com/a/24444/5001: \makeatletter \renewcommand{@seccntformat}[1]{\csname the#1\endcsname.\quad} \makeatother

\begin{document} \setcounter{section}{2} \setcounter{subsection}{3} \stepcounter{subsubsection} \subsubsection{Outage probability for cooperative transmission using DF method under co-channel interference effect} \end{document}

Mico
  • 506,678
  • I use titlesec package – Diagram Jan 12 '21 at 10:02
  • @Diagram - Thanks. Is there something keeping you from switching from a titlesec-based solution to the sectsty-based solution shown above? – Mico Jan 12 '21 at 10:41
  • I have a thesis template overleaf document. I don't know how can I adapt my document to sectsty package. – Diagram Jan 12 '21 at 10:44
  • @Diagram - I guess you could (a) edit the template file to comment out the instruction that loads the titlesec package and (b) add the 6 instruction lines -- 5 lines without the comment line % See https://tex.stackexchange.com/a/24444/5001: -- shown above to the preamble of your document. – Mico Jan 12 '21 at 11:18
0

Something like this, perhaps---

\documentclass{article}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}
\titleformat{\subsubsection}[block]{\normalfont\normalsize\bfseries\parbox{\textwidth}}{\thesubsubsection.}{1em}{#1}[]
\begin{document}
\setcounter{section}{2}\setcounter{subsection}{3}\setcounter{subsubsection}{1}
\subsubsection{Outage probability for cooperative transmission using DF method under co-channel interference effect}
\lipsum[1]
\end{document}

enter image description here

Obviously not perfect, but a start, perhaps.

chsk
  • 3,667
0

You want the block format.

\documentclass{book}
\usepackage{titlesec}
\usepackage{newtxtext}

\titleformat{\chapter}{\normalfont\normalsize\bfseries}{\thechapter.}{1em}{} \titleformat{\section}[block]{\normalfont\normalsize\bfseries}{\thesection.}{1em}{} \titleformat{\subsection}[block]{\normalfont\normalsize\bfseries}{\thesubsection.}{1em}{} \titleformat{\subsubsection}[block]{\normalfont\normalsize\bfseries}{\thesubsubsection.}{1em}{} \titlelabel{\thetitle.\quad}

\setcounter{secnumdepth}{4}

\begin{document}

\chapter{Title}

\section{Outage probability for cooperative transmission using DF method under co-channel interference effect} \subsection{Outage probability for cooperative transmission using DF method under co-channel interference effect} \subsubsection{Outage probability for cooperative transmission using DF method under co-channel interference effect}

\end{document}

enter image description here

egreg
  • 1,121,712