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.

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?

share|improve this question
2  
What sort of search did you do? By 'sources' I take it you actually mean the files used by TeX at run-time, not for example the source files for the beamer documentation? Probably you are looking for kpsewhich beamer.cls or similar. –  Joseph Wright Aug 22 at 8:48
1  
If you compile a Beamer document, you can see a few of the files used by studying the log file –  cmhughes Aug 22 at 8:56
1  
every time you process any latex document the full path of every included file is printed to the log file. –  David Carlisle Aug 22 at 9:49

2 Answers 2

up vote 7 down vote accepted

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).

share|improve this answer
    
Thanks for the clear and detailed introduction. –  Jens Piegsa Aug 22 at 10:40

It's texmf\source\beamer-src.tar.bz2, where texmf has to be replaced with the main root of your installation — usually C:\Program Files\MiKTeX 2.9 for a 64 bit installation, or C:\Program Files (x86)\MiKTeX 2.9 for a 32 bit installation.

Generally speaking (almost) all sources are installed in Main Root\source. The exact location can be checked, for a particular package, with MiKTeX Package Manager: right-click on the package name and select the Files tab; a popup window will show the list of all files in the package, ordered by path, such as this one:

enter image description here

share|improve this answer
    
Thank you. The MiKTeX Package Manager shows a relative path: texmf\tex\latex\beamer\base\ (wherein texmf seems to be a placeholder), while kpsewhich gives an absolute path, like: C:/Users/Jens/AppData/Roaming/MiKTeX/2.9/tex/latex/beamer/base/beamer.cls. –  Jens Piegsa Aug 22 at 10:38
1  
Such a path corresponds to a personal installation. For an installation for every user, texmf is C:\Program Files\MiKTeX by default. –  Bernard Aug 22 at 10:57

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.