我有一份a0poster
文档(见下面的示例),它没有加载交叉引用,尽管bibtex
它运行正常并编译了引用。
我将正文写入不同的tex
文件并将其包含到主 tex 文件中(两者都可以在下面找到)。
如果文件text.tex
使用 包含\include
,则交叉引用会失败。如果使用 包含\input
,则一切正常。为什么?
PS:下面的文件main.tex
有很多\usepackages
以及一些类所需的定义a0poster
。
主文本
\documentclass[portrait]{a0poster}
\RequirePackage{amssymb,amsthm,array}
\RequirePackage[reqno]{amsmath}
% revtex
\usepackage[sort&compress,numbers]{natbib}
\usepackage{doi}%<----------
\usepackage{hyperref}
% Insert font types as \LARGE or \color
\usepackage{multicol}
\usepackage{amsfonts}
\usepackage[final]{graphicx}
\usepackage{pstricks}
\usepackage{alltt}
\usepackage{a4}
\usepackage{float}
\usepackage{verbatim}
\usepackage{calc}
\usepackage{wrapfig}%I took out the package cite
\usepackage[absolute]{textpos}
\usepackage{boxedminipage}
\renewcommand\familydefault{cmss}
% Switch off page numbers on a poster, obviously, and section numbers too.
\pagestyle{empty}
\setcounter{secnumdepth}{0}
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage[normalem]{ulem} % underline \uline
\usepackage{pifont} % inclui suporte a simbolos \ding no texto
\usepackage{stmaryrd} % inclui outros simbolos
% These colours are tried and tested for titles and headers. Don't
% over use color!
\usepackage{color}
\definecolor{DarkBlue}{rgb}{0.1,0.1,0.5}
\definecolor{Red}{rgb}{0.9,0.0,0.1}
% put text on the top of the image
\def\imagetop#1{\vtop{\null\hbox{#1}}}
\setlength{\abovecaptionskip}{0pt}
\setlength{\belowcaptionskip}{0pt}
% see documentation for a0poster class for the size options here
\newcommand{\Textsize}{\large}
\newcommand{\IntroTextsize}{\large}
\newcommand{\Abstractsize}{\normalsize}
\newcommand{\TReferences}{\scriptsize}
\def\Head#1{\noindent\hbox to \hsize{\hfil{\Huge\color{DarkBlue} #1}}\bigskip}
\def\TAuthors#1{\noindent{\huge\color{DarkBlue} #1}\smallskip}
\def\TAddress#1{\noindent{\Large\color{DarkBlue} #1}\smallskip}
\def\LHead#1{\noindent{\Huge\color{DarkBlue} #1}\smallskip}
\def\Subhead#1{\noindent{\Large\color{DarkBlue} #1}}
\def\Title#1{\noindent{\VERYHuge\color{Red} #1}}
\TPGrid[20mm,20mm]{15}{25} % 3 - 1 - 7 - 1 - 3 Columns
% Mess with these as you like
\parindent=0pt
\parskip=0.5\baselineskip
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%
\include{text} %%%%% gives the undefined reference error
\input{text} %%%%% loads the text with correct cross-referencing
%%%%%%%%%%%%%%%%%%%%%%
\begin{textblock}{7}(7.8,21.6)
\begin{multicols}{2}
\TReferences
\bibliographystyle{apsrev4-1-custom}
\bibliography{referencias}
\end{multicols}
\end{textblock}
\end{document}
文本.tex
\begin{textblock}{7}(0.25,5.8)
\begin{equation}
\label{eq:myEqn1}
f(x) = a + bx
\end{equation}
eq \eqref{eq:myEqn1} is a straight line! %%%% display '??' undefined reference
\end{textblock}
答案1
您不能使用\include
此类;该\include
机制需要分页符,无法在海报中执行。实际上a0poster
(或由其输入的包)重新定义\clearpage
为不真正发出分页符。
由于\include
没有看到必要的分页符,标签无法正确写入辅助.aux
文件中,因此导致标签丢失。事实上,代码
\newlabel{eq:myEqn1}{{1}{1}{}{equation.0.1}{}}
出现在.log
文件中,这意味着执行.aux
时该文件未正确打开。\label