[Tex/LaTex] find the source code of beamer in a MiKTeX installation

beamermiktexsourcecode

I'm looking for the source code of default beamer themes (*.sty) for studying purpose.

A file content search for keywords like \setbeamertemplate only returns texworks.exe.

If these definitions are only shipped as binaries, is there another way to install the source?

Best Answer

The files loaded by TeX to use a LaTeX document class such as beamer are text files: there are no binaries involved. If you know the name of the file TeX is loading you can find it using kpsewhich. For example, the main beamer class file is called beamer.cls, and

kpsewhich beamer.cls

at the Command Line/Terminal will find it. On my system it gives

c:/texlive/2014/texmf-dist/tex/latex/beamer/beamer.cls

Inside the beamer folder you will then find other files that come with it: a lot in the case of beamer, perhaps no additional files for a lot of packages. (The set up for beamer is pretty complex: there are a lot of files to read if you want to find a particular piece of code.)

(Class files all have extension .cls, package files all have extension .sty that's built-in to the LaTeX kernel, which is called latex.ltx should you wish to read that! The beamer theme files have a naming pattern beamer<type>theme<name>.sty, so for example the 'Seagull' colour theme is defined by beamercolorthemeseagull.sty.)

Some document classes and packages use a source/extracted approach where the sources may not be directly usable. They might be found using kpsewhich, for example

kpsewhich siunitx.dtx

gives me

c:/texlive/2014/texmf-dist/source/latex/siunitx/siunitx.dtx

Note that beamer doesn't use such sources so this won't show anything. Also notice that MiKTeX and TeX Live have a different approach to the source files: TeX Live includes them all unzipped and so easy-to-find, while in MiKTeX most of the sources are compressed inside <installation root>\source.

As noted in a comment, the .log file generated by TeX includes the location of each file loaded. MiKTeX always gives the full path for these, while TeX Live gives relative paths where appropriate (making it a bit easier to read in some cases).