交叉引用和独立类

交叉引用和独立类

我在使用独立类时遇到了交叉引用问题。让我来解释一下。这是 Main.tex:

    %** Main.tex**

\documentclass{article}
\usepackage[italian]{babel} 
\usepackage{amsmath,amssymb,amsthm}  
\usepackage{hyperref} 
\usepackage{graphicx}
\usepackage{xcolor}  
\usepackage{pgfplots}   
 \usepackage{standalone}
\usepackage{tikz}
\usetikzlibrary{spy}
\usetikzlibrary{decorations.fractals}
\usetikzlibrary{external}       
    \tikzexternalize

\newtheorem{theorem}{Theorem}
%*********************************************************************************
% Impostazioni di hyperref
%*********************************************************************************
\hypersetup{%
    hyperfootnotes=true,pdfpagelabels, 
    colorlinks=true, linktocpage=true, pdfstartpage=1, pdfstartview=FitV, 
    breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,%
    plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
    hypertexnames=true, pdfhighlight=/O,
    urlcolor=blue, linkcolor=blue, citecolor=webgreen,
    pdfsubject={},%
    pdfkeywords={},%
    pdfcreator={pdfLaTeX}
}

\begin{document}

We consider the following equation 
\begin{equation}
\label{eqn:a=b}
A=B\,\,.
\end{equation}
In reference to the eq.\,\eqref{eqn:a=b}, we consider the table~\ref{tab:AB}.\\

\tikzset{external/remake next=true}
\begin{table}
 \hspace{-1cm}\includegraphics[width=1.2\textwidth]{DisgnRq}
\caption{A vs B}
\label{tab:AB}
\end{table}
Lorem ipsum ...
\begin{theorem}
\label{thm:L}
Dolor sit amet...
\end{theorem}

From the Theorem~\ref{thm:L}, we obtain...
\end{document}

这是 DisgnRq.tex:

    %** DisgnRq.tex**

\documentclass[%
border={1cm .5cm 2cm .5cm} % left bottom right top
]{standalone}
\usepackage{amsmath,amssymb,amsthm}  
\usepackage{hyperref} 
\usepackage{xcolor}                     
\usepackage{tikz}
\usepackage{preview}
\hypersetup{%
    hyperfootnotes=true,pdfpagelabels, 
    colorlinks=true, linktocpage=true, pdfstartpage=1, pdfstartview=FitV, 
    breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,%
    plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
    hypertexnames=true, pdfhighlight=/O,
    urlcolor=blue, linkcolor=blue, citecolor=webgreen,
    pdfsubject={},%
    pdfkeywords={},%
    pdfcreator={pdfLaTeX}
}
\PreviewEnvironment{tikzpicture}
\usetikzlibrary[positioning]
\usetikzlibrary{patterns}

\tikzset{S1/.style  = {draw, text centered,
                        minimum height = 1.5cm,
                        minimum width  = 13em,
                        fill = green!15
}}
\tikzset{S2/.style = {draw, text centered,
                         minimum height = 1.5cm,
                         minimum width = 8em,
                         fill           = yellow!30,
                         text width = 12.35 em
}}


\begin{document}

\begin{center}
\begin{tikzpicture}[node distance=0 cm,outer sep = 0pt]

\node[S1,minimum height = 1cm] (A) at (-7,5.5) {A};

\node[S2,minimum height = 1cm] (B) [right=of A]   {B};

% A
\node[S1] (A1) [below=of A] {A1 (cfr.\,eq.\,\eqref{eqn:a=b})};

% B
\node[S2] (B1) [below=of B] {B1\\ \vspace{.2em}\fontsize{7.5}{5}\selectfont{Lorem ipsum (vd.\,Teorema~\ref{thm:L})}};

\end{tikzpicture}
\end{center}

\end{document}

如你所见,相对引用没有被编译: 汇编

有什么建议么?

答案1

谢谢你的提示,Christian Hupfer!

我以这种方式改变了“DisgnRq.tex”:

%** DisgnRq.tex**

\documentclass[%
border={1cm .5cm 2cm .5cm} % left bottom right top
]{standalone}
\usepackage{amsmath,amssymb,amsthm} 
\usepackage{xr-hyper} % *suggested change*
\usepackage{hyperref}
\usepackage{xcolor}             
\usepackage{tikz}
\usepackage{preview}
\hypersetup{%
    hyperfootnotes=true,pdfpagelabels, 
    colorlinks=true, linktocpage=true, pdfstartpage=1, pdfstartview=FitV, 
    breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,%
    plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
    hypertexnames=true, pdfhighlight=/O,
    urlcolor=blue, linkcolor=blue, citecolor=webgreen,
    pdfsubject={},%
    pdfkeywords={},%
    pdfcreator={pdfLaTeX},%
    pdfproducer={LaTeX with hyperref and ClassicThesis}%
}
\PreviewEnvironment{tikzpicture}
\usetikzlibrary[positioning]
\usetikzlibrary{patterns}

\tikzset{S1/.style  = {draw, text centered,
                        minimum height = 1.5cm,
                        minimum width  = 13em,
                        fill = green!15
}}
\tikzset{S2/.style = {draw, text centered,
                         minimum height = 1.5cm,
                         minimum width = 8em,
                         fill           = yellow!30,
                         text width = 12.35 em
}}
\externaldocument[main::]{Main} % *suggested change*

\begin{document}

\begin{center}
\begin{tikzpicture}[node distance=0 cm,outer sep = 0pt]

\node[S1,minimum height = 1cm] (A) at (-7,5.5) {A};

\node[S2,minimum height = 1cm] (B) [right=of A]   {B};

% A
\node[S1] (A1) [below=of A] {A1 (cfr.\,eq.\,\eqref{main::eqn:a=b})};



% B
\node[S2] (B1) [below=of B] {B1\\ \vspace{.2em}\fontsize{7.5}{5}\selectfont{Lorem ipsum (vd.\,Teorema~\ref{main::thm:L})}};

\end{tikzpicture}
\end{center}

\end{document}

确实有效!

然而问题几乎已经解决:唯一剩下的问题是,虽然正文中的引用是“活动链接”,但表中的引用却不是。

有任何想法吗?

PS:我使用 TeXLive-2011,这就是您在编译“DisgnRq.tex”时遇到问题的原因。

相关内容