Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Say I want to find all of the packages of the form

tikzlibrary*.code.tex

Is there any way I can retrieve a list of all such files available in TeX's path in a portable way, hopefully one that doesn't require a special compilation sequence?

My actual task has nothing to do with TikZ—so TikZ-specific answers will probably not work.

share|improve this question
add comment

2 Answers 2

up vote 11 down vote accepted

If you restrict to packages that have been hashed by kpathsea path searching library then you can do

grep "tikzlibrary.*code\.tex" `kpsewhich --all ls-R`

replacing grep by any plain text file searching tool if you are on a machine without grep. kpsewhich is used as a standalone front-end of the kpathsea library

$ 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
share|improve this answer
    
+1 I was disappointed when I found I couldn't feed kpsewhich a regex directly and so looked at tlmgr instead. But yours sill find more stuff if you've got relevant files in the local tree. –  cfr Jan 27 at 0:41
    
i think you've got a glitch in your grep statement -- need to invert the .* to *. -- but i'm not about to change your code! –  barbara beeton Jan 27 at 14:30
    
@barbarabeeton no it's a regex not a filename glob library*. would look for a sequence of 0 or more y –  David Carlisle Jan 27 at 16:17
add comment

This is dependent on TeX Live but does not require grep:

tlmgr search --file '.*tikzlibrary.*\.code\.tex'

produces:

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

Unlike David Carlisle's solution, though, this won't pick up stuff from the local texmf tree.

[I think it is kind of neat you can do this with tlmgr, though, so I'm posting it anyway.]

share|improve this answer
1  
+1 also of course your version actually shows the paths:-) (I could use some more arcane commandline to extract the full path from ls-R listings, but in oractice I'd just look in an editor.. –  David Carlisle Jan 27 at 0:34
    
@DavidCarlisle If you just want the names of the files, though, that might be seen as a disadvantage! I guess it depends what you are doing with it. I kind of like that it shows me the package names, too. But again, that might be another complication if you are trying to parse it in a script. –  cfr Jan 27 at 0:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.