![LaTeX 是否有可用的工具可以搜索带有通配符的文件?](https://linux22.com/image/283201/LaTeX%20%E6%98%AF%E5%90%A6%E6%9C%89%E5%8F%AF%E7%94%A8%E7%9A%84%E5%B7%A5%E5%85%B7%E5%8F%AF%E4%BB%A5%E6%90%9C%E7%B4%A2%E5%B8%A6%E6%9C%89%E9%80%9A%E9%85%8D%E7%AC%A6%E7%9A%84%E6%96%87%E4%BB%B6%EF%BC%9F.png)
假设我想找到所有以下形式的包
tikzlibrary*.code.tex
有没有什么方法可以以可移植的方式检索 TeX 路径中所有可用的此类文件的列表,希望不需要特殊的编译序列?
我的实际任务与 TikZ 无关 - 因此特定于 TikZ 的答案可能不起作用。
答案1
如果你限制使用已通过帕西阿路径搜索库然后你可以做
grep "tikzlibrary.*code\.tex" `kpsewhich --all ls-R`
如果你的机器没有 grep,可以用任何纯文本文件搜索工具替换 grep。用作库kpsewhich
的独立前端kpathsea
$ grep "tikzlibrary.*code\.tex" `kpsewhich --all ls-R`
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarybayesnet.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrary3d.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryarrows.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryautomata.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarybackgrounds.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycalc.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycalendar.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarychains.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydecorations.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydecorations.footprints.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydecorations.fractals.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydecorations.markings.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydecorations.pathmorphing.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydecorations.pathreplacing.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydecorations.shapes.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydecorations.text.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryer.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryfadings.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryfit.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryfixedpointarithmetic.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryfolding.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryfpu.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryintersections.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarylindenmayersystems.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarymatrix.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarymindmap.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypatterns.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypetri.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryplothandlers.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryplotmarks.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypositioning.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryscopes.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshadings.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshadows.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshapes.arrows.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshapes.callouts.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshapes.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshapes.gates.logic.IEC.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshapes.gates.logic.US.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshapes.geometric.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshapes.misc.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshapes.multipart.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshapes.symbols.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarysnakes.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryspy.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarysvg.path.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarythrough.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarytopaths.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarytrees.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryturtle.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycircuits.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycircuits.ee.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycircuits.ee.IEC.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycircuits.logic.CDH.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycircuits.logic.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycircuits.logic.IEC.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycircuits.logic.US.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydatavisualization.3d.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydatavisualization.barcharts.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydatavisualization.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydatavisualization.formats.functions.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydatavisualization.polar.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydatavisualization.sparklines.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarygraphs.basic.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarygraphs.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.colormaps.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.dateplot.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.external.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.groupplots.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.patchplots.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.polar.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.smithchart.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.statistics.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.ternary.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.units.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarydateplot.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryhobby.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryocgx.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryexternal.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryshadows.blur.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplots.clickable.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarypgfplotsclickable.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryrulercompass.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryswitching-architectures.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarycalligraphy.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibraryknots.code.tex
/usr/local/texlive/2013/texmf-dist/ls-R:tikzlibrarytikzmark.code.tex
答案2
这取决于 TeX Live,但不需要grep
:
tlmgr search --file '.*tikzlibrary.*\.code\.tex'
生成:
aobs-tikz:
texmf-dist/tex/latex/aobs-tikz/tikzlibraryoverlay-beamer-styles.code.tex
hobby:
texmf-dist/tex/latex/hobby/tikzlibraryhobby.code.tex
ocgx:
texmf-dist/tex/latex/ocgx/tikzlibraryocgx.code.tex
pgf:
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.IEC.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.ee.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.CDH.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.IEC.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.US.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/circuits/tikzlibrarycircuits.logic.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.3d.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.barcharts.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.formats.functions.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.polar.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.sparklines.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.basic.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrary3d.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryarrows.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautomata.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybackgrounds.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalendar.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarychains.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.footprints.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.fractals.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.markings.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.pathmorphing.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.pathreplacing.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.shapes.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarydecorations.text.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryer.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfixedpointarithmetic.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfolding.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfpu.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarylindenmayersystems.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymatrix.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymindmap.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypatterns.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypetri.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryplothandlers.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryplotmarks.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryscopes.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshadings.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshadows.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.arrows.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.callouts.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.gates.logic.IEC.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.gates.logic.US.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.geometric.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.misc.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.multipart.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.symbols.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarysnakes.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryspy.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarysvg.path.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarythrough.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytrees.code.tex
texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryturtle.code.tex
texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex
pgf-blur:
texmf-dist/tex/latex/pgf-blur/tikzlibraryshadows.blur.code.tex
pgfplots:
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.colormaps.code.tex
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.polar.code.tex
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.statistics.code.tex
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.ternary.code.tex
texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex
texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex
texmf-dist/tex/generic/pgfplots/oldpgfplotscompatib/tikzlibrarydateplot.code.tex
texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex
texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplotsclickable.code.tex
rulercompass:
texmf-dist/tex/latex/rulercompass/tikzlibraryrulercompass.code.tex
sa-tikz:
texmf-dist/tex/latex/sa-tikz/tikzlibraryswitching-architectures.code.tex
spath3:
texmf-dist/tex/latex/spath3/tikzlibrarycalligraphy.code.tex
texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex
tikz-bayesnet:
texmf-dist/doc/latex/tikz-bayesnet/tikzlibrarybayesnet.code.tex
tikzmark:
texmf-dist/tex/latex/tikzmark/tikzlibrarytikzmark.code.tex
然而,与大卫卡莱尔的解决方案不同的是,这不会从本地texmf
树中获取东西。
[不过,我认为用 来做这件事很不错tlmgr
,所以我还是将其发布出来了。]