1

I've been reading the tikz manual, and I was able to generate this MWE:

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{tikz}
\usetikzlibrary{calc, intersections,through,backgrounds,positioning}
\usepackage{pgfpages,ifthen}
\usepackage{blindtext}
\usepackage{multicol}
\usepackage{amsmath,amssymb,amsthm,mathrsfs,bbm,bm}
\usepackage{graphicx,subcaption,float,enumerate}
\usetheme[progressbar=frametitle]{metropolis}
\setbeamertemplate{frame numbering}[none]
\metroset{block=fill}
\setbeamercovered{transparent=15}

\title{Test Presentation}
\subtitle{a quick one}
\date{}
\author{}
\institute{}

\begin{document}
\maketitle

\begin{frame}
    \begin{tikzpicture}[remember picture,overlay] 
    \draw[very thick,red] (current page.west) rectangle (current
    page.south) ;
    \draw[very thick,blue] (current page.north west) rectangle (current
    page.center);
    \end{tikzpicture}
\end{frame}

\begin{frame}{A frame title}
    \begin{tikzpicture}[remember picture,overlay] 
    \draw[very thick,red] (current page.west) rectangle (current
    page.south) ;
    \draw[very thick,blue] (current page.north west) rectangle (current
    page.center);
    \end{tikzpicture}
\end{frame}


\end{document}

I'd like some help with the following:

  1. How can I name the blue and red nodes, so that I can now anchor things to them later on?
  2. How can I anchor these nodes to the bottom of the header? I know I need to do some calculations, and I am reading section 13.5 of the Tikz manual to figure it out. What I need to do is anchor to something like (current page.west - headerwidth), etc.
  3. I would like to generate a few frames with "sample slide layouts", things like two vertical panels on the left and one long one the right, etc. Right now, I want to do this manually, and just keep a sample_slides.tex file on my computer with the code for all of these layouts that I can then just anchor new content to. Does this kind of thing make sense?

Note: I've also tagged beamer because I am sp[ecifically asking about a beamer slide header

user79950
  • 303
  • 1
    You don't need graphicx and enumerate, beamer loads them for you. And float makes little sense in a documentclass that does not have floats. – samcarter_is_at_topanswers.xyz Apr 24 '18 at 15:57
  • thanks @samcarter (its a copy/paste from other docs). Ill remove – user79950 Apr 24 '18 at 16:09
  • 2
    Or you could use fit to fit the rectangle coordinates: \node[draw,blue,fit=(current page.north west) (current page.center)] (bluenode){};. You'd need to load the fit library for that. –  Apr 24 '18 at 16:17

1 Answers1

2

For questions 1 and 2:

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{tikz}
\usetikzlibrary{calc, intersections,through,backgrounds,positioning}
\usepackage{pgfpages,ifthen}
\usepackage{blindtext}
\usepackage{multicol}
\usepackage{amsmath,amssymb,amsthm,mathrsfs,bbm,bm}
\usepackage{subcaption}
\usetheme[progressbar=frametitle]{metropolis}
\setbeamertemplate{frame numbering}[none]
\metroset{block=fill}
\setbeamercovered{transparent=15}

\title{Test Presentation}
\subtitle{a quick one}
\date{}
\author{}
\institute{}

\newlength{\test}
\makeatletter
\setlength{\test}{\totalheightof{%
  \begin{beamercolorbox}[%
      wd=\paperwidth,%
      sep=0pt,%
      leftskip=\metropolis@frametitle@padding,%
      rightskip=\metropolis@frametitle@padding,%
    ]{frametitle}%
  \metropolis@frametitlestrut@start%
  TJ%
  \nolinebreak%
  \metropolis@frametitlestrut@end%
  \end{beamercolorbox}%
}}
\addtolength{\test}{\metropolis@progressinheadfoot@linewidth}
 \makeatother

\begin{document}
\maketitle

\begin{frame}
    \begin{tikzpicture}[remember picture,overlay] 
    \draw[very thick,red] (current page.west) rectangle (current
    page.south) node (rednode) {};
        \node [above of = rednode] {test};
    \draw[very thick,blue] (current page.north west) rectangle (current
    page.center);
    \end{tikzpicture}
\end{frame}

\begin{frame}{A frame title}
    \begin{tikzpicture}[remember picture,overlay] 
    \draw[very thick,blue] (current page.north west)++(0,-\test) rectangle (current page.center);
    \end{tikzpicture}
\end{frame}


\end{document}

I am not sure if I understand your third question, but maybe https://ctan.org/pkg/gridslides is what you are looking for?


I have the feeling that you are asking an XY-question. If your ultimate goal is to fill these rectangles with text, I would say: don't do that - let beamer do the work for you and you will get slides that are normally perfectly aligned and and only very rarely need manual intervention. For example if you want a text block at the top and the bottom of the left hand site, you could use columns:

\documentclass{beamer}
\usetheme[progressbar=frametitle]{metropolis}

\begin{document}

\begin{frame}
    \frametitle{title}
    \begin{columns}[t]
        \begin{column}{.48\textwidth}
                Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, 
        \end{column}
        \begin{column}{.48\textwidth}
                whatever should be on the right
        \end{column}        
    \end{columns}
    \vfill
    \begin{columns}[t]
        \begin{column}{.48\textwidth}
                Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, 
        \end{column}
        \begin{column}{.48\textwidth}

        \end{column}        
    \end{columns}   
\end{frame}


\end{document}

enter image description here

  • thanks for your answer. How can I place some text in what I think of as the red boxes center, top left corner, etc.? – user79950 Apr 24 '18 at 16:22
  • 2
    @user79950 make to columns and forget about the boxes? – samcarter_is_at_topanswers.xyz Apr 24 '18 at 16:22
  • 1
    @user79950 I somehow have the feeling you are asking an XY question, see https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem – samcarter_is_at_topanswers.xyz Apr 24 '18 at 16:24
  • 1
    @marmot You are of course absolutely correct. I wanted to say 2 columns, sorry fr that! – samcarter_is_at_topanswers.xyz Apr 24 '18 at 16:34
  • @samcarter that's an interesting point. My last three questions have been about the same essential problem: Positioning things absolutely on a beamer slide. In this question[1] I specifically said "this question is not specifically about this MWE, just in general how to look at a slide, pick a point with my eye, and put something there exactly and absolutely in tikz." I didn't really get a satisfying answer/ to that point though. So I did more research and came up with this approach.

    [1] https://tex.stackexchange.com/questions/427691/positioning-and-coordinates-in-tikzbeamer

    – user79950 Apr 24 '18 at 16:53
  • My general question is, what if I want two "columns" stacked on top of each other taking up the left half of the frame, while a picture takes up the right? etc. Out of all the questions I've asked, I can summarize all answers as "let beamer handle the placement". This is difficult for me, as I have said before I am very very particular about placement. I look at a blank slide and SEE what I want, and where I want it. The workflow for beamer seems to be put what you want to display in and then SEE what beamer gives you, and adjust IF YOU MUST. – user79950 Apr 24 '18 at 16:56
  • 2
    @user79950 Oh, in this case I totally agree with marmots comment: https://tex.stackexchange.com/questions/427691/positioning-and-coordinates-in-tikzbeamer#comment1070293_427701 – samcarter_is_at_topanswers.xyz Apr 24 '18 at 16:57
  • yes I guess I'm just being hardheaded when it comes to surrendering the control that came with powerpoint where I literally place something exactly where I want it. – user79950 Apr 24 '18 at 17:00
  • 2
    @user79950 The point is: beamer is also very particular about placement: all elements are perfectly aligned, respect the margins etc. I myself also consider my very picky about the positioning and using beamer is therefore perfect for me – samcarter_is_at_topanswers.xyz Apr 24 '18 at 17:00
  • 1
    @user79950 Powerpoint does not give you absolut control, you can place things to where it looks like they might be aligned as good as you are able to see them, but in beamer they are exactly aligned. – samcarter_is_at_topanswers.xyz Apr 24 '18 at 17:02
  • Yes, beamer and tikz let you perfectly align things, but only after arduous iteratively compiling your documents! I think you're drastically understating the role of \vspace{-3mm}-type lines in slides to "undo an indent" or "push that down a bit" etc. As opposed to powerpoint where I just drag it somewhere and it might actually be "off" by a few milimeters imperceptible to the human eye (especially the audience). – user79950 Apr 24 '18 at 17:06
  • 1
    @user79950 beamer does not indent line :) But most of the times, such lines are just a cure for some other underlying problem. (and yes, I use them myself if I am too lazy to fix the problem) – samcarter_is_at_topanswers.xyz Apr 24 '18 at 17:12