0

I use Lyx. When I export my article as pdf (or postscript) the cross-reference to the Sections appears as ?? in the output.

The same doesn't happen with Part, subsection, and subsubsection. It works fine only if I export as HTML.

This is an excerpt of my text as it is shown in the preview pane of Lyx.

In Section \ref{sec:Measurement-setup},
the hardware measurement setup is presented...

\section{Measurement setup \label{sec:Measurement-setup}}

The preamble looks like this

\documentclass{article}
\usepackage[latin9]{inputenc}
\usepackage{array}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{graphicx}
\PassOptionsToPackage{normalem}{ulem}
\usepackage{ulem}

\makeatletter

\providecommand{\tabularnewline}{\\}

\usepackage{spconf}
\usepackage{epsfig}
\usepackage{textcomp}

\title{bla bla bla}

\name{bla bla bla}

\address{bla bla bla}

\makeatother

I tried removing the Hyperref support but the result is the same: ??

  • 1
    does lyx really add \usepackage{epsfig} ??? no document written this century should have that. It was written in 1993 as a legacy compatibility package to support a syntax popular in the 1980s.... – David Carlisle Mar 22 at 18:28
  • No, that it was added by me because I was having some issues with eps figures, so I tried adding that line. Thanks for the sidenote. Deleting it from the preamble it doesn't solve the original question, though – Robyc Mar 22 at 19:22
  • impossible to say why you get ?? given the information shown, you always get that the first time latex runs, cross references are resolved on later passes, but I would have assumed lyx runs latex multiple times to resolve references (although I don't use it myself) – David Carlisle Mar 22 at 19:24
  • please make a small but complete example document in which cross references do not resolve, then it can be debugged, if you just post disconnected fragments there is not a lot of help that can be given. – David Carlisle Mar 22 at 19:27
  • Reduce a copy or you document and reduce as far of possible while is still showing the problem (i.e., delete irrelevant text, figures, etc.}.Then export the document to LaTeX (pdflatex) and reduce also as far of possible (irrelevant packages, comments, etc.). At this point most probably you will have only a few lines of code and you will discover yourself the mistake. Otherwise, edit the question and post that reduced but complete LaTeX code. – Fran Mar 22 at 23:50
0

General advice is, I believe, not to have labels in any kind of so-called moving arguments. In your case, this means putting the label after the section title, as the first inset of the paragraph following the title: \section{Measurement setup} \label{sec:Measurement-setup}

0

Not too sure why your setup is a problem. I don't use LyX so this is fairly new out of box you do need \hyperref to be active to export working refs in pdf.

So simply cobbling some of the bits you gave together (since we don't have your non working copy) I get this TeX and PDF output and using either the bookmark or the red link can hyperleap to the first section.

enter image description here

enter image description here

%% LyX 2.3.2-2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass{article}
\usepackage[latin9]{inputenc}
\usepackage{color}
\usepackage{amsmath}
\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=1,
 breaklinks=false,pdfborder={0 0 1},backref=section,colorlinks=true]
 {hyperref}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{array}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{ulem}
\providecommand{\tabularnewline}{\\}
\usepackage{textcomp}
\title{bla bla bla}
\name{bla bla bla}
\address{bla bla bla}

\makeatother

\begin{document}
\maketitle

In Section \ref{sec:Measurement-setup}, the hardware measurement
setup is presented...

\section{Measurement setup \label{sec:Measurement-setup}}
\end{document}
  • Thank you for checking this out. Out of the box it works for me as well, indeed. I guess the style package I use adds some formatting that breaks the label, as PhilipPirrip suggests in one of the comments above. – Robyc Mar 25 at 13:13

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.