“重新运行以确保交叉引用正确。” LaTeX 警告

“重新运行以确保交叉引用正确。” LaTeX 警告

我被这个警告困扰了:“标签可能已更改。请重新运行以获取正确的交叉引用。” 编译器无法编译我的文档,我无法移动它。

  1. 最初警告是指一些未定义的标签,我尝试将新的 .aux 文件与之前的文件进行比较,但没有发现任何差异。
  2. 所以我决定对每个引用都“注释 %”(目前我在文档中引用的引用仅用于图表),然后尝试重新编译它。关于未定义标签的警告消失了,但主要警告“rerrun”仍然存在。我尝试重新编译两次以上,但不起作用。一旦我删除注释“%”,问题就会再次出现。
  3. 然后出现了另一个警告(您可以在下面看到),我决定用它来替换\usepackage{hyperref}\usepackage{bookmark}(替换完成后,警告消失了,但重新编译过程不再起作用):

软件包 rerunfilecheck 警告:文件 *****.out 已更改。
请重新运行以获取正确的概要或使用软件包“bookmark”。

文档相当大,因此给您一个不容易测试代码的工作环境。我使用 Visual Code 作为编辑器,我可以看到编译器日志正在工作。我会尝试给您一个与我的类似的 MWE:

    \documentclass[11pt, a4paper,oneside,english,tipotesi=magistrale,numerazioneromana,evenboxes]{toptesi}

    
    \usepackage[utf8]{inputenc} %This pack allows to use UTF8 codification for special characters.
    \usepackage[T1]{fontenc} %font enconding
    \usepackage{comment} %This pack allows for multiple-lines comments.
    \usepackage{enumitem} %This pack allows the creation of lists
    \usepackage[english]{babel}
    \usepackage{geometry} %This pack allows to set margins, paper size and so on.
    \usepackage{mathtools} %This pack introduces several powerful math commands that are not provided by basic LaTeX. Mathtools includes amsmath package.
    \usepackage{fancyhdr} %It allows some text formatting like chapter on top of each page.
    \usepackage{etoolbox} 
    \usepackage{array} %It allows tables formatting.
    \usepackage{booktabs} %It allows to control the thickness of horizontal rules by toprule, midrule, bottomrule.
    \usepackage{graphicx}
    
    
    \usepackage{libertinus} %font
    \usepackage{libertinust1math} %mathfont
    \usepackage{microtype} %improves general typographic
    \usepackage{pifont} %allow special symbol like square or circle with shadows
    \usepackage{bbding} %adds more symbols
    \usepackage{tabularx}
    \usepackage{tcolorbox}
    \usepackage[autostyle]{csquotes}
    \usepackage{optidef} %useful to write optimization problems
    \usepackage{scalerel,amssymb} %allows to scale/stretch and shift objects
    \usepackage{gensymb} %Generic symbols for both text and math mode
    \usepackage{cancel} %Place lines through maths formulae
    
    
    \usepackage{titlesec} %allows different title styles
    \usepackage{xcolor} %color extension
    
    
    \usepackage[hypcap=true]{caption} %It allows to be redirected directly to the figure instead of the caption of the figure, when you click an hyperreference in the text.
    \usepackage{bookmark} %allows cross-referencing 
    
    
    
    
    
    %--------------------------------------------------------------------------------------
    %This code changes the chapter style and makes it fancier
    
    
    \newcommand{\chapnumfont}{%     % define font for chapter number
     \usefont{T1}{pnc}{b}{n}%      % choose New Chancery, bold, normal shape
     \fontsize{100}{110}%          % font size 100pt, baselineskip 100pt
     \selectfont%                  % activate font
    }
    \colorlet{chapnumcol}{gray!75}  % color for chapter number
    
    \titleformat{name=\chapter}[display]
    {\filleft\bfseries}
    {\filleft\chapnumfont\textcolor{chapnumcol}{\thechapter}}
    {-24pt}
    {\Huge}
    
    \titleformat{name=\chapter,numberless}[display]
    {\filright\bfseries}
    {\filright}
    {-24pt}
    {\Huge}
    
    
    
    
    
    %-----------------------------------------------------------------------%This set another box where put text inside (for assumptions)
    
    
    \definecolor{mycolor}{rgb}{0.122, 0.435, 0.698}
    
    \newtcbox{\mybox}{enhanced,left skip=15pt,
      colframe=mycolor,colback=mycolor!5!white,
      boxrule=0.5pt,arc=4pt,boxsep=0pt,left=6pt,right=6pt,top=5pt,bottom=5pt, hbox, drop fuzzy shadow}
    
    \newlength{\xdescwd}
    \newenvironment{xdesc}[1]
      {\settowidth{\xdescwd}{\textbf{#1:}}%
       \begin{description}[leftmargin=\dimexpr\xdescwd+.5em\relax,
         labelindent=0pt,labelsep=.5em,
         labelwidth=\xdescwd,align=right]\item[#1:]}
      {\end{description}}
    
    \newtcolorbox{longbox}[2][]{before upper={\begin{xdesc}{#2}},after upper={\end{xdesc}}, 
        enhanced, left skip=15pt, drop fuzzy shadow, breakable, colframe=mycolor,colback=mycolor!5!white,
        boxrule=0.5pt, arc=4pt, boxsep=0pt, left=6pt, right=6pt, top=5pt, bottom=5pt, #1}
    
    
    
    %----------------------------------------------------------------------------------------
    
    \setlength{\tabcolsep}{15pt} %This command increments column spacing in tables.
    
    %----------------------------------------------------------------------------------------
    
    \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} %This commands allow to center tables horizontally and vertically.
    \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
    
    %-----------------------------------------------------------------------------------------------------
    
    \numberwithin{equation}{chapter} %This command allows to enumerate formulas or equations according to the section they belong.
    
    %-----------------------------------------------------------------------------------------------------%This command put headers with no upper case and add number section and name
    
    \pagestyle{fancy}
    \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
    \renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
    \fancyhead[R]{\nouppercase{\leftmark}}
    \fancyhead[L]{\rightmark}
    
    %---------------------------------------------------------------------------------------------This command generates hyperlinks with tables, figures, chapters and sections
    
    \hypersetup{%
        pdfpagemode={UseOutlines},
        bookmarksopen,
        pdfstartview={FitH},
        colorlinks,
        linkcolor={black},
        citecolor={blue},
        urlcolor={blue}
      }
    
      %-------------------------------------------------------------------------------------
    
      \geometry{left=4cm, right=4cm} %This command set margins
    
      %-------------------------------------------------------------------------------------
    
      \addto\captionsenglish{%
      \renewcommand{\figurename}{Fig.}%
      \renewcommand{\contentsname}{Table of Contents}%
    } 
    
    %This code change the reference Figure x.x in Fig. x.x when we use the command "figurename and ref" to cite a figure within the text
    
    %------------------------------------------------------------------------------------
    
    
    \begin{document}
    \english
    
    
  \chapter(first chapter)
  \section(first section)

   This is the moon buggy example (\figurename~\ref{moonbuggy}).

     \begin{figure}[h] 
            \centering
            \includegraphics[scale=.15]{figures/moonbuggy}
            \caption{Lunar Roving Vehicle (LRV), also called Moon buggy, is an electric vehicle designed to expand astronauts' range of exploration on the low-gravity lunar surface}
            \label{moonbuggy}
        \end{figure}

\chapter{Second Chapter}

This is the second moon buggy example (\figurename~\ref{moonbuggy2}).
    
         \begin{figure}[h] 
                \centering
                \includegraphics[scale=.15]{figures/moonbuggy2}
                \caption{Lunar Roving Vehicle (LRV) second caption}
                \label{moonbuggy2}
            \end{figure}


   Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text (\figurename~\ref{moonbuggy2}).

         \begin{longbox}[width=.8\linewidth]{Assumption 6}
            The thrust direction can be commanded in any direction 
            instantaneously.
         \end{longbox}
        
Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text.

        \end{document}

我怀疑问题是由某种浮动动态引起的,并且有些东西会混淆引用和编译过程。无论如何,我尊重进入图形环境的顺序,将 放在\label之后\caption和 之前\end

奇怪的是,一切都运行良好,但当我尝试在具有环境的章节之一中插入一个框时\tcolorbox,警告出现,从那时起文档就不再编译。我不知道该怎么办,我做了大量的研究,但没有找到对我的情况有用的东西。我依靠你更好的经验和能力。

我全靠你了!谢谢。

答案1

\documentclass[11pt, a4paper,oneside,english,tipotesi=magistrale,numerazioneromana,evenboxes]{toptesi}

    
    \usepackage[utf8]{inputenc} %This pack allows to use UTF8 codification for special characters.
    \usepackage[T1]{fontenc} %font enconding
    \usepackage{comment} %This pack allows for multiple-lines comments.
    \usepackage{enumitem} %This pack allows the creation of lists
    \usepackage[english]{babel}
    \usepackage{geometry} %This pack allows to set margins, paper size and so on.
    \usepackage{mathtools} %This pack introduces several powerful math commands that are not provided by basic LaTeX. Mathtools includes amsmath package.
    \usepackage{fancyhdr} %It allows some text formatting like chapter on top of each page.
    \usepackage{etoolbox} 
    \usepackage{array} %It allows tables formatting.
    \usepackage{booktabs} %It allows to control the thickness of horizontal rules by toprule, midrule, bottomrule.
    \usepackage{graphicx}
    
    
    \usepackage{libertinus} %font
    \usepackage{libertinust1math} %mathfont
    \usepackage{microtype} %improves general typographic
    \usepackage{pifont} %allow special symbol like square or circle with shadows
    \usepackage{bbding} %adds more symbols
    \usepackage{tabularx}
    \usepackage{tcolorbox}
    \usepackage[autostyle]{csquotes}
    \usepackage{optidef} %useful to write optimization problems
    \usepackage{scalerel,amssymb} %allows to scale/stretch and shift objects
%%%%%    \usepackage{gensymb} %Generic symbols for both text and math mode
    \usepackage{cancel} %Place lines through maths formulae
    
    
    \usepackage{titlesec} %allows different title styles
    \usepackage{xcolor} %color extension
    
    
    \usepackage[hypcap=true]{caption} %It allows to be redirected directly to the figure instead of the caption of the figure, when you click an hyperreference in the text.
    \usepackage{bookmark} %allows cross-referencing 
    
    
    
    
    
    %--------------------------------------------------------------------------------------
    %This code changes the chapter style and makes it fancier
    
    
    \newcommand{\chapnumfont}{%     % define font for chapter number
     \usefont{T1}{pnc}{b}{n}%      % choose New Chancery, bold, normal shape
     \fontsize{100}{110}%          % font size 100pt, baselineskip 100pt
     \selectfont%                  % activate font
    }
    \colorlet{chapnumcol}{gray!75}  % color for chapter number
    
    \titleformat{name=\chapter}[display]
    {\filleft\bfseries}
    {\filleft\chapnumfont\textcolor{chapnumcol}{\thechapter}}
    {-24pt}
    {\Huge}
    
    \titleformat{name=\chapter,numberless}[display]
    {\filright\bfseries}
    {\filright}
    {-24pt}
    {\Huge}
    
    
    
    
    
    %-----------------------------------------------------------------------%This set another box where put text inside (for assumptions)
    
    
    \definecolor{mycolor}{rgb}{0.122, 0.435, 0.698}
    
    \newtcbox{\mybox}{left skip=15pt,
      colframe=mycolor,colback=mycolor!5!white,
      boxrule=0.5pt,arc=4pt,boxsep=0pt,left=6pt,right=6pt,top=5pt,bottom=5pt, hbox}
    
    \newlength{\xdescwd}
    \newenvironment{xdesc}[1]
      {\settowidth{\xdescwd}{\textbf{#1:}}%
       \begin{description}[leftmargin=\dimexpr\xdescwd+.5em\relax,
         labelindent=0pt,labelsep=.5em,
         labelwidth=\xdescwd,align=right]\item[#1:]}
      {\end{description}}
    
    \newtcolorbox{longbox}[2][]{before upper={\begin{xdesc}{#2}},after upper={\end{xdesc}}, 
        , left skip=15pt,  colframe=mycolor,colback=mycolor!5!white,
        boxrule=0.5pt, arc=4pt, boxsep=0pt, left=6pt, right=6pt, top=5pt, bottom=5pt, #1}
    
    
    
    %----------------------------------------------------------------------------------------
    
    \setlength{\tabcolsep}{15pt} %This command increments column spacing in tables.
    
    %----------------------------------------------------------------------------------------
    
    \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} %This commands allow to center tables horizontally and vertically.
    \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
    
    %-----------------------------------------------------------------------------------------------------
    
    \numberwithin{equation}{chapter} %This command allows to enumerate formulas or equations according to the section they belong.
    
    %-----------------------------------------------------------------------------------------------------%This command put headers with no upper case and add number section and name
    
    \pagestyle{fancy}
    \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
    \renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
    \fancyhead[R]{\nouppercase{\leftmark}}
    \fancyhead[L]{\rightmark}
    
    %---------------------------------------------------------------------------------------------This command generates hyperlinks with tables, figures, chapters and sections
    
    \hypersetup{%
        pdfpagemode={UseOutlines},
        bookmarksopen,
        pdfstartview={FitH},
        colorlinks,
        linkcolor={black},
        citecolor={blue},
        urlcolor={blue}
      }
    
      %-------------------------------------------------------------------------------------
    
      \geometry{left=4cm, right=4cm} %This command set margins
    
      %-------------------------------------------------------------------------------------
    
      \addto\captionsenglish{%
      \renewcommand{\figurename}{Fig.}%
      \renewcommand{\contentsname}{Table of Contents}%
    } 
    
    %This code change the reference Figure x.x in Fig. x.x when we use the command "figurename and ref" to cite a figure within the text
    
    %------------------------------------------------------------------------------------
    
    
    \begin{document}
    \english
    
    
  \chapter(first chapter)
  \section(first section)

   This is the moon buggy example (\figurename~\ref{moonbuggy}).

     \begin{figure}[h] 
            \centering
            \includegraphics[scale=.15]{example-image}
            \caption{Lunar Roving Vehicle (LRV), also called Moon buggy, is an electric vehicle designed to expand astronauts' range of exploration on the low-gravity lunar surface}
            \label{moonbuggy}
        \end{figure}

\chapter{Second Chapter}

This is the second moon buggy example (\figurename~\ref{moonbuggy2}).
    
         \begin{figure}[h] 
                \centering
                \includegraphics[scale=.15]{example-image}
                \caption{Lunar Roving Vehicle (LRV) second caption}
                \label{moonbuggy2}
            \end{figure}


   Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text (\figurename~\ref{moonbuggy2}).

         \begin{longbox}[width=.8\linewidth]{Assumption 6}
            The thrust direction can be commanded in any direction 
            instantaneously.
         \end{longbox}
        
Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text. Some random text.

        \end{document}

相关内容