【问题标题】:References not shown (Latex)未显示参考文献(乳胶)
【发布时间】:2018-06-20 04:44:18
【问题描述】:

我有一个非常奇怪的问题。在我的一篇论文中,对章节的引用根本没有打印出来。我用 pdflatex 编译,它可以毫无怨言地工作,它会吐出 pdf,但没有任何对部分的引用。

我只是在一个部分之后使用 \label{sec:mysec} 并在文本中的任何位置使用 \ref{sec:mysec},这是典型的用法。我已经使用了多年,但在这个特定的文档中,必须与阻止乳胶显示参考的东西进行交互。

如果有帮助,这些是我要导入的包:

\documentclass[a4paper,man,natbib,floatsintext]{apa6}
\usepackage[utf8]{inputenc} 
\usepackage{multirow}
\usepackage{graphicx} 
\usepackage{rotating}  
\usepackage{amsmath} 
\usepackage{amssymb} 
\usepackage{color} 
\usepackage{array}

我不知道它可能来自哪里。任何提示都会非常受欢迎。

非常感谢!

【问题讨论】:

    标签: label latex ref


    【解决方案1】:

    来自apa6documentation3.4 标题级别部分,第 5 页):

    请注意,部分不能\ref'd,因为 APA 样式可以 不要使用编号的部分。所以\label 命令是不必要的 除非你想使用\refname

    \refname 仅允许您访问参考部分标题(如果您使用它)。 apa6 文档中的所有部分都打印不带数字(源自类中的 \setcounter{secnumdepth}{0}),因此 \label\ref 没有多大意义:

    \documentclass{apa6}
    
    \begin{document}
    
    \section{A section}
    \label{sec:section}
    
    \section*{Another section}
    See section~\ref{sec:section}.
    
    \end{document}
    

    您可以使用以下\setlabel{<stuff>}{<label>} 选项手动设置\label 应存储的内容并在以后引用它:

    \documentclass{apa6}
    
    \makeatletter
    \newcommand{\setlabel}[1]{\edef\@currentlabel{#1}\label}
    \makeatother
    
    \begin{document}
    
    \section{A section}
    \setlabel{A section}{sec:section}
    
    \section*{Another section}
    See section~\ref{sec:section}.
    
    \end{document}
    

    如果您希望自动执行此过程,您可以通过以下方式在LaTeX kernel 中修补\@sect\@ssect

    \documentclass{apa6}
    
    \usepackage{etoolbox}
    
    \makeatletter
    % \pretocmd{<cmd>}{<prefix>}{<success>}{<failure>}
    \pretocmd{\@sect}{\def\@currentlabel{#8}}{}{}% Store title of \section
    \pretocmd{\@ssect}{\def\@currentlabel{#5}}{}{}% Store title of \section*
    \makeatother
    
    \begin{document}
    
    \section{A section}
    \label{sec:section}
    
    \section*{Another section}
    See section~\ref{sec:section}.
    
    \end{document}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-31
      • 2019-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多