Text Formattingsection styles for long titles

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
dsplib
Posts: 4
Joined: Fri Jun 15, 2018 2:33 pm

section styles for long titles

Post by dsplib »

Dear all!
I have a problem with the setting of section title styles.
I have quite long titles and they often go beyond the width of the text. I also want to prevent word wraps in the title.
Now it seems like this
ex.png
ex.png (66.61 KiB) Viewed 3550 times
Could you help me to limit title width and prevent word wraps?

My header is:

Code: Select all

\documentclass[10pt]{extreport}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{mathtext}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{graphicx}
\usepackage{indentfirst} % Красная строка

\graphicspath{{./img/}}

\usepackage{section}
\setlength{\secindent}{\parindent}
\setlength{\subindent}{\parindent}

\usepackage[figurename=Рисунок.]{caption} 
% for figures: caption label is italic, the caption text is bold / italic
\captionsetup[figure]{labelfont=it,textfont={it}}
\renewcommand{\figurename}{Рисунок}


\RequirePackage{caption}
\DeclareCaptionLabelSeparator{defffis}{   }
\captionsetup{justification=centering,labelsep=defffis}

\numberwithin{equation}{section}
\numberwithin{figure}{section}


\usepackage{geometry}
\geometry{
	a5paper,
	left=10mm,
	top=15mm,
	right=10mm,
	bottom=20mm,
}





\usepackage{tocloft}
\cftsetindents{section}{1em}{3em}
\cftsetindents{subsection}{2em}{3em}
\renewcommand\cfttoctitlefont{\hfill\Large\bfseries}
\renewcommand\cftaftertoctitle{\hfill\mbox{}}

\setcounter{tocdepth}{2}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10397
Joined: Mon Mar 10, 2008 9:44 pm

section styles for long titles

Post by Stefan Kottwitz »

Welcome to the forum!

If you complete the document code above a bit, so we can compile it with a section title that shows the breaking issue, I would test it and try to fix it.

Stefan
LaTeX.org admin
dsplib
Posts: 4
Joined: Fri Jun 15, 2018 2:33 pm

section styles for long titles

Post by dsplib »

Dear Stefan! Thank you for your answer.
I have prepared one section without images and so on.

You can compile it by yourself and check header problem.

PS inside you can find some wrong links to the figures and equation because I have deleted many other sections and figures.
Attachments
FORUM.zip
one section
(14.31 KiB) Downloaded 186 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10397
Joined: Mon Mar 10, 2008 9:44 pm

section styles for long titles

Post by Stefan Kottwitz »

It seems that ФНЧ cannot be hyphenated for justification. You could add \sloppy to its heading font macro to ease the justification. With your document code I could test that, it seems to work.

Code: Select all

\makeatletter
\g@addto@macro\hdfnt\sloppy
\makeatother
Stefan
LaTeX.org admin
Post Reply