2

Please see update at the end!

My latex editor (TexStudio) complains, when the log file is too big. So I have to get rid of the warnings, which are mostly

Marginpar on page x moved

My document has about 1000 pages and I use \cite in the margin. So I have thousands of these warnings.

My idea was to use package silence and set the appropriate filters. But when I include

\usepackage{silence}

in the preamble, even with no filters, options or respective commands set yet, rendering to PDF time seems to be unlimited. On my very fast machine usually rendering takes 1-2 minutes. With silence it goes indefinitely, several hours at least. I can see from the log, when I interrupt, that only the first few of my about 60 chapters have been scanned. If filters had been set, the respective warnings were filtered out correctly. Of course, these rendering times make it impossible to work. The package silence is installed correctly, as I can see in the MikTeX package manager. I have included the \usepackage command right after the \documentclass command, but the behavior is the same if I include it at a later position in the preamble. I have dozens of other packages installed and never experienced anything like that.

What is the problem and what can I do?

Update:

By further testing I found out that the following code in one of my subfiles causes the indefinite loop of package silence:

\subsection{text … $ \mathbb{R} $ … text}

Using math mode in a section heading, but only in conjunction with the macros \mathbb, \mathcal. Other macros work well, even self-defined ones. Possibly there are more macros which cause the hang-up, but so far I found only these two. Changing the length of the rest of the section heading text has no effect. Elimination of these macros in the math mode within the 2 section headings concerned causes the respective subfile to be processed rapidly and correctly. All unwanted warnings are gone.

  • 1
    could be related to any part of your code. please provide an MWE and people have an easier time checking for errors. – naphaneal Mar 30 at 19:53
  • @naphaneal, where to start with a 1000 page document? This will take weeks, won't it? – Roland Salz Mar 30 at 20:25
  • Depending on your filter settings, that package seems to do several string comparisons which are slow in (La)TeX. You could start with a document that only contains the first chapter of your document and check how long compilation takes. Then experiment with the filter settings to see if the situation improves. – siracusa Mar 30 at 20:28
  • 2
    If some pages have been output after several minutes, it could mean that there are very slow loops or that at some point, an infinite loop starts. Since you say that after interruption some chapters have been processed, can you try moving \end{document} at the end of the first chapter and see what happens? – egreg Mar 30 at 21:06
  • @egreg, thanks a lot for this idea! In fact, I found what causes the indefinite loops. Please see my update to the question. But I have no idea why this causes the problem. – Roland Salz Mar 31 at 12:55
4

The following would produce an infinite loop:

\RequirePackage{silence}

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{hyperref}

\begin{document}

\section{Something about $\mathbb{R}$, plus other things}

\end{document}

On the other hand, this will compile flawlessly.

\RequirePackage{silence}

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{hyperref}

\WarningFilter{latex}{Marginpar on page}
\WarningFilter{hyperref}{Token not allowed}

\pdfstringdefDisableCommands{\let\mathbb\relax}

\begin{document}

\section{Something about $\mathbb{R}$, plus other things}

\end{document}

Much better would be to use

\section{Something about \texorpdfstring{$\mathbb{R}$}{R}, plus other things}

Where does the problem arise? It's when hyperref macros try to produce the text for the bookmarks. For some reason, a \sl@Terminator escapes being gobbled, because silence redefines \@gobble under certain circumstances, but hyperref does things differently than the other package expects. Since the definition of \sl@Terminator is

\def\sl@Terminator{\sl@Terminator}

this starts an infinite loop.

  • could you please also explain why the above mentioned statement would cause infinite loop. – subham soni Mar 31 at 14:37

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.