4

Possible Duplicate:
How to disable hyphenation in all section and subsection titles?
No hyphen for a word

How to I tell LaTeX not to split words in section title? For example:

\section{Protokol CAN in ISO/OSI referenčni model}

... gets printed as "Protokol CAN in ISO/OSI referenčni mo-del". How do I tell him to put last word in new line? Thanks!

jurij
  • 213

1 Answers1

4

Making the words un-breakable may lead to underfull or overfull boxes. I would say that the best solution is to make the section headers \raggedright, which ensures that they break only at spaces and no bad boxes are introduced. As well, it looks better than the hyphenates section titles IMO.

Recommanded solution with titlesec package. Put this code into your preamble:

\usepackage[raggedright]{titlesec}

Solution with no package. This redefines the inner section commands to use \raggedright. Put this code into your preamble:

\makeatletter
\def\section{\@startsection{section}{1}{\z@}{-3.5ex \@plus -1ex \@minus -.2ex}{2.3ex \@plus .2ex}
  {\normalfont\raggedright\Large\bfseries}}
\def\subseciton{\@startsection{subsection}{2}{\z@}{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}
  {\normalfont\raggedright\large\bfseries}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}
  {\normalfont\raggedright\normalsize\bfseries}}
\makeatother
yo'
  • 51,322