4

This is the code for beamer's sidebar:

\documentclass{beamer}
\usepackage{tikz,graphicx} 

\title{Title}
\author{My name}
\institute{My institute}

\useoutertheme[right,height=0pt,width=0.12\paperwidth]{sidebar}
\setbeamertemplate{sidebar canvas right}[horizontal shading]    [left=blue!10!white,right=white] 

\makeatletter
\addtobeamertemplate{sidebar right}{}{%
\begin{tikzpicture}[remember picture,overlay] % 
    \node[anchor=north east,xshift=0.8pt,yshift=2pt] at (current page.north east) {\includegraphics[width=0.11\paperwidth]{logo.png}};
\end{tikzpicture}
}
\makeatother

\begin{document}
\begin{frame}[plain]
\titlepage
\end{frame}

\begin{frame}
Frame content
\end{frame}

\end{document}

I want the logo image file(logo.png) to be transparent at the top of the sidebar and not cover the texts, what should I do?

  • 2
    Welcome to TeX.sx. can you please give more details as to what you mean by transparent? do you mean that some element of image should be transparent, such as the background? Or do you want the whole image to not be fully opaque? – ArTourter Jun 5 '16 at 15:26
  • in which case, the answer from @Rmano is correct. jpg doesn't support transparency, you need to edit your image and create the transparency layer and save it as a png instead. – ArTourter Jun 6 '16 at 10:36
  • such as this logo:logo.png – wei robot026a Jun 7 '16 at 13:46
  • That logo has a correct alpha layer and for me your MWE is correctly compiled withthe tranparency (see last edit in my answer) – Rmano Jun 7 '16 at 13:57
  • Could we move the title text down and under the logo picture? – wei robot026a Jun 7 '16 at 14:33
4

The jpg format has no idea of what transparency is. If you create a png image with a proper alpha (transparent) layer, it should simply work.

I have

\addtobeamertemplate{frametitle}{}{%
\begin{textblock*}{100mm}(.98\textwidth,0.1cm)
    \includegraphics[height=0.9cm]{logo-eb}
\end{textblock*}}

(using \usepackage[absolute,overlay]{textpos}) and it works nicely:

enter image description here

(and the image is a .png with the parts external to the circle marked as transparent).

enter image description here

update

With the new MWE, and your logo, the result is satisfactory:

enter image description here

If you want that also the orange part (which is not transparent in the .png) you can

  1. edit the PNG image so that it is partially transparent, or

  2. add opacity like this:

       \node[anchor=north east,xshift=0.8pt,yshift=2pt,
        opacity=0.3] at (current page.north east) {\includegraphics[width=0.11\paperwidth]{logo.png}};
    

    to obtain:

    enter image description here

  3. and/or move the logo down (for example with yshift=-0.11\paperwidth:

    enter image description here

  • I have tried this. The logo can be transparent. However, The logo positon cann‘t work well in sidebar. – wei robot026a Jun 6 '16 at 11:33
  • @weirobot026a --- difficult to say. If you can post a complete minimal working example (MWE) maybe we can help... – Rmano Jun 6 '16 at 13:56
  • I have slove it by this:\makeatletter \addtobeamertemplate{sidebar right}{}{% \begin{tikzpicture}[remember picture,overlay] % \node[anchor=south east,xshift=0.8pt,yshift=2pt] at (current page.south east) {\includegraphics[width=0.11\paperwidth]{logo.png}}; \end{tikzpicture} } \makeatother.Thank you. – wei robot026a Jun 7 '16 at 11:10
  • Are you sure your logo.png has an alpha layer? - the fact that the png can have transparency does not mean that it automatically has it... if you post a question with an MWE and the logo.png I'll try to help you. – Rmano Jun 7 '16 at 12:02
  • I have changed my question. And I want the logo file at the top of sidebar.What should I do? Thanks. – wei robot026a Jun 7 '16 at 13:10

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.