3

I'm using the following script in beamer to locate our logo at the right-most corner of all pages in the presentation,

\begin{textblock}{5}(10.0, \dimexpr 0.5\headheight - 7.5pt )
   \includegraphics[width=40pt]{logo.png}
\end{textblock}

The placement of the textblock in the page is fine, however there is an undesired equal sign (see added image) in the page. It's the first time I use \dimexpr, do I make a mistake?

enter image description here

I think this undesired equal sign comes from \dimexpr 0.5\headheight - 7.5pt this part of script. Because when I replace it with, for example, 1, the equal sign goes.

I just tried to do something \dimexpr 15pt - 7.5pt it still gives an undesired equal sign.

  • 1
    Please, convert it to a full Minimal (non-)Working Example. – yo' Nov 20 '12 at 8:48
  • 1
    You probably also get some compilation errors: never overlook them. – egreg Nov 20 '12 at 9:18
  • @egreg Yes, I have some compilation errors too. However, my deadline is coming and I pretend like there no warnings. I really wish I had time to create a perfect template. – Sait Nov 20 '12 at 9:21
  • Error messages and warnings are different things; an error can lead to very unexpected results, as you found out. – egreg Nov 20 '12 at 9:23
3

Another option is to use the starred version of the textblock environment. This way, you can indicate the unit and, when the calc package is loaded, you can do your usual calc computations.

\documentclass[10pt]{beamer}
\usetheme{Warsaw}
\usepackage{calc}
\usepackage{textpos}
\title{Topic name}
\author{My name}
\date{\today}
\begin{document}
\begin{frame}
\maketitle
\begin{textblock*}{5cm}(10pt,\dimexpr0.5\headheight - 7.5pt)
   \includegraphics[width=40pt]{example-image}
\end{textblock*}
\end{frame}
\end{document}
1

I suppose that testblock doesn't accept values with a unit. You have to strip it:

\PassOptionsToPackage{demo}{graphicx}%% only for demo
\documentclass[12pt]{beamer}
\usepackage{textpos}
\begin{document}

\makeatletter
\def\foo{\strip@pt\dimexpr0.5\headheight - 5pt\relax}
\makeatother
\begin{textblock}{5}(10.0,\foo)
   \includegraphics[width=40pt]{logo.png}
\end{textblock}

\end{document}

However, instead of using textblock you should redefine your header which is possible with the default macros which beamer provides.

  • This manipulation generates an undesired @pt 0.5= – Sait Nov 20 '12 at 9:15

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.