2

Is there a way to make references to not yet written code?

Basically I just want to supress warnings that appear, when I write \ref{}, cause I happen to have references to things, that will come only later. However, I don't want the missing reference warnings to clutter the log (which in any case is already big and confusing).

3
  • 4
    Well you must compile at least twice for avoid warnings and get the references right instead the ?? symbols when LaTeX can't find the label or the object to reference. You can put comments on your code to know where you must, in a future stage, add a label or an object. And you can also use the todonotes package that can help you to add colourful notes for remind you to add those things. This package includes also placeholder pictures also.
    – Aradnix
    Oct 16, 2014 at 16:18
  • @Aradnix todonotes seems to be a good solution.
    – embert
    Oct 16, 2014 at 16:21
  • If your log is "large and confusing", first clean up current warnings. If (La)TeX issues a warning, more often than not something is wrong. It might be mildly wrong (a line is too long to fit, in which case you should rewrite sometime, or something like it) or it could be more serious. Warnings about missing references should not be silenced, they are serious problems, that must be fixed.
    – vonbrand
    Feb 20, 2016 at 3:35

1 Answer 1

1

You can suppress warnings using silence.

Below is a small example:

enter image description here

\documentclass{article}

\usepackage{silence}% Filter out unwanted warnings and error messages
                                    % Remove all warnings issued by LaTeX that starts with
\WarningFilter[todo]{latex}
  {Reference }                      % 'Reference ' and
\WarningFilter[todo]{latex}
  {There were undefined references} % 'There were undefined references'

\ActivateWarningFilters[todo]% Activate the 'todo' warnings filter
\begin{document}

\section{A section}
See Section~\ref{sec:two} and~\ref{sec:three}.

\iffalse% Comment to insert this section
\section{Another section}\label{sec:two}
This is another section.
\fi% Comment to insert this section

\section{Yet another section}\label{sec:three}
This is yet another section.

\end{document}

The .log for the above example produces 0 warnings.

All warning filters are stored in a "family" called todo, which can be activated as needed.

You must log in to answer this question.

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