I have a .tex document that contains some references to non-existing labels. For example, it may have \ref*{some:string}, but no \label{some:string}. This results in printing double question-marks ?? when generating the PDF. These references used to point to a super-large appendix which I'm not including in this short version of the document. Still, I would like to be able to print the correct section numbering instead of ??.

So, I made a command that creates an empty equation that contains only the missing label and gives it the desired tag, so that I can link label strings to the correct section numbers.


and at some point of my document I have a list of such \dummylabels, like so:


However, this has the side-effect of printing empty equations that are numbered (although I use the starred equations environment), which is something I don't want.

So, is there a way to hide these empty equations? Or, is there another way to create labels for those kinds of references and manually give them a tag/numbering, so that when the PDF is generated it will print that tag instead of ???

Note that these references are starred (\ref*{...}), so no hyperlink is actually created, which is good.

  • The packages xr and xr-hyper provide means for importing cross-referencing-data from other documents as long as these documents' .aux-files are available. Feb 14, 2021 at 23:57

2 Answers 2


You need to manually define the reference, of course.





Here are references to the dummy labels: \ref{some:string1} and \ref{some:string2}


enter image description here

If you load hyperref, use \ref* in order not to make links.

Explanation: \label{foo} makes foo refer to the current value of \@currentlabel; usually it is \refstepcounter that sets \@currentlabel, but one can set it to whatever one desires.

Caveat. The \dummylabel commands should go after \begin{document}, because in the preamble the .aux file is not available for writing.

You can as well place \dummylabel at the bottom, just before \end{document}.


I solve the same kind of problem with a hack by @Ulrike Fischer at comp.text.tex. It's the commented part on the code below. I define another command to keep the original \ref, and to have the possibility to add extra content if the label doesn't exist


%   \renewcommand\ref[1]{%
%       \@ifundefined{r@#1}
%       {no label #1}
%       {ref of #1: \Oriref{#1}}}}

  • Thanks for the answer. I tried it, but my document wouldn't compile. It was giving an error for references that target labels with underscores, like \ref*{some_string}.
    – frabala
    Feb 5, 2021 at 14:12
  • No error with the \checkref macro. If you tried the commented part, the error comes from the two calls to #1 outside any macro.
    – NBur
    Feb 5, 2021 at 14:22
  • You can code {no label \texttt{\detokenize{#1}}}{ref of \texttt{\detokenize{#1}}: \Oriref{#1}} to avoid the error.
    – NBur
    Feb 5, 2021 at 14:37

You must log in to answer this question.

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