My problem is that I can't create a table of contents for my document. I just use


but it's generating nothing but the word "Contents"! However TeXstudio, in the left sidebar, is showing all sections and stuff.

enter image description here

When I open the .toc file with notepad++ there's only this string

\select@language {russian}




            \section*{Краткая характеристика}
        В данной работе рассматривается создание и управление базой данных для веб-сайта. На примерах рассмотрена регистрация пользователей на сайте, осуществление восстановления логина/пароля пользователя, так же рассмотрены функции администратора сайта - добавление/удаление информации и объектов.

        Все формы созданы на языке гипертекстовой разметки HTML, для создания сценариев взаимодействия с базами данных используется язык PHP.

        Применяемая СУБД: MySQL.

        Для администрирования СУБД использовалось приложение PHPMyAdmin.

  • 1
    And (just to be sure) do you run the document twice? – Gonzalo Medina Dec 3 '12 at 18:55
  • 1
    For this kind of problem, you should clear out all auxiliary files and start clean. Delete .toc and .aux files and recompile (at least twice). – Werner Dec 3 '12 at 18:55
  • @GonzaloMedina yep, even more than twice – Danil Gholtsman Dec 3 '12 at 19:00
  • @Werner well, its not helped me – Danil Gholtsman Dec 3 '12 at 19:04
  • What document class are you using? Do you get any warning/error messages (if so, please add them verbatim to your question)? Can we please see a small but complete skeleton of your document? – Gonzalo Medina Dec 3 '12 at 19:06

You are using \section*{...}. This will format its text like a section, but the section will not be numbered and it will not be listed in the table of contents. Remove the star, compile twice, and the section should appear in the toc. If you want to have different entries in the toc and in the main text (for example if the section title is much too long for the toc), you can use \section[toc title]{section title}, where "toc title" goes into the toc and "section title" is written in the main text.

As more MWE you could look at

\section[Some section title]{\centering Some longer section title}

\section*{\centering Another section title}

and the result when compiling it (twice).

I should also mention \addcontentsline{toc}{section}{section title only in toc} which adds an entry(-line including page number) to the toc (lof would add to the list of figures, lot to tables,...), formatted as section, but would not write anything in the main text.

  • 1
    @DanilGholtsman You're welcome! Sometimes such small things have big effects and are hard to find (I know that from experience...). – Stephen Dec 3 '12 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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