|
如题。我已经把一部分资料写在一个文档1里了,现在又写了一个文档2,也写了很多,和文档1有一部分内容是重复的,如果我想在文档2里引用文档1的定理,并且点一下就能打开文档1,这个要怎么做?
我搜索了一个xr包,但是不太会用:
文档1的代码- \documentclass[a4paper]{book}
- \usepackage{amsmath,bm,yhmath,amssymb,etoolbox,esvect,stmaryrd,cite,enumitem,extarrows,mathtools,ifthen}
- \usepackage{etoolbox}
- \usepackage[amsmath, thmmarks]{ntheorem}
- {
- \theoremstyle{nonumberplain}
- \theoremheaderfont{\indent\bfseries}
- \theorembodyfont{\normalfont}
- \theoremsymbol{\ensuremath{\Box}}
- }
- \newtheorem{theorem}{Theorem}[section]
- \usepackage{xr}
- \usepackage[pdfencoding=auto,psdextra,colorlinks,linkcolor=red,anchorcolor=blue,citecolor=blue]{hyperref}
- \usepackage{cleveref}
- \begin{document}
- \chapter{book1,chapter1}
- \section{section1}
- \begin{theorem}\label{f1:thm:01:01:01}
- book1,theorem 1
- \end{theorem}
- \end{document}
复制代码 文档2的代码:- \documentclass[a4paper]{book}
- \usepackage{amsmath,bm,yhmath,amssymb,etoolbox,esvect,stmaryrd,cite,enumitem,extarrows,mathtools,ifthen}
- \usepackage{etoolbox}
- \usepackage[amsmath, thmmarks]{ntheorem}
- {
- \theoremstyle{nonumberplain}
- \theoremheaderfont{\indent\bfseries}
- \theorembodyfont{\normalfont}
- \theoremsymbol{\ensuremath{\Box}}
- }
- \newtheorem{theorem}{Theorem}[section]
- \usepackage{xr}
- \usepackage[pdfencoding=auto,psdextra,colorlinks,linkcolor=red,anchorcolor=blue,citecolor=blue]{hyperref}
- \usepackage{cleveref}
- \externaldocument{1}
- \begin{document}
- Book2
- \chapter{book2,chapter1}
- \section{section}
- \begin{theorem}\label{f2:thm:01:01:01}
- Book2, Theorem1
- \end{theorem}
- \newpage
- \autoref{f1:thm:01:01:01}
- \autoref{f2:thm:01:01:01}
- \end{document}
复制代码 编译之后,那两个链接都是指向文档2里那个定理的,没有指向文档1。 |
|