Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question

migrated from stackoverflow.com Aug 21 '12 at 23:36

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Werner, percusse, yo', lockstep, Thorsten Aug 22 '12 at 6:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Aug 21 '12 at 23:42
    
See the solutions provided in No hyphen for a word. As a quick-fix, I would use \mbox{model}. –  Werner Aug 21 '12 at 23:52
    
What document class are you using? –  Gonzalo Medina Aug 21 '12 at 23:57

1 Answer 1

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
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.