TransWikia.com

Relative path to .sty theme - nested {color,inner,outer} theme files

TeX - LaTeX Asked by chrisb2244 on February 1, 2021

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

One Answer

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

Answered by chrisb2244 on February 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP