Page LayoutMenu's not showing on the first "compilation"

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Sueroski
Posts: 3
Joined: Sun Dec 05, 2010 10:38 pm

Menu's not showing on the first "compilation"

Post by Sueroski »

It's my first post here then - Hello Everyone.
I really like LaTeX by now 'couse I can make/edit really big and formated documents without heavy IDEs (editors for LaTeX is really light and actually I can edit LaTeX files on every editor ex. my favourite Emacs).

Ok, now about my problem.
I started yesterday learning LaTeX and I have a problem.

It's my LaTeX "code":

Code: Select all

\documentclass[11pt, a4paper]{article}

\usepackage[utf8]{inputenc}

\begin{document}
\begin{titlepage}
\title{Nauka LaTeX'a}
\author{Sueroski}
\date{2010}
\maketitle
\end{titlepage}

\tableofcontents
\newpage


\section{Test}
Witaj mój świecie LaTeX'a ;]

\subsection{Center}
\begin{center}
Ulala ;p
\end{center}
\newpage


\section{Test2}
tests
\end{document}
All was ok before I added "\newline"... I added it cuz I want to have each section and menu on separated pages.

And when I added these "\newline" code my menu (\tableofcontents) started be blank on first "compilation" (I don't know how this process is named in LaTeX).
It's really strange but when I compile it another time (without code changes... just compilation when pdf/dvi exist) it starting works ok...

And it's problem - what I must change (probably something with \newline) to make it ok on the first compilation?

Greetings

PS I compile it at once to PDF using "pdflatex" is it can make this problem?

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Menu's not showing on the first "compilation"

Post by frabjous »

I assume you mean \newpage rather than \newline?

Anyway, what you describe is perfectly normal, intended behavior. When latex first processes a file, it puts the information it needs into the .toc file, and then only inserts the contents of the .toc file into the appropriate place when latex is run next. It's perfectly normal to have to run latex two or even three times before everything appears as it should.

It doesn't really have to do with \newpage, nor is it different between latex and pdflatex.

There is no way around it. Some editors will run scripts in the background which will process the file as many times as needed before showing you the result, but that's the best you can expect.

It's been awhile since I've used the AucTeX plugin for emacs, but I'd be surprised if it couldn't be configured to do so.
Sueroski
Posts: 3
Joined: Sun Dec 05, 2010 10:38 pm

Menu's not showing on the first "compilation"

Post by Sueroski »

frabjous wrote:I assume you mean \newpage rather than \newline?
Yea, I mean it... just mistake (it was early hour when I wrote it)
frabjous wrote:Anyway, what you describe is perfectly normal, intended behavior. When latex first processes a file, it puts the information it needs into the .toc file, and then only inserts the contents of the .toc file into the appropriate place when latex is run next. It's perfectly normal to have to run latex two or even three times before everything appears as it should.
Hmm... then ok. I can run it few times... it's just kinda strange for me but I know why it is
if everyone must do it then no problem cuz I was think it's bug in code


And I have another little question.
On top of menu I have text "Contects" and is there option to translate this string? It can be kinda strange if in book in Polish there will be text "Contects"...
I wanna just change "Contects" to "Spis treści". Can I do it? And how?

Greets
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Menu's not showing on the first "compilation"

Post by frabjous »

Near the beginning of the document, put:

Code: Select all

\usepackage[polish]{babel}
This will both change "Contents" to "Spis treści", and also load the Polish hyphenation patterns. It also loads some abbreviations for accented characters, etc., see the babel document for more info.

If you wanted something else, then you could do:

Code: Select all

\renewcommand{\contentsname}{Whatever you wanted}
after \begin{document}, but it shouldn't be necessary if you use babel.
Post Reply