I wanted to style chapter headings, found out about titlesec and wrote the document like this:





{\chapter} % command
[display] % shape
{\bfseries\flushright\Huge\color{crvena}} % format
{\ \thechapter} % label
{0.5ex} % sep
} % before-code
] % after-code


After that I wrote some text and finished with:


The result is fine, as can be seen from the image:

enter image description here

But the problem is now that there are errors in table of contents:


enter image description here

What has caused 1 [Pleaseinsertintopreamble] to be written instead of 1 Лавиринт and how to fix it?

EDIT 1: I tried to use fancyhdr, but got this:

ToC is fine: enter image description here

but header is not:

enter image description here

  • Welcome to TeX.SX! The problem usually is associated to the utf8x option to inputenc rather than utf8.
    – egreg
    Commented Mar 8, 2014 at 20:09
  • Thanks. :) I've seen that the problem occurs with utf8x, so I was somewhat surprised to see it happen with utf8 as well. If I add \usepackage{fancyhdr}, ToC works fine, but then headers are wrong. I'm new to both fancyhdr and titlesec, so I have no clue what's going on. : )
    – Milos
    Commented Mar 8, 2014 at 20:17

1 Answer 1


The serbianc module for babel seems to enforce using the utf8x option for inputenc and the package ucs which is, in my opinion, wrong.

A workaround seems to be specifying utf8x prior to utf8.



However, I would ask the maintainer of babel to remove the setting, leaving the user the choice of what option for inputenc to use. And I'd much prefer utf8.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .