Forgot password?
 Register account
View 291|Reply 0

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

[Copy link]

411

Threads

1634

Posts

14

Reputation

Show all posts

abababa posted 2022-5-4 14:38 |Read mode
如题。我已经把一部分资料写在一个文档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}
Copy the Code
文档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}
Copy the Code
编译之后,那两个链接都是指向文档2里那个定理的,没有指向文档1。

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | 快速注册

$\LaTeX$ formula tutorial

Mobile version

2025-6-8 10:19 GMT+8

Powered by Discuz!

Processed in 0.016169 second(s), 21 queries

× Quick Reply To Top Edit