回忆录类-参考书目环境引用错误的bibunit

回忆录类-参考书目环境引用错误的bibunit

我正在使用回忆录课程撰写论文。

我有一个主程序,可以调用所有需要的文件。

其中一个文件是“摘要”,它调用两个具有各自参考书目的不同 tex 文件(我需要用两种语言提供摘要,英语和丹麦语)。

问题是第二个参考书目(丹麦语)没有出现(参考文献放置完美,但它们交叉引用英文摘要的参考书目环境)。

编辑:丹麦文摘要似乎一直在查看英文 bib 文件。只有当参考文献在英文摘要中被引用时,才会放置参考文献,否则不会显示。如果两个 bib 文件中的参考文献关键字不同(例如,下面示例中的 test1 和 test1d),则参考文献将无法正确放置。

附上 MWE

\documentclass[b5paper,10pt,authoryear,longnamesfirst]{memoir}

\begin{filecontents}{englishsummary.bib}
@Article{test1,
  author =   {Test Testesen},
  title =    {Test},
  journal =      {Test journal},
  year =     {2018},
}
@Article{test2,
  author =   {Test T. Test},
  title =    {TestB},
  journal =      {Journal of testing},
  year =     {2018},
}
\end{filecontents}

\begin{filecontents}{danishsummary.bib}

@Article{test1d,
  author =   {Test Testesen},
  title =    {Test},
  journal =      {Test journal},
  year =     {2018},
}
@Article{test2d,
  author =   {Test T. Test},
  title =    {TestB},
  journal =      {Journal of testing},
  year =     {2018},
}
\end{filecontents}

% preamble
\let\newfloat\undefined
\usepackage[capbesideposition={top,center},capposition=top]{floatrow}

\usepackage[scaled=0.75]{beramono}
\usepackage[utf8]{inputenc}
\usepackage[english,danish]{babel}
\usepackage{microtype}

\usepackage{bibunits}
\usepackage[authoryear,sectionbib,longnamesfirst]{natbib}

\setlrmarginsandblock{*}{1.228571in}{0.75} 
\setulmarginsandblock{1in}{*}{1.2}

\nouppercaseheads
\makeoddhead{headings}{\small\scshape\rightmark}{}{\small\thepage} 
\makeevenhead{headings}{\small\thepage}{}{\small\scshape\leftmark}

\linespread{1.1}

\usepackage{cleveref}
% END PREAMBLE

\begin{document}

    \selectlanguage{english}
    \frenchspacing
    \tableofcontents*
    %SUMMARY
    \let\oldbibsection\bibsection
    \let\oldbibsection\bibsection
    \renewcommand\bibsection{\section*{\bibname}}

    % English summary
    \begin{bibunit}[elsarticle-harv]
        \chapter*[Summary]{Summary}
        \addcontentsline{toc}{chapter}{Summary}

        some english text \citep{test1} and \cite{test2}.
        %\clearpage
        \putbib[englishsummary.bib]
    \end{bibunit}
    % END OF English SUMMARY

    % Danish summary
    \begin{bibunit}[elsarticle-harv_danish]
        \chapter*[Danish summary]{Danish summary}
        \addcontentsline{toc}{chapter}{Danish summary}
        \selectlanguage{Danish}
        \frenchspacing
        \setcounter{footnote}{0}
        %DANISH SUMMARY     
        some danish text \citep{test1d} and \cite{test2d}.
        \clearpage
        \putbib[danishsummary.bib]
    \end{bibunit}
        % END OF DANISH SUMMARY
    \selectlanguage{english}
    \frenchspacing
    \let\bibsection\oldbibsection
\end{document}

答案1

以下是 OP 当前 MWE 的重新编辑(20180831 12:10)

\documentclass[oneside]{memoir}
\usepackage{filecontents}
\begin{filecontents*}{englishsummary.bib}
@Article{test1,
  author =   {Test Testesen},
  title =    {Test english},
  journal =      {Test journal},
  year =     {2018},
}
@Article{test2,
  author =   {Test T. Test},
  title =    {TestB english},
  journal =      {Journal of testing},
  year =     {2018},
}
\end{filecontents*}
\begin{filecontents*}{danishsummary.bib}
@Article{test1d,
  author =   {Test TestesenD},
  title =    {Test danish},
  journal =      {Test journal},
  year =     {2018},
}
@Article{test2d,
  author =   {Test T. TestD},
  title =    {TestB danish},
  journal =      {Journal of testing},
  year =     {2018},
}
\end{filecontents*}

\usepackage[utf8]{inputenc}
\usepackage[danish,english]{babel}

\usepackage{bibunits}
\usepackage[authoryear,sectionbib,longnamesfirst]{natbib}

\begin{document}

    \selectlanguage{english}
    \tableofcontents*


    % English summary
    \begin{bibunit}[plainnat]
        \chapter*[Summary]{Summary}

        some english text \citep{test1} and \cite{test2}.
        %\clearpage
        \putbib[englishsummary]
    \end{bibunit}
    % END OF English SUMMARY

    % Danish summary
    \begin{bibunit}[plainnat]
        \chapter*[Danish summary]{Danish summary}
        \addcontentsline{toc}{chapter}{Danish summary}
        \selectlanguage{Danish}
        \frenchspacing

        some danish text \citep{test1d} and \cite{test2d}.

        \putbib[danishsummary]
    \end{bibunit}
\end{document}

据我所知,在我的系统上引用是正确的。我添加了包filecontents并切换到该环境的星号版本,然后如果我们在文本文件中更改它们,这两个 bibfiles 将在磁盘上发生变化。


评论太长了,这里是一篇非常小的 MWE 回忆录,与bibunits

记得在所有文件上运行 bibtex buX.aux(我使用该latexmk工具,它会自动检测buX.aux文件并bibtex在其上运行

那么你的文档上到底存在什么问题?

\documentclass[a4paper]{memoir}
\begin{filecontents}{mytest.bib}
@Article{test1,
  author =   {Test Testesen},
  title =    {Test},
  journal =      {Test journal},
  year =     {2018},
}
@Article{test2,
  author =   {Test T. Test},
  title =    {TestB},
  journal =      {Journal of testing},
  year =     {2018},
}
\end{filecontents}


\usepackage[danish,english]{babel}
\usepackage{bibunits}
\usepackage[authoryear,sectionbib,longnamesfirst]{natbib}


\begin{document}

\tableofcontents*


%English summary
\begin{bibunit}[plainnat]
\chapter*[Summary]{Summary}
\addcontentsline{toc}{chapter}{Summary}

some text

\cite{test1}

\putbib[mytest]
\end{bibunit}

% Danish summary
\begin{bibunit}[plainnat]
\chapter*[Danish summary]{Danish summary}
\addcontentsline{toc}{chapter}{Danish summary}
\selectlanguage{danish}
\frenchspacing

some text

\cite{test2}

\putbib[mytest]
\end{bibunit}

\end{document}

相关内容