本项目直接依赖 elegantbook 宏包提供的文类,而 elegantbook 文类依赖的宏包是超级多的

https://github.com/XiangyunHuang/ElegantBookdown/blob/4b6ddb326824d2a89a2c04e23fd0f8d69c5d4f30/.travis.yml#L44-L48

LaTeX 宏包的依赖网络在我这就是一团乱麻,能否类似 Python 或 R 语言的模块/包一样,可以根据宏包画出它的依赖网络,类似 https://github.com/crsh/citr#package-dependencies

目的

找到关键节点,尽量优化,减负,包太多容易引起冲突

StackOverflow 上有不少人问类似的问题。例如<https://tex.stackexchange.com/questions/408356/how-to-ensure-package-dependencies-are-satisfied> 和 <https://tex.stackexchange.com/questions/119469/how-to-design-a-command-inquiring-internally-required-packages> 里面提供的方法。
再有就是用\listfiles 命令。

\documentclass{elegantbook}
\listfiles
\begin{document}
\end{document}

可以找.log 里面找到调用的宏包列表。

*File List*
elegantbook.cls    2020/02/10 v3.10 ElegantBook document class
kvoptions.sty    2019/11/29 v3.13 Key value format for package options (HO)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
 ltxcmds.sty    2019/12/15 v1.24 LaTeX kernel commands for general use (HO)
kvsetkeys.sty    2019/12/15 v1.18 Key value parser (HO)
etoolbox.sty    2019/09/21 v2.5h e-TeX tools for LaTeX (JAW)
    book.cls    2019/12/20 v1.4l Standard LaTeX document class
    bk10.clo    2019/12/20 v1.4l Standard LaTeX file (size option)
geometry.sty    2020/01/02 v5.9 Page Geometry
  ifvtex.sty    2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.
   iftex.sty    2019/11/07 v1.0c TeX engine tests
indentfirst.sty    1995/11/23 v1.03 Indent first paragraph (DPC)
 comment.sty    
newtxtext.sty    2018/03/27 v1.531
fontaxes.sty    2014/03/23 v1.0d Font selection axes
 xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
 fontenc.sty
t1ntxtlf.fd    2015/01/17 v1.0 font definition file for T1/ntx/tlf
textcomp.sty    2020/02/02 v2.0n Standard LaTeX package
anyfontsize.sty    2007/11/22 anyfontsize.sty by pts
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
  pdftex.def    2018/01/08 v1.0l Graphics/color driver for pdftex
     mwe.sty    2018/03/30 v0.5 Package to support minimal working examples (MW
E)
graphicx.sty    2019/11/30 v1.2a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2019/11/30 v1.4a Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  lipsum.sty    2019/01/02 v2.2 150 paragraphs of Lorem Ipsum dummy text
   expl3.sty    2020-02-25 L3 programming layer (loader) 
l3backend-pdfmode.def    2020-02-23 L3 backend support: PDF mode
  xparse.sty    2020-02-25 L3 Experimental document command parser
  lipsum.ltd
blindtext.sty    2012/01/06 V2.0 blindtext-Package
  xspace.sty    2014/10/28 v1.13 Space after command names (DPC,MH)
  natbib.sty    2010/09/13 8.31b (PWD, AO)
enumerate.sty    2015/07/23 v3.00 enumerate extensions (DPC)
enumitem.sty    2019/06/20 v3.9 Customized lists
 caption.sty    2020/01/03 v3.4h Customizing captions (AR)
caption3.sty    2020/01/03 v1.8h caption3 kernel (AR)
 amsmath.sty    2020/01/20 v2.17e AMS math features
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    2016/03/08 v2.02 operator names
mathrsfs.sty    1996/01/01 Math RSFS package v1.0 (jk)
amsfonts.sty    2013/01/14 v3.01 Basic AMSFonts support
 amssymb.sty    2013/01/14 v3.01 AMS font symbols
booktabs.sty    2020/01/12 v1.61803398 Publication quality tables
multicol.sty    2019/12/09 v1.8y multicolumn formatting (FMi)
multirow.sty    2019/05/31 v2.5 Span multiple rows of a table
fancyvrb.sty    2020/01/13 v3.5 verbatim text (tvz,hv)
makecell.sty    2009/08/03 V0.1e Managing of Tab Column Heads and Cells
   array.sty    2019/08/31 v2.4l Tabular extension package (FMi)
  hologo.sty    2019/12/05 v1.14 A logo collection with bookmark support (HO)
infwarerr.sty    2019/12/03 v1.5 Providing info/warning/error messages (HO)
kvdefinekeys.sty    2019-12-19 v1.6 Define keys (HO)
pdftexcmds.sty    2019/11/24 v0.31 Utility functions of pdfTeX for LuaTeX (HO)
setspace.sty    2011/12/19 v6.7a set line spacing
  xpatch.sty    2012/10/02 v0.3 Extending etoolbox patching commands
pgfornament.sty    2016/03/05 v0.21 vector ornaments
    tikz.sty    2020/01/08 v3.1.5b (3.1.5b)
     pgf.sty    2020/01/08 v3.1.5b (3.1.5b)
  pgfrcs.sty    2020/01/08 v3.1.5b (3.1.5b)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
 pgfcore.sty    2020/01/08 v3.1.5b (3.1.5b)
  pgfsys.sty    2020/01/08 v3.1.5b (3.1.5b)
pgfsys.code.tex
pgfsyssoftpath.code.tex    2020/01/08 v3.1.5b (3.1.5b)
pgfsysprotocol.code.tex    2020/01/08 v3.1.5b (3.1.5b)
pgfcore.code.tex
pgfcomp-version-0-65.sty    2020/01/08 v3.1.5b (3.1.5b)
pgfcomp-version-1-18.sty    2020/01/08 v3.1.5b (3.1.5b)
  pgffor.sty    2020/01/08 v3.1.5b (3.1.5b)
 pgfkeys.sty    
pgfkeys.code.tex
 pgfmath.sty    
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
 pgfopts.sty    2014/07/10 v2.1a LaTeX package options with pgfkeys
pgflibraryvectorian.code.tex
hyperref.sty    2020/01/14 v7.00d Hypertext links for LaTeX
pdfescape.sty    2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
 hycolor.sty    2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
letltxmacro.sty    2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
 auxhook.sty    2019-12-17 v1.6 Hooks for auxiliary files (HO)
  pd1enc.def    2020/01/14 v7.00d Hyperref: PDFDocEncoding definition (HO)
 intcalc.sty    2019/12/15 v1.3 Expandable calculations with integers (HO)
etexcmds.sty    2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
  bitset.sty    2019/12/09 v1.3 Handle bit-vector datatype (HO)
bigintcalc.sty    2019/12/15 v1.5 Expandable calculations on big integers (HO)
atbegshi.sty    2019/12/05 v1.19 At begin shipout hook (HO)
 hpdftex.def    2020/01/14 v7.00d Hyperref driver for pdfTeX
atveryend.sty    2019-12-11 v1.11 Hooks at the very end of document (HO)
rerunfilecheck.sty    2019/12/05 v1.9 Rerun checks for auxiliary files (HO)
uniquecounter.sty    2019/12/15 v1.4 Provide unlimited unique counter (HO)
   puenc.def    2020/01/14 v7.00d Hyperref: PDF Unicode definition (HO)
titlesec.sty    2019/10/16 v2.13 Sectioning titles
 titleps.sty
apptools.sty    2012/11/28 v1.0 Tools for customizing appendices
appendix.sty    2020/02/08 v1.2c extra appendix facilities
  pifont.sty    2005/04/12 PSNFSS-v9.2a Pi font support (SPQR) 
    upzd.fd    2001/06/04 font definitions for U/pzd.
    upsy.fd    2001/06/04 font definitions for U/psy.
  manfnt.sty    1999/07/010.2LaTeX2e manfnt package
  bbding.sty    1999/04/15 v1.01 Dingbats symbols
tcolorbox.sty    2019/11/15 version 4.22 text color boxes
verbatim.sty    2019/11/10 v1.5r LaTeX2e package for verbatim enhancements
 environ.sty    2014/05/04 v0.3 A new way to define environments
trimspaces.sty    2009/09/17 v1.1 Trim spaces around a token list
  adforn.sty    2019/10/13 v1.1b adforn CFR
uornementsadf.fd
fancyhdr.sty    2019/01/31 v3.10 Extensive control of page headers and footers
listings.sty    2019/09/10 1.8c (Carsten Heinz)
 lstmisc.sty    2019/09/10 1.8c (Carsten Heinz)
listings.cfg    2019/09/10 1.8c listings configuration
lstlang1.sty    2019/09/10 1.8c listings language file
lstlang2.sty    2019/09/10 1.8c listings language file
lstlang3.sty    2019/09/10 1.8c listings language file
lstlang1.sty    2019/09/10 1.8c listings language file
lstlang2.sty    2019/09/10 1.8c listings language file
lstlang3.sty    2019/09/10 1.8c listings language file
lstlang1.sty    2019/09/10 1.8c listings language file
lstlang2.sty    2019/09/10 1.8c listings language file
lstlang3.sty    2019/09/10 1.8c listings language file
 lstmisc.sty    2019/09/10 1.8c (Carsten Heinz)
      bm.sty    2019/07/24 v1.2d Bold Symbol Support (DPC/FMi)
supp-pdf.mkii
epstopdf-base.sty    2020-01-24 v2.11 Base part for package epstopdf
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
footmisc.sty    2011/06/06 v5.5b a miscellany of footnote facilities
 nameref.sty    2019/09/16 v2.46 Cross-referencing by name of section
refcount.sty    2019/12/15 v3.6 Data extraction from label references (HO)
gettitlestring.sty    2019/12/15 v1.6 Cleanup title references (HO)
elegantbook-dependancies-2.out
elegantbook-dependancies-2.out
 ***********

至于包与包之间的依赖关系,好像暂时还没有好的解决办法。

有这个也解决一半问题了,至少知道使用 elegantbook 文类后,已经加载了哪些宏包,就没必要自己在导言区再去加载一遍,万一又引起冲突