找回密码
 快速注册
搜索
查看: 105|回复: 0

请教跨文档引用定理要怎么做?

[复制链接]

413

主题

1558

回帖

1万

积分

积分
11498

显示全部楼层

abababa 发表于 2022-5-4 14:38 |阅读模式
如题。我已经把一部分资料写在一个文档1里了,现在又写了一个文档2,也写了很多,和文档1有一部分内容是重复的,如果我想在文档2里引用文档1的定理,并且点一下就能打开文档1,这个要怎么做?

我搜索了一个xr包,但是不太会用:
文档1的代码
  1. \documentclass[a4paper]{book}
  2. \usepackage{amsmath,bm,yhmath,amssymb,etoolbox,esvect,stmaryrd,cite,enumitem,extarrows,mathtools,ifthen}
  3. \usepackage{etoolbox}
  4. \usepackage[amsmath, thmmarks]{ntheorem}
  5. {
  6.         \theoremstyle{nonumberplain}
  7.         \theoremheaderfont{\indent\bfseries}
  8.         \theorembodyfont{\normalfont}
  9.         \theoremsymbol{\ensuremath{\Box}}
  10. }
  11. \newtheorem{theorem}{Theorem}[section]
  12. \usepackage{xr}
  13. \usepackage[pdfencoding=auto,psdextra,colorlinks,linkcolor=red,anchorcolor=blue,citecolor=blue]{hyperref}
  14. \usepackage{cleveref}
  15. \begin{document}
  16. \chapter{book1,chapter1}
  17. \section{section1}
  18. \begin{theorem}\label{f1:thm:01:01:01}
  19. book1,theorem 1
  20. \end{theorem}
  21. \end{document}
复制代码
文档2的代码:
  1. \documentclass[a4paper]{book}
  2. \usepackage{amsmath,bm,yhmath,amssymb,etoolbox,esvect,stmaryrd,cite,enumitem,extarrows,mathtools,ifthen}
  3. \usepackage{etoolbox}
  4. \usepackage[amsmath, thmmarks]{ntheorem}
  5. {
  6.         \theoremstyle{nonumberplain}
  7.         \theoremheaderfont{\indent\bfseries}
  8.         \theorembodyfont{\normalfont}
  9.         \theoremsymbol{\ensuremath{\Box}}
  10. }
  11. \newtheorem{theorem}{Theorem}[section]
  12. \usepackage{xr}
  13. \usepackage[pdfencoding=auto,psdextra,colorlinks,linkcolor=red,anchorcolor=blue,citecolor=blue]{hyperref}
  14. \usepackage{cleveref}
  15. \externaldocument{1}
  16. \begin{document}
  17. Book2
  18. \chapter{book2,chapter1}
  19. \section{section}
  20. \begin{theorem}\label{f2:thm:01:01:01}
  21. Book2, Theorem1
  22. \end{theorem}
  23. \newpage
  24. \autoref{f1:thm:01:01:01}
  25. \autoref{f2:thm:01:01:01}
  26. \end{document}
复制代码
编译之后,那两个链接都是指向文档2里那个定理的,没有指向文档1。

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 12:19

Powered by Discuz!

× 快速回复 返回顶部 返回列表