# Same preamble in 2 files causes pdflatex to crash in just one

I was compiling two different files with the exact same preamble. The important thing is that I'm using together scrbook and classicthesis (with also classicthesis-preamble loaded) but when I compile two different things happen.

Small note: I'm on a Fedora 15 SO, with the original TeXLive installation retrieved from tug.org. To compile i use either "TeXWorks" or the pdflatex command from the terminal.

File1 compiles great, no problems at all.

However, file2 gets stuck giving this output:

Class scrbook Warning: \float@addtolists detected!
(scrbook)              You should use the features of package tocbasic'
(scrbook)              Support for \float@addtolists may be removed from
(scrbook)              scrbook' soon .


The same output is thrown also by file1 (I later realised this by compiling from Terminal), but file1 does not stuck there, goes on and generates the PDF.

The preamble in both files is loaded by a file0.tex which I wrote to keep the two files clean, so I am sure that the preamble is identical.

I've found on the net (thanks Google!) a package that should fix this problem, but it doesn't seem to work: it's called scrhack.

1st edit: I created another main file, and added just the custom headers I wrote. Everything's fine, so my custom headers are not the problem. I've added random text, with a \chapter{Foo} and \section{Bar}. Still no problems.

So I've added a file with \input{file2.1}. This was originally added also to file2. At this point, compilation freezes, without saying a word about why...

Since I can't understand the mistake, nor I can find and errore in the source of file2.1, I've made a pastebin for you to see.

2nd edit: I've narrowed down the problem, it stucks because I renewed the \vec command. This is a MWE that makes my compiler freeze without giving any feedback or traceback or error messages.

\documentclass{scrbook}
\usepackage[italian]{babel}
\usepackage{classicthesis}
\usepackage{classicthesis-preamble}
\usepackage{amsmath}

\renewcommand{\vec}[1]{\vec{\textbf{#1}}} % vettori
\begin{document}
Let $\vec{F}$ be the force vector...
\end{document}


Although I've found where the problem is, I don't why it happens...

-
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  Martin Scharrer Oct 16 '11 at 14:08
The message is only a warning, so it might not be the cause of the issue. Without a minimal working example (MWE) that illustrates your problem it is basically impossible to help you, IMHO. Try to minimize both files as described in the above linked page. You might even find the issue while doing so. –  Martin Scharrer Oct 16 '11 at 14:10
Hi martin. Thanks for the attention and the welcome. :) I'm sorry I haven't provided a MWE, the fact is that I tried to "re-assemble" the code and it works fine, until I add another file that seems fine. So, the MWE would be a 50 or so line of code which seems to be fine. :( I'll add the things i did in the main question, to explain myself better. –  Marcello Massaro Oct 16 '11 at 15:04
Well you wrote a very fine recursive definition which throws tex in an endless loop trying to execute the \vec. See tex.ac.uk/cgi-bin/texfaq2html?label=patch for better ways to patch a command. –  Ulrike Fischer Oct 16 '11 at 16:08
Thanks @UlrikeFischer that just solved my problem! Although, if you don't actually answer I can't close the question as "answered". :P –  Marcello Massaro Oct 16 '11 at 16:19

Well you wrote a very fine recursive definition which throws tex in an endless loop trying to execute the \vec. See http://www.tex.ac.uk/cgi-bin/texfaq2html?label=patch for better ways to patch a command.