他のTexファイルで参考文献を使用できない

他のTexファイルで参考文献を使用できない

2 つの .tex ファイルがあります。reftest.tex には、主な詳細 (参考文献、図、方程式) が含まれています。そして、cross_ref.tex です。cross_ref.tex では、reftest.tex ファイル内の参考文献の引用を相互参照したいのですが、引用に失敗しました。修正を手伝っていただけますか? これが私のコードです。

reftest.tex の場合:

 \documentclass[preprint,12pt, sort&compress]{elsarticle}
\def\bibsection{\section*{References}}
\usepackage[draft]{hyperref}
\usepackage{graphicx}
\usepackage{caption,subfig}
\usepackage{amssymb}
\usepackage{amsmath}

\begin{document}
This is ref \cite{S_Goossens}

\begin{figure} 
  \centering \includegraphics[width=0.5\linewidth]{example-image-a}
  \caption{This is caption}
  \label{fig:2}
\end{figure}

\begin{equation}
\label{eq:1} 
  y=x
\end{equation}

\begin{thebibliography}{00}

%% Text of bibliographic item
\bibitem{S_Goossens}SMichel Goossens, Frank Mittelbach, and Alexander Samarin Addison-Wesley, Reading, Massachusetts, 1993.

\end{thebibliography}
\end{document}

cross_ref.tex内

\documentclass[preprint,12pt, sort&compress]{elsarticle}
\def\bibsection{\section*{References}}
\usepackage[draft]{hyperref}
\usepackage{graphicx}
\usepackage{caption,subfig}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{xr}
\externaldocument{reftest}

\begin{document}
This is ref \cite{S_Goossens} in the reftest file

Figure \ref{fig:1} is figure in the reftest file

The  Eq. \eqref{eq:1} is a equation 

\end{document}

出力にcross_ref.texファイルの引用番号が表示されない

ここに画像の説明を入力してください

答え1

これでxcite動作しているようです。`xrxr-hyperの代わりにパッケージの読み込み順序に注意してください。

reftest.tex

\documentclass[preprint,12pt, sort&compress]{elsarticle}
\def\bibsection{\section*{References}}
\usepackage{graphicx}
\usepackage{caption,subfig}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[draft]{hyperref}

\begin{document}
This is ref \cite{S_Goossens}

\begin{figure} 
  \centering \includegraphics[width=0.5\linewidth]{example-image-a}
  \caption{This is caption}
  \label{fig:1}
\end{figure}

\begin{equation}
\label{eq:1} 
  y=x
\end{equation}

\begin{thebibliography}{00}

%% Text of bibliographic item
\bibitem{S_Goossens} Michel Goossens, Frank Mittelbach, and Alexander Samarin 
Addison-Wesley, Reading, Massachusetts, 1993.

\end{thebibliography}
\end{document}

crossref.tex

\documentclass[preprint,12pt, sort&compress]{elsarticle}
\def\bibsection{\section*{References}}
\usepackage{graphicx}
\usepackage{caption,subfig}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{xcite}
\usepackage{xr-hyper}
\usepackage[draft]{hyperref}
\externaldocument{reftest}
\externalcitedocument{reftest}

\begin{document}
This is ref \cite{S_Goossens} in the reftest file

Figure \ref{fig:1} is figure in the reftest file

The  Eq. \eqref{eq:1} is a equation 

\end{document}

出力crossref.tex

ここに画像の説明を入力してください

答え2

はい、ここに解決策があります。

外部書誌ファイル (literatur.bib) を使用する場合:

    @BOOK{S_Goossens,
  title = {Some title},
  publisher = {Addison-Wesley},
  year = {1993},
  author = {Goossens, S. Michel and Mittelbach, Frank and Samarin, Alexander},
  address = {Reading, Massachusetts},
  owner = {polz},
  timestamp = {2016.03.24}
}

環境を使用する代わりに外部参考文献を使用するように reftest.tex を変更するだけですthebibliography

\documentclass[preprint,12pt, sort&compress]{elsarticle}
\def\bibsection{\section*{References}}
\usepackage[draft]{hyperref}
\usepackage{graphicx}
\usepackage{caption,subfig}
\usepackage{amssymb}
\usepackage{amsmath}

\begin{document}
This is ref \cite{S_Goossens}

\begin{figure} 
  \centering \includegraphics[width=0.5\linewidth]{example-image-a}
  \caption{This is caption}
  \label{fig:1}
\end{figure}

\begin{equation}
\label{eq:1} 
  y=x
\end{equation}

\bibliography{literatur}{}
\bibliographystyle{plain}

\end{document}

ここで、\usepackage{bibentry}cross_rex.tex のプリアンブルに コマンドを追加し、 を介して literatur.bib を追加すると\nobibliography{literatur}{}、参考文献の印刷が防止され、希望どおりに動作します。

\documentclass[preprint,12pt, sort&compress]{elsarticle}
\def\bibsection{\section*{References}}
\usepackage[draft]{hyperref}
\usepackage{graphicx}
\usepackage{caption,subfig}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{xr}
\externaldocument{reftest}

\usepackage{bibentry}

\begin{document}
This is ref \cite{S_Goossens} in the reftest file

Figure \ref{fig:1} is figure in the reftest file

The  Eq. \eqref{eq:1} is a equation 

\nobibliography{literatur}{}

\end{document}

ここに画像の説明を入力してください

関連情報