Skip to content

peterpf/beamer-material-theme

Repository files navigation

LaTeX Beamer Material Theme

A beamer theme inspired by Google's material design with adjustable colors and side-by-side layout.

Installation

Prerequisite: LuaTex and the roboto font are required to compile the presentation.

Download the repository into your working directory and rename it to theme. Continue with the following steps:

  • Copy example.tex from theme/src folder to the same levels as the theme folder. Do the same for the theme/images folder. Your working directory should look like this:

    .
    ├── images/
    ├── theme/
    |   ├── src/
    |   ├── example.tex
    ├── example.tex
    ├── ...
  • Open the example.tex file and adapt:

    • References to the theme:
    \usepackage{src/beamerthemematerial} % replace this
    \usepackage{theme/src/beamerthemematerial} % with this
    • Refences to the images folder:

      \includegraphics[width=0.8\textwidth]{theme/images/tensorflow.pdf}
  • Open theme/src/beamerthemematerial.sty and adapt the paths for the styles:

    \usepackage{theme/src/material_colors}
    \usepackage{theme/src/beamerinnerthemematerial}
    \usepackage{theme/src/beamerouterthemematerial}
    \usepackage{theme/src/beamercolorthemematerial}
    
    \directlua {
      local settings = require("theme/src/settings")
      local Utils = require("theme/src/Utils")
    }
  • Open theme/src/settings.lua and adapt the references:

    local Utils = require("theme/src/Utils")
    local config = require("theme/src/config")
  • Open theme/src/Utils.lua and adapt the references:

    local ColorUtils = require("theme/lib/colors")

Use the example.tex file as a starting point for your presentation (you can rename it to whatever you'd like).

Include as git submodule

Go to your working directory and clone the beamer-material-theme repository into the folder theme with

git submodule add [email protected]:peterpf/beamer-material-theme.git theme

Follow the steps described in the Installation section.

Theme Configuration

Colors can be adapted via the config.lua. Undefined complementary colors will be calculated based on their respective main colors. Predefined themes are already there, choose the one you want by changing the return value of config.lua, or create your own:

return lightBlue
-- or
return darkPurple

Working with Visual Studio Code

It is possible to automatically build the beamer presentation with Visual Studio Code (VSCode). The following extensions are necessary:

Configure the extensions by opening Command Palete -> Open Default Settings (JSON) and add or update the following lines:

"latex-workshop.latex.tools": [
  {
    "name": "xelatexmk",
    "command": "latexmk",
    "args": [
      "-synctex=1",
      "-interaction=nonstopmode",
      "-file-line-error",
      "-xelatex",
      "-outdir=%OUTDIR%",
      "%DOC%"
    ],
    "env": {}
  },
  {
    "name": "lualatexmk",
    "command": "latexmk",
    "args": [
      "-synctex=1",
      "-interaction=nonstopmode",
      "-file-line-error",
      "-lualatex",
      "-outdir=%OUTDIR%",
      "%DOC%"
    ],
    "env": {}
  },
]

"latex-workshop.latex.recipes": [
  {
    "name": "latexmk (xelatex)",
    "tools": [
      "xelatexmk"
    ]
  },
  {
    "name": "latexmk (lualatex)",
    "tools": [
      "lualatexmk"
    ]
  },
]

After saving the User Settings (JSON) file you should be able to see a meny entry in the LaTeX Workshop tool:

Viewing the build recipes of the LaTeX Workshop extension

Compiling the presentation with docker

If you don't want to install dependencies and rather use docker to produce a PDF file from your LaTeX file, follow the instructions below.

Execute following commands in the directory of the cloned repository:

docker build . -t latex-beamer
docker run -v $PWD:/data/ latex-beamer example.tex

Replace example.tex with your presentation's tex file. Execute the docker command mentioned above in the project root folder.

Important Notes

  • Packages that should not be included
    • graphicx or graphics as they are already included in beamer
    • transparency, svg as it messes with the tikz package's fill opacity (shadows won't be displayed correctly)

Shoutouts