0

I've been working through the detailed answer to this question: Design a custom Beamer theme from scratch and have a question regarding paths.

I'm building a theme to be used in multiple presentations. I have a directory structure (git repo) as follows:

|- Presentations (top-dir)
|
|\_.git (and subfolders)
|
|\_Presentation1
|  |-presentation1.tex
|  \-presentation1.{aux,pdf} etc
|
|\_Presentation2
|  |-presentation2.tex
|  \-presentation2.{aux,pdf} etc
|
\_Theme
   |-beamerthememytheme.sty
   |-beamerinnerthememytheme.sty
   |-beamerouterthememytheme.sty
   \-beamercolorthememytheme.sty

I seem to have a few options to use this theme:

  • Symbolically link all 4 files into each presentation. Adds to setup cost, can complicate handling with git, but works nicely and doesn't require peculiar handling in the theme files

  • Abandon \usetheme{mytheme} and use \usepackage{../Theme/beamerthememytheme} in the presentationN.tex file. This also works for the main .tex file, but seems to require that my theme file now reads \usepackage{../Theme/beamerinnerthememytheme} instead of the simpler \useinnertheme{mytheme}

  • Remove extra files. Use only beamerthememytheme.sty and copy the contents of {inner,outer,color} themes into that file. I can also rename to make this simpler by removing the leading beamertheme label, since I have to use \usepackage anyway. This seems undesirable for readability/maintainability, but I suppose is a tradeoff if the alternatives are complicated.

Is there any way to specify from a .sty file the part that it is included with? In my case, I would imagine I could then go ahead and include <unknown-inclusion-relative-path>/beamerinnerthememytheme without concern that I might have presentations want to include this from outside of this directory structure (not a major problem, but would be nice to avoid limiting possibilities whilst I still have ability to easily change).

  • 1
    I would put the theme files (with a better name than "mytheme") in a folder themestexmf/tex/latex/mythemes/... and then add themestexmf as a new root to the tex system. – Ulrike Fischer Sep 4 at 9:29
  • You can define the TEXINPUTS environment variable: TEXINPUTS=".//;../Theme//;" – Paul Gaborit Oct 5 at 7:35
0

Following the suggestion of Ulrike Fischer in the comments to the question, I ran the following command using the Windows Command Prompt.

initexmf --register-root="%cd%"

from the top-level directory, having moved the them file into the directory

top-level-dir/text/latex/themename

and I can now successfully use \usetheme{themename}.

The command can be run from a .bat file or similar, making it easier to carry out in a newly cloned repository.

An equivalent Linux script might be something like (untested):

initexmf --register-root="$(pwd)"

I used the command prompt to avoid possible issues when my 'Linux' prompt is in fact via mingw and git-bash (which often causes path problems converting to/from Windows/Linux).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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